-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add methods param for RPC state_traceBlock
#9642
Conversation
Signed-off-by: koushiro <[email protected]>
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.
Looks reasonable to me
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, modulo a few questions and suggestions.
client/rpc-api/src/state/mod.rs
Outdated
/// If an empty string is specified no events will be filtered out. If anything other than | ||
/// an empty string is specified, events will be filtered by method (so non-method events will | ||
/// **not** show up). |
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.
What happens if the caller specifies both storage_keys
and methods
? Is there a priority? Or Invalid Params
error (this would be my preference)? Either way it'd be good to document the behaviour.
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.
Dumb question: what is the expected format of these methods? Is it the Rust name or some other convention (JS?)? A short example here would be valuable to newcomers I think.
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.
What happens if the caller specifies both
storage_keys
andmethods
? Is there a priority?
I prefer the priority of filter conditions to be determined according to the order of declaration of rpc parameters. (Currently, storage_keys
is filtered first, then methods)
what is the expected format of these methods?
These methods
are just ordinary string format, you could find these methods by rg "method = " primitives/state-machine/src/ext.rs
A short example here would be valuable to newcomers I think.
Yes, I will add a simple example into doc
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.
I prefer the priority of filter conditions to be determined according to the order of declaration of rpc parameters. (Currently,
storage_keys
is filtered first, then methods)
Fair. Can you document that behaviour please?
@@ -35,6 +35,9 @@ pub struct BlockTrace { | |||
/// Storage key targets used to filter out events that do not have one of the storage keys. | |||
/// Empty string means do not filter out any events. | |||
pub storage_keys: String, | |||
/// Method targets used to filter out events that do not have one of the event method. | |||
/// Empty string means do not filter out any events. |
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.
I wonder if this empty string business is going to come back and bite us one day. Ideally we'd have an Option<String>
here, but I understand why you went with the same we had before.
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
@@ -258,6 +258,15 @@ pub trait StateApi<Hash> { | |||
/// http://localhost:9933/ | |||
/// ``` | |||
/// | |||
/// - Get tracing events with all `storage_keys` and method ('Put') |
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.
👍
bot merge |
Trying merge. |
Signed-off-by: koushiro [email protected]
Summary
Add
methods
param for RPCstate_traceBlock
to fetch all changed storages for a given block.Close #9632
Example