diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index f7b7f0e7f6..7a6941f0ac 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -163,7 +163,7 @@ var ( ) // Returns a list of precompiles that only appear in Arbitrum chains (i.e. ArbOS precompiles) at the genesis block -func getArbitrumOnlyGenesisPrecompiles(chainConfig *params.ChainConfig) []common.Address { +func GetArbitrumOnlyGenesisPrecompiles(chainConfig *params.ChainConfig) []common.Address { rules := chainConfig.Rules(big.NewInt(0), false, 0, chainConfig.ArbitrumChainParams.InitialArbOSVersion) arbPrecompiles := vm.ActivePrecompiles(rules) rules.IsArbitrum = false @@ -204,7 +204,7 @@ func InitializeArbosState(stateDB vm.StateDB, burner burn.Burner, chainConfig *p // Solidity requires call targets have code, but precompiles don't. // To work around this, we give precompiles fake code. - for _, genesisPrecompile := range getArbitrumOnlyGenesisPrecompiles(chainConfig) { + for _, genesisPrecompile := range GetArbitrumOnlyGenesisPrecompiles(chainConfig) { stateDB.SetCode(genesisPrecompile, []byte{byte(vm.INVALID)}) } diff --git a/system_tests/outbox_test.go b/system_tests/outbox_test.go index d0ca0ccda3..e80c837b58 100644 --- a/system_tests/outbox_test.go +++ b/system_tests/outbox_test.go @@ -16,6 +16,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" + "github.com/offchainlabs/nitro/arbos/arbosState" "github.com/offchainlabs/nitro/gethhook" "github.com/offchainlabs/nitro/solgen/go/node_interfacegen" "github.com/offchainlabs/nitro/solgen/go/precompilesgen" @@ -23,6 +25,37 @@ import ( "github.com/offchainlabs/nitro/util/merkletree" ) +func TestP256VerifyEnabled(t *testing.T) { + gethhook.RequireHookedGeth() + for _, tc := range []struct { + arbOSVersion uint64 + wantP256Verify bool + }{ + { + arbOSVersion: 20, + wantP256Verify: false, + }, + { + arbOSVersion: 30, + wantP256Verify: true, + }, + } { + addresses := arbosState.GetArbitrumOnlyGenesisPrecompiles(¶ms.ChainConfig{ + ArbitrumChainParams: params.ArbitrumChainParams{ + EnableArbOS: true, + InitialArbOSVersion: tc.arbOSVersion, + }, + }) + got := false + for _, a := range addresses { + got = got || (a == common.BytesToAddress([]byte{0x01, 0x00})) + } + if got != tc.wantP256Verify { + t.Errorf("Got P256Verify enabled: %t, want: %t", got, tc.wantP256Verify) + } + } +} + func TestOutboxProofs(t *testing.T) { t.Parallel() gethhook.RequireHookedGeth()