From c244a0bbdc3ccd8c3ad0346257e3ed60b887d763 Mon Sep 17 00:00:00 2001 From: kaola526 Date: Fri, 10 Jun 2022 00:36:46 +0800 Subject: [PATCH 1/6] fix bug #8825 --- cli/multisig.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cli/multisig.go b/cli/multisig.go index d9255f6e4..7d58bb2e2 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -881,6 +881,40 @@ var msigAddProposeCmd = &cli.Command{ from = defaddr } + store := adt.WrapStore(ctx, cbor.NewCborStore(blockstore.NewAPIBlockstore(api))) + + head, err := api.ChainHead(ctx) + if err != nil { + return err + } + + act, err := api.StateGetActor(ctx, msig, head.Key()) + if err != nil { + return err + } + + mstate, err := multisig.Load(store, act) + if err != nil { + return err + } + + signers, err := mstate.Signers() + if err != nil { + return err + } + + for _, s := range signers { + signerActor, err := api.StateAccountKey(ctx, s, types.EmptyTSK) + if err != nil { + return err + } + + if signerActor == addr { + return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String()) + } + + } + proto, err := api.MsigAddPropose(ctx, msig, from, addr, cctx.Bool("increase-threshold")) if err != nil { return err From bc25a3fd37c6612aa065d1cea4252da2c4fd5bc5 Mon Sep 17 00:00:00 2001 From: kaola526 Date: Tue, 14 Jun 2022 10:40:45 +0800 Subject: [PATCH 2/6] fix bug --- cli/multisig.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cli/multisig.go b/cli/multisig.go index 7d58bb2e2..106fc3524 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -912,7 +912,6 @@ var msigAddProposeCmd = &cli.Command{ if signerActor == addr { return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String()) } - } proto, err := api.MsigAddPropose(ctx, msig, from, addr, cctx.Bool("increase-threshold")) From 51ad079bc704f37e9a7159f66f2992b376d4e8e1 Mon Sep 17 00:00:00 2001 From: kaola526 Date: Tue, 14 Jun 2022 11:17:04 +0800 Subject: [PATCH 3/6] fix bug --- cli/multisig.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/multisig.go b/cli/multisig.go index 106fc3524..89640ccf4 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -904,12 +904,12 @@ var msigAddProposeCmd = &cli.Command{ } for _, s := range signers { - signerActor, err := api.StateAccountKey(ctx, s, types.EmptyTSK) + addrId, err := api.StateLookupID(ctx, addr, types.EmptyTSK) if err != nil { return err } - if signerActor == addr { + if s == addrId { return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String()) } } From 2e3b8402ccef54618b93792a6b200e4ad4dcdc73 Mon Sep 17 00:00:00 2001 From: kaola526 <88829586+kaola526@users.noreply.github.com> Date: Wed, 15 Jun 2022 06:59:17 +0800 Subject: [PATCH 4/6] Update multisig.go --- cli/multisig.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/multisig.go b/cli/multisig.go index 3a868b6ed..ad5f4e757 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -899,13 +899,13 @@ var msigAddProposeCmd = &cli.Command{ if err != nil { return err } - + + addrId, err := api.StateLookupID(ctx, addr, types.EmptyTSK) + if err != nil { + return err + } + for _, s := range signers { - addrId, err := api.StateLookupID(ctx, addr, types.EmptyTSK) - if err != nil { - return err - } - if s == addrId { return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String()) } From e3003dce3189909689ebe6ba21572b66dc9d7fea Mon Sep 17 00:00:00 2001 From: kaola526 Date: Tue, 21 Jun 2022 17:49:10 +0800 Subject: [PATCH 5/6] fix ci/circleci error --- cli/multisig.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/multisig.go b/cli/multisig.go index df44e39dc..ebe0bc6e6 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -899,12 +899,12 @@ var msigAddProposeCmd = &cli.Command{ if err != nil { return err } - + addrId, err := api.StateLookupID(ctx, addr, types.EmptyTSK) if err != nil { return err } - + for _, s := range signers { if s == addrId { return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String()) From e278380f22b7619de5976f9ca21df80a787a7e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 7 Jul 2022 13:41:47 +0200 Subject: [PATCH 6/6] cli: msig: Cleanup duplicate signer message --- cli/multisig.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/multisig.go b/cli/multisig.go index ebe0bc6e6..f4b67e14d 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -907,7 +907,7 @@ var msigAddProposeCmd = &cli.Command{ for _, s := range signers { if s == addrId { - return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String()) + return fmt.Errorf("%s is already a signer", addr.String()) } }