Skip to content

Conversation

nadir-akhtar
Copy link
Collaborator

@nadir-akhtar nadir-akhtar commented Mar 11, 2025

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:

  • Why shares are needed for EigenLayer accounting, and rebase tokens
  • The impact of direct transfers into a StrategyBase contract
  • Inflation attacks, and an exploit scenario
  • The mitigations built into the StrategyBase contract and any residual risk & side effects

Modifications:

  • Added the StrategyBaseAccounting doc
  • Renamed docs/core/accounting/SlashingEdgeCase.md to docs/core/accounting/DualSlashingEdgeCase.md (for clarity)

Result:

More clarity on how StrategyBase does shares accounting!

@github-actions github-actions bot added the 📖 Documentation Improvements or additions to documentation. label Mar 11, 2025
Copy link
Contributor

@MinisculeTarantula MinisculeTarantula left a 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.

@nadir-akhtar nadir-akhtar force-pushed the nadir/strategy-base-docs branch 2 times, most recently from 039303f to fb1e159 Compare March 12, 2025 22:47
@nadir-akhtar nadir-akhtar marked this pull request as ready for review March 12, 2025 22:48
@nadir-akhtar
Copy link
Collaborator Author

@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.
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

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.
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nadir-akhtar nadir-akhtar force-pushed the nadir/strategy-base-docs branch from 7d4e647 to 9a3dc19 Compare March 13, 2025 20:05
@nadir-akhtar nadir-akhtar merged commit 7b56641 into dev Mar 13, 2025
11 checks passed
@nadir-akhtar nadir-akhtar deleted the nadir/strategy-base-docs branch March 13, 2025 23:26
Copy link

Certora Run Started (Eigenlayer Contracts)

  • Group ID: 1356f87f-86a3-45e5-bbf4-dc1391821972
Config Status Link Log File
core/AllocationManager.conf Compiled - certora/confs/core/AllocationManager.conf-b2c3501aa4fa.log
core/AllocationManagerSanity.conf Compiled - certora/confs/core/AllocationManagerSanity.conf-79c0f3c191ec.log
core/DelegationManager.conf Compiled - certora/confs/core/DelegationManager.conf-9c75bd5d0ba6.log
core/DelegationManagerValidState.conf Compiled - certora/confs/core/DelegationManagerValidState.conf-54e664e14fd8.log
core/StrategyManager.conf Compiled - certora/confs/core/StrategyManager.conf-43e33102fc4c.log
permissions/Pausable.conf Compiled - certora/confs/permissions/Pausable.conf-a97cd4e11cf9.log
pods/EigenPodManagerRules.conf Compiled - certora/confs/pods/EigenPodManagerRules.conf-1cc1ddce2c63.log
strategies/StrategyBase.conf Compiled - certora/confs/strategies/StrategyBase.conf-24d4e97f00cd.log

Certora Run Summary

  • Started 0 jobs
  • 0 jobs failed

Download Logs

Copy link

Certora Run Started (Eigenlayer Contracts)

  • Group ID: d4eb6127-dbf3-4e6c-8877-1203ebb35e06
Config Status Link Log File
core/AllocationManager.conf Submited link certora/confs/core/AllocationManager.conf-36377860f712.log
core/AllocationManagerSanity.conf Submited link certora/confs/core/AllocationManagerSanity.conf-0399a31bf931.log
core/DelegationManager.conf Submited link certora/confs/core/DelegationManager.conf-7429a8f18791.log
core/DelegationManagerValidState.conf Submited link certora/confs/core/DelegationManagerValidState.conf-3fdfc1c5b69c.log
core/StrategyManager.conf Submited link certora/confs/core/StrategyManager.conf-5ad6e74526fa.log
permissions/Pausable.conf Submited link certora/confs/permissions/Pausable.conf-39857ca2c4d2.log
pods/EigenPodManagerRules.conf Submited link certora/confs/pods/EigenPodManagerRules.conf-314f3231f70c.log
strategies/StrategyBase.conf Submited link certora/confs/strategies/StrategyBase.conf-f3d4e6aca15b.log

Certora Run Summary

  • Started 8 jobs
  • 0 jobs failed

Download Logs

Copy link

@certora-run certora-run bot left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 Documentation Improvements or additions to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants