Skip to content

feat(vm): optimize resource processing (TIP-945) - #7069

Open
yanghang8612 wants to merge 8 commits into
feature/tip-944-voting-powerfrom
feature/tip-945-resource-processing
Open

yanghang8612 wants to merge 8 commits into
feature/tip-944-voting-powerfrom
feature/tip-945-resource-processing

Conversation

@yanghang8612

@yanghang8612 yanghang8612 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Implement TIP-945 behind ALLOW_TVM_RESOURCE_OPTIMIZATION (104), applying the specified vote-input validation order and per-account Stake 2.0 weight accounting.

Behind the same parameter, persist the restored Stake 2.0 energy window when a successful contract transaction uses no energy.

Behind the same parameter, and only while Stake 2.0 is enabled, contract execution uses the same fractional energy weight as the account-resource query.

Why are these changes required?

Keep TVM resource processing consistent with the protocol's validation and accounting rules.

Related to TIP-945.

This PR has been tested by:

  • ./gradlew clean build -x test on macOS ARM64 / JDK 17.
  • Combined regression suite: 111 tests, 110 passed and 1 existing benchmark skipped, including static configuration restoration, TIP-944/TIP-945 tests, all four activation combinations, VM guards, rollback, finalization, consecutive stake transfers, pre-existing weight offsets, zero-Energy calls, and fractional energy weights.
  • Tip944VmTest, Tip945VmTest, and :framework:checkstyleTest on macOS ARM64 / JDK 17. The new tests cover a zero-energy call with the caller and origin as the same account and as different accounts, both with parameter 104 on and off.
  • RepositoryImplHardenTest and :framework:checkstyleTest on macOS ARM64 / JDK 17. The new test checks fractional energy weight with parameter 104 on and off, with and without hardened calculation, and with Stake 2.0 disabled.
  • Required Checkstyle tasks and .github/scripts/check_math_usage.sh.

Follow up

Merge the TIP-944 implementation first, then rebase/retarget this PR onto release_v4.8.3.

Extra details

Targets feature/tip-944-voting-power so this review contains only TIP-945 changes. This is a branch dependency; runtime activation remains independent. Proposal validation, application, and parameter output follow the order 102, 103, 104.

@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.3 milestone Oct 28, 2026
@halibobo1205 halibobo1205 added the topic:vm VM, smart contract label Oct 28, 2026
@yanghang8612
yanghang8612 force-pushed the feature/tip-945-resource-processing branch from db3830a to b88c860 Compare October 29, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:vm VM, smart contract

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants