-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Process epoch error to use correct state version #14069
Conversation
ad57827
to
e49c822
Compare
@@ -257,16 +257,18 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot primitives. | |||
return nil, errors.Wrap(err, "could not process epoch with optimizations") | |||
} | |||
} else if state.Version() <= version.Deneb { | |||
stateVersion := version.String(state.Version()) | |||
state, err = altair.ProcessEpoch(ctx, state) |
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.
Can we drop the returned state? ProcessEpoch mutates the state argument, there is no benefit to conditionally returnign the state here. Refactor the method signature to only return an error.
state, err = altair.ProcessEpoch(ctx, state) | |
err = altair.ProcessEpoch(ctx, state) |
@@ -257,16 +257,18 @@ func ProcessSlots(ctx context.Context, state state.BeaconState, slot primitives. | |||
return nil, errors.Wrap(err, "could not process epoch with optimizations") | |||
} | |||
} else if state.Version() <= version.Deneb { | |||
stateVersion := version.String(state.Version()) |
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.
maybe we should do it outside , but it's also possible to trigger the nil pointer issue in the else statement maybe. It was my idea to add this state version but seems to be causing other issues.
e5f6964
to
a9e0a05
Compare
a9e0a05
to
f6f55e4
Compare
f6f55e4
to
0f11e9a
Compare
h/t Seamonkey for pointing out a regression from #14001.
If the
ProcessEpoch
function returns an error, the state isnil
by default. We can't use that to get the state version, or it will panic as seen below:This PR fixes the caller return pattern since state is mutated, we don't need to return it