feat: vault upgrade lifecycle events#549
Conversation
Add upgrade.rs module with UpgradeStartedData and UpgradeCompletedData structs. Emit upgrade_started before WASM swap (carries new_wasm_hash + previous_version). Emit upgrade_completed after WASM swap (carries new_wasm_hash). Retain original upgraded event for backward compatibility with existing indexers. Add event_upgrade_started and event_upgrade_completed to events.rs with snapshot tests. Document all three upgrade events in EVENT_SCHEMA.md with indexer guidance. Add 7 focused tests covering event ordering, data payloads, and version tracking. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CI failures are pre-existing on main, not introduced by this PR. The compile errors (__broadcast defined multiple times, duplicate definitions with name 'broadcast') originate from two pub fn broadcast implementations already present in contracts/vault/src/lib.rs lines 1471 and 1628 — both existed before this branch was cut. This same failure appears on the main branch run immediately before our PR was opened: run IDs 28292295694 (CI), 28292295699 (Test Coverage), 28292295713 (WASM Size Budget). Our change (upgrade.rs + lifecycle events) compiles and is orthogonal to the broadcast duplication bug. |
The first broadcast implementation (with panic-based validation) was accidentally placed after a misattributed upgrade docstring, creating two definitions inside the same contractimpl block. The second implementation (with proper VaultError return codes and its own docstring) is the intended one — the duplicate is removed. This was a pre-existing compile error on main (runs 28292295694/699/713). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vault: add contracterror to soroban_sdk imports settlement: add String, Severity, AdminBroadcast, MAX_MESSAGE_LEN Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This PR is being closed as invalid. To raise a PR, please first comment on the issue you want to work on and wait to be assigned. Once you're assigned to the issue, open a fresh PR (linking it with This keeps the contributor workflow predictable for everyone working on the GrantFox campaign. Thanks! |
CI status — pre-existing failures vs. our changesAfter four commits on this branch I want to be transparent about what's failing and why. What this PR fixed (were already broken on
|
| Error | Location | Status |
|---|---|---|
error[E0428]: __broadcast defined multiple times |
vault/src/lib.rs |
✅ Fixed in 2fa20fe |
cannot find type Severity / String / AdminBroadcast |
settlement/src/lib.rs |
✅ Fixed in 028e46e |
cannot find value MAX_MESSAGE_LEN |
settlement/src/lib.rs |
✅ Fixed in 028e46e |
cannot find attribute contracterror |
vault/src/lib.rs |
✅ Fixed in 028e46e |
contracterror import out of alphabetical order |
vault/src/lib.rs:31 |
✅ Fixed in aaa4af3 |
Remaining failures — all pre-existing on main (CI run 28292295694 / 28292295713)
| Error | Job | Pre-existing on main? |
|---|---|---|
Val: TryFromVal<Env, u16> — deduct(max_fee_bps: u16) in vault |
WASM Build | ✅ Yes (run 28292295713) |
Box not found in this scope — proptest + #![no_std] nightly |
Test (Nightly) | ✅ Yes |
cargo fmt --check diffs in vault, settlement, revenue_pool |
Test (Stable) | ✅ Yes (run 28292295694) |
The u16 WASM error was introduced by PR #519 (max_fee_bps: u16 slippage feature) which merged before us; soroban_sdk v22 doesn't implement TryFromVal for u16. Fixing it would require changing u16 → u32 or a wrapper type in deduct — that's outside the scope of this issue but worth tracking separately.
Happy to address anything in scope. Let me know if you'd like a fix for the u16 type as well.
Summary
Test plan
Closes #528