-
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
[GRPC] Simple Transaction Filtering #13715
Conversation
ade83ae
to
1c4d87c
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.
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.
1c4d87c
to
06ffae9
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.
06ffae9
to
c51f147
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.
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.
Just a few extra comments, I left most of my initial feedback in #13715.
@@ -619,7 +622,7 @@ libfuzzer-sys = "0.4.6" | |||
libsecp256k1 = "0.7.0" | |||
log = "0.4.17" | |||
lru = "0.7.5" | |||
lz4 = "1.24.0" | |||
lz4 = "1.25.0" |
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'm assuming this doesn't cause issues with anything else in aptos-core?
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 looked at the changelog, seems fine.
#[serde(deny_unknown_fields)] | ||
#[derive(derive_builder::Builder)] | ||
#[builder(setter(strip_option), default)] | ||
pub struct UserTransactionFilter { |
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 just took this library for a spin and immediately tried to do things like UserTransactionFilter::builder()
and UserTransactionFilter::sender()
, before ultimately looking at the derive_builder docs and realizing I want UserTransactionFilterBuilder
.
Two things:
- Could we maybe mention this in the doc comments?
- Maybe something less heavyweight / more obvious would be to add a
builder
method as the first method for all of these structs that just returns a newThingBuilder
. Maybe derive_builder can even help with that.
pub mod filters; | ||
pub mod traits; | ||
|
||
// re-export for convenience |
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.
In practice I had to do these imports too:
use aptos_transaction_filter::{
boolean_transaction_filter::APIFilter, filters::UserTransactionFilterBuilder,
};
Maybe more should be exposed at the top level by default. I doubt we'll see name clashes.
/** | ||
* This is a convenience method to allow for the error to be annotated with the filter type/path at each level | ||
* This is the public API for checking the validity of a filter! | ||
* Example output looks like: | ||
* ```text | ||
* FilterError: This is a test error!. | ||
* Trace Path: | ||
* transaction_filter::traits::test::InnerStruct: {"a":"test"} | ||
* core::option::Option<transaction_filter::traits::test::InnerStruct>: {"a":"test"} | ||
* transaction_filter::traits::test::OuterStruct: {"inner":{"a":"test"}} | ||
* ``` | ||
**/ |
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.
Needs to be ///
for it to be a doc comment. Maybe intentional that it isn't one? Seems like it should be though.
let res = outer.is_valid(); | ||
assert!(res.is_err()); | ||
let error = res.unwrap_err(); | ||
assert_eq!(error.to_string(), "Filter Error: This is a test error!\nTrace Path:\naptos_transaction_filter::traits::test::InnerStruct: {\"a\":\"test\"}\ncore::option::Option<aptos_transaction_filter::traits::test::InnerStruct>: {\"a\":\"test\"}\naptos_transaction_filter::traits::test::OuterStruct: {\"inner\":{\"a\":\"test\"}}"); |
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.
Nit, to make this more readable can we use a raw string or indoc or something for the assertion?
|
||
Or, if you prefer, as yaml: | ||
|
||
```yaml |
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.
Now that this is using just 0.8.x of serde_yaml does this still work? I assume so, looks fine, just calling it out in case.
Moving my approval over here from aptos-labs/aptos-indexer-processors#398 |
c51f147
to
ce4b9be
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Seeing this error in the tests in CI but not locally (with both normal cargo test and cargo nextest), investigating:
Update: I see this PR updates lz4 to 1.25 whereas in the original repo and here it is 1.24. I'll try going back to 1.24. Update: No cigar, debugging further here: https://aptos-org.slack.com/archives/C04PF1X2UKY/p1718969817705389. |
8af264b
to
7bb79e3
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.
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.
7bb79e3
to
e88bfa7
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.
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.
e88bfa7
to
8482bb7
Compare
8482bb7
to
7815ce6
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
|
Description
an MVP version of the transaction filtering crate, to performantly filter out API streams of transactions
This PR: aptos-labs/aptos-indexer-processors#398 but in aptos-core as otherwise there are dependency issues
Performance
On a random 3mb proto of 1000txns during taptos, running the "everything" filter (looped) gives:
Random 10mb proto from April 25th with "everything" filter:
Graffio 100mb proto ("everything" filter, but with
or
):More advanced feature complete version here: aptos-labs/aptos-indexer-processors#392
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
Key Areas to Review
Checklist