Security: Add rate limiting, audit events, and event indexing to contracts - #308
Merged
parkerwinner merged 1 commit intoAug 28, 2026
Conversation
…euse Add rate limiting to the previously-unprotected batch escrow operations, emit structured audit events for admin/compliance/recurring-escrow state changes and normalize dispute/approval events onto the existing indexable event schema, and remove a redundant admin storage read on the escrow release/refund hot paths.
|
@hardcordev 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! 🚀 |
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
Hardens the payment escrow and remittance hub contracts against
transaction spam on batch operations, closes gaps in the on-chain audit
trail for admin/compliance/recurring-escrow actions, normalizes
dispute/approval events onto the contract's indexable event schema, and
removes a redundant storage read from the escrow release/refund hot
paths.
Changes
Added a
FunctionType::Batchvariant and wiredenforce_rate_limitinto
batch_create_escrows,batch_deposit, andbatch_release,which previously had no rate limiting despite every other
state-changing operation in the hub being protected.
events::emitcalls (the contract's existingGpayEventtimestamp/actor/amount/status/data schema) to state-changing
operations that previously left no record:
add_supported_asset,register_compliance_rule,set_user_jurisdiction,admin_override_compliance(a compliance bypass), andcreate_recurring_escrow/cancel_recurring_escrow.approval and dispute functions (
add_approver,remove_approver,revoke_approval,raise_dispute,vote_on_dispute,resolve_dispute) were publishing events via rawenv.events().publish(...)calls with topics/payloads outside thecontract's standard
(gpayremit, component, action, id)schema, so anindexer built around that schema would miss them entirely. Normalized
all six to use the existing
events::emithelper.enforce_rate_limitnow returns the admin address it already readsfrom storage, and the six release/refund entry points
(
release_escrow,release_asset,release_partial,refund_escrow,refund_asset,refund_partial) reuse that valuefor their authorization check instead of reading
DataKey::Adminasecond time, removing a redundant instance-storage read on every
release/refund call.
Issues
Resolves #300
Resolves #299
Resolves #298
Resolves #297
Verification
review tool was used.
cargo buildwas not run.cargo testwas not run.