Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ var PrecompiledContractsOsaka = PrecompiledContracts{
common.BytesToAddress([]byte{0x10}): &bls12381MapG1{},
common.BytesToAddress([]byte{0x11}): &bls12381MapG2{},

common.BytesToAddress([]byte{0x1, 0x00}): &p256Verify{},
common.BytesToAddress([]byte{0x1, 0x00}): &p256Verify{eip7951: true},
}

// PrecompiledContractsP256Verify contains the precompiled Ethereum
Expand Down Expand Up @@ -1529,10 +1529,15 @@ func kZGToVersionedHash(kzg kzg4844.Commitment) common.Hash {

// P256VERIFY (secp256r1 signature verification)
// implemented as a native contract
type p256Verify struct{}
type p256Verify struct {
eip7951 bool
}

// RequiredGas returns the gas required to execute the precompiled contract
func (c *p256Verify) RequiredGas(input []byte) uint64 {
if c.eip7951 {
return params.P256VerifyGasEIP7951
}
return params.P256VerifyGas
}

Expand Down
3 changes: 2 additions & 1 deletion core/vm/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ func TestPrecompiledP256VerifyAlwaysAvailableInHFs(t *testing.T) {
assert.Equal(t, true, addressFound)

preCompiledContracts := ActivePrecompiledContracts(latestHfRules)
assert.Equal(t, &p256Verify{}, preCompiledContracts[precompiledP256VerifyAddress])
_, ok := preCompiledContracts[precompiledP256VerifyAddress].(*p256Verify)
assert.Equal(t, true, ok)
}
}

Expand Down
Loading
Loading