Skip to content

Commit

Permalink
Fix decoding sequenced batches (provide the correct fork id)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Mar 12, 2024
1 parent 8c7f9c8 commit 811e5b3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer
return nil, err
}

return decodeSequencedBatches(smcAbi, txData, state.FORKID_ETROG, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da)
return decodeSequencedBatches(smcAbi, txData, state.FORKID_ELDERBERRY, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da)
}

func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash,
Expand All @@ -1297,7 +1297,7 @@ func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer commo
return nil, err
}

return decodeSequencedBatches(smcAbi, txData, state.FORKID_ELDERBERRY, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da)
return decodeSequencedBatches(smcAbi, txData, state.FORKID_ETROG, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da)
}

// decodeSequencedBatches decodes provided data, based on the funcName, whether it is rollup or validium data and returns sequenced batches
Expand Down Expand Up @@ -1343,7 +1343,7 @@ func decodeSequencedBatches(smcAbi abi.ABI, txData []byte, forkID uint64, lastBa
Coinbase: coinbase,
PolygonRollupBaseEtrogBatchData: &s,
}
if forkID == state.FORKID_ELDERBERRY {
if forkID >= state.FORKID_ELDERBERRY {
batch.SequencedBatchElderberryData = &SequencedBatchElderberryData{
MaxSequenceTimestamp: maxSequenceTimestamp,
InitSequencedBatchNumber: initSequencedBatchNumber,
Expand Down Expand Up @@ -1385,7 +1385,7 @@ func decodeSequencedBatches(smcAbi abi.ABI, txData []byte, forkID uint64, lastBa
Coinbase: coinbase,
PolygonRollupBaseEtrogBatchData: &s,
}
if forkID == state.FORKID_ELDERBERRY {
if forkID >= state.FORKID_ELDERBERRY {
elderberry := &SequencedBatchElderberryData{
MaxSequenceTimestamp: maxSequenceTimestamp,
InitSequencedBatchNumber: initSequencedBatchNumber,
Expand Down Expand Up @@ -1816,6 +1816,15 @@ func (etherMan *Client) EstimateGas(ctx context.Context, from common.Address, to
})
}

func (etherMan *Client) Call(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte, blockNum *big.Int) ([]byte, error) {

Check failure on line 1819 in etherman/etherman.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported method Client.Call should have comment or be unexported (revive)
return etherMan.EthClient.CallContract(ctx, ethereum.CallMsg{
From: from,
To: to,
Value: value,
Data: data,
}, blockNum)
}

// CheckTxWasMined check if a tx was already mined
func (etherMan *Client) CheckTxWasMined(ctx context.Context, txHash common.Hash) (bool, *types.Receipt, error) {
receipt, err := etherMan.EthClient.TransactionReceipt(ctx, txHash)
Expand Down

0 comments on commit 811e5b3

Please sign in to comment.