mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
add scaffolding for Osaka precompiles. Make it more explicit when 7883 is/isn't enabled in tests.
This commit is contained in:
parent
886186ac8b
commit
b857df1cb9
2 changed files with 31 additions and 7 deletions
|
|
@ -66,7 +66,7 @@ var PrecompiledContractsByzantium = PrecompiledContracts{
|
|||
common.BytesToAddress([]byte{0x2}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{0x3}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{0x4}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: false},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: false, eip7883: false},
|
||||
common.BytesToAddress([]byte{0x6}): &bn256AddByzantium{},
|
||||
common.BytesToAddress([]byte{0x7}): &bn256ScalarMulByzantium{},
|
||||
common.BytesToAddress([]byte{0x8}): &bn256PairingByzantium{},
|
||||
|
|
@ -79,7 +79,7 @@ var PrecompiledContractsIstanbul = PrecompiledContracts{
|
|||
common.BytesToAddress([]byte{0x2}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{0x3}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{0x4}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: false},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: false, eip7883: false},
|
||||
common.BytesToAddress([]byte{0x6}): &bn256AddIstanbul{},
|
||||
common.BytesToAddress([]byte{0x7}): &bn256ScalarMulIstanbul{},
|
||||
common.BytesToAddress([]byte{0x8}): &bn256PairingIstanbul{},
|
||||
|
|
@ -93,7 +93,7 @@ var PrecompiledContractsBerlin = PrecompiledContracts{
|
|||
common.BytesToAddress([]byte{0x2}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{0x3}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{0x4}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: true},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: true, eip7883: false},
|
||||
common.BytesToAddress([]byte{0x6}): &bn256AddIstanbul{},
|
||||
common.BytesToAddress([]byte{0x7}): &bn256ScalarMulIstanbul{},
|
||||
common.BytesToAddress([]byte{0x8}): &bn256PairingIstanbul{},
|
||||
|
|
@ -107,7 +107,7 @@ var PrecompiledContractsCancun = PrecompiledContracts{
|
|||
common.BytesToAddress([]byte{0x2}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{0x3}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{0x4}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: true},
|
||||
common.BytesToAddress([]byte{0x5}): &bigModExp{eip2565: true, eip7883: false},
|
||||
common.BytesToAddress([]byte{0x6}): &bn256AddIstanbul{},
|
||||
common.BytesToAddress([]byte{0x7}): &bn256ScalarMulIstanbul{},
|
||||
common.BytesToAddress([]byte{0x8}): &bn256PairingIstanbul{},
|
||||
|
|
@ -122,7 +122,7 @@ var PrecompiledContractsPrague = PrecompiledContracts{
|
|||
common.BytesToAddress([]byte{0x02}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{0x03}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{0x04}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{0x05}): &bigModExp{eip2565: true},
|
||||
common.BytesToAddress([]byte{0x05}): &bigModExp{eip2565: true, eip7883: false},
|
||||
common.BytesToAddress([]byte{0x06}): &bn256AddIstanbul{},
|
||||
common.BytesToAddress([]byte{0x07}): &bn256ScalarMulIstanbul{},
|
||||
common.BytesToAddress([]byte{0x08}): &bn256PairingIstanbul{},
|
||||
|
|
@ -141,6 +141,28 @@ var PrecompiledContractsBLS = PrecompiledContractsPrague
|
|||
|
||||
var PrecompiledContractsVerkle = PrecompiledContractsBerlin
|
||||
|
||||
// PrecompiledContractsOsaka contains the set of pre-compiled Ethereum
|
||||
// contracts used in the Osaka release.
|
||||
var PrecompiledContractsOsaka = PrecompiledContracts{
|
||||
common.BytesToAddress([]byte{0x01}): &ecrecover{},
|
||||
common.BytesToAddress([]byte{0x02}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{0x03}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{0x04}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{0x05}): &bigModExp{eip2565: true, eip7883: true},
|
||||
common.BytesToAddress([]byte{0x06}): &bn256AddIstanbul{},
|
||||
common.BytesToAddress([]byte{0x07}): &bn256ScalarMulIstanbul{},
|
||||
common.BytesToAddress([]byte{0x08}): &bn256PairingIstanbul{},
|
||||
common.BytesToAddress([]byte{0x09}): &blake2F{},
|
||||
common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{},
|
||||
common.BytesToAddress([]byte{0x0b}): &bls12381G1Add{},
|
||||
common.BytesToAddress([]byte{0x0c}): &bls12381G1MultiExp{},
|
||||
common.BytesToAddress([]byte{0x0d}): &bls12381G2Add{},
|
||||
common.BytesToAddress([]byte{0x0e}): &bls12381G2MultiExp{},
|
||||
common.BytesToAddress([]byte{0x0f}): &bls12381Pairing{},
|
||||
common.BytesToAddress([]byte{0x10}): &bls12381MapG1{},
|
||||
common.BytesToAddress([]byte{0x11}): &bls12381MapG2{},
|
||||
}
|
||||
|
||||
var (
|
||||
PrecompiledAddressesPrague []common.Address
|
||||
PrecompiledAddressesCancun []common.Address
|
||||
|
|
@ -175,6 +197,8 @@ func activePrecompiledContracts(rules params.Rules) PrecompiledContracts {
|
|||
switch {
|
||||
case rules.IsVerkle:
|
||||
return PrecompiledContractsVerkle
|
||||
case rules.IsOsaka:
|
||||
return PrecompiledContractsOsaka
|
||||
case rules.IsPrague:
|
||||
return PrecompiledContractsPrague
|
||||
case rules.IsCancun:
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ var allPrecompiles = map[common.Address]PrecompiledContract{
|
|||
common.BytesToAddress([]byte{2}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{3}): &ripemd160hash{},
|
||||
common.BytesToAddress([]byte{4}): &dataCopy{},
|
||||
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: false},
|
||||
common.BytesToAddress([]byte{0xf5}): &bigModExp{eip2565: true},
|
||||
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: false, eip7883: false},
|
||||
common.BytesToAddress([]byte{0xf5}): &bigModExp{eip2565: true, eip7883: false},
|
||||
common.BytesToAddress([]byte{0xf6}): &bigModExp{eip2565: true, eip7883: true},
|
||||
common.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
|
||||
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
||||
|
|
|
|||
Loading…
Reference in a new issue