Skip to content

Restrict adapter calls to registered agents only#1730

Draft
yrong wants to merge 4 commits intomainfrom
ron/enforce-agent-call-adapter
Draft

Restrict adapter calls to registered agents only#1730
yrong wants to merge 4 commits intomainfrom
ron/enforce-agent-call-adapter

Conversation

@yrong
Copy link
Contributor

@yrong yrong commented Mar 2, 2026

No description provided.

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.80%. Comparing base (e7fa333) to head (0137696).

Files with missing lines Patch % Lines
...ntracts/src/l2-integration/SnowbridgeL2Adaptor.sol 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1730      +/-   ##
==========================================
+ Coverage   75.20%   78.80%   +3.59%     
==========================================
  Files          24       24              
  Lines         996     1000       +4     
  Branches      186      188       +2     
==========================================
+ Hits          749      788      +39     
+ Misses        223      186      -37     
- Partials       24       26       +2     
Flag Coverage Δ
solidity 78.80% <83.33%> (+3.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +32 to +33
Agent(payable(msg.sender)).GATEWAY() == GATEWAY,
"Caller is not a registered Gateway Agent"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Agent(payable(msg.sender)).GATEWAY() == GATEWAY,
"Caller is not a registered Gateway Agent"
IGatewayV2(GATEWAY).isAgent(msg.sender),
"Caller is not a registered Gateway Agent"

Otherwise someone can deploy a contract that returns the expected GATEWAY address from a GATEWAY() function without actually being a real Agent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test in #1733 to demonstrate.

Copy link
Contributor Author

@yrong yrong Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

It seems we don't have IGatewayV2(GATEWAY).isAgent(msg.sender) implemented yet? To achieve this, I assume we would need an additional mapping from agent address to ID in storage?

mapping(bytes32 agentID => address) agents;

@yrong yrong marked this pull request as draft March 3, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants