From ddfa973ae075e757dacd26456b310c9299f552d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 14 Mar 2023 13:59:36 +0100 Subject: [PATCH] stmgr: More correct fix for genesis state compute --- chain/stmgr/execute.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chain/stmgr/execute.go b/chain/stmgr/execute.go index e673982992a..9512d7374c6 100644 --- a/chain/stmgr/execute.go +++ b/chain/stmgr/execute.go @@ -52,6 +52,16 @@ func (sm *StateManager) TipSetState(ctx context.Context, ts *types.TipSet) (st c sm.stlk.Unlock() + if ts.Height() == 0 { + // NB: This is here because the process that executes blocks requires that the + // block miner reference a valid miner in the state tree. Unless we create some + // magical genesis miner, this won't work properly, so we short circuit here + // This avoids the question of 'who gets paid the genesis block reward'. + // This also makes us not attempt to lookup the tipset state with + // tryLookupTipsetState, which would cause a very long, very slow walk. + return ts.Blocks()[0].ParentStateRoot, ts.Blocks()[0].ParentMessageReceipts, nil + } + st, rec, err = sm.tsExec.ExecuteTipSet(ctx, sm, ts, sm.tsExecMonitor, false) if err != nil { return cid.Undef, cid.Undef, err