-
Notifications
You must be signed in to change notification settings - Fork 332
feat: add upgrade method to WormholeExecutor contract #3603
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
base: stellar
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 target_contract parameter in execute_governance_action is caller-chosen, not PTGM-bound The (Refers to lines 151-154) Was this helpful? React with 👍 or 👎 to provide feedback. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,4 +209,11 @@ impl WormholeExecutor { | |
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| /// Upgrade the contract WASM. Callable only by the contract itself. | ||
| pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) -> Result<(), ContractError> { | ||
| env.current_contract_address().require_auth(); | ||
| env.deployer().update_current_contract_wasm(new_wasm_hash); | ||
| Ok(()) | ||
| } | ||
|
Comment on lines
+213
to
+218
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Executor's The new The integration test Possible fix approachIn `execute_governance_action`, when `target_contract == env.current_contract_address()` and the action is `Upgrade`, call `env.deployer().update_current_contract_wasm(wasm_hash)` directly instead of going through `invoke_contract`, thereby avoiding re-entry. The `upgrade` function can remain for completeness but the self-upgrade governance path needs the direct call.Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
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.
🚩 UpgradePayload.version field is parsed but never used
The
UpgradePayloadstruct atgovernance.rs:36-39includes aversion: u64field that is parsed from the PTGM payload, butexecute_governance_actionatlib.rs:199-206only usespayload.wasm_digestand silently discardspayload.version. This means an upgrade governance message could specify any version number and it would have no effect. Ifversionis intended to enforce monotonic upgrades or serve as a safety check (e.g., preventing accidental downgrades), it should be validated. If it's purely informational/reserved for future use, this is fine but should be documented.(Refers to lines 199-207)
Was this helpful? React with 👍 or 👎 to provide feedback.