-
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
Fix randomness fetching around null blocks #6240
Conversation
@@ -95,7 +97,12 @@ func (a *ChainAPI) ChainGetRandomnessFromTickets(ctx context.Context, tsk types. | |||
return nil, xerrors.Errorf("loading tipset key: %w", err) | |||
} | |||
|
|||
return a.Chain.GetChainRandomness(ctx, pts.Cids(), personalization, randEpoch, entropy) | |||
// Doing this here is slightly nicer than doing it in the chainstore directly, but it's still bad for ChainAPI to reason about network upgrades | |||
if randEpoch > build.UpgradeHyperdriveHeight { |
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.
Would love a creative suggestion that allows us to not do this
This version seems better to me. The Chain API having to check network version is annoying, especially if we consider that in future upgrades might depend on state and not a pure chain. |
b443c2f
to
21b4741
Compare
Added a test which will pass once we make a minor tweak to the tipset skipcache index (waiting on some input from Why) |
@@ -833,3 +891,55 @@ func TestSyncCheckpointEarlierThanHead(t *testing.T) { | |||
require.Equal(tu.t, p1Head, a.TipSet()) | |||
tu.assertBad(p1, b.TipSet()) | |||
} | |||
|
|||
func TestDrandNull(t *testing.T) { |
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.
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.
Yes, because of the tipset cache thing i mentioned above^
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.
SGWM, regarding the ugliness: the randomness just does not belong in Chain API,
as choosing randomness turns out to be a consensus rule built on top of the content of the chain.
9da93a6
to
10b9313
Compare
|
||
require.Equal(t, []byte(rand), expectedRand) | ||
build.UpgradeHyperdriveHeight = ov5h | ||
|
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.
Would it be easy enough to test that a second node can sync to this chain?
This is the larger but "better" fix to the critical portion of #3613.