Skip to content

Commit

Permalink
Keep deprecated precompiles in cancun (as deprecated) (#663)
Browse files Browse the repository at this point in the history
* keep deprecatedContract behavior for previously deployed contracts

* avoid modifying globals

* set timestamps in chain config
  • Loading branch information
darioush authored Sep 30, 2024
1 parent 7a5204d commit 39516a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions core/state_transition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestNativeAssetContractCall(t *testing.T) {
makeTx(1, contractAddr, common.Big0, 100_000, big.NewInt(params.LaunchMinGasPrice), nil), // No input data is necessary, since this will hit the contract's fallback function.
}

phase6Tests := map[string]stateTransitionTest{
tests := map[string]stateTransitionTest{
"phase5": {
config: params.TestApricotPhase5Config,
txs: txs,
Expand All @@ -167,9 +167,21 @@ func TestNativeAssetContractCall(t *testing.T) {
gasUsed: []uint64{132091, 21618},
want: "",
},
"durango": {
config: params.TestDurangoChainConfig,
txs: txs,
gasUsed: []uint64{132117, 21618},
want: "",
},
"etna": {
config: params.TestEtnaChainConfig,
txs: txs,
gasUsed: []uint64{132117, 21618},
want: "",
},
}

for name, stTest := range phase6Tests {
for name, stTest := range tests {
t.Run(name, func(t *testing.T) {
executeStateTransitionTest(t, stTest)
})
Expand Down
3 changes: 3 additions & 0 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ var PrecompiledContractsCancun = map[common.Address]contract.StatefulPrecompiled
common.BytesToAddress([]byte{8}): newWrappedPrecompiledContract(&bn256PairingIstanbul{}),
common.BytesToAddress([]byte{9}): newWrappedPrecompiledContract(&blake2F{}),
common.BytesToAddress([]byte{0x0a}): newWrappedPrecompiledContract(&kzgPointEvaluation{}),
genesisContractAddr: &deprecatedContract{},
NativeAssetBalanceAddr: &deprecatedContract{},
NativeAssetCallAddr: &deprecatedContract{},
}

// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
Expand Down
3 changes: 3 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ var (
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ShanghaiTime: utils.NewUint64(0),
NetworkUpgrades: NetworkUpgrades{
ApricotPhase1BlockTimestamp: utils.NewUint64(0),
ApricotPhase2BlockTimestamp: utils.NewUint64(0),
Expand Down Expand Up @@ -478,6 +479,8 @@ var (
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ShanghaiTime: utils.NewUint64(0),
CancunTime: utils.NewUint64(0),
NetworkUpgrades: NetworkUpgrades{
ApricotPhase1BlockTimestamp: utils.NewUint64(0),
ApricotPhase2BlockTimestamp: utils.NewUint64(0),
Expand Down

0 comments on commit 39516a3

Please sign in to comment.