Skip to content

Commit

Permalink
Update EIP-2537 and EIP-4844 precompile addresses (#7940)
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis committed Jul 28, 2023
1 parent cc74e74 commit 27125b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,31 @@ var PrecompiledContractsBerlin = map[libcommon.Address]PrecompiledContract{
libcommon.BytesToAddress([]byte{9}): &blake2F{},
}

var PrecompiledContractsCancun = map[libcommon.Address]PrecompiledContract{
libcommon.BytesToAddress([]byte{0x01}): &ecrecover{},
libcommon.BytesToAddress([]byte{0x02}): &sha256hash{},
libcommon.BytesToAddress([]byte{0x03}): &ripemd160hash{},
libcommon.BytesToAddress([]byte{0x04}): &dataCopy{},
libcommon.BytesToAddress([]byte{0x05}): &bigModExp{eip2565: true},
libcommon.BytesToAddress([]byte{0x06}): &bn256AddIstanbul{},
libcommon.BytesToAddress([]byte{0x07}): &bn256ScalarMulIstanbul{},
libcommon.BytesToAddress([]byte{0x08}): &bn256PairingIstanbul{},
libcommon.BytesToAddress([]byte{0x09}): &blake2F{},
libcommon.BytesToAddress([]byte{0x0a}): &pointEvaluation{},
}

// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
// contracts specified in EIP-2537. These are exported for testing purposes.
var PrecompiledContractsBLS = map[libcommon.Address]PrecompiledContract{
libcommon.BytesToAddress([]byte{10}): &bls12381G1Add{},
libcommon.BytesToAddress([]byte{11}): &bls12381G1Mul{},
libcommon.BytesToAddress([]byte{12}): &bls12381G1MultiExp{},
libcommon.BytesToAddress([]byte{13}): &bls12381G2Add{},
libcommon.BytesToAddress([]byte{14}): &bls12381G2Mul{},
libcommon.BytesToAddress([]byte{15}): &bls12381G2MultiExp{},
libcommon.BytesToAddress([]byte{16}): &bls12381Pairing{},
libcommon.BytesToAddress([]byte{17}): &bls12381MapG1{},
libcommon.BytesToAddress([]byte{18}): &bls12381MapG2{},
}

var PrecompiledContractsCancun = map[libcommon.Address]PrecompiledContract{
libcommon.BytesToAddress([]byte{1}): &ecrecover{},
libcommon.BytesToAddress([]byte{2}): &sha256hash{},
libcommon.BytesToAddress([]byte{3}): &ripemd160hash{},
libcommon.BytesToAddress([]byte{4}): &dataCopy{},
libcommon.BytesToAddress([]byte{5}): &bigModExp{eip2565: true},
libcommon.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
libcommon.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
libcommon.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
libcommon.BytesToAddress([]byte{9}): &blake2F{},
libcommon.BytesToAddress([]byte{20}): &pointEvaluation{},
libcommon.BytesToAddress([]byte{0x0c}): &bls12381G1Add{},
libcommon.BytesToAddress([]byte{0x0d}): &bls12381G1Mul{},
libcommon.BytesToAddress([]byte{0x0e}): &bls12381G1MultiExp{},
libcommon.BytesToAddress([]byte{0x0f}): &bls12381G2Add{},
libcommon.BytesToAddress([]byte{0x10}): &bls12381G2Mul{},
libcommon.BytesToAddress([]byte{0x11}): &bls12381G2MultiExp{},
libcommon.BytesToAddress([]byte{0x12}): &bls12381Pairing{},
libcommon.BytesToAddress([]byte{0x13}): &bls12381MapG1{},
libcommon.BytesToAddress([]byte{0x14}): &bls12381MapG2{},
}

var (
Expand Down
2 changes: 1 addition & 1 deletion core/vm/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestExecute(t *testing.T) {
func TestCall(t *testing.T) {
_, tx := memdb.NewTestTx(t)
state := state.New(state.NewDbStateReader(tx))
address := libcommon.HexToAddress("0x0a")
address := libcommon.HexToAddress("0xaa")
state.SetCode(address, []byte{
byte(vm.PUSH1), 10,
byte(vm.PUSH1), 0,
Expand Down

0 comments on commit 27125b3

Please sign in to comment.