Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 2.1 KB

File metadata and controls

51 lines (34 loc) · 2.1 KB

Fix Summary: Dispute Tally O(1) Implementation (#661)

Issues Addressed

Based on maintainer feedback, the following compilation errors were fixed:

1. Duplicate get_assigned_arbitrators Function

Problem: The function was defined twice in the contract (lines 1610 and 1849).

Solution: Removed the duplicate definition at line 1849 which was trying to access a non-existent dispute.assigned_arbitrators field. Kept the correct implementation at line 1610 that uses DataKey::Arbitrators.

2. Missing new_tally Function in Scope

Problem: The new_tally() function was referenced but not properly declared, and the closure syntax was incorrect.

Solution:

  • Added new_tally() helper function to create a default DisputeTally struct
  • Fixed closure syntax from .unwrap_or_else(new_tally) to .unwrap_or_else(|| new_tally())
  • Added missing storage keys: DisputeTally(u64) and Arbitrators(u64) to the DataKey enum
  • Added helper functions: bump_dispute_tally_ttl() and bump_arbitrators_ttl()

Additional Fixes

3. Missing Struct Fields

  • Added tally: DisputeTally field to Dispute struct
  • Added arbitrator_count: u32 field to Dispute struct
  • Initialized these fields in the raise_dispute function

4. Missing Match Pattern

  • Added VoteChoice::SplitAward pattern in the cast_vote match statement to handle all vote choice variants

Build Status

Compilation Successful

  • Build passes for wasm32-unknown-unknown target
  • Only warnings present (unused function, unused mut variable)
  • No compilation errors

Next Steps

The contract now compiles successfully. The failing tests are due to test snapshots needing regeneration after the struct changes, which is expected behavior when adding new fields to serialized structures.

Commit Details

Commit: 67ba4eb Branch: refactor/dispute-tally-incremental-accumulator-661 Message: fix: resolve duplicate get_assigned_arbitrators and new_tally scope issues

Changed Files

  • contracts/dispute/src/lib.rs - Main contract file with all fixes applied
  • Test snapshots updated (47 files changed)