Skip to content

Commit c8412f6

Browse files
authored
Include missing check of P256 on Amoy (ethereum#1877)
* checks p256 instruction * lint fix
1 parent c5adefd commit c8412f6

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

core/vm/contracts_test.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -439,19 +439,22 @@ func TestPrecompiledP256Verify(t *testing.T) {
439439
// BOR: if this test failed, it means you should include PrecompiledP256Verify in the PrecompiledContracts
440440
// TODO: handle when common.BytesToAddress([]byte{0x01, 0x00}) will colide a new Ethereum's precompile
441441
func TestPrecompiledP256VerifyAlwaysAvailableInHFs(t *testing.T) {
442-
latestHfRules := params.BorMainnetChainConfig.Rules(big.NewInt(math.MaxInt64), true, 0)
443-
precompiledP256VerifyAddress := common.BytesToAddress([]byte{0x01, 0x00})
444-
445-
addresses := ActivePrecompiles(latestHfRules)
446-
addressFound := false
447-
for _, addr := range addresses {
448-
if addr == precompiledP256VerifyAddress {
449-
addressFound = true
450-
break
442+
chainConfigs := []*params.ChainConfig{params.BorMainnetChainConfig, params.AmoyChainConfig}
443+
for _, chainConfig := range chainConfigs {
444+
latestHfRules := chainConfig.Rules(big.NewInt(math.MaxInt64), true, 0)
445+
precompiledP256VerifyAddress := common.BytesToAddress([]byte{0x01, 0x00})
446+
447+
addresses := ActivePrecompiles(latestHfRules)
448+
addressFound := false
449+
for _, addr := range addresses {
450+
if addr == precompiledP256VerifyAddress {
451+
addressFound = true
452+
break
453+
}
451454
}
452-
}
453-
assert.Equal(t, true, addressFound)
455+
assert.Equal(t, true, addressFound)
454456

455-
preCompiledContracts := ActivePrecompiledContracts(latestHfRules)
456-
assert.Equal(t, &p256Verify{}, preCompiledContracts[precompiledP256VerifyAddress])
457+
preCompiledContracts := ActivePrecompiledContracts(latestHfRules)
458+
assert.Equal(t, &p256Verify{}, preCompiledContracts[precompiledP256VerifyAddress])
459+
}
457460
}

0 commit comments

Comments
 (0)