Skip to content

Commit ee33f56

Browse files
evm: unpeg BLS costs to EIP2537
1 parent 293f4cc commit ee33f56

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

packages/evm/src/precompiles/0c-bls12-g1msm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function precompile0c(opts: PrecompileInput): Promise<ExecResult> {
3838
// on this eventually to be "floored" pair number should happen before the input length modulo
3939
// validation (same for g2msm)
4040
const numPairs = Math.floor(inputData.length / 160)
41-
const gasUsedPerPair = opts.common.paramByEIP('bls12381G1MulGas', 2537) ?? BigInt(0)
41+
const gasUsedPerPair = opts.common.param('bls12381G1MulGas') ?? BigInt(0)
4242
const gasUsed = msmGasUsed(numPairs, gasUsedPerPair, BLS_GAS_DISCOUNT_PAIRS_G1)
4343

4444
if (!gasLimitCheck(opts, gasUsed, pName)) {

packages/evm/src/precompiles/0d-bls12-g2add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function precompile0d(opts: PrecompileInput): Promise<ExecResult> {
1616
const bls = (<any>opts._EVM)._bls! as EVMBLSInterface
1717

1818
// note: the gas used is constant; even if the input is incorrect.
19-
const gasUsed = opts.common.paramByEIP('bls12381G2AddGas', 2537) ?? BigInt(0)
19+
const gasUsed = opts.common.param('bls12381G2AddGas') ?? BigInt(0)
2020
if (!gasLimitCheck(opts, gasUsed, pName)) {
2121
return OOGResult(opts.gasLimit)
2222
}

packages/evm/src/precompiles/0e-bls12-g2msm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function precompile0e(opts: PrecompileInput): Promise<ExecResult> {
3333
}
3434

3535
const numPairs = Math.floor(opts.data.length / 288)
36-
const gasUsedPerPair = opts.common.paramByEIP('bls12381G2MulGas', 2537) ?? BigInt(0)
36+
const gasUsedPerPair = opts.common.param('bls12381G2MulGas') ?? BigInt(0)
3737
const gasUsed = msmGasUsed(numPairs, gasUsedPerPair, BLS_GAS_DISCOUNT_PAIRS_G2)
3838

3939
if (!gasLimitCheck(opts, gasUsed, pName)) {

packages/evm/src/precompiles/0f-bls12-pairing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function precompile0f(opts: PrecompileInput): Promise<ExecResult> {
1515
const pName = getPrecompileName('11')
1616
const bls = (<any>opts._EVM)._bls! as EVMBLSInterface
1717

18-
const baseGas = opts.common.paramByEIP('bls12381PairingBaseGas', 2537) ?? BigInt(0)
18+
const baseGas = opts.common.param('bls12381PairingBaseGas') ?? BigInt(0)
1919

2020
// TODO: confirm that this is not a thing for the other precompiles
2121
if (opts.data.length === 0) {
@@ -31,7 +31,7 @@ export async function precompile0f(opts: PrecompileInput): Promise<ExecResult> {
3131
)
3232
}
3333

34-
const gasUsedPerPair = opts.common.paramByEIP('bls12381PairingPerPairGas', 2537) ?? BigInt(0)
34+
const gasUsedPerPair = opts.common.param('bls12381PairingPerPairGas') ?? BigInt(0)
3535

3636
// TODO: For this precompile it is the only exception that the length check is placed before the
3737
// gas check. I will keep it there to not side-change the existing implementation, but we should

packages/evm/src/precompiles/10-bls12-map-fp-to-g1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function precompile10(opts: PrecompileInput): Promise<ExecResult> {
1616
const bls = (<any>opts._EVM)._bls! as EVMBLSInterface
1717

1818
// note: the gas used is constant; even if the input is incorrect.
19-
const gasUsed = opts.common.paramByEIP('bls12381MapG1Gas', 2537) ?? BigInt(0)
19+
const gasUsed = opts.common.param('bls12381MapG1Gas') ?? BigInt(0)
2020
if (!gasLimitCheck(opts, gasUsed, pName)) {
2121
return OOGResult(opts.gasLimit)
2222
}

packages/evm/src/precompiles/11-bls12-map-fp2-to-g2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function precompile11(opts: PrecompileInput): Promise<ExecResult> {
1616
const bls = (<any>opts._EVM)._bls! as EVMBLSInterface
1717

1818
// note: the gas used is constant; even if the input is incorrect.
19-
const gasUsed = opts.common.paramByEIP('bls12381MapG2Gas', 2537) ?? BigInt(0)
19+
const gasUsed = opts.common.param('bls12381MapG2Gas') ?? BigInt(0)
2020
if (!gasLimitCheck(opts, gasUsed, pName)) {
2121
return OOGResult(opts.gasLimit)
2222
}

0 commit comments

Comments
 (0)