-
Notifications
You must be signed in to change notification settings - Fork 707
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
Limit datastore keys query #4805
base: mainnet_2_3
Are you sure you want to change the base?
Conversation
@@ -46,6 +46,8 @@ pub struct NodeStatus { | |||
pub chain_id: u64, | |||
/// minimal fees to include an operation in a block | |||
pub minimal_fees: Amount, | |||
/// current mip version | |||
pub current_mip_version: u32, |
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.
is this a rebase artifact ?
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.
cherry picked the commit, the difference will disappear when mip_versionning will be merged into main_2_3
@@ -39,6 +39,8 @@ | |||
enable_broadcast = false | |||
# deferred credits delta (in milliseconds) | |||
deferred_credits_delta = 7776000000 # ~ 3 months (90×24×60×60×1000) in milliseconds | |||
# max datastore keys query (also used by GRPC API) | |||
#max_datastore_keys_query = 500 |
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.
there should be 2 distinct config parameters:
- max datastore keys queries: limits the number of simultaneous key queries in the api
- max datastore keys limit : limits the number of keys returned by a single query
@@ -458,6 +463,12 @@ impl MassaRpcServer for API<Public> { | |||
let config = CompactConfig::default(); | |||
let now = MassaTime::now(); | |||
|
|||
let current_mip_version = self |
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.
rebase artifact ?
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.
@@ -555,6 +566,7 @@ impl MassaRpcServer for API<Public> { | |||
current_cycle, | |||
chain_id: self.0.api_settings.chain_id, | |||
minimal_fees: self.0.api_settings.minimal_fees, | |||
current_mip_version, |
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.
rebase artifact ?
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.
} | ||
_ => { | ||
return Err( | ||
ApiError::ExecutionError("unexpected response".to_string()).into() |
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.
note: this is also triggered when keys from a non-existing address are queried, which is not unexpected but could be quite common
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.
same comment elsewhere
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.
Here we match for the type of enum ExecutionQueryResponseItem
, we can't have anything else than AddressDatastoreKeys type. So i return an Error "in case if"
For NotFound error, it will be triggered at line 996 with 'ExecutionQueryError'
&self, | ||
addr: &Address, | ||
prefix: &[u8], | ||
offset: Option<Bound<Vec<u8>>>, |
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.
do not use Option<Bound>
, use the variant Bound::Unbounded
when we don't want a bound
resync_check
flag