-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Problem
When a room contract is migrated to a new WASM version, the migration code sends an upgrade pointer UPDATE to the old contract. This UPDATE fails with:
UPDATE operation failed: invalid contract update, reason: State verification failed: Invalid signature: signature error
This was observed in the browser console while the UI migrated room XQTMFW5V from old contract oW3AFr9RE15sm9d1dZwEQVMjaNJKwsyNbGUP1ptekE6 to new contract GD238LC8mu6FHfp33w9DVATyKaCa9n5CNnKUzyANzodj.
Root Cause
In ui/src/components/app/freenet_api/room_synchronizer.rs around line 449-453, the upgrade state is constructed as:
let upgrade_state = ChatRoomStateV1 {
upgrade: OptionalUpgradeV1(Some(authorized_upgrade)),
..Default::default() // ← BUG: empty/invalid state for all other fields
};The ..Default::default() produces an empty configuration (with zeroed owner_member_id), empty members, etc. The old contract's state verification checks the entire submitted state for consistency and rejects it because the configuration fields are invalid/empty.
Expected Behavior
The upgrade pointer should be sent as a delta (not a full state replacement), or the full current room state should be included alongside the upgrade pointer so the old contract's validation passes.
Steps to Reproduce
- Have a room created with an older contract version
- Connect with a new River UI that triggers contract migration
- Observe the console error:
UPDATE operation failed: ... Invalid signature: signature error
Impact
- The upgrade pointer is never set on the old contract
- Other clients can't follow the migration pointer to the new contract
- The new contract subscription eventually fails with repeated timeout errors
Related
- feat: Graceful room contract WASM upgrades #63 (Graceful room contract WASM upgrades)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status