more fixes

This commit is contained in:
Aayush 2022-09-10 10:34:47 -04:00
parent 76090193ea
commit 19c3232d2f
22 changed files with 83 additions and 69 deletions

View File

@ -231,7 +231,7 @@ func generateRegistry(registryPath string) error {
return nil // skip
}
return xerrors.Errorf("loading builtin template file: %w", err)
return xerrors.Errorf("loading registry template file: %w", err)
}
tpl := template.Must(template.New("").Funcs(template.FuncMap{

View File

@ -10,15 +10,13 @@ import (
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
multisig{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/multisig"
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
{{else}}
actorstypes "github.com/filecoin-project/go-state-types/actors"
multisig{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}multisig"
init{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/init"
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
@ -90,7 +88,7 @@ func (m message{{.v}}) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin{{.latestVersion}}.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
multisig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
@ -67,7 +67,7 @@ func (m message0) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
@ -64,7 +64,7 @@ func (m message2) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
multisig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
@ -64,7 +64,7 @@ func (m message3) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
multisig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
@ -64,7 +64,7 @@ func (m message4) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
multisig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
@ -64,7 +64,7 @@ func (m message5) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
multisig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
@ -64,7 +64,7 @@ func (m message6) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,7 +5,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
multisig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
@ -64,7 +64,7 @@ func (m message7) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -6,7 +6,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
@ -69,7 +69,7 @@ func (m message8) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -6,7 +6,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
@ -69,7 +69,7 @@ func (m message9) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -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)
}

View File

@ -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)
})
}

View File

@ -13,7 +13,9 @@ 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/go-state-types/network"
"github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/blockstore"
@ -94,7 +96,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 +361,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)
}

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit b3185c5fbe05a1032fde707fee2f95ef117461d0
Subproject commit 945bc4ae58de63735e430607166d1a9c3c7dd43a

View File

@ -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()

View File

@ -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=<addr> <msig> <addr> 0 <addr> false

View File

@ -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{}

View File

@ -96,7 +96,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
},
matchStates: []matchState{
{
msg: makeMessage(t, provider, builtin.MethodsMiner.PreCommitSector, &minertypes.SectorPreCommitInfo{
msg: makeMessage(t, provider, builtin.MethodsMiner.PreCommitSector, &minertypes.PreCommitSectorParams{
SectorNumber: sectorNumber,
SealedCID: sealedCid,
DealIDs: []abi.DealID{dealID},
@ -114,7 +114,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
},
matchStates: []matchState{
{
msg: makeMessage(t, provider, builtin.MethodsMiner.PreCommitSector, &minertypes.SectorPreCommitInfo{
msg: makeMessage(t, provider, builtin.MethodsMiner.PreCommitSector, &minertypes.PreCommitSectorParams{
SectorNumber: sectorNumber,
SealedCID: sealedCid,
DealIDs: []abi.DealID{dealID},
@ -172,7 +172,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
currentDealInfoErr2: errors.New("something went wrong"),
matchStates: []matchState{
{
msg: makeMessage(t, provider, builtin.MethodsMiner.PreCommitSector, &minertypes.SectorPreCommitInfo{
msg: makeMessage(t, provider, builtin.MethodsMiner.PreCommitSector, &minertypes.PreCommitSectorParams{
SectorNumber: sectorNumber,
SealedCID: sealedCid,
DealIDs: []abi.DealID{dealID},

View File

@ -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)
}

View File

@ -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)

View File

@ -10,6 +10,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
@ -111,3 +112,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,
}
}