Skip to content

Commit

Permalink
core/vm: fix PrecompiledContractsCancun
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 committed Mar 20, 2024
1 parent 10ae179 commit 574981c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
10 changes: 5 additions & 5 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{100}): &tmHeaderValidate{},
common.BytesToAddress([]byte{101}): &iavlMerkleProofValidatePlato{},
common.BytesToAddress([]byte{102}): &blsSignatureVerify{},
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidate{},
common.BytesToAddress([]byte{103}): &cometBFTLightBlockValidateHertz{},
common.BytesToAddress([]byte{104}): &verifyDoubleSignEvidence{},
common.BytesToAddress([]byte{105}): &secp256k1SignatureRecover{},
}
Expand Down Expand Up @@ -263,6 +263,7 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{

var (
PrecompiledAddressesCancun []common.Address
PrecompiledAddressesFeynman []common.Address
PrecompiledAddressesHertz []common.Address
PrecompiledAddressesPlato []common.Address
PrecompiledAddressesLuban []common.Address
Expand All @@ -273,7 +274,6 @@ var (
PrecompiledAddressesIstanbul []common.Address
PrecompiledAddressesByzantium []common.Address
PrecompiledAddressesHomestead []common.Address
PrecompiledAddressesFeynman []common.Address
)

func init() {
Expand Down Expand Up @@ -307,12 +307,12 @@ func init() {
for k := range PrecompiledContractsHertz {
PrecompiledAddressesHertz = append(PrecompiledAddressesHertz, k)
}
for k := range PrecompiledContractsCancun {
PrecompiledAddressesCancun = append(PrecompiledAddressesCancun, k)
}
for k := range PrecompiledContractsFeynman {
PrecompiledAddressesFeynman = append(PrecompiledAddressesFeynman, k)
}
for k := range PrecompiledContractsCancun {
PrecompiledAddressesCancun = append(PrecompiledAddressesCancun, k)
}
}

// ActivePrecompiles returns the precompiles enabled with the current configuration.
Expand Down
20 changes: 17 additions & 3 deletions tests/0001-diff-go-ethereum.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/core/vm/contracts.go b/core/vm/contracts.go
index 36d33e41c..adb10883e 100644
index 3c43848e5..533663ebc 100644
--- a/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{8}): &bn256PairingIstanbul{},
common.BytesToAddress([]byte{9}): &blake2F{},
Expand All @@ -12,6 +12,20 @@ index 36d33e41c..adb10883e 100644
}

var PrecompiledContractsNano = map[common.Address]PrecompiledContract{
@@ -217,13 +214,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{},
}

// PrecompiledContractsFeynman contains the default set of pre-compiled Ethereum
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
index 70c543f14..65716f944 100644
--- a/core/vm/jump_table.go
Expand All @@ -26,7 +40,7 @@ index 70c543f14..65716f944 100644
enable3860(&instructionSet) // Limit and meter initcode

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
+++ b/params/protocol_params.go
@@ -23,7 +23,7 @@ import (
Expand Down
4 changes: 0 additions & 4 deletions tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte
if r, _ := tm.findSkip(name); r != "" {
t.Skip(r)
}
// TODO(Nathan): fix before enable Cancun
if strings.Contains(key, "Cancun") {
return
}
runTestFunc(runTest, t, name, m, key)
})
}
Expand Down

0 comments on commit 574981c

Please sign in to comment.