Skip to content

feat(reputation-registry): gate get_score behind pause circuit breaker - #185

Open
fridaypetra55-afk wants to merge 1 commit into
cocor-tech:masterfrom
fridaypetra55-afk:fix/118-reputation-registry-pause-get-score
Open

feat(reputation-registry): gate get_score behind pause circuit breaker#185
fridaypetra55-afk wants to merge 1 commit into
cocor-tech:masterfrom
fridaypetra55-afk:fix/118-reputation-registry-pause-get-score

Conversation

@fridaypetra55-afk

Copy link
Copy Markdown
Contributor

Summary

  • record_activity and the other mutating entry points already checked pause::when_not_paused, but get_score did not — so a paused contract (e.g. after a scoring bug is discovered) would still happily serve scores while it's under investigation.
  • get_score now returns Result<MoiScore, ReputationError> and rejects with ContractPaused when paused, consistent with every other entry point in the contract. The generated Soroban client keeps the ergonomic client.get_score(...) panicking-on-error call site working unchanged; client.try_get_score(...) is used where the paused error needs to be observed.
  • Added a test_pause_blocks_get_score test mirroring the existing test_pause_blocks_record pattern.

Note on pre-existing breakage (unrelated to this change)

While validating this fix I found reputation-registry's own test suite does not currently compile on master, for reasons unrelated to this issue:

  • lib.rs never re-exports types::* (e.g. crate::MoiScore), which test.rs imports directly.
  • test.rs calls client.record(...) / client.try_record(...), but the contract only exposes record_activity.
  • test.rs uses Events::last() as an iterator, which isn't supported by the pinned soroban-sdk version's testutils API.
  • reputation-registry/Cargo.toml was also missing the testutils dev-dependency that circle/Cargo.toml has, so the package couldn't even attempt to build its tests — I've added that here since it's needed for this package to build its own test suite at all.

This is likely why it was never caught: the CI workflow at .github/workflows/*.yml triggers on branches: ["main"], but the repo's default branch is master, so cargo test --workspace / clippy have not actually been running in CI. I did not attempt to fix the pre-existing record/export/Events issues here since they're out of scope for #118 — happy to file that as a separate issue if useful. I did verify cargo build -p reputation-registry (the actual contract lib, non-test) compiles cleanly with this change.

Closes #118

record_activity and other mutating entry points already checked
pause::when_not_paused, but get_score did not, so a paused contract
would still serve (potentially bogus) scores while scoring bugs were
under investigation. get_score now returns Result<MoiScore,
ReputationError> and rejects with ContractPaused when the admin has
paused the contract, matching every other reputation-registry entry
point.

Also adds the missing testutils dev-dependency to
reputation-registry/Cargo.toml (present in circle's Cargo.toml but
absent here), which is required to build this package's own test
suite in isolation.

Closes cocor-tech#118
@drips-wave

drips-wave Bot commented Jul 31, 2026

Copy link
Copy Markdown

@fridaypetra55-afk 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

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.

feat(contract): add pause state to reputation-registry contract

1 participant