-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[API] Add filter support for view and simulate #11666
Conversation
bd75d6f
to
999d6b3
Compare
999d6b3
to
76257fa
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just disable view functions on the node?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We want something more granular. If one view function is being called a lot and hurting the node we'd like to disable that function specifically without killing all other view functions. We can't realistically disable view functions on our public node APIs without causing massive damage to ecosystem projects. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one comment
api/src/view_function.rs
Outdated
view_function.module.name().as_str(), | ||
view_function.function.as_str(), | ||
) { | ||
return Err(BasicErrorWith404::bad_request_with_code_no_info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be a 403?
76257fa
to
0c517d8
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
❌ Forge suite
|
) { | ||
return Err(SubmitTransactionError::forbidden_with_code( | ||
"Transaction not allowed by simulation filter", | ||
AptosErrorCode::InvalidInput, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arguably, it could possibly be a different code, but that's fine. InvalidInput always requires user intervention.
Description
This is one short term solution to the overall problem of nodes being overwhelmed by computationally expensive functions to the point where they can't even state sync.
Test Plan
View Functions
Start local testnet:
Stop it, add
0x1::coin::balance
to the config in the blocklist:Start local testnet again:
Try to call view function from the explorer, get this response:
Other view functions work fine.
I also tested allowlist and the no list and it worked as expected.
Simulation
Same procedure at first as above but we add this config:
Calling the function with the CLI you get this error: