Skip to content

fix(circuit_breaker): remove anonymous failure reporting and restore Sybil resistance (closes #313) - #318

Open
guptakumarranjeet150 wants to merge 1 commit into
Vero-protocol:mainfrom
guptakumarranjeet150:fix/issue-313-remove-anonymous-failure-reporting
Open

fix(circuit_breaker): remove anonymous failure reporting and restore Sybil resistance (closes #313)#318
guptakumarranjeet150 wants to merge 1 commit into
Vero-protocol:mainfrom
guptakumarranjeet150:fix/issue-313-remove-anonymous-failure-reporting

Conversation

@guptakumarranjeet150

Copy link
Copy Markdown

Summary

Closes #313

Closes the anonymous failure-counter path in batch dispatch by requiring attributable reporter signatures and routing `BatchCall::RecordFailure(reporter)` through `record_failure(env, reporter)`. This restores the documented anti-DoS Sybil barrier (`MAX_REPORTS_PER_REPORTER * (MIN_DISTINCT_REPORTERS - 1) <= FAILURE_THRESHOLD`) preventing unauthenticated callers from manipulating the circuit-breaker state.

Key Changes

  • Batch Dispatch Attribution (`src/types.rs`, `src/contracts/proxy_entry/mod.rs`):
    • Updated `BatchCall::RecordFailure(Address)` to carry an attributable reporter address.
    • Routed dispatch through authenticated `Self::record_failure(env, reporter)` which validates the address and enforces signature authorization.
  • Removed Unauthenticated Path (`src/circuit_breaker.rs`):
    • Deleted `record_failure_anonymous` which previously bypassed authentication, quotas, and cooldowns.
    • Made `pub mod circuit_breaker` in `src/lib.rs` to expose security parameters for audit and test assertions.
  • Unit & Regression Testing (`tests/circuit_breaker_dos.rs`):
    • Updated `test_batch_execute_with_record_failure_variant` asserting attributable batch execution.
    • Added `test_sybil_barrier_arithmetic_invariant` verifying the anti-DoS arithmetic invariant.
    • Added `test_batch_execute_record_failure_requires_auth` asserting that unauthenticated callers on the batch path cannot increment `FailureCount`.

Verification

  • `cargo test --test circuit_breaker_dos`: 17/17 tests passing green.
  • `cargo test --lib`: 15/15 tests passing green.

…Sybil resistance (closes Vero-protocol#313)

- Updates `BatchCall::RecordFailure(Address)` to carry an attributable reporter address, routing batch dispatch through the authenticated `Self::record_failure` path.
- Removes the unauthenticated `record_failure_anonymous` helper from `src/circuit_breaker.rs`, restoring the documented anti-DoS Sybil barrier: `MAX_REPORTS_PER_REPORTER * (MIN_DISTINCT_REPORTERS - 1) <= FAILURE_THRESHOLD`.
- Exposes `circuit_breaker` module publicly in `src/lib.rs` for constant auditing.
- Updates `tests/circuit_breaker_dos.rs` to verify attributable batch execution, adds runtime assertion of the arithmetic Sybil barrier invariant, and asserts unauthenticated batch dispatches cannot increment `FailureCount`.
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.

record_failure_anonymous bypasses the authenticated reporter model and restores the #142 circuit-breaker DoS

1 participant