Skip to content

feat(delegation): derive pause proposal_id from action hash for idemp…#479

Merged
Baskarayelu merged 3 commits into
CredenceOrg:mainfrom
K1NGD4VID:feature/delegation-deterministic-proposal-id
Jun 3, 2026
Merged

feat(delegation): derive pause proposal_id from action hash for idemp…#479
Baskarayelu merged 3 commits into
CredenceOrg:mainfrom
K1NGD4VID:feature/delegation-deterministic-proposal-id

Conversation

@K1NGD4VID
Copy link
Copy Markdown
Contributor

…otency

  • Replace counter-based PauseProposalCounter with deterministic hash(action, epoch)
  • Add PROPOSAL_EPOCH_SIZE constant (100 ledgers ~8 min) with tradeoff docs
  • derive_proposal_id: SHA-256 of (action_u32 ++ epoch_u32), first 8 bytes as u64
  • Idempotent: same action+epoch converges to one proposal, votes accumulate
  • Add get_proposal_by_legacy_id compatibility shim for old counter-based IDs
  • Fix executed detection for hash-derived proposals via surviving approval keys
  • Fix credence_errors duplicate discriminants (StorageCapReached=224, DomainMismatch=225)
  • Add 6 test cases: idempotency, epoch difference, simultaneous, boundary, accumulation, legacy fetch

closes #437

…otency

- Replace counter-based PauseProposalCounter with deterministic hash(action, epoch)
- Add PROPOSAL_EPOCH_SIZE constant (100 ledgers ~8 min) with tradeoff docs
- derive_proposal_id: SHA-256 of (action_u32 ++ epoch_u32), first 8 bytes as u64
- Idempotent: same action+epoch converges to one proposal, votes accumulate
- Add get_proposal_by_legacy_id compatibility shim for old counter-based IDs
- Fix executed detection for hash-derived proposals via surviving approval keys
- Fix credence_errors duplicate discriminants (StorageCapReached=224, DomainMismatch=225)
- Add 6 test cases: idempotency, epoch difference, simultaneous, boundary, accumulation, legacy fetch
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@K1NGD4VID Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@K1NGD4VID K1NGD4VID force-pushed the feature/delegation-deterministic-proposal-id branch from 63993e4 to bf218b8 Compare June 3, 2026 04:58
@Baskarayelu Baskarayelu merged commit bdd9a88 into CredenceOrg:main Jun 3, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contracts] Delegation: deterministic proposal_id derivation from action hash for idempotent submission

2 participants