Add StartEpoch to multisig create params

This commit is contained in:
Aayush Rajasekaran 2020-09-02 23:17:49 -04:00
parent a74a368c41
commit 1cf51b956a
5 changed files with 37 additions and 19 deletions

View File

@ -386,8 +386,8 @@ type FullNode interface {
MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
// MsigCreate creates a multisig wallet // MsigCreate creates a multisig wallet
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration> // It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
//<initial balance>, <sender address of the create msg>, <gas price> // <vesting start epoch>, <initial balance>, <sender address of the create msg>
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, abi.ChainEpoch, types.BigInt, address.Address) (cid.Cid, error)
// MsigPropose proposes a multisig message // MsigPropose proposes a multisig message
// It takes the following params: <multisig address>, <recipient address>, <value to transfer>, // It takes the following params: <multisig address>, <recipient address>, <value to transfer>,
// <sender address of the propose msg>, <method to call in the proposed message>, <params to include in the proposed message> // <sender address of the propose msg>, <method to call in the proposed message>, <params to include in the proposed message>

View File

@ -197,7 +197,7 @@ type FullNodeStruct struct {
StateCirculatingSupply func(context.Context, types.TipSetKey) (api.CirculatingSupply, error) `perm:"read"` StateCirculatingSupply func(context.Context, types.TipSetKey) (api.CirculatingSupply, error) `perm:"read"`
MsigGetAvailableBalance func(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) `perm:"read"` MsigGetAvailableBalance func(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) `perm:"read"`
MsigCreate func(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) `perm:"sign"` MsigCreate func(context.Context, uint64, []address.Address, abi.ChainEpoch, abi.ChainEpoch, types.BigInt, address.Address) (cid.Cid, error) `perm:"sign"`
MsigPropose func(context.Context, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) `perm:"sign"` MsigPropose func(context.Context, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) `perm:"sign"`
MsigApprove func(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) `perm:"sign"` MsigApprove func(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) `perm:"sign"`
MsigCancel func(context.Context, address.Address, uint64, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) `perm:"sign"` MsigCancel func(context.Context, address.Address, uint64, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) `perm:"sign"`
@ -865,8 +865,8 @@ func (c *FullNodeStruct) MsigGetAvailableBalance(ctx context.Context, a address.
return c.Internal.MsigGetAvailableBalance(ctx, a, tsk) return c.Internal.MsigGetAvailableBalance(ctx, a, tsk)
} }
func (c *FullNodeStruct) MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (cid.Cid, error) { func (c *FullNodeStruct) MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, vestingStart abi.ChainEpoch, val types.BigInt, src address.Address) (cid.Cid, error) {
return c.Internal.MsigCreate(ctx, req, addrs, duration, val, src, gp) return c.Internal.MsigCreate(ctx, req, addrs, duration, vestingStart, val, src)
} }
func (c *FullNodeStruct) MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) { func (c *FullNodeStruct) MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) {

View File

@ -62,6 +62,11 @@ var msigCreateCmd = &cli.Command{
Usage: "length of the period over which funds unlock", Usage: "length of the period over which funds unlock",
Value: "0", Value: "0",
}, },
&cli.StringFlag{
Name: "vesting-start",
Usage: "epoch at which vesting begins",
Value: "0",
},
&cli.StringFlag{ &cli.StringFlag{
Name: "from", Name: "from",
Usage: "account to send the create message from", Usage: "account to send the create message from",
@ -120,10 +125,9 @@ var msigCreateCmd = &cli.Command{
} }
d := abi.ChainEpoch(cctx.Uint64("duration")) d := abi.ChainEpoch(cctx.Uint64("duration"))
vs := abi.ChainEpoch(cctx.Uint64("vesting-start"))
gp := types.NewInt(1) msgCid, err := api.MsigCreate(ctx, required, addrs, d, vs, intVal, sendAddr)
msgCid, err := api.MsigCreate(ctx, required, addrs, d, intVal, sendAddr, gp)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1879,7 +1879,7 @@ Response:
### MsigCreate ### MsigCreate
MsigCreate creates a multisig wallet MsigCreate creates a multisig wallet
It takes the following params: <required number of senders>, <approving addresses>, <unlock duration> It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
<initial balance>, <sender address of the create msg>, <gas price> <vesting start epoch>, <initial balance>, <sender address of the create msg>
Perms: sign Perms: sign
@ -1890,9 +1890,9 @@ Inputs:
42, 42,
null, null,
10101, 10101,
10101,
"0", "0",
"t01234", "t01234"
"0"
] ]
``` ```
@ -2407,7 +2407,7 @@ Inputs:
"Extra": { "Extra": {
"Actor": "t01234", "Actor": "t01234",
"Method": 1, "Method": 1,
"Data": "Ynl0ZSBhcnJheQ==" "Params": "Ynl0ZSBhcnJheQ=="
}, },
"Lane": 42, "Lane": 42,
"Nonce": 42, "Nonce": 42,
@ -2443,7 +2443,7 @@ Inputs:
"Extra": { "Extra": {
"Actor": "t01234", "Actor": "t01234",
"Method": 1, "Method": 1,
"Data": "Ynl0ZSBhcnJheQ==" "Params": "Ynl0ZSBhcnJheQ=="
}, },
"Lane": 42, "Lane": 42,
"Nonce": 42, "Nonce": 42,
@ -2479,7 +2479,7 @@ Inputs:
"Extra": { "Extra": {
"Actor": "t01234", "Actor": "t01234",
"Method": 1, "Method": 1,
"Data": "Ynl0ZSBhcnJheQ==" "Params": "Ynl0ZSBhcnJheQ=="
}, },
"Lane": 42, "Lane": 42,
"Nonce": 42, "Nonce": 42,
@ -2513,6 +2513,7 @@ Inputs:
Response: Response:
```json ```json
{ {
<<<<<<< HEAD
"Voucher": { "Voucher": {
"ChannelAddr": "t01234", "ChannelAddr": "t01234",
"TimeLockMin": 10101, "TimeLockMin": 10101,
@ -2532,6 +2533,16 @@ Response:
"Type": 2, "Type": 2,
"Data": "Ynl0ZSBhcnJheQ==" "Data": "Ynl0ZSBhcnJheQ=="
} }
=======
"ChannelAddr": "t01234",
"TimeLockMin": 10101,
"TimeLockMax": 10101,
"SecretPreimage": "Ynl0ZSBhcnJheQ==",
"Extra": {
"Actor": "t01234",
"Method": 1,
"Params": "Ynl0ZSBhcnJheQ=="
>>>>>>> Add StartEpoch to multisig create params
}, },
"Shortfall": "0" "Shortfall": "0"
} }
@ -2568,7 +2579,7 @@ Inputs:
"Extra": { "Extra": {
"Actor": "t01234", "Actor": "t01234",
"Method": 1, "Method": 1,
"Data": "Ynl0ZSBhcnJheQ==" "Params": "Ynl0ZSBhcnJheQ=="
}, },
"Lane": 42, "Lane": 42,
"Nonce": 42, "Nonce": 42,
@ -3308,7 +3319,8 @@ Response:
"Multiaddrs": null, "Multiaddrs": null,
"SealProofType": 3, "SealProofType": 3,
"SectorSize": 34359738368, "SectorSize": 34359738368,
"WindowPoStPartitionSectors": 42 "WindowPoStPartitionSectors": 42,
"ConsensusFaultElapsed": 10101
} }
``` ```
@ -3785,7 +3797,9 @@ Response:
"VerifiedDealWeight": "0", "VerifiedDealWeight": "0",
"InitialPledge": "0", "InitialPledge": "0",
"ExpectedDayReward": "0", "ExpectedDayReward": "0",
"ExpectedStoragePledge": "0" "ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0"
} }
``` ```

View File

@ -28,8 +28,7 @@ type MsigAPI struct {
MpoolAPI MpoolAPI MpoolAPI MpoolAPI
} }
// TODO: remove gp (gasPrice) from arguments func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, vestingStart abi.ChainEpoch, val types.BigInt, src address.Address) (cid.Cid, error) {
func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (cid.Cid, error) {
lenAddrs := uint64(len(addrs)) lenAddrs := uint64(len(addrs))
@ -50,6 +49,7 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
Signers: addrs, Signers: addrs,
NumApprovalsThreshold: req, NumApprovalsThreshold: req,
UnlockDuration: duration, UnlockDuration: duration,
StartEpoch: vestingStart,
} }
enc, actErr := actors.SerializeParams(msigParams) enc, actErr := actors.SerializeParams(msigParams)