-
Notifications
You must be signed in to change notification settings - Fork 438
docs: add StrategyBase accounting doc #1233
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this!
I think it is well-targeted to an audience that seeks to understand the basic shares accounting model. Additionally, since the use (at least so far) has really just been to handle rebasing tokens, the focus on explaining a bit about them + using them as motivation seems apt.
This does not cover "share-inflation" attacks or the chosen mitigation strategy, but I suspect that those topics may be of a greater technical depth than you were aiming for here.
So depending on the target audience, I think this either seems done or like more could be added.
039303f
to
fb1e159
Compare
@MinisculeTarantula Thank you for the review! The first iteration covered the basics, and I've now added the technical depth on the attack vectors you reference. Please have another look at the newly added sections 🙏 |
* Alice's shares: **1** | ||
* Alice's "deserved" token balance: **1e6 + 1** | ||
|
||
Note the large difference between the `StrategyBase`'s token balance and the number of shares. As mentioned before, the exchange rate is now 1e6 tokens : 1 share. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: it's actually (1e6 + 1) tokens : 1 share
but idk, probably it's clearer without this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree the exchange rate is a bit awkward, I think that readers will strongly prefer the accuracy! Thanks for the callout
|
||
* Bob's 1000 tokens * 1 share / 1e6 tokens = 1e-3 shares = 0 shares | ||
|
||
Due to the large divisor, Bob's received shares are now 1e-3, a very small number, which is *effectively 0* due to EVM division. Thus, **Bob receives no shares for his token deposit**. This is a problem, as he is entitled to 1000 tokens, but has no shares for withdrawing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion for a change: which is *effectively 0* due to EVM division
=> which is rounded to zero due to EVM division
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7d4e647
to
9a3dc19
Compare
Certora Run Started (Eigenlayer Contracts)
Certora Run Summary
|
Certora Run Started (Eigenlayer Contracts)
Certora Run Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verification Results
- Group ID: d4eb6127-dbf3-4e6c-8877-1203ebb35e06
Job | Status | Result | VERIFIED | Link |
---|---|---|---|---|
permissions/Pausable.conf | SUCCEEDED | ✅ | 2 | Link |
strategies/StrategyBase.conf | SUCCEEDED | ✅ | 2 | Link |
core/AllocationManager.conf | SUCCEEDED | ✅ | 15 | Link |
core/AllocationManagerSanity.conf | SUCCEEDED | ✅ | 2 | Link |
pods/EigenPodManagerRules.conf | SUCCEEDED | ✅ | 9 | Link |
core/StrategyManager.conf | SUCCEEDED | ✅ | 6 | Link |
core/DelegationManagerValidState.conf | SUCCEEDED | ✅ | 11 | Link |
core/DelegationManager.conf | SUCCEEDED | ✅ | 9 | Link |
Motivation:
This PR adds documentation about the
StrategyBase
contract and the shares model, as well as answers to some common questions about the accounting model.Specifically, it covers:
StrategyBase
contractStrategyBase
contract and any residual risk & side effectsModifications:
docs/core/accounting/SlashingEdgeCase.md
todocs/core/accounting/DualSlashingEdgeCase.md
(for clarity)Result:
More clarity on how
StrategyBase
does shares accounting!