feat(tholos): add set_bond_amount, admin-gated like update_resolvers/set_paused - #150
Merged
Merged
Conversation
…set_paused Adds set_bond_amount(new_bond_amount) validated against the same bounds initialize already enforces (bond_amount > 0, bond_amount <= MAX_BOND_AMOUNT), emitting a new BondAmountUpdated event on change. A bond change only affects assertions created afterward: Assertion.bond already pins the bond amount at creation and every payout path (dispute, finalize, resolve) reads that field, never the live DataKey::BondAmount. Makes that pinning guarantee explicit via a new doc comment on Assertion.bond, and adds a regression test proving a set_bond_amount call does not retroactively change an already-open assertion's payout, plus tests for the happy path, admin auth-gating, and bound validation. Closes drydocs#134
Adds the missing Errors section to set_bond_amount's doc comment (NotInitialized, InvalidBondAmount), per CONTRIBUTING.md's doc-comment convention. Updates docs/src/CONTRACT.md to keep the public interface reference in sync: adds the set_bond_amount function entry, the BondAmountUpdated event row, and notes the Assertion.bond pinning guarantee in its field table.
Regenerates packages/tholos-sdk/src from contracts/tholos's compiled wasm to include the new set_bond_amount function, per the CI drift check and packages/tholos-sdk/README.md's regeneration instructions.
collinsezedike
approved these changes
Sep 4, 2026
collinsezedike
left a comment
Collaborator
There was a problem hiding this comment.
@JohnArayaE thank you for the contribution. This looks good, there is nothing to flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
set_bond_amount(new_bond_amount), admin-gated the same wayupdate_resolversandset_pausedalready are, validated against the same boundsinitializealready enforces (bond_amount > 0,bond_amount <= MAX_BOND_AMOUNT). Emits a newBondAmountUpdatedevent on change.A bond change only affects assertions created after the call:
Assertion.bondalready pins the bond amount at creation, and every payout path (dispute,finalize,resolve) reads that field, never the liveDataKey::BondAmount. This PR makes that pinning guarantee explicit via a new doc comment onAssertion.bond, and adds a regression test proving aset_bond_amountcall does not retroactively change an already-open assertion's payout.docs/src/CONTRACT.mdis updated to match: a newset_bond_amountfunction entry, theBondAmountUpdatedevent row, and the pinning note onAssertion.bond's field description.Tests added
env.auths().MAX_BOND_AMOUNT, and exactly atMAX_BOND_AMOUNT.initialize(NotInitialized).Test plan
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings, andcargo testpass locally (76 passed intholos, 107 intholos-v2, unaffected)CONTRACT.mdupdated to match the changed public interfacescripts/testnet-smoke.shrun against testnet — not run; this change is additive and doesn't affect the existing deployed flow (assert/dispute/resolve/finalize)cargo build -p tholos --target wasm32v1-none --releasebuilds successfullyCloses #134