-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Run fork function after cron for null block safety #4114
Conversation
(TODO: Make sure this doesn't break consensus on the already performed forks (should be fairly easy with just |
@magik6k this does not break consensus at breeze, smoke and ignition epochs Before change
After change
Double checked that these match the next header to confirm compute-state is including cron/fork functions. I also checked 41820, 51000 and 94000 in case I was off by one and found matches |
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.
This makes sense.
chain/stmgr/stmgr.go
Outdated
if i > parentEpoch { | ||
// run cron for null rounds if any | ||
if err := runCron(); err != nil { | ||
return cid.Cid{}, cid.Cid{}, err |
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.
nit cid.Undef
.
In case its not clear I don't have merge permissions so someone else should push the button. |
Actors state migrations will take place within a fork function called from
handleStateForks
. In general migrations need the epoch the transition is run at to work correctly. We are assuming the epoch passed to any migration function will be the same epoch passed tohandleStateForks
,i
.i
is the fork epoch. In the common case of no null blocks it is the "previous epoch" in the sense that epochi
's cron has already run as part of processing the parent tipset and state.If there are null blocks then for
i > parentEpoch
epochi
's cron will not have run before the fork function because of the current ordering of fork function before cron. We can't distinguish these two cases from within the migration function so the epoch we are passed in won't be well defined with respect to our state.The fix is to run cron before the fork function.