Skip to content

Commit

Permalink
fix: hex to to bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Sep 30, 2024
1 parent ac54169 commit ad3b3b4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
8 changes: 1 addition & 7 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1875,13 +1875,7 @@ func (a *Aggregator) getWitness(batchNumber uint64, url string, fullWitness bool
return nil, err
}

witnessString := strings.TrimLeft(witness, "0x")
if len(witnessString)%2 != 0 {
witnessString = "0" + witnessString
}
bytes := common.Hex2Bytes(witnessString)

return bytes, nil
return common.FromHex(witness), nil
}

func printInputProver(logger *log.Logger, inputProver *prover.StatelessInputProver) {
Expand Down
1 change: 1 addition & 0 deletions sequencesender.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion sequencesender/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *SequenceSender) getBatchFromRPC(batchNumber uint64) (*rpcbatch.RPCBatch
return nil, fmt.Errorf("error unmarshalling the batch from the response calling zkevm_getBatchByNumber: %w", err)
}

rpcBatch, err := rpcbatch.New(batchNumber, zkEVMBatchData.Blocks, common.Hex2Bytes(zkEVMBatchData.BatchL2Data),
rpcBatch, err := rpcbatch.New(batchNumber, zkEVMBatchData.Blocks, common.FromHex(zkEVMBatchData.BatchL2Data),
common.HexToHash(zkEVMBatchData.GlobalExitRoot), common.HexToAddress(zkEVMBatchData.Coinbase), zkEVMBatchData.Closed)
if err != nil {
return nil, fmt.Errorf("error creating the rpc batch: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion sequencesender/sequencesender.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (s *SequenceSender) populateSequenceData(rpcBatch *rpcbatch.RPCBatch, batch
// Decode batch to retrieve the l1 info tree index
batchRaw, err := state.DecodeBatchV2(rpcBatch.L2Data())
if err != nil {
s.logger.Errorf("Failed to decode batch data, err: %v", err)
s.logger.Errorf("Failed to decode batch data for batch %d, err: %v", batchNumber, err)
return err
}

Expand Down

0 comments on commit ad3b3b4

Please sign in to comment.