Repository: iotexproject/iotex-core
Pull request #4070 (2024-01-26 01:04:37)

enable 48kB execution data limit and deterministic deployment at Sumatra height
…tra height

# Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

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
- [] 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=4070) **Quality Gate passed**  
Kudos, no new issues were introduced!

[0 New issues](https://sonarcloud.io/project/issues?id=iotexproject_iotex-core&pullRequest=4070&resolved=false&inNewCodePeriod=true)  
[0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=iotexproject_iotex-core&pullRequest=4070&resolved=false&inNewCodePeriod=true)  
No data about Coverage  
[2.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=iotexproject_iotex-core&pullRequest=4070&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=iotexproject_iotex-core&pullRequest=4070)


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) Report
Attention: `534 lines` in your changes are missing coverage. Please review.
> Comparison is base [(`e1f0636`)](https://app.codecov.io/gh/iotexproject/iotex-core/commit/e1f0636b27ca54fa57da8cadb3034431143833fa?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) 75.38% compared to head [(`482d44f`)](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) 76.19%.
> Report is 161 commits behind head on master.

| [Files](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) | Patch % | Lines |
|---|---|---|
| [action/protocol/staking/staking\_statereader.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL3Byb3RvY29sL3N0YWtpbmcvc3Rha2luZ19zdGF0ZXJlYWRlci5nbw==) | 69.76% | [35 Missing and 17 partials :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [action/protocol/execution/evm/evm.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL3Byb3RvY29sL2V4ZWN1dGlvbi9ldm0vZXZtLmdv) | 48.38% | [47 Missing and 1 partial :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [api/coreservice.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YXBpL2NvcmVzZXJ2aWNlLmdv) | 62.96% | [34 Missing and 6 partials :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [api/web3server.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YXBpL3dlYjNzZXJ2ZXIuZ28=) | 79.24% | [30 Missing and 3 partials :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [action/candidate\_endorsement.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL2NhbmRpZGF0ZV9lbmRvcnNlbWVudC5nbw==) | 0.00% | [31 Missing :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [action/protocol/staking/protocol.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL3Byb3RvY29sL3N0YWtpbmcvcHJvdG9jb2wuZ28=) | 36.36% | [28 Missing :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [action/candidate\_activate.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL2NhbmRpZGF0ZV9hY3RpdmF0ZS5nbw==) | 0.00% | [25 Missing :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [...tion/protocol/staking/contractstake\_bucket\_type.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL3Byb3RvY29sL3N0YWtpbmcvY29udHJhY3RzdGFrZV9idWNrZXRfdHlwZS5nbw==) | 0.00% | [24 Missing :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [action/protocol/rewarding/fund.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YWN0aW9uL3Byb3RvY29sL3Jld2FyZGluZy9mdW5kLmdv) | 23.07% | [19 Missing and 1 partial :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| [api/websocket.go](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject#diff-YXBpL3dlYnNvY2tldC5nbw==) | 0.00% | [20 Missing :warning: ](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) |
| ... and [40 more](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject) | |

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #4070      +/-   ##
==========================================
+ Coverage   75.38%   76.19%   +0.81%     
==========================================
  Files         303      338      +35     
  Lines       25923    28806    +2883     
==========================================
+ Hits        19541    21950    +2409     
- Misses       5360     5738     +378     
- Partials     1022     1118      +96     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/iotexproject/iotex-core/pull/4070?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iotexproject).


Patch:
diff --git a/action/protocol/context.go b/action/protocol/context.go
index 0cb7be38a..5de7b937e 100644
--- a/action/protocol/context.go
+++ b/action/protocol/context.go
@@ -113,9 +113,9 @@ type (
 		AllowCorrectChainIDOnly                 bool
 		AddContractStakingVotes                 bool
 		FixContractStakingWeightedVotes         bool
-		SharedGasWithDapp                       bool
 		ExecutionSizeLimit32KB                  bool
 		UseZeroNonceForFreshAccount             bool
+		SharedGasWithDapp                       bool
 	}
 
 	// FeatureWithHeightCtx provides feature check functions.
@@ -254,9 +254,9 @@ func WithFeatureCtx(ctx context.Context) context.Context {
 			AllowCorrectChainIDOnly:                 g.IsQuebec(height),
 			AddContractStakingVotes:                 g.IsQuebec(height),
 			FixContractStakingWeightedVotes:         g.IsRedsea(height),
+			ExecutionSizeLimit32KB:                  !g.IsSumatra(height),
+			UseZeroNonceForFreshAccount:             g.IsSumatra(height),
 			SharedGasWithDapp:                       g.IsToBeEnabled(height),
-			ExecutionSizeLimit32KB:                  !g.IsToBeEnabled(height),
-			UseZeroNonceForFreshAccount:             g.IsToBeEnabled(height),
 		},
 	)
 }
diff --git a/api/coreservice.go b/api/coreservice.go
index 833355920..3d617b87f 100644
--- a/api/coreservice.go
+++ b/api/coreservice.go
@@ -458,7 +458,7 @@ func (core *coreService) SendAction(ctx context.Context, in *iotextypes.Action)
 	// reject action if a replay tx is not whitelisted
 	var (
 		g        = core.Genesis()
-		deployer = selp.SrcPubkey().Address()
+		deployer = selp.SenderAddress()
 	)
 	if selp.Encoding() == uint32(iotextypes.Encoding_ETHEREUM_UNPROTECTED) && !g.IsDeployerWhitelisted(deployer) {
 		return "", status.Errorf(codes.InvalidArgument, "replay deployer %v not whitelisted", deployer.Hex())
diff --git a/api/web3server.go b/api/web3server.go
index d0171ebc7..adce43041 100644
--- a/api/web3server.go
+++ b/api/web3server.go
@@ -454,7 +454,7 @@ func (svr *web3Handler) sendRawTransaction(in *gjson.Result) (interface{}, error
 		pubkey   crypto.PublicKey
 		err      error
 	)
-	if g := cs.Genesis(); g.IsToBeEnabled(cs.TipHeight()) {
+	if g := cs.Genesis(); g.IsSumatra(cs.TipHeight()) {
 		tx, err = action.DecodeEtherTx(dataStr.String())
 		if err != nil {
 			return nil, err


Test patch:
diff --git a/action/protocol/execution/protocol_test.go b/action/protocol/execution/protocol_test.go
index 7ad1e7c61..fde4680b6 100644
--- a/action/protocol/execution/protocol_test.go
+++ b/action/protocol/execution/protocol_test.go
@@ -633,9 +633,10 @@ func TestProtocol_Validate(t *testing.T) {
 		size      uint64
 		expectErr error
 	}{
-		{"limit 32KB", 0, 32684, action.ErrOversizedData},
-		{"limit 48KB I", genesis.Default.ToBeEnabledBlockHeight, 32684, nil},
-		{"limit 48KB II", genesis.Default.ToBeEnabledBlockHeight, 49153, action.ErrOversizedData},
+		{"limit 32KB", 0, 32683, nil},
+		{"exceed 32KB", 0, 32684, action.ErrOversizedData},
+		{"limit 48KB", genesis.Default.SumatraBlockHeight, 49067, nil},
+		{"exceed 48KB", genesis.Default.SumatraBlockHeight, 49068, action.ErrOversizedData},
 	}
 
 	for i := range cases {
diff --git a/blockchain/integrity/integrity_test.go b/blockchain/integrity/integrity_test.go
index e00b225ff..1ed177e7d 100644
--- a/blockchain/integrity/integrity_test.go
+++ b/blockchain/integrity/integrity_test.go
@@ -966,7 +966,7 @@ func TestConvertCleanAddress(t *testing.T) {
 	cfg.Genesis.PalauBlockHeight = 2
 	cfg.Genesis.QuebecBlockHeight = 2
 	cfg.Genesis.RedseaBlockHeight = 2
-	cfg.Genesis.ToBeEnabledBlockHeight = 2
+	cfg.Genesis.SumatraBlockHeight = 2
 	cfg.Genesis.InitBalanceMap[identityset.Address(27).String()] = unit.ConvertIotxToRau(10000000000).String()
 
 	ctx := context.Background()