Skip to content

fix(agents): conservative default spending limits (#323) - #926

Open
raymondidahor-bot wants to merge 1 commit into
Stellar-Ecosystem:mainfrom
raymondidahor-bot:spending-limits
Open

fix(agents): conservative default spending limits (#323)#926
raymondidahor-bot wants to merge 1 commit into
Stellar-Ecosystem:mainfrom
raymondidahor-bot:spending-limits

Conversation

@raymondidahor-bot

Copy link
Copy Markdown

Summary

Fixes #323

Freshly registered agents defaulted to effectively unlimited spending caps (10,000 USDC/tx, 100,000 USDC/day) with no way to tighten them. This PR makes the defaults restrictive named constants and documents them.

Changes

contract/agents/src/lib.rs

  • Added named constants DEFAULT_MAX_PER_TX_STROOPS (500,000,000 stroops = 500 USDC) and DEFAULT_MAX_PER_DAY_STROOPS (5,000,000,000 stroops = 5,000 USDC) with a prominent comment block explaining the security rationale.
  • register_agent now uses these constants instead of the inline permissive literals (10,000 USDC/tx, 100,000 USDC/day).
  • Added a sanity validation in update_policy (max_per_tx_stroops > 0, max_per_day >= max_per_tx) so invalid limits are rejected at write time.

contract/agents/DEPLOY.md

  • Added a "Default Spending Limits" section documenting the constants, the security rationale, and the exact stellar contract invoke command an owner uses to raise limits.

Acceptance criteria

  • ✅ Defaults are conservative (500 USDC/tx, 5,000 USDC/day) and documented in DEPLOY.md
  • ✅ Raising limits requires an explicit owner-authorized update_policy call (caller.require_auth() + agent.owner == caller)
  • ✅ Default values are named constants, not inline literals

Close #323

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

)

Freshly registered agents defaulted to effectively unlimited caps
(10,000 USDC/tx, 100,000 USDC/day) with no way to tighten them. Defaults
are now restrictive named constants (500 USDC/tx, 5,000 USDC/day) and
raising them requires an explicit owner-authorized update_policy call.
Defaults documented in DEPLOY.md.

Close Stellar-Ecosystem#323

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@raymondidahor-bot 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

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 26b1e530-dcc8-48aa-a8ad-583520457b9a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Agents: default spending limits are dangerously permissive

1 participant