From 3caf617dcdee9fc1d2e9070bfdba370b20231884 Mon Sep 17 00:00:00 2001 From: cui <523516579@qq.com> Date: Tue, 9 Apr 2024 14:33:36 +0800 Subject: [PATCH] core/vm: move bls precompiles to correct addresses (#29445) core: make bls precompiled contract use the correct address as in eip --- core/vm/contracts.go | 18 +++++++++--------- tests/fuzzers/bls12381/precompile_fuzzer.go | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 2991437608..bef8575bb5 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -111,15 +111,15 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{ // PrecompiledContractsBLS contains the set of pre-compiled Ethereum // contracts specified in EIP-2537. These are exported for testing purposes. var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{ - common.BytesToAddress([]byte{10}): &bls12381G1Add{}, - common.BytesToAddress([]byte{11}): &bls12381G1Mul{}, - common.BytesToAddress([]byte{12}): &bls12381G1MultiExp{}, - common.BytesToAddress([]byte{13}): &bls12381G2Add{}, - common.BytesToAddress([]byte{14}): &bls12381G2Mul{}, - common.BytesToAddress([]byte{15}): &bls12381G2MultiExp{}, - common.BytesToAddress([]byte{16}): &bls12381Pairing{}, - common.BytesToAddress([]byte{17}): &bls12381MapG1{}, - common.BytesToAddress([]byte{18}): &bls12381MapG2{}, + common.BytesToAddress([]byte{11}): &bls12381G1Add{}, + common.BytesToAddress([]byte{12}): &bls12381G1Mul{}, + common.BytesToAddress([]byte{13}): &bls12381G1MultiExp{}, + common.BytesToAddress([]byte{14}): &bls12381G2Add{}, + common.BytesToAddress([]byte{15}): &bls12381G2Mul{}, + common.BytesToAddress([]byte{16}): &bls12381G2MultiExp{}, + common.BytesToAddress([]byte{17}): &bls12381Pairing{}, + common.BytesToAddress([]byte{18}): &bls12381MapG1{}, + common.BytesToAddress([]byte{19}): &bls12381MapG2{}, } var ( diff --git a/tests/fuzzers/bls12381/precompile_fuzzer.go b/tests/fuzzers/bls12381/precompile_fuzzer.go index 763ed56e9f..4df4db73d1 100644 --- a/tests/fuzzers/bls12381/precompile_fuzzer.go +++ b/tests/fuzzers/bls12381/precompile_fuzzer.go @@ -25,15 +25,15 @@ import ( ) const ( - blsG1Add = byte(10) - blsG1Mul = byte(11) - blsG1MultiExp = byte(12) - blsG2Add = byte(13) - blsG2Mul = byte(14) - blsG2MultiExp = byte(15) - blsPairing = byte(16) - blsMapG1 = byte(17) - blsMapG2 = byte(18) + blsG1Add = byte(11) + blsG1Mul = byte(12) + blsG1MultiExp = byte(13) + blsG2Add = byte(14) + blsG2Mul = byte(15) + blsG2MultiExp = byte(16) + blsPairing = byte(17) + blsMapG1 = byte(18) + blsMapG2 = byte(19) ) func checkInput(id byte, inputLen int) bool {