more fixes

This commit is contained in:
Aayush
2022-09-10 12:37:03 -04:00
parent 76090193ea
commit 19c3232d2f
22 changed files with 83 additions and 69 deletions
+2 -1
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)
})
}
+25 -8
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)
}