Skip to content

Refactor to allow for single sponsorWallet updates #296

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

Merged
merged 39 commits into from
May 16, 2024

Conversation

acenolaza
Copy link
Contributor

@acenolaza acenolaza commented May 2, 2024

What does this change?

It basically applies suggestion made here to allow sending txs using a single sponsor wallet. This is meant to be used by a deployment used a fallback that should send txs whenever main airseeker deployments are down their sponsorWallets have run out of funds for some reason. This fallback deployment also makes our lives easier by not having to top-up the sponsorWallet of each dAPI.

  1. Adds a new wallet derivation scheme type called fallback
  2. It also adds a new property to walletDerivationScheme config object called sponsorAddress. This property must be set to a valid address when walletDerivationScheme.type is fallback
  3. pendingTransactionsInfo objects are now keyed by dataFeedId instead of sponsorWalletAddress
  4. The getRecommendedGasPrice() nows receives an array of dataFeedIds instead of a single sponsorWalletAddress as argument and it only uses the oldest pendingTransactionsInfo (when more than 1 dataFeedId is passed)
  5. There is a new submitBatchTransaction() function that bundles all the calldatas required to update all data feeds in the batch and sends a single tryMulticall() tx.

@acenolaza acenolaza requested review from Siegrift and bdrhn9 May 2, 2024 18:40
@acenolaza acenolaza self-assigned this May 2, 2024
@acenolaza acenolaza force-pushed the single-sponsor-wallet branch from 5411f65 to 6cf0255 Compare May 2, 2024 18:48
@acenolaza acenolaza force-pushed the single-sponsor-wallet branch from 6cf0255 to 6c7985d Compare May 2, 2024 18:52
@bbenligiray
Copy link
Member

bbenligiray commented May 3, 2024

It also adds a new property to walletDerivationScheme config object called sponsorWallet.

Looks like you mean sponsorAddress.

I dislike "fallback", something like "fixed" would be semantically less restrictive

pendingTransactionsInfo objects are now keyed by dataFeedId instead of sponsorWalletAddress

I thought we decided not to touch this on a recent call. Doesn't self-funded scheme update the same data feed (with ID) using multiple sponsor wallets belonging to different update parameters?

@acenolaza
Copy link
Contributor Author

acenolaza commented May 3, 2024

Looks like you mean sponsorAddress.

Good catch. Updated comment

I dislike "fallback", something like "fixed" would be semantically less restrictive

👍🏻

I thought we decided not to touch this on a recent call.

That is correct but Emanuel made a good suggestion where by doing this change, retries get mostly fixed for single wallet

Doesn't self-funded scheme update the same data feed (with ID) using multiple sponsor wallets belonging to different update parameters?

🤔 that is a good question and it seems we could be scaling the gas price for wallets that might not need it when self-funded is set. @Siegrift any thoughts on this? Maybe we can use both as keys 🤔

pendingTransactionsInfo: Record<
    ChainId,
    Record<string /* Provider name */, Record<Address /* Sponsor wallet */, Record<Hex /* Data Feed ID */, PendingTransactionInfo | null>>>
  >;

@acenolaza
Copy link
Contributor Author

Maybe we can use both as keys 🤔

Implemented that here I'll wait for comments 🙏🏻

Copy link
Collaborator

@Siegrift Siegrift left a comment

Choose a reason for hiding this comment

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

Doesn't self-funded scheme update the same data feed (with ID) using multiple sponsor wallets belonging to different update parameters?

🤔 that is a good question and it seems we could be scaling the gas price for wallets that might not need it when self-funded is set. @Siegrift any thoughts on this? Maybe we can use both as keys 🤔

Currently, Airseeker can update the same data feed using different wallets for self-funded (as @bbenligiray suggests in the question), but it can also happen when there are 2 active data feed using the same data feed ID (e.g. one identified by ID, one by dapiName). Airseeker now treats these separate and scales them independently. There is no case, where a single wallet updates multiple data feeds, so key-ing by both data feed ID and sponsor address solves the problem for "fixed" wallet derivation.

Another question is whether it doesn't make sense for this to only key this by data feed ID. In both managed/self-funded there we will be scaling unnecessarily (in the self-funded it depends on how often the deviation is triggered for multiple deviating feeds - but that seems probably enough). So I think it doesn't and we should do what you suggest.

I dislike "fallback", something like "fixed" would be semantically less restrictive

fwiw: I don't have a strong opinion about this.

@acenolaza acenolaza marked this pull request as ready for review May 7, 2024 21:26
@acenolaza acenolaza requested a review from Siegrift May 7, 2024 21:26
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this module copy-pastes a lot of existing functionality. Also, some changes are unnecessary and can be reverted.

Copy link
Collaborator

@Siegrift Siegrift left a comment

Choose a reason for hiding this comment

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

FYI: I've edited the spec about the wallet derivation types here

@acenolaza acenolaza requested review from Siegrift and bdrhn9 May 14, 2024 19:57
Copy link
Collaborator

@Siegrift Siegrift left a comment

Choose a reason for hiding this comment

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

Can you rebase please? I'll review then.

@acenolaza acenolaza requested a review from Siegrift May 15, 2024 14:07
Copy link
Collaborator

@Siegrift Siegrift left a comment

Choose a reason for hiding this comment

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

👍 Implementation looks good to me, but wait for @bdrhn9 's approve as well as this is a quite a significant change.

I think we already talked about this internally, but this should be tested on testnets before we attempt to roll it out for mainnets.

Copy link
Contributor

@bdrhn9 bdrhn9 left a comment

Choose a reason for hiding this comment

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

Changes looks clean and good to me 💪🏼

@acenolaza
Copy link
Contributor Author

Thank you both for all the feedback! 🚀

@acenolaza acenolaza closed this May 16, 2024
@acenolaza acenolaza reopened this May 16, 2024
@acenolaza
Copy link
Contributor Author

Thank you both for all the feedback! 🚀

Should I just merge now? How should we test these changes? Do you guys deploy to a testnet to verify everything is still working as expected?

@bdrhn9
Copy link
Contributor

bdrhn9 commented May 16, 2024

Thank you both for all the feedback! 🚀

Should I just merge now? How should we test these changes? Do you guys deploy to a testnet to verify everything is still working as expected?

I think changes looks good and mergeable. I will test these changes by deploying on one testnet. Maybe I'll remove actual deployment on that specific testnet to see whether our fallback airseeker gain control over.

@acenolaza acenolaza merged commit adf2585 into main May 16, 2024
8 checks passed
@acenolaza acenolaza deleted the single-sponsor-wallet branch May 16, 2024 16:15
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.

4 participants