fix a few multisig cli issues

This commit is contained in:
whyrusleeping 2020-07-20 17:17:53 -07:00
parent 34fffb90d5
commit 42a7cb1248
3 changed files with 15 additions and 8 deletions

View File

@ -5,11 +5,12 @@ import (
"context" "context"
"encoding/binary" "encoding/binary"
"encoding/json" "encoding/json"
"github.com/filecoin-project/lotus/lib/adtutil"
"io" "io"
"os" "os"
"sync" "sync"
"github.com/filecoin-project/lotus/lib/adtutil"
"github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/minio/blake2b-simd" "github.com/minio/blake2b-simd"
@ -659,7 +660,7 @@ func (cs *ChainStore) GetCMessage(c cid.Cid) (types.ChainMsg, error) {
return m, nil return m, nil
} }
if err != bstore.ErrNotFound { if err != bstore.ErrNotFound {
log.Warn("GetCMessage: unexpected error getting unsigned message: %s", err) log.Warnf("GetCMessage: unexpected error getting unsigned message: %s", err)
} }
return cs.GetSignedMessage(c) return cs.GetSignedMessage(c)

View File

@ -364,12 +364,17 @@ var msigProposeCmd = &cli.Command{
return fmt.Errorf("proposal returned exit %d", wait.Receipt.ExitCode) return fmt.Errorf("proposal returned exit %d", wait.Receipt.ExitCode)
} }
_, v, err := cbg.CborReadHeader(bytes.NewReader(wait.Receipt.Return)) var retval samsig.ProposeReturn
if err != nil { if err := retval.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
return err return fmt.Errorf("failed to unmarshal propose return value: %w", err)
} }
fmt.Printf("Transaction ID: %d\n", v) fmt.Printf("Transaction ID: %d\n", retval.TxnID)
if retval.Applied {
fmt.Printf("Transaction was executed during propose\n")
fmt.Printf("Exit Code: %d\n", retval.Code)
fmt.Printf("Return Value: %x\n", retval.Ret)
}
return nil return nil
}, },

View File

@ -2,6 +2,7 @@ package full
import ( import (
"context" "context"
"github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -115,7 +116,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
Params: params, Params: params,
}) })
if actErr != nil { if actErr != nil {
return cid.Undef, actErr return cid.Undef, xerrors.Errorf("failed to serialize parameters: %w", actErr)
} }
msg := &types.Message{ msg := &types.Message{
@ -130,7 +131,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg) smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg)
if err != nil { if err != nil {
return cid.Undef, nil return cid.Undef, xerrors.Errorf("failed to push message: %w", err)
} }
return smsg.Cid(), nil return smsg.Cid(), nil