204 Separate Script to Deposit and Register#212
Conversation
fbdc6b6 to
55ab7c0
Compare
ethanfrey
left a comment
There was a problem hiding this comment.
The design looks good. Approve it.
The one request to improve would be to make the sleep a bit more robust as commented below. You could merge and do that in a future PR, or make that change, test it works, then merge. No need to block on my re-review for that change
| address _operatorAddr, | ||
| uint256 _stakeAmount | ||
| ) internal { | ||
| IStrategyManager strategyManager = IStrategyManager(_strategyManagerAddress); |
There was a problem hiding this comment.
Okay this is the code that was pulled out from the register lib, right?
| /// @notice The error for the failed to get allocation configuration delay. | ||
| error WavsRegisterOperatorLib__FailedToGetAllocationConfigurationDelay(); | ||
|
|
||
| /** |
| IAllocationManager allocationManager = IAllocationManager(allocationManagerAddress); | ||
| OperatorSet memory opSetQuery = OperatorSet({avs: serviceManagerAddress, id: 0}); | ||
| if (!allocationManager.isMemberOfOperatorSet(operatorAddr, opSetQuery)) { | ||
| (bool success, bytes memory result) = address(allocationManager).staticcall( |
There was a problem hiding this comment.
And the ugly workaround gone 😄
| # Deposit into strategy | ||
| forge script script/eigenlayer/bls/WavsDepositIntoStrategy.s.sol -vvv --rpc-url "$RPC_URL" --private-key "$OPERATOR_KEY" --broadcast || handle_error "Failed to deposit into strategy" | ||
|
|
||
| # Wait based on environment |
There was a problem hiding this comment.
Ah, very cool.
Run one script, wait the time in bash, then run the second part.
Good approach
scripts/bls/eigen/register.sh
Outdated
| cast rpc evm_mine --rpc-url http://localhost:8545 | ||
| done | ||
| elif [[ "$DEPLOY_ENV" == "TESTNET" ]]; then | ||
| WAIT_TIME=$((12 * ALLOCATION_DELAY)) |
There was a problem hiding this comment.
This seems a bit arbitrary.
Could you do something like:
- calculate target block number (current + allocation delay)
- while current_block < target_block
- sleep (5 * target - current)
This is more robust and doesn't have to wait 2x the expected time. You can change 5 with any other number you like, whatever would be a lower bound for block time (could even be 1, you just have a few extra queries, but that is cheap)
60f8050 to
c427ff6
Compare
Fixes on #204