-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force upgrade stdlib with v13 for consensus update #4402
base: dag-master
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request reorganizes and updates the force-upgrade functionality. It moves the force-upgrade module from the Changes
Sequence Diagram(s)sequenceDiagram
participant BC as BlockChain
participant FE as ForceUpgradeManagement
participant BE as BlockExecutor
participant OB as OpenedBlock
BC->>FE: Request force upgrade block number
FE-->>BC: Return block number (100)
BC->>BE: Validate transaction count & decide on extra txn execution
BE->>FE: Verify force upgrade parameters (version, metadata)
BE->>BC: Execute extra transaction for force upgrade
OB->>FE: Utilize new force upgrade flow directly (no conditional flags)
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
vm/vm-runtime/src/force_upgrade_management.rs (1)
75-83
:⚠️ Potential issueFix failing test assertions for Dev and Test chains.
The test assertions for Dev and Test chains are failing. The test expects the same address for both chains but uses different chain IDs (254).
Apply this diff to fix the test:
- get_force_upgrade_account(&ChainId::new(254))?.address(), + get_force_upgrade_account(&ChainId::new(255))?.address(),🧰 Tools
🪛 GitHub Actions: Code Coverage Report
[error] 75-75: Assertion
left == right
failed in test force_upgrade_management::tests::test_get_force_upgrade_account.
🧹 Nitpick comments (5)
executor/src/block_executor.rs (1)
170-170
: Address TODO comment regarding execute_extra_txn.The TODO comment indicates a need to check and merge execute_extra_txn functionality with OpenedBlock.
Would you like me to help analyze the OpenedBlock implementation and propose a merged solution?
chain/open-block/src/lib.rs (1)
312-322
: Consider making the stdlib version configurable.The stdlib version is hardcoded to 13, which could make future upgrades more difficult. Consider:
- Making the version configurable through a constant or configuration
- Adding a comment explaining why version 13 is specifically required
- let version = on_chain_config::Version { major: 13 }; + // TODO: Consider making this configurable + const STDLIB_VERSION: u64 = 13; + let version = on_chain_config::Version { major: STDLIB_VERSION };chain/open-block/Cargo.toml (1)
1-33
: Fix manifest warnings in pipeline.The pipeline reports warnings about unused manifest key:
dependencies.bcs-ext.package
. Consider removing thepackage
specification if it's not needed.-bcs-ext = { package = "bcs-ext", workspace = true } +bcs-ext = { workspace = true }🧰 Tools
🪛 GitHub Actions: Code Coverage Report
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
🪛 GitHub Actions: benchmark pull requests
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
chain/force-upgrade/Cargo.toml (1)
16-16
: Fix manifest warnings in pipeline.Similar to
chain/open-block/Cargo.toml
, remove the unnecessarypackage
specification to resolve pipeline warnings.-bcs-ext = { package = "bcs-ext", workspace = true } +bcs-ext = { workspace = true }Cargo.toml (1)
1-1
: Pipeline Warning: Unused Manifest Key for 'dependencies.bcs-ext.package'
The pipeline reports an unused manifest key (dependencies.bcs-ext.package
). Although this issue exists outside the scope of the current PR changes, it may be worth reviewing the configuration forbcs-ext
to remove any obsolete keys.🧰 Tools
🪛 GitHub Actions: Code Coverage Report
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
🪛 GitHub Actions: benchmark pull requests
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
🪛 GitHub Actions: Build and Test
[warning] 1-1: unused manifest key: dependencies.bcs-ext.package
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (14)
Cargo.toml
(4 hunks)chain/Cargo.toml
(1 hunks)chain/force-upgrade/Cargo.toml
(3 hunks)chain/force-upgrade/src/lib.rs
(1 hunks)chain/open-block/Cargo.toml
(1 hunks)chain/open-block/src/lib.rs
(4 hunks)chain/src/chain.rs
(2 hunks)chain/tests/test_force_upgrade.rs
(7 hunks)cmd/starcoin/Cargo.toml
(0 hunks)executor/Cargo.toml
(0 hunks)executor/src/block_executor.rs
(3 hunks)node/Cargo.toml
(0 hunks)vm/vm-runtime/src/force_upgrade_management.rs
(2 hunks)vm/vm-runtime/src/lib.rs
(1 hunks)
💤 Files with no reviewable changes (3)
- cmd/starcoin/Cargo.toml
- executor/Cargo.toml
- node/Cargo.toml
✅ Files skipped from review due to trivial changes (1)
- vm/vm-runtime/src/lib.rs
🧰 Additional context used
🪛 GitHub Actions: Code Coverage Report
chain/open-block/Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
chain/Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
vm/vm-runtime/src/force_upgrade_management.rs
[error] 75-75: Assertion left == right
failed in test force_upgrade_management::tests::test_get_force_upgrade_account.
chain/force-upgrade/Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
🪛 GitHub Actions: benchmark pull requests
chain/open-block/Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
chain/Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
chain/force-upgrade/Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
Cargo.toml
[warning] 1-1: Unused manifest key: dependencies.bcs-ext.package
🪛 GitHub Actions: Build and Test
chain/force-upgrade/Cargo.toml
[warning] 1-1: unused manifest key: dependencies.bcs-ext.package
Cargo.toml
[warning] 1-1: unused manifest key: dependencies.bcs-ext.package
🔇 Additional comments (15)
chain/force-upgrade/src/lib.rs (1)
27-27
: LGTM! Package path updated for v13 upgrade.The package file path has been correctly updated to reflect the upgrade from version 12 to version 13.
vm/vm-runtime/src/force_upgrade_management.rs (1)
8-8
: Verify the significant reduction in force upgrade block number.The force upgrade block number has been drastically reduced from 17500000 to 100. This could significantly impact the network's upgrade timeline.
Please confirm if this reduction is intentional and aligns with the network's upgrade schedule.
chain/tests/test_force_upgrade.rs (1)
20-20
: LGTM! Test cases updated for v12 to v13 upgrade path.The test cases have been correctly updated to use stdlib version 12 as the starting point for the v13 upgrade.
Also applies to: 36-36, 204-204
executor/src/block_executor.rs (2)
133-141
: LGTM! Version check updated for v12 to v13 upgrade.The version check has been correctly updated to execute extra transactions only when the stdlib version is 12, preparing for the upgrade to v13.
144-147
: LGTM! Improved error handling for metadata retrieval.The code now properly handles metadata retrieval errors using get_block_metadata_v2 with explicit error messaging.
chain/open-block/src/lib.rs (2)
9-9
: LGTM! Import changes are well-organized.The new imports are properly structured and align with the force upgrade functionality changes.
Also applies to: 27-27, 31-41
557-563
: LGTM! Transaction validation logic is cleaner.The simplified validation logic maintains the same functionality while being more readable and maintainable.
chain/src/chain.rs (1)
756-762
: LGTM! Consistent transaction validation.The transaction validation logic matches the changes in
open-block/src/lib.rs
, maintaining consistency across the codebase.chain/open-block/Cargo.toml (1)
18-18
: LGTM! Required dependency for force upgrade.The addition of
starcoin-vm-runtime
is necessary for the force upgrade functionality.chain/force-upgrade/Cargo.toml (1)
7-7
: LGTM! Version bump and dependency addition.The version update to 2.0.2 and addition of
starcoin-vm-runtime
align with the force upgrade changes.Also applies to: 28-28
chain/Cargo.toml (1)
24-24
: Dependency Update: 'starcoin-vm-runtime' Now Mandatory
The removal of theoptional = true
flag forstarcoin-vm-runtime
is intentional to ensure that the dependency is always included as part of the consensus update. Please verify that all consuming modules are compatible with this stricter dependency requirement.Cargo.toml (4)
43-43
: Workspace Members Update: 'chain/force-upgrade' Module
The workspace members list now includes"chain/force-upgrade"
(previously located under"vm/force-upgrade"
), reflecting the new module organization. This change improves clarity and aligns with the project’s structural reorganization.
157-157
: Default Members Update: 'chain/force-upgrade' Inclusion
Updating the default-members configuration to reference"chain/force-upgrade"
ensures that the renamed module is automatically included, which is consistent with the intended restructuring.
457-457
: Dependency Revision Update: 'starcoin-framework'
The revision forstarcoin-framework
has been bumped to631ddccd5a169f535476a62bd8145782e3d9960a
. This update is crucial to maintain compatibility across the codebase as part of the consensus update. Please ensure related tests pass with this new revision.
475-475
: Dependency Path Update: 'starcoin-force-upgrade'
The dependency forstarcoin-force-upgrade
has been updated to use the new path"chain/force-upgrade"
. This change correctly reflects the move of the force-upgrade module and ensures path consistency across the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
genesis/src/lib.rs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Generate code coverage report
//FIXME: consensus config update by genesis init when stdlib upgrade_from_12_to_13 | ||
/*assert_eq!( | ||
consensus_config.as_ref().unwrap(), | ||
&net.genesis_config().consensus_config | ||
); | ||
);*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Verification inconclusive
Verify the consensus config update during stdlib upgrade.
The commented-out assertion suggests that the consensus config will be updated during the stdlib upgrade from v12 to v13. This change needs careful verification to ensure the new consensus config is correctly applied.
Run the following script to verify the consensus config changes:
Additionally, please verify:
- What are the specific consensus config changes being introduced?
- Are there any migration steps needed for the consensus config update?
- Have all dependent components been updated to handle the new consensus config?
🏁 Script executed:
#!/bin/bash
# Description: Check for consensus config changes in the stdlib upgrade
# Search for consensus config related changes
ast-grep --pattern 'consensus_config'
# Search for stdlib upgrade related changes
rg -A 5 'upgrade.*12.*13|v12.*v13'
Length of output: 5077
ACTION: Verify consensus config migration for stdlib upgrade from v12 to v13.
The commented-out assertion indicates that the consensus config verification is intentionally disabled pending the upgrade. Please confirm that:
- The new consensus config values (e.g., gas limits, time targets, difficulty windows, etc.) are being set as expected.
- All necessary migration steps for transitioning from v12 to v13 are implemented and documented.
- All dependent modules (such as genesis initialization and transaction builder logic) correctly handle the updated consensus config.
Once these items are verified, consider adding or re-enabling corresponding tests to ensure the configuration matches post-upgrade requirements.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Other information
Summary by CodeRabbit
Refactor
Chore
Tests
New Features