feat: discard the code_hash and trx_hash fields passed in during contract deployment - #4
Open
lily309 wants to merge 1 commit into
Open
feat: discard the code_hash and trx_hash fields passed in during contract deployment#4lily309 wants to merge 1 commit into
code_hash and trx_hash fields passed in during contract deployment#4lily309 wants to merge 1 commit into
Conversation
code_hash and trx_hash fields passed in during contract deployment
yanghang8612
force-pushed
the
feat/reject-contract-hash-fields
branch
from
September 1, 2026 07:06
fd01663 to
57fa8e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this needed?
The
code_hashandtrx_hashfields passed in during contract deployment are unused. They do not participate in deployment processing and do not affect the deployment result or execution semantics.Since these fields have no functional meaning as deployment inputs, this change introduces a preventive protocol restriction against their future use.
Historical transaction scan
We performed a complete scan of all historical transactions across the full chain history.
No historical contract deployment transaction was found with either
code_hashortrx_hashset. The number of historical transactions carrying either field is zero.This confirms that normal contract deployments have never relied on these fields. The restriction does not invalidate any historical transaction or alter any existing user behavior.
Implementation
The field numbers already exist in the protocol message and cannot be removed directly without affecting wire compatibility. Therefore, preventive prohibition at the protocol level must be implemented as an activation-gated validation rule.
After activation, a contract deployment transaction containing a non-empty
code_hashortrx_hashis rejected during validation using the existing timeout rejection semantics. Before activation, the existing behavior is preserved.Normal contract deployment transactions do not set these fields and are completely unaffected by this change. Contract bytecode, addresses, resource settings, constructor parameters, and all other normal deployment inputs continue to be processed exactly as before.
What does this PR do?
code_hashandtrx_hashvalues during contract deployment validation.Compatibility
This change currently uses the same provisional fork version introduced by #6920.
The current branches merge without textual conflicts. If the version identifier or activation parameters in #6920 change, this PR should be updated accordingly.
Tests
code_hashrejection after activation.trx_hashrejection after activation.