Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Sep 10, 2022
1 parent 7609019 commit 19c3232
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 69 deletions.
2 changes: 1 addition & 1 deletion chain/actors/agen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 2 additions & 4 deletions chain/actors/builtin/multisig/message.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message0.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message4.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message5.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message6.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message7.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message8.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/multisig/message9.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/miners.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion cli/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down
33 changes: 25 additions & 8 deletions cli/filplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
2 changes: 1 addition & 1 deletion itests/deadlines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 0 additions & 2 deletions itests/multisig/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions itests/verifreg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{}
Expand Down
6 changes: 3 additions & 3 deletions markets/storageadapter/ondealsectorcommitted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
Expand Down Expand Up @@ -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},
Expand Down
22 changes: 4 additions & 18 deletions storage/pipeline/precommit_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down
Loading

0 comments on commit 19c3232

Please sign in to comment.