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: better introspection for encumbered magnitude #1038

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

wadealexc
Copy link
Collaborator

@wadealexc wadealexc commented Jan 17, 2025

Reasoning: current encumberedMagnitude is a public getter that returns the non-updated version of an operator's encumbered magnitude.

When actually calling modifyAllocations, we use the updated version -- so this is probably more relevant to expose.

This PR makes the encumberedMagnitude mapping internal, and instead exposes a getter (getEncumberedMagnitude) that returns the current encumbered magnitude with completable deallocations included.

@wadealexc wadealexc force-pushed the alex/alm-magnitude-introspect branch 2 times, most recently from bc82389 to 03e41ea Compare January 17, 2025 19:36
@wadealexc wadealexc force-pushed the alex/alm-magnitude-introspect branch from 03e41ea to 321ff35 Compare January 17, 2025 19:58
@wadealexc wadealexc changed the title feat(wip): better introspection for encumbered magnitude feat: better introspection for encumbered magnitude Jan 17, 2025
@wadealexc wadealexc marked this pull request as ready for review January 17, 2025 19:59
Copy link
Collaborator

@ypatil12 ypatil12 left a comment

Choose a reason for hiding this comment

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

LGTM, one non-blocking nit. Would also be good to have a test confirming expected behavior of the view func

src/contracts/core/AllocationManagerStorage.sol Outdated Show resolved Hide resolved
@wadealexc
Copy link
Collaborator Author

LGTM, one non-blocking nit. Would also be good to have a test confirming expected behavior of the view func

So it doesn't really look like it because the updates I made to tests were very small, but the updated unit tests actually do check that the new function behaves correctly.

I was also planning to further dig into this in integration tests -- this version of getting encumbered magnitude makes integration test invariant/assertion writing much easier :)

Copy link
Collaborator

@8sunyuan 8sunyuan left a comment

Choose a reason for hiding this comment

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

LGTM, the only code smell to me is how these view functions are implemented differently from the internal logic but thats been the case for a while. A bit late for a refactor.

@wadealexc wadealexc merged commit 4bde5b5 into slashing-magnitudes-fixes Jan 21, 2025
11 checks passed
@wadealexc wadealexc deleted the alex/alm-magnitude-introspect branch January 21, 2025 16:16
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