-
Notifications
You must be signed in to change notification settings - Fork 154
Migrate mocked test to alloy #3930
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
Conversation
| let asserter = Asserter::new(); | ||
| let provider = ProviderBuilder::new().connect_mocked_client(asserter.clone()); | ||
|
|
||
| asserter.push_success(&U256::from(1337).abi_encode()); |
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.
Unfortunate that we apparently can't assert anything on the request but this logic is called a lot during e2e tests anyway.
| .expect(&format!("should have a spender key {:?}", spender)); | ||
| assert_eq!(allowances.spender, spender); | ||
| // We don't check which of the two (0x11, 0x22) got the error vs the result | ||
| // because it's order dependent and without a custom mock transport just for |
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.
It would be possible to build the hashset with a seeded hasher to make the order stable, right?
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.
The result hashmap is built inside and that's the one we check against, so I don't think so? Unless you mean changing the fetch_allowances code
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.
IIUC we primarily need to ensure that the requests we pass into fetch_allowances are handled in a deterministic fashion. The out hashmap only has 1 entry so order doesn't matter there and if the inner hashset (line 384) has stable ordering the resulting RPC requests should be sent to the mock provider in a deterministic order as well.
The order of the result hashmap doesn't matter since we can just look up the results with the key.
OTOH this relies on implementation details so changing those might result in a failing tests even if the output might not change.
MartinquaXD
left a comment
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.
Fine to merge after fixing the remaining lint.
Description
Migrates the fetch_skips_failed_allowance_calls test to alloy, directly addressing this comment
#3927 (comment)
Changes
How to test
Existing tests