Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(solver): check target before accept #2478

Merged
merged 1 commit into from
Nov 14, 2024
Merged

feat(solver): check target before accept #2478

merged 1 commit into from
Nov 14, 2024

Conversation

kevinhalliday
Copy link
Contributor

Only accept if know target, and call / deposits are verified.

issue: none


func (t Targets) ForCall(call bindings.SolveCall) (Target, bool) {
for _, target := range t {
if target.IsAllowedCall(call) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should error if multiple targets are matched?

Copy link
Collaborator

Choose a reason for hiding this comment

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

mmm, should we use the inbox or outbox contract address to identify the target? Picking any target that matches feels a bit loose?

Copy link
Collaborator

Choose a reason for hiding this comment

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

non matching calls will also be hard to debug since we can't see what rules are expected and why they are failing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should error if multiple targets are matched?

Yeah would help us catch bugs / bad target config.

mmm, should we use the inbox or outbox contract address to identify the target? Picking any target that matches feels a bit loose?

We will still be executing through the outbox. And there is a difference between outbox allowing or not allowing a call (which it does). And a target saying "yes this is an allowed call".

We can also add an outbox check.

non matching calls will also be hard to debug since we can't see what rules are expected and why they are failing

Yeah good point we do need to consider debugging.

"is this call one we support?" (target.IsAllowedCall)

Here we filter out chains / contracts / functions selectors we don't support. Here I think we can

Request for unsupported call   dest_chain="holeskey" target_contract="0x..." target_selector="0x..."

then "should I make this supported call?" (target.Verify)

Here we can log the error returned by verify

Request rejected for target      reason="insufficient deposits"   target="symbiotic" dest_chain="holeskey" ...

@kevinhalliday kevinhalliday merged commit b0b379d into main Nov 14, 2024
19 checks passed
@kevinhalliday kevinhalliday deleted the kh/solving branch November 14, 2024 15:43
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.

2 participants