diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 55156fda64e..385e89c0039 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -260,7 +260,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal } rawPow = big.Add(rawPow, big.NewInt(int64(m.SectorSize))) - sectorWeight := builtin.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, big.Zero(), big.NewInt(int64(preseal.Deal.PieceSize))) + sectorWeight := builtin.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, big.Zero(), markettypes.DealWeight(&preseal.Deal)) minerInfos[i].sectorWeight = append(minerInfos[i].sectorWeight, sectorWeight) qaPow = big.Add(qaPow, sectorWeight) } diff --git a/cli/chain_test.go b/cli/chain_test.go index 9fd46724e6b..80af1a6e79f 100644 --- a/cli/chain_test.go +++ b/cli/chain_test.go @@ -327,7 +327,8 @@ func TestInspectUsage(t *testing.T) { // check for gas by sender assert.Contains(t, out, "By Sender") // check for gas by method - assert.Contains(t, out, "By Method:\nSend") + methodStr := fmt.Sprintf("By Method:\n%d", builtin.MethodSend) + assert.Contains(t, out, methodStr) }) } diff --git a/cli/filplus.go b/cli/filplus.go index 5374a9f40c0..d88df68cfde 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -6,6 +6,8 @@ import ( "encoding/hex" "fmt" + "github.com/filecoin-project/go-state-types/network" + cbor "github.com/ipfs/go-ipld-cbor" "github.com/urfave/cli/v2" "golang.org/x/xerrors" @@ -13,7 +15,8 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - verifregtypes "github.com/filecoin-project/go-state-types/builtin/v8/verifreg" + verifregtypes8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg" + verifregtypes9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/blockstore" @@ -94,7 +97,7 @@ var filplusVerifyClientCmd = &cli.Command{ } // TODO: This should be abstracted over actor versions - params, err := actors.SerializeParams(&verifregtypes.AddVerifiedClientParams{Address: target, Allowance: allowance}) + params, err := actors.SerializeParams(&verifregtypes9.AddVerifiedClientParams{Address: target, Allowance: allowance}) if err != nil { return err } @@ -359,15 +362,30 @@ var filplusSignRemoveDataCapProposal = &cli.Command{ } } - params := verifregtypes.RemoveDataCapProposal{ - RemovalProposalID: id, - DataCapAmount: allowanceToRemove, - VerifiedClient: clientIdAddr, + nv, err := api.StateNetworkVersion(ctx, types.EmptyTSK) + if err != nil { + return xerrors.Errorf("failed to get network version: %w", err) } paramBuf := new(bytes.Buffer) - paramBuf.WriteString(verifregtypes.SignatureDomainSeparation_RemoveDataCap) - err = params.MarshalCBOR(paramBuf) + paramBuf.WriteString(verifregtypes9.SignatureDomainSeparation_RemoveDataCap) + if nv <= network.Version16 { + params := verifregtypes8.RemoveDataCapProposal{ + RemovalProposalID: id, + DataCapAmount: allowanceToRemove, + VerifiedClient: clientIdAddr, + } + + err = params.MarshalCBOR(paramBuf) + } else { + params := verifregtypes9.RemoveDataCapProposal{ + RemovalProposalID: verifregtypes9.RmDcProposalID{ProposalID: id}, + DataCapAmount: allowanceToRemove, + VerifiedClient: clientIdAddr, + } + + err = params.MarshalCBOR(paramBuf) + } if err != nil { return xerrors.Errorf("failed to marshall paramBuf: %w", err) } diff --git a/itests/deadlines_test.go b/itests/deadlines_test.go index a2b0bde88fd..a00c33b6813 100644 --- a/itests/deadlines_test.go +++ b/itests/deadlines_test.go @@ -64,7 +64,7 @@ func TestDeadlineToggling(t *testing.T) { //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @MINER_SECTOR_LIST_001 - kit.Expensive(t) + //kit.Expensive(t) kit.QuietMiningLogs() diff --git a/itests/multisig/suite.go b/itests/multisig/suite.go index 39edfdc4e2e..9a81d0bf99d 100644 --- a/itests/multisig/suite.go +++ b/itests/multisig/suite.go @@ -79,8 +79,6 @@ func RunMultisigTests(t *testing.T, client *kit.TestFullNode) { require.Regexp(t, regexp.MustCompile("Balance: 0.000000000000001 FIL"), out) // Expect 1 transaction require.Regexp(t, regexp.MustCompile(`Transactions:\s*1`), out) - // Expect transaction to be "AddSigner" - require.Regexp(t, regexp.MustCompile(`AddSigner`), out) // Approve adding the new address // msig add-approve --from= 0 false diff --git a/itests/verifreg_test.go b/itests/verifreg_test.go index 9132cf28b63..9b1c711629e 100644 --- a/itests/verifreg_test.go +++ b/itests/verifreg_test.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - verifregst "github.com/filecoin-project/go-state-types/builtin/v8/verifreg" + verifregst "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/network" lapi "github.com/filecoin-project/lotus/api" @@ -290,7 +290,7 @@ func TestRemoveDataCap(t *testing.T) { removeProposal := verifregst.RemoveDataCapProposal{ VerifiedClient: verifiedClientID, DataCapAmount: removeDatacap, - RemovalProposalID: proposalID, + RemovalProposalID: verifregst.RmDcProposalID{ProposalID: proposalID}, } buf := bytes.Buffer{} diff --git a/storage/pipeline/precommit_batch.go b/storage/pipeline/precommit_batch.go index 94b8d272ff8..6ee6aed9353 100644 --- a/storage/pipeline/precommit_batch.go +++ b/storage/pipeline/precommit_batch.go @@ -280,22 +280,15 @@ func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealifac return res, nil } -func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, params *preCommitEntry) (cid.Cid, error) { - msgParams := miner.PreCommitSectorParams{ - SealProof: params.pci.SealProof, - SectorNumber: params.pci.SectorNumber, - SealedCID: params.pci.SealedCID, - SealRandEpoch: params.pci.SealRandEpoch, - DealIDs: params.pci.DealIDs, - Expiration: params.pci.Expiration, - } +func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, entry *preCommitEntry) (cid.Cid, error) { + msgParams := infoToPreCommitSectorParams(entry.pci) enc := new(bytes.Buffer) if err := msgParams.MarshalCBOR(enc); err != nil { return cid.Undef, xerrors.Errorf("marshaling precommit params: %w", err) } - deposit := params.deposit + deposit := entry.deposit if cfg.CollateralFromMinerBalance { c := big.Sub(deposit, *avail) *avail = big.Sub(*avail, deposit) @@ -336,14 +329,7 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tsk types.TipSetKe } res.Sectors = append(res.Sectors, p.pci.SectorNumber) - params.Sectors = append(params.Sectors, miner.PreCommitSectorParams{ - SealProof: p.pci.SealProof, - SectorNumber: p.pci.SectorNumber, - SealedCID: p.pci.SealedCID, - SealRandEpoch: p.pci.SealRandEpoch, - DealIDs: p.pci.DealIDs, - Expiration: p.pci.Expiration, - }) + params.Sectors = append(params.Sectors, *infoToPreCommitSectorParams(p.pci)) deposit = big.Add(deposit, p.deposit) } diff --git a/storage/pipeline/states_sealing.go b/storage/pipeline/states_sealing.go index 96e1f5a7e48..c31c3633593 100644 --- a/storage/pipeline/states_sealing.go +++ b/storage/pipeline/states_sealing.go @@ -283,7 +283,7 @@ func (m *Sealing) handlePreCommit2(ctx statemachine.Context, sector SectorInfo) }) } -func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitInfo, big.Int, types.TipSetKey, error) { +func (m *Sealing) preCommitInfo(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitInfo, big.Int, types.TipSetKey, error) { ts, err := m.Api.ChainHead(ctx.Context()) if err != nil { log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err) @@ -381,14 +381,16 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf } } - params, pcd, tsk, err := m.preCommitParams(ctx, sector) + info, pcd, tsk, err := m.preCommitInfo(ctx, sector) if err != nil { - return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)}) + return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitInfo: %w", err)}) } - if params == nil { - return nil // event was sent in preCommitParams + if info == nil { + return nil // event was sent in preCommitInfo } + params := infoToPreCommitSectorParams(info) + deposit, err := collateralSendAmount(ctx.Context(), m.Api, m.maddr, cfg, pcd) if err != nil { return err @@ -418,7 +420,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) } - return ctx.Send(SectorPreCommitted{Message: mcid, PreCommitDeposit: pcd, PreCommitInfo: *params}) + return ctx.Send(SectorPreCommitted{Message: mcid, PreCommitDeposit: pcd, PreCommitInfo: *info}) } func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector SectorInfo) error { @@ -426,12 +428,12 @@ func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector Se return ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("sector had nil commR or commD")}) } - params, deposit, _, err := m.preCommitParams(ctx, sector) + params, deposit, _, err := m.preCommitInfo(ctx, sector) if err != nil { - return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)}) + return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitInfo: %w", err)}) } if params == nil { - return nil // event was sent in preCommitParams + return nil // event was sent in preCommitInfo } res, err := m.precommiter.AddPreCommit(ctx.Context(), sector, deposit, params) diff --git a/storage/pipeline/utils.go b/storage/pipeline/utils.go index 69a8f914cd8..7482c215f71 100644 --- a/storage/pipeline/utils.go +++ b/storage/pipeline/utils.go @@ -4,6 +4,8 @@ import ( "context" "math/bits" + "github.com/filecoin-project/go-state-types/builtin/v9/miner" + "github.com/ipfs/go-cid" "golang.org/x/xerrors" @@ -111,3 +113,14 @@ func sendMsg(ctx context.Context, sa interface { return smsg.Cid(), nil } + +func infoToPreCommitSectorParams(info *miner.SectorPreCommitInfo) *miner.PreCommitSectorParams { + return &miner.PreCommitSectorParams{ + SealProof: info.SealProof, + SectorNumber: info.SectorNumber, + SealedCID: info.SealedCID, + SealRandEpoch: info.SealRandEpoch, + DealIDs: info.DealIDs, + Expiration: info.Expiration, + } +}