From 3c2fcce2c3139bdf04906cba07311d6ce73dbb52 Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 17 May 2022 18:32:29 -0400 Subject: [PATCH] fix: genesis: only sign preseal deals after v16 --- chain/gen/genesis/miners.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index a28804512..5ff499351 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -238,20 +238,26 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal for _, preseal := range m.Sectors { preseal.Deal.VerifiedDeal = true preseal.Deal.EndEpoch = minerInfos[i].presealExp - buf, err := cborutil.Dump(&preseal.Deal) - if err != nil { - return cid.Undef, fmt.Errorf("failed to marshal proposal: %w", err) - } - - sig, err := sigs.Sign(wallet.ActSigType(preseal.DealClientKey.Type), preseal.DealClientKey.PrivateKey, buf) - if err != nil { - return cid.Undef, fmt.Errorf("failed to sign proposal: %w", err) - } - - params.Deals = append(params.Deals, markettypes.ClientDealProposal{ + p := markettypes.ClientDealProposal{ Proposal: preseal.Deal, - ClientSignature: *sig, - }) + ClientSignature: crypto.Signature{Type: crypto.SigTypeBLS}, + } + + if av >= actors.Version8 { + buf, err := cborutil.Dump(&preseal.Deal) + if err != nil { + return cid.Undef, fmt.Errorf("failed to marshal proposal: %w", err) + } + + sig, err := sigs.Sign(wallet.ActSigType(preseal.DealClientKey.Type), preseal.DealClientKey.PrivateKey, buf) + if err != nil { + return cid.Undef, fmt.Errorf("failed to sign proposal: %w", err) + } + + p.ClientSignature = *sig + } + + params.Deals = append(params.Deals, p) if len(params.Deals) == cbg.MaxLength { if err := publish(params); err != nil {