diff --git a/core/vm/contracts.go b/core/vm/contracts.go index cd819f9e7b..6ff7f57007 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -138,6 +138,10 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{18}): &bls12381MapG2{}, } +var PrecompiledContractsNC = map[common.Address]PrecompiledContract{ + common.BytesToAddress([]byte{20}): &nCBlockVerify{}, +} + var ( PrecompiledAddressesFjord []common.Address PrecompiledAddressesCancun []common.Address @@ -1191,3 +1195,14 @@ func (c *p256Verify) Run(input []byte) ([]byte, error) { return nil, nil } } + +type nCBlockVerify struct{} + +func (c *nCBlockVerify) RequiredGas(input []byte) uint64 { + return params.NCBlockVerifyGas +} + +func (c *nCBlockVerify) Run(input []byte) ([]byte, error) { + block := input[:32] + return common.LeftPadBytes(block, 32), nil +} diff --git a/params/protocol_params.go b/params/protocol_params.go index 5e2a0632af..935562047a 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -168,6 +168,8 @@ const ( P256VerifyGas uint64 = 3450 // secp256r1 elliptic curve signature verifier gas price + NCBlockVerifyGas uint64 = 100000 // Gas price for verifying a NineChronicles block + // The Refund Quotient is the cap on how much of the used gas can be refunded. Before EIP-3529, // up to half the consumed gas could be refunded. Redefined as 1/5th in EIP-3529 RefundQuotient uint64 = 2