From 04aec20e40473141018a22d5d52955896c6f71f0 Mon Sep 17 00:00:00 2001 From: Andrew Richardson Date: Fri, 24 Jun 2022 14:56:49 -0400 Subject: [PATCH] Disable identity resolution for local definitions Signed-off-by: Andrew Richardson --- internal/defsender/sender.go | 8 +++++--- internal/defsender/sender_test.go | 18 ++---------------- internal/identity/identitymanager.go | 4 ---- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/internal/defsender/sender.go b/internal/defsender/sender.go index c4f37e1f16..a56019ab6e 100644 --- a/internal/defsender/sender.go +++ b/internal/defsender/sender.go @@ -82,9 +82,11 @@ func (bm *definitionSender) CreateDefinition(ctx context.Context, def core.Defin func (bm *definitionSender) CreateDefinitionWithIdentity(ctx context.Context, def core.Definition, signingIdentity *core.SignerRef, tag string, waitConfirm bool) (msg *core.Message, err error) { - err = bm.identity.ResolveInputSigningIdentity(ctx, signingIdentity) - if err != nil { - return nil, err + if bm.multiparty { + err = bm.identity.ResolveInputSigningIdentity(ctx, signingIdentity) + if err != nil { + return nil, err + } } return bm.createDefinitionCommon(ctx, def, signingIdentity, tag, waitConfirm) diff --git a/internal/defsender/sender_test.go b/internal/defsender/sender_test.go index 9eeafc388d..ef520b32c4 100644 --- a/internal/defsender/sender_test.go +++ b/internal/defsender/sender_test.go @@ -152,6 +152,8 @@ func TestCreateDefinitionBadIdentity(t *testing.T) { ds, cancel := newTestDefinitionSender(t) defer cancel() + ds.multiparty = true + mim := ds.identity.(*identitymanagermocks.Manager) mim.On("ResolveInputSigningIdentity", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) _, err := ds.CreateDefinitionWithIdentity(ds.ctx, &core.Namespace{}, &core.SignerRef{ @@ -165,38 +167,22 @@ func TestCreateDefinitionLocal(t *testing.T) { ds, cancel := newTestDefinitionSender(t) defer cancel() - mim := ds.identity.(*identitymanagermocks.Manager) - mbm := ds.broadcast.(*broadcastmocks.Manager) - mms := &sysmessagingmocks.MessageSender{} mdh := &mockDefinitionHandler{} ds.Init(mdh) - mim.On("ResolveInputSigningIdentity", mock.Anything, mock.Anything).Return(nil) - _, err := ds.CreateDefinition(ds.ctx, &core.Datatype{}, core.SystemTagDefineDatatype, true) assert.NoError(t, err) - mim.AssertExpectations(t) - mbm.AssertExpectations(t) - mms.AssertExpectations(t) } func TestCreateDefinitionLocalError(t *testing.T) { ds, cancel := newTestDefinitionSender(t) defer cancel() - mim := ds.identity.(*identitymanagermocks.Manager) - mbm := ds.broadcast.(*broadcastmocks.Manager) - mms := &sysmessagingmocks.MessageSender{} mdh := &mockDefinitionHandler{err: fmt.Errorf("pop")} ds.Init(mdh) - mim.On("ResolveInputSigningIdentity", mock.Anything, mock.Anything).Return(nil) - _, err := ds.CreateDefinition(ds.ctx, &core.Datatype{}, core.SystemTagDefineDatatype, true) assert.EqualError(t, err, "pop") - mim.AssertExpectations(t) - mbm.AssertExpectations(t) - mms.AssertExpectations(t) } diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index c130774316..589fb6ea70 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -219,10 +219,6 @@ func (im *identityManager) resolveDefaultSigningIdentity(ctx context.Context, si if err != nil { return err } - if im.multiparty == nil { - signerRef.Key = verifierRef.Value - return nil - } identity, err := im.GetMultipartyRootOrg(ctx) if err != nil { return err