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(admin): create admin namespace and add paymaster clear / toggle for reputation #570

Merged
merged 14 commits into from
Feb 2, 2024

Conversation

0xfourzerofour
Copy link
Collaborator

@0xfourzerofour 0xfourzerofour commented Jan 26, 2024

[Closes] #543 #528

Proposed Changes

current logic

  • Create 3 new methods admin_togglePaymasterTracker, admin_toggleReputationTracker and admin_clearPaymasterTrackerState

ideal logic

While working on this I realized how much I do not like the current reputation manager setup and would like to refactor quickly before this ticket is merged. Currently the strange seperation beween the locked pool paymaster logic and the locked reputation makes things inconsistent.

I started this feature by separating the toggle and clear functions per datastructure like reputation and paymaster however I think it would be better to have 2 admin methods.

  • admin_clearState in which there is an enum in the params to choose what state to clear, and if ALL is specified we can clear the pool state. This creatly reduces the amount of boiler plate code needed to get this feature working well.
  • admin_setTracking in which there is an enum in the params to choose what state to clear, and if ALL is specified we can toggle the pool tracking of each option paymaster or reputation. This also reduces the amount of boiler plate code needed.

I also would like to move the reputation state within the locked pool state to keep things consistent.

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 141 lines in your changes are missing coverage. Please review.

Comparison is base (0099370) 57.06% compared to head (33c6549) 56.81%.

Additional details and impacted files

Impacted file tree graph

Files Coverage Δ
bin/rundler/src/cli/rpc.rs 0.00% <ø> (ø)
crates/pool/src/mempool/mod.rs 87.36% <ø> (ø)
crates/pool/src/server/mod.rs 25.00% <ø> (ø)
crates/pool/src/task.rs 0.00% <0.00%> (ø)
crates/rpc/src/task.rs 0.00% <0.00%> (ø)
crates/pool/src/mempool/pool.rs 93.32% <90.90%> (-0.29%) ⬇️
crates/rpc/src/debug.rs 0.00% <0.00%> (ø)
crates/rpc/src/types.rs 28.37% <0.00%> (-0.79%) ⬇️
crates/pool/src/mempool/paymaster.rs 92.40% <94.73%> (+0.13%) ⬆️
bin/rundler/src/cli/pool.rs 0.00% <0.00%> (ø)
... and 6 more
Flag Coverage Δ
unit-tests 56.81% <42.68%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
rundler binary 0.00% <0.00%> (ø)
builder 50.09% <ø> (ø)
dev 0.00% <ø> (ø)
pool 63.17% <51.21%> (-0.55%) ⬇️
provider 0.91% <ø> (ø)
rpc 36.16% <0.00%> (-1.03%) ⬇️
sim 83.51% <ø> (ø)
tasks ∅ <ø> (∅)
types 90.25% <ø> (ø)
utils 14.96% <ø> (ø)

Comment on lines +148 to +149
// Only return an error if tracking is enabled
if paymaster_metadata.pending_balance.lt(&max_op_cost) && self.tracker_enabled {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something that confused me about the naming conventions here. We're still actually preforming the tracking, correct? We're just not allowing the tracking to cause UOs to be rejected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeh the naming was something I was not too sure about either. Maybe like only_tracking or blocking_enabled would be more fit for purpose

@@ -104,7 +104,7 @@ where
async fn bundler_clear_mempool(&self) -> RpcResult<String> {
let _ = self
.pool
.debug_clear_state(true, false)
.debug_clear_state(true, true, false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Double checking this, we want clear_mempool to clear paymaster tracking? It seems like we should have the clear_mempool bool just wipe out the pending paymaster balances, without actually wiping the whole paymaster tracker.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeh this one I was sort of pre-empting another pr that I am working on that changes how the mempool is split up as I think the pool state should be seperate from paymaster and reputation as they are not directly tied to the pool they are just used to track existing and incoming user ops.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And also moving the reputation into the same level as the pool so that we do not need that interface

Copy link
Collaborator

Choose a reason for hiding this comment

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

So we want to leave this as true for clearing the paymaster tracking?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeh I think leave it for true if we want to clear the mempool as the paymaster tracking relies on operation id's that are in the mempool

Copy link
Collaborator

@dancoombs dancoombs left a comment

Choose a reason for hiding this comment

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

Couple small things, mostly LGTM

@dancoombs
Copy link
Collaborator

Related: #573

Copy link
Collaborator

@dancoombs dancoombs left a comment

Choose a reason for hiding this comment

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

LGTM, just want to make sure that flag is set correctly.

@0xfourzerofour 0xfourzerofour merged commit 96bd95b into main Feb 2, 2024
6 checks passed
@0xfourzerofour 0xfourzerofour deleted the josh/reputation-paymaster-flag branch February 2, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants