Skip to content

Commit 39516a3

Browse files
author
Darioush Jalali
authored
Keep deprecated precompiles in cancun (as deprecated) (#663)
* keep deprecatedContract behavior for previously deployed contracts * avoid modifying globals * set timestamps in chain config
1 parent 7a5204d commit 39516a3

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

core/state_transition_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func TestNativeAssetContractCall(t *testing.T) {
142142
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.
143143
}
144144

145-
phase6Tests := map[string]stateTransitionTest{
145+
tests := map[string]stateTransitionTest{
146146
"phase5": {
147147
config: params.TestApricotPhase5Config,
148148
txs: txs,
@@ -167,9 +167,21 @@ func TestNativeAssetContractCall(t *testing.T) {
167167
gasUsed: []uint64{132091, 21618},
168168
want: "",
169169
},
170+
"durango": {
171+
config: params.TestDurangoChainConfig,
172+
txs: txs,
173+
gasUsed: []uint64{132117, 21618},
174+
want: "",
175+
},
176+
"etna": {
177+
config: params.TestEtnaChainConfig,
178+
txs: txs,
179+
gasUsed: []uint64{132117, 21618},
180+
want: "",
181+
},
170182
}
171183

172-
for name, stTest := range phase6Tests {
184+
for name, stTest := range tests {
173185
t.Run(name, func(t *testing.T) {
174186
executeStateTransitionTest(t, stTest)
175187
})

core/vm/contracts.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ var PrecompiledContractsCancun = map[common.Address]contract.StatefulPrecompiled
172172
common.BytesToAddress([]byte{8}): newWrappedPrecompiledContract(&bn256PairingIstanbul{}),
173173
common.BytesToAddress([]byte{9}): newWrappedPrecompiledContract(&blake2F{}),
174174
common.BytesToAddress([]byte{0x0a}): newWrappedPrecompiledContract(&kzgPointEvaluation{}),
175+
genesisContractAddr: &deprecatedContract{},
176+
NativeAssetBalanceAddr: &deprecatedContract{},
177+
NativeAssetCallAddr: &deprecatedContract{},
175178
}
176179

177180
// PrecompiledContractsBLS contains the set of pre-compiled Ethereum

params/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ var (
446446
MuirGlacierBlock: big.NewInt(0),
447447
BerlinBlock: big.NewInt(0),
448448
LondonBlock: big.NewInt(0),
449+
ShanghaiTime: utils.NewUint64(0),
449450
NetworkUpgrades: NetworkUpgrades{
450451
ApricotPhase1BlockTimestamp: utils.NewUint64(0),
451452
ApricotPhase2BlockTimestamp: utils.NewUint64(0),
@@ -478,6 +479,8 @@ var (
478479
MuirGlacierBlock: big.NewInt(0),
479480
BerlinBlock: big.NewInt(0),
480481
LondonBlock: big.NewInt(0),
482+
ShanghaiTime: utils.NewUint64(0),
483+
CancunTime: utils.NewUint64(0),
481484
NetworkUpgrades: NetworkUpgrades{
482485
ApricotPhase1BlockTimestamp: utils.NewUint64(0),
483486
ApricotPhase2BlockTimestamp: utils.NewUint64(0),

0 commit comments

Comments
 (0)