core/vm: fix PrecompiledContractsCancun (#2310)
This commit is contained in:
parent
10ae179a73
commit
ccd7a44be0
@ -133,20 +133,6 @@ var PrecompiledContractsPlanck = map[common.Address]PrecompiledContract{
|
|||||||
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlanck{},
|
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlanck{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
|
|
||||||
// contracts used in the Berlin release.
|
|
||||||
var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{
|
|
||||||
common.BytesToAddress([]byte{1}): &ecrecover{},
|
|
||||||
common.BytesToAddress([]byte{2}): &sha256hash{},
|
|
||||||
common.BytesToAddress([]byte{3}): &ripemd160hash{},
|
|
||||||
common.BytesToAddress([]byte{4}): &dataCopy{},
|
|
||||||
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: true},
|
|
||||||
common.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
|
|
||||||
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
|
||||||
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
|
||||||
common.BytesToAddress([]byte{9}): &blake2F{},
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrecompiledContractsLuban contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsLuban contains the default set of pre-compiled Ethereum
|
||||||
// contracts used in the Luban release.
|
// contracts used in the Luban release.
|
||||||
var PrecompiledContractsLuban = map[common.Address]PrecompiledContract{
|
var PrecompiledContractsLuban = map[common.Address]PrecompiledContract{
|
||||||
@ -185,6 +171,20 @@ var PrecompiledContractsPlato = map[common.Address]PrecompiledContract{
|
|||||||
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidate{},
|
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidate{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
|
||||||
|
// contracts used in the Berlin release.
|
||||||
|
var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{
|
||||||
|
common.BytesToAddress([]byte{1}): &ecrecover{},
|
||||||
|
common.BytesToAddress([]byte{2}): &sha256hash{},
|
||||||
|
common.BytesToAddress([]byte{3}): &ripemd160hash{},
|
||||||
|
common.BytesToAddress([]byte{4}): &dataCopy{},
|
||||||
|
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: true},
|
||||||
|
common.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{9}): &blake2F{},
|
||||||
|
}
|
||||||
|
|
||||||
// PrecompiledContractsHertz contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsHertz contains the default set of pre-compiled Ethereum
|
||||||
// contracts used in the Hertz release.
|
// contracts used in the Hertz release.
|
||||||
var PrecompiledContractsHertz = map[common.Address]PrecompiledContract{
|
var PrecompiledContractsHertz = map[common.Address]PrecompiledContract{
|
||||||
@ -204,6 +204,27 @@ var PrecompiledContractsHertz = map[common.Address]PrecompiledContract{
|
|||||||
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidateHertz{},
|
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidateHertz{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrecompiledContractsFeynman contains the default set of pre-compiled Ethereum
|
||||||
|
// contracts used in the Feynman release.
|
||||||
|
var PrecompiledContractsFeynman = map[common.Address]PrecompiledContract{
|
||||||
|
common.BytesToAddress([]byte{1}): &ecrecover{},
|
||||||
|
common.BytesToAddress([]byte{2}): &sha256hash{},
|
||||||
|
common.BytesToAddress([]byte{3}): &ripemd160hash{},
|
||||||
|
common.BytesToAddress([]byte{4}): &dataCopy{},
|
||||||
|
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: true},
|
||||||
|
common.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{9}): &blake2F{},
|
||||||
|
|
||||||
|
common.BytesToAddress([]byte{100}): &tmHeaderValidate{},
|
||||||
|
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlato{},
|
||||||
|
common.BytesToAddress([]byte{102}): &blsSignatureVerify{},
|
||||||
|
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidateHertz{},
|
||||||
|
common.BytesToAddress([]byte{104}): &verifyDoubleSignEvidence{},
|
||||||
|
common.BytesToAddress([]byte{105}): &secp256k1SignatureRecover{},
|
||||||
|
}
|
||||||
|
|
||||||
// PrecompiledContractsCancun contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsCancun contains the default set of pre-compiled Ethereum
|
||||||
// contracts used in the Cancun release.
|
// contracts used in the Cancun release.
|
||||||
var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{
|
var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{
|
||||||
@ -218,27 +239,6 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{
|
|||||||
common.BytesToAddress([]byte{9}): &blake2F{},
|
common.BytesToAddress([]byte{9}): &blake2F{},
|
||||||
common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{},
|
common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{},
|
||||||
|
|
||||||
common.BytesToAddress([]byte{100}): &tmHeaderValidate{},
|
|
||||||
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlato{},
|
|
||||||
common.BytesToAddress([]byte{102}): &blsSignatureVerify{},
|
|
||||||
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidate{},
|
|
||||||
common.BytesToAddress([]byte{104}): &verifyDoubleSignEvidence{},
|
|
||||||
common.BytesToAddress([]byte{105}): &secp256k1SignatureRecover{},
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrecompiledContractsFeynman contains the default set of pre-compiled Ethereum
|
|
||||||
// contracts used in the Feynman release.
|
|
||||||
var PrecompiledContractsFeynman = map[common.Address]PrecompiledContract{
|
|
||||||
common.BytesToAddress([]byte{1}): &ecrecover{},
|
|
||||||
common.BytesToAddress([]byte{2}): &sha256hash{},
|
|
||||||
common.BytesToAddress([]byte{3}): &ripemd160hash{},
|
|
||||||
common.BytesToAddress([]byte{4}): &dataCopy{},
|
|
||||||
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: true},
|
|
||||||
common.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
|
|
||||||
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
|
||||||
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
|
||||||
common.BytesToAddress([]byte{9}): &blake2F{},
|
|
||||||
|
|
||||||
common.BytesToAddress([]byte{100}): &tmHeaderValidate{},
|
common.BytesToAddress([]byte{100}): &tmHeaderValidate{},
|
||||||
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlato{},
|
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlato{},
|
||||||
common.BytesToAddress([]byte{102}): &blsSignatureVerify{},
|
common.BytesToAddress([]byte{102}): &blsSignatureVerify{},
|
||||||
@ -263,17 +263,17 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
PrecompiledAddressesCancun []common.Address
|
PrecompiledAddressesCancun []common.Address
|
||||||
|
PrecompiledAddressesFeynman []common.Address
|
||||||
PrecompiledAddressesHertz []common.Address
|
PrecompiledAddressesHertz []common.Address
|
||||||
|
PrecompiledAddressesBerlin []common.Address
|
||||||
PrecompiledAddressesPlato []common.Address
|
PrecompiledAddressesPlato []common.Address
|
||||||
PrecompiledAddressesLuban []common.Address
|
PrecompiledAddressesLuban []common.Address
|
||||||
PrecompiledAddressesPlanck []common.Address
|
PrecompiledAddressesPlanck []common.Address
|
||||||
PrecompiledAddressesMoran []common.Address
|
PrecompiledAddressesMoran []common.Address
|
||||||
PrecompiledAddressesNano []common.Address
|
PrecompiledAddressesNano []common.Address
|
||||||
PrecompiledAddressesBerlin []common.Address
|
|
||||||
PrecompiledAddressesIstanbul []common.Address
|
PrecompiledAddressesIstanbul []common.Address
|
||||||
PrecompiledAddressesByzantium []common.Address
|
PrecompiledAddressesByzantium []common.Address
|
||||||
PrecompiledAddressesHomestead []common.Address
|
PrecompiledAddressesHomestead []common.Address
|
||||||
PrecompiledAddressesFeynman []common.Address
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -286,9 +286,6 @@ func init() {
|
|||||||
for k := range PrecompiledContractsIstanbul {
|
for k := range PrecompiledContractsIstanbul {
|
||||||
PrecompiledAddressesIstanbul = append(PrecompiledAddressesIstanbul, k)
|
PrecompiledAddressesIstanbul = append(PrecompiledAddressesIstanbul, k)
|
||||||
}
|
}
|
||||||
for k := range PrecompiledContractsBerlin {
|
|
||||||
PrecompiledAddressesBerlin = append(PrecompiledAddressesBerlin, k)
|
|
||||||
}
|
|
||||||
for k := range PrecompiledContractsNano {
|
for k := range PrecompiledContractsNano {
|
||||||
PrecompiledAddressesNano = append(PrecompiledAddressesNano, k)
|
PrecompiledAddressesNano = append(PrecompiledAddressesNano, k)
|
||||||
}
|
}
|
||||||
@ -304,15 +301,18 @@ func init() {
|
|||||||
for k := range PrecompiledContractsPlato {
|
for k := range PrecompiledContractsPlato {
|
||||||
PrecompiledAddressesPlato = append(PrecompiledAddressesPlato, k)
|
PrecompiledAddressesPlato = append(PrecompiledAddressesPlato, k)
|
||||||
}
|
}
|
||||||
|
for k := range PrecompiledContractsBerlin {
|
||||||
|
PrecompiledAddressesBerlin = append(PrecompiledAddressesBerlin, k)
|
||||||
|
}
|
||||||
for k := range PrecompiledContractsHertz {
|
for k := range PrecompiledContractsHertz {
|
||||||
PrecompiledAddressesHertz = append(PrecompiledAddressesHertz, k)
|
PrecompiledAddressesHertz = append(PrecompiledAddressesHertz, k)
|
||||||
}
|
}
|
||||||
for k := range PrecompiledContractsCancun {
|
|
||||||
PrecompiledAddressesCancun = append(PrecompiledAddressesCancun, k)
|
|
||||||
}
|
|
||||||
for k := range PrecompiledContractsFeynman {
|
for k := range PrecompiledContractsFeynman {
|
||||||
PrecompiledAddressesFeynman = append(PrecompiledAddressesFeynman, k)
|
PrecompiledAddressesFeynman = append(PrecompiledAddressesFeynman, k)
|
||||||
}
|
}
|
||||||
|
for k := range PrecompiledContractsCancun {
|
||||||
|
PrecompiledAddressesCancun = append(PrecompiledAddressesCancun, k)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActivePrecompiles returns the precompiles enabled with the current configuration.
|
// ActivePrecompiles returns the precompiles enabled with the current configuration.
|
||||||
@ -324,6 +324,8 @@ func ActivePrecompiles(rules params.Rules) []common.Address {
|
|||||||
return PrecompiledAddressesFeynman
|
return PrecompiledAddressesFeynman
|
||||||
case rules.IsHertz:
|
case rules.IsHertz:
|
||||||
return PrecompiledAddressesHertz
|
return PrecompiledAddressesHertz
|
||||||
|
case rules.IsBerlin:
|
||||||
|
return PrecompiledAddressesBerlin
|
||||||
case rules.IsPlato:
|
case rules.IsPlato:
|
||||||
return PrecompiledAddressesPlato
|
return PrecompiledAddressesPlato
|
||||||
case rules.IsLuban:
|
case rules.IsLuban:
|
||||||
@ -334,8 +336,6 @@ func ActivePrecompiles(rules params.Rules) []common.Address {
|
|||||||
return PrecompiledAddressesMoran
|
return PrecompiledAddressesMoran
|
||||||
case rules.IsNano:
|
case rules.IsNano:
|
||||||
return PrecompiledAddressesNano
|
return PrecompiledAddressesNano
|
||||||
case rules.IsBerlin:
|
|
||||||
return PrecompiledAddressesBerlin
|
|
||||||
case rules.IsIstanbul:
|
case rules.IsIstanbul:
|
||||||
return PrecompiledAddressesIstanbul
|
return PrecompiledAddressesIstanbul
|
||||||
case rules.IsByzantium:
|
case rules.IsByzantium:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
diff --git a/core/vm/contracts.go b/core/vm/contracts.go
|
diff --git a/core/vm/contracts.go b/core/vm/contracts.go
|
||||||
index 36d33e41c..adb10883e 100644
|
index 5988bb15f..c92cbf542 100644
|
||||||
--- a/core/vm/contracts.go
|
--- a/core/vm/contracts.go
|
||||||
+++ b/core/vm/contracts.go
|
+++ b/core/vm/contracts.go
|
||||||
@@ -78,9 +78,6 @@ var PrecompiledContractsIstanbul = map[common.Address]PrecompiledContract{
|
@@ -83,9 +83,6 @@ var PrecompiledContractsIstanbul = map[common.Address]PrecompiledContract{
|
||||||
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
|
||||||
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
||||||
common.BytesToAddress([]byte{9}): &blake2F{},
|
common.BytesToAddress([]byte{9}): &blake2F{},
|
||||||
@ -12,6 +12,20 @@ index 36d33e41c..adb10883e 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
var PrecompiledContractsNano = map[common.Address]PrecompiledContract{
|
var PrecompiledContractsNano = map[common.Address]PrecompiledContract{
|
||||||
|
@@ -238,13 +235,6 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{
|
||||||
|
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
|
||||||
|
common.BytesToAddress([]byte{9}): &blake2F{},
|
||||||
|
common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{},
|
||||||
|
-
|
||||||
|
- common.BytesToAddress([]byte{100}): &tmHeaderValidate{},
|
||||||
|
- common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlato{},
|
||||||
|
- common.BytesToAddress([]byte{102}): &blsSignatureVerify{},
|
||||||
|
- common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidateHertz{},
|
||||||
|
- common.BytesToAddress([]byte{104}): &verifyDoubleSignEvidence{},
|
||||||
|
- common.BytesToAddress([]byte{105}): &secp256k1SignatureRecover{},
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
|
||||||
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
|
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
|
||||||
index 70c543f14..65716f944 100644
|
index 70c543f14..65716f944 100644
|
||||||
--- a/core/vm/jump_table.go
|
--- a/core/vm/jump_table.go
|
||||||
@ -26,7 +40,7 @@ index 70c543f14..65716f944 100644
|
|||||||
enable3860(&instructionSet) // Limit and meter initcode
|
enable3860(&instructionSet) // Limit and meter initcode
|
||||||
|
|
||||||
diff --git a/params/protocol_params.go b/params/protocol_params.go
|
diff --git a/params/protocol_params.go b/params/protocol_params.go
|
||||||
index b32b4d943..8b544af08 100644
|
index b84fa148f..97bf6c4d2 100644
|
||||||
--- a/params/protocol_params.go
|
--- a/params/protocol_params.go
|
||||||
+++ b/params/protocol_params.go
|
+++ b/params/protocol_params.go
|
||||||
@@ -23,7 +23,7 @@ import (
|
@@ -23,7 +23,7 @@ import (
|
||||||
|
@ -252,10 +252,6 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte
|
|||||||
if r, _ := tm.findSkip(name); r != "" {
|
if r, _ := tm.findSkip(name); r != "" {
|
||||||
t.Skip(r)
|
t.Skip(r)
|
||||||
}
|
}
|
||||||
// TODO(Nathan): fix before enable Cancun
|
|
||||||
if strings.Contains(key, "Cancun") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
runTestFunc(runTest, t, name, m, key)
|
runTestFunc(runTest, t, name, m, key)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user