From f290abee89594fb6b672c02672302372a810be5d Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 25 Nov 2024 20:41:10 +0100 Subject: [PATCH 01/33] evm: add devnet-5 EIP-7702 changes --- packages/evm/src/opcodes/functions.ts | 42 ++++++++--- packages/evm/test/eips/eip-7702.spec.ts | 99 +++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 11 deletions(-) create mode 100644 packages/evm/test/eips/eip-7702.spec.ts diff --git a/packages/evm/src/opcodes/functions.ts b/packages/evm/src/opcodes/functions.ts index 6b7ef88852..f78c49671c 100644 --- a/packages/evm/src/opcodes/functions.ts +++ b/packages/evm/src/opcodes/functions.ts @@ -25,6 +25,7 @@ import { concatBytes, equalsBytes, getVerkleTreeIndicesForStorageSlot, + hexToBytes, setLengthLeft, } from '@ethereumjs/util' import { keccak256 } from 'ethereum-cryptography/keccak.js' @@ -61,16 +62,40 @@ export interface AsyncOpHandler { export type OpHandler = SyncOpHandler | AsyncOpHandler +// TODO: verify that this is the correct designator +// The PR https://github.com/ethereum/EIPs/pull/8969 has two definitions of the +// designator: the original (0xef0100) and the designator added in the changes (0xef01) +const eip7702Designator = hexToBytes('0xef01') +const eip7702HashBigInt = bytesToBigInt(keccak256(eip7702Designator)) + function getEIP7702DelegatedAddress(code: Uint8Array) { if (equalsBytes(code.slice(0, 3), DELEGATION_7702_FLAG)) { return new Address(code.slice(3, 24)) } } -async function eip7702CodeCheck(runState: RunState, code: Uint8Array) { +/** + * This method performs checks to transfor the code which the EVM observes regarding EIP-7702. + * If the code is 7702-delegated code, it will retrieve the code of the designated address + * in case of an executable operation (`isReadOperation` == false), or the 7702 designator + * code in case of a read operation + * @param runState + * @param code + * @param isReadOperation Boolean to determine if the target code is meant to be read or executed (default: `false`) + * @returns + */ +async function eip7702CodeCheck( + runState: RunState, + code: Uint8Array, + isReadOperation: boolean = false, +) { const address = getEIP7702DelegatedAddress(code) if (address !== undefined) { - return runState.stateManager.getCode(address) + if (isReadOperation) { + return eip7702Designator + } else { + return runState.stateManager.getCode(address) + } } return code @@ -538,7 +563,7 @@ export const handlers: Map = new Map([ runState.stack.push(BigInt(EOFBYTES.length)) return } else if (common.isActivatedEIP(7702)) { - code = await eip7702CodeCheck(runState, code) + code = await eip7702CodeCheck(runState, code, true) } const size = BigInt(code.length) @@ -560,7 +585,7 @@ export const handlers: Map = new Map([ // In legacy code, the target code is treated as to be "EOFBYTES" code code = EOFBYTES } else if (common.isActivatedEIP(7702)) { - code = await eip7702CodeCheck(runState, code) + code = await eip7702CodeCheck(runState, code, true) } const data = getDataSlice(code, codeOffset, dataLength) @@ -587,13 +612,8 @@ export const handlers: Map = new Map([ } else if (common.isActivatedEIP(7702)) { const possibleDelegatedAddress = getEIP7702DelegatedAddress(code) if (possibleDelegatedAddress !== undefined) { - const account = await runState.stateManager.getAccount(possibleDelegatedAddress) - if (!account || account.isEmpty()) { - runState.stack.push(BIGINT_0) - return - } - - runState.stack.push(BigInt(bytesToHex(account.codeHash))) + // The account is delegated by an EIP-7702 tx. Push the EIP-7702 designator hash to the stack + runState.stack.push(eip7702HashBigInt) return } else { runState.stack.push(bytesToBigInt(keccak256(code))) diff --git a/packages/evm/test/eips/eip-7702.spec.ts b/packages/evm/test/eips/eip-7702.spec.ts new file mode 100644 index 0000000000..7e648b5ed0 --- /dev/null +++ b/packages/evm/test/eips/eip-7702.spec.ts @@ -0,0 +1,99 @@ +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { + Address, + bytesToBigInt, + equalsBytes, + hexToBytes, + setLengthRight, + unprefixedHexToBytes, +} from '@ethereumjs/util' +import { keccak256 } from 'ethereum-cryptography/keccak' +import { assert, describe, it } from 'vitest' + +import { createEVM } from '../../src/index.js' + +const eip7702Designator = hexToBytes('0xef01') +const addressHex = '01'.repeat(20) // Address as unprefixed hex string +const address = new Address(unprefixedHexToBytes(addressHex)) + +const delegationCode = hexToBytes('0xef0100' + addressHex) // This code will delegate to `address` + +// Helpers for unprefixed hex strings of opcodes +const EXTCODESIZE = '3B' +const EXTCODECOPY = '3C' +const EXTCODEHASH = '3F' + +// This code stores the topmost stack item in slot 0 +const STORE_TOP_STACK_CODE = '5F55' + +// This code pushes the `address` to the stack +const PUSH_Address = '73' + addressHex // PUSH20
as unprefixed hex string + +const testCodeAddress = new Address(unprefixedHexToBytes('02'.repeat(20))) + +// Setups EVM with an account at `address` which is delegated to itself +async function getEVM() { + const common = new Common({ + chain: Mainnet, + hardfork: Hardfork.Prague, + }) + const evm = await createEVM({ + common, + }) + await evm.stateManager.putCode(address, delegationCode) + return evm +} + +describe('EIP 7702 tests', () => { + it('EXTCODESIZE', async () => { + const evm = await getEVM() + const code = unprefixedHexToBytes(PUSH_Address + EXTCODESIZE + STORE_TOP_STACK_CODE) + await evm.stateManager.putCode(testCodeAddress, code) + + await evm.runCall({ + to: testCodeAddress, + gasLimit: BigInt(100_000), + }) + + const result = await evm.stateManager.getStorage(testCodeAddress, new Uint8Array(32)) + const expected = BigInt(eip7702Designator.length) + + assert.equal(bytesToBigInt(result), expected) + }) + + it('EXTCODEHASH', async () => { + const evm = await getEVM() + const code = unprefixedHexToBytes(PUSH_Address + EXTCODEHASH + STORE_TOP_STACK_CODE) + await evm.stateManager.putCode(testCodeAddress, code) + + await evm.runCall({ + to: testCodeAddress, + gasLimit: BigInt(100_000), + }) + + const result = await evm.stateManager.getStorage(testCodeAddress, new Uint8Array(32)) + const expected = keccak256(eip7702Designator) + + assert.ok(equalsBytes(result, expected)) + }) + + it('EXTCODECOPY', async () => { + const evm = await getEVM() + // This code does some extra logic than other tests, because it has to setup EXTCODECOPY (4 stack items instead of 1) + // It EXTCODECOPYs 32 bytes of the delegated address in memory at key 0, and then MLOADs key 0 before storing the result + const code = unprefixedHexToBytes( + '60205F5F' + PUSH_Address + EXTCODECOPY + '5F51' + STORE_TOP_STACK_CODE, + ) + await evm.stateManager.putCode(testCodeAddress, code) + + await evm.runCall({ + to: testCodeAddress, + gasLimit: BigInt(100_000), + }) + + const result = await evm.stateManager.getStorage(testCodeAddress, new Uint8Array(32)) + const expected = setLengthRight(eip7702Designator, 32) + + assert.ok(equalsBytes(result, expected)) + }) +}) From 85e937aaa0615f3cbe768af141d0f8596d042979 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 25 Nov 2024 20:53:27 +0100 Subject: [PATCH 02/33] vm: add devnet-5 EIP-7685 changes --- packages/block/src/helpers.ts | 5 ++++- packages/vm/test/api/EIPs/eip-7685.spec.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/block/src/helpers.ts b/packages/block/src/helpers.ts index 3f0b498796..79228bddb9 100644 --- a/packages/block/src/helpers.ts +++ b/packages/block/src/helpers.ts @@ -173,7 +173,10 @@ export function genRequestsRoot( let flatRequests = new Uint8Array() for (const req of requests) { - flatRequests = concatBytes(flatRequests, sha256Function(req.bytes)) + if (req.bytes.length > 1) { + // Only append requests if they have content + flatRequests = concatBytes(flatRequests, sha256Function(req.bytes)) + } } return sha256Function(flatRequests) diff --git a/packages/vm/test/api/EIPs/eip-7685.spec.ts b/packages/vm/test/api/EIPs/eip-7685.spec.ts index 99b0f4c2d2..9be6ec60fa 100644 --- a/packages/vm/test/api/EIPs/eip-7685.spec.ts +++ b/packages/vm/test/api/EIPs/eip-7685.spec.ts @@ -1,7 +1,7 @@ import { createBlock, genRequestsRoot } from '@ethereumjs/block' import { createBlockchain } from '@ethereumjs/blockchain' import { Common, Hardfork, Mainnet } from '@ethereumjs/common' -import { createCLRequest, hexToBytes } from '@ethereumjs/util' +import { createCLRequest, equalsBytes, hexToBytes } from '@ethereumjs/util' import { sha256 } from 'ethereum-cryptography/sha256' import { assert, describe, expect, it } from 'vitest' @@ -31,6 +31,9 @@ describe('EIP-7685 runBlock tests', () => { generate: true, }) assert.equal(res.gasUsed, 0n) + // Verify that if the requests are empty, the byte-types are not appended to the to-be-hashed flat array + // I.e. the flat array to-be-hashed is not `0x 00 01 02`, but is now the empty bytes array, `0x` + assert.ok(equalsBytes(res.requestsHash!, sha256(new Uint8Array()))) }) it('should error when an invalid requestsHash is provided', async () => { const vm = await setupVM({ common }) From 3525a19b0b866c4fa50381e0fd1e9ab8f1342e7e Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 25 Nov 2024 20:58:30 +0100 Subject: [PATCH 03/33] monorepo: make cspell happy --- packages/evm/src/opcodes/functions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/evm/src/opcodes/functions.ts b/packages/evm/src/opcodes/functions.ts index f78c49671c..9661b7c8b6 100644 --- a/packages/evm/src/opcodes/functions.ts +++ b/packages/evm/src/opcodes/functions.ts @@ -75,7 +75,7 @@ function getEIP7702DelegatedAddress(code: Uint8Array) { } /** - * This method performs checks to transfor the code which the EVM observes regarding EIP-7702. + * This method performs checks to transform the code which the EVM observes regarding EIP-7702. * If the code is 7702-delegated code, it will retrieve the code of the designated address * in case of an executable operation (`isReadOperation` == false), or the 7702 designator * code in case of a read operation From 4800a9f4ae712674dc0e6607b6dac68139c51b34 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Tue, 26 Nov 2024 16:28:03 +0100 Subject: [PATCH 04/33] vm/client: fix tests --- packages/client/test/rpc/engine/newPayloadV4.spec.ts | 3 ++- packages/vm/test/api/EIPs/eip-7702.spec.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/client/test/rpc/engine/newPayloadV4.spec.ts b/packages/client/test/rpc/engine/newPayloadV4.spec.ts index 4538a2d95b..4acd9a9ea4 100644 --- a/packages/client/test/rpc/engine/newPayloadV4.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV4.spec.ts @@ -162,7 +162,7 @@ describe(`${method}: call with executionPayloadV4`, () => { excessBlobGas: '0x0', parentHash: '0x6abe4c2777a6a1e994d83920cfb95229b071174b95c89343f54b926f733789f2', stateRoot: '0x7aa6e46df1f78988a3141b5e7da8abee78d1daca175f43fe8866b2d1bf8d8ef8', - blockHash: '0x9a5903d803e6e7c3631cd76cb7279f93d7facc995c53eaffadf4e225504b18eb', + blockHash: '0xece8d273a76238c4c9e4e28cbd301d40b04cb21242e83960ca688324e0483fd8', } const oldMethods = ['engine_newPayloadV1', 'engine_newPayloadV2', 'engine_newPayloadV3'] @@ -181,6 +181,7 @@ describe(`${method}: call with executionPayloadV4`, () => { } res = await rpc.request(method, [validBlock, [], parentBeaconBlockRoot, ['0x', '0x', '0x']]) + console.log(res) assert.equal(res.result.status, 'VALID') res = await rpc.request('engine_forkchoiceUpdatedV3', validPayload) diff --git a/packages/vm/test/api/EIPs/eip-7702.spec.ts b/packages/vm/test/api/EIPs/eip-7702.spec.ts index a1a5c107f5..4d4a56c673 100644 --- a/packages/vm/test/api/EIPs/eip-7702.spec.ts +++ b/packages/vm/test/api/EIPs/eip-7702.spec.ts @@ -25,6 +25,9 @@ import type { VM } from '../../../src/index.js' import type { AuthorizationListBytesItem } from '@ethereumjs/tx' import type { PrefixedHexString } from '@ethereumjs/util' +// EIP-7702 code designator. If code starts with these bytes, it is a 7702-delegated address +const eip7702Designator = hexToBytes('0xef01') + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) const defaultAuthPkey = hexToBytes(`0x${'20'.repeat(32)}`) @@ -248,21 +251,21 @@ describe('test EIP-7702 opcodes', () => { { // PUSH20 EXTCODESIZE PUSH0 SSTORE STOP code: `0x73${defaultAuthAddr.toString().slice(2)}3b5f5500`, - expectedStorage: bigIntToUnpaddedBytes(BigInt(randomCode.length)), + expectedStorage: bigIntToUnpaddedBytes(BigInt(eip7702Designator.length)), name: 'EXTCODESIZE', }, // EXTCODEHASH { // PUSH20 EXTCODEHASH PUSH0 SSTORE STOP code: `0x73${defaultAuthAddr.toString().slice(2)}3f5f5500`, - expectedStorage: keccak256(randomCode), + expectedStorage: keccak256(eip7702Designator), name: 'EXTCODEHASH', }, // EXTCODECOPY { // PUSH1 32 PUSH0 PUSH0 PUSH20 EXTCODEHASH PUSH0 MLOAD PUSH0 SSTORE STOP code: `0x60205f5f73${defaultAuthAddr.toString().slice(2)}3c5f515f5500`, - expectedStorage: setLengthRight(randomCode, 32), + expectedStorage: setLengthRight(eip7702Designator, 32), name: 'EXTCODECOPY', }, ] From d4e94960c02be30a0a6ce73f2e01eaa2c13cbf3e Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Tue, 26 Nov 2024 16:28:55 +0100 Subject: [PATCH 05/33] evm: remove redundant test --- packages/evm/test/eips/eip-7702.spec.ts | 99 ------------------------- 1 file changed, 99 deletions(-) delete mode 100644 packages/evm/test/eips/eip-7702.spec.ts diff --git a/packages/evm/test/eips/eip-7702.spec.ts b/packages/evm/test/eips/eip-7702.spec.ts deleted file mode 100644 index 7e648b5ed0..0000000000 --- a/packages/evm/test/eips/eip-7702.spec.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Common, Hardfork, Mainnet } from '@ethereumjs/common' -import { - Address, - bytesToBigInt, - equalsBytes, - hexToBytes, - setLengthRight, - unprefixedHexToBytes, -} from '@ethereumjs/util' -import { keccak256 } from 'ethereum-cryptography/keccak' -import { assert, describe, it } from 'vitest' - -import { createEVM } from '../../src/index.js' - -const eip7702Designator = hexToBytes('0xef01') -const addressHex = '01'.repeat(20) // Address as unprefixed hex string -const address = new Address(unprefixedHexToBytes(addressHex)) - -const delegationCode = hexToBytes('0xef0100' + addressHex) // This code will delegate to `address` - -// Helpers for unprefixed hex strings of opcodes -const EXTCODESIZE = '3B' -const EXTCODECOPY = '3C' -const EXTCODEHASH = '3F' - -// This code stores the topmost stack item in slot 0 -const STORE_TOP_STACK_CODE = '5F55' - -// This code pushes the `address` to the stack -const PUSH_Address = '73' + addressHex // PUSH20
as unprefixed hex string - -const testCodeAddress = new Address(unprefixedHexToBytes('02'.repeat(20))) - -// Setups EVM with an account at `address` which is delegated to itself -async function getEVM() { - const common = new Common({ - chain: Mainnet, - hardfork: Hardfork.Prague, - }) - const evm = await createEVM({ - common, - }) - await evm.stateManager.putCode(address, delegationCode) - return evm -} - -describe('EIP 7702 tests', () => { - it('EXTCODESIZE', async () => { - const evm = await getEVM() - const code = unprefixedHexToBytes(PUSH_Address + EXTCODESIZE + STORE_TOP_STACK_CODE) - await evm.stateManager.putCode(testCodeAddress, code) - - await evm.runCall({ - to: testCodeAddress, - gasLimit: BigInt(100_000), - }) - - const result = await evm.stateManager.getStorage(testCodeAddress, new Uint8Array(32)) - const expected = BigInt(eip7702Designator.length) - - assert.equal(bytesToBigInt(result), expected) - }) - - it('EXTCODEHASH', async () => { - const evm = await getEVM() - const code = unprefixedHexToBytes(PUSH_Address + EXTCODEHASH + STORE_TOP_STACK_CODE) - await evm.stateManager.putCode(testCodeAddress, code) - - await evm.runCall({ - to: testCodeAddress, - gasLimit: BigInt(100_000), - }) - - const result = await evm.stateManager.getStorage(testCodeAddress, new Uint8Array(32)) - const expected = keccak256(eip7702Designator) - - assert.ok(equalsBytes(result, expected)) - }) - - it('EXTCODECOPY', async () => { - const evm = await getEVM() - // This code does some extra logic than other tests, because it has to setup EXTCODECOPY (4 stack items instead of 1) - // It EXTCODECOPYs 32 bytes of the delegated address in memory at key 0, and then MLOADs key 0 before storing the result - const code = unprefixedHexToBytes( - '60205F5F' + PUSH_Address + EXTCODECOPY + '5F51' + STORE_TOP_STACK_CODE, - ) - await evm.stateManager.putCode(testCodeAddress, code) - - await evm.runCall({ - to: testCodeAddress, - gasLimit: BigInt(100_000), - }) - - const result = await evm.stateManager.getStorage(testCodeAddress, new Uint8Array(32)) - const expected = setLengthRight(eip7702Designator, 32) - - assert.ok(equalsBytes(result, expected)) - }) -}) From caa9e1cfbb4a9f0728a4071b7725af1c86ea467b Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Wed, 27 Nov 2024 15:02:00 +0100 Subject: [PATCH 06/33] remove accidental console.log --- packages/client/test/rpc/engine/newPayloadV4.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/test/rpc/engine/newPayloadV4.spec.ts b/packages/client/test/rpc/engine/newPayloadV4.spec.ts index 4acd9a9ea4..3fdda74f04 100644 --- a/packages/client/test/rpc/engine/newPayloadV4.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV4.spec.ts @@ -181,7 +181,6 @@ describe(`${method}: call with executionPayloadV4`, () => { } res = await rpc.request(method, [validBlock, [], parentBeaconBlockRoot, ['0x', '0x', '0x']]) - console.log(res) assert.equal(res.result.status, 'VALID') res = await rpc.request('engine_forkchoiceUpdatedV3', validPayload) From 74a2123ef9897731244435ff88f3f5c802202721 Mon Sep 17 00:00:00 2001 From: harkamal Date: Mon, 16 Dec 2024 15:50:34 +0530 Subject: [PATCH 07/33] remove 7742 and add 7691 independently --- packages/block/src/params.ts | 9 +++++++++ packages/common/src/eips.ts | 9 +++++++++ packages/common/src/hardforks.ts | 2 +- packages/evm/src/evm.ts | 2 +- packages/tx/src/4844/tx.ts | 8 +++++--- packages/tx/src/constants.ts | 1 - packages/vm/src/params.ts | 6 ++++++ 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/packages/block/src/params.ts b/packages/block/src/params.ts index d4277f3329..622937dab2 100644 --- a/packages/block/src/params.ts +++ b/packages/block/src/params.ts @@ -85,4 +85,13 @@ export const paramsBlock: ParamsDict = { // pow difficultyBombDelay: 11400000, // the amount of blocks to delay the difficulty bomb with }, + /** +. * Blob throughput increase +. */ + 7691: { + // gasConfig + targetBlobGasPerBlock: 786432, // The target blob gas consumed per block + maxblobGasPerBlock: 1179648, // The max blob gas allowable per block + blobGasPriceUpdateFraction: 5007716, // The denominator used in the exponential when calculating a blob gas price + }, } diff --git a/packages/common/src/eips.ts b/packages/common/src/eips.ts index 091fae9ce4..6c43bfa341 100644 --- a/packages/common/src/eips.ts +++ b/packages/common/src/eips.ts @@ -415,6 +415,15 @@ export const eipsDict: EIPsDict = { minimumHardfork: Hardfork.Cancun, requiredEIPs: [3675], }, + /** + * Description : Blob throughput increase + * URL : https://eips.ethereum.org/EIPS/eip-7691 + * Status : Review + */ + 7691: { + minimumHardfork: Hardfork.Paris, + requiredEIPs: [4844], + }, /** * Description : EVM Object Format (EOFv1) Meta * URL : https://github.com/ethereum/EIPs/blob/4153e95befd0264082de3c4c2fe3a85cc74d3152/EIPS/eip-7692.md diff --git a/packages/common/src/hardforks.ts b/packages/common/src/hardforks.ts index 1f3a8fbf8e..b6f045d37c 100644 --- a/packages/common/src/hardforks.ts +++ b/packages/common/src/hardforks.ts @@ -160,7 +160,7 @@ export const hardforksDict: HardforksDict = { prague: { // TODO update this accordingly to the right devnet setup //eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698], // This is EOF-only - eips: [2537, 2935, 6110, 7002, 7251, 7685, 7702], // This is current prague without EOF + eips: [2537, 2935, 6110, 7002, 7251, 7685, 7691, 7702], // This is current prague without EOF }, /** * Description: Next feature hardfork after prague, internally used for verkle testing/implementation (incomplete/experimental) diff --git a/packages/evm/src/evm.ts b/packages/evm/src/evm.ts index 5e86d49d60..218acb07f6 100644 --- a/packages/evm/src/evm.ts +++ b/packages/evm/src/evm.ts @@ -182,7 +182,7 @@ export class EVM implements EVMInterface { const supportedEIPs = [ 663, 1153, 1559, 2537, 2565, 2718, 2929, 2930, 2935, 3198, 3529, 3540, 3541, 3607, 3651, 3670, 3855, 3860, 4200, 4399, 4750, 4788, 4844, 4895, 5133, 5450, 5656, 6110, 6206, 6780, 6800, - 7002, 7069, 7251, 7480, 7516, 7620, 7685, 7692, 7698, 7702, 7709, + 7002, 7069, 7251, 7480, 7516, 7620, 7685, 7691, 7692, 7698, 7702, 7709, ] for (const eip of this.common.eips()) { diff --git a/packages/tx/src/4844/tx.ts b/packages/tx/src/4844/tx.ts index f1af09dc11..d3eedb33ad 100644 --- a/packages/tx/src/4844/tx.ts +++ b/packages/tx/src/4844/tx.ts @@ -15,7 +15,6 @@ import * as EIP1559 from '../capabilities/eip1559.js' import * as EIP2718 from '../capabilities/eip2718.js' import * as EIP2930 from '../capabilities/eip2930.js' import * as Legacy from '../capabilities/legacy.js' -import { LIMIT_BLOBS_PER_TX } from '../constants.js' import { getBaseJSON, sharedConstructor, valueBoundaryCheck } from '../features/util.js' import { TransactionType } from '../types.js' import { AccessLists, validateNotArray } from '../util.js' @@ -172,13 +171,16 @@ export class Blob4844Tx implements TransactionInterface LIMIT_BLOBS_PER_TX) { - const msg = Legacy.errorMsg(this, `tx can contain at most ${LIMIT_BLOBS_PER_TX} blobs`) + + const limitBlobsPerTx = this.common.param('maxblobGasPerBlock') / this.common.param('blobGasPerBlob') + if (this.blobVersionedHashes.length > limitBlobsPerTx) { + const msg = Legacy.errorMsg(this, `tx can contain at most ${limitBlobsPerTx} blobs`) throw new Error(msg) } else if (this.blobVersionedHashes.length === 0) { const msg = Legacy.errorMsg(this, `tx should contain at least one blob`) throw new Error(msg) } + if (this.to === undefined) { const msg = Legacy.errorMsg( this, diff --git a/packages/tx/src/constants.ts b/packages/tx/src/constants.ts index e3f73893f9..828ebb6ba0 100644 --- a/packages/tx/src/constants.ts +++ b/packages/tx/src/constants.ts @@ -3,7 +3,6 @@ export const MAX_CALLDATA_SIZE = 16777216 // 2 ** 24 export const MAX_ACCESS_LIST_SIZE = 16777216 // 2 ** 24 export const MAX_VERSIONED_HASHES_LIST_SIZE = 16777216 // 2 ** 24 -export const LIMIT_BLOBS_PER_TX = 6 // 786432 / 2^17 (`MAX_BLOB_GAS_PER_BLOCK` / `GAS_PER_BLOB`) export const MAX_TX_WRAP_KZG_COMMITMENTS = 16777216 // 2 ** 24 export const FIELD_ELEMENTS_PER_BLOB = 4096 // This is also in the Common 4844 parameters but needed here since types can't access Common params export const BYTES_PER_FIELD_ELEMENT = 32 diff --git a/packages/vm/src/params.ts b/packages/vm/src/params.ts index dfaa021cda..e1bc6d1b67 100644 --- a/packages/vm/src/params.ts +++ b/packages/vm/src/params.ts @@ -91,4 +91,10 @@ export const paramsVM: ParamsDict = { // See: https://github.com/ethereum/EIPs/pull/8934/files consolidationRequestPredeployAddress: '0x01aBEa29659e5e97C95107F20bb753cD3e09bBBb', // Address of the consolidations contract }, + /** +. * Shard Blob Transactions +. */ + 7691: { + maxblobGasPerBlock: 1179648, // The max blob gas allowable per block + }, } From 7f5c4c5f2772615c7970096f0f7a24177279692f Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 16 Dec 2024 23:56:40 +0100 Subject: [PATCH 08/33] fix t8ntool empty requests reporting --- packages/vm/test/t8n/t8ntool.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vm/test/t8n/t8ntool.ts b/packages/vm/test/t8n/t8ntool.ts index 19605a8fe1..d57563513e 100644 --- a/packages/vm/test/t8n/t8ntool.ts +++ b/packages/vm/test/t8n/t8ntool.ts @@ -303,7 +303,12 @@ export class TransitionTool { if (requests !== undefined) { // NOTE: EEST currently wants the raw request bytes, **excluding** the type - output.requests = requests.map((request) => bytesToHex(request.bytes.slice(1))) + output.requests = [] + for (const request of requests) { + if (request.bytes.length > 1) { + output.requests.push(bytesToHex(request.bytes.slice(1))) + } + } } if (this.rejected.length > 0) { From 13aafd650dcfafd688436ce82ec44cc9c5f8215b Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Thu, 19 Dec 2024 02:41:49 +0100 Subject: [PATCH 09/33] client: fix engine reporting empty requests --- .../src/rpc/modules/engine/util/getPayload.ts | 13 ++++- .../src/rpc/modules/engine/util/newPayload.ts | 49 ++++++++++--------- .../test/rpc/engine/newPayloadV4.spec.ts | 17 +++++-- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/packages/client/src/rpc/modules/engine/util/getPayload.ts b/packages/client/src/rpc/modules/engine/util/getPayload.ts index fec0814f2d..615fbe04f7 100644 --- a/packages/client/src/rpc/modules/engine/util/getPayload.ts +++ b/packages/client/src/rpc/modules/engine/util/getPayload.ts @@ -25,9 +25,20 @@ export const blockToExecutionPayload = ( // ethereumjs does not provide any transaction censoring detection (yet) to suggest // overriding builder/mev-boost blocks const shouldOverrideBuilder = false + + let executionRequests = undefined + if (requests !== undefined) { + executionRequests = [] + for (const request of requests) { + if (request.bytes.length > 1) { + executionRequests.push(bytesToHex(request.bytes)) + } + } + } + return { executionPayload, - executionRequests: requests?.map((req) => bytesToHex(req.data)), + executionRequests, blockValue: bigIntToHex(value), blobsBundle, shouldOverrideBuilder, diff --git a/packages/client/src/rpc/modules/engine/util/newPayload.ts b/packages/client/src/rpc/modules/engine/util/newPayload.ts index 5155ddfc5a..c2c42e6f7a 100644 --- a/packages/client/src/rpc/modules/engine/util/newPayload.ts +++ b/packages/client/src/rpc/modules/engine/util/newPayload.ts @@ -57,30 +57,35 @@ export const validateAndGen7685RequestsHash = ( common: Common, executionRequests: PrefixedHexString[], ): PrefixedHexString => { - let validationError: string | null = null - const requests: CLRequest[] = [] - let requestIndex = 0 - if (common.isActivatedEIP(6110)) { - requests.push(new CLRequest(CLRequestType.Deposit, hexToBytes(executionRequests[requestIndex]))) - requestIndex++ - } - if (common.isActivatedEIP(7002)) { - requests.push( - new CLRequest(CLRequestType.Withdrawal, hexToBytes(executionRequests[requestIndex])), - ) - requestIndex++ - } - if (common.isActivatedEIP(7251)) { - requests.push( - new CLRequest(CLRequestType.Consolidation, hexToBytes(executionRequests[requestIndex])), - ) - requestIndex++ - } - if (requestIndex !== executionRequests.length) { - validationError = `Invalid executionRequests=${executionRequests.length} expected=${requestIndex}` - throw validationError + for (const request of executionRequests) { + const bytes = hexToBytes(request) + if (bytes.length === 0) { + throw new Error('Got a request without a request-identifier') + } + switch (bytes[0]) { + case 0: + if (!common.isActivatedEIP(6110)) { + throw new Error(`Deposit requests are not active`) + } + requests.push(new CLRequest(CLRequestType.Deposit, bytes.slice(1))) + break + case 1: + if (!common.isActivatedEIP(7002)) { + throw new Error(`Withdrawal requests are not active`) + } + requests.push(new CLRequest(CLRequestType.Withdrawal, bytes.slice(1))) + break + case 2: + if (!common.isActivatedEIP(7251)) { + throw new Error(`Consolidation requests are not active`) + } + requests.push(new CLRequest(CLRequestType.Consolidation, bytes.slice(1))) + break + default: + throw new Error(`Unknown request identifier: got ${bytes[0]}`) + } } const sha256Function = common.customCrypto.sha256 ?? sha256 diff --git a/packages/client/test/rpc/engine/newPayloadV4.spec.ts b/packages/client/test/rpc/engine/newPayloadV4.spec.ts index 3fdda74f04..6b5634024b 100644 --- a/packages/client/test/rpc/engine/newPayloadV4.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV4.spec.ts @@ -180,7 +180,7 @@ describe(`${method}: call with executionPayloadV4`, () => { assert.ok(res.error.message.includes(expectedError)) } - res = await rpc.request(method, [validBlock, [], parentBeaconBlockRoot, ['0x', '0x', '0x']]) + res = await rpc.request(method, [validBlock, [], parentBeaconBlockRoot, []]) assert.equal(res.result.status, 'VALID') res = await rpc.request('engine_forkchoiceUpdatedV3', validPayload) @@ -201,9 +201,20 @@ describe(`${method}: call with executionPayloadV4`, () => { res = await rpc.request('engine_getPayloadV4', [payloadId]) const { executionPayload, executionRequests } = res.result + + assert.ok( + executionRequests?.length === 1, + 'executionRequests should have the deposit request, and should exclude the other requests (these are empty)', + ) + + const depositRequestBytes = hexToBytes(executionRequests[0]) + assert.ok( + depositRequestBytes[0] === 0x00, + 'deposit request byte 0 is the deposit request identifier byte (0x00)', + ) assert.ok( - executionRequests?.length === 3, - 'executionRequests should have 3 entries for each request type', + depositRequestBytes.length > 1, + 'deposit request includes data (and is thus not empty)', ) res = await rpc.request(method, [ From fc3c150fdd675bb05c078afbef9dadecffb4abf8 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Thu, 19 Dec 2024 02:52:24 +0100 Subject: [PATCH 10/33] t8n: fix requests reporting --- packages/vm/test/t8n/t8ntool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vm/test/t8n/t8ntool.ts b/packages/vm/test/t8n/t8ntool.ts index d57563513e..fe322ffac7 100644 --- a/packages/vm/test/t8n/t8ntool.ts +++ b/packages/vm/test/t8n/t8ntool.ts @@ -306,7 +306,7 @@ export class TransitionTool { output.requests = [] for (const request of requests) { if (request.bytes.length > 1) { - output.requests.push(bytesToHex(request.bytes.slice(1))) + output.requests.push(bytesToHex(request.bytes)) } } } From fb7e67f73b5af74c94ccd7b45ebb57a7e24723c3 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Thu, 19 Dec 2024 04:18:16 +0100 Subject: [PATCH 11/33] Implement EIP 7623: calldata cost increase (#3813) * common/evm/vm: implement EIP7623 calldata cost increase * move the floorcost update and add debug log * fix t8ntool empty requests reporting * common: add 7623 * tx: add 7623 validator * t8n: throw on invalid txs * make cspell happy --------- Co-authored-by: harkamal --- packages/common/src/eips.ts | 9 ++ packages/common/src/hardforks.ts | 2 +- packages/tx/src/capabilities/legacy.ts | 17 ++- packages/tx/src/params.ts | 6 + packages/vm/src/runTx.ts | 29 ++++- packages/vm/test/api/EIPs/eip-7623.spec.ts | 125 +++++++++++++++++++++ packages/vm/test/t8n/t8ntool.ts | 5 +- 7 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 packages/vm/test/api/EIPs/eip-7623.spec.ts diff --git a/packages/common/src/eips.ts b/packages/common/src/eips.ts index 6c43bfa341..1c6e31aab0 100644 --- a/packages/common/src/eips.ts +++ b/packages/common/src/eips.ts @@ -405,6 +405,15 @@ export const eipsDict: EIPsDict = { */ requiredEIPs: [3540, 3541, 3670], }, + /** + * Description : Increase calldata cost to reduce maximum block size + * URL : https://github.com/ethereum/EIPs/blob/da2a86bf15044416e8eb0301c9bdb8d561feeb32/EIPS/eip-7623.md + * Status : Review + */ + 7623: { + minimumHardfork: Hardfork.Chainstart, + requiredEIPs: [], + }, /** * Description : General purpose execution layer requests * URL : https://eips.ethereum.org/EIPS/eip-7685 diff --git a/packages/common/src/hardforks.ts b/packages/common/src/hardforks.ts index b6f045d37c..f83f077111 100644 --- a/packages/common/src/hardforks.ts +++ b/packages/common/src/hardforks.ts @@ -160,7 +160,7 @@ export const hardforksDict: HardforksDict = { prague: { // TODO update this accordingly to the right devnet setup //eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698], // This is EOF-only - eips: [2537, 2935, 6110, 7002, 7251, 7685, 7691, 7702], // This is current prague without EOF + eips: [2537, 2935, 6110, 7002, 7251, 7623, 7685, 7691, 7702], // This is current prague without EOF }, /** * Description: Next feature hardfork after prague, internally used for verkle testing/implementation (incomplete/experimental) diff --git a/packages/tx/src/capabilities/legacy.ts b/packages/tx/src/capabilities/legacy.ts index be56064168..39813721e9 100644 --- a/packages/tx/src/capabilities/legacy.ts +++ b/packages/tx/src/capabilities/legacy.ts @@ -2,6 +2,7 @@ import { Address, BIGINT_0, SECP256K1_ORDER_DIV_2, + bigIntMax, bigIntToUnpaddedBytes, bytesToHex, ecrecover, @@ -167,8 +168,20 @@ export function getValidationErrors(tx: LegacyTxInterface): string[] { errors.push('Invalid Signature') } - if (tx.getIntrinsicGas() > tx.gasLimit) { - errors.push(`gasLimit is too low. given ${tx.gasLimit}, need at least ${tx.getIntrinsicGas()}`) + let intrinsicGas = tx.getIntrinsicGas() + if (tx.common.isActivatedEIP(7623)) { + let tokens = 0 + for (let i = 0; i < tx.data.length; i++) { + tokens += tx.data[i] === 0 ? 1 : 4 + } + const floorCost = + tx.common.param('txGas') + tx.common.param('totalCostFloorPerToken') * BigInt(tokens) + intrinsicGas = bigIntMax(intrinsicGas, floorCost) + } + if (intrinsicGas > tx.gasLimit) { + errors.push( + `gasLimit is too low. The gasLimit is lower than the minimum gas limit of ${tx.getIntrinsicGas()}, the gas limit is: ${tx.gasLimit}`, + ) } return errors diff --git a/packages/tx/src/params.ts b/packages/tx/src/params.ts index 66ce2302bb..d5de087267 100644 --- a/packages/tx/src/params.ts +++ b/packages/tx/src/params.ts @@ -44,6 +44,12 @@ export const paramsTx: ParamsDict = { blobCommitmentVersionKzg: 1, // The number indicated a versioned hash is a KZG commitment }, /** + * Increase calldata cost to reduce maximum block size + */ + 7623: { + totalCostFloorPerToken: 10, + }, + /** . * Set EOA account code for one transaction . */ 7702: { diff --git a/packages/vm/src/runTx.ts b/packages/vm/src/runTx.ts index 3697f810ad..7624dc34dc 100644 --- a/packages/vm/src/runTx.ts +++ b/packages/vm/src/runTx.ts @@ -12,6 +12,7 @@ import { KECCAK256_NULL, MAX_UINT64, SECP256K1_ORDER_DIV_2, + bigIntMax, bytesToBigInt, bytesToHex, bytesToUnprefixedHex, @@ -249,11 +250,24 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { // Validate gas limit against tx base fee (DataFee + TxFee + Creation Fee) const intrinsicGas = tx.getIntrinsicGas() + let floorCost = BIGINT_0 + + if (vm.common.isActivatedEIP(7623)) { + // Tx should at least cover the floor price for tx data + let tokens = 0 + for (let i = 0; i < tx.data.length; i++) { + tokens += tx.data[i] === 0 ? 1 : 4 + } + floorCost = + tx.common.param('txGas') + tx.common.param('totalCostFloorPerToken') * BigInt(tokens) + } + let gasLimit = tx.gasLimit - if (gasLimit < intrinsicGas) { + const minGasLimit = bigIntMax(intrinsicGas, floorCost) + if (gasLimit < minGasLimit) { const msg = _errorMsg( `tx gas limit ${Number(gasLimit)} is lower than the minimum gas limit of ${Number( - intrinsicGas, + minGasLimit, )}`, vm, block, @@ -614,6 +628,15 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { debugGas(`tx add baseFee ${intrinsicGas} to totalGasSpent (-> ${results.totalGasSpent})`) } + if (vm.common.isActivatedEIP(7623)) { + if (results.totalGasSpent < floorCost) { + results.totalGasSpent = floorCost + if (vm.DEBUG) { + debugGas(`tx apply floorCost ${floorCost} to totalGasSpent (-> ${results.totalGasSpent})`) + } + } + } + // Add blob gas used to result if (isBlob4844Tx(tx)) { results.blobGasUsed = totalblobGas @@ -635,6 +658,8 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { debug(`No tx gasRefund`) } } + + results.amountSpent = results.totalGasSpent * gasPrice // Update sender's balance diff --git a/packages/vm/test/api/EIPs/eip-7623.spec.ts b/packages/vm/test/api/EIPs/eip-7623.spec.ts new file mode 100644 index 0000000000..f362cb8b66 --- /dev/null +++ b/packages/vm/test/api/EIPs/eip-7623.spec.ts @@ -0,0 +1,125 @@ +import { createBlock } from '@ethereumjs/block' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { createLegacyTx } from '@ethereumjs/tx' +import { Account, Address, createZeroAddress, hexToBytes, privateToAddress } from '@ethereumjs/util' +import { assert, describe, it } from 'vitest' + +import { createVM, runTx } from '../../../src/index.js' + +const common = new Common({ chain: Mainnet, hardfork: Hardfork.Prague }) + +const pkey = hexToBytes(`0x${'20'.repeat(32)}`) +const GWEI = BigInt(1000000000) +const sender = new Address(privateToAddress(pkey)) + +const coinbase = new Address(hexToBytes(`0x${'ff'.repeat(20)}`)) + +const block = createBlock( + { + header: { + baseFeePerGas: 7, + coinbase, + }, + }, + { common }, +) + +const code = hexToBytes('0x60008080806001415AF100') +const contractAddress = new Address(hexToBytes(`0x${'ee'.repeat(20)}`)) + +async function getVM(common: Common) { + const vm = await createVM({ common }) + await vm.stateManager.putAccount(sender, new Account()) + const account = await vm.stateManager.getAccount(sender) + const balance = GWEI * BigInt(21000) * BigInt(10000000) + account!.balance = balance + await vm.stateManager.putAccount(sender, account!) + + await vm.stateManager.putCode(contractAddress, code) + return vm +} + +describe('EIP 7623 calldata cost increase tests', () => { + it('charges floor gas', async () => { + const vm = await getVM(common) + + const tx = createLegacyTx( + { + to: createZeroAddress(), + data: new Uint8Array(100).fill(1), + gasLimit: 1000000, + gasPrice: 10, + }, + { common }, + ).sign(pkey) + + const result = await runTx(vm, { + block, + tx, + skipHardForkValidation: true, + }) + + const baseCost = tx.common.param('txGas') + const floorCost = tx.common.param('totalCostFloorPerToken') + + const expected = baseCost + BigInt(tx.data.length) * BigInt(4) * floorCost + + assert.equal(result.totalGasSpent, expected) + }) + it('rejects transactions having a gas limit below the floor gas limit', async () => { + const vm = await getVM(common) + + const tx = createLegacyTx( + { + to: createZeroAddress(), + data: new Uint8Array(100).fill(1), + gasLimit: 21000 + 100 * 4, + gasPrice: 10, + }, + { common }, + ).sign(pkey) + try { + await runTx(vm, { + block, + tx, + skipHardForkValidation: true, + }) + assert.fail('runTx should throw') + } catch (e) { + assert.ok('Successfully failed') + } + }) + it('correctly charges execution gas instead of floor gas when execution gas exceeds the floor gas', async () => { + const vm = await getVM(common) + const to = createZeroAddress() + + // Store 1 in slot 1 + await vm.stateManager.putCode(to, hexToBytes('0x6001600155')) + + const tx = createLegacyTx( + { + to: createZeroAddress(), + data: new Uint8Array(100).fill(1), + gasLimit: 1000000, + gasPrice: 10, + }, + { common }, + ).sign(pkey) + + const result = await runTx(vm, { + block, + tx, + skipHardForkValidation: true, + }) + + const baseCost = tx.common.param('txGas') + + const expected = + baseCost + + BigInt(tx.data.length) * tx.common.param('txDataNonZeroGas') + + BigInt(2 * 3) + + BigInt(22_100) + + assert.equal(result.totalGasSpent, expected) + }) +}) diff --git a/packages/vm/test/t8n/t8ntool.ts b/packages/vm/test/t8n/t8ntool.ts index fe322ffac7..bfb93d3b79 100644 --- a/packages/vm/test/t8n/t8ntool.ts +++ b/packages/vm/test/t8n/t8ntool.ts @@ -171,6 +171,9 @@ export class TransitionTool { for (const txData of this.txsData) { try { const tx = createTx(txData, { common: this.common }) + if (!tx.isValid()) { + throw new Error(tx.getValidationErrors().join(', ')) + } // Set `allowNoBlobs` to `true`, since the test might not have the blob // The 4844-tx at this should still be valid, since it has the `blobHashes` field await builder.addTransaction(tx, { allowNoBlobs: true }) @@ -306,7 +309,7 @@ export class TransitionTool { output.requests = [] for (const request of requests) { if (request.bytes.length > 1) { - output.requests.push(bytesToHex(request.bytes)) + output.requests.push(bytesToHex(request.bytes.slice(1))) } } } From 98806ff463ec42ad8f2ae17246cb7090350ba1a1 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Thu, 19 Dec 2024 17:29:03 +1300 Subject: [PATCH 12/33] client: fix requests contract address (devnet-5) (#3818) --- packages/vm/src/params.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vm/src/params.ts b/packages/vm/src/params.ts index e1bc6d1b67..da50338b39 100644 --- a/packages/vm/src/params.ts +++ b/packages/vm/src/params.ts @@ -39,7 +39,7 @@ export const paramsVM: ParamsDict = { */ 2935: { // config - historyStorageAddress: '0x0aae40965e6800cd9b1f4b05ff21581047e3f91e', // The address where the historical blockhashes are stored + historyStorageAddress: '0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC', // The address where the historical blockhashes are stored historyServeWindow: 8192, // The amount of blocks to be served by the historical blockhash contract }, /** @@ -79,7 +79,7 @@ export const paramsVM: ParamsDict = { // config systemAddress: '0xfffffffffffffffffffffffffffffffffffffffe', // The system address to perform operations on the withdrawal requests predeploy address // See: https://github.com/ethereum/EIPs/pull/8934/files - withdrawalRequestPredeployAddress: '0x09Fc772D0857550724b07B850a4323f39112aAaA', // Address of the validator excess address + withdrawalRequestPredeployAddress: '0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA', // Address of the validator excess address }, /** @@ -89,7 +89,7 @@ export const paramsVM: ParamsDict = { // config systemAddress: '0xfffffffffffffffffffffffffffffffffffffffe', // The system address to perform operations on the consolidation requests predeploy address // See: https://github.com/ethereum/EIPs/pull/8934/files - consolidationRequestPredeployAddress: '0x01aBEa29659e5e97C95107F20bb753cD3e09bBBb', // Address of the consolidations contract + consolidationRequestPredeployAddress: '0x00431F263cE400f4455c2dCf564e53007Ca4bbBb', // Address of the consolidations contract }, /** . * Shard Blob Transactions From 5079664401866fa2d3b3de04686827334687bc32 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 22 Dec 2024 03:28:45 +0100 Subject: [PATCH 13/33] update chainid to uint256 --- packages/tx/src/util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tx/src/util.ts b/packages/tx/src/util.ts index 983111fdae..5a051167a4 100644 --- a/packages/tx/src/util.ts +++ b/packages/tx/src/util.ts @@ -210,8 +210,8 @@ export class AuthorizationLists { if (address.length !== 20) { throw new Error('Invalid EIP-7702 transaction: address length should be 20 bytes') } - if (bytesToBigInt(chainId) > MAX_UINT64) { - throw new Error('Invalid EIP-7702 transaction: chainId exceeds 2^64 - 1') + if (bytesToBigInt(chainId) > MAX_INTEGER) { + throw new Error('Invalid EIP-7702 transaction: chainId exceeds 2^256 - 1') } if (bytesToBigInt(nonce) > MAX_UINT64) { throw new Error('Invalid EIP-7702 transaction: nonce exceeds 2^64 - 1') From c827859d1d3accdc1cb7202c01eb4f3bf99108b2 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 22 Dec 2024 13:07:10 +0100 Subject: [PATCH 14/33] evm: update bls gas (eips PR 9097) --- packages/evm/src/params.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/evm/src/params.ts b/packages/evm/src/params.ts index 397e746e20..4ebf09fb5e 100644 --- a/packages/evm/src/params.ts +++ b/packages/evm/src/params.ts @@ -234,14 +234,14 @@ export const paramsEVM: ParamsDict = { */ 2537: { // gasPrices - bls12381G1AddGas: 500, // Gas cost of a single BLS12-381 G1 addition precompile-call + bls12381G1AddGas: 375, // Gas cost of a single BLS12-381 G1 addition precompile-call bls12381G1MulGas: 12000, // Gas cost of a single BLS12-381 G1 multiplication precompile-call - bls12381G2AddGas: 800, // Gas cost of a single BLS12-381 G2 addition precompile-call - bls12381G2MulGas: 45000, // Gas cost of a single BLS12-381 G2 multiplication precompile-call + bls12381G2AddGas: 600, // Gas cost of a single BLS12-381 G2 addition precompile-call + bls12381G2MulGas: 22500, // Gas cost of a single BLS12-381 G2 multiplication precompile-call bls12381PairingBaseGas: 65000, // Base gas cost of BLS12-381 pairing check bls12381PairingPerPairGas: 43000, // Per-pair gas cost of BLS12-381 pairing check bls12381MapG1Gas: 5500, // Gas cost of BLS12-381 map field element to G1 - bls12381MapG2Gas: 75000, // Gas cost of BLS12-381 map field element to G2 + bls12381MapG2Gas: 23800, // Gas cost of BLS12-381 map field element to G2 }, /** . * Gas cost increases for state access opcodes From e4adff7f59c884aba77123a25c4de511abe00eef Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 22 Dec 2024 13:12:58 +0100 Subject: [PATCH 15/33] evm: bls update msm gas (eips PR 9116) --- .../evm/src/precompiles/0d-bls12-g1msm.ts | 8 +- .../evm/src/precompiles/10-bls12-g2msm.ts | 8 +- .../src/precompiles/bls12_381/constants.ts | 391 ++++++++++++------ .../evm/src/precompiles/bls12_381/util.ts | 14 +- 4 files changed, 281 insertions(+), 140 deletions(-) diff --git a/packages/evm/src/precompiles/0d-bls12-g1msm.ts b/packages/evm/src/precompiles/0d-bls12-g1msm.ts index ac67b5be48..5ec0e3829f 100644 --- a/packages/evm/src/precompiles/0d-bls12-g1msm.ts +++ b/packages/evm/src/precompiles/0d-bls12-g1msm.ts @@ -3,7 +3,11 @@ import { bytesToHex } from '@ethereumjs/util' import { EvmErrorResult, OOGResult } from '../evm.js' import { ERROR, EvmError } from '../exceptions.js' -import { leading16ZeroBytesCheck, msmGasUsed } from './bls12_381/index.js' +import { + BLS_GAS_DISCOUNT_PAIRS_G1, + leading16ZeroBytesCheck, + msmGasUsed, +} from './bls12_381/index.js' import { gasLimitCheck, moduloLengthCheck } from './util.js' import { getPrecompileName } from './index.js' @@ -29,7 +33,7 @@ export async function precompile0d(opts: PrecompileInput): Promise { // validation (same for g2msm) const numPairs = Math.floor(inputData.length / 160) const gasUsedPerPair = opts.common.paramByEIP('bls12381G1MulGas', 2537) ?? BigInt(0) - const gasUsed = msmGasUsed(numPairs, gasUsedPerPair) + const gasUsed = msmGasUsed(numPairs, gasUsedPerPair, BLS_GAS_DISCOUNT_PAIRS_G1) if (!gasLimitCheck(opts, gasUsed, pName)) { return OOGResult(opts.gasLimit) diff --git a/packages/evm/src/precompiles/10-bls12-g2msm.ts b/packages/evm/src/precompiles/10-bls12-g2msm.ts index b327e3ca6f..b5255ee696 100644 --- a/packages/evm/src/precompiles/10-bls12-g2msm.ts +++ b/packages/evm/src/precompiles/10-bls12-g2msm.ts @@ -3,7 +3,11 @@ import { bytesToHex } from '@ethereumjs/util' import { EvmErrorResult, OOGResult } from '../evm.js' import { ERROR, EvmError } from '../exceptions.js' -import { leading16ZeroBytesCheck, msmGasUsed } from './bls12_381/index.js' +import { + BLS_GAS_DISCOUNT_PAIRS_G2, + leading16ZeroBytesCheck, + msmGasUsed, +} from './bls12_381/index.js' import { gasLimitCheck, moduloLengthCheck } from './util.js' import { getPrecompileName } from './index.js' @@ -24,7 +28,7 @@ export async function precompile10(opts: PrecompileInput): Promise { const numPairs = Math.floor(opts.data.length / 288) const gasUsedPerPair = opts.common.paramByEIP('bls12381G2MulGas', 2537) ?? BigInt(0) - const gasUsed = msmGasUsed(numPairs, gasUsedPerPair) + const gasUsed = msmGasUsed(numPairs, gasUsedPerPair, BLS_GAS_DISCOUNT_PAIRS_G2) if (!gasLimitCheck(opts, gasUsed, pName)) { return OOGResult(opts.gasLimit) diff --git a/packages/evm/src/precompiles/bls12_381/constants.ts b/packages/evm/src/precompiles/bls12_381/constants.ts index a869e7cb5b..f143bd053f 100644 --- a/packages/evm/src/precompiles/bls12_381/constants.ts +++ b/packages/evm/src/precompiles/bls12_381/constants.ts @@ -14,134 +14,265 @@ export const BLS_G2_INFINITY_POINT_BYTES = new Uint8Array(BLS_G2_POINT_BYTE_LENG export const BLS_ZERO_BUFFER = new Uint8Array(32) export const BLS_ONE_BUFFER = concatBytes(new Uint8Array(31), hexToBytes('0x01')) -// gas discount pairs taken from EIP-2537 `bls12381MultiExpGasDiscount` parameter -export const BLS_GAS_DISCOUNT_PAIRS = [ - [1, 1200], - [2, 888], - [3, 764], - [4, 641], - [5, 594], - [6, 547], - [7, 500], - [8, 453], - [9, 438], - [10, 423], - [11, 408], - [12, 394], - [13, 379], - [14, 364], - [15, 349], - [16, 334], - [17, 330], - [18, 326], - [19, 322], - [20, 318], - [21, 314], - [22, 310], - [23, 306], - [24, 302], - [25, 298], - [26, 294], - [27, 289], - [28, 285], - [29, 281], - [30, 277], - [31, 273], - [32, 269], - [33, 268], - [34, 266], - [35, 265], - [36, 263], - [37, 262], - [38, 260], - [39, 259], - [40, 257], - [41, 256], - [42, 254], - [43, 253], - [44, 251], - [45, 250], - [46, 248], - [47, 247], - [48, 245], - [49, 244], - [50, 242], - [51, 241], - [52, 239], - [53, 238], - [54, 236], - [55, 235], - [56, 233], - [57, 232], - [58, 231], - [59, 229], - [60, 228], - [61, 226], - [62, 225], - [63, 223], - [64, 222], - [65, 221], - [66, 220], - [67, 219], - [68, 219], - [69, 218], - [70, 217], - [71, 216], - [72, 216], - [73, 215], - [74, 214], - [75, 213], - [76, 213], - [77, 212], - [78, 211], - [79, 211], - [80, 210], - [81, 209], - [82, 208], - [83, 208], - [84, 207], - [85, 206], - [86, 205], - [87, 205], - [88, 204], - [89, 203], - [90, 202], - [91, 202], - [92, 201], - [93, 200], - [94, 199], - [95, 199], - [96, 198], - [97, 197], - [98, 196], - [99, 196], - [100, 195], - [101, 194], - [102, 193], - [103, 193], - [104, 192], - [105, 191], - [106, 191], - [107, 190], - [108, 189], - [109, 188], - [110, 188], - [111, 187], - [112, 186], - [113, 185], - [114, 185], - [115, 184], - [116, 183], - [117, 182], - [118, 182], - [119, 181], - [120, 180], - [121, 179], - [122, 179], - [123, 178], - [124, 177], - [125, 176], - [126, 176], - [127, 175], - [128, 174], +// G1/G2 MSM discount constants taken from EIP-2537 +export const BLS_GAS_DISCOUNT_PAIRS_G1: [number, number][] = [ + [1, 1000], + [2, 949], + [3, 848], + [4, 797], + [5, 764], + [6, 750], + [7, 738], + [8, 728], + [9, 719], + [10, 712], + [11, 705], + [12, 698], + [13, 692], + [14, 687], + [15, 682], + [16, 677], + [17, 673], + [18, 669], + [19, 665], + [20, 661], + [21, 658], + [22, 654], + [23, 651], + [24, 648], + [25, 645], + [26, 642], + [27, 640], + [28, 637], + [29, 635], + [30, 632], + [31, 630], + [32, 627], + [33, 625], + [34, 623], + [35, 621], + [36, 619], + [37, 617], + [38, 615], + [39, 613], + [40, 611], + [41, 609], + [42, 608], + [43, 606], + [44, 604], + [45, 603], + [46, 601], + [47, 599], + [48, 598], + [49, 596], + [50, 595], + [51, 593], + [52, 592], + [53, 591], + [54, 589], + [55, 588], + [56, 586], + [57, 585], + [58, 584], + [59, 582], + [60, 581], + [61, 580], + [62, 579], + [63, 577], + [64, 576], + [65, 575], + [66, 574], + [67, 573], + [68, 572], + [69, 570], + [70, 569], + [71, 568], + [72, 567], + [73, 566], + [74, 565], + [75, 564], + [76, 563], + [77, 562], + [78, 561], + [79, 560], + [80, 559], + [81, 558], + [82, 557], + [83, 556], + [84, 555], + [85, 554], + [86, 553], + [87, 552], + [88, 551], + [89, 550], + [90, 549], + [91, 548], + [92, 547], + [93, 547], + [94, 546], + [95, 545], + [96, 544], + [97, 543], + [98, 542], + [99, 541], + [100, 540], + [101, 540], + [102, 539], + [103, 538], + [104, 537], + [105, 536], + [106, 536], + [107, 535], + [108, 534], + [109, 533], + [110, 532], + [111, 532], + [112, 531], + [113, 530], + [114, 529], + [115, 528], + [116, 528], + [117, 527], + [118, 526], + [119, 525], + [120, 525], + [121, 524], + [122, 523], + [123, 522], + [124, 522], + [125, 521], + [126, 520], + [127, 520], + [128, 519], +] + +export const BLS_GAS_DISCOUNT_PAIRS_G2: [number, number][] = [ + [1, 1000], + [2, 1000], + [3, 923], + [4, 884], + [5, 855], + [6, 832], + [7, 812], + [8, 796], + [9, 782], + [10, 770], + [11, 759], + [12, 749], + [13, 740], + [14, 732], + [15, 724], + [16, 717], + [17, 711], + [18, 704], + [19, 699], + [20, 693], + [21, 688], + [22, 683], + [23, 679], + [24, 674], + [25, 670], + [26, 666], + [27, 663], + [28, 659], + [29, 655], + [30, 652], + [31, 649], + [32, 646], + [33, 643], + [34, 640], + [35, 637], + [36, 634], + [37, 632], + [38, 629], + [39, 627], + [40, 624], + [41, 622], + [42, 620], + [43, 618], + [44, 615], + [45, 613], + [46, 611], + [47, 609], + [48, 607], + [49, 606], + [50, 604], + [51, 602], + [52, 600], + [53, 598], + [54, 597], + [55, 595], + [56, 593], + [57, 592], + [58, 590], + [59, 589], + [60, 587], + [61, 586], + [62, 584], + [63, 583], + [64, 582], + [65, 580], + [66, 579], + [67, 578], + [68, 576], + [69, 575], + [70, 574], + [71, 573], + [72, 571], + [73, 570], + [74, 569], + [75, 568], + [76, 567], + [77, 566], + [78, 565], + [79, 563], + [80, 562], + [81, 561], + [82, 560], + [83, 559], + [84, 558], + [85, 557], + [86, 556], + [87, 555], + [88, 554], + [89, 553], + [90, 552], + [91, 552], + [92, 551], + [93, 550], + [94, 549], + [95, 548], + [96, 547], + [97, 546], + [98, 545], + [99, 545], + [100, 544], + [101, 543], + [102, 542], + [103, 541], + [104, 541], + [105, 540], + [106, 539], + [107, 538], + [108, 537], + [109, 537], + [110, 536], + [111, 535], + [112, 535], + [113, 534], + [114, 533], + [115, 532], + [116, 532], + [117, 531], + [118, 530], + [119, 530], + [120, 529], + [121, 528], + [122, 528], + [123, 527], + [124, 526], + [125, 526], + [126, 525], + [127, 524], + [128, 524], ] diff --git a/packages/evm/src/precompiles/bls12_381/util.ts b/packages/evm/src/precompiles/bls12_381/util.ts index d6dbb2f8ef..e4d449033d 100644 --- a/packages/evm/src/precompiles/bls12_381/util.ts +++ b/packages/evm/src/precompiles/bls12_381/util.ts @@ -1,7 +1,5 @@ import { equalsBytes } from '@ethereumjs/util' -import { BLS_GAS_DISCOUNT_PAIRS } from './constants.js' - import type { PrecompileInput } from '../types.js' const ZERO_BYTES_16 = new Uint8Array(16) @@ -14,15 +12,19 @@ const ZERO_BYTES_16 = new Uint8Array(16) * @param gasUsedPerPair * @returns */ -export const msmGasUsed = (numPairs: number, gasUsedPerPair: bigint) => { - const gasDiscountMax = BLS_GAS_DISCOUNT_PAIRS[BLS_GAS_DISCOUNT_PAIRS.length - 1][1] +export const msmGasUsed = ( + numPairs: number, + gasUsedPerPair: bigint, + discountTable: [number, number][], +) => { + const gasDiscountMax = discountTable[discountTable.length - 1][1] let gasDiscountMultiplier - if (numPairs <= BLS_GAS_DISCOUNT_PAIRS.length) { + if (numPairs <= discountTable.length) { if (numPairs === 0) { gasDiscountMultiplier = 0 // this implicitly sets gasUsed to 0 as per the EIP. } else { - gasDiscountMultiplier = BLS_GAS_DISCOUNT_PAIRS[numPairs - 1][1] + gasDiscountMultiplier = discountTable[numPairs - 1][1] } } else { gasDiscountMultiplier = gasDiscountMax From 34a4882cb24bdcafe6fc68786abbdcf3dab75cdb Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 22 Dec 2024 13:13:47 +0100 Subject: [PATCH 16/33] evm: bls update pairing gas (eips PR 9098) --- packages/evm/src/params.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/evm/src/params.ts b/packages/evm/src/params.ts index 4ebf09fb5e..03ef11aa00 100644 --- a/packages/evm/src/params.ts +++ b/packages/evm/src/params.ts @@ -238,8 +238,8 @@ export const paramsEVM: ParamsDict = { bls12381G1MulGas: 12000, // Gas cost of a single BLS12-381 G1 multiplication precompile-call bls12381G2AddGas: 600, // Gas cost of a single BLS12-381 G2 addition precompile-call bls12381G2MulGas: 22500, // Gas cost of a single BLS12-381 G2 multiplication precompile-call - bls12381PairingBaseGas: 65000, // Base gas cost of BLS12-381 pairing check - bls12381PairingPerPairGas: 43000, // Per-pair gas cost of BLS12-381 pairing check + bls12381PairingBaseGas: 37700, // Base gas cost of BLS12-381 pairing check + bls12381PairingPerPairGas: 32600, // Per-pair gas cost of BLS12-381 pairing check bls12381MapG1Gas: 5500, // Gas cost of BLS12-381 map field element to G1 bls12381MapG2Gas: 23800, // Gas cost of BLS12-381 map field element to G2 }, From 3938e7fdb43d1869206d0a68a432dd5720806253 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 22 Dec 2024 13:20:35 +0100 Subject: [PATCH 17/33] evm: rename bls files and remove g1mul, g2mul (eips PR 8945) --- .../{0d-bls12-g1msm.ts => 0c-bls12-g1msm.ts} | 2 +- .../evm/src/precompiles/0c-bls12-g1mul.ts | 55 ----------------- .../{0e-bls12-g2add.ts => 0d-bls12-g2add.ts} | 2 +- .../{10-bls12-g2msm.ts => 0e-bls12-g2msm.ts} | 2 +- .../evm/src/precompiles/0f-bls12-g2mul.ts | 59 ------------------- ...1-bls12-pairing.ts => 0f-bls12-pairing.ts} | 2 +- ...p-fp-to-g1.ts => 10-bls12-map-fp-to-g1.ts} | 2 +- ...fp2-to-g2.ts => 11-bls12-map-fp2-to-g2.ts} | 2 +- packages/evm/src/precompiles/index.ts | 46 ++++----------- 9 files changed, 18 insertions(+), 154 deletions(-) rename packages/evm/src/precompiles/{0d-bls12-g1msm.ts => 0c-bls12-g1msm.ts} (97%) delete mode 100644 packages/evm/src/precompiles/0c-bls12-g1mul.ts rename packages/evm/src/precompiles/{0e-bls12-g2add.ts => 0d-bls12-g2add.ts} (96%) rename packages/evm/src/precompiles/{10-bls12-g2msm.ts => 0e-bls12-g2msm.ts} (97%) delete mode 100644 packages/evm/src/precompiles/0f-bls12-g2mul.ts rename packages/evm/src/precompiles/{11-bls12-pairing.ts => 0f-bls12-pairing.ts} (97%) rename packages/evm/src/precompiles/{12-bls12-map-fp-to-g1.ts => 10-bls12-map-fp-to-g1.ts} (96%) rename packages/evm/src/precompiles/{13-bls12-map-fp2-to-g2.ts => 11-bls12-map-fp2-to-g2.ts} (96%) diff --git a/packages/evm/src/precompiles/0d-bls12-g1msm.ts b/packages/evm/src/precompiles/0c-bls12-g1msm.ts similarity index 97% rename from packages/evm/src/precompiles/0d-bls12-g1msm.ts rename to packages/evm/src/precompiles/0c-bls12-g1msm.ts index 5ec0e3829f..dec05e962e 100644 --- a/packages/evm/src/precompiles/0d-bls12-g1msm.ts +++ b/packages/evm/src/precompiles/0c-bls12-g1msm.ts @@ -15,7 +15,7 @@ import { getPrecompileName } from './index.js' import type { EVMBLSInterface, ExecResult } from '../types.js' import type { PrecompileInput } from './types.js' -export async function precompile0d(opts: PrecompileInput): Promise { +export async function precompile0c(opts: PrecompileInput): Promise { const pName = getPrecompileName('0d') const bls = (opts._EVM)._bls! as EVMBLSInterface diff --git a/packages/evm/src/precompiles/0c-bls12-g1mul.ts b/packages/evm/src/precompiles/0c-bls12-g1mul.ts deleted file mode 100644 index aedb566405..0000000000 --- a/packages/evm/src/precompiles/0c-bls12-g1mul.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { bytesToHex } from '@ethereumjs/util' - -import { EvmErrorResult, OOGResult } from '../evm.js' -import { ERROR, EvmError } from '../exceptions.js' - -import { leading16ZeroBytesCheck } from './bls12_381/index.js' -import { equalityLengthCheck, gasLimitCheck } from './util.js' - -import { getPrecompileName } from './index.js' - -import type { EVMBLSInterface, ExecResult } from '../types.js' -import type { PrecompileInput } from './types.js' - -export async function precompile0c(opts: PrecompileInput): Promise { - const pName = getPrecompileName('0c') - const bls = (opts._EVM)._bls! as EVMBLSInterface - - // note: the gas used is constant; even if the input is incorrect. - const gasUsed = opts.common.paramByEIP('bls12381G1MulGas', 2537) ?? BigInt(0) - if (!gasLimitCheck(opts, gasUsed, pName)) { - return OOGResult(opts.gasLimit) - } - - if (!equalityLengthCheck(opts, 160, pName)) { - return EvmErrorResult(new EvmError(ERROR.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit) - } - - // check if some parts of input are zero bytes. - const zeroByteRanges = [ - [0, 16], - [64, 80], - ] - if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName)) { - return EvmErrorResult(new EvmError(ERROR.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit) - } - - let returnValue - try { - returnValue = bls.mulG1(opts.data) - } catch (e: any) { - if (opts._debug !== undefined) { - opts._debug(`${pName} failed: ${e.message}`) - } - return EvmErrorResult(e, opts.gasLimit) - } - - if (opts._debug !== undefined) { - opts._debug(`${pName} return value=${bytesToHex(returnValue)}`) - } - - return { - executionGasUsed: gasUsed, - returnValue, - } -} diff --git a/packages/evm/src/precompiles/0e-bls12-g2add.ts b/packages/evm/src/precompiles/0d-bls12-g2add.ts similarity index 96% rename from packages/evm/src/precompiles/0e-bls12-g2add.ts rename to packages/evm/src/precompiles/0d-bls12-g2add.ts index d1bc0e4807..dbbd53a98f 100644 --- a/packages/evm/src/precompiles/0e-bls12-g2add.ts +++ b/packages/evm/src/precompiles/0d-bls12-g2add.ts @@ -11,7 +11,7 @@ import { getPrecompileName } from './index.js' import type { EVMBLSInterface, ExecResult } from '../types.js' import type { PrecompileInput } from './types.js' -export async function precompile0e(opts: PrecompileInput): Promise { +export async function precompile0d(opts: PrecompileInput): Promise { const pName = getPrecompileName('0e') const bls = (opts._EVM)._bls! as EVMBLSInterface diff --git a/packages/evm/src/precompiles/10-bls12-g2msm.ts b/packages/evm/src/precompiles/0e-bls12-g2msm.ts similarity index 97% rename from packages/evm/src/precompiles/10-bls12-g2msm.ts rename to packages/evm/src/precompiles/0e-bls12-g2msm.ts index b5255ee696..554ad6fd24 100644 --- a/packages/evm/src/precompiles/10-bls12-g2msm.ts +++ b/packages/evm/src/precompiles/0e-bls12-g2msm.ts @@ -15,7 +15,7 @@ import { getPrecompileName } from './index.js' import type { EVMBLSInterface, ExecResult } from '../types.js' import type { PrecompileInput } from './types.js' -export async function precompile10(opts: PrecompileInput): Promise { +export async function precompile0e(opts: PrecompileInput): Promise { const pName = getPrecompileName('10') const bls = (opts._EVM)._bls! as EVMBLSInterface diff --git a/packages/evm/src/precompiles/0f-bls12-g2mul.ts b/packages/evm/src/precompiles/0f-bls12-g2mul.ts deleted file mode 100644 index 3e6e16d6eb..0000000000 --- a/packages/evm/src/precompiles/0f-bls12-g2mul.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { bytesToHex } from '@ethereumjs/util' - -import { EvmErrorResult, OOGResult } from '../evm.js' -import { ERROR, EvmError } from '../exceptions.js' - -import { leading16ZeroBytesCheck } from './bls12_381/index.js' -import { equalityLengthCheck, gasLimitCheck } from './util.js' - -import { getPrecompileName } from './index.js' - -import type { EVMBLSInterface, ExecResult } from '../types.js' -import type { PrecompileInput } from './types.js' - -export async function precompile0f(opts: PrecompileInput): Promise { - const pName = getPrecompileName('0f') - const bls = (opts._EVM)._bls! as EVMBLSInterface - - // note: the gas used is constant; even if the input is incorrect. - const gasUsed = opts.common.paramByEIP('bls12381G2MulGas', 2537) ?? BigInt(0) - if (!gasLimitCheck(opts, gasUsed, pName)) { - return OOGResult(opts.gasLimit) - } - - if (!equalityLengthCheck(opts, 288, pName)) { - return EvmErrorResult(new EvmError(ERROR.BLS_12_381_INVALID_INPUT_LENGTH), opts.gasLimit) - } - - // check if some parts of input are zero bytes. - const zeroByteRanges = [ - [0, 16], - [64, 80], - [128, 144], - [192, 208], - ] - if (!leading16ZeroBytesCheck(opts, zeroByteRanges, pName)) { - return EvmErrorResult(new EvmError(ERROR.BLS_12_381_POINT_NOT_ON_CURVE), opts.gasLimit) - } - - // TODO: verify that point is on G2 - - let returnValue - try { - returnValue = bls.mulG2(opts.data) - } catch (e: any) { - if (opts._debug !== undefined) { - opts._debug(`${pName} failed: ${e.message}`) - } - return EvmErrorResult(e, opts.gasLimit) - } - - if (opts._debug !== undefined) { - opts._debug(`${pName} return value=${bytesToHex(returnValue)}`) - } - - return { - executionGasUsed: gasUsed, - returnValue, - } -} diff --git a/packages/evm/src/precompiles/11-bls12-pairing.ts b/packages/evm/src/precompiles/0f-bls12-pairing.ts similarity index 97% rename from packages/evm/src/precompiles/11-bls12-pairing.ts rename to packages/evm/src/precompiles/0f-bls12-pairing.ts index fa8a03ecc9..c8ee1df3c5 100644 --- a/packages/evm/src/precompiles/11-bls12-pairing.ts +++ b/packages/evm/src/precompiles/0f-bls12-pairing.ts @@ -11,7 +11,7 @@ import { getPrecompileName } from './index.js' import type { EVMBLSInterface, ExecResult } from '../types.js' import type { PrecompileInput } from './types.js' -export async function precompile11(opts: PrecompileInput): Promise { +export async function precompile0f(opts: PrecompileInput): Promise { const pName = getPrecompileName('11') const bls = (opts._EVM)._bls! as EVMBLSInterface diff --git a/packages/evm/src/precompiles/12-bls12-map-fp-to-g1.ts b/packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts similarity index 96% rename from packages/evm/src/precompiles/12-bls12-map-fp-to-g1.ts rename to packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts index 93381090db..79ce977ac1 100644 --- a/packages/evm/src/precompiles/12-bls12-map-fp-to-g1.ts +++ b/packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts @@ -11,7 +11,7 @@ import { getPrecompileName } from './index.js' import type { EVMBLSInterface, ExecResult } from '../types.js' import type { PrecompileInput } from './types.js' -export async function precompile12(opts: PrecompileInput): Promise { +export async function precompile10(opts: PrecompileInput): Promise { const pName = getPrecompileName('12') const bls = (opts._EVM)._bls! as EVMBLSInterface diff --git a/packages/evm/src/precompiles/13-bls12-map-fp2-to-g2.ts b/packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts similarity index 96% rename from packages/evm/src/precompiles/13-bls12-map-fp2-to-g2.ts rename to packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts index ff4a60f3c4..0c6882d025 100644 --- a/packages/evm/src/precompiles/13-bls12-map-fp2-to-g2.ts +++ b/packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts @@ -11,7 +11,7 @@ import { getPrecompileName } from './index.js' import type { EVMBLSInterface, ExecResult } from '../types.js' import type { PrecompileInput } from './types.js' -export async function precompile13(opts: PrecompileInput): Promise { +export async function precompile11(opts: PrecompileInput): Promise { const pName = getPrecompileName('13') const bls = (opts._EVM)._bls! as EVMBLSInterface diff --git a/packages/evm/src/precompiles/index.ts b/packages/evm/src/precompiles/index.ts index 03fef4f1c9..ae7a44fb65 100644 --- a/packages/evm/src/precompiles/index.ts +++ b/packages/evm/src/precompiles/index.ts @@ -12,14 +12,12 @@ import { precompile08 } from './08-bn254-pairing.js' import { precompile09 } from './09-blake2f.js' import { precompile0a } from './0a-kzg-point-evaluation.js' import { precompile0b } from './0b-bls12-g1add.js' -import { precompile0c } from './0c-bls12-g1mul.js' -import { precompile0d } from './0d-bls12-g1msm.js' -import { precompile0e } from './0e-bls12-g2add.js' -import { precompile0f } from './0f-bls12-g2mul.js' -import { precompile10 } from './10-bls12-g2msm.js' -import { precompile11 } from './11-bls12-pairing.js' -import { precompile12 } from './12-bls12-map-fp-to-g1.js' -import { precompile13 } from './13-bls12-map-fp2-to-g2.js' +import { precompile0c } from './0c-bls12-g1msm.js' +import { precompile0d } from './0d-bls12-g2add.js' +import { precompile0e } from './0e-bls12-g2msm.js' +import { precompile0f } from './0f-bls12-pairing.js' +import { precompile10 } from './10-bls12-map-fp-to-g1.js' +import { precompile11 } from './11-bls12-map-fp2-to-g2.js' import { MCLBLS, NobleBLS } from './bls12_381/index.js' import { NobleBN254, RustBN254 } from './bn254/index.js' @@ -165,7 +163,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile0c, - name: 'BLS12_G1MUL (0x0c)', + name: 'BLS12_G1MSM (0x0c)', }, { address: BYTES_19 + '0d', @@ -174,7 +172,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile0d, - name: 'BLS12_G1MSM (0x0d)', + name: 'BLS12_G1ADD (0x0d)', }, { address: BYTES_19 + '0e', @@ -183,7 +181,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile0e, - name: 'BLS12_G2ADD (0x0e)', + name: 'BLS12_G2MSM (0x0e)', }, { address: BYTES_19 + '0f', @@ -192,7 +190,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile0f, - name: 'BLS12_G2MUL (0x0f)', + name: 'BLS12_PAIRING (0x0f)', }, { address: BYTES_19 + '10', @@ -201,7 +199,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile10, - name: 'BLS12_G2MSM (0x10)', + name: 'BLS12_MAP_FP_TO_G1 (0x10)', }, { address: BYTES_19 + '11', @@ -210,25 +208,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile11, - name: 'BLS12_PAIRING (0x11)', - }, - { - address: BYTES_19 + '12', - check: { - type: PrecompileAvailabilityCheck.EIP, - param: 2537, - }, - precompile: precompile12, - name: 'BLS12_MAP_FP_TO_G1 (0x12)', - }, - { - address: BYTES_19 + '13', - check: { - type: PrecompileAvailabilityCheck.EIP, - param: 2537, - }, - precompile: precompile13, - name: 'BLS12_MAP_FP2_TO_G2 (0x13)', + name: 'BLS12_MAP_FP_TO_G2 (0x11)', }, ] @@ -250,8 +230,6 @@ const precompiles: Precompiles = { [BYTES_19 + '0f']: precompile0f, [BYTES_19 + '10']: precompile10, [BYTES_19 + '11']: precompile11, - [BYTES_19 + '12']: precompile12, - [BYTES_19 + '13']: precompile13, } type DeletePrecompile = { From eadbf2c56b0afb3615da8ccd577e3baf81cf1a0d Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 5 Jan 2025 19:10:48 +0100 Subject: [PATCH 18/33] evm: update 2537 addresses in test --- .../evm/test/precompiles/eip-2537-bls.spec.ts | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/evm/test/precompiles/eip-2537-bls.spec.ts b/packages/evm/test/precompiles/eip-2537-bls.spec.ts index 7f552e74c5..4a7f622c92 100644 --- a/packages/evm/test/precompiles/eip-2537-bls.spec.ts +++ b/packages/evm/test/precompiles/eip-2537-bls.spec.ts @@ -15,23 +15,19 @@ const files = readdirSync(dir) const precompileMap: { [key: string]: string } = { 'add_G1_bls.json': '000000000000000000000000000000000000000b', - 'add_G2_bls.json': '000000000000000000000000000000000000000e', + 'add_G2_bls.json': '000000000000000000000000000000000000000d', 'fail-add_G1_bls.json': '000000000000000000000000000000000000000b', - 'fail-add_G2_bls.json': '000000000000000000000000000000000000000e', - 'fail-map_fp2_to_G2_bls.json': '0000000000000000000000000000000000000013', - 'fail-map_fp_to_G1_bls.json': '0000000000000000000000000000000000000012', - 'fail-mul_G1_bls.json': '000000000000000000000000000000000000000c', - 'fail-mul_G2_bls.json': '000000000000000000000000000000000000000f', + 'fail-add_G2_bls.json': '000000000000000000000000000000000000000d', + 'fail-map_fp2_to_G2_bls.json': '0000000000000000000000000000000000000011', + 'fail-map_fp_to_G1_bls.json': '0000000000000000000000000000000000000010', 'fail-multiexp_G1_bls.json': '000000000000000000000000000000000000000c', - 'fail-multiexp_G2_bls.json': '0000000000000000000000000000000000000010', - 'fail-pairing_check_bls.json': '0000000000000000000000000000000000000011', - 'map_fp2_to_G2_bls.json': '0000000000000000000000000000000000000013', - 'map_fp_to_G1_bls.json': '0000000000000000000000000000000000000012', - 'mul_G1_bls.json': '000000000000000000000000000000000000000c', - 'mul_G2_bls.json': '000000000000000000000000000000000000000f', - 'multiexp_G1_bls.json': '000000000000000000000000000000000000000d', - 'multiexp_G2_bls.json': '0000000000000000000000000000000000000010', - 'pairing_check_bls.json': '0000000000000000000000000000000000000011', + 'fail-multiexp_G2_bls.json': '000000000000000000000000000000000000000e', + 'fail-pairing_check_bls.json': '000000000000000000000000000000000000000f', + 'map_fp2_to_G2_bls.json': '0000000000000000000000000000000000000011', + 'map_fp_to_G1_bls.json': '0000000000000000000000000000000000000010', + 'multiexp_G1_bls.json': '000000000000000000000000000000000000000c', + 'multiexp_G2_bls.json': '000000000000000000000000000000000000000e', + 'pairing_check_bls.json': '000000000000000000000000000000000000000f', } const common = new Common({ chain: Mainnet, hardfork: Hardfork.Berlin, eips: [2537] }) @@ -93,7 +89,7 @@ for (const bls of [undefined, mclbls]) { } const precompileAddressStart = 0x0b -const precompileAddressEnd = 0x13 +const precompileAddressEnd = 0x11 const precompiles: PrefixedHexString[] = [] From e2b355a870e76503127a1fcef8a950c102a6bb07 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Sun, 5 Jan 2025 19:20:55 +0100 Subject: [PATCH 19/33] tx: add eip-7691 param --- packages/tx/src/params.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/tx/src/params.ts b/packages/tx/src/params.ts index d5de087267..84467d803b 100644 --- a/packages/tx/src/params.ts +++ b/packages/tx/src/params.ts @@ -58,4 +58,10 @@ export const paramsTx: ParamsDict = { perAuthBaseGas: 12500, // Gas cost of each authority item, provided the authority exists in the trie perEmptyAccountCost: 25000, // Gas cost of each authority item, in case the authority does not exist in the trie }, + /** + . * Shard Blob Transactions + . */ + 7691: { + maxblobGasPerBlock: 1179648, // The max blob gas allowable per block + }, } From 4b863bf79bb35f3d0672809fac7f26b49e031e96 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 6 Jan 2025 07:30:21 +0100 Subject: [PATCH 20/33] tx: add required params to common --- packages/tx/src/params.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/tx/src/params.ts b/packages/tx/src/params.ts index 84467d803b..12afc54409 100644 --- a/packages/tx/src/params.ts +++ b/packages/tx/src/params.ts @@ -42,6 +42,8 @@ export const paramsTx: ParamsDict = { . */ 4844: { blobCommitmentVersionKzg: 1, // The number indicated a versioned hash is a KZG commitment + blobGasPerBlob: 131072, // The base fee for blob gas per blob + maxblobGasPerBlock: 786432, // The max blob gas allowable per block }, /** * Increase calldata cost to reduce maximum block size From a178857c8dfc01bbf395f831e6e235877a0940d3 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 6 Jan 2025 08:02:51 +0100 Subject: [PATCH 21/33] vm/tests: update 7002 test: correctly deploy withdrawal contract --- packages/vm/test/api/EIPs/eip-7002.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vm/test/api/EIPs/eip-7002.spec.ts b/packages/vm/test/api/EIPs/eip-7002.spec.ts index 35d064686d..40d8838100 100644 --- a/packages/vm/test/api/EIPs/eip-7002.spec.ts +++ b/packages/vm/test/api/EIPs/eip-7002.spec.ts @@ -32,11 +32,11 @@ const deploymentTxData = { gasLimit: BigInt('0x3d090'), gasPrice: BigInt('0xe8d4a51000'), data: hexToBytes( - '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f556101f480602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1460c7573615156028575f545f5260205ff35b36603814156101f05760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f057600182026001905f5b5f821115608057810190830284830290049160010191906065565b9093900434106101f057600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160db575060105b5f5b81811461017f5780604c02838201600302600401805490600101805490600101549160601b83528260140152807fffffffffffffffffffffffffffffffff0000000000000000000000000000000016826034015260401c906044018160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160dd565b9101809214610191579060025561019c565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101c957505f5b6001546002828201116101de5750505f6101e4565b01600290035b5f555f600155604c025ff35b5f5ffd', + '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f556101f880602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd', ), v: BigInt('0x1b'), r: BigInt('0x539'), - s: BigInt('0x10e740537d4d36b9'), + s: BigInt('0xeb793ed1dcd82833'), } const deploymentTx = createLegacyTx(deploymentTxData) From 4a9b0c2e06daaaf64e82f43c62cced7147e6ae5b Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 6 Jan 2025 08:32:35 +0100 Subject: [PATCH 22/33] client: update genesis contracts --- .../test/rpc/engine/newPayloadV4.spec.ts | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/packages/client/test/rpc/engine/newPayloadV4.spec.ts b/packages/client/test/rpc/engine/newPayloadV4.spec.ts index 6b5634024b..db29e70c69 100644 --- a/packages/client/test/rpc/engine/newPayloadV4.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV4.spec.ts @@ -12,9 +12,9 @@ const [blockData] = beaconData const parentBeaconBlockRoot = '0x42942949c4ed512cd85c2cb54ca88591338cbb0564d3a2bea7961a639ef29d64' const validForkChoiceState = { - headBlockHash: '0x6abe4c2777a6a1e994d83920cfb95229b071174b95c89343f54b926f733789f2', - safeBlockHash: '0x6abe4c2777a6a1e994d83920cfb95229b071174b95c89343f54b926f733789f2', - finalizedBlockHash: '0x6abe4c2777a6a1e994d83920cfb95229b071174b95c89343f54b926f733789f2', + headBlockHash: '0x5bc7efe14c04eed7572809bb9c11d48d872139384097b95e04f8ab1b01ae8ecc', + safeBlockHash: '0x5bc7efe14c04eed7572809bb9c11d48d872139384097b95e04f8ab1b01ae8ecc', + finalizedBlockHash: '0x5bc7efe14c04eed7572809bb9c11d48d872139384097b95e04f8ab1b01ae8ecc', } const validPayloadAttributes = { timestamp: '0x64ba84fd', @@ -35,26 +35,24 @@ const electraGenesisContracts = { // sender corresponding to the priv key 0x9c9996335451aab4fc4eac58e31a8c300e095cdbcee532d53d09280e83360355 '0x610adc49ecd66cbf176a8247ebd59096c031bd9f': { balance: '0x6d6172697573766477000000' }, // eip 2925 contract - '0x0aae40965e6800cd9b1f4b05ff21581047e3f91e': { + '0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc': { balance: '0', nonce: '1', - code: '0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500', + code: '0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500', }, // consolidation requests contract - '0x00706203067988Ab3E2A2ab626EdCD6f28bDBbbb': { - balance: '0', - nonce: '1', - code: '0x3373fffffffffffffffffffffffffffffffffffffffe1460cf573615156028575f545f5260205ff35b366060141561019a5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f821115608057810190830284830290049160010191906065565b90939004341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060011160e3575060015b5f5b8181146101295780607402838201600402600401805490600101805490600101805490600101549260601b84529083601401528260340152906054015260010160e5565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd', + '0x00431f263ce400f4455c2dcf564e53007ca4bbbb': { + nonce: '0x01', + balance: '0x00', + code: '0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd', + storage: {}, }, // withdrawals request contract - '0x05F27129610CB42103b665629CB5c8C00296AaAa': { - balance: '0', - nonce: '1', - code: '0x3373fffffffffffffffffffffffffffffffffffffffe1460c7573615156028575f545f5260205ff35b36603814156101f05760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f057600182026001905f5b5f821115608057810190830284830290049160010191906065565b9093900434106101f057600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160db575060105b5f5b81811461017f5780604c02838201600302600401805490600101805490600101549160601b83528260140152807fffffffffffffffffffffffffffffffff0000000000000000000000000000000016826034015260401c906044018160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160dd565b9101809214610191579060025561019c565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101c957505f5b6001546002828201116101de5750505f6101e4565b01600290035b5f555f600155604c025ff35b5f5ffd', - storage: { - '0x0000000000000000000000000000000000000000000000000000000000000000': - '0x000000000000000000000000000000000000000000000000000000000000049d', - }, + '0x0c15f14308530b7cdb8460094bbb9cc28b9aaaaa': { + nonce: '0x01', + balance: '0x00', + code: '0x3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd', + storage: {}, }, // beacon deposit contract for deposit receipts '0x00000000219ab540356cBB839Cbe05303d7705Fa': { @@ -160,9 +158,9 @@ describe(`${method}: call with executionPayloadV4`, () => { withdrawals: [], blobGasUsed: '0x0', excessBlobGas: '0x0', - parentHash: '0x6abe4c2777a6a1e994d83920cfb95229b071174b95c89343f54b926f733789f2', - stateRoot: '0x7aa6e46df1f78988a3141b5e7da8abee78d1daca175f43fe8866b2d1bf8d8ef8', - blockHash: '0xece8d273a76238c4c9e4e28cbd301d40b04cb21242e83960ca688324e0483fd8', + parentHash: '0x5bc7efe14c04eed7572809bb9c11d48d872139384097b95e04f8ab1b01ae8ecc', + stateRoot: '0xebe157ea5c3dc6fb5970f67b76266903282aee9772030f06c112348f32037fd9', + blockHash: '0x725c21032b68ae7d2f143581d0196cfbfd14dbc45c14eaeab15443831de489b7', } const oldMethods = ['engine_newPayloadV1', 'engine_newPayloadV2', 'engine_newPayloadV3'] From b195bbb03035ff63d0d6f0923c7ac8985e9dc149 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 6 Jan 2025 12:51:57 +0100 Subject: [PATCH 23/33] evm: update bls test files --- .../evm/test/precompiles/bls/add_G1_bls.json | 18 ++--- .../evm/test/precompiles/bls/add_G2_bls.json | 18 ++--- .../test/precompiles/bls/fail-mul_G1_bls.json | 37 --------- .../test/precompiles/bls/fail-mul_G2_bls.json | 37 --------- .../precompiles/bls/map_fp2_to_G2_bls.json | 10 +-- .../evm/test/precompiles/bls/mul_G1_bls.json | 79 ------------------- .../evm/test/precompiles/bls/mul_G2_bls.json | 79 ------------------- .../test/precompiles/bls/multiexp_G1_bls.json | 22 +++--- .../test/precompiles/bls/multiexp_G2_bls.json | 24 +++--- .../precompiles/bls/pairing_check_bls.json | 12 +-- 10 files changed, 52 insertions(+), 284 deletions(-) delete mode 100644 packages/evm/test/precompiles/bls/fail-mul_G1_bls.json delete mode 100644 packages/evm/test/precompiles/bls/fail-mul_G2_bls.json delete mode 100644 packages/evm/test/precompiles/bls/mul_G1_bls.json delete mode 100644 packages/evm/test/precompiles/bls/mul_G2_bls.json diff --git a/packages/evm/test/precompiles/bls/add_G1_bls.json b/packages/evm/test/precompiles/bls/add_G1_bls.json index b09475db24..b947ccd2de 100644 --- a/packages/evm/test/precompiles/bls/add_G1_bls.json +++ b/packages/evm/test/precompiles/bls/add_G1_bls.json @@ -3,63 +3,63 @@ "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21", "Name": "bls_g1add_g1+p1", "Expected": "000000000000000000000000000000000a40300ce2dec9888b60690e9a41d3004fda4886854573974fab73b046d3147ba5b7a5bde85279ffede1b45b3918d82d0000000000000000000000000000000006d3d887e9f53b9ec4eb6cedf5607226754b07c01ace7834f57f3e7315faefb739e59018e22c492006190fba4a870025", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", "Name": "bls_g1add_p1+g1", "Expected": "000000000000000000000000000000000a40300ce2dec9888b60690e9a41d3004fda4886854573974fab73b046d3147ba5b7a5bde85279ffede1b45b3918d82d0000000000000000000000000000000006d3d887e9f53b9ec4eb6cedf5607226754b07c01ace7834f57f3e7315faefb739e59018e22c492006190fba4a870025", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "000000000000000000000000000000000123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef00000000000000000000000000000000193fb7cedb32b2c3adc06ec11a96bc0d661869316f5e4a577a9f7c179593987beb4fb2ee424dbb2f5dd891e228b46c4a0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", "Name": "bls_g1add_g1_wrong_order+g1", "Expected": "000000000000000000000000000000000abe7ae4ae2b092a5cc1779b1f5605d904fa6ec59b0f084907d1f5e4d2663e117a3810e027210a72186159a21271df3e0000000000000000000000000000000001e1669f00e10205f2e2f1195d65c21022f6a9a6de21f329756309815281a4434b2864d34ebcbc1d7e7cfaaee3feeea2", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1add_(g1+0=g1)", "Expected": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1add_(p1+0=p1)", "Expected": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb00000000000000000000000000000000114d1d6855d545a8aa7d76c8cf2e21f267816aef1db507c96655b9d5caac42364e6f38ba0ecb751bad54dcd6b939c2ca", "Name": "bls_g1add_(g1-g1=0)", "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a2100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca9426000000000000000000000000000000000195e911162921ba5ed055b496420f197693d36569ec34c63d7c0529a097d49e543070afba4b707e878e53c2b779208a", "Name": "bls_g1add_(p1-p1=0)", "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", "Name": "bls_g1add_(g1+g1=2*g1)", "Expected": "000000000000000000000000000000000572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e00000000000000000000000000000000166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28", - "Gas": 500, + "Gas": 375, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a2100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21", "Name": "bls_g1add_(p1+p1=2*p1)", "Expected": "0000000000000000000000000000000015222cddbabdd764c4bee0b3720322a65ff4712c86fc4b1588d0c209210a0884fa9468e855d261c483091b2bf7de6a630000000000000000000000000000000009f9edb99bc3b75d7489735c98b16ab78b9386c5f7a1f76c7e96ac6eb5bbde30dbca31a74ec6e0f0b12229eecea33c39", - "Gas": 500, + "Gas": 375, "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/bls/add_G2_bls.json b/packages/evm/test/precompiles/bls/add_G2_bls.json index edce01f5e7..0fcc5dc7b2 100644 --- a/packages/evm/test/precompiles/bls/add_G2_bls.json +++ b/packages/evm/test/precompiles/bls/add_G2_bls.json @@ -3,63 +3,63 @@ "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451", "Name": "bls_g2add_g2+p2", "Expected": "000000000000000000000000000000000b54a8a7b08bd6827ed9a797de216b8c9057b3a9ca93e2f88e7f04f19accc42da90d883632b9ca4dc38d013f71ede4db00000000000000000000000000000000077eba4eecf0bd764dce8ed5f45040dd8f3b3427cb35230509482c14651713282946306247866dfe39a8e33016fcbe520000000000000000000000000000000014e60a76a29ef85cbd69f251b9f29147b67cfe3ed2823d3f9776b3a0efd2731941d47436dc6d2b58d9e65f8438bad073000000000000000000000000000000001586c3c910d95754fef7a732df78e279c3d37431c6a2b77e67a00c7c130a8fcd4d19f159cbeb997a178108fffffcbd20", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d87845100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", "Name": "bls_g2add_p2+g2", "Expected": "000000000000000000000000000000000b54a8a7b08bd6827ed9a797de216b8c9057b3a9ca93e2f88e7f04f19accc42da90d883632b9ca4dc38d013f71ede4db00000000000000000000000000000000077eba4eecf0bd764dce8ed5f45040dd8f3b3427cb35230509482c14651713282946306247866dfe39a8e33016fcbe520000000000000000000000000000000014e60a76a29ef85cbd69f251b9f29147b67cfe3ed2823d3f9776b3a0efd2731941d47436dc6d2b58d9e65f8438bad073000000000000000000000000000000001586c3c910d95754fef7a732df78e279c3d37431c6a2b77e67a00c7c130a8fcd4d19f159cbeb997a178108fffffcbd20", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000197bfd0342bbc8bee2beced2f173e1a87be576379b343e93232d6cef98d84b1d696e5612ff283ce2cfdccb2cfb65fa0c00000000000000000000000000000000184e811f55e6f9d84d77d2f79102fd7ea7422f4759df5bf7f6331d550245e3f1bcf6a30e3b29110d85e0ca16f9f6ae7a000000000000000000000000000000000f10e1eb3c1e53d2ad9cf2d398b2dc22c5842fab0a74b174f691a7e914975da3564d835cd7d2982815b8ac57f507348f000000000000000000000000000000000767d1c453890f1b9110fda82f5815c27281aba3f026ee868e4176a0654feea41a96575e0c4d58a14dbfbcc05b5010b100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", "Name": "bls_g2add_g2_wrong_order+g2", "Expected": "0000000000000000000000000000000011f00077935238fc57086414804303b20fab5880bc29f35ebda22c13dd44e586c8a889fe2ba799082c8458d861ac10cf0000000000000000000000000000000007318be09b19be000fe5df77f6e664a8286887ad8373005d7f7a203fcc458c28004042780146d3e43fa542d921c69512000000000000000000000000000000001287eab085d6f8a29f1f1aedb5ad9e8546963f0b11865e05454d86b9720c281db567682a233631f63a2794432a5596ae0000000000000000000000000000000012ec87cea1bacb75aa97728bcd64b27c7a42dd2319a2e17fe3837a05f85d089c5ebbfb73c1d08b7007e2b59ec9c8e065", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g2add_(g2+0=g2)", "Expected": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d87845100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g2add_(p2+0=p2)", "Expected": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17f9ee3837a55024f78c71363275a75d75d86bab79f74782aa0000000000000000000000000000000013fa4d4a0ad8b1ce186ed5061789213d993923066dddaf1040bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed", "Name": "bls_g2add_(g2-g2=0)", "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d87845100000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000a6296409115572426717c73668335a949829d739cff2cb4ab043710d28f8e772f6ef41aac4806c9cb273c490384032d000000000000000000000000000000000cde4e850c721fa94e8890d500e3655b442d5c0dc4fff1b694c6f8dd68f6d8dc1bc3251a37d27e7af96f65a96278265a", "Name": "bls_g2add_(p2-p2=0)", "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", "Name": "bls_g2add_(g2+g2=2*g2)", "Expected": "000000000000000000000000000000001638533957d540a9d2370f17cc7ed5863bc0b995b8825e0ee1ea1e1e4d00dbae81f14b0bf3611b78c952aacab827a053000000000000000000000000000000000a4edef9c1ed7f729f520e47730a124fd70662a904ba1074728114d1031e1572c6c886f6b57ec72a6178288c47c33577000000000000000000000000000000000468fb440d82b0630aeb8dca2b5256789a66da69bf91009cbfe6bd221e47aa8ae88dece9764bf3bd999d95d71e4c9899000000000000000000000000000000000f6d4552fa65dd2638b361543f887136a43253d9c66c411697003f7a13c308f5422e1aa0a59c8967acdefd8b6e36ccf3", - "Gas": 800, + "Gas": 600, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d87845100000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451", "Name": "bls_g2add_(p2+p2=2*p2)", "Expected": "000000000000000000000000000000000b76fcbb604082a4f2d19858a7befd6053fa181c5119a612dfec83832537f644e02454f2b70d40985ebb08042d1620d40000000000000000000000000000000019a4a02c0ae51365d964c73be7babb719db1c69e0ddbf9a8a335b5bed3b0a4b070d2d5df01d2da4a3f1e56aae2ec106d000000000000000000000000000000000d18322f821ac72d3ca92f92b000483cf5b7d9e5d06873a44071c4e7e81efd904f210208fe0b9b4824f01c65bc7e62080000000000000000000000000000000004e563d53609a2d1e216aaaee5fbc14ef460160db8d1fdc5e1bd4e8b54cd2f39abf6f925969fa405efb9e700b01c7085", - "Gas": 800, + "Gas": 600, "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/bls/fail-mul_G1_bls.json b/packages/evm/test/precompiles/bls/fail-mul_G1_bls.json deleted file mode 100644 index b3c7338ba6..0000000000 --- a/packages/evm/test/precompiles/bls/fail-mul_G1_bls.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "Input": "", - "ExpectedError": "invalid input length", - "Name": "bls_g1mul_empty_input" - }, - { - "Input": "00000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid input length", - "Name": "bls_g1mul_short_input" - }, - { - "Input": "000000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid input length", - "Name": "bls_g1mul_large_input" - }, - { - "Input": "0000000000000000000000000000000031f2e5916b17be2e71b10b4292f558e727dfd7d48af9cbc5087f0ce00dcca27c8b01e83eaace1aefb539f00adb2271660000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid fp.Element encoding", - "Name": "bls_g1mul_invalid_field_element" - }, - { - "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb00000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid point: not on curve", - "Name": "bls_g1mul_point_not_on_curve" - }, - { - "Input": "1000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid field element top bytes", - "Name": "bls_g1mul_violate_top_bytes" - }, - { - "Input": "000000000000000000000000000000000123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef00000000000000000000000000000000193fb7cedb32b2c3adc06ec11a96bc0d661869316f5e4a577a9f7c179593987beb4fb2ee424dbb2f5dd891e228b46c4a0000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "g1 point is not on correct subgroup", - "Name": "bls_g1mul_g1_not_in_correct_subgroup" - } -] diff --git a/packages/evm/test/precompiles/bls/fail-mul_G2_bls.json b/packages/evm/test/precompiles/bls/fail-mul_G2_bls.json deleted file mode 100644 index 8ff55d2e53..0000000000 --- a/packages/evm/test/precompiles/bls/fail-mul_G2_bls.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "Input": "", - "ExpectedError": "invalid input length", - "Name": "bls_g2mul_empty_input" - }, - { - "Input": "000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid input length", - "Name": "bls_g2mul_short_input" - }, - { - "Input": "0000000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid input length", - "Name": "bls_g2mul_large_input" - }, - { - "Input": "000000000000000000000000000000001c4bb49d2a0ef12b7123acdd7110bd292b5bc659edc54dc21b81de057194c79b2a5803255959bbef8e7f56c8c12168630000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid fp.Element encoding", - "Name": "bls_g2mul_invalid_field_element" - }, - { - "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb800000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid point: not on curve", - "Name": "bls_g2mul_point_not_on_curve" - }, - { - "Input": "10000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "invalid field element top bytes", - "Name": "bls_g2mul_violate_top_bytes" - }, - { - "Input": "00000000000000000000000000000000197bfd0342bbc8bee2beced2f173e1a87be576379b343e93232d6cef98d84b1d696e5612ff283ce2cfdccb2cfb65fa0c00000000000000000000000000000000184e811f55e6f9d84d77d2f79102fd7ea7422f4759df5bf7f6331d550245e3f1bcf6a30e3b29110d85e0ca16f9f6ae7a000000000000000000000000000000000f10e1eb3c1e53d2ad9cf2d398b2dc22c5842fab0a74b174f691a7e914975da3564d835cd7d2982815b8ac57f507348f000000000000000000000000000000000767d1c453890f1b9110fda82f5815c27281aba3f026ee868e4176a0654feea41a96575e0c4d58a14dbfbcc05b5010b10000000000000000000000000000000000000000000000000000000000000002", - "ExpectedError": "g2 point is not on correct subgroup", - "Name": "bls_g2mul_g2_not_in_correct_subgroup" - } -] diff --git a/packages/evm/test/precompiles/bls/map_fp2_to_G2_bls.json b/packages/evm/test/precompiles/bls/map_fp2_to_G2_bls.json index ab17304ee8..0014a8974d 100644 --- a/packages/evm/test/precompiles/bls/map_fp2_to_G2_bls.json +++ b/packages/evm/test/precompiles/bls/map_fp2_to_G2_bls.json @@ -3,35 +3,35 @@ "Input": "0000000000000000000000000000000007355d25caf6e7f2f0cb2812ca0e513bd026ed09dda65b177500fa31714e09ea0ded3a078b526bed3307f804d4b93b040000000000000000000000000000000002829ce3c021339ccb5caf3e187f6370e1e2a311dec9b75363117063ab2015603ff52c3d3b98f19c2f65575e99e8b78c", "Name": "bls_g2map_", "Expected": "0000000000000000000000000000000000e7f4568a82b4b7dc1f14c6aaa055edf51502319c723c4dc2688c7fe5944c213f510328082396515734b6612c4e7bb700000000000000000000000000000000126b855e9e69b1f691f816e48ac6977664d24d99f8724868a184186469ddfd4617367e94527d4b74fc86413483afb35b000000000000000000000000000000000caead0fd7b6176c01436833c79d305c78be307da5f6af6c133c47311def6ff1e0babf57a0fb5539fce7ee12407b0a42000000000000000000000000000000001498aadcf7ae2b345243e281ae076df6de84455d766ab6fcdaad71fab60abb2e8b980a440043cd305db09d283c895e3d", - "Gas": 75000, + "Gas": 23800, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000138879a9559e24cecee8697b8b4ad32cced053138ab913b99872772dc753a2967ed50aabc907937aefb2439ba06cc50c000000000000000000000000000000000a1ae7999ea9bab1dcc9ef8887a6cb6e8f1e22566015428d220b7eec90ffa70ad1f624018a9ad11e78d588bd3617f9f2", "Name": "bls_g2map_616263", "Expected": "00000000000000000000000000000000108ed59fd9fae381abfd1d6bce2fd2fa220990f0f837fa30e0f27914ed6e1454db0d1ee957b219f61da6ff8be0d6441f000000000000000000000000000000000296238ea82c6d4adb3c838ee3cb2346049c90b96d602d7bb1b469b905c9228be25c627bffee872def773d5b2a2eb57d00000000000000000000000000000000033f90f6057aadacae7963b0a0b379dd46750c1c94a6357c99b65f63b79e321ff50fe3053330911c56b6ceea08fee65600000000000000000000000000000000153606c417e59fb331b7ae6bce4fbf7c5190c33ce9402b5ebe2b70e44fca614f3f1382a3625ed5493843d0b0a652fc3f", - "Gas": 75000, + "Gas": 23800, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000018c16fe362b7dbdfa102e42bdfd3e2f4e6191d479437a59db4eb716986bf08ee1f42634db66bde97d6c16bbfd342b3b8000000000000000000000000000000000e37812ce1b146d998d5f92bdd5ada2a31bfd63dfe18311aa91637b5f279dd045763166aa1615e46a50d8d8f475f184e", "Name": "bls_g2map_6162636465663031", "Expected": "00000000000000000000000000000000038af300ef34c7759a6caaa4e69363cafeed218a1f207e93b2c70d91a1263d375d6730bd6b6509dcac3ba5b567e85bf3000000000000000000000000000000000da75be60fb6aa0e9e3143e40c42796edf15685cafe0279afd2a67c3dff1c82341f17effd402e4f1af240ea90f4b659b0000000000000000000000000000000019b148cbdf163cf0894f29660d2e7bfb2b68e37d54cc83fd4e6e62c020eaa48709302ef8e746736c0e19342cc1ce3df4000000000000000000000000000000000492f4fed741b073e5a82580f7c663f9b79e036b70ab3e51162359cec4e77c78086fe879b65ca7a47d34374c8315ac5e", - "Gas": 75000, + "Gas": 23800, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000008d4a0997b9d52fecf99427abb721f0fa779479963315fe21c6445250de7183e3f63bfdf86570da8929489e421d4ee950000000000000000000000000000000016cb4ccad91ec95aab070f22043916cd6a59c4ca94097f7f510043d48515526dc8eaaea27e586f09151ae613688d5a89", "Name": "bls_g2map_713132385f717171", "Expected": "000000000000000000000000000000000c5ae723be00e6c3f0efe184fdc0702b64588fe77dda152ab13099a3bacd3876767fa7bbad6d6fd90b3642e902b208f90000000000000000000000000000000012c8c05c1d5fc7bfa847f4d7d81e294e66b9a78bc9953990c358945e1f042eedafce608b67fdd3ab0cb2e6e263b9b1ad0000000000000000000000000000000004e77ddb3ede41b5ec4396b7421dd916efc68a358a0d7425bddd253547f2fb4830522358491827265dfc5bcc1928a5690000000000000000000000000000000011c624c56dbe154d759d021eec60fab3d8b852395a89de497e48504366feedd4662d023af447d66926a28076813dd646", - "Gas": 75000, + "Gas": 23800, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000003f80ce4ff0ca2f576d797a3660e3f65b274285c054feccc3215c879e2c0589d376e83ede13f93c32f05da0f68fd6a1000000000000000000000000000000000006488a837c5413746d868d1efb7232724da10eca410b07d8b505b9363bdccf0a1fc0029bad07d65b15ccfe6dd25e20d", "Name": "bls_g2map_613531325f616161", "Expected": "000000000000000000000000000000000ea4e7c33d43e17cc516a72f76437c4bf81d8f4eac69ac355d3bf9b71b8138d55dc10fd458be115afa798b55dac34be1000000000000000000000000000000001565c2f625032d232f13121d3cfb476f45275c303a037faa255f9da62000c2c864ea881e2bcddd111edc4a3c0da3e88d00000000000000000000000000000000043b6f5fe4e52c839148dc66f2b3751e69a0f6ebb3d056d6465d50d4108543ecd956e10fa1640dfd9bc0030cc2558d28000000000000000000000000000000000f8991d2a1ad662e7b6f58ab787947f1fa607fce12dde171bc17903b012091b657e15333e11701edcf5b63ba2a561247", - "Gas": 75000, + "Gas": 23800, "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/bls/mul_G1_bls.json b/packages/evm/test/precompiles/bls/mul_G1_bls.json deleted file mode 100644 index 17babfa7d3..0000000000 --- a/packages/evm/test/precompiles/bls/mul_G1_bls.json +++ /dev/null @@ -1,79 +0,0 @@ -[ - { - "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", - "Name": "bls_g1mul_(g1+g1=2*g1)", - "Expected": "000000000000000000000000000000000572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e00000000000000000000000000000000166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000002", - "Name": "bls_g1mul_(p1+p1=2*p1)", - "Expected": "0000000000000000000000000000000015222cddbabdd764c4bee0b3720322a65ff4712c86fc4b1588d0c209210a0884fa9468e855d261c483091b2bf7de6a630000000000000000000000000000000009f9edb99bc3b75d7489735c98b16ab78b9386c5f7a1f76c7e96ac6eb5bbde30dbca31a74ec6e0f0b12229eecea33c39", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000001", - "Name": "bls_g1mul_(1*g1=g1)", - "Expected": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000001", - "Name": "bls_g1mul_(1*p1=p1)", - "Expected": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000000", - "Name": "bls_g1mul_(0*g1=inf)", - "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000000", - "Name": "bls_g1mul_(0*p1=inf)", - "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011", - "Name": "bls_g1mul_(x*inf=inf)", - "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", - "Name": "bls_g1mul_random*g1", - "Expected": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", - "Name": "bls_g1mul_random*p1", - "Expected": "0000000000000000000000000000000006ee9c9331228753bcb148d0ca8623447701bb0aa6eafb0340aa7f81543923474e00f2a225de65c62dd1d8303270220c0000000000000000000000000000000018dd7be47eb4e80985d7a0d2cc96c8b004250b36a5c3ec0217705d453d3ecc6d0d3d1588722da51b40728baba1e93804", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e19a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", - "Name": "bls_g1mul_random*g1_unnormalized_scalar", - "Expected": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4", - "Gas": 12000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a219a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", - "Name": "bls_g1mul_random*p1_unnormalized_scalar", - "Expected": "0000000000000000000000000000000006ee9c9331228753bcb148d0ca8623447701bb0aa6eafb0340aa7f81543923474e00f2a225de65c62dd1d8303270220c0000000000000000000000000000000018dd7be47eb4e80985d7a0d2cc96c8b004250b36a5c3ec0217705d453d3ecc6d0d3d1588722da51b40728baba1e93804", - "Gas": 12000, - "NoBenchmark": false - } -] diff --git a/packages/evm/test/precompiles/bls/mul_G2_bls.json b/packages/evm/test/precompiles/bls/mul_G2_bls.json deleted file mode 100644 index 7f927d8955..0000000000 --- a/packages/evm/test/precompiles/bls/mul_G2_bls.json +++ /dev/null @@ -1,79 +0,0 @@ -[ - { - "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", - "Name": "bls_g2mul_(g2+g2=2*g2)", - "Expected": "000000000000000000000000000000001638533957d540a9d2370f17cc7ed5863bc0b995b8825e0ee1ea1e1e4d00dbae81f14b0bf3611b78c952aacab827a053000000000000000000000000000000000a4edef9c1ed7f729f520e47730a124fd70662a904ba1074728114d1031e1572c6c886f6b57ec72a6178288c47c33577000000000000000000000000000000000468fb440d82b0630aeb8dca2b5256789a66da69bf91009cbfe6bd221e47aa8ae88dece9764bf3bd999d95d71e4c9899000000000000000000000000000000000f6d4552fa65dd2638b361543f887136a43253d9c66c411697003f7a13c308f5422e1aa0a59c8967acdefd8b6e36ccf3", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000002", - "Name": "bls_g2mul_(p2+p2=2*p2)", - "Expected": "000000000000000000000000000000000b76fcbb604082a4f2d19858a7befd6053fa181c5119a612dfec83832537f644e02454f2b70d40985ebb08042d1620d40000000000000000000000000000000019a4a02c0ae51365d964c73be7babb719db1c69e0ddbf9a8a335b5bed3b0a4b070d2d5df01d2da4a3f1e56aae2ec106d000000000000000000000000000000000d18322f821ac72d3ca92f92b000483cf5b7d9e5d06873a44071c4e7e81efd904f210208fe0b9b4824f01c65bc7e62080000000000000000000000000000000004e563d53609a2d1e216aaaee5fbc14ef460160db8d1fdc5e1bd4e8b54cd2f39abf6f925969fa405efb9e700b01c7085", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000001", - "Name": "bls_g2mul_(1*g2=g2)", - "Expected": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000001", - "Name": "bls_g2mul_(1*p2=p2)", - "Expected": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000000", - "Name": "bls_g2mul_(0*g2=inf)", - "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000000", - "Name": "bls_g2mul_(0*p2=inf)", - "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011", - "Name": "bls_g2mul_(x*inf=inf)", - "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", - "Name": "bls_g2mul_random*g2", - "Expected": "0000000000000000000000000000000014856c22d8cdb2967c720e963eedc999e738373b14172f06fc915769d3cc5ab7ae0a1b9c38f48b5585fb09d4bd2733bb000000000000000000000000000000000c400b70f6f8cd35648f5c126cce5417f3be4d8eefbd42ceb4286a14df7e03135313fe5845e3a575faab3e8b949d248800000000000000000000000000000000149a0aacc34beba2beb2f2a19a440166e76e373194714f108e4ab1c3fd331e80f4e73e6b9ea65fe3ec96d7136de81544000000000000000000000000000000000e4622fef26bdb9b1e8ef6591a7cc99f5b73164500c1ee224b6a761e676b8799b09a3fd4fa7e242645cc1a34708285e4", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", - "Name": "bls_g2mul_random*p2", - "Expected": "00000000000000000000000000000000036074dcbbd0e987531bfe0e45ddfbe09fd015665990ee0c352e8e403fe6af971d8f42141970d9ab14b4dd04874409e600000000000000000000000000000000019705637f24ba2f398f32c3a3e20d6a1cd0fd63e6f8f071cf603a8334f255744927e7bfdfdb18519e019c49ff6e914500000000000000000000000000000000008e74fcff4c4278c9accfb60809ed69bbcbe3d6213ef2304e078d15ec7d6decb4f462b24b8e7cc38cc11b6f2c9e0486000000000000000000000000000000001331d40100f38c1070afd832445881b47cf4d63894666d9907c85ac66604aab5ad329980938cc3c167ccc5b6bc1b8f30", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be9a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", - "Name": "bls_g2mul_random*g2_unnormalized_scalar", - "Expected": "0000000000000000000000000000000014856c22d8cdb2967c720e963eedc999e738373b14172f06fc915769d3cc5ab7ae0a1b9c38f48b5585fb09d4bd2733bb000000000000000000000000000000000c400b70f6f8cd35648f5c126cce5417f3be4d8eefbd42ceb4286a14df7e03135313fe5845e3a575faab3e8b949d248800000000000000000000000000000000149a0aacc34beba2beb2f2a19a440166e76e373194714f108e4ab1c3fd331e80f4e73e6b9ea65fe3ec96d7136de81544000000000000000000000000000000000e4622fef26bdb9b1e8ef6591a7cc99f5b73164500c1ee224b6a761e676b8799b09a3fd4fa7e242645cc1a34708285e4", - "Gas": 45000, - "NoBenchmark": false - }, - { - "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784519a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", - "Name": "bls_g2mul_random*p2_unnormalized_scalar", - "Expected": "00000000000000000000000000000000036074dcbbd0e987531bfe0e45ddfbe09fd015665990ee0c352e8e403fe6af971d8f42141970d9ab14b4dd04874409e600000000000000000000000000000000019705637f24ba2f398f32c3a3e20d6a1cd0fd63e6f8f071cf603a8334f255744927e7bfdfdb18519e019c49ff6e914500000000000000000000000000000000008e74fcff4c4278c9accfb60809ed69bbcbe3d6213ef2304e078d15ec7d6decb4f462b24b8e7cc38cc11b6f2c9e0486000000000000000000000000000000001331d40100f38c1070afd832445881b47cf4d63894666d9907c85ac66604aab5ad329980938cc3c167ccc5b6bc1b8f30", - "Gas": 45000, - "NoBenchmark": false - } -] diff --git a/packages/evm/test/precompiles/bls/multiexp_G1_bls.json b/packages/evm/test/precompiles/bls/multiexp_G1_bls.json index 19f0884004..cef5ce63bc 100644 --- a/packages/evm/test/precompiles/bls/multiexp_G1_bls.json +++ b/packages/evm/test/precompiles/bls/multiexp_G1_bls.json @@ -3,77 +3,77 @@ "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g1multiexp_(g1+g1=2*g1)", "Expected": "000000000000000000000000000000000572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e00000000000000000000000000000000166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g1multiexp_(p1+p1=2*p1)", "Expected": "0000000000000000000000000000000015222cddbabdd764c4bee0b3720322a65ff4712c86fc4b1588d0c209210a0884fa9468e855d261c483091b2bf7de6a630000000000000000000000000000000009f9edb99bc3b75d7489735c98b16ab78b9386c5f7a1f76c7e96ac6eb5bbde30dbca31a74ec6e0f0b12229eecea33c39", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000001", "Name": "bls_g1multiexp_(1*g1=g1)", "Expected": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000001", "Name": "bls_g1multiexp_(1*p1=p1)", "Expected": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1multiexp_(0*g1=inf)", "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1multiexp_(0*p1=inf)", "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011", "Name": "bls_g1multiexp_(x*inf=inf)", "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 14400, + "Gas": 12000, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1multiexp_(2g1+inf)", "Expected": "000000000000000000000000000000000572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e00000000000000000000000000000000166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28", - "Gas": 21312, + "Gas": 22776, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1multiexp_(inf+inf)", "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 21312, + "Gas": 22776, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g1multiexp_(2g1+2p1)", "Expected": "00000000000000000000000000000000148f92dced907361b4782ab542a75281d4b6f71f65c8abf94a5a9082388c64662d30fd6a01ced724feef3e284752038c0000000000000000000000000000000015c3634c3b67bc18e19150e12bfd8a1769306ed010f59be645a0823acb5b38f39e8e0d86e59b6353fdafc59ca971b769", - "Gas": 21312, + "Gas": 22776, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e300000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a2147b8192d77bf871b62e87859d653922725724a5c031afeabc60bcef5ff66513800000000000000000000000000000000184bb665c37ff561a89ec2122dd343f20e0f4cbcaec84e3c3052ea81d1834e192c426074b02ed3dca4e7676ce4ce48ba0000000000000000000000000000000004407b8d35af4dacc809927071fc0405218f1401a6d15af775810e4e460064bcc9468beeba82fdc751be70476c888bf3328388aff0d4a5b7dc9205abd374e7e98f3cd9f3418edb4eafda5fb16473d21600000000000000000000000000000000009769f3ab59bfd551d53a5f846b9984c59b97d6842b20a2c565baa167945e3d026a3755b6345df8ec7e6acb6868ae6d000000000000000000000000000000001532c00cf61aa3d0ce3e5aa20c3b531a2abd2c770a790a2613818303c6b830ffc0ecf6c357af3317b9575c567f11cd2c263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e2000000000000000000000000000000001974dbb8e6b5d20b84df7e625e2fbfecb2cdb5f77d5eae5fb2955e5ce7313cae8364bc2fff520a6c25619739c6bdcb6a0000000000000000000000000000000015f9897e11c6441eaa676de141c8d83c37aab8667173cbe1dfd6de74d11861b961dccebcd9d289ac633455dfcc7013a347b8192d77bf871b62e87859d653922725724a5c031afeabc60bcef5ff665131000000000000000000000000000000000a7a047c4a8397b3446450642c2ac64d7239b61872c9ae7a59707a8f4f950f101e766afe58223b3bff3a19a7f754027c000000000000000000000000000000001383aebba1e4327ccff7cf9912bda0dbc77de048b71ef8c8a81111d71dc33c5e3aa6edee9cf6f5fe525d50cc50b77cc9328388aff0d4a5b7dc9205abd374e7e98f3cd9f3418edb4eafda5fb16473d211000000000000000000000000000000000e7a16a975904f131682edbb03d9560d3e48214c9986bd50417a77108d13dc957500edf96462a3d01e62dc6cd468ef11000000000000000000000000000000000ae89e677711d05c30a48d6d75e76ca9fb70fe06c6dd6ff988683d89ccde29ac7d46c53bb97a59b1901abf1db66052db55b53c4669f19f0fc7431929bc0363d7d8fb432435fcde2635fdba334424e9f5", "Name": "bls_g1multiexp_multiple", "Expected": "00000000000000000000000000000000053fbdb09b6b5faa08bfe7b7069454247ad4d8bd57e90e2d2ebaa04003dcf110aa83072c07f480ab2107cca2ccff6091000000000000000000000000000000001654537b7c96fe64d13906066679c3d45808cb666452b55d1b909c230cc4b423c3f932c58754b9b762dc49fcc825522c", - "Gas": 42000, + "Gas": 61992, "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/bls/multiexp_G2_bls.json b/packages/evm/test/precompiles/bls/multiexp_G2_bls.json index 1655e68bff..0b98cfa8ab 100644 --- a/packages/evm/test/precompiles/bls/multiexp_G2_bls.json +++ b/packages/evm/test/precompiles/bls/multiexp_G2_bls.json @@ -3,84 +3,84 @@ "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g2multiexp_(g2+g2=2*g2)", "Expected": "000000000000000000000000000000001638533957d540a9d2370f17cc7ed5863bc0b995b8825e0ee1ea1e1e4d00dbae81f14b0bf3611b78c952aacab827a053000000000000000000000000000000000a4edef9c1ed7f729f520e47730a124fd70662a904ba1074728114d1031e1572c6c886f6b57ec72a6178288c47c33577000000000000000000000000000000000468fb440d82b0630aeb8dca2b5256789a66da69bf91009cbfe6bd221e47aa8ae88dece9764bf3bd999d95d71e4c9899000000000000000000000000000000000f6d4552fa65dd2638b361543f887136a43253d9c66c411697003f7a13c308f5422e1aa0a59c8967acdefd8b6e36ccf3", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g2multiexp_(p2+p2=2*p2)", "Expected": "000000000000000000000000000000000b76fcbb604082a4f2d19858a7befd6053fa181c5119a612dfec83832537f644e02454f2b70d40985ebb08042d1620d40000000000000000000000000000000019a4a02c0ae51365d964c73be7babb719db1c69e0ddbf9a8a335b5bed3b0a4b070d2d5df01d2da4a3f1e56aae2ec106d000000000000000000000000000000000d18322f821ac72d3ca92f92b000483cf5b7d9e5d06873a44071c4e7e81efd904f210208fe0b9b4824f01c65bc7e62080000000000000000000000000000000004e563d53609a2d1e216aaaee5fbc14ef460160db8d1fdc5e1bd4e8b54cd2f39abf6f925969fa405efb9e700b01c7085", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000001", "Name": "bls_g2multiexp_(1*g2=g2)", "Expected": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000001", "Name": "bls_g2multiexp_(1*p2=p2)", "Expected": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g2multiexp_(0*g2=inf)", "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g2multiexp_(0*p2=inf)", "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011", "Name": "bls_g2multiexp_(x*inf=inf)", "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 54000, + "Gas": 22500, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g2multiexp_(2g2+inf)", "Expected": "000000000000000000000000000000001638533957d540a9d2370f17cc7ed5863bc0b995b8825e0ee1ea1e1e4d00dbae81f14b0bf3611b78c952aacab827a053000000000000000000000000000000000a4edef9c1ed7f729f520e47730a124fd70662a904ba1074728114d1031e1572c6c886f6b57ec72a6178288c47c33577000000000000000000000000000000000468fb440d82b0630aeb8dca2b5256789a66da69bf91009cbfe6bd221e47aa8ae88dece9764bf3bd999d95d71e4c9899000000000000000000000000000000000f6d4552fa65dd2638b361543f887136a43253d9c66c411697003f7a13c308f5422e1aa0a59c8967acdefd8b6e36ccf3", - "Gas": 79920, + "Gas": 45000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g2multiexp_(2p2+inf)", "Expected": "000000000000000000000000000000000b76fcbb604082a4f2d19858a7befd6053fa181c5119a612dfec83832537f644e02454f2b70d40985ebb08042d1620d40000000000000000000000000000000019a4a02c0ae51365d964c73be7babb719db1c69e0ddbf9a8a335b5bed3b0a4b070d2d5df01d2da4a3f1e56aae2ec106d000000000000000000000000000000000d18322f821ac72d3ca92f92b000483cf5b7d9e5d06873a44071c4e7e81efd904f210208fe0b9b4824f01c65bc7e62080000000000000000000000000000000004e563d53609a2d1e216aaaee5fbc14ef460160db8d1fdc5e1bd4e8b54cd2f39abf6f925969fa405efb9e700b01c7085", - "Gas": 79920, + "Gas": 45000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000000", "Name": "bls_g1multiexp_(inf+inf)", "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Gas": 79920, + "Gas": 45000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000002", "Name": "bls_g2multiexp_(2g2+2p2)", "Expected": "00000000000000000000000000000000009cc9ed6635623ba19b340cbc1b0eb05c3a58770623986bb7e041645175b0a38d663d929afb9a949f7524656043bccc000000000000000000000000000000000c0fb19d3f083fd5641d22a861a11979da258003f888c59c33005cb4a2df4df9e5a2868832063ac289dfa3e997f21f8a00000000000000000000000000000000168bf7d87cef37cf1707849e0a6708cb856846f5392d205ae7418dd94d94ef6c8aa5b424af2e99d957567654b9dae1d90000000000000000000000000000000017e0fa3c3b2665d52c26c7d4cea9f35443f4f9007840384163d3aa3c7d4d18b21b65ff4380cf3f3b48e94b5eecb221dd", - "Gas": 79920, + "Gas": 45000, "NoBenchmark": false }, { "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e300000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d87845147b8192d77bf871b62e87859d653922725724a5c031afeabc60bcef5ff66513800000000000000000000000000000000108ed59fd9fae381abfd1d6bce2fd2fa220990f0f837fa30e0f27914ed6e1454db0d1ee957b219f61da6ff8be0d6441f000000000000000000000000000000000296238ea82c6d4adb3c838ee3cb2346049c90b96d602d7bb1b469b905c9228be25c627bffee872def773d5b2a2eb57d00000000000000000000000000000000033f90f6057aadacae7963b0a0b379dd46750c1c94a6357c99b65f63b79e321ff50fe3053330911c56b6ceea08fee65600000000000000000000000000000000153606c417e59fb331b7ae6bce4fbf7c5190c33ce9402b5ebe2b70e44fca614f3f1382a3625ed5493843d0b0a652fc3f328388aff0d4a5b7dc9205abd374e7e98f3cd9f3418edb4eafda5fb16473d21600000000000000000000000000000000038af300ef34c7759a6caaa4e69363cafeed218a1f207e93b2c70d91a1263d375d6730bd6b6509dcac3ba5b567e85bf3000000000000000000000000000000000da75be60fb6aa0e9e3143e40c42796edf15685cafe0279afd2a67c3dff1c82341f17effd402e4f1af240ea90f4b659b0000000000000000000000000000000019b148cbdf163cf0894f29660d2e7bfb2b68e37d54cc83fd4e6e62c020eaa48709302ef8e746736c0e19342cc1ce3df4000000000000000000000000000000000492f4fed741b073e5a82580f7c663f9b79e036b70ab3e51162359cec4e77c78086fe879b65ca7a47d34374c8315ac5e263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e2000000000000000000000000000000000c5ae723be00e6c3f0efe184fdc0702b64588fe77dda152ab13099a3bacd3876767fa7bbad6d6fd90b3642e902b208f90000000000000000000000000000000012c8c05c1d5fc7bfa847f4d7d81e294e66b9a78bc9953990c358945e1f042eedafce608b67fdd3ab0cb2e6e263b9b1ad0000000000000000000000000000000004e77ddb3ede41b5ec4396b7421dd916efc68a358a0d7425bddd253547f2fb4830522358491827265dfc5bcc1928a5690000000000000000000000000000000011c624c56dbe154d759d021eec60fab3d8b852395a89de497e48504366feedd4662d023af447d66926a28076813dd64647b8192d77bf871b62e87859d653922725724a5c031afeabc60bcef5ff665131000000000000000000000000000000000ea4e7c33d43e17cc516a72f76437c4bf81d8f4eac69ac355d3bf9b71b8138d55dc10fd458be115afa798b55dac34be1000000000000000000000000000000001565c2f625032d232f13121d3cfb476f45275c303a037faa255f9da62000c2c864ea881e2bcddd111edc4a3c0da3e88d00000000000000000000000000000000043b6f5fe4e52c839148dc66f2b3751e69a0f6ebb3d056d6465d50d4108543ecd956e10fa1640dfd9bc0030cc2558d28000000000000000000000000000000000f8991d2a1ad662e7b6f58ab787947f1fa607fce12dde171bc17903b012091b657e15333e11701edcf5b63ba2a561247328388aff0d4a5b7dc9205abd374e7e98f3cd9f3418edb4eafda5fb16473d211", "Name": "bls_g2multiexp_multiple", "Expected": "0000000000000000000000000000000016cf5fd2c2f1b2e01cc48a6d03e8e6d7f3ad754d6c7d4000f806c18c28d8d559cf529dd159c74946a7713d1906894718000000000000000000000000000000000628d42142df8d620d1f3709ac01f382ba950eaf14c12863885af5838067deec4bb363ffda427fcbdd2b8ec6cc5784ae0000000000000000000000000000000018168dec2441ef462e9a769c782f81acdc7fa49dffebb996764ba9fa96b9200ceb5edd9e96b33c383bd042b4e6af191a000000000000000000000000000000001065aaea2c4aa1d2bee7f1e82a2138ae7016dbbade8383ad912d81eca5fb260086238f95f8cef8f2f491969d4cefa2c3", - "Gas": 147690, + "Gas": 112320, "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/bls/pairing_check_bls.json b/packages/evm/test/precompiles/bls/pairing_check_bls.json index 6e80a69d17..70ab731461 100644 --- a/packages/evm/test/precompiles/bls/pairing_check_bls.json +++ b/packages/evm/test/precompiles/bls/pairing_check_bls.json @@ -3,42 +3,42 @@ "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", "Name": "bls_pairing_e(G1,0)=e(0,G2)", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", - "Gas": 151000, + "Gas": 102900, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", "Name": "bls_pairing_non-degeneracy", "Expected": "0000000000000000000000000000000000000000000000000000000000000000", - "Gas": 108000, + "Gas": 70300, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a2100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be000000000000000000000000000000000a40300ce2dec9888b60690e9a41d3004fda4886854573974fab73b046d3147ba5b7a5bde85279ffede1b45b3918d82d0000000000000000000000000000000006d3d887e9f53b9ec4eb6cedf5607226754b07c01ace7834f57f3e7315faefb739e59018e22c492006190fba4a87002500000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17f9ee3837a55024f78c71363275a75d75d86bab79f74782aa0000000000000000000000000000000013fa4d4a0ad8b1ce186ed5061789213d993923066dddaf1040bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed", "Name": "bls_pairing_bilinearity", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", - "Gas": 194000, + "Gas": 135500, "NoBenchmark": false }, { "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17f9ee3837a55024f78c71363275a75d75d86bab79f74782aa0000000000000000000000000000000013fa4d4a0ad8b1ce186ed5061789213d993923066dddaf1040bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed", "Name": "bls_pairing_e(G1,-G2)=e(-G1,G2)", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", - "Gas": 151000, + "Gas": 102900, "NoBenchmark": false }, { "Input": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4000000000000000000000000000000000bc2357c6782bbb6a078d9e171fc7a81f7bd8ca73eb485e76317359908bb09bd372fd362a637512a9d48019b383e54890000000000000000000000000000000004b8f49c3bac0247a09487049492b0ed99cf90c56263141daa35f011330d3ced3f3ad78d252c51a3bb42fc7d8f182594000000000000000000000000000000000982d17b17404ac198a0ff5f2dffa56a328d95ec4732d9cca9da420ec7cf716dc63d56d0f5179a8b1ec71fe0328fe88200000000000000000000000000000000147c92cb19e43943bb20c5360a6c4347411eb8ffb3d6f19cc428a8dc0cb3fd1eb3ad02b1c21e21c78f65a7691ee63de90000000000000000000000000000000016cae74dc6523e5273dbd2d9d25c53f1e2c453e6d9ba3f605021cfb514fa0bdf721b05f2200f32591d733e739fabf438000000000000000000000000000000001405df65fb71b738510b3a2fc31c33ef3d884ccc84efb1017341a368bf40727b7ad8cdc8e3fd6b0eb94102488c5cb77000000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17f9ee3837a55024f78c71363275a75d75d86bab79f74782aa0000000000000000000000000000000013fa4d4a0ad8b1ce186ed5061789213d993923066dddaf1040bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed", "Name": "bls_pairing_e(aG1,bG2)=e(abG1,G2)", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", - "Gas": 151000, + "Gas": 102900, "NoBenchmark": false }, { "Input": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4000000000000000000000000000000000bc2357c6782bbb6a078d9e171fc7a81f7bd8ca73eb485e76317359908bb09bd372fd362a637512a9d48019b383e54890000000000000000000000000000000004b8f49c3bac0247a09487049492b0ed99cf90c56263141daa35f011330d3ced3f3ad78d252c51a3bb42fc7d8f182594000000000000000000000000000000000982d17b17404ac198a0ff5f2dffa56a328d95ec4732d9cca9da420ec7cf716dc63d56d0f5179a8b1ec71fe0328fe88200000000000000000000000000000000147c92cb19e43943bb20c5360a6c4347411eb8ffb3d6f19cc428a8dc0cb3fd1eb3ad02b1c21e21c78f65a7691ee63de90000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb00000000000000000000000000000000114d1d6855d545a8aa7d76c8cf2e21f267816aef1db507c96655b9d5caac42364e6f38ba0ecb751bad54dcd6b939c2ca00000000000000000000000000000000166335679f3b3e2617b70c22c48e820e2c6a35149c4f96293035c1494a1ce4591f7a44bce94e9d76def50a71c9e7fa41000000000000000000000000000000000ef11c636091748476331159c8259c064da712ffec033c89299384b4c11b801893026726d992aacdc8e0a28db1a3ab82000000000000000000000000000000000fd8d4944030f480f44ce0d2d4fb67ff6264d30a0f3193cc218b062e5114cf9e4ce847489f7be94b0d4a9fc0c550fdc60000000000000000000000000000000000edba2c166be3d673ea77016163ae5cdf7b3c9bd480e733eb5c08a5f1c798793d339cb503005f5a9e586ea5aabf9695", "Name": "bls_pairing_e(aG1,bG2)=e(G1,abG2)", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", - "Gas": 151000, + "Gas": 102900, "NoBenchmark": false } ] From df639781bc3cb66b2b01189bef5d0d5ad2648a6d Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 6 Jan 2025 13:35:53 +0100 Subject: [PATCH 24/33] vm: 2935 update history serve window --- packages/vm/src/params.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vm/src/params.ts b/packages/vm/src/params.ts index 16a3d4168c..17268cbd8d 100644 --- a/packages/vm/src/params.ts +++ b/packages/vm/src/params.ts @@ -40,7 +40,7 @@ export const paramsVM: ParamsDict = { 2935: { // config historyStorageAddress: '0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC', // The address where the historical blockhashes are stored - historyServeWindow: 8192, // The amount of blocks to be served by the historical blockhash contract + historyServeWindow: 8191, // The amount of blocks to be served by the historical blockhash contract systemAddress: '0xfffffffffffffffffffffffffffffffffffffffe', // The system address }, /** From 90fc63a4e298b86093eb2513540f03a85ede59a8 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 6 Jan 2025 15:10:12 +0100 Subject: [PATCH 25/33] evm: EXTCODE* do not follow 7702 delegations for gas calculations --- packages/evm/src/opcodes/gas.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/evm/src/opcodes/gas.ts b/packages/evm/src/opcodes/gas.ts index d6af6993b0..9b491f3e90 100644 --- a/packages/evm/src/opcodes/gas.ts +++ b/packages/evm/src/opcodes/gas.ts @@ -191,10 +191,6 @@ export const dynamicGasHandlers: Map Date: Thu, 9 Jan 2025 00:56:47 +0100 Subject: [PATCH 26/33] vm: t8n fix: exit early on non-existent 2935 code --- packages/vm/src/runBlock.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/vm/src/runBlock.ts b/packages/vm/src/runBlock.ts index a8a5323819..3e587f37eb 100644 --- a/packages/vm/src/runBlock.ts +++ b/packages/vm/src/runBlock.ts @@ -18,7 +18,6 @@ import { bytesToHex, concatBytes, createAddressFromString, - createPartialAccount, equalsBytes, getVerkleTreeIndicesForStorageSlot, hexToBytes, @@ -529,9 +528,9 @@ export async function accumulateParentBlockHash( // but we need to put account so as to query later for slot const code = await vm.stateManager.getCode(historyAddress) - // Create an empty account if not there already if (code.length === 0) { - await vm.stateManager.putAccount(historyAddress, createPartialAccount({})) + // Exit early, system contract has no code so no storage is written + return } async function putBlockHash(vm: VM, hash: Uint8Array, number: bigint) { From f0dbc536306630454bf93edc19b475527be1657b Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Thu, 9 Jan 2025 20:47:14 +0100 Subject: [PATCH 27/33] vm: move floor check after applying refund --- packages/vm/src/runTx.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/vm/src/runTx.ts b/packages/vm/src/runTx.ts index 947ffdc71c..022105e32d 100644 --- a/packages/vm/src/runTx.ts +++ b/packages/vm/src/runTx.ts @@ -628,15 +628,6 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { debugGas(`tx add baseFee ${intrinsicGas} to totalGasSpent (-> ${results.totalGasSpent})`) } - if (vm.common.isActivatedEIP(7623)) { - if (results.totalGasSpent < floorCost) { - results.totalGasSpent = floorCost - if (vm.DEBUG) { - debugGas(`tx apply floorCost ${floorCost} to totalGasSpent (-> ${results.totalGasSpent})`) - } - } - } - // Add blob gas used to result if (isBlob4844Tx(tx)) { results.blobGasUsed = totalblobGas @@ -644,7 +635,7 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { // Process any gas refund gasRefund += results.execResult.gasRefund ?? BIGINT_0 - results.gasRefund = gasRefund + results.gasRefund = gasRefund // TODO: this field could now be incorrect with the introduction of 7623 const maxRefundQuotient = vm.common.param('maxRefundQuotient') if (gasRefund !== BIGINT_0) { const maxRefund = results.totalGasSpent / maxRefundQuotient @@ -659,6 +650,16 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { } } + if (vm.common.isActivatedEIP(7623)) { + if (results.totalGasSpent < floorCost) { + // TODO: likely set `results.gasRefund = BIGINT_0` + results.totalGasSpent = floorCost + if (vm.DEBUG) { + debugGas(`tx apply floorCost ${floorCost} to totalGasSpent (-> ${results.totalGasSpent})`) + } + } + } + results.amountSpent = results.totalGasSpent * gasPrice // Update sender's balance From cf390939bb4e3af2538a28affc307d209e1f0bae Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Thu, 9 Jan 2025 21:48:50 +0100 Subject: [PATCH 28/33] evm: update bls cases --- .../test/precompiles/bls/fail-mul_G1_bls.json | 37 +++++++++ .../test/precompiles/bls/fail-mul_G2_bls.json | 37 +++++++++ .../evm/test/precompiles/bls/mul_G1_bls.json | 79 +++++++++++++++++++ .../evm/test/precompiles/bls/mul_G2_bls.json | 79 +++++++++++++++++++ .../test/precompiles/bls/multiexp_G1_bls.json | 14 ++++ .../test/precompiles/bls/multiexp_G2_bls.json | 14 ++++ .../evm/test/precompiles/eip-2537-bls.spec.ts | 8 +- 7 files changed, 266 insertions(+), 2 deletions(-) create mode 100644 packages/evm/test/precompiles/bls/fail-mul_G1_bls.json create mode 100644 packages/evm/test/precompiles/bls/fail-mul_G2_bls.json create mode 100644 packages/evm/test/precompiles/bls/mul_G1_bls.json create mode 100644 packages/evm/test/precompiles/bls/mul_G2_bls.json diff --git a/packages/evm/test/precompiles/bls/fail-mul_G1_bls.json b/packages/evm/test/precompiles/bls/fail-mul_G1_bls.json new file mode 100644 index 0000000000..b3c7338ba6 --- /dev/null +++ b/packages/evm/test/precompiles/bls/fail-mul_G1_bls.json @@ -0,0 +1,37 @@ +[ + { + "Input": "", + "ExpectedError": "invalid input length", + "Name": "bls_g1mul_empty_input" + }, + { + "Input": "00000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid input length", + "Name": "bls_g1mul_short_input" + }, + { + "Input": "000000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid input length", + "Name": "bls_g1mul_large_input" + }, + { + "Input": "0000000000000000000000000000000031f2e5916b17be2e71b10b4292f558e727dfd7d48af9cbc5087f0ce00dcca27c8b01e83eaace1aefb539f00adb2271660000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid fp.Element encoding", + "Name": "bls_g1mul_invalid_field_element" + }, + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb00000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid point: not on curve", + "Name": "bls_g1mul_point_not_on_curve" + }, + { + "Input": "1000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid field element top bytes", + "Name": "bls_g1mul_violate_top_bytes" + }, + { + "Input": "000000000000000000000000000000000123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef00000000000000000000000000000000193fb7cedb32b2c3adc06ec11a96bc0d661869316f5e4a577a9f7c179593987beb4fb2ee424dbb2f5dd891e228b46c4a0000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "g1 point is not on correct subgroup", + "Name": "bls_g1mul_g1_not_in_correct_subgroup" + } +] diff --git a/packages/evm/test/precompiles/bls/fail-mul_G2_bls.json b/packages/evm/test/precompiles/bls/fail-mul_G2_bls.json new file mode 100644 index 0000000000..8ff55d2e53 --- /dev/null +++ b/packages/evm/test/precompiles/bls/fail-mul_G2_bls.json @@ -0,0 +1,37 @@ +[ + { + "Input": "", + "ExpectedError": "invalid input length", + "Name": "bls_g2mul_empty_input" + }, + { + "Input": "000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid input length", + "Name": "bls_g2mul_short_input" + }, + { + "Input": "0000000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid input length", + "Name": "bls_g2mul_large_input" + }, + { + "Input": "000000000000000000000000000000001c4bb49d2a0ef12b7123acdd7110bd292b5bc659edc54dc21b81de057194c79b2a5803255959bbef8e7f56c8c12168630000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid fp.Element encoding", + "Name": "bls_g2mul_invalid_field_element" + }, + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb800000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid point: not on curve", + "Name": "bls_g2mul_point_not_on_curve" + }, + { + "Input": "10000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "invalid field element top bytes", + "Name": "bls_g2mul_violate_top_bytes" + }, + { + "Input": "00000000000000000000000000000000197bfd0342bbc8bee2beced2f173e1a87be576379b343e93232d6cef98d84b1d696e5612ff283ce2cfdccb2cfb65fa0c00000000000000000000000000000000184e811f55e6f9d84d77d2f79102fd7ea7422f4759df5bf7f6331d550245e3f1bcf6a30e3b29110d85e0ca16f9f6ae7a000000000000000000000000000000000f10e1eb3c1e53d2ad9cf2d398b2dc22c5842fab0a74b174f691a7e914975da3564d835cd7d2982815b8ac57f507348f000000000000000000000000000000000767d1c453890f1b9110fda82f5815c27281aba3f026ee868e4176a0654feea41a96575e0c4d58a14dbfbcc05b5010b10000000000000000000000000000000000000000000000000000000000000002", + "ExpectedError": "g2 point is not on correct subgroup", + "Name": "bls_g2mul_g2_not_in_correct_subgroup" + } +] diff --git a/packages/evm/test/precompiles/bls/mul_G1_bls.json b/packages/evm/test/precompiles/bls/mul_G1_bls.json new file mode 100644 index 0000000000..17babfa7d3 --- /dev/null +++ b/packages/evm/test/precompiles/bls/mul_G1_bls.json @@ -0,0 +1,79 @@ +[ + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000002", + "Name": "bls_g1mul_(g1+g1=2*g1)", + "Expected": "000000000000000000000000000000000572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e00000000000000000000000000000000166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000002", + "Name": "bls_g1mul_(p1+p1=2*p1)", + "Expected": "0000000000000000000000000000000015222cddbabdd764c4bee0b3720322a65ff4712c86fc4b1588d0c209210a0884fa9468e855d261c483091b2bf7de6a630000000000000000000000000000000009f9edb99bc3b75d7489735c98b16ab78b9386c5f7a1f76c7e96ac6eb5bbde30dbca31a74ec6e0f0b12229eecea33c39", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000001", + "Name": "bls_g1mul_(1*g1=g1)", + "Expected": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000001", + "Name": "bls_g1mul_(1*p1=p1)", + "Expected": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000000", + "Name": "bls_g1mul_(0*g1=inf)", + "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a210000000000000000000000000000000000000000000000000000000000000000", + "Name": "bls_g1mul_(0*p1=inf)", + "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011", + "Name": "bls_g1mul_(x*inf=inf)", + "Expected": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", + "Name": "bls_g1mul_random*g1", + "Expected": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", + "Name": "bls_g1mul_random*p1", + "Expected": "0000000000000000000000000000000006ee9c9331228753bcb148d0ca8623447701bb0aa6eafb0340aa7f81543923474e00f2a225de65c62dd1d8303270220c0000000000000000000000000000000018dd7be47eb4e80985d7a0d2cc96c8b004250b36a5c3ec0217705d453d3ecc6d0d3d1588722da51b40728baba1e93804", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e19a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g1mul_random*g1_unnormalized_scalar", + "Expected": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a219a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g1mul_random*p1_unnormalized_scalar", + "Expected": "0000000000000000000000000000000006ee9c9331228753bcb148d0ca8623447701bb0aa6eafb0340aa7f81543923474e00f2a225de65c62dd1d8303270220c0000000000000000000000000000000018dd7be47eb4e80985d7a0d2cc96c8b004250b36a5c3ec0217705d453d3ecc6d0d3d1588722da51b40728baba1e93804", + "Gas": 12000, + "NoBenchmark": false + } +] diff --git a/packages/evm/test/precompiles/bls/mul_G2_bls.json b/packages/evm/test/precompiles/bls/mul_G2_bls.json new file mode 100644 index 0000000000..c1b79098bf --- /dev/null +++ b/packages/evm/test/precompiles/bls/mul_G2_bls.json @@ -0,0 +1,79 @@ +[ + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000002", + "Name": "bls_g2mul_(g2+g2=2*g2)", + "Expected": "000000000000000000000000000000001638533957d540a9d2370f17cc7ed5863bc0b995b8825e0ee1ea1e1e4d00dbae81f14b0bf3611b78c952aacab827a053000000000000000000000000000000000a4edef9c1ed7f729f520e47730a124fd70662a904ba1074728114d1031e1572c6c886f6b57ec72a6178288c47c33577000000000000000000000000000000000468fb440d82b0630aeb8dca2b5256789a66da69bf91009cbfe6bd221e47aa8ae88dece9764bf3bd999d95d71e4c9899000000000000000000000000000000000f6d4552fa65dd2638b361543f887136a43253d9c66c411697003f7a13c308f5422e1aa0a59c8967acdefd8b6e36ccf3", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000002", + "Name": "bls_g2mul_(p2+p2=2*p2)", + "Expected": "000000000000000000000000000000000b76fcbb604082a4f2d19858a7befd6053fa181c5119a612dfec83832537f644e02454f2b70d40985ebb08042d1620d40000000000000000000000000000000019a4a02c0ae51365d964c73be7babb719db1c69e0ddbf9a8a335b5bed3b0a4b070d2d5df01d2da4a3f1e56aae2ec106d000000000000000000000000000000000d18322f821ac72d3ca92f92b000483cf5b7d9e5d06873a44071c4e7e81efd904f210208fe0b9b4824f01c65bc7e62080000000000000000000000000000000004e563d53609a2d1e216aaaee5fbc14ef460160db8d1fdc5e1bd4e8b54cd2f39abf6f925969fa405efb9e700b01c7085", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000001", + "Name": "bls_g2mul_(1*g2=g2)", + "Expected": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000001", + "Name": "bls_g2mul_(1*p2=p2)", + "Expected": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0000000000000000000000000000000000000000000000000000000000000000", + "Name": "bls_g2mul_(0*g2=inf)", + "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784510000000000000000000000000000000000000000000000000000000000000000", + "Name": "bls_g2mul_(0*p2=inf)", + "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011", + "Name": "bls_g2mul_(x*inf=inf)", + "Expected": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", + "Name": "bls_g2mul_random*g2", + "Expected": "0000000000000000000000000000000014856c22d8cdb2967c720e963eedc999e738373b14172f06fc915769d3cc5ab7ae0a1b9c38f48b5585fb09d4bd2733bb000000000000000000000000000000000c400b70f6f8cd35648f5c126cce5417f3be4d8eefbd42ceb4286a14df7e03135313fe5845e3a575faab3e8b949d248800000000000000000000000000000000149a0aacc34beba2beb2f2a19a440166e76e373194714f108e4ab1c3fd331e80f4e73e6b9ea65fe3ec96d7136de81544000000000000000000000000000000000e4622fef26bdb9b1e8ef6591a7cc99f5b73164500c1ee224b6a761e676b8799b09a3fd4fa7e242645cc1a34708285e4", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d878451263dbd792f5b1be47ed85f8938c0f29586af0d3ac7b977f21c278fe1462040e3", + "Name": "bls_g2mul_random*p2", + "Expected": "00000000000000000000000000000000036074dcbbd0e987531bfe0e45ddfbe09fd015665990ee0c352e8e403fe6af971d8f42141970d9ab14b4dd04874409e600000000000000000000000000000000019705637f24ba2f398f32c3a3e20d6a1cd0fd63e6f8f071cf603a8334f255744927e7bfdfdb18519e019c49ff6e914500000000000000000000000000000000008e74fcff4c4278c9accfb60809ed69bbcbe3d6213ef2304e078d15ec7d6decb4f462b24b8e7cc38cc11b6f2c9e0486000000000000000000000000000000001331d40100f38c1070afd832445881b47cf4d63894666d9907c85ac66604aab5ad329980938cc3c167ccc5b6bc1b8f30", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be9a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g2mul_random*g2_unnormalized_scalar", + "Expected": "0000000000000000000000000000000014856c22d8cdb2967c720e963eedc999e738373b14172f06fc915769d3cc5ab7ae0a1b9c38f48b5585fb09d4bd2733bb000000000000000000000000000000000c400b70f6f8cd35648f5c126cce5417f3be4d8eefbd42ceb4286a14df7e03135313fe5845e3a575faab3e8b949d248800000000000000000000000000000000149a0aacc34beba2beb2f2a19a440166e76e373194714f108e4ab1c3fd331e80f4e73e6b9ea65fe3ec96d7136de81544000000000000000000000000000000000e4622fef26bdb9b1e8ef6591a7cc99f5b73164500c1ee224b6a761e676b8799b09a3fd4fa7e242645cc1a34708285e4", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784519a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g2mul_random*p2_unnormalized_scalar", + "Expected": "00000000000000000000000000000000036074dcbbd0e987531bfe0e45ddfbe09fd015665990ee0c352e8e403fe6af971d8f42141970d9ab14b4dd04874409e600000000000000000000000000000000019705637f24ba2f398f32c3a3e20d6a1cd0fd63e6f8f071cf603a8334f255744927e7bfdfdb18519e019c49ff6e914500000000000000000000000000000000008e74fcff4c4278c9accfb60809ed69bbcbe3d6213ef2304e078d15ec7d6decb4f462b24b8e7cc38cc11b6f2c9e0486000000000000000000000000000000001331d40100f38c1070afd832445881b47cf4d63894666d9907c85ac66604aab5ad329980938cc3c167ccc5b6bc1b8f30", + "Gas": 22500, + "NoBenchmark": false + } +] diff --git a/packages/evm/test/precompiles/bls/multiexp_G1_bls.json b/packages/evm/test/precompiles/bls/multiexp_G1_bls.json index cef5ce63bc..e3ba0d8557 100644 --- a/packages/evm/test/precompiles/bls/multiexp_G1_bls.json +++ b/packages/evm/test/precompiles/bls/multiexp_G1_bls.json @@ -75,5 +75,19 @@ "Expected": "00000000000000000000000000000000053fbdb09b6b5faa08bfe7b7069454247ad4d8bd57e90e2d2ebaa04003dcf110aa83072c07f480ab2107cca2ccff6091000000000000000000000000000000001654537b7c96fe64d13906066679c3d45808cb666452b55d1b909c230cc4b423c3f932c58754b9b762dc49fcc825522c", "Gas": 61992, "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e19a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g1multiexp_random*g1_unnormalized_scalar", + "Expected": "000000000000000000000000000000000491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a0000000000000000000000000000000017cd7061575d3e8034fcea62adaa1a3bc38dca4b50e4c5c01d04dd78037c9cee914e17944ea99e7ad84278e5d49f36c4", + "Gas": 12000, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a219a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g1multiexp_random*p1_unnormalized_scalar", + "Expected": "0000000000000000000000000000000006ee9c9331228753bcb148d0ca8623447701bb0aa6eafb0340aa7f81543923474e00f2a225de65c62dd1d8303270220c0000000000000000000000000000000018dd7be47eb4e80985d7a0d2cc96c8b004250b36a5c3ec0217705d453d3ecc6d0d3d1588722da51b40728baba1e93804", + "Gas": 12000, + "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/bls/multiexp_G2_bls.json b/packages/evm/test/precompiles/bls/multiexp_G2_bls.json index 0b98cfa8ab..8357cc406e 100644 --- a/packages/evm/test/precompiles/bls/multiexp_G2_bls.json +++ b/packages/evm/test/precompiles/bls/multiexp_G2_bls.json @@ -82,5 +82,19 @@ "Expected": "0000000000000000000000000000000016cf5fd2c2f1b2e01cc48a6d03e8e6d7f3ad754d6c7d4000f806c18c28d8d559cf529dd159c74946a7713d1906894718000000000000000000000000000000000628d42142df8d620d1f3709ac01f382ba950eaf14c12863885af5838067deec4bb363ffda427fcbdd2b8ec6cc5784ae0000000000000000000000000000000018168dec2441ef462e9a769c782f81acdc7fa49dffebb996764ba9fa96b9200ceb5edd9e96b33c383bd042b4e6af191a000000000000000000000000000000001065aaea2c4aa1d2bee7f1e82a2138ae7016dbbade8383ad912d81eca5fb260086238f95f8cef8f2f491969d4cefa2c3", "Gas": 112320, "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be9a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g2multiexp_random*g2_unnormalized_scalar", + "Expected": "0000000000000000000000000000000014856c22d8cdb2967c720e963eedc999e738373b14172f06fc915769d3cc5ab7ae0a1b9c38f48b5585fb09d4bd2733bb000000000000000000000000000000000c400b70f6f8cd35648f5c126cce5417f3be4d8eefbd42ceb4286a14df7e03135313fe5845e3a575faab3e8b949d248800000000000000000000000000000000149a0aacc34beba2beb2f2a19a440166e76e373194714f108e4ab1c3fd331e80f4e73e6b9ea65fe3ec96d7136de81544000000000000000000000000000000000e4622fef26bdb9b1e8ef6591a7cc99f5b73164500c1ee224b6a761e676b8799b09a3fd4fa7e242645cc1a34708285e4", + "Gas": 22500, + "NoBenchmark": false + }, + { + "Input": "00000000000000000000000000000000103121a2ceaae586d240843a398967325f8eb5a93e8fea99b62b9f88d8556c80dd726a4b30e84a36eeabaf3592937f2700000000000000000000000000000000086b990f3da2aeac0a36143b7d7c824428215140db1bb859338764cb58458f081d92664f9053b50b3fbd2e4723121b68000000000000000000000000000000000f9e7ba9a86a8f7624aa2b42dcc8772e1af4ae115685e60abc2c9b90242167acef3d0be4050bf935eed7c3b6fc7ba77e000000000000000000000000000000000d22c3652d0dc6f0fc9316e14268477c2049ef772e852108d269d9c38dba1d4802e8dae479818184c08f9a569d8784519a2b64cc58f8992cb21237914262ca9ada6cb13dc7b7d3f11c278fe0462040e4", + "Name": "bls_g2multiexp_random*p2_unnormalized_scalar", + "Expected": "00000000000000000000000000000000036074dcbbd0e987531bfe0e45ddfbe09fd015665990ee0c352e8e403fe6af971d8f42141970d9ab14b4dd04874409e600000000000000000000000000000000019705637f24ba2f398f32c3a3e20d6a1cd0fd63e6f8f071cf603a8334f255744927e7bfdfdb18519e019c49ff6e914500000000000000000000000000000000008e74fcff4c4278c9accfb60809ed69bbcbe3d6213ef2304e078d15ec7d6decb4f462b24b8e7cc38cc11b6f2c9e0486000000000000000000000000000000001331d40100f38c1070afd832445881b47cf4d63894666d9907c85ac66604aab5ad329980938cc3c167ccc5b6bc1b8f30", + "Gas": 22500, + "NoBenchmark": false } ] diff --git a/packages/evm/test/precompiles/eip-2537-bls.spec.ts b/packages/evm/test/precompiles/eip-2537-bls.spec.ts index 4a7f622c92..ac37ebb851 100644 --- a/packages/evm/test/precompiles/eip-2537-bls.spec.ts +++ b/packages/evm/test/precompiles/eip-2537-bls.spec.ts @@ -20,11 +20,15 @@ const precompileMap: { [key: string]: string } = { 'fail-add_G2_bls.json': '000000000000000000000000000000000000000d', 'fail-map_fp2_to_G2_bls.json': '0000000000000000000000000000000000000011', 'fail-map_fp_to_G1_bls.json': '0000000000000000000000000000000000000010', + 'fail-mul_G1_bls.json': '000000000000000000000000000000000000000c', + 'fail-mul_G2_bls.json': '000000000000000000000000000000000000000e', 'fail-multiexp_G1_bls.json': '000000000000000000000000000000000000000c', 'fail-multiexp_G2_bls.json': '000000000000000000000000000000000000000e', 'fail-pairing_check_bls.json': '000000000000000000000000000000000000000f', 'map_fp2_to_G2_bls.json': '0000000000000000000000000000000000000011', 'map_fp_to_G1_bls.json': '0000000000000000000000000000000000000010', + 'mul_G1_bls.json': '000000000000000000000000000000000000000c', + 'mul_G2_bls.json': '000000000000000000000000000000000000000e', 'multiexp_G1_bls.json': '000000000000000000000000000000000000000c', 'multiexp_G2_bls.json': '000000000000000000000000000000000000000e', 'pairing_check_bls.json': '000000000000000000000000000000000000000f', @@ -78,8 +82,8 @@ for (const bls of [undefined, mclbls]) { 'return value should match testVectorResult', ) assert.equal(result.executionGasUsed, BigInt(data.Gas)) - } catch (e) { - assert.fail('The precompile should not throw') + } catch (e: any) { + assert.fail(e.message) } } }) From 737c60b5468946233383d11bc2803ef22062a4cd Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 13 Jan 2025 16:03:08 +0100 Subject: [PATCH 29/33] evm/common: cleanup pr --- packages/common/src/hardforks.ts | 6 ++---- packages/evm/src/opcodes/functions.ts | 1 - packages/evm/src/precompiles/index.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/common/src/hardforks.ts b/packages/common/src/hardforks.ts index c915a31ef6..fd11ca6876 100644 --- a/packages/common/src/hardforks.ts +++ b/packages/common/src/hardforks.ts @@ -158,12 +158,10 @@ export const hardforksDict: HardforksDict = { * Status : Final */ prague: { - // TODO update this accordingly to the right devnet setup - //eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698], // This is EOF-only - eips: [2537, 2935, 6110, 7002, 7251, 7623, 7685, 7691, 7702], // This is current prague without EOF + eips: [2537, 2935, 6110, 7002, 7251, 7623, 7685, 7691, 7702], }, osaka: { - eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698], // These are the EOF EIPs + eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698], }, /** * Description: Next feature hardfork after prague, internally used for verkle testing/implementation (incomplete/experimental) diff --git a/packages/evm/src/opcodes/functions.ts b/packages/evm/src/opcodes/functions.ts index 22601fbeed..fb9599645c 100644 --- a/packages/evm/src/opcodes/functions.ts +++ b/packages/evm/src/opcodes/functions.ts @@ -61,7 +61,6 @@ export interface AsyncOpHandler { export type OpHandler = SyncOpHandler | AsyncOpHandler -// TODO: verify that this is the correct designator // The PR https://github.com/ethereum/EIPs/pull/8969 has two definitions of the // designator: the original (0xef0100) and the designator added in the changes (0xef01) const eip7702Designator = hexToBytes('0xef01') diff --git a/packages/evm/src/precompiles/index.ts b/packages/evm/src/precompiles/index.ts index ae7a44fb65..55c25c95b1 100644 --- a/packages/evm/src/precompiles/index.ts +++ b/packages/evm/src/precompiles/index.ts @@ -172,7 +172,7 @@ const precompileEntries: PrecompileEntry[] = [ param: 2537, }, precompile: precompile0d, - name: 'BLS12_G1ADD (0x0d)', + name: 'BLS12_G2ADD (0x0d)', }, { address: BYTES_19 + '0e', From b06737be5868a9ed0803ccd1d4d4aa5319605501 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 13 Jan 2025 17:14:21 +0100 Subject: [PATCH 30/33] monorepo: casing maxblob -> maxBlob --- packages/block/src/block/block.ts | 4 ++-- packages/block/src/params.ts | 6 +++--- packages/client/src/miner/pendingBlock.ts | 4 ++-- packages/client/src/rpc/modules/eth.ts | 4 ++-- packages/client/src/service/txpool.ts | 2 +- packages/client/test/miner/pendingBlock.spec.ts | 2 +- packages/tx/src/4844/tx.ts | 3 ++- packages/tx/src/params.ts | 4 ++-- packages/vm/src/buildBlock.ts | 2 +- packages/vm/src/params.ts | 6 +++--- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/packages/block/src/block/block.ts b/packages/block/src/block/block.ts index 00467923c2..ed39eae880 100644 --- a/packages/block/src/block/block.ts +++ b/packages/block/src/block/block.ts @@ -249,7 +249,7 @@ export class Block { } } if (this.common.isActivatedEIP(4844)) { - const blobGasLimit = this.common.param('maxblobGasPerBlock') + const blobGasLimit = this.common.param('maxBlobGasPerBlock') const blobGasPerBlob = this.common.param('blobGasPerBlob') if (tx instanceof Blob4844Tx) { blobGasUsed += BigInt(tx.numBlobs()) * blobGasPerBlob @@ -354,7 +354,7 @@ export class Block { */ validateBlobTransactions(parentHeader: BlockHeader) { if (this.common.isActivatedEIP(4844)) { - const blobGasLimit = this.common.param('maxblobGasPerBlock') + const blobGasLimit = this.common.param('maxBlobGasPerBlock') const blobGasPerBlob = this.common.param('blobGasPerBlob') let blobGasUsed = BIGINT_0 diff --git a/packages/block/src/params.ts b/packages/block/src/params.ts index 622937dab2..0ebfa7ff09 100644 --- a/packages/block/src/params.ts +++ b/packages/block/src/params.ts @@ -10,7 +10,7 @@ export const paramsBlock: ParamsDict = { gasLimitBoundDivisor: 1024, // The bound divisor of the gas limit, used in update calculations targetBlobGasPerBlock: 0, // Base value needed here since called pre-4844 in BlockHeader.calcNextExcessBlobGas() blobGasPerBlob: 0, - maxblobGasPerBlock: 0, + maxBlobGasPerBlock: 0, // format maxExtraDataSize: 32, // Maximum size extra data may be after Genesis // pow @@ -72,7 +72,7 @@ export const paramsBlock: ParamsDict = { // gasConfig targetBlobGasPerBlock: 393216, // The target blob gas consumed per block blobGasPerBlob: 131072, // The base fee for blob gas per blob - maxblobGasPerBlock: 786432, // The max blob gas allowable per block + maxBlobGasPerBlock: 786432, // The max blob gas allowable per block blobGasPriceUpdateFraction: 3338477, // The denominator used in the exponential when calculating a blob gas price // gasPrices simplePerBlobGas: 12000, // The basic gas fee for each blob @@ -91,7 +91,7 @@ export const paramsBlock: ParamsDict = { 7691: { // gasConfig targetBlobGasPerBlock: 786432, // The target blob gas consumed per block - maxblobGasPerBlock: 1179648, // The max blob gas allowable per block + maxBlobGasPerBlock: 1179648, // The max blob gas allowable per block blobGasPriceUpdateFraction: 5007716, // The denominator used in the exponential when calculating a blob gas price }, } diff --git a/packages/client/src/miner/pendingBlock.ts b/packages/client/src/miner/pendingBlock.ts index 15ba431dc1..4d9e8deb2e 100644 --- a/packages/client/src/miner/pendingBlock.ts +++ b/packages/client/src/miner/pendingBlock.ts @@ -192,7 +192,7 @@ export class PendingBlock { // Get if and how many blobs are allowed in the tx let allowedBlobs if (vm.common.isActivatedEIP(4844)) { - const blobGasLimit = vm.common.param('maxblobGasPerBlock') + const blobGasLimit = vm.common.param('maxBlobGasPerBlock') const blobGasPerBlob = vm.common.param('blobGasPerBlob') allowedBlobs = Number(blobGasLimit / blobGasPerBlob) } else { @@ -270,7 +270,7 @@ export class PendingBlock { let allowedBlobs if (vm.common.isActivatedEIP(4844)) { const bundle = this.blobsBundles.get(payloadId) ?? { blobs: [], commitments: [], proofs: [] } - const blobGasLimit = vm.common.param('maxblobGasPerBlock') + const blobGasLimit = vm.common.param('maxBlobGasPerBlock') const blobGasPerBlob = vm.common.param('blobGasPerBlob') allowedBlobs = Number(blobGasLimit / blobGasPerBlob) - bundle.blobs.length } else { diff --git a/packages/client/src/rpc/modules/eth.ts b/packages/client/src/rpc/modules/eth.ts index 167e46c6df..a5c7880b2d 100644 --- a/packages/client/src/rpc/modules/eth.ts +++ b/packages/client/src/rpc/modules/eth.ts @@ -1160,7 +1160,7 @@ export class Eth { // Blob Transactions sent over RPC are expected to be in Network Wrapper format tx = createBlob4844TxFromSerializedNetworkWrapper(txBuf, { common }) - const blobGasLimit = tx.common.param('maxblobGasPerBlock') + const blobGasLimit = tx.common.param('maxBlobGasPerBlock') const blobGasPerBlob = tx.common.param('blobGasPerBlob') if (BigInt((tx.blobs ?? []).length) * blobGasPerBlob > blobGasLimit) { @@ -1402,7 +1402,7 @@ export class Eth { let blobGasUsedRatio = 0 if (b.header.excessBlobGas !== undefined) { baseFeePerBlobGas = b.header.getBlobGasPrice() - const max = b.common.param('maxblobGasPerBlock') + const max = b.common.param('maxBlobGasPerBlock') blobGasUsedRatio = Number(blobGasUsed) / Number(max) } diff --git a/packages/client/src/service/txpool.ts b/packages/client/src/service/txpool.ts index 6a1ef4201a..fe2d36c176 100644 --- a/packages/client/src/service/txpool.ts +++ b/packages/client/src/service/txpool.ts @@ -399,7 +399,7 @@ export class TxPool { } pruneBlobsAndProofsCache() { - const blobGasLimit = this.config.chainCommon.param('maxblobGasPerBlock') + const blobGasLimit = this.config.chainCommon.param('maxBlobGasPerBlock') const blobGasPerBlob = this.config.chainCommon.param('blobGasPerBlob') const allowedBlobsPerBlock = Number(blobGasLimit / blobGasPerBlob) diff --git a/packages/client/test/miner/pendingBlock.spec.ts b/packages/client/test/miner/pendingBlock.spec.ts index 7d295a4515..91354c83f6 100644 --- a/packages/client/test/miner/pendingBlock.spec.ts +++ b/packages/client/test/miner/pendingBlock.spec.ts @@ -366,7 +366,7 @@ describe('[PendingBlock]', async () => { const fillProofs = blobsToProofs(kzg, fillBlobs, fillCommitments) const fillBlobAndProof = { blob: fillBlobs[0], proof: fillProofs[0] } - const blobGasLimit = txPool['config'].chainCommon.param('maxblobGasPerBlock') + const blobGasLimit = txPool['config'].chainCommon.param('maxBlobGasPerBlock') const blobGasPerBlob = txPool['config'].chainCommon.param('blobGasPerBlob') const allowedBlobsPerBlock = Number(blobGasLimit / blobGasPerBlob) const allowedLength = allowedBlobsPerBlock * txPool['config'].blobsAndProofsCacheBlocks diff --git a/packages/tx/src/4844/tx.ts b/packages/tx/src/4844/tx.ts index d3eedb33ad..f8082b5148 100644 --- a/packages/tx/src/4844/tx.ts +++ b/packages/tx/src/4844/tx.ts @@ -172,7 +172,8 @@ export class Blob4844Tx implements TransactionInterface limitBlobsPerTx) { const msg = Legacy.errorMsg(this, `tx can contain at most ${limitBlobsPerTx} blobs`) throw new Error(msg) diff --git a/packages/tx/src/params.ts b/packages/tx/src/params.ts index 12afc54409..8b97c8f703 100644 --- a/packages/tx/src/params.ts +++ b/packages/tx/src/params.ts @@ -43,7 +43,7 @@ export const paramsTx: ParamsDict = { 4844: { blobCommitmentVersionKzg: 1, // The number indicated a versioned hash is a KZG commitment blobGasPerBlob: 131072, // The base fee for blob gas per blob - maxblobGasPerBlock: 786432, // The max blob gas allowable per block + maxBlobGasPerBlock: 786432, // The max blob gas allowable per block }, /** * Increase calldata cost to reduce maximum block size @@ -64,6 +64,6 @@ export const paramsTx: ParamsDict = { . * Shard Blob Transactions . */ 7691: { - maxblobGasPerBlock: 1179648, // The max blob gas allowable per block + maxBlobGasPerBlock: 1179648, // The max blob gas allowable per block }, } diff --git a/packages/vm/src/buildBlock.ts b/packages/vm/src/buildBlock.ts index 60535a28c6..ee5614a99d 100644 --- a/packages/vm/src/buildBlock.ts +++ b/packages/vm/src/buildBlock.ts @@ -232,7 +232,7 @@ export class BlockBuilder { // cannot be greater than the remaining gas in the block const blockGasLimit = toType(this.headerData.gasLimit, TypeOutput.BigInt) - const blobGasLimit = this.vm.common.param('maxblobGasPerBlock') + const blobGasLimit = this.vm.common.param('maxBlobGasPerBlock') const blobGasPerBlob = this.vm.common.param('blobGasPerBlob') const blockGasRemaining = blockGasLimit - this.gasUsed diff --git a/packages/vm/src/params.ts b/packages/vm/src/params.ts index 17268cbd8d..96f63b194c 100644 --- a/packages/vm/src/params.ts +++ b/packages/vm/src/params.ts @@ -8,7 +8,7 @@ export const paramsVM: ParamsDict = { // gasConfig maxRefundQuotient: 2, // Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund) blobGasPerBlob: 0, - maxblobGasPerBlock: 0, + maxBlobGasPerBlock: 0, // pow minerReward: '5000000000000000000', // the amount a miner get rewarded for mining a block }, @@ -55,7 +55,7 @@ export const paramsVM: ParamsDict = { . */ 4844: { blobGasPerBlob: 131072, // The base fee for blob gas per blob - maxblobGasPerBlock: 786432, // The max blob gas allowable per block + maxBlobGasPerBlock: 786432, // The max blob gas allowable per block }, /** . * Beacon block root in the EVM @@ -94,6 +94,6 @@ export const paramsVM: ParamsDict = { . * Shard Blob Transactions . */ 7691: { - maxblobGasPerBlock: 1179648, // The max blob gas allowable per block + maxBlobGasPerBlock: 1179648, // The max blob gas allowable per block }, } From 5abc99138832e918357d439c14eb32aa788ab3de Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 13 Jan 2025 17:26:04 +0100 Subject: [PATCH 31/33] tx: tx tests support prague --- packages/tx/test/transactionRunner.spec.ts | 2 ++ packages/tx/test/types.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/tx/test/transactionRunner.spec.ts b/packages/tx/test/transactionRunner.spec.ts index 7941133744..0bfb19b221 100644 --- a/packages/tx/test/transactionRunner.spec.ts +++ b/packages/tx/test/transactionRunner.spec.ts @@ -14,6 +14,7 @@ const argv = minimist(process.argv.slice(2)) const file: string | undefined = argv.file const forkNames: ForkName[] = [ + 'Prague', 'London+3860', 'London', 'Berlin', @@ -28,6 +29,7 @@ const forkNames: ForkName[] = [ ] const forkNameMap: ForkNamesMap = { + Prague: 'prague', 'London+3860': 'london', London: 'london', Berlin: 'berlin', diff --git a/packages/tx/test/types.ts b/packages/tx/test/types.ts index f99dfc815a..1b53f6ec64 100644 --- a/packages/tx/test/types.ts +++ b/packages/tx/test/types.ts @@ -1,4 +1,5 @@ export type ForkName = + | 'Prague' | 'London+3860' | 'London' | 'Berlin' From 8535e2c06f3d4d4de0b04f48f5e5cf93fbba0182 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 13 Jan 2025 17:35:03 +0100 Subject: [PATCH 32/33] tx: add missing forks --- packages/tx/test/transactionRunner.spec.ts | 6 ++++++ packages/tx/test/types.ts | 3 +++ packages/vm/src/runTx.ts | 8 +++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/tx/test/transactionRunner.spec.ts b/packages/tx/test/transactionRunner.spec.ts index 0bfb19b221..4be2980adf 100644 --- a/packages/tx/test/transactionRunner.spec.ts +++ b/packages/tx/test/transactionRunner.spec.ts @@ -15,6 +15,9 @@ const file: string | undefined = argv.file const forkNames: ForkName[] = [ 'Prague', + 'Cancun', + 'Shanghai', + 'Paris', 'London+3860', 'London', 'Berlin', @@ -31,6 +34,9 @@ const forkNames: ForkName[] = [ const forkNameMap: ForkNamesMap = { Prague: 'prague', 'London+3860': 'london', + Cancun: 'cancun', + Shanghai: 'shanghai', + Paris: 'paris', London: 'london', Berlin: 'berlin', Istanbul: 'istanbul', diff --git a/packages/tx/test/types.ts b/packages/tx/test/types.ts index 1b53f6ec64..37fc111f1f 100644 --- a/packages/tx/test/types.ts +++ b/packages/tx/test/types.ts @@ -1,5 +1,8 @@ export type ForkName = | 'Prague' + | 'Cancun' + | 'Shanghai' + | 'Paris' | 'London+3860' | 'London' | 'Berlin' diff --git a/packages/vm/src/runTx.ts b/packages/vm/src/runTx.ts index 7f252d85a2..00e3b9cac2 100644 --- a/packages/vm/src/runTx.ts +++ b/packages/vm/src/runTx.ts @@ -652,11 +652,13 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { if (vm.common.isActivatedEIP(7623)) { if (results.totalGasSpent < floorCost) { - // TODO: likely set `results.gasRefund = BIGINT_0` - results.totalGasSpent = floorCost if (vm.DEBUG) { - debugGas(`tx apply floorCost ${floorCost} to totalGasSpent (-> ${results.totalGasSpent})`) + debugGas( + `tx floorCost ${floorCost} is higher than to total execution gas spent (-> ${results.totalGasSpent}), setting floor as gas paid`, + ) } + results.gasRefund = BIGINT_0 + results.totalGasSpent = floorCost } } From 17038a3f4a72aae507941ed167b86bae6ff6f771 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Mon, 13 Jan 2025 18:18:28 +0100 Subject: [PATCH 33/33] client: switch cl request types --- packages/client/src/rpc/modules/engine/util/newPayload.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/rpc/modules/engine/util/newPayload.ts b/packages/client/src/rpc/modules/engine/util/newPayload.ts index c2c42e6f7a..b387274027 100644 --- a/packages/client/src/rpc/modules/engine/util/newPayload.ts +++ b/packages/client/src/rpc/modules/engine/util/newPayload.ts @@ -65,19 +65,19 @@ export const validateAndGen7685RequestsHash = ( throw new Error('Got a request without a request-identifier') } switch (bytes[0]) { - case 0: + case CLRequestType.Deposit: if (!common.isActivatedEIP(6110)) { throw new Error(`Deposit requests are not active`) } requests.push(new CLRequest(CLRequestType.Deposit, bytes.slice(1))) break - case 1: + case CLRequestType.Withdrawal: if (!common.isActivatedEIP(7002)) { throw new Error(`Withdrawal requests are not active`) } requests.push(new CLRequest(CLRequestType.Withdrawal, bytes.slice(1))) break - case 2: + case CLRequestType.Consolidation: if (!common.isActivatedEIP(7251)) { throw new Error(`Consolidation requests are not active`) }