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

feat(walletManager): add shouldRecordUsage option and tests #88

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

md0x
Copy link
Contributor

@md0x md0x commented Sep 18, 2024

Changes proposed in this PR:

  • Introduced shouldRecordUsage optional boolean argument to getWallet and getSharedWallet methods.
  • Added tests to verify the functionality of the shouldRecordUsage option.
  • Implemented to avoid recording usage when finding an unlock in findUnlock function.

@md0x md0x marked this pull request as draft September 18, 2024 09:06
}
}
}
let selectedWallet = this.findAssignedWallet(ovalInstance);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small refactoring to simplify getSharedWallet by pulling out this logic.

@md0x md0x force-pushed the pablo/find-unlock-shared-wallets branch 2 times, most recently from 36b98db to 877b870 Compare September 18, 2024 10:19
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
@md0x md0x force-pushed the pablo/find-unlock-shared-wallets branch from 877b870 to 75e2276 Compare September 18, 2024 10:22
@md0x md0x marked this pull request as ready for review September 18, 2024 10:33
@md0x md0x changed the title feat(walletManager): add skipUsageRecording option and tests feat(walletManager): add shouldRecordUsage option and tests Sep 18, 2024
Copy link
Member

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -99,7 +101,7 @@ export const getUnlockBundlesFromOvalAddresses = async (
targetBlock,
ovalAddress,
req,
false,
false, // Do not simulate
Copy link
Member

Choose a reason for hiding this comment

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

What does this comment mean? If we're not simulating, wouldn't this be true...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simulate has a default value of true, but here we are not simulating. I added the comment because now we have a second optional boolean argument, shouldRecordWalletUsage, so it’s easier to read.

) => {
const unlocks = await Promise.all(
getOvalAddresses().map(async (ovalAddress) =>
prepareUnlockTransaction(flashbotsBundleProvider, backrunTxs, targetBlock, ovalAddress, req),
// Do not record wallet usage here as we will record it in the loop below once we find a valid unlock.
Copy link
Member

Choose a reason for hiding this comment

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

+1

@md0x md0x merged commit 91c16b9 into development Sep 20, 2024
1 check passed
@md0x md0x deleted the pablo/find-unlock-shared-wallets branch September 20, 2024 12:36
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.

2 participants