Layr-Labs / eigenlayer-contracts

Other
616 stars 329 forks source link

Nadir/deploy refactor #790

Open nadir-akhtar opened 2 days ago

nadir-akhtar commented 2 days ago

Creating example scripts for deploying, queueing, and executing contract upgrades

The PR adds script/Release_Template.sol, a template file providing abstract contracts for a variety of scripting use cases. A release script can inherit and override relevant functions with lightweight and straightforward syntax. Below are the contexts for using each script:

Furthermore, script/releases/v0.1-eigenpod/ contains an example set of scripts inheriting and implementing functions for each aforementioned abstract contract. These scripts are purely for demonstration.

=======================================

To run this locally, try the following commands.

Deploy

forge script script/releases/v0.1-eigenpod/DeployEigenPod.s.sol -s "deploy(string memory)" "script/configs/zipzoop.json"

Example Output

$ forge script script/releases/v0.1-eigenpod/DeployEigenPod.s.sol -s "deploy(string memory)" "script/configs/zipzoop.json"
[⠊] Compiling...
[⠆] Compiling 2 files with Solc 0.8.12
[⠰] Solc 0.8.12 finished in 4.41s
...
Script ran successfully.
Gas used: 10380021

== Return ==
0: struct Deployment[] [Deployment({ name: "EigenPod", deployedTo: 0x90193C961A926261B756D1E5bb255e67ff9498A1 })]

Execute

forge script script/releases/v0.1-eigenpod/UpgradeEigenPod.s.sol -s "execute(string memory)" "script/configs/zipzoop.json"

Example Output

$ forge script script/releases/v0.1-eigenpod/UpgradeEigenPod.s.sol -s "execute(string memory)" 
"script/configs/zipzoop.json"
[⠊] Compiling...
[⠘] Compiling 1 files with Solc 0.8.12
[⠃] Solc 0.8.12 finished in 4.92s
...
Script ran successfully.
Gas used: 6812603

== Return ==
0: struct Transaction Transaction({ to: 0x40A2aCCbd92BCA938b02010E17A5b8929b49130D, value: 0, data: 0x8d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000212000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e40825f38f0000000000000000000000001bef05c7303d44e0e2fcd2a19d993eded4c51b5b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bef05c7303d44e0e2fcd2a19d993eded4c51b5b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008499a88ec4000000000000000000000000b8d8952f572e67b11e43bc21250967772fa883ff00000000000000000000000010eba780ccd9e5e9ffbe529c25046c076be91048000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, op: 1 })

Queue

forge script script/releases/v0.1-eigenpod/UpgradeViaTimelock.s.sol -s "queue(string memory)" "script/configs/zipzoop.json"

Example Output

$ forge script script/releases/v0.1-eigenpod/UpgradeViaTimelock.s.sol -s "queue(string memory)" "script/configs/zipzoop.json"
[⠊] Compiling...
[⠑] Compiling 1 files with Solc 0.8.12
[⠘] Solc 0.8.12 finished in 4.78s
...
Script ran successfully.
Gas used: 6794122

== Return ==
0: struct Transaction Transaction({ to: 0x0000000000000000000000000000000000000000, value: 0, data: 0x3a66f901000000000000000000000000da29bb71669f46f2a779b4b62f03644a84ee3479000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a46a76120200000000000000000000000040a2accbd92bca938b02010e17a5b8929b49130d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000001a48d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001520092cc4a800a1513e85c481dddf3a06c6921211eac000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243659cfe60000000000000000000000000000000000000000000000000000000000000000001bef05c7303d44e0e2fcd2a19d993eded4c51b5b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008499a88ec4000000000000000000000000b8d8952f572e67b11e43bc21250967772fa883ff00000000000000000000000010eba780ccd9e5e9ffbe529c25046c076be91048000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a6db1a8c5a981d1536266d2a393c5f8ddb210eaf0000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, op: 1 })

Execute after Queue

forge script script/releases/v0.1-eigenpod/UpgradeViaTimelock.s.sol -s "execute(string memory)" "script/configs/zipzoop.json"

Example Output

$ forge script script/releases/v0.1-eigenpod/UpgradeViaTimelock.s.sol -s "execute(string memory)" "script/configs/zipzoop.json"
[⠊] Compiling...
No files changed, compilation skipped
Script ran successfully.
Gas used: 7429010

== Return ==
0: struct Transaction Transaction({ to: 0x40A2aCCbd92BCA938b02010E17A5b8929b49130D, value: 0, data: 0x8d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004d2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004040825f38f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a46a76120200000000000000000000000040a2accbd92bca938b02010e17a5b8929b49130d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000001a48d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001520092cc4a800a1513e85c481dddf3a06c6921211eac000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243659cfe60000000000000000000000000000000000000000000000000000000000000000001bef05c7303d44e0e2fcd2a19d993eded4c51b5b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008499a88ec4000000000000000000000000b8d8952f572e67b11e43bc21250967772fa883ff00000000000000000000000010eba780ccd9e5e9ffbe529c25046c076be91048000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a6db1a8c5a981d1536266d2a393c5f8ddb210eaf000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad4a89e3ca9b3dc25aabe0aa7d72e61d2ec66052000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246b9b6229000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000, op: 1 })
github-actions[bot] commented 2 days ago
  Reading tracefile ./lcov.info.pruned
                                               |Lines      |Functions|Branches  
Filename                                       |Rate    Num|Rate  Num|Rate   Num
================================================================================
[src/contracts/]
core/AVSDirectory.sol                          |85.2%    27|88.9%   9|    -    0
core/DelegationManager.sol                     |96.5%   198|92.3%  39|    -    0
core/RewardsCoordinator.sol                    |93.0%   128|84.8%  33|    -    0
core/StrategyManager.sol                       |97.6%    83| 100%  24|    -    0
libraries/BeaconChainProofs.sol                | 100%    22| 100%  11|    -    0
libraries/BytesLib.sol                         | 0.0%   156| 0.0%  14|    -    0
libraries/EIP1271SignatureUtils.sol            | 100%     3| 100%   1|    -    0
libraries/Endian.sol                           | 100%     2| 100%   1|    -    0
libraries/Merkle.sol                           | 100%    38| 100%   5|    -    0
libraries/StructuredLinkedList.sol             | 0.0%    45| 0.0%  19|    -    0
permissions/Pausable.sol                       |95.7%    23|90.9%  11|    -    0
permissions/PauserRegistry.sol                 | 100%    12| 100%   6|    -    0
pods/EigenPod.sol                              | 100%   122|96.2%  26|    -    0
pods/EigenPodManager.sol                       | 100%    75|92.9%  14|    -    0
strategies/EigenStrategy.sol                   | 0.0%    10| 0.0%   5|    -    0
strategies/StrategyBase.sol                    |90.9%    44|78.9%  19|    -    0
strategies/StrategyBaseTVLLimits.sol           | 100%    12| 100%   6|    -    0
strategies/StrategyFactory.sol                 | 100%    35| 100%   9|    -    0
token/BackingEigen.sol                         |83.3%    30|69.2%  13|    -    0
token/Eigen.sol                                |45.0%    40|61.5%  13|    -    0
utils/UpgradeableSignatureCheckingUtils.sol    | 0.0%     6| 0.0%   4|    -    0
================================================================================
                                         Total:|75.6%  1111|76.2% 282|    -    0