feat(vm): check CREATE2 max depth under Osaka#6807
Open
yanghang8612 wants to merge 1 commit into
Open
Conversation
| } | ||
|
|
||
| @Test | ||
| public void testCreate2MaxDepthWithOsakaOnly() throws ContractValidateException { |
Collaborator
There was a problem hiding this comment.
Would be great to add a test case where both allowTvmCompatibleEvm and allowTvmOsaka are false, just to explicitly confirm that CREATE2 behaves as expected when neither flag is enabled. Helps make the intent clear for future readers!
Collaborator
Author
There was a problem hiding this comment.
Good idea, thanks! Added testCreate2MaxDepthWithNeitherFlag in the latest push: with both allowTvmCompatibleEvm and allowTvmOsaka disabled, the MAX_DEPTH short-circuit is not taken, so at max depth CREATE2 still proceeds as before — it records an internal transaction and pushes the new contract address instead of 0. This documents the baseline behavior alongside the Osaka-only case for future readers. PTAL.
aiden3885
approved these changes
Jun 1, 2026
c0126f0 to
0af1527
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.
What does this PR do?
Extends the CREATE2 (
Program.createContract2) maximum call-depth guard so it also takes effect under the Osaka fork. The guard pushes0and returns when the call depth reachesMAX_DEPTH(64); it was previously gated only onallowTvmCompatibleEvm()and is now gated onallowTvmCompatibleEvm() || allowTvmOsaka().Why are these changes required?
The
ALLOW_TVM_OSAKAproposal only gates on theVERSION_4_8_2fork and does not requireALLOW_TVM_COMPATIBLE_EVMas a prerequisite (seeProposalUtil). Osaka can therefore be active whileallowTvmCompatibleEvmis still off, in which case a max-depth CREATE2 would fail to short-circuit as expected. Gating the guard on Osaka as well keeps CREATE2's max-depth behavior consistent whenever Osaka is enabled. (CREATE, CALL and the other call paths already enforce this depth check unconditionally.)This PR has been tested by:
Added
OperationsTest#testCreate2MaxDepthWithOsakaOnly: enables Osaka only (allowTvmCompatibleEvm = 0,allowTvmOsaka = 1), invokescreateContract2at depth 64, and asserts that0is pushed onto the stack and no internal transaction is created.Follow up
None.
Extra details
Single-line behavioral change; paths where
allowTvmCompatibleEvmis enabled are unaffected.