From 6dc30f597af50c4c157daf3d781c76e924539646 Mon Sep 17 00:00:00 2001 From: Lucca Martins Date: Thu, 13 Nov 2025 09:24:51 -0300 Subject: [PATCH 1/2] checks p256 instruction --- core/vm/contracts_test.go | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index 2de116991a..39ded66a3a 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -439,19 +439,23 @@ func TestPrecompiledP256Verify(t *testing.T) { // BOR: if this test failed, it means you should include PrecompiledP256Verify in the PrecompiledContracts // TODO: handle when common.BytesToAddress([]byte{0x01, 0x00}) will colide a new Ethereum's precompile func TestPrecompiledP256VerifyAlwaysAvailableInHFs(t *testing.T) { - latestHfRules := params.BorMainnetChainConfig.Rules(big.NewInt(math.MaxInt64), true, 0) - precompiledP256VerifyAddress := common.BytesToAddress([]byte{0x01, 0x00}) - - addresses := ActivePrecompiles(latestHfRules) - addressFound := false - for _, addr := range addresses { - if addr == precompiledP256VerifyAddress { - addressFound = true - break + + chainConfigs := []*params.ChainConfig{params.BorMainnetChainConfig, params.AmoyChainConfig} + for _, chainConfig := range chainConfigs { + latestHfRules := chainConfig.Rules(big.NewInt(math.MaxInt64), true, 0) + precompiledP256VerifyAddress := common.BytesToAddress([]byte{0x01, 0x00}) + + addresses := ActivePrecompiles(latestHfRules) + addressFound := false + for _, addr := range addresses { + if addr == precompiledP256VerifyAddress { + addressFound = true + break + } } - } - assert.Equal(t, true, addressFound) + assert.Equal(t, true, addressFound) - preCompiledContracts := ActivePrecompiledContracts(latestHfRules) - assert.Equal(t, &p256Verify{}, preCompiledContracts[precompiledP256VerifyAddress]) + preCompiledContracts := ActivePrecompiledContracts(latestHfRules) + assert.Equal(t, &p256Verify{}, preCompiledContracts[precompiledP256VerifyAddress]) + } } From e27c0912031015a9f462790d4d3552fd7537ef03 Mon Sep 17 00:00:00 2001 From: Lucca Martins Date: Thu, 13 Nov 2025 09:26:03 -0300 Subject: [PATCH 2/2] lint fix --- core/vm/contracts_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index 39ded66a3a..0392fb5a5f 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -439,7 +439,6 @@ func TestPrecompiledP256Verify(t *testing.T) { // BOR: if this test failed, it means you should include PrecompiledP256Verify in the PrecompiledContracts // TODO: handle when common.BytesToAddress([]byte{0x01, 0x00}) will colide a new Ethereum's precompile func TestPrecompiledP256VerifyAlwaysAvailableInHFs(t *testing.T) { - chainConfigs := []*params.ChainConfig{params.BorMainnetChainConfig, params.AmoyChainConfig} for _, chainConfig := range chainConfigs { latestHfRules := chainConfig.Rules(big.NewInt(math.MaxInt64), true, 0)