Skip to content
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

test: access keys scenarios in meta transactions #8570

Merged
merged 5 commits into from
Feb 22, 2023

Conversation

jakmeier
Copy link
Contributor

Final set of tests to complement the integration tests listed in #8467.

Final set of tests to complement the integration tests listed in near#8467.
@jakmeier jakmeier requested a review from a team as a code owner February 14, 2023 15:07
assert_eq!(
allowance.unwrap(),
initial_allowance,
"allowance should not change, we used the relayer's fund not the sender's"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also check relayer’s and sender’s balance to validate that relayer’s funds been used and that sender’s overall balance was also left untouched (regardless of what the kay’s allowance says?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_meta_tx_fn_call does all these checks already, including complicated balance calculations for the 30% contract rewards and all that jazz

deposit: 0,
})];

let tx_result = node.user().meta_tx(sender, receiver, relayer, actions).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an unfortunate amount of duplication between the three tests added here? Would it be possible to consolidate them somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried my best to reduce duplication, but the consolidated function need an awful lot of parameters. See my latest commit.

In terms of LOC, I ended up with more code than before. But I think it's still an improvement, as the logical duplication is reduced. Not sure if the code is cleaner to read though.

test-utils/testlib/src/runtime_utils.rs Outdated Show resolved Hide resolved
test-utils/testlib/src/runtime_utils.rs Outdated Show resolved Hide resolved
@near-bulldozer near-bulldozer bot merged commit fce79bc into near:master Feb 22, 2023
@jakmeier jakmeier deleted the meta-tx-integrations-tests-5 branch February 22, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants