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

refactor: create senders based on escrow account version #624

Merged
merged 9 commits into from
Feb 12, 2025

Conversation

gusinacio
Copy link
Contributor

@gusinacio gusinacio commented Feb 11, 2025

This PR aims to enable creation of two kinds of SenderAccounts:

  • Legacy Account
  • Horizon Account

Actor names now have the type as a prefix and they pass different versions of the escrow_account_watcher, depending on the type (since there'll be different queries).

Actors receive their enum SenderType so they can route and query properly the corresponding db tables.

For future PRs:

  • Implement all unimplemented parts, specially the sender state (allow, deny)
  • Implement todo!() query for escrow accounts v2

Extras:

  • just ci command that performs all ci checks
  • fix test-log to output correctly tracing logs

@gusinacio gusinacio changed the title refactor: create senders based on escrow account refactor: create senders based on escrow account version Feb 11, 2025
@gusinacio gusinacio force-pushed the gustavo/horizon-escrow branch 5 times, most recently from f2a47e1 to cdb15fa Compare February 12, 2025 13:28
@gusinacio gusinacio marked this pull request as ready for review February 12, 2025 13:31
@@ -95,12 +95,33 @@ pub async fn escrow_accounts(
reject_thawing_signers: bool,
) -> Result<EscrowAccountsWatcher, anyhow::Error> {
indexer_watcher::new_watcher(interval, move || {
get_escrow_accounts(escrow_subgraph, indexer_address, reject_thawing_signers)
get_escrow_accounts_v1(escrow_subgraph, indexer_address, reject_thawing_signers)
})
.await
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this function should be renamed to escrow_accounts_v1, it can make it a bit confusing? since in every other spot you are making the difference in the names between v1 and v2 and this could give the idea is generic for both versions

Copy link
Contributor Author

@gusinacio gusinacio Feb 12, 2025

Choose a reason for hiding this comment

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

You are absolutely right, I just didn't want to change this because it would have tons of other changes (since it's also used in service).

I could I do this renaming in a follow-up PR, unless you think it's mandatory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe just create an issue so that this is not forgotten?

) -> anyhow::Result<EscrowAccounts> {
Ok(EscrowAccounts::new(HashMap::new(), HashMap::new()))
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Add TODO: Change query for temporary implementation of subgraph handling both v1 and V2

Copy link
Contributor Author

@gusinacio gusinacio Feb 12, 2025

Choose a reason for hiding this comment

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

There's already a TODO on top of the function. Do you want me to change the message?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just tried to mean that the current comment kind of only sounds for v2 and we might need to modify also v1 query later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment you change the provided schema old queries will break so you will quickly realize that you need to change the query.

On the other hand, this won't break and that's why there's a TODO

justfile Show resolved Hide resolved
@gusinacio gusinacio force-pushed the gustavo/horizon-escrow branch from 4051582 to da09924 Compare February 12, 2025 19:04
Signed-off-by: Gustavo Inacio <[email protected]>
suchapalaver
suchapalaver previously approved these changes Feb 12, 2025
@gusinacio gusinacio requested a review from carlosvdr February 12, 2025 19:08
@suchapalaver
Copy link
Collaborator

Nice one @gusinacio taking inspiration from #625 👍

@gusinacio gusinacio merged commit 375e25c into main Feb 12, 2025
10 checks passed
@gusinacio gusinacio deleted the gustavo/horizon-escrow branch February 12, 2025 19:38
@coveralls
Copy link

coveralls commented Feb 13, 2025

Pull Request Test Coverage Report for Build 13292922750

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 199 of 303 (65.68%) changed or added relevant lines in 5 files are covered.
  • 42 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.5%) to 77.127%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/tap-agent/src/test.rs 13 16 81.25%
crates/tap-agent/src/agent/sender_account.rs 59 66 89.39%
crates/tap-agent/src/agent.rs 0 11 0.0%
crates/monitor/src/escrow_accounts.rs 2 20 10.0%
crates/tap-agent/src/agent/sender_accounts_manager.rs 125 190 65.79%
Files with Coverage Reduction New Missed Lines %
crates/tap-agent/src/agent/sender_accounts_manager.rs 42 77.0%
Totals Coverage Status
Change from base Build 13291342224: -0.5%
Covered Lines: 8150
Relevant Lines: 10567

💛 - Coveralls

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