-
Notifications
You must be signed in to change notification settings - Fork 35
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: fix bugs with status command #143
Conversation
* fix a bug where we pulled the beacon state head even if we have an old checkpoint * fix a bug where we compute the wrong diff if the pod owner queues a withdrawal * still some outstanding bugs: * i think `sumRestakedBalancesGwei` also needs to use a prior state if we have an existing checkpoint * i ended up completing a 2 day old checkpoint and while status was _more_ accurate than the existing command off master, it was off by a bit. possibly precision issues? idk
Bug # 2 explanation: This bug occurs when the pod owner queues a withdrawal in the DelegationManager. The bug is that queuing a withdrawal results in a decrease of shares - so you had 32 ETH of shares, then you queued a withdrawal, now you have 0 ETH of shares. When a checkpoint is completed in the pod, the change in shares is applied as a delta - so if you have gained 0.01 ETH, the checkpoint would add 0.01 ETH to your current shares, for a new total share count of 0.01 ETH. The CLI bug here is that the The change in this PR correctly calculates a delta rather than using a total. |
Bug # 2 testing: To test this change, I am manually altering the value returned when the This effectively simulates running the As you can see, |
Bug # 3 explanation: If we have partially completed a checkpoint, Those validators' balance diffs will not be accounted for in the delta the CLI calculates. To fix this I need to consider whether there's a way to use Not sure what's better here. TBH I think this is a fairly minor issue and the PR here is already a good improvement, so this might be something we want to earmark for a future fix. |
|
||
if checkpointTimestamp != 0 { | ||
// Change in the pod's native ETH balance (already calculated for us when the checkpoint was started) | ||
nativeETHDeltaGwei = new(big.Float).SetUint64(checkpoint.PodBalanceGwei) |
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.
PodBalanceGwei is the delta?
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.
yep! it's calculated when the checkpoint is started on chain
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.
probably couldve been named better 😬
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 can clean this all up tomorrow. Your testing seems exhaustive, and I've run a few more scenarios on my side as well.
sumRestakedBalancesGwei
also needs to use a prior state if we have an existing checkpointsee comments below for explanation and testing