Repository: iotexproject/iotex-core
Pull request #4308 (2024-06-20 00:12:29)

[evm] defer Cancun enabling
# Description
as title

Fixes #(issue)

## Type of change
Please delete options that are not relevant.
- [] Bug fix (non-breaking change which fixes an issue)
- [] New feature (non-breaking change which adds functionality)
- [] Code refactor or improvement
- [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
- [] This change requires a documentation update

# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [x] make test
- [] fullsync
- [] Other test (please specify)

**Test Configuration**:
- Firmware version:
- Hardware:
- Toolchain:
- SDK:

# Checklist:
- [] My code follows the style guidelines of this project
- [] I have performed a self-review of my code
- [] I have commented my code, particularly in hard-to-understand areas
- [] I have made corresponding changes to the documentation
- [] My changes generate no new warnings
- [] I have added tests that prove my fix is effective or that my feature works
- [] New and existing unit tests pass locally with my changes
- [] Any dependent changes have been merged and published in downstream modules


sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=iotexproject_iotex-core&pullRequest=4308) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=iotexproject_iotex-core&pullRequest=4308&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=iotexproject_iotex-core&pullRequest=4308&resolutions=WONTFIX)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=iotexproject_iotex-core&pullRequest=4308&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=iotexproject_iotex-core&pullRequest=4308&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=iotexproject_iotex-core&pullRequest=4308&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=iotexproject_iotex-core&pullRequest=4308)



Patch:
diff --git a/action/protocol/execution/evm/evm.go b/action/protocol/execution/evm/evm.go
index 4fd7105fa..99e5ad711 100644
--- a/action/protocol/execution/evm/evm.go
+++ b/action/protocol/execution/evm/evm.go
@@ -441,12 +441,6 @@ func getChainConfig(g genesis.Blockchain, height uint64, id uint32, getBlockTime
 	}
 	sumatraTimestamp := (uint64)(sumatraTime.Unix())
 	chainConfig.ShanghaiTime = &sumatraTimestamp
-	upernavikTime, err := getBlockTime(g.UpernavikBlockHeight)
-	if err != nil {
-		return nil, err
-	}
-	upernavikTimestamp := (uint64)(upernavikTime.Unix())
-	chainConfig.CancunTime = &upernavikTimestamp
 	return &chainConfig, nil
 }
 


Test patch:
diff --git a/action/protocol/execution/evm/evm_test.go b/action/protocol/execution/evm/evm_test.go
index 8865bd244..3739a4cda 100644
--- a/action/protocol/execution/evm/evm_test.go
+++ b/action/protocol/execution/evm/evm_test.go
@@ -364,10 +364,10 @@ func TestConstantinople(t *testing.T) {
 		require.Equal(isSumatra, chainRules.IsMerge)
 		require.Equal(isSumatra, chainRules.IsShanghai)
 
-		// Upernavik = enable Cancun
-		isUpernavik := g.IsUpernavik(e.height)
-		require.Equal(isUpernavik, chainRules.IsCancun)
-		//Prague not yet enabled
+		// Cancun and Prague not yet enabled
+		require.False(chainRules.IsCancun)
+		require.False(evmChainConfig.IsCancun(big.NewInt(int64(e.height)), evm.Context.Time))
+		require.False(chainRules.IsPrague)
 		require.False(evmChainConfig.IsPrague(big.NewInt(int64(e.height)), evm.Context.Time))
 
 		// test basefee
diff --git a/action/protocol/execution/protocol_test.go b/action/protocol/execution/protocol_test.go
index 81fc1844e..45e95afde 100644
--- a/action/protocol/execution/protocol_test.go
+++ b/action/protocol/execution/protocol_test.go
@@ -1328,6 +1328,8 @@ func TestShanghaiEVM(t *testing.T) {
 
 func TestCancunEVM(t *testing.T) {
 	t.Run("eip1153-transientstorage", func(t *testing.T) {
+		// TODO: re-enable this test when enable Cancun
+		t.Skip()
 		NewSmartContractTest(t, "testdata-cancun/transientstorage.json")
 	})
 }