Skip to content

Commit

Permalink
added example how code in overrides would change
Browse files Browse the repository at this point in the history
  • Loading branch information
mralj committed Sep 26, 2024
1 parent dd60efc commit 8a9633a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/vm/contracts_rollup_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

package vm

import "math/big"
import (
"math/big"
)

type RollupPrecompiledContractsOverrides struct {
l1SLoadGetLatestL1Block func() *big.Int
Expand All @@ -23,3 +25,16 @@ func getLatestL1BlockNumber(evm *EVM) func() *big.Int {
return evm.Context.BlockNumber
}
}

// [OVERRIDE] getLatestL1BlockNumber
// Each rollup should override this function so that it returns
// correct latest L1 block number
//
// EXAMPLE 2
// func getLatestL1BlockNumber(evm *EVM) func() *big.Int {
// return func() *big.Int {
// addressOfL1BlockContract := common.Address{}
// slotInContractRepresentingL1BlockNumber := common.Hash{}
// return evm.StateDB.GetState(addressOfL1BlockContract, slotInContractRepresentingL1BlockNumber).Big()
// }
// }

0 comments on commit 8a9633a

Please sign in to comment.