From ca42a2403d5898cb1030c0e067b8c4a408eb3a57 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Wed, 15 Sep 2021 01:35:12 -0400 Subject: [PATCH 01/15] Add identity manager and API input matrix logic Signed-off-by: Peter Broadhurst --- Makefile | 1 + README.md | 19 +- internal/assets/manager.go | 10 +- internal/batchpin/batchpin.go | 8 +- internal/blockchain/ethereum/ethereum.go | 13 +- internal/blockchain/ethereum/ethereum_test.go | 14 +- internal/broadcast/manager.go | 10 +- internal/config/config.go | 6 + internal/i18n/en_translations.go | 3 + internal/identity/identitymanager.go | 185 +++++++++++ internal/identity/identitymanager_test.go | 303 ++++++++++++++++++ internal/identity/iifactory/factory.go | 4 +- internal/identity/{onchain => tbd}/config.go | 4 +- .../{onchain/onchain.go => tbd/tbd.go} | 29 +- .../onchain_test.go => tbd/tbd_test.go} | 15 +- internal/networkmap/manager.go | 10 +- internal/orchestrator/orchestrator.go | 55 ++-- internal/orchestrator/orchestrator_test.go | 3 + internal/privatemessaging/privatemessaging.go | 10 +- internal/syscore/syscore.go | 30 ++ mocks/blockchainmocks/plugin.go | 43 +-- mocks/identitymanagermocks/manager.go | 30 ++ mocks/identitymocks/plugin.go | 25 -- mocks/syscoremocks/system_core.go | 54 ++++ pkg/blockchain/plugin.go | 4 +- pkg/fftypes/identity.go | 9 +- pkg/identity/plugin.go | 10 +- 27 files changed, 749 insertions(+), 158 deletions(-) create mode 100644 internal/identity/identitymanager.go create mode 100644 internal/identity/identitymanager_test.go rename internal/identity/{onchain => tbd}/config.go (90%) rename internal/identity/{onchain/onchain.go => tbd/tbd.go} (58%) rename internal/identity/{onchain/onchain_test.go => tbd/tbd_test.go} (76%) create mode 100644 internal/syscore/syscore.go create mode 100644 mocks/identitymanagermocks/manager.go create mode 100644 mocks/syscoremocks/system_core.go diff --git a/Makefile b/Makefile index 3e00a76454..6f4fa001c3 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ $(eval $(call makemock, pkg/dataexchange, Plugin, dataexchangem $(eval $(call makemock, pkg/dataexchange, Callbacks, dataexchangemocks)) $(eval $(call makemock, pkg/tokens, Plugin, tokenmocks)) $(eval $(call makemock, pkg/tokens, Callbacks, tokenmocks)) +$(eval $(call makemock, internal/identity, Manager, identitymanagermocks)) $(eval $(call makemock, internal/batchpin, Submitter, batchpinmocks)) $(eval $(call makemock, internal/sysmessaging, SystemEvents, sysmessagingmocks)) $(eval $(call makemock, internal/syncasync, Bridge, syncasyncmocks)) diff --git a/README.md b/README.md index 745fc8896b..46b768c586 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,12 @@ It depends on the following Kaleido services: │ │ │ │ * Hashes data, and maintains mapping to payload references in blob storage │ │ └───────────────┘ * Integrates with blockchain interface [Bi] plugin │ │ + │ │ ┌───────────────┐ + │ ├───┤ identity [Im] │ - Central identity management service across components + │ │ │ manager │ * Resolves API input identity + key combos (short names, formatting etc.) + │ │ │ │ * Resolves registered on-chain signing keys back to identities + │ │ └───────────────┘ * Integrates with Blockchain Interface and plugable Identity Interface (TBD) + │ │ │ │ ┌───────────────┐ - Private data management and validation │ ├───┤ event [Em]│ * Implements dispatcher for batch component │ │ │ manager │ * Integrates with data exchange [Dx] plugin @@ -268,15 +274,10 @@ Plugins: Each plugin comprises a Go shim, plus a remote agent microservice runti │ │ httpdirect │ │ kaleido │ │ └───────────────┘ └───────────────┘ │ - │ ┌───────────────┐ - Identity resolution and mapping - ├───────────┤ identity [Ii]│ * Resolves opaque identifiers used throughout FireFly - │ │ interface │ * Maps to and from blockchain signing identities - │ └─────┬─────────┘ * Map API/user identities from authentication, to network/organizational identities - │ │ - │ ├───────────── ... extensible to DIDs etc. - │ ┌─────┴─────────┐ - │ │ onchain │ - │ └───────────────┘ + │ ┌───────────────┐ - Pluggable identity infrastructure + ├───────────┤ identity [Ii]│ * TBD + │ │ interface │ * See Identity Manager component above + │ └───────────────┘ * See Issue │ │ ┌───────────────┐ - API Authentication and Authorization Interface ├───────────┤ api auth [Aa]│ * Authenticates security credentials (OpenID Connect id token JWTs etc.) diff --git a/internal/assets/manager.go b/internal/assets/manager.go index 053cb2dd07..3a0ce256a4 100644 --- a/internal/assets/manager.go +++ b/internal/assets/manager.go @@ -22,10 +22,10 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/data" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/internal/syncasync" "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" "github.com/hyperledger-labs/firefly/pkg/tokens" ) @@ -42,20 +42,20 @@ type Manager interface { type assetManager struct { ctx context.Context database database.Plugin - identity identity.Plugin + identity identity.Manager data data.Manager syncasync syncasync.Bridge tokens map[string]tokens.Plugin } -func NewAssetManager(ctx context.Context, di database.Plugin, ii identity.Plugin, dm data.Manager, sa syncasync.Bridge, ti map[string]tokens.Plugin) (Manager, error) { - if di == nil || ii == nil || sa == nil || ti == nil { +func NewAssetManager(ctx context.Context, di database.Plugin, im identity.Manager, dm data.Manager, sa syncasync.Bridge, ti map[string]tokens.Plugin) (Manager, error) { + if di == nil || im == nil || sa == nil || ti == nil { return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) } am := &assetManager{ ctx: ctx, database: di, - identity: ii, + identity: im, data: dm, syncasync: sa, tokens: ti, diff --git a/internal/batchpin/batchpin.go b/internal/batchpin/batchpin.go index 1a6366b114..38979d2589 100644 --- a/internal/batchpin/batchpin.go +++ b/internal/batchpin/batchpin.go @@ -19,11 +19,11 @@ package batchpin import ( "context" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/pkg/blockchain" "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" ) type Submitter interface { @@ -32,14 +32,14 @@ type Submitter interface { type batchPinSubmitter struct { database database.Plugin - identity identity.Plugin + identity identity.Manager blockchain blockchain.Plugin } -func NewBatchPinSubmitter(di database.Plugin, ii identity.Plugin, bi blockchain.Plugin) Submitter { +func NewBatchPinSubmitter(di database.Plugin, im identity.Manager, bi blockchain.Plugin) Submitter { return &batchPinSubmitter{ database: di, - identity: ii, + identity: im, blockchain: bi, } } diff --git a/internal/blockchain/ethereum/ethereum.go b/internal/blockchain/ethereum/ethereum.go index f9bd350085..8be5390687 100644 --- a/internal/blockchain/ethereum/ethereum.go +++ b/internal/blockchain/ethereum/ethereum.go @@ -422,9 +422,8 @@ func (e *Ethereum) eventLoop() { } } -func (e *Ethereum) VerifyIdentitySyntax(ctx context.Context, identity *fftypes.Identity) (err error) { - identity.OnChain, err = e.validateEthAddress(ctx, identity.OnChain) - return +func (e *Ethereum) ResolveSigningKey(ctx context.Context, signingKeyInput string) (signingKey string, err error) { + return e.validateEthAddress(ctx, signingKeyInput) } func (e *Ethereum) validateEthAddress(ctx context.Context, identity string) (string, error) { @@ -435,10 +434,10 @@ func (e *Ethereum) validateEthAddress(ctx context.Context, identity string) (str return "0x" + identity, nil } -func (e *Ethereum) invokeContractMethod(ctx context.Context, method string, identity *fftypes.Identity, requestID string, input interface{}, output interface{}) (*resty.Response, error) { +func (e *Ethereum) invokeContractMethod(ctx context.Context, method, signingKey string, requestID string, input interface{}, output interface{}) (*resty.Response, error) { return e.client.R(). SetContext(ctx). - SetQueryParam(e.prefixShort+"-from", identity.OnChain). + SetQueryParam(e.prefixShort+"-from", signingKey). SetQueryParam(e.prefixShort+"-sync", "false"). SetQueryParam(e.prefixShort+"-id", requestID). SetBody(input). @@ -446,7 +445,7 @@ func (e *Ethereum) invokeContractMethod(ctx context.Context, method string, iden Post(e.instancePath + "/" + method) } -func (e *Ethereum) SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, identity *fftypes.Identity, batch *blockchain.BatchPin) error { +func (e *Ethereum) SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, signingKey string, batch *blockchain.BatchPin) error { tx := &asyncTXSubmission{} ethHashes := make([]string, len(batch.Contexts)) for i, v := range batch.Contexts { @@ -462,7 +461,7 @@ func (e *Ethereum) SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, i PayloadRef: batch.BatchPaylodRef, Contexts: ethHashes, } - res, err := e.invokeContractMethod(ctx, "pinBatch", identity, batch.TransactionID.String(), input, tx) + res, err := e.invokeContractMethod(ctx, "pinBatch", signingKey, batch.TransactionID.String(), input, tx) if err != nil || !res.IsSuccess() { return restclient.WrapRestErr(ctx, res, err, i18n.MsgEthconnectRESTErr) } diff --git a/internal/blockchain/ethereum/ethereum_test.go b/internal/blockchain/ethereum/ethereum_test.go index 2876c154f6..e5ea9e47dc 100644 --- a/internal/blockchain/ethereum/ethereum_test.go +++ b/internal/blockchain/ethereum/ethereum_test.go @@ -372,7 +372,7 @@ func TestSubmitBatchPinOK(t *testing.T) { return httpmock.NewJsonResponderOrPanic(200, asyncTXSubmission{})(req) }) - err := e.SubmitBatchPin(context.Background(), nil, &fftypes.Identity{OnChain: addr}, batch) + err := e.SubmitBatchPin(context.Background(), nil, addr, batch) assert.NoError(t, err) @@ -408,7 +408,7 @@ func TestSubmitBatchEmptyPayloadRef(t *testing.T) { return httpmock.NewJsonResponderOrPanic(200, asyncTXSubmission{})(req) }) - err := e.SubmitBatchPin(context.Background(), nil, &fftypes.Identity{OnChain: addr}, batch) + err := e.SubmitBatchPin(context.Background(), nil, addr, batch) assert.NoError(t, err) @@ -436,7 +436,7 @@ func TestSubmitBatchPinFail(t *testing.T) { httpmock.RegisterResponder("POST", `http://localhost:12345/instances/0x12345/pinBatch`, httpmock.NewStringResponder(500, "pop")) - err := e.SubmitBatchPin(context.Background(), nil, &fftypes.Identity{OnChain: addr}, batch) + err := e.SubmitBatchPin(context.Background(), nil, addr, batch) assert.Regexp(t, "FF10111", err) assert.Regexp(t, "pop", err) @@ -447,14 +447,12 @@ func TestVerifyEthAddress(t *testing.T) { e, cancel := newTestEthereum() defer cancel() - id := &fftypes.Identity{OnChain: "0x12345"} - err := e.VerifyIdentitySyntax(context.Background(), id) + _, err := e.ResolveSigningKey(context.Background(), "0x12345") assert.Regexp(t, "FF10141", err) - id = &fftypes.Identity{OnChain: "0x2a7c9D5248681CE6c393117E641aD037F5C079F6"} - err = e.VerifyIdentitySyntax(context.Background(), id) + key, err := e.ResolveSigningKey(context.Background(), "0x2a7c9D5248681CE6c393117E641aD037F5C079F6") assert.NoError(t, err) - assert.Equal(t, "0x2a7c9d5248681ce6c393117e641ad037f5c079f6", id.OnChain) + assert.Equal(t, "0x2a7c9d5248681ce6c393117e641ad037f5c079f6", key) } diff --git a/internal/broadcast/manager.go b/internal/broadcast/manager.go index 4b21a9b97e..ed1e659476 100644 --- a/internal/broadcast/manager.go +++ b/internal/broadcast/manager.go @@ -26,12 +26,12 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/data" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/internal/syncasync" "github.com/hyperledger-labs/firefly/pkg/blockchain" "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/dataexchange" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" "github.com/hyperledger-labs/firefly/pkg/publicstorage" ) @@ -49,7 +49,7 @@ type Manager interface { type broadcastManager struct { ctx context.Context database database.Plugin - identity identity.Plugin + identity identity.Manager data data.Manager blockchain blockchain.Plugin exchange dataexchange.Plugin @@ -59,14 +59,14 @@ type broadcastManager struct { batchpin batchpin.Submitter } -func NewBroadcastManager(ctx context.Context, di database.Plugin, ii identity.Plugin, dm data.Manager, bi blockchain.Plugin, dx dataexchange.Plugin, pi publicstorage.Plugin, ba batch.Manager, sa syncasync.Bridge, bp batchpin.Submitter) (Manager, error) { - if di == nil || ii == nil || dm == nil || bi == nil || dx == nil || pi == nil || ba == nil { +func NewBroadcastManager(ctx context.Context, di database.Plugin, im identity.Manager, dm data.Manager, bi blockchain.Plugin, dx dataexchange.Plugin, pi publicstorage.Plugin, ba batch.Manager, sa syncasync.Bridge, bp batchpin.Submitter) (Manager, error) { + if di == nil || im == nil || dm == nil || bi == nil || dx == nil || pi == nil || ba == nil { return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) } bm := &broadcastManager{ ctx: ctx, database: di, - identity: ii, + identity: im, data: dm, blockchain: bi, exchange: dx, diff --git a/internal/config/config.go b/internal/config/config.go index 596d49d56c..cb1be15fed 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -151,6 +151,10 @@ var ( AdminPreinit = rootKey("admin.preinit") // IdentityType the type of the identity plugin in use IdentityType = rootKey("identity.type") + // IdentityManagerCacheTTL the identity manager cache time to live + IdentityManagerCacheTTL = rootKey("identity.manager.cache.ttl") + // IdentityManagerCacheLimit the identity manager cache limit in count of items + IdentityManagerCacheLimit = rootKey("identity.manager.cache.limit") // Lang is the language to use for translation Lang = rootKey("lang") // LogForceColor forces color to be enabled, even if we do not detect a TTY @@ -325,6 +329,8 @@ func Reset() { viper.SetDefault(string(UIEnabled), true) viper.SetDefault(string(ValidatorCacheSize), "1Mb") viper.SetDefault(string(ValidatorCacheTTL), "1h") + viper.SetDefault(string(IdentityManagerCacheLimit), 100 /* items */) + viper.SetDefault(string(IdentityManagerCacheTTL), "1h") i18n.SetLang(GetString(Lang)) } diff --git a/internal/i18n/en_translations.go b/internal/i18n/en_translations.go index 4ac5d45c58..8d697c0785 100644 --- a/internal/i18n/en_translations.go +++ b/internal/i18n/en_translations.go @@ -194,4 +194,7 @@ var ( MsgTokensRESTErr = ffm("FF10274", "Error from tokens service: %s") MsgTokenPoolDuplicate = ffm("FF10275", "Duplicate token pool") MsgTokenPoolRejected = ffm("FF10276", "Token pool with ID '%s' was rejected. Please check the FireFly logs for more information") + MsgAuthorNotFoundByDID = ffm("FF10277", "Author could not be resolved via DID '%s'") + MsgAuthorOrgNotFoundByName = ffm("FF10278", "Author organization could not be resolved via name '%s'") + MsgAuthorOrgSigningKeyMismatch = ffm("FF10279", "Author organization '%s' is not associated with signing key '%s'") ) diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go new file mode 100644 index 0000000000..8f04c896cf --- /dev/null +++ b/internal/identity/identitymanager.go @@ -0,0 +1,185 @@ +// Copyright © 2021 Kaleido, Inc. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package identity + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger-labs/firefly/pkg/blockchain" + "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger-labs/firefly/pkg/identity" + "github.com/karlseguin/ccache" +) + +const ( + fireflyOrgDIDPrefix = "did:firefly:org/" +) + +type Manager interface { + ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) +} + +type identityManager struct { + database database.Plugin + plugin identity.Plugin + blockchain blockchain.Plugin + + identityCacheTTL time.Duration + identityCache *ccache.Cache + signingKeyCacheTTL time.Duration + signingKeyCache *ccache.Cache +} + +func NewIdentityManager(ctx context.Context, di database.Plugin, ii identity.Plugin, bi blockchain.Plugin) (Manager, error) { + if di == nil || ii == nil || bi == nil { + return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) + } + im := &identityManager{ + database: di, + plugin: ii, + blockchain: bi, + identityCacheTTL: config.GetDuration(config.IdentityManagerCacheTTL), + signingKeyCacheTTL: config.GetDuration(config.IdentityManagerCacheTTL), + } + // For the identity and signingkey caches, we just treat them all equally sized and the max items + im.identityCache = ccache.New( + ccache.Configure().MaxSize(config.GetInt64(config.IdentityManagerCacheLimit)), + ) + im.signingKeyCache = ccache.New( + ccache.Configure().MaxSize(config.GetInt64(config.IdentityManagerCacheLimit)), + ) + + return im, nil +} + +// ResolveInputIdentity takes in identity input information from an API call, or configuration load, and resolves +// the combination +func (im *identityManager) ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) { + log.L(ctx).Debugf("Resolving identity input: key='%s' author='%s'", identity.Key, identity.Author) + + if identity.Key != "" { + err = im.resolveSigningKey(ctx, identity) + if err != nil { + return err + } + } + + // Resolve the identity + if err = im.resolveInputAuthor(ctx, identity); err != nil { + return err + } + + log.L(ctx).Debugf("Resolved identity: key='%s' author='%s'", identity.Key, identity.Author) + return +} + +func (im *identityManager) cachedOrgLookupByAuthor(ctx context.Context, author string) (org *fftypes.Organization, err error) { + // Use an LRU cache for the author identity, as it's likely for the same identity to be re-used over and over + if cached := im.identityCache.Get(author); cached != nil { + cached.Extend(im.identityCacheTTL) + org = cached.Value().(*fftypes.Organization) + } else { + // TODO: Per comments in https://github.com/hyperledger-labs/firefly/issues/187 we need to resolve whether "Organization" + // is the right thing to resolve here. We might want to fall-back to that in the case of plain string, but likely + // we need something more sophisticated here where we have an Identity object in the database. + if strings.HasPrefix(author, fireflyOrgDIDPrefix) { + orgUUID, err := fftypes.ParseUUID(ctx, strings.TrimPrefix(author, fireflyOrgDIDPrefix)) + if err != nil { + return nil, err + } + if org, err = im.database.GetOrganizationByID(ctx, orgUUID); err != nil { + return nil, err + } + if org == nil { + return nil, i18n.NewError(ctx, i18n.MsgAuthorNotFoundByDID, author) + } + } else { + if org, err = im.database.GetOrganizationByName(ctx, author); err != nil { + return nil, err + } + if org == nil { + return nil, i18n.NewError(ctx, i18n.MsgAuthorOrgNotFoundByName, author) + } + } + + // Cache the result + im.identityCache.Set(author, org, im.identityCacheTTL) + } + return org, nil +} + +func (im *identityManager) resolveInputAuthor(ctx context.Context, identity *fftypes.Identity) (err error) { + + var org *fftypes.Organization + if identity.Author == "" { + // We allow lookup of an org by signing key (this convenience mechanism is currently not cached) + if identity.Key != "" { + if org, err = im.database.GetOrganizationByIdentity(ctx, identity.Key); err != nil { + return err + } + } + if org == nil { + // Otherwise default to the org identity that owns this node, if no input author specified + identity.Author = config.GetString(config.OrgName) + } + } + + if org == nil { + if org, err = im.cachedOrgLookupByAuthor(ctx, identity.Author); err != nil { + return err + } + } + + // TODO: Organizations should be able to have multiple signing keys. See notes below about whether a level of + // indirection is needed in front of orgs (likely it is). + if identity.Key == "" { + identity.Key = org.Identity + } else if org.Identity != identity.Key { + return i18n.NewError(ctx, i18n.MsgAuthorOrgSigningKeyMismatch, org.ID, identity.Key) + } + + // We normalize the author to the DID + identity.Author = fmt.Sprintf("%s%s", fireflyOrgDIDPrefix, org.ID) + return nil + +} + +func (im *identityManager) resolveSigningKey(ctx context.Context, identity *fftypes.Identity) (err error) { + // Resolve the signing key + if identity.Key != "" { + inputKey := identity.Key + if cached := im.signingKeyCache.Get(inputKey); cached != nil { + cached.Extend(im.identityCacheTTL) + identity.Key = cached.Value().(string) + } else { + identity.Key, err = im.blockchain.ResolveSigningKey(ctx, inputKey) + if err != nil { + return err + } + im.signingKeyCache.Set(inputKey, identity.Key, im.identityCacheTTL) + } + } + + return +} diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go new file mode 100644 index 0000000000..b0c945d678 --- /dev/null +++ b/internal/identity/identitymanager_test.go @@ -0,0 +1,303 @@ +// Copyright © 2021 Kaleido, Inc. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package identity + +import ( + "context" + "fmt" + "testing" + + "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" + "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/stretchr/testify/assert" +) + +func newTestIdentityManager(t *testing.T) (context.Context, *identityManager) { + + mdi := &databasemocks.Plugin{} + mii := &identitymocks.Plugin{} + mbi := &blockchainmocks.Plugin{} + + config.Reset() + + ctx := context.Background() + im, err := NewIdentityManager(ctx, mdi, mii, mbi) + assert.NoError(t, err) + return ctx, im.(*identityManager) +} + +func TestNewIdentityManagerMissingDeps(t *testing.T) { + _, err := NewIdentityManager(context.Background(), nil, nil, nil) + assert.Regexp(t, "FF10128", err) +} + +func TestResolveInputIdentityBlankBlank(t *testing.T) { + + identity := &fftypes.Identity{} + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x12345", + } + + ctx, im := newTestIdentityManager(t) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByName", ctx, "org1").Return(org, nil).Once() + + config.Set(config.OrgName, "org1") + + err := im.ResolveInputIdentity(ctx, identity) + assert.NoError(t, err) + assert.Equal(t, "0x12345", identity.Key) + assert.Equal(t, fmt.Sprintf("did:firefly:org/%s", org.ID), identity.Author) + + // Cached result (note once above) + err = im.ResolveInputIdentity(ctx, &fftypes.Identity{}) + assert.NoError(t, err) + mdi.AssertExpectations(t) +} + +func TestResolveInputIdentityBlankShortKeyNameResolved(t *testing.T) { + + identity := &fftypes.Identity{ + Key: "org1key", + } + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x12345", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "org1key").Return("0x12345", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "0x12345").Return(org, nil).Once() + + config.Set(config.OrgName, "org1") + + err := im.ResolveInputIdentity(ctx, identity) + assert.NoError(t, err) + assert.Equal(t, "0x12345", identity.Key) + assert.Equal(t, fmt.Sprintf("did:firefly:org/%s", org.ID), identity.Author) + mbi.AssertExpectations(t) + mdi.AssertExpectations(t) + +} + +func TestResolveInputIdentityBlankShortKeyNameUnresolved(t *testing.T) { + + identity := &fftypes.Identity{ + Key: "org1key", + } + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x12345", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "org1key").Return("0x12345", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "0x12345").Return(nil, nil).Once() + mdi.On("GetOrganizationByName", ctx, "org1").Return(org, nil).Once() + + config.Set(config.OrgName, "org1") + + err := im.ResolveInputIdentity(ctx, identity) + assert.NoError(t, err) + assert.Equal(t, "0x12345", identity.Key) + assert.Equal(t, fmt.Sprintf("did:firefly:org/%s", org.ID), identity.Author) + + mbi.AssertExpectations(t) + mdi.AssertExpectations(t) + +} + +func TestResolveInputIdentityBlankShortKeyNameFail(t *testing.T) { + + identity := &fftypes.Identity{ + Key: "org1key", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "org1key").Return("0x12345", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "0x12345").Return(nil, fmt.Errorf("pop")).Once() + + config.Set(config.OrgName, "org1") + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "pop", err) + + mbi.AssertExpectations(t) + mdi.AssertExpectations(t) + +} + +func TestResolveInputIdentityOrgIdShortKeyName(t *testing.T) { + + identity := &fftypes.Identity{ + Key: "org1key", + Author: "org1", + } + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x12345", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "org1key").Return("0x12345", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByName", ctx, "org1").Return(org, nil).Once() + + err := im.ResolveInputIdentity(ctx, identity) + assert.NoError(t, err) + assert.Equal(t, "0x12345", identity.Key) + assert.Equal(t, fmt.Sprintf("did:firefly:org/%s", org.ID), identity.Author) + + // Cached result (note once on mocks above) + err = im.ResolveInputIdentity(ctx, &fftypes.Identity{ + Key: "org1key", + Author: "org1", + }) + assert.NoError(t, err) + + mbi.AssertExpectations(t) + mdi.AssertExpectations(t) +} + +func TestResolveInputIdentityOrgKeyMismatch(t *testing.T) { + + identity := &fftypes.Identity{ + Key: "org1key", + Author: "org1", + } + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x222222", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "org1key").Return("0x111111", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByName", ctx, "org1").Return(org, nil).Once() + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "FF10279", err) + + mbi.AssertExpectations(t) + mdi.AssertExpectations(t) +} + +func TestResolveInputIdentityResolveKeyFail(t *testing.T) { + + identity := &fftypes.Identity{ + Key: "org1key", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "org1key").Return("", fmt.Errorf("pop")) + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, err, "pop") + mbi.AssertExpectations(t) +} + +func TestResolveInputIdentityBadOrgDID(t *testing.T) { + + identity := &fftypes.Identity{ + Author: "did:firefly:org/!NoUUIDHere!", + } + + ctx, im := newTestIdentityManager(t) + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "FF10142", err) +} + +func TestResolveInputIdentityOrgLookupByDIDFail(t *testing.T) { + + orgId := fftypes.NewUUID() + identity := &fftypes.Identity{ + Author: fmt.Sprintf("did:firefly:org/%s", orgId), + } + + ctx, im := newTestIdentityManager(t) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByID", ctx, orgId).Return(nil, fmt.Errorf("pop")) + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "pop", err) + mdi.AssertExpectations(t) +} + +func TestResolveInputIdentityOrgLookupByDIDNotFound(t *testing.T) { + + orgId := fftypes.NewUUID() + identity := &fftypes.Identity{ + Author: fmt.Sprintf("did:firefly:org/%s", orgId), + } + + ctx, im := newTestIdentityManager(t) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByID", ctx, orgId).Return(nil, nil) + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "FF10277", err) + mdi.AssertExpectations(t) +} + +func TestResolveInputIdentityOrgLookupByNameFail(t *testing.T) { + + identity := &fftypes.Identity{ + Author: "org1", + } + + ctx, im := newTestIdentityManager(t) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByName", ctx, "org1").Return(nil, fmt.Errorf("pop")) + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "pop", err) + mdi.AssertExpectations(t) +} + +func TestResolveInputIdentityOrgLookupByNameNotFound(t *testing.T) { + + identity := &fftypes.Identity{ + Author: "org1", + } + + ctx, im := newTestIdentityManager(t) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByName", ctx, "org1").Return(nil, nil) + + err := im.ResolveInputIdentity(ctx, identity) + assert.Regexp(t, "FF10278", err) + mdi.AssertExpectations(t) +} diff --git a/internal/identity/iifactory/factory.go b/internal/identity/iifactory/factory.go index 3e7af39c0e..1dbe032d67 100644 --- a/internal/identity/iifactory/factory.go +++ b/internal/identity/iifactory/factory.go @@ -21,12 +21,12 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity/onchain" + "github.com/hyperledger-labs/firefly/internal/identity/tbd" "github.com/hyperledger-labs/firefly/pkg/identity" ) var plugins = []identity.Plugin{ - &onchain.OnChain{}, + &tbd.TBD{}, // Plugin interface is TBD at this point. Plugin with "onchain" naming, and TBD implementation provided to avoid config migration impact } var pluginsByName = make(map[string]identity.Plugin) diff --git a/internal/identity/onchain/config.go b/internal/identity/tbd/config.go similarity index 90% rename from internal/identity/onchain/config.go rename to internal/identity/tbd/config.go index fb9a5af23a..874729510f 100644 --- a/internal/identity/onchain/config.go +++ b/internal/identity/tbd/config.go @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package onchain +package tbd import ( "github.com/hyperledger-labs/firefly/internal/config" ) -func (oc *OnChain) InitPrefix(prefix config.Prefix) { +func (tbd *TBD) InitPrefix(prefix config.Prefix) { } diff --git a/internal/identity/onchain/onchain.go b/internal/identity/tbd/tbd.go similarity index 58% rename from internal/identity/onchain/onchain.go rename to internal/identity/tbd/tbd.go index 25308d7884..762794e330 100644 --- a/internal/identity/onchain/onchain.go +++ b/internal/identity/tbd/tbd.go @@ -14,42 +14,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -package onchain +package tbd import ( "context" "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/hyperledger-labs/firefly/pkg/identity" ) -type OnChain struct { +// TBD is a null implementation of the Identity Interface to avoid breaking configuration created with the previous "onchain" plugin +type TBD struct { capabilities *identity.Capabilities callbacks identity.Callbacks } -func (oc *OnChain) Name() string { - return "onchain" +func (tbd *TBD) Name() string { + return "onchain" // For backwards compatibility with previous config that might have specified "onchain" } -func (oc *OnChain) Init(ctx context.Context, prefix config.Prefix, callbacks identity.Callbacks) (err error) { - oc.callbacks = callbacks - oc.capabilities = &identity.Capabilities{} +func (tbd *TBD) Init(ctx context.Context, prefix config.Prefix, callbacks identity.Callbacks) (err error) { + tbd.callbacks = callbacks + tbd.capabilities = &identity.Capabilities{} return nil } -func (oc *OnChain) Start() error { +func (tbd *TBD) Start() error { return nil } -func (oc *OnChain) Capabilities() *identity.Capabilities { - return oc.capabilities -} - -func (oc *OnChain) Resolve(ctx context.Context, identifier string) (*fftypes.Identity, error) { - return &fftypes.Identity{ - Identifier: identifier, - OnChain: identifier, - }, nil +func (tbd *TBD) Capabilities() *identity.Capabilities { + return tbd.capabilities } diff --git a/internal/identity/onchain/onchain_test.go b/internal/identity/tbd/tbd_test.go similarity index 76% rename from internal/identity/onchain/onchain_test.go rename to internal/identity/tbd/tbd_test.go index 75fb931fcb..d5de9b0481 100644 --- a/internal/identity/onchain/onchain_test.go +++ b/internal/identity/tbd/tbd_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package onchain +package tbd import ( "context" @@ -29,7 +29,7 @@ import ( var utConfPrefix = config.NewPluginConfig("onchain_unit_tests") func TestInit(t *testing.T) { - var oc identity.Plugin = &OnChain{} + var oc identity.Plugin = &TBD{} oc.InitPrefix(utConfPrefix) err := oc.Init(context.Background(), utConfPrefix, &identitymocks.Callbacks{}) assert.NoError(t, err) @@ -39,14 +39,3 @@ func TestInit(t *testing.T) { capabilities := oc.Capabilities() assert.NotNil(t, capabilities) } - -func TestResolve(t *testing.T) { - var oc identity.Plugin = &OnChain{} - err := oc.Init(context.Background(), utConfPrefix, &identitymocks.Callbacks{}) - assert.NoError(t, err) - - id, err := oc.Resolve(context.Background(), "0x12345") - assert.NoError(t, err) - assert.Equal(t, "0x12345", id.Identifier) - assert.Equal(t, "0x12345", id.OnChain) -} diff --git a/internal/networkmap/manager.go b/internal/networkmap/manager.go index d0913702f4..458c451238 100644 --- a/internal/networkmap/manager.go +++ b/internal/networkmap/manager.go @@ -21,10 +21,10 @@ import ( "github.com/hyperledger-labs/firefly/internal/broadcast" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/dataexchange" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" ) type Manager interface { @@ -43,11 +43,11 @@ type networkMap struct { database database.Plugin broadcast broadcast.Manager exchange dataexchange.Plugin - identity identity.Plugin + identity identity.Manager } -func NewNetworkMap(ctx context.Context, di database.Plugin, bm broadcast.Manager, dx dataexchange.Plugin, ii identity.Plugin) (Manager, error) { - if di == nil || bm == nil || dx == nil || ii == nil { +func NewNetworkMap(ctx context.Context, di database.Plugin, bm broadcast.Manager, dx dataexchange.Plugin, im identity.Manager) (Manager, error) { + if di == nil || bm == nil || dx == nil || im == nil { return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) } @@ -56,7 +56,7 @@ func NewNetworkMap(ctx context.Context, di database.Plugin, bm broadcast.Manager database: di, broadcast: bm, exchange: dx, - identity: ii, + identity: im, } return nm, nil } diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index d6b6a22e4e..75d8c11ec2 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -31,6 +31,7 @@ import ( "github.com/hyperledger-labs/firefly/internal/dataexchange/dxfactory" "github.com/hyperledger-labs/firefly/internal/events" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/internal/identity/iifactory" "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/internal/networkmap" @@ -43,7 +44,7 @@ import ( "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/dataexchange" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" + idplugin "github.com/hyperledger-labs/firefly/pkg/identity" "github.com/hyperledger-labs/firefly/pkg/publicstorage" "github.com/hyperledger-labs/firefly/pkg/tokens" ) @@ -118,27 +119,28 @@ type Orchestrator interface { } type orchestrator struct { - ctx context.Context - cancelCtx context.CancelFunc - started bool - database database.Plugin - blockchain blockchain.Plugin - identity identity.Plugin - publicstorage publicstorage.Plugin - dataexchange dataexchange.Plugin - events events.EventManager - networkmap networkmap.Manager - batch batch.Manager - broadcast broadcast.Manager - messaging privatemessaging.Manager - syshandlers syshandlers.SystemHandlers - data data.Manager - syncasync syncasync.Bridge - batchpin batchpin.Submitter - assets assets.Manager - tokens map[string]tokens.Plugin - bc boundCallbacks - preInitMode bool + ctx context.Context + cancelCtx context.CancelFunc + started bool + database database.Plugin + blockchain blockchain.Plugin + identity identity.Manager + identityPlugin idplugin.Plugin + publicstorage publicstorage.Plugin + dataexchange dataexchange.Plugin + events events.EventManager + networkmap networkmap.Manager + batch batch.Manager + broadcast broadcast.Manager + messaging privatemessaging.Manager + syshandlers syshandlers.SystemHandlers + data data.Manager + syncasync syncasync.Bridge + batchpin batchpin.Submitter + assets assets.Manager + tokens map[string]tokens.Plugin + bc boundCallbacks + preInitMode bool } func NewOrchestrator() Orchestrator { @@ -285,7 +287,7 @@ func (or *orchestrator) initPlugins(ctx context.Context) (err error) { return err } } - if err = or.identity.Init(ctx, identityConfig.SubPrefix(or.identity.Name()), or); err != nil { + if err = or.identityPlugin.Init(ctx, identityConfig.SubPrefix(or.identityPlugin.Name()), or); err != nil { return err } @@ -346,6 +348,13 @@ func (or *orchestrator) initPlugins(ctx context.Context) (err error) { func (or *orchestrator) initComponents(ctx context.Context) (err error) { + if or.identity == nil { + or.identity, err = identity.NewIdentityManager(ctx, or.database, or.identityPlugin, or.blockchain) + if err != nil { + return err + } + } + if or.data == nil { or.data, err = data.NewDataManager(ctx, or.database, or.publicstorage, or.dataexchange) if err != nil { diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go index 49ae6e69f4..f7d0bc8f38 100644 --- a/internal/orchestrator/orchestrator_test.go +++ b/internal/orchestrator/orchestrator_test.go @@ -32,6 +32,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" "github.com/hyperledger-labs/firefly/mocks/eventmocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/identitymocks" "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" @@ -58,6 +59,7 @@ type testOrchestrator struct { mpm *privatemessagingmocks.Manager mbi *blockchainmocks.Plugin mii *identitymocks.Plugin + mim *identitymanagermocks.Manager mdx *dataexchangemocks.Plugin mam *assetmocks.Manager mti *tokenmocks.Plugin @@ -81,6 +83,7 @@ func newTestOrchestrator() *testOrchestrator { mpm: &privatemessagingmocks.Manager{}, mbi: &blockchainmocks.Plugin{}, mii: &identitymocks.Plugin{}, + mim: &identitymanagermocks.Manager{}, mdx: &dataexchangemocks.Plugin{}, mam: &assetmocks.Manager{}, mti: &tokenmocks.Plugin{}, diff --git a/internal/privatemessaging/privatemessaging.go b/internal/privatemessaging/privatemessaging.go index 7460817f1c..c8c64fd037 100644 --- a/internal/privatemessaging/privatemessaging.go +++ b/internal/privatemessaging/privatemessaging.go @@ -25,6 +25,7 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/data" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/internal/retry" "github.com/hyperledger-labs/firefly/internal/syncasync" @@ -32,7 +33,6 @@ import ( "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/dataexchange" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" "github.com/karlseguin/ccache" ) @@ -50,7 +50,7 @@ type privateMessaging struct { ctx context.Context database database.Plugin - identity identity.Plugin + identity identity.Manager exchange dataexchange.Plugin blockchain blockchain.Plugin batch batch.Manager @@ -64,15 +64,15 @@ type privateMessaging struct { opCorrelationRetries int } -func NewPrivateMessaging(ctx context.Context, di database.Plugin, ii identity.Plugin, dx dataexchange.Plugin, bi blockchain.Plugin, ba batch.Manager, dm data.Manager, sa syncasync.Bridge, bp batchpin.Submitter) (Manager, error) { - if di == nil || ii == nil || dx == nil || bi == nil || ba == nil || dm == nil { +func NewPrivateMessaging(ctx context.Context, di database.Plugin, im identity.Manager, dx dataexchange.Plugin, bi blockchain.Plugin, ba batch.Manager, dm data.Manager, sa syncasync.Bridge, bp batchpin.Submitter) (Manager, error) { + if di == nil || im == nil || dx == nil || bi == nil || ba == nil || dm == nil { return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) } pm := &privateMessaging{ ctx: ctx, database: di, - identity: ii, + identity: im, exchange: dx, blockchain: bi, batch: ba, diff --git a/internal/syscore/syscore.go b/internal/syscore/syscore.go new file mode 100644 index 0000000000..18e6866458 --- /dev/null +++ b/internal/syscore/syscore.go @@ -0,0 +1,30 @@ +// Copyright © 2021 Kaleido, Inc. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package syscore + +import ( + "context" + + "github.com/hyperledger-labs/firefly/internal/events/system" + "github.com/hyperledger-labs/firefly/pkg/fftypes" +) + +// SystemCore specifies an interface for global utility functions, without creating a cycle between components +type SystemCore interface { + AddSystemEventListener(ns string, el system.EventListener) error + ResolveSigningIdentity(ctx context.Context, suppliedIdentity string) (*fftypes.Identity, error) +} diff --git a/mocks/blockchainmocks/plugin.go b/mocks/blockchainmocks/plugin.go index 8592f8ab32..7d0934a8ca 100644 --- a/mocks/blockchainmocks/plugin.go +++ b/mocks/blockchainmocks/plugin.go @@ -67,27 +67,34 @@ func (_m *Plugin) Name() string { return r0 } -// Start provides a mock function with given fields: -func (_m *Plugin) Start() error { - ret := _m.Called() +// ResolveSigningKey provides a mock function with given fields: ctx, signingKey +func (_m *Plugin) ResolveSigningKey(ctx context.Context, signingKey string) (string, error) { + ret := _m.Called(ctx, signingKey) - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + var r0 string + if rf, ok := ret.Get(0).(func(context.Context, string) string); ok { + r0 = rf(ctx, signingKey) } else { - r0 = ret.Error(0) + r0 = ret.Get(0).(string) } - return r0 + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, signingKey) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } -// SubmitBatchPin provides a mock function with given fields: ctx, ledgerID, identity, batch -func (_m *Plugin) SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, identity *fftypes.Identity, batch *blockchain.BatchPin) error { - ret := _m.Called(ctx, ledgerID, identity, batch) +// Start provides a mock function with given fields: +func (_m *Plugin) Start() error { + ret := _m.Called() var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.UUID, *fftypes.Identity, *blockchain.BatchPin) error); ok { - r0 = rf(ctx, ledgerID, identity, batch) + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } @@ -95,13 +102,13 @@ func (_m *Plugin) SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, id return r0 } -// VerifyIdentitySyntax provides a mock function with given fields: ctx, identity -func (_m *Plugin) VerifyIdentitySyntax(ctx context.Context, identity *fftypes.Identity) error { - ret := _m.Called(ctx, identity) +// SubmitBatchPin provides a mock function with given fields: ctx, ledgerID, signingKey, batch +func (_m *Plugin) SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, signingKey string, batch *blockchain.BatchPin) error { + ret := _m.Called(ctx, ledgerID, signingKey, batch) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Identity) error); ok { - r0 = rf(ctx, identity) + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.UUID, string, *blockchain.BatchPin) error); ok { + r0 = rf(ctx, ledgerID, signingKey, batch) } else { r0 = ret.Error(0) } diff --git a/mocks/identitymanagermocks/manager.go b/mocks/identitymanagermocks/manager.go new file mode 100644 index 0000000000..4645dfb05c --- /dev/null +++ b/mocks/identitymanagermocks/manager.go @@ -0,0 +1,30 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package identitymanagermocks + +import ( + context "context" + + fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + + mock "github.com/stretchr/testify/mock" +) + +// Manager is an autogenerated mock type for the Manager type +type Manager struct { + mock.Mock +} + +// ResolveInputIdentity provides a mock function with given fields: ctx, _a1 +func (_m *Manager) ResolveInputIdentity(ctx context.Context, _a1 *fftypes.Identity) error { + ret := _m.Called(ctx, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Identity) error); ok { + r0 = rf(ctx, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/mocks/identitymocks/plugin.go b/mocks/identitymocks/plugin.go index 561c1c1cab..699adb1673 100644 --- a/mocks/identitymocks/plugin.go +++ b/mocks/identitymocks/plugin.go @@ -7,8 +7,6 @@ import ( config "github.com/hyperledger-labs/firefly/internal/config" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" - identity "github.com/hyperledger-labs/firefly/pkg/identity" mock "github.com/stretchr/testify/mock" @@ -68,29 +66,6 @@ func (_m *Plugin) Name() string { return r0 } -// Resolve provides a mock function with given fields: ctx, identifier -func (_m *Plugin) Resolve(ctx context.Context, identifier string) (*fftypes.Identity, error) { - ret := _m.Called(ctx, identifier) - - var r0 *fftypes.Identity - if rf, ok := ret.Get(0).(func(context.Context, string) *fftypes.Identity); ok { - r0 = rf(ctx, identifier) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*fftypes.Identity) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, identifier) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // Start provides a mock function with given fields: func (_m *Plugin) Start() error { ret := _m.Called() diff --git a/mocks/syscoremocks/system_core.go b/mocks/syscoremocks/system_core.go new file mode 100644 index 0000000000..664fc79afc --- /dev/null +++ b/mocks/syscoremocks/system_core.go @@ -0,0 +1,54 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package syscoremocks + +import ( + context "context" + + fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + mock "github.com/stretchr/testify/mock" + + system "github.com/hyperledger-labs/firefly/internal/events/system" +) + +// SystemCore is an autogenerated mock type for the SystemCore type +type SystemCore struct { + mock.Mock +} + +// AddSystemEventListener provides a mock function with given fields: ns, el +func (_m *SystemCore) AddSystemEventListener(ns string, el system.EventListener) error { + ret := _m.Called(ns, el) + + var r0 error + if rf, ok := ret.Get(0).(func(string, system.EventListener) error); ok { + r0 = rf(ns, el) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ResolveSigningIdentity provides a mock function with given fields: ctx, suppliedIdentity +func (_m *SystemCore) ResolveSigningIdentity(ctx context.Context, suppliedIdentity string) (*fftypes.Identity, error) { + ret := _m.Called(ctx, suppliedIdentity) + + var r0 *fftypes.Identity + if rf, ok := ret.Get(0).(func(context.Context, string) *fftypes.Identity); ok { + r0 = rf(ctx, suppliedIdentity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*fftypes.Identity) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, suppliedIdentity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/pkg/blockchain/plugin.go b/pkg/blockchain/plugin.go index 6d636ab932..78add90ae3 100644 --- a/pkg/blockchain/plugin.go +++ b/pkg/blockchain/plugin.go @@ -42,11 +42,11 @@ type Plugin interface { // VerifyIdentitySyntax verifies that the supplied identity string is valid syntax according to the protocol. // Can apply transformations to the supplied signing identity (only), such as lower case - VerifyIdentitySyntax(ctx context.Context, identity *fftypes.Identity) error + ResolveSigningKey(ctx context.Context, signingKey string) (string, error) // SubmitBatchPin sequences a batch of message globally to all viewers of a given ledger // The returned tracking ID will be used to correlate with any subsequent transaction tracking updates - SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, identity *fftypes.Identity, batch *BatchPin) error + SubmitBatchPin(ctx context.Context, ledgerID *fftypes.UUID, signingKey string, batch *BatchPin) error } // Callbacks is the interface provided to the blockchain plugin, to allow it to pass events back to firefly. diff --git a/pkg/fftypes/identity.go b/pkg/fftypes/identity.go index d09cd9c989..ffbc791d43 100644 --- a/pkg/fftypes/identity.go +++ b/pkg/fftypes/identity.go @@ -16,10 +16,9 @@ package fftypes -// Identity is a structure used to keep track of and map identity in the system. -// -// TODO: Mapping of more sophisticate identities (DIDs etc.) via plugins, and richer interface +// Identity is the nested structure representing an identity, that might comprise a resolvable +// by FireFly identity DID, a blockchain signing key, or both. type Identity struct { - Identifier string `json:"identifier,omitempty"` - OnChain string `json:"onchain,omitempty"` + Author string `json:"author"` + Key string `json:"key"` } diff --git a/pkg/identity/plugin.go b/pkg/identity/plugin.go index 780836fc6e..276f2d003e 100644 --- a/pkg/identity/plugin.go +++ b/pkg/identity/plugin.go @@ -40,8 +40,14 @@ type Plugin interface { // Capabilities returns capabilities - not called until after Init Capabilities() *Capabilities - // Resolve maps an identity identifier passed in a message to a full identity that includes the signing identity - Resolve(ctx context.Context, identifier string) (identity *fftypes.Identity, err error) + // INTERFACE IS TBD SINCE INTRODUCTION OF THE IDENTITY MANAGER [Im] COMPONENT + // + // There is a strong thought that a pluggable infrastructure for mapping external DID based identity + // solutions into FireFly is required. However, the immediate shift in Sep 2021 moved to defining + // a strong enough identity construct within FireFly to map from/to. + // + // See issue https://github.com/hyperledger-labs/firefly/issues/187 to contribute to the discussion + } // Callbacks is the interface provided to the identity plugin, to allow it to request information from firefly, or pass events. From cce35d79e1dc93136de908cf1c4f856fe6030998 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Wed, 15 Sep 2021 16:47:53 -0400 Subject: [PATCH 02/15] Add additional resolvers to identity manager Signed-off-by: Peter Broadhurst --- .../000027_create_key_fields.down.sql | 6 + .../postgres/000027_create_key_fields.up.sql | 17 +++ .../sqlite/000027_create_key_fields.down.sql | 4 + .../sqlite/000027_create_key_fields.up.sql | 9 ++ internal/assets/manager.go | 12 +- internal/assets/manager_test.go | 32 +++-- internal/batch/batch_manager.go | 8 +- internal/batch/batch_manager_test.go | 12 +- internal/batch/batch_processor.go | 9 +- internal/batch/batch_processor_test.go | 2 +- internal/batchpin/batchpin.go | 16 +-- internal/batchpin/batchpin_test.go | 83 +++-------- internal/broadcast/datatype.go | 2 +- internal/broadcast/definition.go | 12 +- internal/broadcast/definition_test.go | 29 ++-- internal/broadcast/manager.go | 11 +- internal/broadcast/manager_test.go | 31 ++-- internal/broadcast/message_test.go | 15 +- internal/broadcast/namespace.go | 2 +- internal/config/config.go | 6 +- internal/database/sqlcommon/batch_sql.go | 4 + internal/database/sqlcommon/batch_sql_test.go | 18 ++- internal/database/sqlcommon/message_sql.go | 4 + .../database/sqlcommon/message_sql_test.go | 26 ++-- internal/database/sqlcommon/tokenpool_sql.go | 8 ++ .../database/sqlcommon/tokenpool_sql_test.go | 4 + internal/events/aggregator_test.go | 120 ++++++++++------ internal/events/batch_pin_complete_test.go | 111 ++++++++++----- internal/events/dx_callbacks_test.go | 77 +++++++--- internal/events/event_dispatcher_test.go | 15 +- internal/events/event_manager.go | 10 +- internal/events/event_manager_test.go | 10 +- internal/events/persist_batch.go | 14 +- internal/i18n/en_translations.go | 1 + internal/identity/identitymanager.go | 89 +++++++++--- internal/identity/identitymanager_test.go | 127 +++++++++++++++++ internal/networkmap/manager_test.go | 6 +- internal/networkmap/register_node.go | 5 - internal/networkmap/register_node_test.go | 7 +- internal/privatemessaging/groupmanager.go | 2 +- .../privatemessaging/groupmanager_test.go | 45 ++++-- internal/privatemessaging/message.go | 26 ++-- internal/privatemessaging/message_test.go | 134 ++++++++---------- internal/privatemessaging/privatemessaging.go | 29 ++-- .../privatemessaging/privatemessaging_test.go | 91 +++++++++--- internal/privatemessaging/recipients.go | 20 ++- internal/privatemessaging/recipients_test.go | 110 ++++++++++++-- internal/syshandlers/syshandler.go | 5 +- .../syshandlers/syshandler_network_node.go | 10 +- .../syshandler_network_node_test.go | 32 +---- .../syshandlers/syshandler_network_org.go | 10 +- mocks/broadcastmocks/manager.go | 46 +++--- mocks/identitymanagermocks/manager.go | 42 ++++++ mocks/syscoremocks/system_core.go | 54 ------- mocks/tokenmocks/plugin.go | 10 +- pkg/database/plugin.go | 4 + pkg/fftypes/batch.go | 8 +- pkg/fftypes/identity.go | 4 +- pkg/fftypes/message.go | 22 +-- pkg/fftypes/message_test.go | 12 +- pkg/fftypes/tokenpool.go | 14 +- pkg/tokens/plugin.go | 2 +- 62 files changed, 1053 insertions(+), 653 deletions(-) create mode 100644 db/migrations/postgres/000027_create_key_fields.down.sql create mode 100644 db/migrations/postgres/000027_create_key_fields.up.sql create mode 100644 db/migrations/sqlite/000027_create_key_fields.down.sql create mode 100644 db/migrations/sqlite/000027_create_key_fields.up.sql delete mode 100644 mocks/syscoremocks/system_core.go diff --git a/db/migrations/postgres/000027_create_key_fields.down.sql b/db/migrations/postgres/000027_create_key_fields.down.sql new file mode 100644 index 0000000000..65af617474 --- /dev/null +++ b/db/migrations/postgres/000027_create_key_fields.down.sql @@ -0,0 +1,6 @@ +BEGIN; +ALTER TABLE batches DROP COLUMN "key"; +ALTER TABLE messages DROP COLUMN "key"; +ALTER TABLE tokenpool DROP COLUMN "key"; +ALTER TABLE tokenpool DROP COLUMN "author"; +COMMIT; diff --git a/db/migrations/postgres/000027_create_key_fields.up.sql b/db/migrations/postgres/000027_create_key_fields.up.sql new file mode 100644 index 0000000000..8a299ea83f --- /dev/null +++ b/db/migrations/postgres/000027_create_key_fields.up.sql @@ -0,0 +1,17 @@ +BEGIN; + +ALTER TABLE batches ADD "key" VARCHAR(1024); +UPDATE batches SET "key" = ""; +ALTER TABLE batches ALTER COLUMN "key" SET NOT NULL; + +ALTER TABLE messages ADD "key" VARCHAR(1024); +UPDATE messages SET "key" = ""; +ALTER TABLE messages ALTER COLUMN "key" SET NOT NULL; + +ALTER TABLE tokenpool ADD "key" VARCHAR(1024); +ALTER TABLE tokenpool ADD "author" VARCHAR(1024); +UPDATE tokenpool SET "key" = "", "author" = ""; +ALTER TABLE tokenpool ALTER COLUMN "key" SET NOT NULL; +ALTER TABLE tokenpool ALTER COLUMN "author" SET NOT NULL; + +COMMIT; diff --git a/db/migrations/sqlite/000027_create_key_fields.down.sql b/db/migrations/sqlite/000027_create_key_fields.down.sql new file mode 100644 index 0000000000..37a47a98c8 --- /dev/null +++ b/db/migrations/sqlite/000027_create_key_fields.down.sql @@ -0,0 +1,4 @@ +ALTER TABLE batches DROP COLUMN "key"; +ALTER TABLE messages DROP COLUMN "key"; +ALTER TABLE tokenpool DROP COLUMN "key"; +ALTER TABLE tokenpool DROP COLUMN "author"; diff --git a/db/migrations/sqlite/000027_create_key_fields.up.sql b/db/migrations/sqlite/000027_create_key_fields.up.sql new file mode 100644 index 0000000000..ab34add9a7 --- /dev/null +++ b/db/migrations/sqlite/000027_create_key_fields.up.sql @@ -0,0 +1,9 @@ +ALTER TABLE batches ADD COLUMN "key" VARCHAR(1024); +UPDATE batches SET "key" = ""; + +ALTER TABLE messages ADD COLUMN "key" VARCHAR(1024); +UPDATE messages SET "key" = ""; + +ALTER TABLE tokenpool ADD COLUMN "key" VARCHAR(1024); +ALTER TABLE tokenpool ADD COLUMN "author" VARCHAR(1024); +UPDATE tokenpool SET "key" = "", "author" = ""; diff --git a/internal/assets/manager.go b/internal/assets/manager.go index 3a0ce256a4..702a11cf03 100644 --- a/internal/assets/manager.go +++ b/internal/assets/manager.go @@ -19,7 +19,6 @@ package assets import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/data" "github.com/hyperledger-labs/firefly/internal/i18n" "github.com/hyperledger-labs/firefly/internal/identity" @@ -81,10 +80,7 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id return nil, err } - if pool.Author == "" { - pool.Author = config.GetString(config.OrgIdentity) - } - author, err := am.identity.Resolve(ctx, pool.Author) + err := am.identity.ResolveInputIdentity(ctx, &pool.Identity) if err != nil { return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) } @@ -106,7 +102,7 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id Subject: fftypes.TransactionSubject{ Namespace: ns, Type: fftypes.TransactionTypeTokenPool, - Signer: author.OnChain, // The transaction records on the on-chain identity + Signer: pool.Key, Reference: id, }, Created: fftypes.Now(), @@ -125,7 +121,7 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id "", fftypes.OpTypeTokensCreatePool, fftypes.OpStatusPending, - author.Identifier) + pool.Author) err = am.database.UpsertOperation(ctx, op, false) if err != nil { return nil, err @@ -137,7 +133,7 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id ID: tx.ID, Type: tx.Subject.Type, } - return pool, plugin.CreateTokenPool(ctx, author, pool) + return pool, plugin.CreateTokenPool(ctx, pool.Key, pool) } func (am *assetManager) scopeNS(ns string, filter database.AndFilter) database.AndFilter { diff --git a/internal/assets/manager_test.go b/internal/assets/manager_test.go index 3d24bd01ad..d7d95f4fa2 100644 --- a/internal/assets/manager_test.go +++ b/internal/assets/manager_test.go @@ -23,7 +23,7 @@ import ( "github.com/hyperledger-labs/firefly/internal/syncasync" "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" "github.com/hyperledger-labs/firefly/mocks/tokenmocks" "github.com/hyperledger-labs/firefly/pkg/database" @@ -37,15 +37,16 @@ func newTestAssets(t *testing.T) (*assetManager, func()) { config.Reset() config.Set(config.OrgIdentity, "UTNodeID") mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} + mim := &identitymanagermocks.Manager{} mdm := &datamocks.Manager{} msa := &syncasyncmocks.Bridge{} mti := &tokenmocks.Plugin{} mti.On("Name").Return("ut_tokens").Maybe() - defaultIdentity := &fftypes.Identity{Identifier: "UTNodeID", OnChain: "0x12345"} - mii.On("Resolve", mock.Anything, "UTNodeID").Return(defaultIdentity, nil).Maybe() + mim.On("ResolveInputIdentity", mock.Anything, mock.MatchedBy(func(identity *fftypes.Identity) bool { + return identity.Author == "org1" + })).Return(nil).Maybe() ctx, cancel := context.WithCancel(context.Background()) - a, err := NewAssetManager(ctx, mdi, mii, mdm, msa, map[string]tokens.Plugin{"magic-tokens": mti}) + a, err := NewAssetManager(ctx, mdi, mim, mdm, msa, map[string]tokens.Plugin{"magic-tokens": mti}) assert.NoError(t, err) return a.(*assetManager), cancel } @@ -79,11 +80,14 @@ func TestCreateTokenPoolBadIdentity(t *testing.T) { defer cancel() mdm := am.data.(*datamocks.Manager) - mii := am.identity.(*identitymocks.Plugin) + mim := am.identity.(*identitymanagermocks.Manager) mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) - mii.On("Resolve", mock.Anything, "wrong").Return(nil, fmt.Errorf("pop")) + mim.On("ResolveInputIdentity", mock.Anything, mock.MatchedBy(func(identity *fftypes.Identity) bool { + assert.Equal(t, "wrong", identity.Author) + return true + })).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "test", &fftypes.TokenPool{Author: "wrong"}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "test", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "wrong"}}, false) assert.Regexp(t, "pop", err) } @@ -94,7 +98,7 @@ func TestCreateTokenPoolBadConnector(t *testing.T) { mdm := am.data.(*datamocks.Manager) mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) - _, err := am.CreateTokenPool(context.Background(), "ns1", "bad", &fftypes.TokenPool{}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "bad", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) assert.Regexp(t, "FF10272", err) } @@ -112,7 +116,7 @@ func TestCreateTokenPoolFail(t *testing.T) { mdi.On("UpsertOperation", mock.Anything, mock.Anything, false).Return(nil) mti.On("CreateTokenPool", context.Background(), mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) assert.Regexp(t, "pop", err) } @@ -125,7 +129,7 @@ func TestCreateTokenPoolTransactionFail(t *testing.T) { mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) mdi.On("UpsertTransaction", context.Background(), mock.Anything, false).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) assert.Regexp(t, "pop", err) } @@ -141,7 +145,7 @@ func TestCreateTokenPoolOperationFail(t *testing.T) { }), false).Return(nil) mdi.On("UpsertOperation", mock.Anything, mock.Anything, false).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) assert.Regexp(t, "pop", err) } @@ -159,7 +163,7 @@ func TestCreateTokenPoolSuccess(t *testing.T) { }), false).Return(nil) mdi.On("UpsertOperation", mock.Anything, mock.Anything, false).Return(nil) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) assert.NoError(t, err) } @@ -188,7 +192,7 @@ func TestCreateTokenPoolConfirm(t *testing.T) { }). Return(nil, nil) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, true) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, true) assert.NoError(t, err) } diff --git a/internal/batch/batch_manager.go b/internal/batch/batch_manager.go index abe87d4bc1..c9b36a1b3d 100644 --- a/internal/batch/batch_manager.go +++ b/internal/batch/batch_manager.go @@ -151,13 +151,13 @@ func (bm *batchManager) removeProcessor(dispatcher *dispatcher, key string) { dispatcher.mux.Unlock() } -func (bm *batchManager) getProcessor(batchType fftypes.MessageType, group *fftypes.Bytes32, namespace, author string) (*batchProcessor, error) { +func (bm *batchManager) getProcessor(batchType fftypes.MessageType, group *fftypes.Bytes32, namespace string, identity *fftypes.Identity) (*batchProcessor, error) { dispatcher, ok := bm.dispatchers[batchType] if !ok { return nil, i18n.NewError(bm.ctx, i18n.MsgUnregisteredBatchType, batchType) } dispatcher.mux.Lock() - key := fmt.Sprintf("%s:%s[group=%v]", namespace, author, group) + key := fmt.Sprintf("%s:%s:%s[group=%v]", namespace, identity.Author, identity.Key, group) processor, ok := dispatcher.processors[key] if !ok { processor = newBatchProcessor( @@ -166,7 +166,7 @@ func (bm *batchManager) getProcessor(batchType fftypes.MessageType, group *fftyp &batchProcessorConf{ Options: dispatcher.batchOptions, namespace: namespace, - author: author, + identity: *identity, group: group, dispatch: dispatcher.handler, processorQuiescing: func() { @@ -345,7 +345,7 @@ func (bm *batchManager) updateOffset(infiniteRetry bool, newOffset int64) (err e func (bm *batchManager) dispatchMessage(dispatched chan *batchDispatch, msg *fftypes.Message, data ...*fftypes.Data) error { l := log.L(bm.ctx) - processor, err := bm.getProcessor(msg.Header.Type, msg.Header.Group, msg.Header.Namespace, msg.Header.Author) + processor, err := bm.getProcessor(msg.Header.Type, msg.Header.Group, msg.Header.Namespace, &msg.Header.Identity) if err != nil { return err } diff --git a/internal/batch/batch_manager_test.go b/internal/batch/batch_manager_test.go index d66aa7c43f..772806506c 100644 --- a/internal/batch/batch_manager_test.go +++ b/internal/batch/batch_manager_test.go @@ -88,7 +88,7 @@ func TestE2EDispatchBroadcast(t *testing.T) { ID: fftypes.NewUUID(), Topics: []string{"topic1", "topic2"}, Namespace: "ns1", - Author: "0x12345", + Identity: fftypes.Identity{Author: "did:firefly:org/abcd", Key: "0x12345"}, }, Data: fftypes.DataRefs{ {ID: dataID1, Hash: dataHash}, @@ -156,8 +156,8 @@ func TestE2EDispatchPrivate(t *testing.T) { assert.Len(t, s, 2) h := sha256.New() nonceBytes, _ := hex.DecodeString( - "746f70696331" + "44dc0861e69d9bab17dd5e90a8898c2ea156ad04e5fabf83119cc010486e6c1b" + "30783132333435" + "0000000000003039", - /*| topic1 | | ---- group id -------------------------------------------------| |author'0x12345'| |i64 nonce (12345) */ + "746f70696331" + "44dc0861e69d9bab17dd5e90a8898c2ea156ad04e5fabf83119cc010486e6c1b" + "6469643a66697265666c793a6f72672f61626364" + "0000000000003039", + /*| topic1 | | ---- group id -------------------------------------------------| |author'"did:firefly:org/abcd' | |i64 nonce (12345) */ /*| context | | sender + nonce */ ) // little endian 12345 in 8 byte hex h.Write(nonceBytes) @@ -165,8 +165,8 @@ func TestE2EDispatchPrivate(t *testing.T) { h = sha256.New() nonceBytes, _ = hex.DecodeString( - "746f70696332" + "44dc0861e69d9bab17dd5e90a8898c2ea156ad04e5fabf83119cc010486e6c1b" + "30783132333435" + "000000000000303a", - /*| topic2 | | ---- group id -------------------------------------------------| |author'0x12345'| |i64 nonce (12346) */ + "746f70696332" + "44dc0861e69d9bab17dd5e90a8898c2ea156ad04e5fabf83119cc010486e6c1b" + "6469643a66697265666c793a6f72672f61626364" + "000000000000303a", + /*| topic2 | | ---- group id -------------------------------------------------| |author'"did:firefly:org/abcd' | |i64 nonce (12346) */ /*| context | | sender + nonce */ ) // little endian 12345 in 8 byte hex h.Write(nonceBytes) @@ -192,7 +192,7 @@ func TestE2EDispatchPrivate(t *testing.T) { ID: fftypes.NewUUID(), Topics: []string{"topic1", "topic2"}, Namespace: "ns1", - Author: "0x12345", + Identity: fftypes.Identity{Author: "did:firefly:org/abcd", Key: "0x12345"}, Group: &groupID, }, Data: fftypes.DataRefs{ diff --git a/internal/batch/batch_processor.go b/internal/batch/batch_processor.go index 80b5989646..cee0bfb740 100644 --- a/internal/batch/batch_processor.go +++ b/internal/batch/batch_processor.go @@ -45,7 +45,7 @@ type batchDispatch struct { type batchProcessorConf struct { Options namespace string - author string + identity fftypes.Identity group *fftypes.Bytes32 dispatch DispatchHandler processorQuiescing func() @@ -66,13 +66,13 @@ type batchProcessor struct { } func newBatchProcessor(ctx context.Context, di database.Plugin, conf *batchProcessorConf, retry *retry.Retry) *batchProcessor { - pCtx := log.WithLogField(ctx, "role", fmt.Sprintf("batchproc-%s:%s", conf.namespace, conf.author)) + pCtx := log.WithLogField(ctx, "role", fmt.Sprintf("batchproc-%s:%s:%s", conf.namespace, conf.identity.Author, conf.identity.Key)) pCtx, cancelCtx := context.WithCancel(pCtx) bp := &batchProcessor{ ctx: pCtx, cancelCtx: cancelCtx, database: di, - name: fmt.Sprintf("%s:%s", conf.namespace, conf.author), + name: fmt.Sprintf("%s:%s:%s", conf.namespace, conf.identity.Author, conf.identity.Key), newWork: make(chan *batchWork), persistWork: make(chan *batchWork, conf.BatchMaxSize), sealBatch: make(chan bool), @@ -157,7 +157,7 @@ func (bp *batchProcessor) createOrAddToBatch(batch *fftypes.Batch, newWork []*ba batch = &fftypes.Batch{ ID: batchID, Namespace: bp.conf.namespace, - Author: bp.conf.author, + Identity: bp.conf.identity, Group: bp.conf.group, Payload: fftypes.BatchPayload{}, Created: fftypes.Now(), @@ -207,6 +207,7 @@ func (bp *batchProcessor) maskContext(ctx context.Context, msg *fftypes.Message, // Now combine our sending identity, and this nonce, to produce the hash that should // be expected by all members of the group as the next nonce from us on this topic. + // Note we use our identity DID (not signing key) for this. hashBuilder.Write([]byte(msg.Header.Author)) nonceBytes := make([]byte, 8) binary.BigEndian.PutUint64(nonceBytes, uint64(gc.Nonce)) diff --git a/internal/batch/batch_processor_test.go b/internal/batch/batch_processor_test.go index afadf3d92c..02e459c962 100644 --- a/internal/batch/batch_processor_test.go +++ b/internal/batch/batch_processor_test.go @@ -33,7 +33,7 @@ func newTestBatchProcessor(dispatch DispatchHandler) (*databasemocks.Plugin, *ba mdi := &databasemocks.Plugin{} bp := newBatchProcessor(context.Background(), mdi, &batchProcessorConf{ namespace: "ns1", - author: "0x12345", + identity: fftypes.Identity{Author: "did:firefly:org/abcd", Key: "0x12345"}, dispatch: dispatch, processorQuiescing: func() {}, Options: Options{ diff --git a/internal/batchpin/batchpin.go b/internal/batchpin/batchpin.go index 38979d2589..ac2faa9f2c 100644 --- a/internal/batchpin/batchpin.go +++ b/internal/batchpin/batchpin.go @@ -20,7 +20,6 @@ import ( "context" "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/pkg/blockchain" "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/fftypes" @@ -46,28 +45,19 @@ func NewBatchPinSubmitter(di database.Plugin, im identity.Manager, bi blockchain func (bp *batchPinSubmitter) SubmitPinnedBatch(ctx context.Context, batch *fftypes.Batch, contexts []*fftypes.Bytes32) error { - signingIdentity, err := bp.identity.Resolve(ctx, batch.Author) - if err == nil { - err = bp.blockchain.VerifyIdentitySyntax(ctx, signingIdentity) - } - if err != nil { - log.L(ctx).Errorf("Invalid signing identity '%s': %s", batch.Author, err) - return err - } - tx := &fftypes.Transaction{ ID: batch.Payload.TX.ID, Subject: fftypes.TransactionSubject{ Type: fftypes.TransactionTypeBatchPin, Namespace: batch.Namespace, - Signer: signingIdentity.OnChain, // The transaction records on the on-chain identity + Signer: batch.Key, // The transaction records on the on-chain identity Reference: batch.ID, }, Created: fftypes.Now(), Status: fftypes.OpStatusPending, } tx.Hash = tx.Subject.Hash() - err = bp.database.UpsertTransaction(ctx, tx, false /* should be new, or idempotent replay */) + err := bp.database.UpsertTransaction(ctx, tx, false /* should be new, or idempotent replay */) if err != nil { return err } @@ -87,7 +77,7 @@ func (bp *batchPinSubmitter) SubmitPinnedBatch(ctx context.Context, batch *fftyp } // Write the batch pin to the blockchain - return bp.blockchain.SubmitBatchPin(ctx, nil /* TODO: ledger selection */, signingIdentity, &blockchain.BatchPin{ + return bp.blockchain.SubmitBatchPin(ctx, nil /* TODO: ledger selection */, batch.Key, &blockchain.BatchPin{ Namespace: batch.Namespace, TransactionID: batch.Payload.TX.ID, BatchID: batch.ID, diff --git a/internal/batchpin/batchpin_test.go b/internal/batchpin/batchpin_test.go index b4046871b5..404e10e04c 100644 --- a/internal/batchpin/batchpin_test.go +++ b/internal/batchpin/batchpin_test.go @@ -23,7 +23,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -31,10 +31,10 @@ import ( func newTestBatchPinSubmitter(t *testing.T) *batchPinSubmitter { mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} + mim := &identitymanagermocks.Manager{} mbi := &blockchainmocks.Plugin{} mbi.On("Name").Return("ut").Maybe() - return NewBatchPinSubmitter(mdi, mii, mbi).(*batchPinSubmitter) + return NewBatchPinSubmitter(mdi, mim, mbi).(*batchPinSubmitter) } func TestSubmitPinnedBatchOk(t *testing.T) { @@ -42,17 +42,15 @@ func TestSubmitPinnedBatchOk(t *testing.T) { bp := newTestBatchPinSubmitter(t) ctx := context.Background() - mii := bp.identity.(*identitymocks.Plugin) mbi := bp.blockchain.(*blockchainmocks.Plugin) mdi := bp.database.(*databasemocks.Plugin) - identity := &fftypes.Identity{ - Identifier: "id1", - OnChain: "0x12345", - } batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "id1", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "id1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ ID: fftypes.NewUUID(), @@ -61,8 +59,6 @@ func TestSubmitPinnedBatchOk(t *testing.T) { } contexts := []*fftypes.Bytes32{} - mii.On("Resolve", ctx, "id1").Return(identity, nil) - mbi.On("VerifyIdentitySyntax", ctx, identity).Return(nil) mdi.On("UpsertTransaction", ctx, mock.Anything, false).Return(nil) mdi.On("UpsertOperation", ctx, mock.MatchedBy(func(op *fftypes.Operation) bool { assert.Equal(t, fftypes.OpTypeBlockchainBatchPin, op.Type) @@ -70,7 +66,7 @@ func TestSubmitPinnedBatchOk(t *testing.T) { assert.Equal(t, *batch.Payload.TX.ID, *op.Transaction) return true }), false).Return(nil) - mbi.On("SubmitBatchPin", ctx, (*fftypes.UUID)(nil), identity, mock.Anything).Return(nil) + mbi.On("SubmitBatchPin", ctx, (*fftypes.UUID)(nil), "0x12345", mock.Anything).Return(nil) err := bp.SubmitPinnedBatch(ctx, batch, contexts) assert.NoError(t, err) @@ -82,17 +78,14 @@ func TestSubmitPinnedBatchOpFail(t *testing.T) { bp := newTestBatchPinSubmitter(t) ctx := context.Background() - mii := bp.identity.(*identitymocks.Plugin) - mbi := bp.blockchain.(*blockchainmocks.Plugin) mdi := bp.database.(*databasemocks.Plugin) - identity := &fftypes.Identity{ - Identifier: "id1", - OnChain: "0x12345", - } batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "id1", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "id1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ ID: fftypes.NewUUID(), @@ -101,8 +94,6 @@ func TestSubmitPinnedBatchOpFail(t *testing.T) { } contexts := []*fftypes.Bytes32{} - mii.On("Resolve", ctx, "id1").Return(identity, nil) - mbi.On("VerifyIdentitySyntax", ctx, identity).Return(nil) mdi.On("UpsertTransaction", ctx, mock.Anything, false).Return(nil) mdi.On("UpsertOperation", ctx, mock.Anything, false).Return(fmt.Errorf("pop")) @@ -116,49 +107,14 @@ func TestSubmitPinnedBatchTxInsertFail(t *testing.T) { bp := newTestBatchPinSubmitter(t) ctx := context.Background() - mii := bp.identity.(*identitymocks.Plugin) - mbi := bp.blockchain.(*blockchainmocks.Plugin) mdi := bp.database.(*databasemocks.Plugin) - identity := &fftypes.Identity{ - Identifier: "id1", - OnChain: "0x12345", - } batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "id1", - Payload: fftypes.BatchPayload{ - TX: fftypes.TransactionRef{ - ID: fftypes.NewUUID(), - }, + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "id1", + Key: "0x12345", }, - } - contexts := []*fftypes.Bytes32{} - - mii.On("Resolve", ctx, "id1").Return(identity, nil) - mbi.On("VerifyIdentitySyntax", ctx, identity).Return(nil) - mdi.On("UpsertTransaction", ctx, mock.Anything, false).Return(fmt.Errorf("pop")) - - err := bp.SubmitPinnedBatch(ctx, batch, contexts) - assert.Regexp(t, "pop", err) - -} - -func TestSubmitPinnedBatchTxBadIdentity(t *testing.T) { - - bp := newTestBatchPinSubmitter(t) - ctx := context.Background() - - mii := bp.identity.(*identitymocks.Plugin) - mbi := bp.blockchain.(*blockchainmocks.Plugin) - - identity := &fftypes.Identity{ - Identifier: "id1", - OnChain: "badness", - } - batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "id1", Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ ID: fftypes.NewUUID(), @@ -167,8 +123,7 @@ func TestSubmitPinnedBatchTxBadIdentity(t *testing.T) { } contexts := []*fftypes.Bytes32{} - mii.On("Resolve", ctx, "id1").Return(identity, nil) - mbi.On("VerifyIdentitySyntax", ctx, identity).Return(fmt.Errorf("pop")) + mdi.On("UpsertTransaction", ctx, mock.Anything, false).Return(fmt.Errorf("pop")) err := bp.SubmitPinnedBatch(ctx, batch, contexts) assert.Regexp(t, "pop", err) diff --git a/internal/broadcast/datatype.go b/internal/broadcast/datatype.go index ea1d740a2d..73033821e1 100644 --- a/internal/broadcast/datatype.go +++ b/internal/broadcast/datatype.go @@ -43,7 +43,7 @@ func (bm *broadcastManager) BroadcastDatatype(ctx context.Context, ns string, da if err := bm.data.CheckDatatype(ctx, ns, datatype); err != nil { return nil, err } - msg, err := bm.broadcastDefinitionAsNode(ctx, datatype, fftypes.SystemTagDefineDatatype, waitConfirm) + msg, err := bm.BroadcastDefinitionAsNode(ctx, datatype, fftypes.SystemTagDefineDatatype, waitConfirm) if msg != nil { datatype.Message = msg.Header.ID } diff --git a/internal/broadcast/definition.go b/internal/broadcast/definition.go index bbbad56816..cbcae3d671 100644 --- a/internal/broadcast/definition.go +++ b/internal/broadcast/definition.go @@ -24,17 +24,13 @@ import ( "github.com/hyperledger-labs/firefly/pkg/fftypes" ) -func (bm *broadcastManager) broadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { - signingIdentity, err := bm.GetNodeSigningIdentity(ctx) - if err != nil { - return nil, err - } - return bm.BroadcastDefinition(ctx, def, signingIdentity, tag, waitConfirm) +func (bm *broadcastManager) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { + return bm.BroadcastDefinition(ctx, def, &fftypes.Identity{ /* resolve to node default */ }, tag, waitConfirm) } func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { - err = bm.blockchain.VerifyIdentitySyntax(ctx, signingIdentity) + err = bm.identity.ResolveInputIdentity(ctx, signingIdentity) if err != nil { return nil, err } @@ -67,7 +63,7 @@ func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes Header: fftypes.MessageHeader{ Namespace: fftypes.SystemNamespace, Type: fftypes.MessageTypeDefinition, - Author: signingIdentity.Identifier, + Identity: *signingIdentity, Topics: fftypes.FFNameArray{def.Topic()}, Tag: string(tag), TxType: fftypes.TransactionTypeBatchPin, diff --git a/internal/broadcast/definition_test.go b/internal/broadcast/definition_test.go index c76929e27e..4e29e3f2d2 100644 --- a/internal/broadcast/definition_test.go +++ b/internal/broadcast/definition_test.go @@ -20,35 +20,32 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) -func TestBroadcastDefinitionAsNodeBadId(t *testing.T) { +func TestBroadcastDefinitionAsNodeUpsertFail(t *testing.T) { bm, cancel := newTestBroadcast(t) defer cancel() - config.Set(config.OrgIdentity, "wrong") - mii := bm.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "wrong").Return(nil, fmt.Errorf("pop")) - _, err := bm.broadcastDefinitionAsNode(bm.ctx, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, false) + mdi := bm.database.(*databasemocks.Plugin) + mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(fmt.Errorf("pop")) + _, err := bm.BroadcastDefinitionAsNode(bm.ctx, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, false) assert.Regexp(t, "pop", err) } -func TestBroadcastDefinitionAsNodeBadSigningId(t *testing.T) { +func TestBroadcastDefinitionBadIdentity(t *testing.T) { bm, cancel := newTestBroadcast(t) defer cancel() - config.Set(config.OrgIdentity, "wrong") - mii := bm.identity.(*identitymocks.Plugin) - mbi := bm.blockchain.(*blockchainmocks.Plugin) - badID := &fftypes.Identity{OnChain: "0x99999"} - mii.On("Resolve", mock.Anything, "wrong").Return(badID, nil) - mbi.On("VerifyIdentitySyntax", mock.Anything, badID).Return(fmt.Errorf("pop")) - _, err := bm.broadcastDefinitionAsNode(bm.ctx, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, false) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) + _, err := bm.BroadcastDefinition(bm.ctx, &fftypes.Namespace{}, &fftypes.Identity{ + Author: "wrong", + Key: "wrong", + }, fftypes.SystemTagDefineNamespace, false) assert.Regexp(t, "pop", err) } diff --git a/internal/broadcast/manager.go b/internal/broadcast/manager.go index ed1e659476..072f349c30 100644 --- a/internal/broadcast/manager.go +++ b/internal/broadcast/manager.go @@ -40,8 +40,8 @@ type Manager interface { BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (out *fftypes.Message, err error) + BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) - GetNodeSigningIdentity(ctx context.Context) (*fftypes.Identity, error) Start() error WaitStop() } @@ -87,15 +87,6 @@ func NewBroadcastManager(ctx context.Context, di database.Plugin, im identity.Ma return bm, nil } -func (bm *broadcastManager) GetNodeSigningIdentity(ctx context.Context) (*fftypes.Identity, error) { - orgIdentity := config.GetString(config.OrgIdentity) - id, err := bm.identity.Resolve(ctx, orgIdentity) - if err != nil { - return nil, err - } - return id, nil -} - func (bm *broadcastManager) dispatchBatch(ctx context.Context, batch *fftypes.Batch, pins []*fftypes.Bytes32) error { // Serialize the full payload, which has already been sealed for us by the BatchManager diff --git a/internal/broadcast/manager_test.go b/internal/broadcast/manager_test.go index aed3aa53b8..8bd658e6eb 100644 --- a/internal/broadcast/manager_test.go +++ b/internal/broadcast/manager_test.go @@ -28,7 +28,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" @@ -40,7 +40,7 @@ func newTestBroadcast(t *testing.T) (*broadcastManager, func()) { config.Reset() config.Set(config.OrgIdentity, "UTNodeID") mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} + mim := &identitymanagermocks.Manager{} mdm := &datamocks.Manager{} mbi := &blockchainmocks.Plugin{} mpi := &publicstoragemocks.Plugin{} @@ -49,12 +49,12 @@ func newTestBroadcast(t *testing.T) (*broadcastManager, func()) { msa := &syncasyncmocks.Bridge{} mbp := &batchpinmocks.Submitter{} mbi.On("Name").Return("ut_blockchain").Maybe() - defaultIdentity := &fftypes.Identity{Identifier: "UTNodeID", OnChain: "0x12345"} - mii.On("Resolve", mock.Anything, "UTNodeID").Return(defaultIdentity, nil).Maybe() - mbi.On("VerifyIdentitySyntax", mock.Anything, defaultIdentity).Return(nil).Maybe() + mim.On("ResolveInputIdentity", mock.Anything, mock.MatchedBy(func(identity *fftypes.Identity) bool { + return identity.Author == "" && identity.Key == "" + })).Return(nil).Maybe() mba.On("RegisterDispatcher", []fftypes.MessageType{fftypes.MessageTypeBroadcast, fftypes.MessageTypeDefinition}, mock.Anything, mock.Anything).Return() ctx, cancel := context.WithCancel(context.Background()) - b, err := NewBroadcastManager(ctx, mdi, mii, mdm, mbi, mdx, mpi, mba, msa, mbp) + b, err := NewBroadcastManager(ctx, mdi, mim, mdm, mbi, mdx, mpi, mba, msa, mbp) assert.NoError(t, err) return b.(*broadcastManager), cancel } @@ -132,17 +132,6 @@ func TestDispatchBatchSubmitBatchPinSucceed(t *testing.T) { assert.NoError(t, err) } -func TestGetOrgIdentityEmpty(t *testing.T) { - bm, cancel := newTestBroadcast(t) - defer cancel() - - config.Set(config.OrgIdentity, "") - mii := bm.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "").Return(nil, fmt.Errorf("pop")) - _, err := bm.GetNodeSigningIdentity(bm.ctx) - assert.Regexp(t, "pop", err) -} - func TestDispatchBatchSubmitBroadcastFail(t *testing.T) { bm, cancel := newTestBroadcast(t) defer cancel() @@ -156,7 +145,7 @@ func TestDispatchBatchSubmitBroadcastFail(t *testing.T) { mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything).Return(nil) mps.On("Name").Return("ut_publicstorage") - err := bm.dispatchBatch(context.Background(), &fftypes.Batch{Author: "wrong"}, []*fftypes.Bytes32{fftypes.NewRandB32()}) + err := bm.dispatchBatch(context.Background(), &fftypes.Batch{Identity: fftypes.Identity{Author: "wrong", Key: "wrong"}}, []*fftypes.Bytes32{fftypes.NewRandB32()}) assert.NoError(t, err) mdi.On("UpdateBatch", mock.Anything, mock.Anything, mock.Anything).Return(nil) @@ -176,7 +165,7 @@ func TestSubmitTXAndUpdateDBUpdateBatchFail(t *testing.T) { mdi.On("UpdateBatch", mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) bm.blockchain.(*blockchainmocks.Plugin).On("SubmitBatchPin", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return("", fmt.Errorf("pop")) - err := bm.submitTXAndUpdateDB(context.Background(), &fftypes.Batch{Author: "UTNodeID"}, []*fftypes.Bytes32{fftypes.NewRandB32()}) + err := bm.submitTXAndUpdateDB(context.Background(), &fftypes.Batch{Identity: fftypes.Identity{Author: "org1", Key: "0x12345"}}, []*fftypes.Bytes32{fftypes.NewRandB32()}) assert.Regexp(t, "pop", err) } @@ -194,7 +183,7 @@ func TestSubmitTXAndUpdateDBAddOp1Fail(t *testing.T) { bm.publicstorage.(*publicstoragemocks.Plugin).On("Name").Return("ut_publicstorage") batch := &fftypes.Batch{ - Author: "UTNodeID", + Identity: fftypes.Identity{Author: "org1", Key: "0x12345"}, Payload: fftypes.BatchPayload{ Messages: []*fftypes.Message{ {Header: fftypes.MessageHeader{ @@ -225,7 +214,7 @@ func TestSubmitTXAndUpdateDBSucceed(t *testing.T) { msgID := fftypes.NewUUID() batch := &fftypes.Batch{ - Author: "UTNodeID", + Identity: fftypes.Identity{Author: "org1", Key: "0x12345"}, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, diff --git a/internal/broadcast/message_test.go b/internal/broadcast/message_test.go index f758308e07..1819dcc4c3 100644 --- a/internal/broadcast/message_test.go +++ b/internal/broadcast/message_test.go @@ -58,7 +58,10 @@ func TestBroadcastMessageOk(t *testing.T) { msg, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "0x12345", + Identity: fftypes.Identity{ + Author: "did:firefly:org/abcd", + Key: "0x12345", + }, }, }, InlineData: fftypes.InlineData{ @@ -113,7 +116,10 @@ func TestBroadcastMessageWaitConfirmOk(t *testing.T) { msg, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "0x12345", + Identity: fftypes.Identity{ + Author: "did:firefly:org/abcd", + Key: "0x12345", + }, }, }, InlineData: fftypes.InlineData{ @@ -176,7 +182,10 @@ func TestBroadcastMessageWithBlobsOk(t *testing.T) { msg, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "0x12345", + Identity: fftypes.Identity{ + Author: "did:firefly:org/abcd", + Key: "0x12345", + }, }, }, InlineData: fftypes.InlineData{ diff --git a/internal/broadcast/namespace.go b/internal/broadcast/namespace.go index af59879803..2289cb0d43 100644 --- a/internal/broadcast/namespace.go +++ b/internal/broadcast/namespace.go @@ -31,7 +31,7 @@ func (bm *broadcastManager) BroadcastNamespace(ctx context.Context, ns *fftypes. if err := ns.Validate(ctx, false); err != nil { return nil, err } - msg, err := bm.broadcastDefinitionAsNode(ctx, ns, fftypes.SystemTagDefineNamespace, waitConfirm) + msg, err := bm.BroadcastDefinitionAsNode(ctx, ns, fftypes.SystemTagDefineNamespace, waitConfirm) if msg != nil { ns.Message = msg.Header.ID } diff --git a/internal/config/config.go b/internal/config/config.go index cb1be15fed..da624912b5 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -187,8 +187,10 @@ var ( NodeDescription = rootKey("node.description") // OrgName is the short name o the org OrgName = rootKey("org.name") - // OrgIdentity is the signing identity allocated to the organization (can be the same as the nodes) - OrgIdentity = rootKey("org.identity") + // OrgIdentityDeprecated deprecated synonym to org.key + OrgIdentityDeprecated = rootKey("org.identity") + // OrgKey is the signing identity allocated to the organization (can be the same as the nodes) + OrgKey = rootKey("org.key") // OrgDescription is a description for the org OrgDescription = rootKey("org.description") // OrchestratorStartupAttempts is how many time to attempt to connect to core infrastructure on startup diff --git a/internal/database/sqlcommon/batch_sql.go b/internal/database/sqlcommon/batch_sql.go index 636c4225e8..eba3ae6e76 100644 --- a/internal/database/sqlcommon/batch_sql.go +++ b/internal/database/sqlcommon/batch_sql.go @@ -33,6 +33,7 @@ var ( "btype", "namespace", "author", + "key", "group_hash", "created", "hash", @@ -88,6 +89,7 @@ func (s *SQLCommon) UpsertBatch(ctx context.Context, batch *fftypes.Batch, allow Set("btype", string(batch.Type)). Set("namespace", batch.Namespace). Set("author", batch.Author). + Set("key", batch.Key). Set("group_hash", batch.Group). Set("created", batch.Created). Set("hash", batch.Hash). @@ -113,6 +115,7 @@ func (s *SQLCommon) UpsertBatch(ctx context.Context, batch *fftypes.Batch, allow string(batch.Type), batch.Namespace, batch.Author, + batch.Key, batch.Group, batch.Created, batch.Hash, @@ -140,6 +143,7 @@ func (s *SQLCommon) batchResult(ctx context.Context, row *sql.Rows) (*fftypes.Ba &batch.Type, &batch.Namespace, &batch.Author, + &batch.Key, &batch.Group, &batch.Created, &batch.Hash, diff --git a/internal/database/sqlcommon/batch_sql_test.go b/internal/database/sqlcommon/batch_sql_test.go index a750cfa792..b702fbc5eb 100644 --- a/internal/database/sqlcommon/batch_sql_test.go +++ b/internal/database/sqlcommon/batch_sql_test.go @@ -39,9 +39,12 @@ func TestBatch2EWithDB(t *testing.T) { batchID := fftypes.NewUUID() msgID1 := fftypes.NewUUID() batch := &fftypes.Batch{ - ID: batchID, - Type: fftypes.MessageTypeBroadcast, - Author: "0x12345", + ID: batchID, + Type: fftypes.MessageTypeBroadcast, + Identity: fftypes.Identity{ + Key: "0x12345", + Author: "did:firefly:org/abcd", + }, Namespace: "ns1", Hash: fftypes.NewRandB32(), Created: fftypes.Now(), @@ -75,9 +78,12 @@ func TestBatch2EWithDB(t *testing.T) { msgID2 := fftypes.NewUUID() payloadRef := "" batchUpdated := &fftypes.Batch{ - ID: batchID, - Type: fftypes.MessageTypeBroadcast, - Author: "0x12345", + ID: batchID, + Type: fftypes.MessageTypeBroadcast, + Identity: fftypes.Identity{ + Key: "0x12345", + Author: "did:firefly:org/abcd", + }, Namespace: "ns1", Hash: fftypes.NewRandB32(), Created: fftypes.Now(), diff --git a/internal/database/sqlcommon/message_sql.go b/internal/database/sqlcommon/message_sql.go index d506a3756b..4813c432fb 100644 --- a/internal/database/sqlcommon/message_sql.go +++ b/internal/database/sqlcommon/message_sql.go @@ -34,6 +34,7 @@ var ( "cid", "mtype", "author", + "key", "created", "namespace", "topics", @@ -106,6 +107,7 @@ func (s *SQLCommon) upsertMessageCommon(ctx context.Context, message *fftypes.Me Set("cid", message.Header.CID). Set("mtype", string(message.Header.Type)). Set("author", message.Header.Author). + Set("key", message.Header.Key). Set("created", message.Header.Created). Set("namespace", message.Header.Namespace). Set("topics", message.Header.Topics). @@ -136,6 +138,7 @@ func (s *SQLCommon) upsertMessageCommon(ctx context.Context, message *fftypes.Me message.Header.CID, string(message.Header.Type), message.Header.Author, + message.Header.Key, message.Header.Created, message.Header.Namespace, message.Header.Topics, @@ -278,6 +281,7 @@ func (s *SQLCommon) msgResult(ctx context.Context, row *sql.Rows) (*fftypes.Mess &msg.Header.CID, &msg.Header.Type, &msg.Header.Author, + &msg.Header.Key, &msg.Header.Created, &msg.Header.Namespace, &msg.Header.Topics, diff --git a/internal/database/sqlcommon/message_sql_test.go b/internal/database/sqlcommon/message_sql_test.go index f2620dd9f5..40745004ec 100644 --- a/internal/database/sqlcommon/message_sql_test.go +++ b/internal/database/sqlcommon/message_sql_test.go @@ -46,10 +46,13 @@ func TestUpsertE2EWithDB(t *testing.T) { rand2 := fftypes.NewRandB32() msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: msgID, - CID: nil, - Type: fftypes.MessageTypeBroadcast, - Author: "0x12345", + ID: msgID, + CID: nil, + Type: fftypes.MessageTypeBroadcast, + Identity: fftypes.Identity{ + Key: "0x12345", + Author: "did:firefly:org/abcd", + }, Created: fftypes.Now(), Namespace: "ns12345", Topics: []string{"test1"}, @@ -92,10 +95,13 @@ func TestUpsertE2EWithDB(t *testing.T) { bid := fftypes.NewUUID() msgUpdated := &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: msgID, - CID: cid, - Type: fftypes.MessageTypeBroadcast, - Author: "0x12345", + ID: msgID, + CID: cid, + Type: fftypes.MessageTypeBroadcast, + Identity: fftypes.Identity{ + Key: "0x12345", + Author: "did:firefly:org/abcd", + }, Created: fftypes.Now(), Namespace: "ns12345", Topics: []string{"topic1", "topic2"}, @@ -400,7 +406,7 @@ func TestGetMessageByIDLoadRefsFail(t *testing.T) { cols := append([]string{}, msgColumns...) cols = append(cols, "id()") mock.ExpectQuery("SELECT .*").WillReturnRows(sqlmock.NewRows(cols). - AddRow(msgID.String(), nil, fftypes.MessageTypeBroadcast, "0x12345", 0, "ns1", "t1", "c1", nil, b32.String(), b32.String(), b32.String(), true, true, 0, "pin", nil, false, 0)) + AddRow(msgID.String(), nil, fftypes.MessageTypeBroadcast, "author1", "0x12345", 0, "ns1", "t1", "c1", nil, b32.String(), b32.String(), b32.String(), true, true, 0, "pin", nil, false, 0)) mock.ExpectQuery("SELECT .*").WillReturnError(fmt.Errorf("pop")) _, err := s.GetMessageByID(context.Background(), msgID) assert.Regexp(t, "FF10115", err) @@ -447,7 +453,7 @@ func TestGetMessagesLoadRefsFail(t *testing.T) { cols := append([]string{}, msgColumns...) cols = append(cols, "id()") mock.ExpectQuery("SELECT .*").WillReturnRows(sqlmock.NewRows(cols). - AddRow(msgID.String(), nil, fftypes.MessageTypeBroadcast, "0x12345", 0, "ns1", "t1", "c1", nil, b32.String(), b32.String(), b32.String(), true, true, 0, "pin", nil, false, 0)) + AddRow(msgID.String(), nil, fftypes.MessageTypeBroadcast, "author1", "0x12345", 0, "ns1", "t1", "c1", nil, b32.String(), b32.String(), b32.String(), true, true, 0, "pin", nil, false, 0)) mock.ExpectQuery("SELECT .*").WillReturnError(fmt.Errorf("pop")) f := database.MessageQueryFactory.NewFilter(context.Background()).Gt("confirmed", "0") _, _, err := s.GetMessages(context.Background(), f) diff --git a/internal/database/sqlcommon/tokenpool_sql.go b/internal/database/sqlcommon/tokenpool_sql.go index ef56f622ca..6bf91de824 100644 --- a/internal/database/sqlcommon/tokenpool_sql.go +++ b/internal/database/sqlcommon/tokenpool_sql.go @@ -36,6 +36,8 @@ var ( "type", "tx_type", "tx_id", + "author", + "key", } tokenPoolFilterFieldMap = map[string]string{ "protocolid": "protocol_id", @@ -81,6 +83,8 @@ func (s *SQLCommon) UpsertTokenPool(ctx context.Context, pool *fftypes.TokenPool Set("type", pool.Type). Set("tx_type", pool.TX.Type). Set("tx_id", pool.TX.ID). + Set("author", pool.Author). + Set("key", pool.Key). Where(sq.Eq{"id": pool.ID}), func() { s.callbacks.UUIDCollectionNSEvent(database.CollectionTokenPools, fftypes.ChangeEventTypeUpdated, pool.Namespace, pool.ID) @@ -100,6 +104,8 @@ func (s *SQLCommon) UpsertTokenPool(ctx context.Context, pool *fftypes.TokenPool pool.Type, pool.TX.Type, pool.TX.ID, + pool.Author, + pool.Key, ), func() { s.callbacks.UUIDCollectionNSEvent(database.CollectionTokenPools, fftypes.ChangeEventTypeCreated, pool.Namespace, pool.ID) @@ -122,6 +128,8 @@ func (s *SQLCommon) tokenPoolResult(ctx context.Context, row *sql.Rows) (*fftype &pool.Type, &pool.TX.Type, &pool.TX.ID, + &pool.Author, + &pool.Key, ) if err != nil { return nil, i18n.WrapError(ctx, err, i18n.MsgDBReadErr, "tokenpool") diff --git a/internal/database/sqlcommon/tokenpool_sql_test.go b/internal/database/sqlcommon/tokenpool_sql_test.go index a8d67c1b8b..b35d9748a9 100644 --- a/internal/database/sqlcommon/tokenpool_sql_test.go +++ b/internal/database/sqlcommon/tokenpool_sql_test.go @@ -48,6 +48,10 @@ func TestTokenPoolE2EWithDB(t *testing.T) { Type: fftypes.TransactionTypeTokenPool, ID: fftypes.NewUUID(), }, + Identity: fftypes.Identity{ + Key: "0x12345", + Author: "did:firefly:org/abcd", + }, } poolJson, _ := json.Marshal(&pool) diff --git a/internal/events/aggregator_test.go b/internal/events/aggregator_test.go index 94d1deaa12..c3c5e11cba 100644 --- a/internal/events/aggregator_test.go +++ b/internal/events/aggregator_test.go @@ -51,8 +51,9 @@ func TestAggregationMaskedZeroNonceMatch(t *testing.T) { defer cancel() // Generate some pin data - member1 := "0x12345" - member2 := "0x23456" + member1org := "org1" + member2org := "org2" + member2key := "0x23456" topic := "some-topic" batchID := fftypes.NewUUID() groupID := fftypes.NewRandB32() @@ -61,9 +62,9 @@ func TestAggregationMaskedZeroNonceMatch(t *testing.T) { h.Write([]byte(topic)) h.Write((*groupID)[:]) contextUnmasked := fftypes.HashResult(h) - member1NonceZero := ag.calcHash(topic, groupID, member1, 0) - member2NonceZero := ag.calcHash(topic, groupID, member2, 0) - member2NonceOne := ag.calcHash(topic, groupID, member2, 1) + member1NonceZero := ag.calcHash(topic, groupID, member1org, 0) + member2NonceZero := ag.calcHash(topic, groupID, member2org, 0) + member2NonceOne := ag.calcHash(topic, groupID, member2org, 1) mdi := ag.database.(*databasemocks.Plugin) mdm := ag.data.(*datamocks.Manager) @@ -79,7 +80,10 @@ func TestAggregationMaskedZeroNonceMatch(t *testing.T) { ID: msgID, Group: groupID, Topics: []string{topic}, - Author: member2, + Identity: fftypes.Identity{ + Author: member2org, + Key: member2key, + }, }, Pins: []string{member2NonceZero.String()}, Data: fftypes.DataRefs{ @@ -95,8 +99,8 @@ func TestAggregationMaskedZeroNonceMatch(t *testing.T) { msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ - {Identity: member1}, - {Identity: member2}, + {Identity: member1org}, + {Identity: member2org}, }, }, }, nil) @@ -183,8 +187,9 @@ func TestAggregationMaskedNextSequenceMatch(t *testing.T) { defer cancel() // Generate some pin data - member1 := "0x12345" - member2 := "0x23456" + member1org := "org1" + member2org := "org2" + member2key := "0x12345" topic := "some-topic" batchID := fftypes.NewUUID() groupID := fftypes.NewRandB32() @@ -193,9 +198,9 @@ func TestAggregationMaskedNextSequenceMatch(t *testing.T) { h.Write([]byte(topic)) h.Write((*groupID)[:]) contextUnmasked := fftypes.HashResult(h) - member1Nonce100 := ag.calcHash(topic, groupID, member1, 100) - member2Nonce500 := ag.calcHash(topic, groupID, member2, 500) - member2Nonce501 := ag.calcHash(topic, groupID, member2, 501) + member1Nonce100 := ag.calcHash(topic, groupID, member1org, 100) + member2Nonce500 := ag.calcHash(topic, groupID, member2org, 500) + member2Nonce501 := ag.calcHash(topic, groupID, member2org, 501) mdi := ag.database.(*databasemocks.Plugin) mdm := ag.data.(*datamocks.Manager) @@ -210,7 +215,10 @@ func TestAggregationMaskedNextSequenceMatch(t *testing.T) { ID: msgID, Group: groupID, Topics: []string{topic}, - Author: member2, + Identity: fftypes.Identity{ + Author: member2org, + Key: member2key, + }, }, Pins: []string{member2Nonce500.String()}, Data: fftypes.DataRefs{ @@ -222,8 +230,8 @@ func TestAggregationMaskedNextSequenceMatch(t *testing.T) { }, nil) // Look for existing nextpins - none found, first on context mdi.On("GetNextPins", ag.ctx, mock.Anything).Return([]*fftypes.NextPin{ - {Context: contextUnmasked, Identity: member1, Hash: member1Nonce100, Nonce: 100, Sequence: 929}, - {Context: contextUnmasked, Identity: member2, Hash: member2Nonce500, Nonce: 500, Sequence: 424}, + {Context: contextUnmasked, Identity: member1org, Hash: member1Nonce100, Nonce: 100, Sequence: 929}, + {Context: contextUnmasked, Identity: member2org, Hash: member2Nonce500, Nonce: 500, Sequence: 424}, }, nil, nil).Once() // Validate the message is ok mdm.On("GetMessageData", ag.ctx, mock.Anything, true).Return([]*fftypes.Data{}, true, nil) @@ -285,7 +293,8 @@ func TestAggregationBroadcast(t *testing.T) { mdm := ag.data.(*datamocks.Manager) // Get the batch - member1 := "0x12345" + member1org := "org1" + member1key := "0x12345" mdi.On("GetBatchByID", ag.ctx, uuidMatches(batchID)).Return(&fftypes.Batch{ ID: batchID, Payload: fftypes.BatchPayload{ @@ -294,7 +303,10 @@ func TestAggregationBroadcast(t *testing.T) { Header: fftypes.MessageHeader{ ID: msgID, Topics: []string{topic}, - Author: member1, + Identity: fftypes.Identity{ + Author: member1org, + Key: member1key, + }, }, Data: fftypes.DataRefs{ {ID: fftypes.NewUUID()}, @@ -611,9 +623,12 @@ func TestCheckMaskedContextReadyMismatchedAuthor(t *testing.T) { _, err := ag.checkMaskedContextReady(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: fftypes.NewRandB32(), - Author: "author1", + ID: fftypes.NewUUID(), + Group: fftypes.NewRandB32(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32()) assert.NoError(t, err) @@ -629,9 +644,12 @@ func TestAttemptContextInitGetGroupByIDFail(t *testing.T) { _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: fftypes.NewRandB32(), - Author: "author1", + ID: fftypes.NewUUID(), + Group: fftypes.NewRandB32(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), fftypes.NewRandB32()) assert.EqualError(t, err, "pop") @@ -647,9 +665,12 @@ func TestAttemptContextInitGroupNotFound(t *testing.T) { _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: fftypes.NewRandB32(), - Author: "author1", + ID: fftypes.NewUUID(), + Group: fftypes.NewRandB32(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), fftypes.NewRandB32()) assert.NoError(t, err) @@ -673,9 +694,12 @@ func TestAttemptContextInitAuthorMismatch(t *testing.T) { _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: groupID, - Author: "author1", + ID: fftypes.NewUUID(), + Group: groupID, + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), zeroHash) assert.NoError(t, err) @@ -698,9 +722,12 @@ func TestAttemptContextInitNoMatch(t *testing.T) { _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: groupID, - Author: "author1", + ID: fftypes.NewUUID(), + Group: groupID, + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), fftypes.NewRandB32()) assert.NoError(t, err) @@ -726,9 +753,12 @@ func TestAttemptContextInitGetPinsFail(t *testing.T) { _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: groupID, - Author: "author1", + ID: fftypes.NewUUID(), + Group: groupID, + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), zeroHash) assert.EqualError(t, err, "pop") @@ -756,9 +786,12 @@ func TestAttemptContextInitGetPinsBlocked(t *testing.T) { np, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: groupID, - Author: "author1", + ID: fftypes.NewUUID(), + Group: groupID, + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), zeroHash) assert.NoError(t, err) @@ -786,9 +819,12 @@ func TestAttemptContextInitInsertPinsFail(t *testing.T) { np, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Group: groupID, - Author: "author1", + ID: fftypes.NewUUID(), + Group: groupID, + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }, "topic1", 12345, fftypes.NewRandB32(), zeroHash) assert.Nil(t, np) diff --git a/internal/events/batch_pin_complete_test.go b/internal/events/batch_pin_complete_test.go index e89430cba1..769e0381e3 100644 --- a/internal/events/batch_pin_complete_test.go +++ b/internal/events/batch_pin_complete_test.go @@ -26,7 +26,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" "github.com/hyperledger-labs/firefly/pkg/blockchain" "github.com/hyperledger-labs/firefly/pkg/database" @@ -47,9 +47,12 @@ func TestBatchPinCompleteOkBroadcast(t *testing.T) { Contexts: []*fftypes.Bytes32{fftypes.NewRandB32()}, } batchData := &fftypes.Batch{ - ID: batch.BatchID, - Namespace: "ns1", - Author: "0x12345", + ID: batch.BatchID, + Namespace: "ns1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, PayloadRef: batch.BatchPaylodRef, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ @@ -86,8 +89,8 @@ func TestBatchPinCompleteOkBroadcast(t *testing.T) { mdi.On("UpsertBatch", mock.Anything, mock.Anything, false).Return(nil) mbi := &blockchainmocks.Plugin{} - mii := em.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x12345").Return(&fftypes.Identity{OnChain: "0x12345"}, nil) + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) err = em.BatchPinComplete(mbi, batch, "0x12345", "tx1", nil) assert.NoError(t, err) @@ -199,8 +202,11 @@ func TestPersistBatchAuthorResolveFail(t *testing.T) { defer cancel() batchHash := fftypes.NewRandB32() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x23456", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, @@ -209,8 +215,8 @@ func TestPersistBatchAuthorResolveFail(t *testing.T) { }, Hash: batchHash, } - mii := em.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(nil, fmt.Errorf("pop")) + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, batchHash, "0x12345") assert.NoError(t, err) @@ -222,8 +228,11 @@ func TestPersistBatchBadAuthor(t *testing.T) { defer cancel() batchHash := fftypes.NewRandB32() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x23456", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, @@ -232,8 +241,8 @@ func TestPersistBatchBadAuthor(t *testing.T) { }, Hash: batchHash, } - mii := em.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, batchHash, "0x12345") assert.NoError(t, err) @@ -244,8 +253,11 @@ func TestPersistBatchMismatchChainHash(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, @@ -254,8 +266,8 @@ func TestPersistBatchMismatchChainHash(t *testing.T) { }, Hash: fftypes.NewRandB32(), } - mii := em.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x12345").Return(&fftypes.Identity{OnChain: "0x12345"}, nil) + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, fftypes.NewRandB32(), "0x12345") assert.NoError(t, err) @@ -266,8 +278,11 @@ func TestPersistBatchUpsertBatchMismatchHash(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, @@ -290,8 +305,11 @@ func TestPersistBatchBadHash(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, @@ -310,8 +328,11 @@ func TestPersistBatchUpsertBatchFail(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ Type: fftypes.TransactionTypeBatchPin, @@ -444,8 +465,11 @@ func TestPersistBatchSwallowBadData(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Namespace: "ns1", Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ @@ -471,8 +495,11 @@ func TestPersistBatchGoodDataUpsertFail(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Namespace: "ns1", Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ @@ -500,8 +527,11 @@ func TestPersistBatchGoodDataMessageFail(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Namespace: "ns1", Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ @@ -510,8 +540,11 @@ func TestPersistBatchGoodDataMessageFail(t *testing.T) { }, Messages: []*fftypes.Message{ {Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }}, }, }, @@ -533,8 +566,11 @@ func TestPersistBatchGoodMessageAuthorMismatch(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "0x12345", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, Namespace: "ns1", Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ @@ -543,8 +579,11 @@ func TestPersistBatchGoodMessageAuthorMismatch(t *testing.T) { }, Messages: []*fftypes.Message{ {Header: fftypes.MessageHeader{ - ID: fftypes.NewUUID(), - Author: "0x9999999", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x9999999", + }, }}, }, }, diff --git a/internal/events/dx_callbacks_test.go b/internal/events/dx_callbacks_test.go index da9f31190e..c023158557 100644 --- a/internal/events/dx_callbacks_test.go +++ b/internal/events/dx_callbacks_test.go @@ -34,8 +34,11 @@ func TestMessageReceiveOK(t *testing.T) { defer cancel() batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "signingOrg", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ ID: fftypes.NewUUID(), @@ -72,8 +75,11 @@ func TestMessageReceiveOkBadBatchIgnored(t *testing.T) { defer cancel() batch := &fftypes.Batch{ - ID: nil, // so that we only test up to persistBatch which will return a non-retry error - Author: "signingOrg", + ID: nil, // so that we only test up to persistBatch which will return a non-retry error + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, } b, _ := json.Marshal(&fftypes.TransportWrapper{ Type: fftypes.TransportPayloadTypeBatch, @@ -103,8 +109,11 @@ func TestMessageReceivePersistBatchError(t *testing.T) { cancel() // retryable error batch := &fftypes.Batch{ - ID: fftypes.NewUUID(), - Author: "signingOrg", + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ ID: fftypes.NewUUID(), @@ -273,8 +282,11 @@ func TestMessageReceiveGetCandidateOrgFail(t *testing.T) { cancel() // retryable error so we need to break the loop batch := &fftypes.Batch{ - ID: nil, // so that we only test up to persistBatch which will return a non-retry error - Author: "signingOrg", + ID: nil, // so that we only test up to persistBatch which will return a non-retry error + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, } b, _ := json.Marshal(&fftypes.TransportWrapper{ Type: fftypes.TransportPayloadTypeBatch, @@ -302,8 +314,11 @@ func TestMessageReceiveGetCandidateOrgNotFound(t *testing.T) { defer cancel() batch := &fftypes.Batch{ - ID: nil, // so that we only test up to persistBatch which will return a non-retry error - Author: "signingOrg", + ID: nil, // so that we only test up to persistBatch which will return a non-retry error + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, } b, _ := json.Marshal(&fftypes.TransportWrapper{ Type: fftypes.TransportPayloadTypeBatch, @@ -331,8 +346,11 @@ func TestMessageReceiveGetCandidateOrgNotMatch(t *testing.T) { defer cancel() batch := &fftypes.Batch{ - ID: nil, // so that we only test up to persistBatch which will return a non-retry error - Author: "signingOrg", + ID: nil, // so that we only test up to persistBatch which will return a non-retry error + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, } b, _ := json.Marshal(&fftypes.TransportWrapper{ Type: fftypes.TransportPayloadTypeBatch, @@ -561,7 +579,10 @@ func TestMessageReceiveMessageIdentityFail(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, @@ -595,7 +616,10 @@ func TestMessageReceiveMessageIdentityIncorrect(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, @@ -629,7 +653,10 @@ func TestMessageReceiveMessagePersistMessageFail(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, @@ -669,7 +696,10 @@ func TestMessageReceiveMessagePersistDataFail(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, @@ -716,7 +746,10 @@ func TestMessageReceiveMessagePersistEventFail(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, @@ -765,7 +798,10 @@ func TestMessageReceiveMessageEnsureLocalGroupFail(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, @@ -804,7 +840,10 @@ func TestMessageReceiveMessageEnsureLocalGroupReject(t *testing.T) { msg := &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "signingOrg", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, ID: fftypes.NewUUID(), TxType: fftypes.TransactionTypeNone, }, diff --git a/internal/events/event_dispatcher_test.go b/internal/events/event_dispatcher_test.go index b118e028ec..e49b7917c1 100644 --- a/internal/events/event_dispatcher_test.go +++ b/internal/events/event_dispatcher_test.go @@ -430,7 +430,10 @@ func TestFilterEventsMatch(t *testing.T) { Topics: fftypes.FFNameArray{"topic1"}, Tag: "tag1", Group: nil, - Author: "0x12345", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, }, }, }, @@ -444,7 +447,10 @@ func TestFilterEventsMatch(t *testing.T) { Topics: fftypes.FFNameArray{"topic1"}, Tag: "tag2", Group: gid1, - Author: "0x23456", + Identity: fftypes.Identity{ + Author: "org2", + Key: "0x23456", + }, }, }, }, @@ -458,7 +464,10 @@ func TestFilterEventsMatch(t *testing.T) { Topics: fftypes.FFNameArray{"topic2"}, Tag: "tag1", Group: nil, - Author: "0x12345", + Identity: fftypes.Identity{ + Author: "signingOrg", + Key: "0x12345", + }, }, }, }, diff --git a/internal/events/event_manager.go b/internal/events/event_manager.go index f6dd96f8cc..77c2fb973a 100644 --- a/internal/events/event_manager.go +++ b/internal/events/event_manager.go @@ -27,6 +27,7 @@ import ( "github.com/hyperledger-labs/firefly/internal/events/eifactory" "github.com/hyperledger-labs/firefly/internal/events/system" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/identity" "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/internal/retry" "github.com/hyperledger-labs/firefly/internal/syshandlers" @@ -35,7 +36,6 @@ import ( "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/dataexchange" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" "github.com/hyperledger-labs/firefly/pkg/publicstorage" "github.com/hyperledger-labs/firefly/pkg/tokens" ) @@ -72,7 +72,7 @@ type eventManager struct { ctx context.Context publicstorage publicstorage.Plugin database database.Plugin - identity identity.Plugin + identity identity.Manager syshandlers syshandlers.SystemHandlers data data.Manager subManager *subscriptionManager @@ -85,8 +85,8 @@ type eventManager struct { internalEvents *system.Events } -func NewEventManager(ctx context.Context, pi publicstorage.Plugin, di database.Plugin, ii identity.Plugin, sh syshandlers.SystemHandlers, dm data.Manager) (EventManager, error) { - if pi == nil || di == nil || ii == nil || dm == nil { +func NewEventManager(ctx context.Context, pi publicstorage.Plugin, di database.Plugin, im identity.Manager, sh syshandlers.SystemHandlers, dm data.Manager) (EventManager, error) { + if pi == nil || di == nil || im == nil || dm == nil { return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) } newPinNotifier := newEventNotifier(ctx, "pins") @@ -95,7 +95,7 @@ func NewEventManager(ctx context.Context, pi publicstorage.Plugin, di database.P ctx: log.WithLogField(ctx, "role", "event-manager"), publicstorage: pi, database: di, - identity: ii, + identity: im, syshandlers: sh, data: dm, retry: retry.Retry{ diff --git a/internal/events/event_manager_test.go b/internal/events/event_manager_test.go index c77a334f30..3d2ef48b44 100644 --- a/internal/events/event_manager_test.go +++ b/internal/events/event_manager_test.go @@ -26,7 +26,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" "github.com/hyperledger-labs/firefly/mocks/syshandlersmocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" @@ -38,13 +38,13 @@ func newTestEventManager(t *testing.T) (*eventManager, func()) { config.Reset() ctx, cancel := context.WithCancel(context.Background()) mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} + mim := &identitymanagermocks.Manager{} mpi := &publicstoragemocks.Plugin{} met := &eventsmocks.Plugin{} mdm := &datamocks.Manager{} msh := &syshandlersmocks.SystemHandlers{} met.On("Name").Return("ut").Maybe() - emi, err := NewEventManager(ctx, mpi, mdi, mii, msh, mdm) + emi, err := NewEventManager(ctx, mpi, mdi, mim, msh, mdm) em := emi.(*eventManager) rag := mdi.On("RunAsGroup", em.ctx, mock.Anything).Maybe() rag.RunFn = func(a mock.Arguments) { @@ -83,11 +83,11 @@ func TestStartStopBadTransports(t *testing.T) { config.Set(config.EventTransportsEnabled, []string{"wrongun"}) defer config.Reset() mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} + mim := &identitymanagermocks.Manager{} mpi := &publicstoragemocks.Plugin{} mdm := &datamocks.Manager{} msh := &syshandlersmocks.SystemHandlers{} - _, err := NewEventManager(context.Background(), mpi, mdi, mii, msh, mdm) + _, err := NewEventManager(context.Background(), mpi, mdi, mim, msh, mdm) assert.Regexp(t, "FF10172", err) } diff --git a/internal/events/persist_batch.go b/internal/events/persist_batch.go index 9b19e95c30..696190f05b 100644 --- a/internal/events/persist_batch.go +++ b/internal/events/persist_batch.go @@ -24,17 +24,17 @@ import ( "github.com/hyperledger-labs/firefly/pkg/fftypes" ) -func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX context*/, batch *fftypes.Batch, onchainHash *fftypes.Bytes32, author string) (valid bool, err error) { +func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX context*/, batch *fftypes.Batch, onchainHash *fftypes.Bytes32, signingKey string) (valid bool, err error) { l := log.L(ctx) - // Verify the author matches - id, err := em.identity.Resolve(ctx, batch.Author) + // Verify that we can resolve the signing key back to this identity. + // This is a specific rule for broadcasts, so we know the authenticity of the data. + author, err := em.identity.ResolveSigningKeyIdentity(ctx, signingKey) if err != nil { - l.Errorf("Invalid batch '%s'. Author '%s' cound not be resolved: %s", batch.ID, batch.Author, err) - return false, nil // This is not retryable. skip this batch + return false, err } - if author != id.OnChain { - l.Errorf("Invalid batch '%s'. Author '%s' does not match transaction submitter '%s'", batch.ID, id.OnChain, author) + if author == "" || author != batch.Author || signingKey != batch.Key { + l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Author, batch.Key, author, signingKey) return false, nil // This is not retryable. skip this batch } diff --git a/internal/i18n/en_translations.go b/internal/i18n/en_translations.go index 8d697c0785..8ca18a4c16 100644 --- a/internal/i18n/en_translations.go +++ b/internal/i18n/en_translations.go @@ -197,4 +197,5 @@ var ( MsgAuthorNotFoundByDID = ffm("FF10277", "Author could not be resolved via DID '%s'") MsgAuthorOrgNotFoundByName = ffm("FF10278", "Author organization could not be resolved via name '%s'") MsgAuthorOrgSigningKeyMismatch = ffm("FF10279", "Author organization '%s' is not associated with signing key '%s'") + MsgLocalOrgLookupFailed = ffm("FF10290", "Unable resolve the local org by the configured signing key on the node. Please confirm the org is registered with key '%s'", 500) ) diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index 8f04c896cf..d5b366d594 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -38,6 +38,8 @@ const ( type Manager interface { ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) + ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (author string, err error) + ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) } type identityManager struct { @@ -45,6 +47,7 @@ type identityManager struct { plugin identity.Plugin blockchain blockchain.Plugin + localOrgDID string identityCacheTTL time.Duration identityCache *ccache.Cache signingKeyCacheTTL time.Duration @@ -73,16 +76,21 @@ func NewIdentityManager(ctx context.Context, di database.Plugin, ii identity.Plu return im, nil } +func orgDID(org *fftypes.Organization) string { + if org == nil { + return "" + } + return fmt.Sprintf("%s%s", fireflyOrgDIDPrefix, org.ID) +} + // ResolveInputIdentity takes in identity input information from an API call, or configuration load, and resolves // the combination func (im *identityManager) ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) { log.L(ctx).Debugf("Resolving identity input: key='%s' author='%s'", identity.Key, identity.Author) - if identity.Key != "" { - err = im.resolveSigningKey(ctx, identity) - if err != nil { - return err - } + identity.Key, err = im.resolveSigningKey(ctx, identity.Key) + if err != nil { + return err } // Resolve the identity @@ -94,9 +102,60 @@ func (im *identityManager) ResolveInputIdentity(ctx context.Context, identity *f return } +func (im *identityManager) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (author string, err error) { + + signingKey, err = im.resolveSigningKey(ctx, signingKey) + if err != nil { + return "", err + } + + // TODO: Consider other ways identity could be resolved + org, err := im.cachedOrgLookupBySigningKey(ctx, signingKey) + if err != nil { + return "", err + } + + return orgDID(org), nil + +} + +func (im *identityManager) ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) { + if im.localOrgDID != "" { + return im.localOrgDID, nil + } + orgKey := config.GetString(config.OrgKey) + if orgKey == "" { + orgKey = config.GetString(config.OrgIdentityDeprecated) + } + im.localOrgDID, err = im.ResolveSigningKeyIdentity(ctx, orgKey) + if err != nil { + return "", i18n.WrapError(ctx, err, i18n.MsgLocalOrgLookupFailed, orgKey) + } + if im.localOrgDID == "" { + return "", i18n.NewError(ctx, i18n.MsgLocalOrgLookupFailed, orgKey) + } + return im.localOrgDID, err +} + +func (im *identityManager) cachedOrgLookupBySigningKey(ctx context.Context, signingKey string) (org *fftypes.Organization, err error) { + cacheKey := fmt.Sprintf("key:%s", signingKey) + if cached := im.identityCache.Get(cacheKey); cached != nil { + cached.Extend(im.identityCacheTTL) + org = cached.Value().(*fftypes.Organization) + } else { + if org, err = im.database.GetOrganizationByIdentity(ctx, signingKey); err != nil || org == nil { + return org, err + } + // Cache the result + im.identityCache.Set(cacheKey, org, im.identityCacheTTL) + } + return org, nil +} + func (im *identityManager) cachedOrgLookupByAuthor(ctx context.Context, author string) (org *fftypes.Organization, err error) { // Use an LRU cache for the author identity, as it's likely for the same identity to be re-used over and over - if cached := im.identityCache.Get(author); cached != nil { + cacheKey := fmt.Sprintf("author:%s", author) + if cached := im.identityCache.Get(cacheKey); cached != nil { cached.Extend(im.identityCacheTTL) org = cached.Value().(*fftypes.Organization) } else { @@ -124,7 +183,7 @@ func (im *identityManager) cachedOrgLookupByAuthor(ctx context.Context, author s } // Cache the result - im.identityCache.Set(author, org, im.identityCacheTTL) + im.identityCache.Set(cacheKey, org, im.identityCacheTTL) } return org, nil } @@ -160,26 +219,24 @@ func (im *identityManager) resolveInputAuthor(ctx context.Context, identity *fft } // We normalize the author to the DID - identity.Author = fmt.Sprintf("%s%s", fireflyOrgDIDPrefix, org.ID) + identity.Author = orgDID(org) return nil } -func (im *identityManager) resolveSigningKey(ctx context.Context, identity *fftypes.Identity) (err error) { +func (im *identityManager) resolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) { // Resolve the signing key - if identity.Key != "" { - inputKey := identity.Key + if inputKey != "" { if cached := im.signingKeyCache.Get(inputKey); cached != nil { cached.Extend(im.identityCacheTTL) - identity.Key = cached.Value().(string) + outputKey = cached.Value().(string) } else { - identity.Key, err = im.blockchain.ResolveSigningKey(ctx, inputKey) + outputKey, err = im.blockchain.ResolveSigningKey(ctx, inputKey) if err != nil { - return err + return "", err } - im.signingKeyCache.Set(inputKey, identity.Key, im.identityCacheTTL) + im.signingKeyCache.Set(inputKey, outputKey, im.identityCacheTTL) } } - return } diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go index b0c945d678..69c981c81f 100644 --- a/internal/identity/identitymanager_test.go +++ b/internal/identity/identitymanager_test.go @@ -301,3 +301,130 @@ func TestResolveInputIdentityOrgLookupByNameNotFound(t *testing.T) { assert.Regexp(t, "FF10278", err) mdi.AssertExpectations(t) } + +func TestResolveSigningKeyIdentityBadSigningKey(t *testing.T) { + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "badness").Return("", fmt.Errorf("pop")) + + _, err := im.ResolveSigningKeyIdentity(ctx, "badness") + assert.Regexp(t, "pop", err) + mbi.AssertExpectations(t) +} + +func TestResolveSigningKeyIdentityOrgLookupFail(t *testing.T) { + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(nil, fmt.Errorf("pop")) + + _, err := im.ResolveSigningKeyIdentity(ctx, "key1") + assert.Regexp(t, "pop", err) + mbi.AssertExpectations(t) +} + +func TestResolveSigningKeyIdentityOrgLookupOkCached(t *testing.T) { + + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Identity: "key1resolved", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(org, nil).Once() + + author, err := im.ResolveSigningKeyIdentity(ctx, "key1") + assert.NoError(t, err) + assert.Equal(t, orgDID(org), author) + + // Cached second time, without any DB call (see "Once()" above) + author, err = im.ResolveSigningKeyIdentity(ctx, "key1") + assert.NoError(t, err) + assert.Equal(t, orgDID(org), author) + + mbi.AssertExpectations(t) +} + +func TestResolveSigningKeyIdentityOrgLookupUnresolved(t *testing.T) { + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil) + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(nil, nil) + + author, err := im.ResolveSigningKeyIdentity(ctx, "key1") + assert.NoError(t, err) + assert.Equal(t, "", author) + + mbi.AssertExpectations(t) +} + +func TestResolveLocalOrgDIDSuccess(t *testing.T) { + + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x222222", + } + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(org, nil).Once() + + config.Set(config.OrgIdentityDeprecated, "key1") + + localOrgDID, err := im.ResolveLocalOrgDID(ctx) + assert.NoError(t, err) + assert.Equal(t, orgDID(org), localOrgDID) + + // Second one cached + localOrgDID, err = im.ResolveLocalOrgDID(ctx) + assert.NoError(t, err) + assert.Equal(t, orgDID(org), localOrgDID) + + mbi.AssertExpectations(t) + +} + +func TestResolveLocalOrgDIDFail(t *testing.T) { + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(nil, fmt.Errorf("pop")).Once() + + config.Set(config.OrgIdentityDeprecated, "key1") + + _, err := im.ResolveLocalOrgDID(ctx) + assert.Regexp(t, "FF10290", err) + + mbi.AssertExpectations(t) + +} + +func TestResolveLocalOrgDIDNotFound(t *testing.T) { + + ctx, im := newTestIdentityManager(t) + mbi := im.blockchain.(*blockchainmocks.Plugin) + mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil).Once() + mdi := im.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(nil, nil).Once() + + config.Set(config.OrgIdentityDeprecated, "key1") + + _, err := im.ResolveLocalOrgDID(ctx) + assert.Regexp(t, "FF10290", err) + + mbi.AssertExpectations(t) + +} diff --git a/internal/networkmap/manager_test.go b/internal/networkmap/manager_test.go index a5145d7371..ae142ec7bc 100644 --- a/internal/networkmap/manager_test.go +++ b/internal/networkmap/manager_test.go @@ -24,7 +24,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/stretchr/testify/assert" ) @@ -34,8 +34,8 @@ func newTestNetworkmap(t *testing.T) (*networkMap, func()) { mdi := &databasemocks.Plugin{} mbm := &broadcastmocks.Manager{} mdx := &dataexchangemocks.Plugin{} - mii := &identitymocks.Plugin{} - nm, err := NewNetworkMap(ctx, mdi, mbm, mdx, mii) + mim := &identitymanagermocks.Manager{} + nm, err := NewNetworkMap(ctx, mdi, mbm, mdx, mim) assert.NoError(t, err) return nm.(*networkMap), cancel diff --git a/internal/networkmap/register_node.go b/internal/networkmap/register_node.go index 0da976414b..85a06c61ef 100644 --- a/internal/networkmap/register_node.go +++ b/internal/networkmap/register_node.go @@ -54,11 +54,6 @@ func (nm *networkMap) RegisterNode(ctx context.Context, waitConfirm bool) (node return nil, nil, err } - signingIdentity, err := nm.identity.Resolve(ctx, node.Owner) - if err != nil { - return nil, nil, i18n.WrapError(ctx, err, i18n.MsgInvalidSigningIdentity) - } - msg, err = nm.broadcast.BroadcastDefinition(ctx, node, signingIdentity, fftypes.SystemTagDefineNode, waitConfirm) if msg != nil { node.Message = msg.Header.ID diff --git a/internal/networkmap/register_node_test.go b/internal/networkmap/register_node_test.go index 6fb23f7de2..57852fc2cc 100644 --- a/internal/networkmap/register_node_test.go +++ b/internal/networkmap/register_node_test.go @@ -24,6 +24,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/identitymocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" @@ -44,11 +45,11 @@ func TestRegisterNodeOk(t *testing.T) { Description: "owning organization", }, nil) - mii := nm.identity.(*identitymocks.Plugin) + mim := nm.identity.(*identitymanagermocks.Manager) childID := &fftypes.Identity{OnChain: "0x12345"} parentID := &fftypes.Identity{OnChain: "0x23456"} - mii.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) - mii.On("Resolve", nm.ctx, "0x23456").Return(parentID, nil) + mim.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) + mim.On("Resolve", nm.ctx, "0x23456").Return(parentID, nil) mdx := nm.exchange.(*dataexchangemocks.Plugin) mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) diff --git a/internal/privatemessaging/groupmanager.go b/internal/privatemessaging/groupmanager.go index 51e1f6bb4c..8c349d5c93 100644 --- a/internal/privatemessaging/groupmanager.go +++ b/internal/privatemessaging/groupmanager.go @@ -112,7 +112,7 @@ func (gm *groupManager) groupInit(ctx context.Context, signer *fftypes.Identity, Group: group.Hash, Namespace: group.Namespace, // Must go into the same ordering context as the message itself Type: fftypes.MessageTypeGroupInit, - Author: signer.Identifier, + Identity: *signer, Tag: string(fftypes.SystemTagDefineGroup), Topics: fftypes.FFNameArray{group.Topic()}, TxType: fftypes.TransactionTypeBatchPin, diff --git a/internal/privatemessaging/groupmanager_test.go b/internal/privatemessaging/groupmanager_test.go index bcc21a3d46..2d4460e956 100644 --- a/internal/privatemessaging/groupmanager_test.go +++ b/internal/privatemessaging/groupmanager_test.go @@ -94,7 +94,10 @@ func TestResolveInitGroupMissingData(t *testing.T) { Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineGroup), Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) @@ -116,7 +119,10 @@ func TestResolveInitGroupBadData(t *testing.T) { Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineGroup), Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) @@ -138,7 +144,10 @@ func TestResolveInitGroupBadValidation(t *testing.T) { Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineGroup), Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) @@ -173,7 +182,10 @@ func TestResolveInitGroupBadGroupID(t *testing.T) { Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineGroup), Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) @@ -210,7 +222,10 @@ func TestResolveInitGroupUpsertFail(t *testing.T) { Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineGroup), Group: group.Hash, - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.EqualError(t, err, "pop") @@ -248,7 +263,10 @@ func TestResolveInitGroupNewOk(t *testing.T) { Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineGroup), Group: group.Hash, - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) @@ -269,7 +287,10 @@ func TestResolveInitGroupExistingOK(t *testing.T) { Namespace: "ns1", Tag: "mytag", Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) @@ -288,7 +309,10 @@ func TestResolveInitGroupExistingFail(t *testing.T) { Namespace: "ns1", Tag: "mytag", Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.EqualError(t, err, "pop") @@ -307,7 +331,10 @@ func TestResolveInitGroupExistingNotFound(t *testing.T) { Namespace: "ns1", Tag: "mytag", Group: fftypes.NewRandB32(), - Author: "author1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, }, }) assert.NoError(t, err) diff --git a/internal/privatemessaging/message.go b/internal/privatemessaging/message.go index f79f1835d7..906a6dc9b6 100644 --- a/internal/privatemessaging/message.go +++ b/internal/privatemessaging/message.go @@ -21,7 +21,6 @@ import ( "encoding/json" "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/pkg/fftypes" ) @@ -37,22 +36,20 @@ func (pm *privateMessaging) SendMessageWithID(ctx context.Context, ns string, id resolved.Header.ID = id resolved.Header.Namespace = ns resolved.Header.Type = fftypes.MessageTypePrivate - if resolved.Header.Author == "" { - resolved.Header.Author = pm.localOrgIdentity - } if resolved.Header.TxType == "" { resolved.Header.TxType = fftypes.TransactionTypeBatchPin } - sender, err := pm.identity.Resolve(ctx, resolved.Header.Author) - if err != nil { + // Resolve the sending identity + if err := pm.identity.ResolveInputIdentity(ctx, &resolved.Header.Identity); err != nil { return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) } // We optimize the DB storage of all the parts of the message using transaction semantics (assuming those are supported by the DB plugin + var err error err = pm.database.RunAsGroup(ctx, func(ctx context.Context) error { if unresolved != nil { - err = pm.resolveMessage(ctx, sender, unresolved) + err = pm.resolveMessage(ctx, unresolved) } if err == nil && !waitConfirm { // We can safely optimize the send into the same DB transaction @@ -70,9 +67,10 @@ func (pm *privateMessaging) SendMessageWithID(ctx context.Context, ns string, id return resolved, err } -func (pm *privateMessaging) resolveMessage(ctx context.Context, sender *fftypes.Identity, in *fftypes.MessageInOut) (err error) { +func (pm *privateMessaging) resolveMessage(ctx context.Context, in *fftypes.MessageInOut) (err error) { + // Resolve the member list into a group - if err = pm.resolveReceipientList(ctx, sender, in); err != nil { + if err = pm.resolveReceipientList(ctx, in); err != nil { return err } @@ -95,6 +93,7 @@ func (pm *privateMessaging) sendOrWaitMessage(ctx context.Context, msg *fftypes. if immediateConfirm { msg.Confirmed = fftypes.Now() msg.Pending = false + msg.Header.Key = "" // there is no on-chain signing assurance with this message } // Store the message - this asynchronously triggers the next step in process @@ -134,15 +133,6 @@ func (pm *privateMessaging) sendUnpinnedMessage(ctx context.Context, message *ff return err } - id, err := pm.identity.Resolve(ctx, message.Header.Author) - if err == nil { - err = pm.blockchain.VerifyIdentitySyntax(ctx, id) - } - if err != nil { - log.L(ctx).Errorf("Invalid signing identity '%s': %s", message.Header.Author, err) - return err - } - data, _, err := pm.data.GetMessageData(ctx, message, true) if err != nil { return err diff --git a/internal/privatemessaging/message_test.go b/internal/privatemessaging/message_test.go index dbb7de0fb8..327b09def8 100644 --- a/internal/privatemessaging/message_test.go +++ b/internal/privatemessaging/message_test.go @@ -25,7 +25,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" @@ -37,11 +37,9 @@ func TestSendConfirmMessageE2EOk(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Return(nil) dataID := fftypes.NewUUID() mdm := pm.data.(*datamocks.Manager) @@ -108,11 +106,13 @@ func TestSendUnpinnedMessageE2EOk(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Run(func(args mock.Arguments) { + identity := args[1].(*fftypes.Identity) + identity.Author = "localorg" + identity.Key = "localkey" + }).Return(nil) dataID := fftypes.NewUUID() groupID := fftypes.NewRandB32() @@ -175,6 +175,7 @@ func TestSendUnpinnedMessageE2EOk(t *testing.T) { mdm.AssertExpectations(t) mdi.AssertExpectations(t) + mim.AssertExpectations(t) } @@ -183,8 +184,8 @@ func TestSendMessageBadIdentity(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(nil, fmt.Errorf("pop")) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Return(fmt.Errorf("pop")) _, err := pm.SendMessage(pm.ctx, "ns1", &fftypes.MessageInOut{ InlineData: fftypes.InlineData{ @@ -198,6 +199,8 @@ func TestSendMessageBadIdentity(t *testing.T) { }, false) assert.Regexp(t, "FF10206.*pop", err) + mim.AssertExpectations(t) + } func TestSendMessageFail(t *testing.T) { @@ -205,11 +208,12 @@ func TestSendMessageFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Run(func(args mock.Arguments) { + identity := args[1].(*fftypes.Identity) + identity.Author = "localorg" + identity.Key = "localkey" + }).Return(nil) dataID := fftypes.NewUUID() mdm := pm.data.(*datamocks.Manager) @@ -231,6 +235,8 @@ func TestSendMessageFail(t *testing.T) { }, false) assert.EqualError(t, err, "pop") + mim.AssertExpectations(t) + } func TestResolveAndSendBadMembers(t *testing.T) { @@ -238,7 +244,7 @@ func TestResolveAndSendBadMembers(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - err := pm.resolveMessage(pm.ctx, &fftypes.Identity{}, &fftypes.MessageInOut{ + err := pm.resolveMessage(pm.ctx, &fftypes.MessageInOut{ InlineData: fftypes.InlineData{ {Value: fftypes.Byteable(`{"some": "data"}`)}, }, @@ -252,6 +258,9 @@ func TestResolveAndSendBadInlineData(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByName", pm.ctx, "localorg").Return(&fftypes.Organization{ ID: fftypes.NewUUID(), @@ -266,7 +275,7 @@ func TestResolveAndSendBadInlineData(t *testing.T) { mdm := pm.data.(*datamocks.Manager) mdm.On("ResolveInlineDataPrivate", pm.ctx, "ns1", mock.Anything).Return(nil, fmt.Errorf("pop")) - err := pm.resolveMessage(pm.ctx, &fftypes.Identity{}, &fftypes.MessageInOut{ + err := pm.resolveMessage(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{Header: fftypes.MessageHeader{Namespace: "ns1"}}, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ @@ -300,11 +309,11 @@ func TestSendUnpinnedMessageMarshalFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.MatchedBy(func(identity *fftypes.Identity) bool { + assert.Equal(t, "localorg", identity.Author) + return true + })).Return(nil) groupID := fftypes.NewRandB32() nodeID1 := fftypes.NewUUID() @@ -333,7 +342,9 @@ func TestSendUnpinnedMessageMarshalFail(t *testing.T) { err := pm.sendUnpinnedMessage(pm.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "localorg", + Identity: fftypes.Identity{ + Author: "localorg", + }, TxType: fftypes.TransactionTypeNone, Group: groupID, }, @@ -350,12 +361,6 @@ func TestSendUnpinnedMessageGetDataFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) - groupID := fftypes.NewRandB32() nodeID1 := fftypes.NewUUID() nodeID2 := fftypes.NewUUID() @@ -381,7 +386,9 @@ func TestSendUnpinnedMessageGetDataFail(t *testing.T) { err := pm.sendUnpinnedMessage(pm.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "localorg", + Identity: fftypes.Identity{ + Author: "localorg", + }, TxType: fftypes.TransactionTypeNone, Group: groupID, }, @@ -391,35 +398,6 @@ func TestSendUnpinnedMessageGetDataFail(t *testing.T) { mdm.AssertExpectations(t) mdi.AssertExpectations(t) -} -func TestSendUnpinnedMessageIdentityFail(t *testing.T) { - - pm, cancel := newTestPrivateMessaging(t) - defer cancel() - - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "badid").Return(nil, fmt.Errorf("pop")) - - groupID := fftypes.NewRandB32() - mdi := pm.database.(*databasemocks.Plugin) - mdi.On("GetGroupByHash", pm.ctx, groupID).Return(&fftypes.Group{ - Hash: groupID, - GroupIdentity: fftypes.GroupIdentity{ - Members: fftypes.Members{}, - }, - }, nil).Once() - - err := pm.sendUnpinnedMessage(pm.ctx, &fftypes.Message{ - Header: fftypes.MessageHeader{ - Author: "badid", - TxType: fftypes.TransactionTypeNone, - Group: groupID, - }, - }) - assert.Regexp(t, "pop", err) - - mdi.AssertExpectations(t) - } func TestSendUnpinnedMessageGroupLookupFail(t *testing.T) { @@ -433,7 +411,9 @@ func TestSendUnpinnedMessageGroupLookupFail(t *testing.T) { err := pm.sendUnpinnedMessage(pm.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ - Author: "org1", + Identity: fftypes.Identity{ + Author: "org1", + }, TxType: fftypes.TransactionTypeNone, Group: groupID, }, @@ -449,11 +429,11 @@ func TestSendUnpinnedMessageInsertFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.MatchedBy(func(identity *fftypes.Identity) bool { + assert.Empty(t, identity.Author) + return true + })).Return(nil) dataID := fftypes.NewUUID() groupID := fftypes.NewRandB32() @@ -490,6 +470,7 @@ func TestSendUnpinnedMessageInsertFail(t *testing.T) { mdm.AssertExpectations(t) mdi.AssertExpectations(t) + mim.AssertExpectations(t) } @@ -498,11 +479,8 @@ func TestSendUnpinnedMessageResolveGroupFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Return(nil) dataID := fftypes.NewUUID() groupID := fftypes.NewRandB32() @@ -543,6 +521,7 @@ func TestSendUnpinnedMessageResolveGroupFail(t *testing.T) { mdm.AssertExpectations(t) mdi.AssertExpectations(t) + mim.AssertExpectations(t) } @@ -551,11 +530,9 @@ func TestSendUnpinnedMessageEventFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "localorg").Return(&fftypes.Identity{ - Identifier: "localorg", - OnChain: "0x12345", - }, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Return(nil) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) dataID := fftypes.NewUUID() groupID := fftypes.NewRandB32() @@ -616,5 +593,6 @@ func TestSendUnpinnedMessageEventFail(t *testing.T) { mdm.AssertExpectations(t) mdi.AssertExpectations(t) + mim.AssertExpectations(t) } diff --git a/internal/privatemessaging/privatemessaging.go b/internal/privatemessaging/privatemessaging.go index c8c64fd037..97be2a886a 100644 --- a/internal/privatemessaging/privatemessaging.go +++ b/internal/privatemessaging/privatemessaging.go @@ -60,7 +60,6 @@ type privateMessaging struct { retry retry.Retry localNodeName string localNodeID *fftypes.UUID // lookup and cached on first use, as might not be registered at startup - localOrgIdentity string opCorrelationRetries int } @@ -70,17 +69,16 @@ func NewPrivateMessaging(ctx context.Context, di database.Plugin, im identity.Ma } pm := &privateMessaging{ - ctx: ctx, - database: di, - identity: im, - exchange: dx, - blockchain: bi, - batch: ba, - data: dm, - syncasync: sa, - batchpin: bp, - localNodeName: config.GetString(config.NodeName), - localOrgIdentity: config.GetString(config.OrgIdentity), + ctx: ctx, + database: di, + identity: im, + exchange: dx, + blockchain: bi, + batch: ba, + data: dm, + syncasync: sa, + batchpin: bp, + localNodeName: config.GetString(config.NodeName), groupManager: groupManager{ database: di, data: dm, @@ -178,10 +176,15 @@ func (pm *privateMessaging) transferBlobs(ctx context.Context, data []*fftypes.D func (pm *privateMessaging) sendData(ctx context.Context, mType string, mID *fftypes.UUID, group *fftypes.Bytes32, ns string, nodes []*fftypes.Node, payload fftypes.Byteable, txid *fftypes.UUID, data []*fftypes.Data) (err error) { l := log.L(ctx) + localOrgDID, err := pm.identity.ResolveLocalOrgDID(ctx) + if err != nil { + return err + } + // Write it to the dataexchange for each member for i, node := range nodes { - if node.Owner == pm.localOrgIdentity { + if node.Owner == localOrgDID { l.Debugf("Skipping send of %s for local node %s:%s for group=%s node=%s (%d/%d)", mType, ns, mID, group, node.ID, i+1, len(nodes)) continue } diff --git a/internal/privatemessaging/privatemessaging_test.go b/internal/privatemessaging/privatemessaging_test.go index 8cc877b3f9..46c6429076 100644 --- a/internal/privatemessaging/privatemessaging_test.go +++ b/internal/privatemessaging/privatemessaging_test.go @@ -29,7 +29,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" @@ -39,12 +39,11 @@ import ( func newTestPrivateMessaging(t *testing.T) (*privateMessaging, func()) { config.Reset() config.Set(config.NodeName, "node1") - config.Set(config.OrgIdentity, "localorg") config.Set(config.GroupCacheTTL, "1m") config.Set(config.GroupCacheSize, "1m") mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} + mim := &identitymanagermocks.Manager{} mdx := &dataexchangemocks.Plugin{} mbi := &blockchainmocks.Plugin{} mba := &batchmocks.Manager{} @@ -55,16 +54,12 @@ func newTestPrivateMessaging(t *testing.T) (*privateMessaging, func()) { mba.On("RegisterDispatcher", []fftypes.MessageType{fftypes.MessageTypeGroupInit, fftypes.MessageTypePrivate}, mock.Anything, mock.Anything).Return() ctx, cancel := context.WithCancel(context.Background()) - pm, err := NewPrivateMessaging(ctx, mdi, mii, mdx, mbi, mba, mdm, msa, mbp) + pm, err := NewPrivateMessaging(ctx, mdi, mim, mdx, mbi, mba, mdm, msa, mbp) assert.NoError(t, err) // Default mocks to save boilerplate in the tests mdx.On("Name").Return("utdx").Maybe() mbi.On("Name").Return("utblk").Maybe() - mii.On("Resolve", ctx, "org1").Return(&fftypes.Identity{ - Identifier: "org1", OnChain: "0x12345", - }, nil).Maybe() - mbi.On("VerifyIdentitySyntax", ctx, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.OnChain == "0x12345" })).Return(nil).Maybe() return pm.(*privateMessaging), cancel } @@ -92,6 +87,7 @@ func TestDispatchBatchWithBlobs(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) mbp := pm.batchpin.(*batchpinmocks.Submitter) mdx := pm.exchange.(*dataexchangemocks.Plugin) + mim := pm.identity.(*identitymanagermocks.Manager) rag := mdi.On("RunAsGroup", pm.ctx, mock.Anything).Maybe() rag.RunFn = func(a mock.Arguments) { @@ -100,6 +96,12 @@ func TestDispatchBatchWithBlobs(t *testing.T) { } } + mim.On("ResolveInputIdentity", pm.ctx, mock.MatchedBy(func(identity *fftypes.Identity) bool { + assert.Equal(t, "org1", identity.Author) + identity.Key = "0x12345" + return true + })).Return(nil) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) mdi.On("GetGroupByHash", pm.ctx, groupID).Return(&fftypes.Group{ Hash: fftypes.NewRandB32(), GroupIdentity: fftypes.GroupIdentity{ @@ -149,8 +151,10 @@ func TestDispatchBatchWithBlobs(t *testing.T) { mbp.On("SubmitPinnedBatch", pm.ctx, mock.Anything, mock.Anything).Return(nil) err := pm.dispatchBatch(pm.ctx, &fftypes.Batch{ - ID: batchID, - Author: "org1", + ID: batchID, + Identity: fftypes.Identity{ + Author: "org1", + }, Group: groupID, Namespace: "ns1", Payload: fftypes.BatchPayload{ @@ -206,14 +210,38 @@ func TestSendAndSubmitBatchBadID(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetGroupByHash", pm.ctx, mock.Anything).Return(nil, fmt.Errorf("pop")) - mii := pm.identity.(*identitymocks.Plugin) - mii.On("Resolve", pm.ctx, "badauthor").Return(&fftypes.Identity{OnChain: "!badaddress"}, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("ResolveInputIdentity", pm.ctx, mock.MatchedBy(func(identity *fftypes.Identity) bool { + assert.Equal(t, "badauthor", identity.Author) + return true + })).Return(fmt.Errorf("pop")) mbp := pm.batchpin.(*batchpinmocks.Submitter) mbp.On("SubmitPinnedBatch", pm.ctx, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) err := pm.sendAndSubmitBatch(pm.ctx, &fftypes.Batch{ - Author: "badauthor", + Identity: fftypes.Identity{ + Author: "badauthor", + }, + }, []*fftypes.Node{}, fftypes.Byteable(`{}`), []*fftypes.Bytes32{}) + assert.Regexp(t, "pop", err) +} + +func TestSendAndSubmitBatchUnregisteredNode(t *testing.T) { + pm, cancel := newTestPrivateMessaging(t) + defer cancel() + + mdi := pm.database.(*databasemocks.Plugin) + mdi.On("GetGroupByHash", pm.ctx, mock.Anything).Return(nil, fmt.Errorf("pop")) + + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("", fmt.Errorf("pop")) + + err := pm.sendAndSubmitBatch(pm.ctx, &fftypes.Batch{ + Identity: fftypes.Identity{ + Author: "badauthor", + }, }, []*fftypes.Node{}, fftypes.Byteable(`{}`), []*fftypes.Bytes32{}) assert.Regexp(t, "pop", err) } @@ -222,11 +250,16 @@ func TestSendImmediateFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mdx := pm.exchange.(*dataexchangemocks.Plugin) mdx.On("SendMessage", pm.ctx, mock.Anything, mock.Anything).Return("", fmt.Errorf("pop")) err := pm.sendAndSubmitBatch(pm.ctx, &fftypes.Batch{ - Author: "org1", + Identity: fftypes.Identity{ + Author: "org1", + }, }, []*fftypes.Node{ { DX: fftypes.DXInfo{ @@ -242,6 +275,9 @@ func TestSendSubmitUpsertOperationFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mdx := pm.exchange.(*dataexchangemocks.Plugin) mdx.On("SendMessage", pm.ctx, mock.Anything, mock.Anything).Return("tracking1", nil) @@ -249,7 +285,9 @@ func TestSendSubmitUpsertOperationFail(t *testing.T) { mdi.On("UpsertOperation", pm.ctx, mock.Anything, false).Return(fmt.Errorf("pop")) err := pm.sendAndSubmitBatch(pm.ctx, &fftypes.Batch{ - Author: "org1", + Identity: fftypes.Identity{ + Author: "org1", + }, Payload: fftypes.BatchPayload{ TX: fftypes.TransactionRef{ ID: fftypes.NewUUID(), @@ -270,11 +308,16 @@ func TestSendSubmitBlobTransferFail(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetBlobMatchingHash", pm.ctx, mock.Anything).Return(nil, fmt.Errorf("pop")) err := pm.sendAndSubmitBatch(pm.ctx, &fftypes.Batch{ - Author: "org1", + Identity: fftypes.Identity{ + Author: "org1", + }, Payload: fftypes.BatchPayload{ Data: []*fftypes.Data{ {ID: fftypes.NewUUID(), Blob: &fftypes.BlobRef{Hash: fftypes.NewRandB32()}}, @@ -302,7 +345,10 @@ func TestWriteTransactionSubmitBatchPinFail(t *testing.T) { mbp := pm.batchpin.(*batchpinmocks.Submitter) mbp.On("SubmitPinnedBatch", pm.ctx, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - err := pm.writeTransaction(pm.ctx, &fftypes.Batch{Author: "org1"}, []*fftypes.Bytes32{}) + err := pm.writeTransaction(pm.ctx, &fftypes.Batch{ + Identity: fftypes.Identity{ + Author: "org1", + }}, []*fftypes.Bytes32{}) assert.Regexp(t, "pop", err) } @@ -385,6 +431,9 @@ func TestRequestReplySuccess(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Return(nil) + msa := pm.syncasync.(*syncasyncmocks.Bridge) msa.On("RequestReply", pm.ctx, "ns1", mock.Anything). Run(func(args mock.Arguments) { @@ -399,9 +448,11 @@ func TestRequestReplySuccess(t *testing.T) { _, err := pm.RequestReply(pm.ctx, "ns1", &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ - Tag: "mytag", - Group: fftypes.NewRandB32(), - Author: "org1", + Tag: "mytag", + Group: fftypes.NewRandB32(), + Identity: fftypes.Identity{ + Author: "org1", + }, }, }, }) diff --git a/internal/privatemessaging/recipients.go b/internal/privatemessaging/recipients.go index 3cb7288225..722fc5be94 100644 --- a/internal/privatemessaging/recipients.go +++ b/internal/privatemessaging/recipients.go @@ -26,7 +26,7 @@ import ( "github.com/hyperledger-labs/firefly/pkg/fftypes" ) -func (pm *privateMessaging) resolveReceipientList(ctx context.Context, sender *fftypes.Identity, in *fftypes.MessageInOut) error { +func (pm *privateMessaging) resolveReceipientList(ctx context.Context, in *fftypes.MessageInOut) error { if in.Header.Group != nil { log.L(ctx).Debugf("Group '%s' specified for message", in.Header.Group) return nil // validity of existing group checked later @@ -43,7 +43,7 @@ func (pm *privateMessaging) resolveReceipientList(ctx context.Context, sender *f // If the group is new, we need to do a group initialization, before we send the message itself. if isNew { - return pm.groupManager.groupInit(ctx, sender, group) + return pm.groupManager.groupInit(ctx, &in.Header.Identity, group) } return err } @@ -105,6 +105,12 @@ func (pm *privateMessaging) resolveNode(ctx context.Context, org *fftypes.Organi } func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.MessageInOut) (gi *fftypes.GroupIdentity, err error) { + + localOrgDID, err := pm.identity.ResolveLocalOrgDID(ctx) + if err != nil { + return nil, err + } + foundLocal := false gi = &fftypes.GroupIdentity{ Namespace: in.Message.Header.Namespace, @@ -123,7 +129,7 @@ func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.Mess if err != nil { return nil, err } - foundLocal = foundLocal || (node.Owner == pm.localOrgIdentity && node.Name == pm.localNodeName) + foundLocal = foundLocal || (node.Owner == localOrgDID && node.Name == pm.localNodeName) gi.Members[i] = &fftypes.Member{ Identity: org.Identity, Node: node.ID, @@ -131,25 +137,25 @@ func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.Mess } if !foundLocal { // Add in the local org identity - localNodeID, err := pm.resolveLocalNode(ctx) + localNodeID, err := pm.resolveLocalNode(ctx, localOrgDID) if err != nil { return nil, err } gi.Members = append(gi.Members, &fftypes.Member{ - Identity: pm.localOrgIdentity, + Identity: localOrgDID, Node: localNodeID, }) } return gi, nil } -func (pm *privateMessaging) resolveLocalNode(ctx context.Context) (*fftypes.UUID, error) { +func (pm *privateMessaging) resolveLocalNode(ctx context.Context, localOrgDID string) (*fftypes.UUID, error) { if pm.localNodeID != nil { return pm.localNodeID, nil } fb := database.NodeQueryFactory.NewFilterLimit(ctx, 1) filter := fb.And( - fb.Eq("owner", pm.localOrgIdentity), + fb.Eq("owner", localOrgDID), fb.Eq("name", pm.localNodeName), ) nodes, _, err := pm.database.GetNodes(ctx, filter) diff --git a/internal/privatemessaging/recipients_test.go b/internal/privatemessaging/recipients_test.go index 1f178a94d6..cbad82ceae 100644 --- a/internal/privatemessaging/recipients_test.go +++ b/internal/privatemessaging/recipients_test.go @@ -22,6 +22,7 @@ import ( "testing" "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -42,6 +43,8 @@ func TestResolveMemberListNewGroupE2E(t *testing.T) { mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: nodeIDLocal, Name: "node1", Owner: "localorg"}}, nil, nil).Once() mdi.On("GetGroups", pm.ctx, mock.Anything).Return([]*fftypes.Group{}, nil, nil) mdi.On("UpsertGroup", pm.ctx, mock.Anything, true).Return(nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) ud := mdi.On("UpsertData", pm.ctx, mock.Anything, true, false).Return(nil) ud.RunFn = func(a mock.Arguments) { data := a[1].(*fftypes.Data) @@ -68,10 +71,13 @@ func TestResolveMemberListNewGroupE2E(t *testing.T) { assert.Equal(t, *dataID, *msg.Data[0].ID) } - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", + Identity: fftypes.Identity{ + Author: "org1", + }, }, }, Group: &fftypes.InputGroup{ @@ -96,8 +102,17 @@ func TestResolveMemberListExistingGroup(t *testing.T) { mdi.On("GetGroups", pm.ctx, mock.Anything).Return([]*fftypes.Group{ {Hash: fftypes.NewRandB32()}, }, nil, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ {Identity: "org1"}, @@ -118,8 +133,17 @@ func TestResolveMemberListGetGroupsFail(t *testing.T) { mdi.On("GetOrganizationByName", pm.ctx, "org1").Return(&fftypes.Organization{ID: fftypes.NewUUID()}, nil) mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: fftypes.NewUUID(), Name: "node1", Owner: "localorg"}}, nil, nil) mdi.On("GetGroups", pm.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ {Identity: "org1"}, @@ -131,6 +155,32 @@ func TestResolveMemberListGetGroupsFail(t *testing.T) { } +func TestResolveMemberListLocalOrgUnregistered(t *testing.T) { + + pm, cancel := newTestPrivateMessaging(t) + defer cancel() + + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("", fmt.Errorf("pop")) + + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, + Group: &fftypes.InputGroup{ + Members: []fftypes.MemberInput{ + {Identity: "org1"}, + }, + }, + }) + assert.EqualError(t, err, "pop") + +} + func TestResolveMemberListMissingLocalMemberLookupFailed(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) @@ -140,8 +190,17 @@ func TestResolveMemberListMissingLocalMemberLookupFailed(t *testing.T) { mdi.On("GetOrganizationByName", pm.ctx, "org1").Return(&fftypes.Organization{ID: fftypes.NewUUID()}, nil) mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: fftypes.NewUUID(), Name: "node2", Owner: "org1"}}, nil, nil).Once() mdi.On("GetNodes", pm.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")).Once() + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ {Identity: "org1"}, @@ -161,8 +220,17 @@ func TestResolveMemberListNodeNotFound(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByName", pm.ctx, "org1").Return(&fftypes.Organization{ID: fftypes.NewUUID()}, nil) mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{}, nil, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ {Identity: "org1"}, @@ -182,8 +250,17 @@ func TestResolveMemberOrgNameNotFound(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByName", pm.ctx, "org1").Return(nil, nil) mdi.On("GetOrganizationByIdentity", pm.ctx, "org1").Return(nil, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ {Identity: "org1"}, @@ -207,8 +284,17 @@ func TestResolveMemberNodeOwnedParentOrg(t *testing.T) { mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{}, nil, nil).Once() mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: fftypes.NewUUID(), Name: "node1", Owner: "localorg"}}, nil, nil) mdi.On("GetGroups", pm.ctx, mock.Anything).Return([]*fftypes.Group{{Hash: fftypes.NewRandB32()}}, nil, nil) + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{Identifier: "0x12345"}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ {Identity: "org1"}, @@ -278,7 +364,7 @@ func TestResolveReceipientListExisting(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{}, &fftypes.MessageInOut{ + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ Group: fftypes.NewRandB32(), @@ -292,7 +378,7 @@ func TestResolveReceipientListEmptyList(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) defer cancel() - err := pm.resolveReceipientList(pm.ctx, &fftypes.Identity{}, &fftypes.MessageInOut{}) + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{}) assert.Regexp(t, "FF10219", err) } @@ -302,7 +388,7 @@ func TestResolveLocalNodeCached(t *testing.T) { pm.localNodeID = fftypes.NewUUID() - ni, err := pm.resolveLocalNode(pm.ctx) + ni, err := pm.resolveLocalNode(pm.ctx, "localorg") assert.NoError(t, err) assert.Equal(t, pm.localNodeID, ni) } @@ -314,7 +400,7 @@ func TestResolveLocalNodeNotFound(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{}, nil, nil) - _, err := pm.resolveLocalNode(pm.ctx) + _, err := pm.resolveLocalNode(pm.ctx, "localorg") assert.Regexp(t, "FF10225", err) } @@ -325,6 +411,6 @@ func TestResolveLocalNodeNotError(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) mdi.On("GetNodes", pm.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")) - _, err := pm.resolveLocalNode(pm.ctx) + _, err := pm.resolveLocalNode(pm.ctx, "localorg") assert.EqualError(t, err, "pop") } diff --git a/internal/syshandlers/syshandler.go b/internal/syshandlers/syshandler.go index 45eb0b426b..4a41ad8d19 100644 --- a/internal/syshandlers/syshandler.go +++ b/internal/syshandlers/syshandler.go @@ -27,7 +27,6 @@ import ( "github.com/hyperledger-labs/firefly/pkg/database" "github.com/hyperledger-labs/firefly/pkg/dataexchange" "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" ) // SystemHandlers interface allows components to call broadcast/private messaging functions internally (without import cycles) @@ -40,17 +39,15 @@ type SystemHandlers interface { type systemHandlers struct { database database.Plugin - identity identity.Plugin exchange dataexchange.Plugin data data.Manager broadcast broadcast.Manager messaging privatemessaging.Manager } -func NewSystemHandlers(di database.Plugin, ii identity.Plugin, dx dataexchange.Plugin, dm data.Manager, bm broadcast.Manager, pm privatemessaging.Manager) SystemHandlers { +func NewSystemHandlers(di database.Plugin, dx dataexchange.Plugin, dm data.Manager, bm broadcast.Manager, pm privatemessaging.Manager) SystemHandlers { return &systemHandlers{ database: di, - identity: ii, exchange: dx, data: dm, broadcast: bm, diff --git a/internal/syshandlers/syshandler_network_node.go b/internal/syshandlers/syshandler_network_node.go index 5e878f5c7f..aec069f7ab 100644 --- a/internal/syshandlers/syshandler_network_node.go +++ b/internal/syshandlers/syshandler_network_node.go @@ -46,14 +46,8 @@ func (sh *systemHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes. return false, nil } - id, err := sh.identity.Resolve(ctx, node.Owner) - if err != nil { - l.Warnf("Unable to process node broadcast %s - resolve owner identity failed: %s", msg.Header.ID, err) - return false, nil - } - - if msg.Header.Author != id.OnChain { - l.Warnf("Unable to process node broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, id.OnChain, msg.Header.Author) + if msg.Header.Author != node.Owner { + l.Warnf("Unable to process node broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, node.Owner, msg.Header.Author) return false, nil } diff --git a/internal/syshandlers/syshandler_network_node_test.go b/internal/syshandlers/syshandler_network_node_test.go index d66271e3a2..ea99f3b82f 100644 --- a/internal/syshandlers/syshandler_network_node_test.go +++ b/internal/syshandlers/syshandler_network_node_test.go @@ -24,7 +24,6 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -49,8 +48,6 @@ func TestHandleSystemBroadcastNodeOk(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(nil, nil) @@ -61,14 +58,16 @@ func TestHandleSystemBroadcastNodeOk(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.True(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -91,8 +90,6 @@ func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(nil, nil) @@ -108,7 +105,6 @@ func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { assert.False(t, valid) assert.EqualError(t, err, "pop") - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -131,8 +127,6 @@ func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(nil, nil) @@ -150,7 +144,6 @@ func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { assert.False(t, valid) assert.EqualError(t, err, "pop") - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -173,8 +166,6 @@ func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(&fftypes.Node{Owner: "0x99999"}, nil) @@ -188,7 +179,6 @@ func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { assert.False(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -211,8 +201,6 @@ func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(&fftypes.Node{Owner: "0x23456"}, nil) @@ -229,7 +217,6 @@ func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { assert.True(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -252,8 +239,6 @@ func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(nil, fmt.Errorf("pop")) @@ -267,7 +252,6 @@ func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { assert.False(t, valid) assert.EqualError(t, err, "pop") - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -290,8 +274,6 @@ func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ @@ -304,7 +286,6 @@ func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { assert.False(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -327,8 +308,6 @@ func TestHandleSystemBroadcastNodeResolveFail(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(nil, fmt.Errorf("pop")) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ @@ -341,7 +320,6 @@ func TestHandleSystemBroadcastNodeResolveFail(t *testing.T) { assert.False(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } diff --git a/internal/syshandlers/syshandler_network_org.go b/internal/syshandlers/syshandler_network_org.go index bfdcddd6cc..ec4758dfaf 100644 --- a/internal/syshandlers/syshandler_network_org.go +++ b/internal/syshandlers/syshandler_network_org.go @@ -50,14 +50,8 @@ func (sh *systemHandlers) handleOrganizationBroadcast(ctx context.Context, msg * } } - id, err := sh.identity.Resolve(ctx, signingIdentity) - if err != nil { - l.Warnf("Unable to process organization broadcast %s - resolve identity failed: %s", msg.Header.ID, err) - return false, nil - } - - if msg.Header.Author != id.OnChain { - l.Warnf("Unable to process organization broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, id.OnChain, msg.Header.Author) + if msg.Header.Author != signingIdentity { + l.Warnf("Unable to process organization broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, signingIdentity, msg.Header.Author) return false, nil } diff --git a/mocks/broadcastmocks/manager.go b/mocks/broadcastmocks/manager.go index 9147e5453b..c76faf903a 100644 --- a/mocks/broadcastmocks/manager.go +++ b/mocks/broadcastmocks/manager.go @@ -60,6 +60,29 @@ func (_m *Manager) BroadcastDefinition(ctx context.Context, def fftypes.Definiti return r0, r1 } +// BroadcastDefinitionAsNode provides a mock function with given fields: ctx, def, tag, waitConfirm +func (_m *Manager) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (*fftypes.Message, error) { + ret := _m.Called(ctx, def, tag, waitConfirm) + + var r0 *fftypes.Message + if rf, ok := ret.Get(0).(func(context.Context, fftypes.Definition, fftypes.SystemTag, bool) *fftypes.Message); ok { + r0 = rf(ctx, def, tag, waitConfirm) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*fftypes.Message) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, fftypes.Definition, fftypes.SystemTag, bool) error); ok { + r1 = rf(ctx, def, tag, waitConfirm) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // BroadcastMessage provides a mock function with given fields: ctx, ns, in, waitConfirm func (_m *Manager) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (*fftypes.Message, error) { ret := _m.Called(ctx, ns, in, waitConfirm) @@ -129,29 +152,6 @@ func (_m *Manager) BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace return r0, r1 } -// GetNodeSigningIdentity provides a mock function with given fields: ctx -func (_m *Manager) GetNodeSigningIdentity(ctx context.Context) (*fftypes.Identity, error) { - ret := _m.Called(ctx) - - var r0 *fftypes.Identity - if rf, ok := ret.Get(0).(func(context.Context) *fftypes.Identity); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*fftypes.Identity) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // Start provides a mock function with given fields: func (_m *Manager) Start() error { ret := _m.Called() diff --git a/mocks/identitymanagermocks/manager.go b/mocks/identitymanagermocks/manager.go index 4645dfb05c..195d32fcd2 100644 --- a/mocks/identitymanagermocks/manager.go +++ b/mocks/identitymanagermocks/manager.go @@ -28,3 +28,45 @@ func (_m *Manager) ResolveInputIdentity(ctx context.Context, _a1 *fftypes.Identi return r0 } + +// ResolveLocalOrgDID provides a mock function with given fields: ctx +func (_m *Manager) ResolveLocalOrgDID(ctx context.Context) (string, error) { + ret := _m.Called(ctx) + + var r0 string + if rf, ok := ret.Get(0).(func(context.Context) string); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(string) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ResolveSigningKeyIdentity provides a mock function with given fields: ctx, signingKey +func (_m *Manager) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (string, error) { + ret := _m.Called(ctx, signingKey) + + var r0 string + if rf, ok := ret.Get(0).(func(context.Context, string) string); ok { + r0 = rf(ctx, signingKey) + } else { + r0 = ret.Get(0).(string) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, signingKey) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/mocks/syscoremocks/system_core.go b/mocks/syscoremocks/system_core.go deleted file mode 100644 index 664fc79afc..0000000000 --- a/mocks/syscoremocks/system_core.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package syscoremocks - -import ( - context "context" - - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" - mock "github.com/stretchr/testify/mock" - - system "github.com/hyperledger-labs/firefly/internal/events/system" -) - -// SystemCore is an autogenerated mock type for the SystemCore type -type SystemCore struct { - mock.Mock -} - -// AddSystemEventListener provides a mock function with given fields: ns, el -func (_m *SystemCore) AddSystemEventListener(ns string, el system.EventListener) error { - ret := _m.Called(ns, el) - - var r0 error - if rf, ok := ret.Get(0).(func(string, system.EventListener) error); ok { - r0 = rf(ns, el) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ResolveSigningIdentity provides a mock function with given fields: ctx, suppliedIdentity -func (_m *SystemCore) ResolveSigningIdentity(ctx context.Context, suppliedIdentity string) (*fftypes.Identity, error) { - ret := _m.Called(ctx, suppliedIdentity) - - var r0 *fftypes.Identity - if rf, ok := ret.Get(0).(func(context.Context, string) *fftypes.Identity); ok { - r0 = rf(ctx, suppliedIdentity) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*fftypes.Identity) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, suppliedIdentity) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/mocks/tokenmocks/plugin.go b/mocks/tokenmocks/plugin.go index fdd299c65c..73cf9d4ebf 100644 --- a/mocks/tokenmocks/plugin.go +++ b/mocks/tokenmocks/plugin.go @@ -35,13 +35,13 @@ func (_m *Plugin) Capabilities() *tokens.Capabilities { return r0 } -// CreateTokenPool provides a mock function with given fields: ctx, identity, pool -func (_m *Plugin) CreateTokenPool(ctx context.Context, identity *fftypes.Identity, pool *fftypes.TokenPool) error { - ret := _m.Called(ctx, identity, pool) +// CreateTokenPool provides a mock function with given fields: ctx, signingKey, pool +func (_m *Plugin) CreateTokenPool(ctx context.Context, signingKey string, pool *fftypes.TokenPool) error { + ret := _m.Called(ctx, signingKey, pool) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Identity, *fftypes.TokenPool) error); ok { - r0 = rf(ctx, identity, pool) + if rf, ok := ret.Get(0).(func(context.Context, string, *fftypes.TokenPool) error); ok { + r0 = rf(ctx, signingKey, pool) } else { r0 = ret.Error(0) } diff --git a/pkg/database/plugin.go b/pkg/database/plugin.go index 69d2511c32..8ef2743738 100644 --- a/pkg/database/plugin.go +++ b/pkg/database/plugin.go @@ -547,6 +547,7 @@ var MessageQueryFactory = &queryFields{ "namespace": &StringField{}, "type": &StringField{}, "author": &StringField{}, + "key": &StringField{}, "topics": &FFNameArrayField{}, "tag": &StringField{}, "group": &Bytes32Field{}, @@ -568,6 +569,7 @@ var BatchQueryFactory = &queryFields{ "namespace": &StringField{}, "type": &StringField{}, "author": &StringField{}, + "key": &StringField{}, "group": &Bytes32Field{}, "hash": &Bytes32Field{}, "payloadref": &StringField{}, @@ -743,6 +745,8 @@ var TokenPoolQueryFactory = &queryFields{ "namespace": &StringField{}, "name": &StringField{}, "protocolid": &StringField{}, + "author": &StringField{}, + "key": &StringField{}, } // TokenAccountQueryFactory filter fields for token accounts diff --git a/pkg/fftypes/batch.go b/pkg/fftypes/batch.go index 799314c3ca..2da07fa93b 100644 --- a/pkg/fftypes/batch.go +++ b/pkg/fftypes/batch.go @@ -26,10 +26,10 @@ import ( ) type Batch struct { - ID *UUID `json:"id"` - Namespace string `json:"namespace"` - Type MessageType `json:"type"` - Author string `json:"author"` + ID *UUID `json:"id"` + Namespace string `json:"namespace"` + Type MessageType `json:"type"` + Identity Group *Bytes32 `jdon:"group,omitempty"` Hash *Bytes32 `json:"hash"` Created *FFTime `json:"created"` diff --git a/pkg/fftypes/identity.go b/pkg/fftypes/identity.go index ffbc791d43..f5f8e1fe38 100644 --- a/pkg/fftypes/identity.go +++ b/pkg/fftypes/identity.go @@ -19,6 +19,6 @@ package fftypes // Identity is the nested structure representing an identity, that might comprise a resolvable // by FireFly identity DID, a blockchain signing key, or both. type Identity struct { - Author string `json:"author"` - Key string `json:"key"` + Author string `json:"author,omitempty"` + Key string `json:"key,omitempty"` } diff --git a/pkg/fftypes/message.go b/pkg/fftypes/message.go index b9d75bda4c..44b3c37a92 100644 --- a/pkg/fftypes/message.go +++ b/pkg/fftypes/message.go @@ -46,17 +46,17 @@ var ( // MessageHeader contains all fields that contribute to the hash // The order of the serialization mut not change, once released type MessageHeader struct { - ID *UUID `json:"id,omitempty"` - CID *UUID `json:"cid,omitempty"` - Type MessageType `json:"type" ffenum:"messagetype"` - TxType TransactionType `json:"txtype,omitempty"` - Author string `json:"author,omitempty"` - Created *FFTime `json:"created,omitempty"` - Namespace string `json:"namespace,omitempty"` - Group *Bytes32 `json:"group,omitempty"` - Topics FFNameArray `json:"topics,omitempty"` - Tag string `json:"tag,omitempty"` - DataHash *Bytes32 `json:"datahash,omitempty"` + ID *UUID `json:"id,omitempty"` + CID *UUID `json:"cid,omitempty"` + Type MessageType `json:"type" ffenum:"messagetype"` + TxType TransactionType `json:"txtype,omitempty"` + Identity + Created *FFTime `json:"created,omitempty"` + Namespace string `json:"namespace,omitempty"` + Group *Bytes32 `json:"group,omitempty"` + Topics FFNameArray `json:"topics,omitempty"` + Tag string `json:"tag,omitempty"` + DataHash *Bytes32 `json:"datahash,omitempty"` } // Message is the envelope by which coordinated data exchange can happen between parties in the network diff --git a/pkg/fftypes/message_test.go b/pkg/fftypes/message_test.go index 8253225891..fb1aac6b92 100644 --- a/pkg/fftypes/message_test.go +++ b/pkg/fftypes/message_test.go @@ -133,11 +133,13 @@ func TestSealKnownMessage(t *testing.T) { hash3.UnmarshalText([]byte("284b535da66aa0734af56c708426d756331baec3bce3079e508003bcf4738ee6")) msg := Message{ Header: MessageHeader{ - ID: msgid, - CID: cid, - Type: MessageTypePrivate, - TxType: TransactionTypeBatchPin, - Author: "0x12345", + ID: msgid, + CID: cid, + Type: MessageTypePrivate, + TxType: TransactionTypeBatchPin, + Identity: Identity{ + Author: "0x12345", + }, Namespace: "ns1", Topics: []string{"topic1", "topic2"}, Tag: "tag1", diff --git a/pkg/fftypes/tokenpool.go b/pkg/fftypes/tokenpool.go index 28d547249e..3922e70d2e 100644 --- a/pkg/fftypes/tokenpool.go +++ b/pkg/fftypes/tokenpool.go @@ -24,11 +24,11 @@ var ( ) type TokenPool struct { - ID *UUID `json:"id,omitempty"` - Type TokenType `json:"type" ffenum:"tokentype"` - Namespace string `json:"namespace,omitempty"` - Name string `json:"name,omitempty"` - ProtocolID string `json:"protocolId,omitempty"` - Author string `json:"author,omitempty"` - TX TransactionRef `json:"tx,omitempty"` + ID *UUID `json:"id,omitempty"` + Type TokenType `json:"type" ffenum:"tokentype"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + ProtocolID string `json:"protocolId,omitempty"` + Identity + TX TransactionRef `json:"tx,omitempty"` } diff --git a/pkg/tokens/plugin.go b/pkg/tokens/plugin.go index c76f28a11f..a6b14ebd90 100644 --- a/pkg/tokens/plugin.go +++ b/pkg/tokens/plugin.go @@ -42,7 +42,7 @@ type Plugin interface { // CreateTokenPool creates a new (fungible or non-fungible) pool of tokens // The returned tracking ID will be used to correlate with any subsequent transaction tracking updates - CreateTokenPool(ctx context.Context, identity *fftypes.Identity, pool *fftypes.TokenPool) error + CreateTokenPool(ctx context.Context, signingKey string, pool *fftypes.TokenPool) error } // Callbacks is the interface provided to the tokens plugin, to allow it to pass events back to firefly. From 89864e72f379e8da74e9d3977627b9b5ed868167 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Wed, 15 Sep 2021 17:01:37 -0400 Subject: [PATCH 03/15] Resolve identity on broadcast send Signed-off-by: Peter Broadhurst --- internal/broadcast/datatype_test.go | 11 +++++ internal/broadcast/definition_test.go | 2 + internal/broadcast/manager_test.go | 6 --- internal/broadcast/message.go | 9 ++-- internal/broadcast/message_test.go | 44 +++++++++++++++---- internal/broadcast/namespace_test.go | 3 ++ internal/orchestrator/orchestrator_test.go | 8 ---- .../syshandler_network_node_test.go | 6 ++- pkg/blockchain/plugin.go | 2 +- 9 files changed, 61 insertions(+), 30 deletions(-) diff --git a/internal/broadcast/datatype_test.go b/internal/broadcast/datatype_test.go index a9cfe3ba8a..ef22e44be1 100644 --- a/internal/broadcast/datatype_test.go +++ b/internal/broadcast/datatype_test.go @@ -23,6 +23,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -57,6 +58,8 @@ func TestBroadcastDatatypeBadValue(t *testing.T) { mdm := bm.data.(*datamocks.Manager) mdm.On("VerifyNamespaceExists", mock.Anything, "ns1").Return(nil) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) _, err := bm.BroadcastDatatype(context.Background(), "ns1", &fftypes.Datatype{ Namespace: "ns1", Name: "ent1", @@ -71,7 +74,9 @@ func TestBroadcastUpsertFail(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(fmt.Errorf("pop")) mdm.On("VerifyNamespaceExists", mock.Anything, "ns1").Return(nil) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) @@ -90,7 +95,9 @@ func TestBroadcastDatatypeInvalid(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(nil) mdm.On("VerifyNamespaceExists", mock.Anything, "ns1").Return(nil) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(fmt.Errorf("pop")) @@ -109,7 +116,9 @@ func TestBroadcastBroadcastFail(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(nil) mdm.On("VerifyNamespaceExists", mock.Anything, "ns1").Return(nil) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) @@ -129,7 +138,9 @@ func TestBroadcastOk(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(nil) mdm.On("VerifyNamespaceExists", mock.Anything, "ns1").Return(nil) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) diff --git a/internal/broadcast/definition_test.go b/internal/broadcast/definition_test.go index 4e29e3f2d2..59e1b1e260 100644 --- a/internal/broadcast/definition_test.go +++ b/internal/broadcast/definition_test.go @@ -33,6 +33,8 @@ func TestBroadcastDefinitionAsNodeUpsertFail(t *testing.T) { mdi := bm.database.(*databasemocks.Plugin) mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(fmt.Errorf("pop")) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) _, err := bm.BroadcastDefinitionAsNode(bm.ctx, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, false) assert.Regexp(t, "pop", err) } diff --git a/internal/broadcast/manager_test.go b/internal/broadcast/manager_test.go index 8bd658e6eb..c27ccc78ef 100644 --- a/internal/broadcast/manager_test.go +++ b/internal/broadcast/manager_test.go @@ -38,7 +38,6 @@ import ( func newTestBroadcast(t *testing.T) (*broadcastManager, func()) { config.Reset() - config.Set(config.OrgIdentity, "UTNodeID") mdi := &databasemocks.Plugin{} mim := &identitymanagermocks.Manager{} mdm := &datamocks.Manager{} @@ -49,9 +48,6 @@ func newTestBroadcast(t *testing.T) (*broadcastManager, func()) { msa := &syncasyncmocks.Bridge{} mbp := &batchpinmocks.Submitter{} mbi.On("Name").Return("ut_blockchain").Maybe() - mim.On("ResolveInputIdentity", mock.Anything, mock.MatchedBy(func(identity *fftypes.Identity) bool { - return identity.Author == "" && identity.Key == "" - })).Return(nil).Maybe() mba.On("RegisterDispatcher", []fftypes.MessageType{fftypes.MessageTypeBroadcast, fftypes.MessageTypeDefinition}, mock.Anything, mock.Anything).Return() ctx, cancel := context.WithCancel(context.Background()) b, err := NewBroadcastManager(ctx, mdi, mim, mdm, mbi, mdx, mpi, mba, msa, mbp) @@ -138,11 +134,9 @@ func TestDispatchBatchSubmitBroadcastFail(t *testing.T) { mdi := bm.database.(*databasemocks.Plugin) mps := bm.publicstorage.(*publicstoragemocks.Plugin) - mbi := bm.blockchain.(*blockchainmocks.Plugin) mbp := bm.batchpin.(*batchpinmocks.Submitter) mdi.On("RunAsGroup", mock.Anything, mock.Anything).Return(nil) mps.On("PublishData", mock.Anything, mock.Anything).Return("id1", nil) - mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything).Return(nil) mps.On("Name").Return("ut_publicstorage") err := bm.dispatchBatch(context.Background(), &fftypes.Batch{Identity: fftypes.Identity{Author: "wrong", Key: "wrong"}}, []*fftypes.Bytes32{fftypes.NewRandB32()}) diff --git a/internal/broadcast/message.go b/internal/broadcast/message.go index a0e3ce2fec..ef747e5011 100644 --- a/internal/broadcast/message.go +++ b/internal/broadcast/message.go @@ -19,7 +19,6 @@ package broadcast import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/i18n" "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/pkg/database" @@ -37,13 +36,15 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin resolved.Header.ID = id resolved.Header.Namespace = ns resolved.Header.Type = fftypes.MessageTypeBroadcast - if resolved.Header.Author == "" { - resolved.Header.Author = config.GetString(config.OrgIdentity) - } if resolved.Header.TxType == "" { resolved.Header.TxType = fftypes.TransactionTypeBatchPin } + // Resolve the sending identity + if err := bm.identity.ResolveInputIdentity(ctx, &resolved.Header.Identity); err != nil { + return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) + } + // We optimize the DB storage of all the parts of the message using transaction semantics (assuming those are supported by the DB plugin var dataToPublish []*fftypes.DataAndBlob err = bm.database.RunAsGroup(ctx, func(ctx context.Context) error { diff --git a/internal/broadcast/message_test.go b/internal/broadcast/message_test.go index 1819dcc4c3..c10d1b6692 100644 --- a/internal/broadcast/message_test.go +++ b/internal/broadcast/message_test.go @@ -25,10 +25,10 @@ import ( "testing" "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" @@ -41,7 +41,7 @@ func TestBroadcastMessageOk(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) - mbi := bm.blockchain.(*blockchainmocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) ctx := context.Background() rag := mdi.On("RunAsGroup", ctx, mock.Anything) @@ -49,11 +49,11 @@ func TestBroadcastMessageOk(t *testing.T) { var fn = a[1].(func(context.Context) error) rag.ReturnArguments = mock.Arguments{fn(a[0].(context.Context))} } - mbi.On("VerifyIdentitySyntax", ctx, "0x12345").Return("0x12345", nil) mdm.On("ResolveInlineDataBroadcast", ctx, "ns1", mock.Anything).Return(fftypes.DataRefs{ {ID: fftypes.NewUUID(), Hash: fftypes.NewRandB32()}, }, []*fftypes.DataAndBlob{}, nil) mdi.On("InsertMessageLocal", ctx, mock.Anything).Return(nil) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) msg, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -82,8 +82,8 @@ func TestBroadcastMessageWaitConfirmOk(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) - mbi := bm.blockchain.(*blockchainmocks.Plugin) msa := bm.syncasync.(*syncasyncmocks.Bridge) + mim := bm.identity.(*identitymanagermocks.Manager) ctx := context.Background() rag := mdi.On("RunAsGroup", ctx, mock.Anything) @@ -91,10 +91,10 @@ func TestBroadcastMessageWaitConfirmOk(t *testing.T) { var fn = a[1].(func(context.Context) error) rag.ReturnArguments = mock.Arguments{fn(a[0].(context.Context))} } - mbi.On("VerifyIdentitySyntax", ctx, "0x12345").Return("0x12345", nil) mdm.On("ResolveInlineDataBroadcast", ctx, "ns1", mock.Anything).Return(fftypes.DataRefs{ {ID: fftypes.NewUUID(), Hash: fftypes.NewRandB32()}, }, []*fftypes.DataAndBlob{}, nil) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) requestID := fftypes.NewUUID() replyMsg := &fftypes.Message{ @@ -139,9 +139,9 @@ func TestBroadcastMessageWithBlobsOk(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) - mbi := bm.blockchain.(*blockchainmocks.Plugin) mdx := bm.exchange.(*dataexchangemocks.Plugin) mps := bm.publicstorage.(*publicstoragemocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) blobHash := fftypes.NewRandB32() dataID := fftypes.NewUUID() @@ -152,7 +152,6 @@ func TestBroadcastMessageWithBlobsOk(t *testing.T) { var fn = a[1].(func(context.Context) error) rag.ReturnArguments = mock.Arguments{fn(a[0].(context.Context))} } - mbi.On("VerifyIdentitySyntax", ctx, "0x12345").Return("0x12345", nil) mdm.On("ResolveInlineDataBroadcast", ctx, "ns1", mock.Anything).Return(fftypes.DataRefs{ {ID: dataID, Hash: fftypes.NewRandB32()}, }, []*fftypes.DataAndBlob{ @@ -178,6 +177,7 @@ func TestBroadcastMessageWithBlobsOk(t *testing.T) { })).Return("payload-ref", nil) mdi.On("UpdateData", ctx, mock.Anything, mock.Anything).Return(nil) mdi.On("InsertMessageLocal", ctx, mock.Anything).Return(nil) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) msg, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -208,16 +208,16 @@ func TestBroadcastMessageBadInput(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) - mbi := bm.blockchain.(*blockchainmocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) ctx := context.Background() - mbi.On("VerifyIdentitySyntax", ctx, mock.Anything).Return("0x12345", nil) rag := mdi.On("RunAsGroup", ctx, mock.Anything) rag.RunFn = func(a mock.Arguments) { var fn = a[1].(func(context.Context) error) rag.ReturnArguments = mock.Arguments{fn(a[0].(context.Context))} } mdm.On("ResolveInlineDataBroadcast", ctx, "ns1", mock.Anything).Return(nil, nil, fmt.Errorf("pop")) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) _, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ InlineData: fftypes.InlineData{ @@ -230,12 +230,31 @@ func TestBroadcastMessageBadInput(t *testing.T) { mdm.AssertExpectations(t) } +func TestBroadcastMessageBadIdentity(t *testing.T) { + bm, cancel := newTestBroadcast(t) + defer cancel() + + ctx := context.Background() + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(fmt.Errorf("pop")) + + _, err := bm.BroadcastMessage(ctx, "ns1", &fftypes.MessageInOut{ + InlineData: fftypes.InlineData{ + {Value: fftypes.Byteable(`{"hello": "world"}`)}, + }, + }, false) + assert.Regexp(t, "FF10206", err) + + mim.AssertExpectations(t) +} + func TestPublishBlobsSendMessageFail(t *testing.T) { bm, cancel := newTestBroadcast(t) defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdx := bm.exchange.(*dataexchangemocks.Plugin) mps := bm.publicstorage.(*publicstoragemocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) blobHash := fftypes.NewRandB32() dataID := fftypes.NewUUID() @@ -250,6 +269,7 @@ func TestPublishBlobsSendMessageFail(t *testing.T) { })).Return("payload-ref", nil) mdi.On("UpdateData", ctx, mock.Anything, mock.Anything).Return(nil) mdi.On("InsertMessageLocal", ctx, mock.Anything).Return(fmt.Errorf("pop")) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) _, err := bm.publishBlobsAndSend(ctx, &fftypes.Message{}, []*fftypes.DataAndBlob{ { @@ -276,6 +296,7 @@ func TestPublishBlobsUpdateDataFail(t *testing.T) { mdi := bm.database.(*databasemocks.Plugin) mdx := bm.exchange.(*dataexchangemocks.Plugin) mps := bm.publicstorage.(*publicstoragemocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) blobHash := fftypes.NewRandB32() dataID := fftypes.NewUUID() @@ -289,6 +310,7 @@ func TestPublishBlobsUpdateDataFail(t *testing.T) { return true })).Return("payload-ref", nil) mdi.On("UpdateData", ctx, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) _, err := bm.publishBlobsAndSend(ctx, &fftypes.Message{}, []*fftypes.DataAndBlob{ { @@ -315,6 +337,7 @@ func TestPublishBlobsPublishFail(t *testing.T) { mdi := bm.database.(*databasemocks.Plugin) mdx := bm.exchange.(*dataexchangemocks.Plugin) mps := bm.publicstorage.(*publicstoragemocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) blobHash := fftypes.NewRandB32() dataID := fftypes.NewUUID() @@ -327,6 +350,7 @@ func TestPublishBlobsPublishFail(t *testing.T) { assert.Equal(t, "some data", string(b)) return true })).Return("", fmt.Errorf("pop")) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) _, err := bm.publishBlobsAndSend(ctx, &fftypes.Message{}, []*fftypes.DataAndBlob{ { @@ -352,12 +376,14 @@ func TestPublishBlobsDownloadFail(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdx := bm.exchange.(*dataexchangemocks.Plugin) + mim := bm.identity.(*identitymanagermocks.Manager) blobHash := fftypes.NewRandB32() dataID := fftypes.NewUUID() ctx := context.Background() mdx.On("DownloadBLOB", ctx, "blob/1").Return(nil, fmt.Errorf("pop")) + mim.On("ResolveInputIdentity", ctx, mock.Anything).Return(nil) _, err := bm.publishBlobsAndSend(ctx, &fftypes.Message{}, []*fftypes.DataAndBlob{ { diff --git a/internal/broadcast/namespace_test.go b/internal/broadcast/namespace_test.go index 344b46167d..f640570ccc 100644 --- a/internal/broadcast/namespace_test.go +++ b/internal/broadcast/namespace_test.go @@ -23,6 +23,7 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -63,7 +64,9 @@ func TestBroadcastNamespaceBroadcastOk(t *testing.T) { defer cancel() mdi := bm.database.(*databasemocks.Plugin) mdm := bm.data.(*datamocks.Manager) + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) mdi.On("GetNamespace", mock.Anything, mock.Anything).Return(&fftypes.Namespace{Name: "ns1"}, nil) mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(nil) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go index f7d0bc8f38..51ef6dd93f 100644 --- a/internal/orchestrator/orchestrator_test.go +++ b/internal/orchestrator/orchestrator_test.go @@ -227,7 +227,6 @@ func TestBadPublicStoragePlugin(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) ctx, cancelCtx := context.WithCancel(context.Background()) err := or.Init(ctx, cancelCtx) assert.Regexp(t, "FF10134.*wrong", err) @@ -239,7 +238,6 @@ func TestBadPublicStorageInitFail(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) ctx, cancelCtx := context.WithCancel(context.Background()) err := or.Init(ctx, cancelCtx) @@ -254,7 +252,6 @@ func TestBadDataExchangePlugin(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) ctx, cancelCtx := context.WithCancel(context.Background()) err := or.Init(ctx, cancelCtx) @@ -267,7 +264,6 @@ func TestBadDataExchangeInitFail(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdx.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) ctx, cancelCtx := context.WithCancel(context.Background()) @@ -285,7 +281,6 @@ func TestBadTokensPlugin(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdx.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdi.On("GetNamespace", mock.Anything, mock.Anything).Return(nil, nil) @@ -305,7 +300,6 @@ func TestBadTokensPluginNoName(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdx.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdi.On("GetNamespace", mock.Anything, mock.Anything).Return(nil, nil) @@ -327,7 +321,6 @@ func TestGoodTokensPlugin(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdx.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdi.On("GetNamespace", mock.Anything, mock.Anything).Return(nil, nil) @@ -502,7 +495,6 @@ func TestInitOK(t *testing.T) { or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mii.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mbi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) - or.mbi.On("VerifyIdentitySyntax", mock.Anything, mock.Anything, mock.Anything).Return("", nil) or.mps.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdx.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) or.mdi.On("GetNamespace", mock.Anything, mock.Anything).Return(nil, nil) diff --git a/internal/syshandlers/syshandler_network_node_test.go b/internal/syshandlers/syshandler_network_node_test.go index ea99f3b82f..79fb34781a 100644 --- a/internal/syshandlers/syshandler_network_node_test.go +++ b/internal/syshandlers/syshandler_network_node_test.go @@ -98,8 +98,10 @@ func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) diff --git a/pkg/blockchain/plugin.go b/pkg/blockchain/plugin.go index 78add90ae3..aa410f264a 100644 --- a/pkg/blockchain/plugin.go +++ b/pkg/blockchain/plugin.go @@ -40,7 +40,7 @@ type Plugin interface { // Capabilities returns capabilities - not called until after Init Capabilities() *Capabilities - // VerifyIdentitySyntax verifies that the supplied identity string is valid syntax according to the protocol. + // ResolveSigningKey verifies that the supplied identity string is valid syntax according to the protocol. // Can apply transformations to the supplied signing identity (only), such as lower case ResolveSigningKey(ctx context.Context, signingKey string) (string, error) From 22c784712d71ea3a0d380cdfc4bfcb7ca8eab2d2 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Wed, 15 Sep 2021 22:03:43 -0400 Subject: [PATCH 04/15] Work through UTs across all components Signed-off-by: Peter Broadhurst --- docs/swagger/swagger.yaml | 83 +++++++++++++ internal/assets/manager.go | 2 +- internal/assets/manager_test.go | 3 +- .../database/sqlcommon/tokenpool_sql_test.go | 10 +- internal/events/batch_pin_complete_test.go | 10 +- internal/events/event_dispatcher_test.go | 2 +- internal/events/persist_batch.go | 6 +- internal/identity/identitymanager.go | 39 +++--- internal/networkmap/register_node.go | 15 ++- internal/networkmap/register_node_test.go | 75 ++++++------ internal/networkmap/register_org.go | 36 ++++-- internal/networkmap/register_org_test.go | 81 +++++++------ internal/orchestrator/orchestrator.go | 6 +- internal/orchestrator/orchestrator_test.go | 13 +- internal/orchestrator/status.go | 6 +- .../syshandler_network_node_test.go | 88 ++++++-------- .../syshandler_network_org_test.go | 112 +++++++----------- internal/syshandlers/syshandler_test.go | 4 +- internal/tokens/https/https.go | 2 +- internal/tokens/https/https_test.go | 4 +- mocks/identitymanagermocks/manager.go | 21 ++++ mocks/tokenmocks/plugin.go | 10 +- pkg/tokens/plugin.go | 2 +- 23 files changed, 369 insertions(+), 261 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 4588545145..503746004a 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -53,6 +53,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -331,6 +333,11 @@ paths: name: id schema: type: string + - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' + in: query + name: key + schema: + type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: namespace @@ -406,6 +413,8 @@ paths: created: {} hash: {} id: {} + key: + type: string namespace: type: string payload: @@ -460,6 +469,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -541,6 +552,8 @@ paths: created: {} hash: {} id: {} + key: + type: string namespace: type: string payload: @@ -595,6 +608,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -698,6 +713,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -813,6 +830,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -1195,6 +1214,11 @@ paths: name: id schema: type: string + - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' + in: query + name: key + schema: + type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: local @@ -1354,6 +1378,11 @@ paths: name: id schema: type: string + - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' + in: query + name: key + schema: + type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: local @@ -1463,6 +1492,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -2015,6 +2046,11 @@ paths: name: id schema: type: string + - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' + in: query + name: key + schema: + type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: local @@ -2125,6 +2161,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -2241,6 +2279,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -2649,6 +2689,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -2698,6 +2740,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -2831,6 +2875,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -2880,6 +2926,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -3041,6 +3089,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -3405,6 +3455,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -3534,6 +3586,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -4207,11 +4261,21 @@ paths: schema: default: 120s type: string + - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' + in: query + name: author + schema: + type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: id schema: type: string + - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' + in: query + name: key + schema: + type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: name @@ -4276,6 +4340,8 @@ paths: author: type: string id: {} + key: + type: string name: type: string namespace: @@ -4331,6 +4397,11 @@ paths: properties: author: type: string + key: + enum: + - fungible + - nonfungible + type: string name: type: string type: @@ -4348,6 +4419,8 @@ paths: author: type: string id: {} + key: + type: string name: type: string namespace: @@ -4372,6 +4445,8 @@ paths: author: type: string id: {} + key: + type: string name: type: string namespace: @@ -4430,6 +4505,8 @@ paths: author: type: string id: {} + key: + type: string name: type: string namespace: @@ -5457,6 +5534,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -5527,6 +5606,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: @@ -5609,6 +5690,8 @@ paths: datahash: {} group: {} id: {} + key: + type: string namespace: type: string tag: diff --git a/internal/assets/manager.go b/internal/assets/manager.go index 702a11cf03..37681f72a4 100644 --- a/internal/assets/manager.go +++ b/internal/assets/manager.go @@ -133,7 +133,7 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id ID: tx.ID, Type: tx.Subject.Type, } - return pool, plugin.CreateTokenPool(ctx, pool.Key, pool) + return pool, plugin.CreateTokenPool(ctx, pool) } func (am *assetManager) scopeNS(ns string, filter database.AndFilter) database.AndFilter { diff --git a/internal/assets/manager_test.go b/internal/assets/manager_test.go index d7d95f4fa2..91651f12a8 100644 --- a/internal/assets/manager_test.go +++ b/internal/assets/manager_test.go @@ -35,7 +35,6 @@ import ( func newTestAssets(t *testing.T) (*assetManager, func()) { config.Reset() - config.Set(config.OrgIdentity, "UTNodeID") mdi := &databasemocks.Plugin{} mim := &identitymanagermocks.Manager{} mdm := &datamocks.Manager{} @@ -178,7 +177,7 @@ func TestCreateTokenPoolConfirm(t *testing.T) { msa := am.syncasync.(*syncasyncmocks.Bridge) mti := am.tokens["magic-tokens"].(*tokenmocks.Plugin) mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil).Times(2) - mti.On("CreateTokenPool", context.Background(), mock.Anything, mock.MatchedBy(func(pool *fftypes.TokenPool) bool { + mti.On("CreateTokenPool", context.Background(), mock.MatchedBy(func(pool *fftypes.TokenPool) bool { return pool.ID == requestID })).Return(nil).Times(1) mdi.On("UpsertTransaction", context.Background(), mock.MatchedBy(func(tx *fftypes.Transaction) bool { diff --git a/internal/database/sqlcommon/tokenpool_sql_test.go b/internal/database/sqlcommon/tokenpool_sql_test.go index b35d9748a9..94a080480f 100644 --- a/internal/database/sqlcommon/tokenpool_sql_test.go +++ b/internal/database/sqlcommon/tokenpool_sql_test.go @@ -153,12 +153,16 @@ func TestUpsertTokenPoolInsertSuccess(t *testing.T) { Type: fftypes.TransactionTypeTokenPool, ID: fftypes.NewUUID(), }, + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, } db.ExpectBegin() db.ExpectQuery("SELECT .*").WillReturnRows(sqlmock.NewRows([]string{"id"})) db.ExpectExec("INSERT .*"). - WithArgs(poolID, "ns1", "", "", "nonfungible", pool.TX.Type, pool.TX.ID). + WithArgs(poolID, "ns1", "", "", "nonfungible", pool.TX.Type, pool.TX.ID, "author1", "0x12345"). WillReturnResult(sqlmock.NewResult(1, 1)) db.ExpectCommit() callbacks.On("UUIDCollectionNSEvent", database.CollectionTokenPools, fftypes.ChangeEventTypeCreated, "ns1", poolID, mock.Anything).Return() @@ -175,6 +179,10 @@ func TestUpsertTokenPoolUpdateSuccess(t *testing.T) { pool := &fftypes.TokenPool{ ID: poolID, Namespace: "ns1", + Identity: fftypes.Identity{ + Author: "author1", + Key: "0x12345", + }, } db.ExpectBegin() diff --git a/internal/events/batch_pin_complete_test.go b/internal/events/batch_pin_complete_test.go index 769e0381e3..ef02209f7c 100644 --- a/internal/events/batch_pin_complete_test.go +++ b/internal/events/batch_pin_complete_test.go @@ -90,7 +90,7 @@ func TestBatchPinCompleteOkBroadcast(t *testing.T) { mbi := &blockchainmocks.Plugin{} mim := em.identity.(*identitymanagermocks.Manager) - mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) + mim.On("ResolveSigningKeyIdentity", mock.Anything, "0x12345").Return("author1", nil) err = em.BatchPinComplete(mbi, batch, "0x12345", "tx1", nil) assert.NoError(t, err) @@ -216,10 +216,10 @@ func TestPersistBatchAuthorResolveFail(t *testing.T) { Hash: batchHash, } mim := em.identity.(*identitymanagermocks.Manager) - mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) + mim.On("ResolveSigningKeyIdentity", mock.Anything, mock.Anything).Return("", fmt.Errorf("pop")) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, batchHash, "0x12345") - assert.NoError(t, err) + assert.Regexp(t, "pop", err) assert.False(t, valid) } @@ -242,7 +242,7 @@ func TestPersistBatchBadAuthor(t *testing.T) { Hash: batchHash, } mim := em.identity.(*identitymanagermocks.Manager) - mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) + mim.On("ResolveSigningKeyIdentity", mock.Anything, mock.Anything).Return("author2", nil) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, batchHash, "0x12345") assert.NoError(t, err) @@ -267,7 +267,7 @@ func TestPersistBatchMismatchChainHash(t *testing.T) { Hash: fftypes.NewRandB32(), } mim := em.identity.(*identitymanagermocks.Manager) - mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) + mim.On("ResolveSigningKeyIdentity", mock.Anything, mock.Anything).Return("author1", nil) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, fftypes.NewRandB32(), "0x12345") assert.NoError(t, err) diff --git a/internal/events/event_dispatcher_test.go b/internal/events/event_dispatcher_test.go index e49b7917c1..958197744a 100644 --- a/internal/events/event_dispatcher_test.go +++ b/internal/events/event_dispatcher_test.go @@ -519,7 +519,7 @@ func TestFilterEventsMatch(t *testing.T) { ed.subscription.groupFilter = nil ed.subscription.topicsFilter = nil ed.subscription.tagFilter = nil - ed.subscription.authorFilter = regexp.MustCompile("0x23456") + ed.subscription.authorFilter = regexp.MustCompile("org2") matched = ed.filterEvents(events) assert.Equal(t, 1, len(matched)) assert.Equal(t, *id2, *matched[0].ID) diff --git a/internal/events/persist_batch.go b/internal/events/persist_batch.go index 696190f05b..2b22de5136 100644 --- a/internal/events/persist_batch.go +++ b/internal/events/persist_batch.go @@ -34,7 +34,7 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c return false, err } if author == "" || author != batch.Author || signingKey != batch.Key { - l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Author, batch.Key, author, signingKey) + l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Key, batch.Author, signingKey, author) return false, nil // This is not retryable. skip this batch } @@ -135,8 +135,8 @@ func (em *eventManager) persistReceivedData(ctx context.Context /* db TX context } func (em *eventManager) persistBatchMessage(ctx context.Context /* db TX context*/, batch *fftypes.Batch, i int, msg *fftypes.Message) error { - if msg != nil && msg.Header.Author != batch.Author { - log.L(ctx).Errorf("Mismatched author '%s' on message entry %d in batch '%s'", msg.Header.Author, i, batch.ID) + if msg != nil && (msg.Header.Author != batch.Author || msg.Header.Key != batch.Key) { + log.L(ctx).Errorf("Mismatched key/author '%s'/'%s' on message entry %d in batch '%s'", msg.Header.Key, msg.Header.Author, i, batch.ID) return nil // skip entry } diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index d5b366d594..8c4cd6f3a1 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -38,6 +38,7 @@ const ( type Manager interface { ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) + ResolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (author string, err error) ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) } @@ -88,7 +89,7 @@ func orgDID(org *fftypes.Organization) string { func (im *identityManager) ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) { log.L(ctx).Debugf("Resolving identity input: key='%s' author='%s'", identity.Key, identity.Author) - identity.Key, err = im.resolveSigningKey(ctx, identity.Key) + identity.Key, err = im.ResolveSigningKey(ctx, identity.Key) if err != nil { return err } @@ -104,7 +105,7 @@ func (im *identityManager) ResolveInputIdentity(ctx context.Context, identity *f func (im *identityManager) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (author string, err error) { - signingKey, err = im.resolveSigningKey(ctx, signingKey) + signingKey, err = im.ResolveSigningKey(ctx, signingKey) if err != nil { return "", err } @@ -137,6 +138,23 @@ func (im *identityManager) ResolveLocalOrgDID(ctx context.Context) (localOrgDID return im.localOrgDID, err } +func (im *identityManager) ResolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) { + // Resolve the signing key + if inputKey != "" { + if cached := im.signingKeyCache.Get(inputKey); cached != nil { + cached.Extend(im.identityCacheTTL) + outputKey = cached.Value().(string) + } else { + outputKey, err = im.blockchain.ResolveSigningKey(ctx, inputKey) + if err != nil { + return "", err + } + im.signingKeyCache.Set(inputKey, outputKey, im.identityCacheTTL) + } + } + return +} + func (im *identityManager) cachedOrgLookupBySigningKey(ctx context.Context, signingKey string) (org *fftypes.Organization, err error) { cacheKey := fmt.Sprintf("key:%s", signingKey) if cached := im.identityCache.Get(cacheKey); cached != nil { @@ -223,20 +241,3 @@ func (im *identityManager) resolveInputAuthor(ctx context.Context, identity *fft return nil } - -func (im *identityManager) resolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) { - // Resolve the signing key - if inputKey != "" { - if cached := im.signingKeyCache.Get(inputKey); cached != nil { - cached.Extend(im.identityCacheTTL) - outputKey = cached.Value().(string) - } else { - outputKey, err = im.blockchain.ResolveSigningKey(ctx, inputKey) - if err != nil { - return "", err - } - im.signingKeyCache.Set(inputKey, outputKey, im.identityCacheTTL) - } - } - return -} diff --git a/internal/networkmap/register_node.go b/internal/networkmap/register_node.go index 85a06c61ef..e4fd7eb2f9 100644 --- a/internal/networkmap/register_node.go +++ b/internal/networkmap/register_node.go @@ -18,6 +18,7 @@ package networkmap import ( "context" + "fmt" "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/i18n" @@ -26,15 +27,23 @@ import ( func (nm *networkMap) RegisterNode(ctx context.Context, waitConfirm bool) (node *fftypes.Node, msg *fftypes.Message, err error) { + localOrgSigningKey, err := nm.getLocalOrgSigningKey(ctx) + if err != nil { + return nil, nil, err + } + node = &fftypes.Node{ ID: fftypes.NewUUID(), Created: fftypes.Now(), - Owner: config.GetString(config.OrgIdentity), + Owner: localOrgSigningKey, // TODO: Switch hierarchy to DID based, not signing key. Introducing an intermediate identity object Name: config.GetString(config.NodeName), Description: config.GetString(config.NodeDescription), } if node.Name == "" { - node.Name = config.GetString(config.OrgIdentity) + orgName := config.GetString(config.OrgName) + if orgName != "" { + node.Name = fmt.Sprintf("%s.node", config.GetString(config.OrgName)) + } } if node.Owner == "" || node.Name == "" { return nil, nil, i18n.NewError(ctx, i18n.MsgNodeAndOrgIDMustBeSet) @@ -54,7 +63,7 @@ func (nm *networkMap) RegisterNode(ctx context.Context, waitConfirm bool) (node return nil, nil, err } - msg, err = nm.broadcast.BroadcastDefinition(ctx, node, signingIdentity, fftypes.SystemTagDefineNode, waitConfirm) + msg, err = nm.broadcast.BroadcastDefinitionAsNode(ctx, node, fftypes.SystemTagDefineNode, waitConfirm) if msg != nil { node.Message = msg.Header.ID } diff --git a/internal/networkmap/register_node_test.go b/internal/networkmap/register_node_test.go index 57852fc2cc..14996207da 100644 --- a/internal/networkmap/register_node_test.go +++ b/internal/networkmap/register_node_test.go @@ -25,7 +25,6 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -36,8 +35,9 @@ func TestRegisterNodeOk(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() + config.Set(config.OrgKey, "0x23456") + config.Set(config.OrgName, "org1") config.Set(config.NodeDescription, "Node 1") - config.Set(config.OrgIdentity, "0x23456") mdi := nm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", nm.ctx, "0x23456").Return(&fftypes.Organization{ @@ -46,17 +46,14 @@ func TestRegisterNodeOk(t *testing.T) { }, nil) mim := nm.identity.(*identitymanagermocks.Manager) - childID := &fftypes.Identity{OnChain: "0x12345"} - parentID := &fftypes.Identity{OnChain: "0x23456"} - mim.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) - mim.On("Resolve", nm.ctx, "0x23456").Return(parentID, nil) + mim.On("ResolveSigningKey", nm.ctx, "0x23456").Return("0x23456", nil) mdx := nm.exchange.(*dataexchangemocks.Plugin) mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) mockMsg := &fftypes.Message{Header: fftypes.MessageHeader{ID: fftypes.NewUUID()}} mbm := nm.broadcast.(*broadcastmocks.Manager) - mbm.On("BroadcastDefinition", nm.ctx, mock.Anything, parentID, fftypes.SystemTagDefineNode, true).Return(mockMsg, nil) + mbm.On("BroadcastDefinitionAsNode", nm.ctx, mock.Anything, fftypes.SystemTagDefineNode, true).Return(mockMsg, nil) node, msg, err := nm.RegisterNode(nm.ctx, true) assert.NoError(t, err) @@ -65,28 +62,39 @@ func TestRegisterNodeOk(t *testing.T) { } -func TestRegisterNodeMissingConfig(t *testing.T) { +func TestRegisterNodeBadParentID(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() - config.Set(config.NodeDescription, nil) - config.Set(config.NodeName, nil) - config.Set(config.OrgIdentity, nil) + config.Set(config.OrgKey, "0x23456") + config.Set(config.NodeDescription, "Node 1") + config.Set(config.NodeName, "node1") + + mdi := nm.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", nm.ctx, "0x23456").Return(&fftypes.Organization{ + Identity: "0x23456", + Description: "owning organization", + }, nil) + + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x23456").Return("", fmt.Errorf("pop")) + + mdx := nm.exchange.(*dataexchangemocks.Plugin) + mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) _, _, err := nm.RegisterNode(nm.ctx, false) - assert.Regexp(t, "FF10216", err) + assert.Regexp(t, "pop", err) } -func TestRegisterNodeBadParentID(t *testing.T) { +func TestRegisterNodeMissingNodeName(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() + config.Set(config.OrgKey, "0x23456") config.Set(config.NodeDescription, "Node 1") - config.Set(config.NodeName, "node1") - config.Set(config.OrgIdentity, "0x23456") mdi := nm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", nm.ctx, "0x23456").Return(&fftypes.Organization{ @@ -94,17 +102,13 @@ func TestRegisterNodeBadParentID(t *testing.T) { Description: "owning organization", }, nil) - mii := nm.identity.(*identitymocks.Plugin) - mii.On("Resolve", nm.ctx, "0x23456").Return(nil, fmt.Errorf("pop")) - - mdx := nm.exchange.(*dataexchangemocks.Plugin) - mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x23456").Return("0x23456", nil) _, _, err := nm.RegisterNode(nm.ctx, false) - assert.Regexp(t, "FF10215", err) + assert.Regexp(t, "FF10216", err) } - func TestRegisterNodeBadNodeID(t *testing.T) { nm, cancel := newTestNetworkmap(t) @@ -112,7 +116,6 @@ func TestRegisterNodeBadNodeID(t *testing.T) { config.Set(config.NodeDescription, "Node 1") config.Set(config.NodeName, "node1") - config.Set(config.OrgIdentity, "0x23456") mdi := nm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", nm.ctx, "0x23456").Return(&fftypes.Organization{ @@ -120,14 +123,11 @@ func TestRegisterNodeBadNodeID(t *testing.T) { Description: "owning organization", }, nil) - mii := nm.identity.(*identitymocks.Plugin) - mii.On("Resolve", nm.ctx, "0x23456").Return(nil, fmt.Errorf("pop")) - - mdx := nm.exchange.(*dataexchangemocks.Plugin) - mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "").Return("", nil) _, _, err := nm.RegisterNode(nm.ctx, false) - assert.Regexp(t, "pop", err) + assert.Regexp(t, "FF10216", err) } @@ -136,16 +136,15 @@ func TestRegisterNodeParentNotFound(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() + config.Set(config.OrgKey, "0x23456") config.Set(config.NodeDescription, "Node 1") config.Set(config.NodeName, "node1") - config.Set(config.OrgIdentity, "0x23456") mdi := nm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", nm.ctx, "0x23456").Return(nil, nil) - mii := nm.identity.(*identitymocks.Plugin) - childID := &fftypes.Identity{OnChain: "0x12345"} - mii.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x23456").Return("0x23456", nil) mdx := nm.exchange.(*dataexchangemocks.Plugin) mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) @@ -160,9 +159,12 @@ func TestRegisterNodeParentBadNode(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() + config.Set(config.OrgKey, "0x23456") config.Set(config.NodeDescription, string(make([]byte, 4097))) config.Set(config.NodeName, "node1") - config.Set(config.OrgIdentity, "0x23456") + + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x23456").Return("0x23456", nil) mdx := nm.exchange.(*dataexchangemocks.Plugin) mdx.On("GetEndpointInfo", nm.ctx).Return("peer1", fftypes.JSONObject{"endpoint": "details"}, nil) @@ -177,13 +179,16 @@ func TestRegisterNodeParentDXEndpointFail(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() + config.Set(config.OrgKey, "0x23456") config.Set(config.NodeDescription, string(make([]byte, 4097))) config.Set(config.NodeName, "node1") - config.Set(config.OrgIdentity, "0x23456") mdx := nm.exchange.(*dataexchangemocks.Plugin) mdx.On("GetEndpointInfo", nm.ctx).Return("", nil, fmt.Errorf("pop")) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x23456").Return("0x23456", nil) + _, _, err := nm.RegisterNode(nm.ctx, false) assert.Regexp(t, "pop", err) diff --git a/internal/networkmap/register_org.go b/internal/networkmap/register_org.go index 32fda65aa0..5726fcb0db 100644 --- a/internal/networkmap/register_org.go +++ b/internal/networkmap/register_org.go @@ -40,11 +40,32 @@ func (nm *networkMap) findOrgsToRoot(ctx context.Context, idType, identity, pare return err } +func (nm *networkMap) getLocalOrgSigningKey(ctx context.Context) (localOrgSigningKey string, err error) { + localOrgSigningKey = config.GetString(config.OrgKey) + if localOrgSigningKey == "" { + localOrgSigningKey = config.GetString(config.OrgIdentityDeprecated) + } + localOrgSigningKey, err = nm.identity.ResolveSigningKey(ctx, localOrgSigningKey) + if err != nil { + return "", err + } + if localOrgSigningKey == "" { + return "", i18n.NewError(ctx, i18n.MsgNodeAndOrgIDMustBeSet) + } + return localOrgSigningKey, nil +} + // RegisterNodeOrganization is a convenience helper to register the org configured on the node, without any extra info func (nm *networkMap) RegisterNodeOrganization(ctx context.Context, waitConfirm bool) (org *fftypes.Organization, msg *fftypes.Message, err error) { + + localOrgSigningKey, err := nm.getLocalOrgSigningKey(ctx) + if err != nil { + return nil, nil, err + } + org = &fftypes.Organization{ Name: config.GetString(config.OrgName), - Identity: config.GetString(config.OrgIdentity), + Identity: localOrgSigningKey, // TODO: Switch hierarchy to DID based, not signing key. Introducing an intermediate identity object Description: config.GetString(config.OrgDescription), } if org.Identity == "" || org.Name == "" { @@ -70,7 +91,9 @@ func (nm *networkMap) RegisterOrganization(ctx context.Context, org *fftypes.Org signingIdentityString := org.Identity if org.Parent != "" { // Check the identity itself is ok - if _, err = nm.identity.Resolve(ctx, org.Identity); err != nil { + if err = nm.identity.ResolveInputIdentity(ctx, &fftypes.Identity{ + Key: signingIdentityString, + }); err != nil { return nil, err } @@ -82,10 +105,7 @@ func (nm *networkMap) RegisterOrganization(ctx context.Context, org *fftypes.Org } } - signingIdentity, err := nm.identity.Resolve(ctx, signingIdentityString) - if err != nil { - return nil, i18n.WrapError(ctx, err, i18n.MsgInvalidSigningIdentity) - } - - return nm.broadcast.BroadcastDefinition(ctx, org, signingIdentity, fftypes.SystemTagDefineOrganization, waitConfirm) + return nm.broadcast.BroadcastDefinition(ctx, org, &fftypes.Identity{ + Key: signingIdentityString, + }, fftypes.SystemTagDefineOrganization, waitConfirm) } diff --git a/internal/networkmap/register_org_test.go b/internal/networkmap/register_org_test.go index 73b6749225..f32d764915 100644 --- a/internal/networkmap/register_org_test.go +++ b/internal/networkmap/register_org_test.go @@ -23,7 +23,7 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -40,11 +40,9 @@ func TestRegisterOrganizationChildOk(t *testing.T) { Description: "parent organization", }, nil) - mii := nm.identity.(*identitymocks.Plugin) - childID := &fftypes.Identity{OnChain: "0x12345"} - parentID := &fftypes.Identity{OnChain: "0x23456"} - mii.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) - mii.On("Resolve", nm.ctx, "0x23456").Return(parentID, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + parentID := &fftypes.Identity{Key: "0x23456"} + mim.On("ResolveInputIdentity", nm.ctx, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" })).Return(nil) mockMsg := &fftypes.Message{Header: fftypes.MessageHeader{ID: fftypes.NewUUID()}} mbm := nm.broadcast.(*broadcastmocks.Manager) @@ -59,6 +57,7 @@ func TestRegisterOrganizationChildOk(t *testing.T) { assert.NoError(t, err) assert.Equal(t, mockMsg, msg) + mim.AssertExpectations(t) } func TestRegisterNodeOrganizationRootOk(t *testing.T) { @@ -66,17 +65,17 @@ func TestRegisterNodeOrganizationRootOk(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() + config.Set(config.OrgIdentityDeprecated, "0x12345") config.Set(config.OrgName, "org1") - config.Set(config.OrgIdentity, "0x12345") config.Set(config.OrgDescription, "my organization") - mii := nm.identity.(*identitymocks.Plugin) - rootID := &fftypes.Identity{OnChain: "0x12345"} - mii.On("Resolve", nm.ctx, "0x12345").Return(rootID, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x12345").Return("0x12345", nil) + mim.On("ResolveInputIdentity", nm.ctx, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" })).Return(nil) mockMsg := &fftypes.Message{Header: fftypes.MessageHeader{ID: fftypes.NewUUID()}} mbm := nm.broadcast.(*broadcastmocks.Manager) - mbm.On("BroadcastDefinition", nm.ctx, mock.Anything, rootID, fftypes.SystemTagDefineOrganization, true).Return(mockMsg, nil) + mbm.On("BroadcastDefinition", nm.ctx, mock.Anything, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" }), fftypes.SystemTagDefineOrganization, true).Return(mockMsg, nil) org, msg, err := nm.RegisterNodeOrganization(nm.ctx, true) assert.NoError(t, err) @@ -85,14 +84,30 @@ func TestRegisterNodeOrganizationRootOk(t *testing.T) { } -func TestRegisterNodeOrganizationMissingConfig(t *testing.T) { +func TestRegisterNodeOrganizationMissingOrgKey(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() - config.Set(config.OrgIdentity, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "").Return("", nil) - _, _, err := nm.RegisterNodeOrganization(nm.ctx, false) + _, _, err := nm.RegisterNodeOrganization(nm.ctx, true) + assert.Regexp(t, "FF10216", err) + +} + +func TestRegisterNodeOrganizationMissingName(t *testing.T) { + + nm, cancel := newTestNetworkmap(t) + defer cancel() + + config.Set(config.OrgKey, "0x2345") + + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKey", nm.ctx, "0x2345").Return("0x2345", nil) + + _, _, err := nm.RegisterNodeOrganization(nm.ctx, true) assert.Regexp(t, "FF10216", err) } @@ -115,14 +130,17 @@ func TestRegisterOrganizationBadIdentity(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() - mii := nm.identity.(*identitymocks.Plugin) - mii.On("Resolve", nm.ctx, "!wrong").Return(nil, fmt.Errorf("pop")) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", nm.ctx, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "wrongun" })).Return(fmt.Errorf("pop")) + mdi := nm.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", nm.ctx, "wrongun").Return(nil, nil) _, err := nm.RegisterOrganization(nm.ctx, &fftypes.Organization{ Name: "org1", - Identity: "!wrong", + Identity: "wrongun", + Parent: "ok", }, false) - assert.Regexp(t, "FF10215.*pop", err) + assert.Regexp(t, "pop", err) } @@ -131,9 +149,8 @@ func TestRegisterOrganizationBadParent(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() - mii := nm.identity.(*identitymocks.Plugin) - childID := &fftypes.Identity{OnChain: "0x12345"} - mii.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", nm.ctx, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" })).Return(nil) mdi := nm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", nm.ctx, "wrongun").Return(nil, nil) @@ -146,31 +163,13 @@ func TestRegisterOrganizationBadParent(t *testing.T) { } -func TestRegisterOrganizationChildResolveFail(t *testing.T) { - - nm, cancel := newTestNetworkmap(t) - defer cancel() - - mii := nm.identity.(*identitymocks.Plugin) - mii.On("Resolve", nm.ctx, "0x12345").Return(nil, fmt.Errorf("pop")) - - _, err := nm.RegisterOrganization(nm.ctx, &fftypes.Organization{ - Name: "org1", - Identity: "0x12345", - Parent: "0x23456", - }, false) - assert.Regexp(t, "pop", err) - -} - func TestRegisterOrganizationParentLookupFail(t *testing.T) { nm, cancel := newTestNetworkmap(t) defer cancel() - mii := nm.identity.(*identitymocks.Plugin) - childID := &fftypes.Identity{OnChain: "0x12345"} - mii.On("Resolve", nm.ctx, "0x12345").Return(childID, nil) + mim := nm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveInputIdentity", nm.ctx, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" })).Return(nil) mdi := nm.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", nm.ctx, "0x23456").Return(nil, fmt.Errorf("pop")) diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index 75d8c11ec2..f62b012db0 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -281,9 +281,9 @@ func (or *orchestrator) initPlugins(ctx context.Context) (err error) { return nil } - if or.identity == nil { + if or.identityPlugin == nil { iiType := config.GetString(config.IdentityType) - if or.identity, err = iifactory.GetPlugin(ctx, iiType); err != nil { + if or.identityPlugin, err = iifactory.GetPlugin(ctx, iiType); err != nil { return err } } @@ -384,7 +384,7 @@ func (or *orchestrator) initComponents(ctx context.Context) (err error) { } } - or.syshandlers = syshandlers.NewSystemHandlers(or.database, or.identity, or.dataexchange, or.data, or.broadcast, or.messaging) + or.syshandlers = syshandlers.NewSystemHandlers(or.database, or.dataexchange, or.data, or.broadcast, or.messaging) if or.events == nil { or.events, err = events.NewEventManager(ctx, or.publicstorage, or.database, or.identity, or.syshandlers, or.data) diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go index 51ef6dd93f..81012b1809 100644 --- a/internal/orchestrator/orchestrator_test.go +++ b/internal/orchestrator/orchestrator_test.go @@ -97,7 +97,8 @@ func newTestOrchestrator() *testOrchestrator { tor.orchestrator.publicstorage = tor.mps tor.orchestrator.messaging = tor.mpm tor.orchestrator.blockchain = tor.mbi - tor.orchestrator.identity = tor.mii + tor.orchestrator.identity = tor.mim + tor.orchestrator.identityPlugin = tor.mii tor.orchestrator.dataexchange = tor.mdx tor.orchestrator.assets = tor.mam tor.orchestrator.tokens = map[string]tokens.Plugin{"token": tor.mti} @@ -151,7 +152,7 @@ func TestBadIdentityPlugin(t *testing.T) { or := newTestOrchestrator() or.mdi.On("GetConfigRecords", mock.Anything, mock.Anything, mock.Anything).Return([]*fftypes.ConfigRecord{}, nil, nil) config.Set(config.IdentityType, "wrong") - or.identity = nil + or.identityPlugin = nil or.mdi.On("Init", mock.Anything, mock.Anything, mock.Anything).Return(nil) ctx, cancelCtx := context.WithCancel(context.Background()) err := or.Init(ctx, cancelCtx) @@ -379,6 +380,14 @@ func TestInitDataComponentFail(t *testing.T) { assert.Regexp(t, "FF10128", err) } +func TestInitIdentityComponentFail(t *testing.T) { + or := newTestOrchestrator() + or.database = nil + or.identity = nil + err := or.initComponents(context.Background()) + assert.Regexp(t, "FF10128", err) +} + func TestInitAssetsComponentFail(t *testing.T) { or := newTestOrchestrator() or.database = nil diff --git a/internal/orchestrator/status.go b/internal/orchestrator/status.go index 55b464289c..e3d68b05d5 100644 --- a/internal/orchestrator/status.go +++ b/internal/orchestrator/status.go @@ -25,13 +25,17 @@ import ( func (or *orchestrator) GetStatus(ctx context.Context) (status *fftypes.NodeStatus, err error) { + orgKey := config.GetString(config.OrgKey) + if orgKey == "" { + orgKey = config.GetString(config.OrgIdentityDeprecated) + } status = &fftypes.NodeStatus{ Node: fftypes.NodeStatusNode{ Name: config.GetString(config.NodeName), }, Org: fftypes.NodeStatusOrg{ Name: config.GetString(config.OrgName), - Identity: config.GetString(config.OrgIdentity), + Identity: orgKey, }, Defaults: fftypes.NodeStatusDefaults{ Namespace: config.GetString(config.NamespacesDefault), diff --git a/internal/syshandlers/syshandler_network_node_test.go b/internal/syshandlers/syshandler_network_node_test.go index 79fb34781a..ab05c10552 100644 --- a/internal/syshandlers/syshandler_network_node_test.go +++ b/internal/syshandlers/syshandler_network_node_test.go @@ -139,8 +139,10 @@ func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -174,8 +176,10 @@ func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -212,8 +216,10 @@ func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.True(t, valid) @@ -247,8 +253,10 @@ func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -281,42 +289,10 @@ func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x99999", - Tag: string(fftypes.SystemTagDefineNode), - }, - }, []*fftypes.Data{data}) - assert.False(t, valid) - assert.NoError(t, err) - - mdi.AssertExpectations(t) -} - -func TestHandleSystemBroadcastNodeResolveFail(t *testing.T) { - sh := newTestSystemHandlers(t) - - node := &fftypes.Node{ - ID: fftypes.NewUUID(), - Name: "node1", - Owner: "0x23456", - Description: "my org", - DX: fftypes.DXInfo{ - Peer: "peer1", - Endpoint: fftypes.JSONObject{"some": "info"}, - }, - } - b, err := json.Marshal(&node) - assert.NoError(t, err) - data := &fftypes.Data{ - Value: fftypes.Byteable(b), - } - - mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ - Header: fftypes.MessageHeader{ - Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x12345", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -349,8 +325,10 @@ func TestHandleSystemBroadcastNodeGetOrgNotFound(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -383,8 +361,10 @@ func TestHandleSystemBroadcastNodeGetOrgFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -415,8 +395,10 @@ func TestHandleSystemBroadcastNodeValidateFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -433,8 +415,10 @@ func TestHandleSystemBroadcastNodeUnmarshalFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineNode), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineNode), }, }, []*fftypes.Data{data}) assert.False(t, valid) diff --git a/internal/syshandlers/syshandler_network_org_test.go b/internal/syshandlers/syshandler_network_org_test.go index c55991a17d..af549fe382 100644 --- a/internal/syshandlers/syshandler_network_org_test.go +++ b/internal/syshandlers/syshandler_network_org_test.go @@ -23,7 +23,6 @@ import ( "testing" "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -46,8 +45,6 @@ func TestHandleSystemBroadcastOrgOk(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, nil) @@ -57,14 +54,15 @@ func TestHandleSystemBroadcastOrgOk(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.True(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -85,8 +83,6 @@ func TestHandleSystemBroadcastOrgDupOk(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x23456"}, nil) @@ -94,14 +90,15 @@ func TestHandleSystemBroadcastOrgDupOk(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.True(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -122,22 +119,21 @@ func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x23456").Return(&fftypes.Identity{OnChain: "0x23456"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x9999"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -157,8 +153,6 @@ func TestHandleSystemBroadcastOrgUpsertFail(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x12345").Return(&fftypes.Identity{OnChain: "0x12345"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, nil) mdi.On("GetOrganizationByName", mock.Anything, "org1").Return(nil, nil) @@ -167,14 +161,15 @@ func TestHandleSystemBroadcastOrgUpsertFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x12345", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x12345", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) assert.EqualError(t, err, "pop") - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -194,21 +189,20 @@ func TestHandleSystemBroadcastOrgGetOrgFail(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x12345").Return(&fftypes.Identity{OnChain: "0x12345"}, nil) mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, fmt.Errorf("pop")) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x12345", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x12345", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) assert.EqualError(t, err, "pop") - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -228,53 +222,19 @@ func TestHandleSystemBroadcastOrgAuthorMismatch(t *testing.T) { Value: fftypes.Byteable(b), } - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x12345").Return(&fftypes.Identity{OnChain: "0x12345"}, nil) mdi := sh.database.(*databasemocks.Plugin) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) assert.NoError(t, err) - mii.AssertExpectations(t) - mdi.AssertExpectations(t) -} - -func TestHandleSystemBroadcastOrgResolveFail(t *testing.T) { - sh := newTestSystemHandlers(t) - - org := &fftypes.Organization{ - ID: fftypes.NewUUID(), - Name: "org1", - Identity: "0x12345", - Description: "my org", - Profile: fftypes.JSONObject{"some": "info"}, - } - b, err := json.Marshal(&org) - assert.NoError(t, err) - data := &fftypes.Data{ - Value: fftypes.Byteable(b), - } - - mii := sh.identity.(*identitymocks.Plugin) - mii.On("Resolve", mock.Anything, "0x12345").Return(nil, fmt.Errorf("pop")) - mdi := sh.database.(*databasemocks.Plugin) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ - Header: fftypes.MessageHeader{ - Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), - }, - }, []*fftypes.Data{data}) - assert.False(t, valid) - assert.NoError(t, err) - - mii.AssertExpectations(t) mdi.AssertExpectations(t) } @@ -300,8 +260,10 @@ func TestHandleSystemBroadcastGetParentFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -332,8 +294,10 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -360,8 +324,10 @@ func TestHandleSystemBroadcastValidateFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) @@ -378,8 +344,10 @@ func TestHandleSystemBroadcastUnmarshalFail(t *testing.T) { valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", - Author: "0x23456", - Tag: string(fftypes.SystemTagDefineOrganization), + Identity: fftypes.Identity{ + Author: "0x23456", + }, + Tag: string(fftypes.SystemTagDefineOrganization), }, }, []*fftypes.Data{data}) assert.False(t, valid) diff --git a/internal/syshandlers/syshandler_test.go b/internal/syshandlers/syshandler_test.go index cf9a1e2b09..96b26c4246 100644 --- a/internal/syshandlers/syshandler_test.go +++ b/internal/syshandlers/syshandler_test.go @@ -24,7 +24,6 @@ import ( "github.com/hyperledger-labs/firefly/mocks/databasemocks" "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" @@ -33,12 +32,11 @@ import ( func newTestSystemHandlers(t *testing.T) *systemHandlers { mdi := &databasemocks.Plugin{} - mii := &identitymocks.Plugin{} mdx := &dataexchangemocks.Plugin{} mdm := &datamocks.Manager{} mbm := &broadcastmocks.Manager{} mpm := &privatemessagingmocks.Manager{} - return NewSystemHandlers(mdi, mii, mdx, mdm, mbm, mpm).(*systemHandlers) + return NewSystemHandlers(mdi, mdx, mdm, mbm, mpm).(*systemHandlers) } func TestHandleSystemBroadcastUnknown(t *testing.T) { diff --git a/internal/tokens/https/https.go b/internal/tokens/https/https.go index c7e517b4d6..86e806e1fd 100644 --- a/internal/tokens/https/https.go +++ b/internal/tokens/https/https.go @@ -216,7 +216,7 @@ func (h *HTTPS) eventLoop() { } } -func (h *HTTPS) CreateTokenPool(ctx context.Context, identity *fftypes.Identity, pool *fftypes.TokenPool) error { +func (h *HTTPS) CreateTokenPool(ctx context.Context, pool *fftypes.TokenPool) error { data := createPoolData{ Namespace: pool.Namespace, Name: pool.Name, diff --git a/internal/tokens/https/https_test.go b/internal/tokens/https/https_test.go index 24248d4a18..f9069d6ae7 100644 --- a/internal/tokens/https/https_test.go +++ b/internal/tokens/https/https_test.go @@ -131,7 +131,7 @@ func TestCreateTokenPool(t *testing.T) { return res, nil }) - err := h.CreateTokenPool(context.Background(), &fftypes.Identity{}, pool) + err := h.CreateTokenPool(context.Background(), pool) assert.NoError(t, err) } @@ -150,7 +150,7 @@ func TestCreateTokenPoolError(t *testing.T) { httpmock.RegisterResponder("POST", fmt.Sprintf("%s/api/v1/pool", httpURL), httpmock.NewJsonResponderOrPanic(500, fftypes.JSONObject{})) - err := h.CreateTokenPool(context.Background(), &fftypes.Identity{}, pool) + err := h.CreateTokenPool(context.Background(), pool) assert.Regexp(t, "FF10274", err) } diff --git a/mocks/identitymanagermocks/manager.go b/mocks/identitymanagermocks/manager.go index 195d32fcd2..597883c8c2 100644 --- a/mocks/identitymanagermocks/manager.go +++ b/mocks/identitymanagermocks/manager.go @@ -50,6 +50,27 @@ func (_m *Manager) ResolveLocalOrgDID(ctx context.Context) (string, error) { return r0, r1 } +// ResolveSigningKey provides a mock function with given fields: ctx, inputKey +func (_m *Manager) ResolveSigningKey(ctx context.Context, inputKey string) (string, error) { + ret := _m.Called(ctx, inputKey) + + var r0 string + if rf, ok := ret.Get(0).(func(context.Context, string) string); ok { + r0 = rf(ctx, inputKey) + } else { + r0 = ret.Get(0).(string) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, inputKey) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ResolveSigningKeyIdentity provides a mock function with given fields: ctx, signingKey func (_m *Manager) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (string, error) { ret := _m.Called(ctx, signingKey) diff --git a/mocks/tokenmocks/plugin.go b/mocks/tokenmocks/plugin.go index 73cf9d4ebf..1157a59b47 100644 --- a/mocks/tokenmocks/plugin.go +++ b/mocks/tokenmocks/plugin.go @@ -35,13 +35,13 @@ func (_m *Plugin) Capabilities() *tokens.Capabilities { return r0 } -// CreateTokenPool provides a mock function with given fields: ctx, signingKey, pool -func (_m *Plugin) CreateTokenPool(ctx context.Context, signingKey string, pool *fftypes.TokenPool) error { - ret := _m.Called(ctx, signingKey, pool) +// CreateTokenPool provides a mock function with given fields: ctx, pool +func (_m *Plugin) CreateTokenPool(ctx context.Context, pool *fftypes.TokenPool) error { + ret := _m.Called(ctx, pool) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, *fftypes.TokenPool) error); ok { - r0 = rf(ctx, signingKey, pool) + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.TokenPool) error); ok { + r0 = rf(ctx, pool) } else { r0 = ret.Error(0) } diff --git a/pkg/tokens/plugin.go b/pkg/tokens/plugin.go index a6b14ebd90..216c3e6cce 100644 --- a/pkg/tokens/plugin.go +++ b/pkg/tokens/plugin.go @@ -42,7 +42,7 @@ type Plugin interface { // CreateTokenPool creates a new (fungible or non-fungible) pool of tokens // The returned tracking ID will be used to correlate with any subsequent transaction tracking updates - CreateTokenPool(ctx context.Context, signingKey string, pool *fftypes.TokenPool) error + CreateTokenPool(ctx context.Context, pool *fftypes.TokenPool) error } // Callbacks is the interface provided to the tokens plugin, to allow it to pass events back to firefly. From 10d7ab3150a3923a0b565972bfcb28cf98c369fd Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Mon, 27 Sep 2021 15:50:38 -0400 Subject: [PATCH 05/15] Update registration to use new identity code Signed-off-by: Nicko Guyer --- internal/broadcast/definition.go | 50 ++++++++++++++++++- internal/broadcast/manager.go | 7 +-- internal/broadcast/message.go | 24 ++++++--- internal/events/aggregator.go | 6 +-- internal/events/batch_pin_complete.go | 14 +++--- internal/events/dx_callbacks.go | 11 ++-- internal/events/event_manager.go | 2 +- internal/events/persist_batch.go | 25 +++++++++- internal/identity/identitymanager.go | 12 +++-- internal/networkmap/register_org.go | 2 +- internal/orchestrator/bound_callbacks.go | 4 +- internal/privatemessaging/message.go | 2 +- internal/privatemessaging/recipients.go | 11 ++-- .../syshandlers/syshandler_network_node.go | 2 +- .../syshandlers/syshandler_network_org.go | 32 ++++++------ test/e2e/e2e_test.go | 38 +++++++------- 16 files changed, 167 insertions(+), 75 deletions(-) diff --git a/internal/broadcast/definition.go b/internal/broadcast/definition.go index cbcae3d671..01af9b153a 100644 --- a/internal/broadcast/definition.go +++ b/internal/broadcast/definition.go @@ -28,6 +28,8 @@ func (bm *broadcastManager) BroadcastDefinitionAsNode(ctx context.Context, def f return bm.BroadcastDefinition(ctx, def, &fftypes.Identity{ /* resolve to node default */ }, tag, waitConfirm) } +// THIS IS WHERE THE OLD CODE FIRST CALLS ResolveInputIdentity +// It does NOT have an author and key the first time func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { err = bm.identity.ResolveInputIdentity(ctx, signingIdentity) @@ -74,5 +76,51 @@ func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes } // Broadcast the message - return bm.broadcastMessageCommon(ctx, msg, waitConfirm) + return bm.broadcastMessageCommon(ctx, msg, waitConfirm, false) +} + +func (bm *broadcastManager) BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { + + signingIdentity.Author = bm.identity.OrgDID(def) + + // Ensure the broadcast message is nil on the sending side - only set on receiving side + def.SetBroadcastMessage(nil) + + // Serialize it into a data object, as a piece of data we can write to a message + data := &fftypes.Data{ + Validator: fftypes.ValidatorTypeSystemDefinition, + ID: fftypes.NewUUID(), + Namespace: fftypes.SystemNamespace, + Created: fftypes.Now(), + } + data.Value, err = json.Marshal(&def) + if err == nil { + err = data.Seal(ctx) + } + if err != nil { + return nil, i18n.WrapError(ctx, err, i18n.MsgSerializationFailed) + } + + // Write as data to the local store + if err = bm.database.UpsertData(ctx, data, true, false /* we just generated the ID, so it is new */); err != nil { + return nil, err + } + + // Create a broadcast message referring to the data + msg = &fftypes.Message{ + Header: fftypes.MessageHeader{ + Namespace: fftypes.SystemNamespace, + Type: fftypes.MessageTypeDefinition, + Identity: *signingIdentity, + Topics: fftypes.FFNameArray{def.Topic()}, + Tag: string(tag), + TxType: fftypes.TransactionTypeBatchPin, + }, + Data: fftypes.DataRefs{ + {ID: data.ID, Hash: data.Hash}, + }, + } + + // Broadcast the message + return bm.broadcastMessageCommon(ctx, msg, waitConfirm, true) } diff --git a/internal/broadcast/manager.go b/internal/broadcast/manager.go index 072f349c30..0e1d63c500 100644 --- a/internal/broadcast/manager.go +++ b/internal/broadcast/manager.go @@ -39,9 +39,10 @@ type Manager interface { BroadcastDatatype(ctx context.Context, ns string, datatype *fftypes.Datatype, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) - BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (out *fftypes.Message, err error) + BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool, identityResolved bool) (out *fftypes.Message, err error) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) + BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) Start() error WaitStop() } @@ -132,7 +133,7 @@ func (bm *broadcastManager) submitTXAndUpdateDB(ctx context.Context, batch *ffty return bm.batchpin.SubmitPinnedBatch(ctx, batch, contexts) } -func (bm *broadcastManager) broadcastMessageCommon(ctx context.Context, msg *fftypes.Message, waitConfirm bool) (*fftypes.Message, error) { +func (bm *broadcastManager) broadcastMessageCommon(ctx context.Context, msg *fftypes.Message, waitConfirm bool, identityResolved bool) (*fftypes.Message, error) { if !waitConfirm { // Seal the message @@ -145,7 +146,7 @@ func (bm *broadcastManager) broadcastMessageCommon(ctx context.Context, msg *fft } return bm.syncasync.SendConfirm(ctx, msg.Header.Namespace, func(requestID *fftypes.UUID) error { - _, err := bm.BroadcastMessageWithID(ctx, msg.Header.Namespace, requestID, nil, msg, false) + _, err := bm.BroadcastMessageWithID(ctx, msg.Header.Namespace, requestID, nil, msg, false, identityResolved) return err }) } diff --git a/internal/broadcast/message.go b/internal/broadcast/message.go index ef747e5011..e03e67b74c 100644 --- a/internal/broadcast/message.go +++ b/internal/broadcast/message.go @@ -26,10 +26,16 @@ import ( ) func (bm *broadcastManager) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) { - return bm.BroadcastMessageWithID(ctx, ns, nil, in, nil, waitConfirm) + return bm.BroadcastMessageWithID(ctx, ns, nil, in, nil, waitConfirm, false) } -func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (out *fftypes.Message, err error) { +func (bm *broadcastManager) BroadcastMessageWithResolvedID(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) { + return bm.BroadcastMessageWithID(ctx, ns, nil, in, nil, waitConfirm, true) +} + +// THIS IS WHERE THE NEW CODE FIRST CALLS ResolveInputIdentity +// IT already has an author and key here +func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool, identityResolved bool) (out *fftypes.Message, err error) { if unresolved != nil { resolved = &unresolved.Message } @@ -40,9 +46,11 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin resolved.Header.TxType = fftypes.TransactionTypeBatchPin } - // Resolve the sending identity - if err := bm.identity.ResolveInputIdentity(ctx, &resolved.Header.Identity); err != nil { - return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) + if !identityResolved { + // Resolve the sending identity + if err := bm.identity.ResolveInputIdentity(ctx, &resolved.Header.Identity); err != nil { + return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) + } } // We optimize the DB storage of all the parts of the message using transaction semantics (assuming those are supported by the DB plugin @@ -64,7 +72,7 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin return nil } - out, err = bm.broadcastMessageCommon(ctx, resolved, false) + out, err = bm.broadcastMessageCommon(ctx, resolved, false, identityResolved) return err }) if err != nil { @@ -75,7 +83,7 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin if len(dataToPublish) > 0 { return bm.publishBlobsAndSend(ctx, resolved, dataToPublish, waitConfirm) } else if waitConfirm { - return bm.broadcastMessageCommon(ctx, resolved, true) + return bm.broadcastMessageCommon(ctx, resolved, true, identityResolved) } // The broadcastMessage function modifies the input message to create all the refs @@ -111,5 +119,5 @@ func (bm *broadcastManager) publishBlobsAndSend(ctx context.Context, msg *fftype } // Now we broadcast the message, as all data has been published - return bm.broadcastMessageCommon(ctx, msg, waitConfirm) + return bm.broadcastMessageCommon(ctx, msg, waitConfirm, false) } diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index 749e95e253..41c3b5ab0c 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -312,7 +312,7 @@ func (ag *aggregator) checkMaskedContextReady(ctx context.Context, msg *fftypes. if err != nil { return nil, err } - l.Debugf("Group=%s Topic='%s' NextPins=%v Sequence=%d Pin=%s NextPins=%v", msg.Header.Group, topic, nextPins, pinnedSequence, pin, nextPins) + l.Debugf("Group=%s Topic='%s' Sequence=%d Pin=%s NextPins=%v", msg.Header.Group, topic, pinnedSequence, pin, nextPins) if len(nextPins) == 0 { // If this is the first time we've seen the context, then this message is read as long as it is @@ -329,8 +329,8 @@ func (ag *aggregator) checkMaskedContextReady(ctx context.Context, msg *fftypes. break } } - if nextPin == nil || nextPin.Identity != msg.Header.Author { - l.Debugf("Mismatched nexthash or author group=%s topic=%s context=%s pin=%s nextHash=%+v", msg.Header.Group, topic, contextUnmasked, pin, nextPin) + if nextPin == nil || nextPin.Identity != msg.Header.Key { + l.Warnf("Mismatched nexthash or author group=%s topic=%s context=%s pin=%s nextHash=%+v", msg.Header.Group, topic, contextUnmasked, pin, nextPin) return nil, nil } return nextPin, nil diff --git a/internal/events/batch_pin_complete.go b/internal/events/batch_pin_complete.go index 448676ff48..36894e66b8 100644 --- a/internal/events/batch_pin_complete.go +++ b/internal/events/batch_pin_complete.go @@ -33,28 +33,28 @@ import ( // // We must block here long enough to get the payload from the publicstorage, persist the messages in the correct // sequence, and also persist all the data. -func (em *eventManager) BatchPinComplete(bi blockchain.Plugin, batchPin *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error { +func (em *eventManager) BatchPinComplete(bi blockchain.Plugin, batchPin *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error { - log.L(em.ctx).Infof("-> BatchPinComplete txn=%s author=%s", protocolTxID, signingIdentity) + log.L(em.ctx).Infof("-> BatchPinComplete txn=%s author=%s", protocolTxID, author) defer func() { - log.L(em.ctx).Infof("<- BatchPinComplete txn=%s author=%s", protocolTxID, signingIdentity) + log.L(em.ctx).Infof("<- BatchPinComplete txn=%s author=%s", protocolTxID, author) }() log.L(em.ctx).Tracef("BatchPinComplete info: %+v", additionalInfo) if batchPin.BatchPaylodRef != "" { - return em.handleBroadcastPinComplete(batchPin, signingIdentity, protocolTxID, additionalInfo) + return em.handleBroadcastPinComplete(batchPin, author, protocolTxID, additionalInfo) } - return em.handlePrivatePinComplete(batchPin, signingIdentity, protocolTxID, additionalInfo) + return em.handlePrivatePinComplete(batchPin, author, protocolTxID, additionalInfo) } -func (em *eventManager) handlePrivatePinComplete(batchPin *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error { +func (em *eventManager) handlePrivatePinComplete(batchPin *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error { // Here we simple record all the pins as parked, and emit an event for the aggregator // to check whether the messages in the batch have been written. return em.retry.Do(em.ctx, "persist private batch pins", func(attempt int) (bool, error) { // We process the batch into the DB as a single transaction (if transactions are supported), both for // efficiency and to minimize the chance of duplicates (although at-least-once delivery is the core model) err := em.database.RunAsGroup(em.ctx, func(ctx context.Context) error { - valid, err := em.persistBatchTransaction(ctx, batchPin, signingIdentity, protocolTxID, additionalInfo) + valid, err := em.persistBatchTransaction(ctx, batchPin, author, protocolTxID, additionalInfo) if valid && err == nil { err = em.persistContexts(ctx, batchPin, true) } diff --git a/internal/events/dx_callbacks.go b/internal/events/dx_callbacks.go index 9d185440bd..6bef3fb05f 100644 --- a/internal/events/dx_callbacks.go +++ b/internal/events/dx_callbacks.go @@ -65,7 +65,8 @@ func (em *eventManager) MessageReceived(dx dataexchange.Plugin, peerID string, d } -func (em *eventManager) checkReceivedIdentity(ctx context.Context, peerID string, author string) (node *fftypes.Node, err error) { +// Why does the node itself matter here? +func (em *eventManager) checkReceivedIdentity(ctx context.Context, peerID, author, signingKey string) (node *fftypes.Node, err error) { l := log.L(em.ctx) // Find the node associated with the peer @@ -82,7 +83,7 @@ func (em *eventManager) checkReceivedIdentity(ctx context.Context, peerID string node = nodes[0] // Find the identity in the mesage - org, err := em.database.GetOrganizationByIdentity(ctx, author) + org, err := em.database.GetOrganizationByIdentity(ctx, signingKey) if err != nil { l.Errorf("Failed to retrieve org: %v", err) return nil, err // retry for persistence error @@ -94,7 +95,7 @@ func (em *eventManager) checkReceivedIdentity(ctx context.Context, peerID string // One of the orgs in the hierarchy of the author must be the owner of the peer node candidate := org - foundNodeOrg := author == node.Owner + foundNodeOrg := signingKey == node.Owner for !foundNodeOrg && candidate.Parent != "" { parent := candidate.Parent candidate, err = em.database.GetOrganizationByIdentity(ctx, parent) @@ -123,7 +124,7 @@ func (em *eventManager) pinedBatchReceived(peerID string, batch *fftypes.Batch) return true, em.database.RunAsGroup(em.ctx, func(ctx context.Context) error { l := log.L(ctx) - node, err := em.checkReceivedIdentity(ctx, peerID, batch.Author) + node, err := em.checkReceivedIdentity(ctx, peerID, batch.Author, batch.Key) if err != nil { return err } @@ -279,7 +280,7 @@ func (em *eventManager) unpinnedMessageReceived(peerID string, message *fftypes. return err } - node, err := em.checkReceivedIdentity(ctx, peerID, message.Header.Author) + node, err := em.checkReceivedIdentity(ctx, peerID, message.Header.Author, message.Header.Key) if err != nil { return err } diff --git a/internal/events/event_manager.go b/internal/events/event_manager.go index 77c2fb973a..20cd46bb0b 100644 --- a/internal/events/event_manager.go +++ b/internal/events/event_manager.go @@ -54,7 +54,7 @@ type EventManager interface { // Bound blockchain callbacks TxSubmissionUpdate(plugin fftypes.Named, tx string, txState blockchain.TransactionStatus, errorMessage string, additionalInfo fftypes.JSONObject) error - BatchPinComplete(bi blockchain.Plugin, batch *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error + BatchPinComplete(bi blockchain.Plugin, batch *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error // Bound dataexchange callbacks TransferResult(dx dataexchange.Plugin, trackingID string, status fftypes.OpStatus, info string, additionalInfo fftypes.JSONObject) error diff --git a/internal/events/persist_batch.go b/internal/events/persist_batch.go index 2b22de5136..0910e5a895 100644 --- a/internal/events/persist_batch.go +++ b/internal/events/persist_batch.go @@ -18,6 +18,7 @@ package events import ( "context" + "encoding/json" "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/pkg/database" @@ -33,7 +34,9 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c if err != nil { return false, err } - if author == "" || author != batch.Author || signingKey != batch.Key { + + // The special case of a root org broadcast is allowed to not have a resolved author, because it's not in the database yet + if !em.isRootOrgBroadcast(batch) && (author == "" || author != batch.Author) || signingKey != batch.Key { l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Key, batch.Author, signingKey, author) return false, nil // This is not retryable. skip this batch } @@ -47,6 +50,26 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c return valid, err } +func (em *eventManager) isRootOrgBroadcast(batch *fftypes.Batch) bool { + // Look into batch to see if it contains a message that contains a data item that is a root organization definition + for _, message := range batch.Payload.Messages { + if message.Header.Type == fftypes.MessageTypeBroadcast { + for _, messageDataItem := range message.Data { + for _, batchDataItem := range batch.Payload.Data { + if batchDataItem.ID.Equals(messageDataItem.ID) { + var org *fftypes.Organization + json.Unmarshal(batchDataItem.Value, &org) + if org != nil && org.Parent == "" { + return true + } + } + } + } + } + } + return false +} + // persistBatch performs very simple validation on each message/data element (hashes) and either persists // or discards them. Errors are returned only in the case of database failures, which should be retried. func (em *eventManager) persistBatch(ctx context.Context /* db TX context*/, batch *fftypes.Batch) (valid bool, err error) { diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index 8c4cd6f3a1..5a97d06617 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -41,6 +41,8 @@ type Manager interface { ResolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (author string, err error) ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) + OrgDID(org *fftypes.Organization) string + GetLocalOrganization(ctx context.Context) (*fftypes.Organization, error) } type identityManager struct { @@ -77,7 +79,11 @@ func NewIdentityManager(ctx context.Context, di database.Plugin, ii identity.Plu return im, nil } -func orgDID(org *fftypes.Organization) string { +func (im *identityManager) GetLocalOrganization(ctx context.Context) (*fftypes.Organization, error) { + return im.cachedOrgLookupByAuthor(ctx, im.localOrgDID) +} + +func (im *identityManager) OrgDID(org *fftypes.Organization) string { if org == nil { return "" } @@ -116,7 +122,7 @@ func (im *identityManager) ResolveSigningKeyIdentity(ctx context.Context, signin return "", err } - return orgDID(org), nil + return im.OrgDID(org), nil } @@ -237,7 +243,7 @@ func (im *identityManager) resolveInputAuthor(ctx context.Context, identity *fft } // We normalize the author to the DID - identity.Author = orgDID(org) + identity.Author = im.OrgDID(org) return nil } diff --git a/internal/networkmap/register_org.go b/internal/networkmap/register_org.go index 5726fcb0db..5f006bc378 100644 --- a/internal/networkmap/register_org.go +++ b/internal/networkmap/register_org.go @@ -105,7 +105,7 @@ func (nm *networkMap) RegisterOrganization(ctx context.Context, org *fftypes.Org } } - return nm.broadcast.BroadcastDefinition(ctx, org, &fftypes.Identity{ + return nm.broadcast.BroadcastRootOrgDefinition(ctx, org, &fftypes.Identity{ Key: signingIdentityString, }, fftypes.SystemTagDefineOrganization, waitConfirm) } diff --git a/internal/orchestrator/bound_callbacks.go b/internal/orchestrator/bound_callbacks.go index 5026a1fd4c..0f6c8873a1 100644 --- a/internal/orchestrator/bound_callbacks.go +++ b/internal/orchestrator/bound_callbacks.go @@ -38,8 +38,8 @@ func (bc *boundCallbacks) TokensTxUpdate(plugin tokens.Plugin, tx string, txStat return bc.ei.TxSubmissionUpdate(plugin, tx, txState, errorMessage, additionalInfo) } -func (bc *boundCallbacks) BatchPinComplete(batch *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error { - return bc.ei.BatchPinComplete(bc.bi, batch, signingIdentity, protocolTxID, additionalInfo) +func (bc *boundCallbacks) BatchPinComplete(batch *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error { + return bc.ei.BatchPinComplete(bc.bi, batch, author, protocolTxID, additionalInfo) } func (bc *boundCallbacks) TransferResult(trackingID string, status fftypes.OpStatus, info string, additionalInfo fftypes.JSONObject) error { diff --git a/internal/privatemessaging/message.go b/internal/privatemessaging/message.go index 906a6dc9b6..b7712fd35e 100644 --- a/internal/privatemessaging/message.go +++ b/internal/privatemessaging/message.go @@ -93,7 +93,7 @@ func (pm *privateMessaging) sendOrWaitMessage(ctx context.Context, msg *fftypes. if immediateConfirm { msg.Confirmed = fftypes.Now() msg.Pending = false - msg.Header.Key = "" // there is no on-chain signing assurance with this message + // msg.Header.Key = "" // there is no on-chain signing assurance with this message } // Store the message - this asynchronously triggers the next step in process diff --git a/internal/privatemessaging/recipients.go b/internal/privatemessaging/recipients.go index 722fc5be94..9b940500ff 100644 --- a/internal/privatemessaging/recipients.go +++ b/internal/privatemessaging/recipients.go @@ -111,6 +111,11 @@ func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.Mess return nil, err } + localOrg, err := pm.identity.GetLocalOrganization(ctx) + if err != nil { + return nil, err + } + foundLocal := false gi = &fftypes.GroupIdentity{ Namespace: in.Message.Header.Namespace, @@ -137,7 +142,7 @@ func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.Mess } if !foundLocal { // Add in the local org identity - localNodeID, err := pm.resolveLocalNode(ctx, localOrgDID) + localNodeID, err := pm.resolveLocalNode(ctx, localOrg.Identity) if err != nil { return nil, err } @@ -149,13 +154,13 @@ func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.Mess return gi, nil } -func (pm *privateMessaging) resolveLocalNode(ctx context.Context, localOrgDID string) (*fftypes.UUID, error) { +func (pm *privateMessaging) resolveLocalNode(ctx context.Context, localOrgSigningKey string) (*fftypes.UUID, error) { if pm.localNodeID != nil { return pm.localNodeID, nil } fb := database.NodeQueryFactory.NewFilterLimit(ctx, 1) filter := fb.And( - fb.Eq("owner", localOrgDID), + fb.Eq("owner", localOrgSigningKey), fb.Eq("name", pm.localNodeName), ) nodes, _, err := pm.database.GetNodes(ctx, filter) diff --git a/internal/syshandlers/syshandler_network_node.go b/internal/syshandlers/syshandler_network_node.go index aec069f7ab..913b05fdf2 100644 --- a/internal/syshandlers/syshandler_network_node.go +++ b/internal/syshandlers/syshandler_network_node.go @@ -46,7 +46,7 @@ func (sh *systemHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes. return false, nil } - if msg.Header.Author != node.Owner { + if msg.Header.Key != node.Owner { l.Warnf("Unable to process node broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, node.Owner, msg.Header.Author) return false, nil } diff --git a/internal/syshandlers/syshandler_network_org.go b/internal/syshandlers/syshandler_network_org.go index ec4758dfaf..27d517fae7 100644 --- a/internal/syshandlers/syshandler_network_org.go +++ b/internal/syshandlers/syshandler_network_org.go @@ -37,23 +37,23 @@ func (sh *systemHandlers) handleOrganizationBroadcast(ctx context.Context, msg * return false, nil } - signingIdentity := org.Identity - if org.Parent != "" { - signingIdentity = org.Parent - parent, err := sh.database.GetOrganizationByIdentity(ctx, org.Parent) - if err != nil { - return false, err // We only return database errors - } - if parent == nil { - l.Warnf("Unable to process organization broadcast %s - parent identity not found: %s", msg.Header.ID, org.Parent) - return false, nil - } - } + // signingIdentity := org.Identity + // if org.Parent != "" { + // signingIdentity = org.Parent + // parent, err := sh.database.GetOrganizationByIdentity(ctx, org.Parent) + // if err != nil { + // return false, err // We only return database errors + // } + // if parent == nil { + // l.Warnf("Unable to process organization broadcast %s - parent identity not found: %s", msg.Header.ID, org.Parent) + // return false, nil + // } + // } - if msg.Header.Author != signingIdentity { - l.Warnf("Unable to process organization broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, signingIdentity, msg.Header.Author) - return false, nil - } + // if msg.Header.Author != signingIdentity { + // l.Warnf("Unable to process organization broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, signingIdentity, msg.Header.Author) + // return false, nil + // } existing, err := sh.database.GetOrganizationByIdentity(ctx, org.Identity) if err == nil && existing == nil { diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 9229372adb..d10fa03136 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -354,31 +354,31 @@ func TestE2EPrivateBlob(t *testing.T) { assert.Regexp(t, "myfile.txt", string(val2)) } -func TestE2ETokenPool(t *testing.T) { +// func TestE2ETokenPool(t *testing.T) { - ts := beforeE2ETest(t) - defer ts.done() +// ts := beforeE2ETest(t) +// defer ts.done() - received1, changes1 := wsReader(t, ts.ws1) - received2, changes2 := wsReader(t, ts.ws2) +// received1, changes1 := wsReader(t, ts.ws1) +// received2, changes2 := wsReader(t, ts.ws2) - var resp *resty.Response - pool := fftypes.TokenPool{ - Name: "my-pool", - } +// var resp *resty.Response +// pool := fftypes.TokenPool{ +// Name: "my-pool", +// } - resp, err := CreateTokenPool(ts.client1, &pool) - require.NoError(t, err) - assert.Equal(t, 202, resp.StatusCode()) +// resp, err := CreateTokenPool(ts.client1, &pool) +// require.NoError(t, err) +// assert.Equal(t, 202, resp.StatusCode()) - <-received1 - <-changes1 // also expect database change events - // TODO: validate created pool +// <-received1 +// <-changes1 // also expect database change events +// // TODO: validate created pool - <-received2 - <-changes2 // also expect database change events - // TODO: validate created pool -} +// <-received2 +// <-changes2 // also expect database change events +// // TODO: validate created pool +// } func TestE2EWebhookExchange(t *testing.T) { From 0d369c169dd714ee139ac8d21a347ee7d9531bc5 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Tue, 28 Sep 2021 16:43:36 -0400 Subject: [PATCH 06/15] Fix private messaging with new identities Signed-off-by: Nicko Guyer --- internal/events/aggregator.go | 4 ++-- internal/identity/identitymanager.go | 13 +++---------- internal/privatemessaging/recipients.go | 5 +++-- pkg/fftypes/organization.go | 11 +++++++++++ test/e2e/e2e_test.go | 4 ++-- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index 41c3b5ab0c..a0dc30f729 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -316,7 +316,7 @@ func (ag *aggregator) checkMaskedContextReady(ctx context.Context, msg *fftypes. if len(nextPins) == 0 { // If this is the first time we've seen the context, then this message is read as long as it is - // the first (nonce=0) message on the context, for one of the members, and there aren't any earlier + // the first (nonce=0) message onw the context, for one of the members, and there aren't any earlier // messages that are nonce=0. return ag.attemptContextInit(ctx, msg, topic, pinnedSequence, contextUnmasked, pin) } @@ -329,7 +329,7 @@ func (ag *aggregator) checkMaskedContextReady(ctx context.Context, msg *fftypes. break } } - if nextPin == nil || nextPin.Identity != msg.Header.Key { + if nextPin == nil || nextPin.Identity != msg.Header.Author { l.Warnf("Mismatched nexthash or author group=%s topic=%s context=%s pin=%s nextHash=%+v", msg.Header.Group, topic, contextUnmasked, pin, nextPin) return nil, nil } diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index 5a97d06617..8deedd7792 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -32,10 +32,6 @@ import ( "github.com/karlseguin/ccache" ) -const ( - fireflyOrgDIDPrefix = "did:firefly:org/" -) - type Manager interface { ResolveInputIdentity(ctx context.Context, identity *fftypes.Identity) (err error) ResolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) @@ -84,10 +80,7 @@ func (im *identityManager) GetLocalOrganization(ctx context.Context) (*fftypes.O } func (im *identityManager) OrgDID(org *fftypes.Organization) string { - if org == nil { - return "" - } - return fmt.Sprintf("%s%s", fireflyOrgDIDPrefix, org.ID) + return org.GetDID() } // ResolveInputIdentity takes in identity input information from an API call, or configuration load, and resolves @@ -186,8 +179,8 @@ func (im *identityManager) cachedOrgLookupByAuthor(ctx context.Context, author s // TODO: Per comments in https://github.com/hyperledger-labs/firefly/issues/187 we need to resolve whether "Organization" // is the right thing to resolve here. We might want to fall-back to that in the case of plain string, but likely // we need something more sophisticated here where we have an Identity object in the database. - if strings.HasPrefix(author, fireflyOrgDIDPrefix) { - orgUUID, err := fftypes.ParseUUID(ctx, strings.TrimPrefix(author, fireflyOrgDIDPrefix)) + if strings.HasPrefix(author, fftypes.FireflyOrgDIDPrefix) { + orgUUID, err := fftypes.ParseUUID(ctx, strings.TrimPrefix(author, fftypes.FireflyOrgDIDPrefix)) if err != nil { return nil, err } diff --git a/internal/privatemessaging/recipients.go b/internal/privatemessaging/recipients.go index 9b940500ff..a0988802f2 100644 --- a/internal/privatemessaging/recipients.go +++ b/internal/privatemessaging/recipients.go @@ -52,6 +52,7 @@ func (pm *privateMessaging) resolveOrg(ctx context.Context, orgInput string) (or orgID, err := fftypes.ParseUUID(ctx, orgInput) if err == nil { org, err = pm.database.GetOrganizationByID(ctx, orgID) + } else { org, err = pm.database.GetOrganizationByName(ctx, orgInput) if err == nil && org == nil { @@ -134,9 +135,9 @@ func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.Mess if err != nil { return nil, err } - foundLocal = foundLocal || (node.Owner == localOrgDID && node.Name == pm.localNodeName) + foundLocal = foundLocal || (node.Owner == localOrg.Identity && node.Name == pm.localNodeName) gi.Members[i] = &fftypes.Member{ - Identity: org.Identity, + Identity: org.GetDID(), Node: node.ID, } } diff --git a/pkg/fftypes/organization.go b/pkg/fftypes/organization.go index 61cffc245d..f6ed435772 100644 --- a/pkg/fftypes/organization.go +++ b/pkg/fftypes/organization.go @@ -25,6 +25,10 @@ import ( "github.com/hyperledger-labs/firefly/internal/i18n" ) +const ( + FireflyOrgDIDPrefix = "did:firefly:org/" +) + // Organization is a top-level identity in the network type Organization struct { ID *UUID `json:"id"` @@ -74,3 +78,10 @@ func (org *Organization) Topic() string { func (org *Organization) SetBroadcastMessage(msgID *UUID) { org.Message = msgID } + +func (org *Organization) GetDID() string { + if org == nil { + return "" + } + return fmt.Sprintf("%s%s", FireflyOrgDIDPrefix, org.ID) +} diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index d10fa03136..b3451b607a 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -394,7 +394,7 @@ func TestE2EWebhookExchange(t *testing.T) { "name": "myhook", "options": { "withData": true, - "url": "https://raw.githubusercontent.com/hyperledger-labs/firefly/main/test/data/config/firefly.core.yaml", + "url": "https://raw.githubusercontent.com/hyperledger/firefly/main/test/data/config/firefly.core.yaml", "reply": true, "replytag": "myreply", "method": "GET" @@ -448,7 +448,7 @@ func TestE2EWebhookRequestReplyNoTx(t *testing.T) { "name": "myhook", "options": { "withData": true, - "url": "https://github.com/hyperledger-labs/firefly/raw/main/resources/ff-logo-32.png", + "url": "https://github.com/hyperledger/firefly/raw/main/resources/ff-logo-32.png", "reply": true, "replytag": "myreply", "replytx": "none", From e5f781981efa94041c1bb35c52e3ad15e9da2e95 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Fri, 1 Oct 2021 10:21:30 -0400 Subject: [PATCH 07/15] Fix unit tests and E2E tests Signed-off-by: Nicko Guyer --- internal/broadcast/manager_test.go | 4 +- internal/database/difactory/plugins_cgo.go | 1 + internal/database/sqlite3/config.go | 1 + internal/database/sqlite3/sqlite3.go | 1 + internal/events/dx_callbacks.go | 1 - internal/events/dx_callbacks_test.go | 42 ++++++++-------- internal/events/persist_batch.go | 18 +++++-- internal/identity/identitymanager_test.go | 8 +-- internal/networkmap/register_org_test.go | 4 +- internal/privatemessaging/message_test.go | 3 ++ internal/privatemessaging/recipients_test.go | 50 ++++++++++++++----- .../syshandler_network_node_test.go | 34 ++++++++----- .../syshandlers/syshandler_network_org.go | 18 ------- .../syshandler_network_org_test.go | 34 +++++++------ mocks/broadcastmocks/manager.go | 37 +++++++++++--- mocks/eventmocks/event_manager.go | 8 +-- mocks/identitymanagermocks/manager.go | 37 ++++++++++++++ 17 files changed, 199 insertions(+), 102 deletions(-) diff --git a/internal/broadcast/manager_test.go b/internal/broadcast/manager_test.go index c27ccc78ef..681c9e41ae 100644 --- a/internal/broadcast/manager_test.go +++ b/internal/broadcast/manager_test.go @@ -67,7 +67,7 @@ func TestBroadcastMessageGood(t *testing.T) { msg := &fftypes.Message{} bm.database.(*databasemocks.Plugin).On("InsertMessageLocal", mock.Anything, msg).Return(nil) - msgRet, err := bm.broadcastMessageCommon(context.Background(), msg, false) + msgRet, err := bm.broadcastMessageCommon(context.Background(), msg, false, false) assert.NoError(t, err) assert.Equal(t, msg, msgRet) @@ -87,7 +87,7 @@ func TestBroadcastMessageBad(t *testing.T) { } bm.database.(*databasemocks.Plugin).On("UpsertMessage", mock.Anything, msg, false).Return(nil) - _, err := bm.broadcastMessageCommon(context.Background(), msg, false) + _, err := bm.broadcastMessageCommon(context.Background(), msg, false, false) assert.Regexp(t, "FF10144", err) } diff --git a/internal/database/difactory/plugins_cgo.go b/internal/database/difactory/plugins_cgo.go index 632ebfe89e..12d7e4d6aa 100644 --- a/internal/database/difactory/plugins_cgo.go +++ b/internal/database/difactory/plugins_cgo.go @@ -14,6 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cgo // +build cgo package difactory diff --git a/internal/database/sqlite3/config.go b/internal/database/sqlite3/config.go index b5b9fe8b9b..15edbda15f 100644 --- a/internal/database/sqlite3/config.go +++ b/internal/database/sqlite3/config.go @@ -14,6 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cgo // +build cgo package sqlite3 diff --git a/internal/database/sqlite3/sqlite3.go b/internal/database/sqlite3/sqlite3.go index 7e4eec4d54..01bf3ad833 100644 --- a/internal/database/sqlite3/sqlite3.go +++ b/internal/database/sqlite3/sqlite3.go @@ -14,6 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cgo // +build cgo package sqlite3 diff --git a/internal/events/dx_callbacks.go b/internal/events/dx_callbacks.go index 6bef3fb05f..1e45b090dc 100644 --- a/internal/events/dx_callbacks.go +++ b/internal/events/dx_callbacks.go @@ -65,7 +65,6 @@ func (em *eventManager) MessageReceived(dx dataexchange.Plugin, peerID string, d } -// Why does the node itself matter here? func (em *eventManager) checkReceivedIdentity(ctx context.Context, peerID, author, signingKey string) (node *fftypes.Node, err error) { l := log.L(em.ctx) diff --git a/internal/events/dx_callbacks_test.go b/internal/events/dx_callbacks_test.go index c023158557..96864d009c 100644 --- a/internal/events/dx_callbacks_test.go +++ b/internal/events/dx_callbacks_test.go @@ -56,8 +56,8 @@ func TestMessageReceiveOK(t *testing.T) { mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ {Name: "node1", Owner: "parentOrg"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", Parent: "parentOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", Parent: "parentOrg", }, nil) mdi.On("GetOrganizationByIdentity", em.ctx, "parentOrg").Return(&fftypes.Organization{ Identity: "parentOrg", @@ -91,8 +91,8 @@ func TestMessageReceiveOkBadBatchIgnored(t *testing.T) { mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ {Name: "node1", Owner: "parentOrg"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", Parent: "parentOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", Parent: "parentOrg", }, nil) mdi.On("GetOrganizationByIdentity", em.ctx, "parentOrg").Return(&fftypes.Organization{ Identity: "parentOrg", @@ -131,8 +131,8 @@ func TestMessageReceivePersistBatchError(t *testing.T) { mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ {Name: "node1", Owner: "parentOrg"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", Parent: "parentOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", Parent: "parentOrg", }, nil) mdi.On("GetOrganizationByIdentity", em.ctx, "parentOrg").Return(&fftypes.Organization{ Identity: "parentOrg", @@ -298,8 +298,8 @@ func TestMessageReceiveGetCandidateOrgFail(t *testing.T) { mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ {Name: "node1", Owner: "parentOrg"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", Parent: "parentOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", Parent: "parentOrg", }, nil) mdi.On("GetOrganizationByIdentity", em.ctx, "parentOrg").Return(nil, fmt.Errorf("pop")) err := em.MessageReceived(mdx, "peer1", b) @@ -330,8 +330,8 @@ func TestMessageReceiveGetCandidateOrgNotFound(t *testing.T) { mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ {Name: "node1", Owner: "parentOrg"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", Parent: "parentOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", Parent: "parentOrg", }, nil) mdi.On("GetOrganizationByIdentity", em.ctx, "parentOrg").Return(nil, nil) err := em.MessageReceived(mdx, "peer1", b) @@ -362,8 +362,8 @@ func TestMessageReceiveGetCandidateOrgNotMatch(t *testing.T) { mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ {Name: "node1", Owner: "another"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", Parent: "parentOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", Parent: "parentOrg", }, nil) mdi.On("GetOrganizationByIdentity", em.ctx, "parentOrg").Return(&fftypes.Organization{ Identity: "parentOrg", @@ -676,10 +676,10 @@ func TestMessageReceiveMessagePersistMessageFail(t *testing.T) { msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ - {Name: "node1", Owner: "signingOrg"}, + {Name: "node1", Owner: "0x12345"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", }, nil) mdi.On("UpsertMessage", em.ctx, mock.Anything, true, false).Return(fmt.Errorf("pop")) @@ -726,10 +726,10 @@ func TestMessageReceiveMessagePersistDataFail(t *testing.T) { msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ - {Name: "node1", Owner: "signingOrg"}, + {Name: "node1", Owner: "0x12345"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", }, nil) mdi.On("UpsertData", em.ctx, mock.Anything, true, false).Return(fmt.Errorf("pop")) @@ -776,10 +776,10 @@ func TestMessageReceiveMessagePersistEventFail(t *testing.T) { msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ - {Name: "node1", Owner: "signingOrg"}, + {Name: "node1", Owner: "0x12345"}, }, nil, nil) - mdi.On("GetOrganizationByIdentity", em.ctx, "signingOrg").Return(&fftypes.Organization{ - Identity: "signingOrg", + mdi.On("GetOrganizationByIdentity", em.ctx, "0x12345").Return(&fftypes.Organization{ + Identity: "0x12345", }, nil) mdi.On("UpsertData", em.ctx, mock.Anything, true, false).Return(nil) mdi.On("UpsertMessage", em.ctx, mock.Anything, true, false).Return(nil) diff --git a/internal/events/persist_batch.go b/internal/events/persist_batch.go index 0910e5a895..13e2bcf990 100644 --- a/internal/events/persist_batch.go +++ b/internal/events/persist_batch.go @@ -35,8 +35,13 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c return false, err } + isRootOrgBroadcast, err := em.isRootOrgBroadcast(batch) + if err != nil { + return false, err + } + // The special case of a root org broadcast is allowed to not have a resolved author, because it's not in the database yet - if !em.isRootOrgBroadcast(batch) && (author == "" || author != batch.Author) || signingKey != batch.Key { + if !isRootOrgBroadcast && (author == "" || author != batch.Author) || signingKey != batch.Key { l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Key, batch.Author, signingKey, author) return false, nil // This is not retryable. skip this batch } @@ -50,7 +55,7 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c return valid, err } -func (em *eventManager) isRootOrgBroadcast(batch *fftypes.Batch) bool { +func (em *eventManager) isRootOrgBroadcast(batch *fftypes.Batch) (bool, error) { // Look into batch to see if it contains a message that contains a data item that is a root organization definition for _, message := range batch.Payload.Messages { if message.Header.Type == fftypes.MessageTypeBroadcast { @@ -58,16 +63,19 @@ func (em *eventManager) isRootOrgBroadcast(batch *fftypes.Batch) bool { for _, batchDataItem := range batch.Payload.Data { if batchDataItem.ID.Equals(messageDataItem.ID) { var org *fftypes.Organization - json.Unmarshal(batchDataItem.Value, &org) + err := json.Unmarshal(batchDataItem.Value, &org) + if err != nil { + return false, nil + } if org != nil && org.Parent == "" { - return true + return true, nil } } } } } } - return false + return false, nil } // persistBatch performs very simple validation on each message/data element (hashes) and either persists diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go index 69c981c81f..38a4bdc257 100644 --- a/internal/identity/identitymanager_test.go +++ b/internal/identity/identitymanager_test.go @@ -341,12 +341,12 @@ func TestResolveSigningKeyIdentityOrgLookupOkCached(t *testing.T) { author, err := im.ResolveSigningKeyIdentity(ctx, "key1") assert.NoError(t, err) - assert.Equal(t, orgDID(org), author) + assert.Equal(t, im.OrgDID(org), author) // Cached second time, without any DB call (see "Once()" above) author, err = im.ResolveSigningKeyIdentity(ctx, "key1") assert.NoError(t, err) - assert.Equal(t, orgDID(org), author) + assert.Equal(t, im.OrgDID(org), author) mbi.AssertExpectations(t) } @@ -384,12 +384,12 @@ func TestResolveLocalOrgDIDSuccess(t *testing.T) { localOrgDID, err := im.ResolveLocalOrgDID(ctx) assert.NoError(t, err) - assert.Equal(t, orgDID(org), localOrgDID) + assert.Equal(t, im.OrgDID(org), localOrgDID) // Second one cached localOrgDID, err = im.ResolveLocalOrgDID(ctx) assert.NoError(t, err) - assert.Equal(t, orgDID(org), localOrgDID) + assert.Equal(t, im.OrgDID(org), localOrgDID) mbi.AssertExpectations(t) diff --git a/internal/networkmap/register_org_test.go b/internal/networkmap/register_org_test.go index f32d764915..801e26e584 100644 --- a/internal/networkmap/register_org_test.go +++ b/internal/networkmap/register_org_test.go @@ -46,7 +46,7 @@ func TestRegisterOrganizationChildOk(t *testing.T) { mockMsg := &fftypes.Message{Header: fftypes.MessageHeader{ID: fftypes.NewUUID()}} mbm := nm.broadcast.(*broadcastmocks.Manager) - mbm.On("BroadcastDefinition", nm.ctx, mock.Anything, parentID, fftypes.SystemTagDefineOrganization, false).Return(mockMsg, nil) + mbm.On("BroadcastRootOrgDefinition", nm.ctx, mock.Anything, parentID, fftypes.SystemTagDefineOrganization, false).Return(mockMsg, nil) msg, err := nm.RegisterOrganization(nm.ctx, &fftypes.Organization{ Name: "org1", @@ -75,7 +75,7 @@ func TestRegisterNodeOrganizationRootOk(t *testing.T) { mockMsg := &fftypes.Message{Header: fftypes.MessageHeader{ID: fftypes.NewUUID()}} mbm := nm.broadcast.(*broadcastmocks.Manager) - mbm.On("BroadcastDefinition", nm.ctx, mock.Anything, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" }), fftypes.SystemTagDefineOrganization, true).Return(mockMsg, nil) + mbm.On("BroadcastRootOrgDefinition", nm.ctx, mock.Anything, mock.MatchedBy(func(i *fftypes.Identity) bool { return i.Key == "0x12345" }), fftypes.SystemTagDefineOrganization, true).Return(mockMsg, nil) org, msg, err := nm.RegisterNodeOrganization(nm.ctx, true) assert.NoError(t, err) diff --git a/internal/privatemessaging/message_test.go b/internal/privatemessaging/message_test.go index 327b09def8..8c39159cc6 100644 --- a/internal/privatemessaging/message_test.go +++ b/internal/privatemessaging/message_test.go @@ -40,6 +40,7 @@ func TestSendConfirmMessageE2EOk(t *testing.T) { mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Return(nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) dataID := fftypes.NewUUID() mdm := pm.data.(*datamocks.Manager) @@ -260,8 +261,10 @@ func TestResolveAndSendBadInlineData(t *testing.T) { mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) mdi := pm.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByName", pm.ctx, "localorg").Return(&fftypes.Organization{ ID: fftypes.NewUUID(), }, nil) diff --git a/internal/privatemessaging/recipients_test.go b/internal/privatemessaging/recipients_test.go index cbad82ceae..3a15ff94ff 100644 --- a/internal/privatemessaging/recipients_test.go +++ b/internal/privatemessaging/recipients_test.go @@ -36,15 +36,26 @@ func TestResolveMemberListNewGroupE2E(t *testing.T) { mdi := pm.database.(*databasemocks.Plugin) nodeIDRemote := fftypes.NewUUID() nodeIDLocal := fftypes.NewUUID() - orgID := fftypes.NewUUID() + orgIDLocal := fftypes.NewUUID() + orgIDRemote := fftypes.NewUUID() + + orgNameRemote := "remoteOrg" + + signingKeyLocal := "localSigningKey" + signingKeyRemote := "remoteSigningKey" + + orgDIDLocal := "did:firefly:org/" + orgIDLocal.String() + orgDIDRemote := "did:firefly:org/" + orgIDRemote.String() + var dataID *fftypes.UUID - mdi.On("GetOrganizationByName", pm.ctx, mock.Anything).Return(&fftypes.Organization{ID: orgID, Identity: "remoteorg"}, nil) - mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: nodeIDRemote, Name: "node2", Owner: "remoteorg"}}, nil, nil).Once() - mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: nodeIDLocal, Name: "node1", Owner: "localorg"}}, nil, nil).Once() + mdi.On("GetOrganizationByName", pm.ctx, orgNameRemote).Return(&fftypes.Organization{ID: orgIDRemote, Identity: signingKeyRemote}, nil) + mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: nodeIDRemote, Name: "node2", Owner: signingKeyRemote}}, nil, nil).Once() + mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{{ID: nodeIDLocal, Name: "node1", Owner: signingKeyLocal}}, nil, nil).Once() mdi.On("GetGroups", pm.ctx, mock.Anything).Return([]*fftypes.Group{}, nil, nil) mdi.On("UpsertGroup", pm.ctx, mock.Anything, true).Return(nil) mim := pm.identity.(*identitymanagermocks.Manager) - mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("ResolveLocalOrgDID", pm.ctx).Return(orgDIDLocal, nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: signingKeyLocal}, nil) ud := mdi.On("UpsertData", pm.ctx, mock.Anything, true, false).Return(nil) ud.RunFn = func(a mock.Arguments) { data := a[1].(*fftypes.Data) @@ -54,12 +65,21 @@ func TestResolveMemberListNewGroupE2E(t *testing.T) { err := json.Unmarshal(data.Value, &group) assert.NoError(t, err) assert.Len(t, group.Members, 2) - // Note localorg comes first, as we sort groups before hashing - assert.Equal(t, "localorg", group.Members[0].Identity) - assert.Equal(t, *nodeIDLocal, *group.Members[0].Node) - assert.Equal(t, "remoteorg", group.Members[1].Identity) - assert.Equal(t, *nodeIDRemote, *group.Members[1].Node) - assert.Nil(t, group.Ledger) + // Group identiy is sorted by group members DIDs so check them in that order + if orgDIDLocal < orgDIDRemote { + assert.Equal(t, orgDIDLocal, group.Members[0].Identity) + assert.Equal(t, *nodeIDLocal, *group.Members[0].Node) + assert.Equal(t, orgDIDRemote, group.Members[1].Identity) + assert.Equal(t, *nodeIDRemote, *group.Members[1].Node) + assert.Nil(t, group.Ledger) + } else { + assert.Equal(t, orgDIDRemote, group.Members[0].Identity) + assert.Equal(t, *nodeIDRemote, *group.Members[1].Node) + assert.Equal(t, orgDIDLocal, group.Members[1].Identity) + assert.Equal(t, *nodeIDLocal, *group.Members[0].Node) + assert.Nil(t, group.Ledger) + } + dataID = data.ID } um := mdi.On("InsertMessageLocal", pm.ctx, mock.Anything).Return(nil).Once() @@ -82,7 +102,7 @@ func TestResolveMemberListNewGroupE2E(t *testing.T) { }, Group: &fftypes.InputGroup{ Members: []fftypes.MemberInput{ - {Identity: "remoteorg"}, + {Identity: orgNameRemote}, }, }, }) @@ -104,6 +124,7 @@ func TestResolveMemberListExistingGroup(t *testing.T) { }, nil, nil) mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -135,6 +156,7 @@ func TestResolveMemberListGetGroupsFail(t *testing.T) { mdi.On("GetGroups", pm.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")) mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -192,6 +214,7 @@ func TestResolveMemberListMissingLocalMemberLookupFailed(t *testing.T) { mdi.On("GetNodes", pm.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")).Once() mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -222,6 +245,7 @@ func TestResolveMemberListNodeNotFound(t *testing.T) { mdi.On("GetNodes", pm.ctx, mock.Anything).Return([]*fftypes.Node{}, nil, nil) mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -252,6 +276,7 @@ func TestResolveMemberOrgNameNotFound(t *testing.T) { mdi.On("GetOrganizationByIdentity", pm.ctx, "org1").Return(nil, nil) mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ @@ -286,6 +311,7 @@ func TestResolveMemberNodeOwnedParentOrg(t *testing.T) { mdi.On("GetGroups", pm.ctx, mock.Anything).Return([]*fftypes.Group{{Hash: fftypes.NewRandB32()}}, nil, nil) mim := pm.identity.(*identitymanagermocks.Manager) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(&fftypes.Organization{Identity: "localorg"}, nil) err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ Message: fftypes.Message{ diff --git a/internal/syshandlers/syshandler_network_node_test.go b/internal/syshandlers/syshandler_network_node_test.go index ab05c10552..9a63f370b7 100644 --- a/internal/syshandlers/syshandler_network_node_test.go +++ b/internal/syshandlers/syshandler_network_node_test.go @@ -59,8 +59,8 @@ func TestHandleSystemBroadcastNodeOk(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -99,7 +99,8 @@ func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -140,7 +141,8 @@ func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -177,7 +179,8 @@ func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -217,7 +220,8 @@ func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -254,7 +258,8 @@ func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -290,7 +295,8 @@ func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x12345", + Author: "did:firefly:org/0x23456", + Key: "0x12345", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -326,7 +332,8 @@ func TestHandleSystemBroadcastNodeGetOrgNotFound(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -362,7 +369,8 @@ func TestHandleSystemBroadcastNodeGetOrgFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -396,7 +404,8 @@ func TestHandleSystemBroadcastNodeValidateFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, @@ -416,7 +425,8 @@ func TestHandleSystemBroadcastNodeUnmarshalFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineNode), }, diff --git a/internal/syshandlers/syshandler_network_org.go b/internal/syshandlers/syshandler_network_org.go index 27d517fae7..9f90d4be8b 100644 --- a/internal/syshandlers/syshandler_network_org.go +++ b/internal/syshandlers/syshandler_network_org.go @@ -37,24 +37,6 @@ func (sh *systemHandlers) handleOrganizationBroadcast(ctx context.Context, msg * return false, nil } - // signingIdentity := org.Identity - // if org.Parent != "" { - // signingIdentity = org.Parent - // parent, err := sh.database.GetOrganizationByIdentity(ctx, org.Parent) - // if err != nil { - // return false, err // We only return database errors - // } - // if parent == nil { - // l.Warnf("Unable to process organization broadcast %s - parent identity not found: %s", msg.Header.ID, org.Parent) - // return false, nil - // } - // } - - // if msg.Header.Author != signingIdentity { - // l.Warnf("Unable to process organization broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, signingIdentity, msg.Header.Author) - // return false, nil - // } - existing, err := sh.database.GetOrganizationByIdentity(ctx, org.Identity) if err == nil && existing == nil { existing, err = sh.database.GetOrganizationByName(ctx, org.Name) diff --git a/internal/syshandlers/syshandler_network_org_test.go b/internal/syshandlers/syshandler_network_org_test.go index af549fe382..20f707cb4b 100644 --- a/internal/syshandlers/syshandler_network_org_test.go +++ b/internal/syshandlers/syshandler_network_org_test.go @@ -46,7 +46,6 @@ func TestHandleSystemBroadcastOrgOk(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, nil) mdi.On("GetOrganizationByName", mock.Anything, "org1").Return(nil, nil) mdi.On("GetOrganizationByID", mock.Anything, org.ID).Return(nil, nil) @@ -55,7 +54,8 @@ func TestHandleSystemBroadcastOrgOk(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -84,14 +84,14 @@ func TestHandleSystemBroadcastOrgDupOk(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x23456"}, nil) mdi.On("UpsertOrganization", mock.Anything, mock.Anything, true).Return(nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -120,13 +120,13 @@ func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x9999"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -223,11 +223,13 @@ func TestHandleSystemBroadcastOrgAuthorMismatch(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x9999"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -256,12 +258,13 @@ func TestHandleSystemBroadcastGetParentFail(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, fmt.Errorf("pop")) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, fmt.Errorf("pop")) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -279,7 +282,7 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { ID: fftypes.NewUUID(), Name: "org1", Identity: "0x12345", - Parent: "0x23456", + Parent: "", Description: "my org", Profile: fftypes.JSONObject{"some": "info"}, } @@ -290,12 +293,13 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, nil) + mdi.On("GetOrganizationByIdentity", mock.Anything, org.Identity).Return(&fftypes.Organization{Identity: "0x12345", Parent: "0x99999"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -325,7 +329,8 @@ func TestHandleSystemBroadcastValidateFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, @@ -345,7 +350,8 @@ func TestHandleSystemBroadcastUnmarshalFail(t *testing.T) { Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ - Author: "0x23456", + Author: "did:firefly:org/0x23456", + Key: "0x23456", }, Tag: string(fftypes.SystemTagDefineOrganization), }, diff --git a/mocks/broadcastmocks/manager.go b/mocks/broadcastmocks/manager.go index c76faf903a..0fce3705cc 100644 --- a/mocks/broadcastmocks/manager.go +++ b/mocks/broadcastmocks/manager.go @@ -106,13 +106,13 @@ func (_m *Manager) BroadcastMessage(ctx context.Context, ns string, in *fftypes. return r0, r1 } -// BroadcastMessageWithID provides a mock function with given fields: ctx, ns, id, unresolved, resolved, waitConfirm -func (_m *Manager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (*fftypes.Message, error) { - ret := _m.Called(ctx, ns, id, unresolved, resolved, waitConfirm) +// BroadcastMessageWithID provides a mock function with given fields: ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved +func (_m *Manager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool, identityResolved bool) (*fftypes.Message, error) { + ret := _m.Called(ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved) var r0 *fftypes.Message - if rf, ok := ret.Get(0).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool) *fftypes.Message); ok { - r0 = rf(ctx, ns, id, unresolved, resolved, waitConfirm) + if rf, ok := ret.Get(0).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool, bool) *fftypes.Message); ok { + r0 = rf(ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*fftypes.Message) @@ -120,8 +120,8 @@ func (_m *Manager) BroadcastMessageWithID(ctx context.Context, ns string, id *ff } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool) error); ok { - r1 = rf(ctx, ns, id, unresolved, resolved, waitConfirm) + if rf, ok := ret.Get(1).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool, bool) error); ok { + r1 = rf(ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved) } else { r1 = ret.Error(1) } @@ -152,6 +152,29 @@ func (_m *Manager) BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace return r0, r1 } +// BroadcastRootOrgDefinition provides a mock function with given fields: ctx, def, signingIdentity, tag, waitConfirm +func (_m *Manager) BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (*fftypes.Message, error) { + ret := _m.Called(ctx, def, signingIdentity, tag, waitConfirm) + + var r0 *fftypes.Message + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Organization, *fftypes.Identity, fftypes.SystemTag, bool) *fftypes.Message); ok { + r0 = rf(ctx, def, signingIdentity, tag, waitConfirm) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*fftypes.Message) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Organization, *fftypes.Identity, fftypes.SystemTag, bool) error); ok { + r1 = rf(ctx, def, signingIdentity, tag, waitConfirm) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Start provides a mock function with given fields: func (_m *Manager) Start() error { ret := _m.Called() diff --git a/mocks/eventmocks/event_manager.go b/mocks/eventmocks/event_manager.go index 19f3756ded..eae0aac0f1 100644 --- a/mocks/eventmocks/event_manager.go +++ b/mocks/eventmocks/event_manager.go @@ -51,13 +51,13 @@ func (_m *EventManager) BLOBReceived(dx dataexchange.Plugin, peerID string, hash return r0 } -// BatchPinComplete provides a mock function with given fields: bi, batch, signingIdentity, protocolTxID, additionalInfo -func (_m *EventManager) BatchPinComplete(bi blockchain.Plugin, batch *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error { - ret := _m.Called(bi, batch, signingIdentity, protocolTxID, additionalInfo) +// BatchPinComplete provides a mock function with given fields: bi, batch, author, protocolTxID, additionalInfo +func (_m *EventManager) BatchPinComplete(bi blockchain.Plugin, batch *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error { + ret := _m.Called(bi, batch, author, protocolTxID, additionalInfo) var r0 error if rf, ok := ret.Get(0).(func(blockchain.Plugin, *blockchain.BatchPin, string, string, fftypes.JSONObject) error); ok { - r0 = rf(bi, batch, signingIdentity, protocolTxID, additionalInfo) + r0 = rf(bi, batch, author, protocolTxID, additionalInfo) } else { r0 = ret.Error(0) } diff --git a/mocks/identitymanagermocks/manager.go b/mocks/identitymanagermocks/manager.go index 597883c8c2..bdd13da76b 100644 --- a/mocks/identitymanagermocks/manager.go +++ b/mocks/identitymanagermocks/manager.go @@ -15,6 +15,43 @@ type Manager struct { mock.Mock } +// GetLocalOrganization provides a mock function with given fields: ctx +func (_m *Manager) GetLocalOrganization(ctx context.Context) (*fftypes.Organization, error) { + ret := _m.Called(ctx) + + var r0 *fftypes.Organization + if rf, ok := ret.Get(0).(func(context.Context) *fftypes.Organization); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*fftypes.Organization) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrgDID provides a mock function with given fields: org +func (_m *Manager) OrgDID(org *fftypes.Organization) string { + ret := _m.Called(org) + + var r0 string + if rf, ok := ret.Get(0).(func(*fftypes.Organization) string); ok { + r0 = rf(org) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // ResolveInputIdentity provides a mock function with given fields: ctx, _a1 func (_m *Manager) ResolveInputIdentity(ctx context.Context, _a1 *fftypes.Identity) error { ret := _m.Called(ctx, _a1) From 5a51d6b06c17444f2e02dff4b020471f878eb786 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Mon, 4 Oct 2021 14:27:58 -0400 Subject: [PATCH 08/15] Address review comments (re-push after DCO issues) Signed-off-by: Peter Broadhurst --- internal/broadcast/definition.go | 52 +----- internal/broadcast/definition_test.go | 21 +++ internal/broadcast/manager.go | 6 +- internal/broadcast/manager_test.go | 4 +- internal/broadcast/message.go | 24 +-- internal/events/aggregator.go | 2 +- internal/events/batch_pin_complete.go | 14 +- internal/events/batch_pin_complete_test.go | 2 +- internal/events/persist_batch.go | 45 +++-- internal/events/persist_batch_test.go | 166 ++++++++++++++++++ internal/identity/identitymanager.go | 15 +- internal/networkmap/register_node.go | 2 +- internal/networkmap/register_org.go | 2 + internal/orchestrator/status.go | 5 +- internal/orchestrator/status_test.go | 15 ++ .../privatemessaging/privatemessaging_test.go | 6 +- internal/privatemessaging/recipients.go | 4 +- internal/privatemessaging/recipients_test.go | 31 +++- internal/syscore/syscore.go | 30 ---- mocks/broadcastmocks/manager.go | 14 +- mocks/identitymanagermocks/manager.go | 14 ++ pkg/fftypes/organization_test.go | 13 ++ 22 files changed, 341 insertions(+), 146 deletions(-) create mode 100644 internal/events/persist_batch_test.go delete mode 100644 internal/syscore/syscore.go diff --git a/internal/broadcast/definition.go b/internal/broadcast/definition.go index 01af9b153a..2529d76ea6 100644 --- a/internal/broadcast/definition.go +++ b/internal/broadcast/definition.go @@ -28,8 +28,6 @@ func (bm *broadcastManager) BroadcastDefinitionAsNode(ctx context.Context, def f return bm.BroadcastDefinition(ctx, def, &fftypes.Identity{ /* resolve to node default */ }, tag, waitConfirm) } -// THIS IS WHERE THE OLD CODE FIRST CALLS ResolveInputIdentity -// It does NOT have an author and key the first time func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { err = bm.identity.ResolveInputIdentity(ctx, signingIdentity) @@ -37,54 +35,17 @@ func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes return nil, err } - // Ensure the broadcast message is nil on the sending side - only set on receiving side - def.SetBroadcastMessage(nil) - - // Serialize it into a data object, as a piece of data we can write to a message - data := &fftypes.Data{ - Validator: fftypes.ValidatorTypeSystemDefinition, - ID: fftypes.NewUUID(), - Namespace: fftypes.SystemNamespace, - Created: fftypes.Now(), - } - data.Value, err = json.Marshal(&def) - if err == nil { - err = data.Seal(ctx) - } - if err != nil { - return nil, i18n.WrapError(ctx, err, i18n.MsgSerializationFailed) - } - - // Write as data to the local store - if err = bm.database.UpsertData(ctx, data, true, false /* we just generated the ID, so it is new */); err != nil { - return nil, err - } - - // Create a broadcast message referring to the data - msg = &fftypes.Message{ - Header: fftypes.MessageHeader{ - Namespace: fftypes.SystemNamespace, - Type: fftypes.MessageTypeDefinition, - Identity: *signingIdentity, - Topics: fftypes.FFNameArray{def.Topic()}, - Tag: string(tag), - TxType: fftypes.TransactionTypeBatchPin, - }, - Data: fftypes.DataRefs{ - {ID: data.ID, Hash: data.Hash}, - }, - } - - // Broadcast the message - return bm.broadcastMessageCommon(ctx, msg, waitConfirm, false) + return bm.broadcastDefinitionCommon(ctx, def, signingIdentity, tag, waitConfirm) } func (bm *broadcastManager) BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { signingIdentity.Author = bm.identity.OrgDID(def) - // Ensure the broadcast message is nil on the sending side - only set on receiving side - def.SetBroadcastMessage(nil) + return bm.broadcastDefinitionCommon(ctx, def, signingIdentity, tag, waitConfirm) +} + +func (bm *broadcastManager) broadcastDefinitionCommon(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { // Serialize it into a data object, as a piece of data we can write to a message data := &fftypes.Data{ @@ -122,5 +83,6 @@ func (bm *broadcastManager) BroadcastRootOrgDefinition(ctx context.Context, def } // Broadcast the message - return bm.broadcastMessageCommon(ctx, msg, waitConfirm, true) + return bm.broadcastMessageCommon(ctx, msg, waitConfirm) + } diff --git a/internal/broadcast/definition_test.go b/internal/broadcast/definition_test.go index 59e1b1e260..f6ee5f17a1 100644 --- a/internal/broadcast/definition_test.go +++ b/internal/broadcast/definition_test.go @@ -51,3 +51,24 @@ func TestBroadcastDefinitionBadIdentity(t *testing.T) { }, fftypes.SystemTagDefineNamespace, false) assert.Regexp(t, "pop", err) } + +func TestBroadcastRootOrgDefinitionPassedThroughAnyIdentity(t *testing.T) { + bm, cancel := newTestBroadcast(t) + defer cancel() + + mim := bm.identity.(*identitymanagermocks.Manager) + mim.On("OrgDID", mock.Anything, mock.Anything).Return("did:firefly:org/12345", nil) + // Should call through to upsert data, stop test there + mdi := bm.database.(*databasemocks.Plugin) + mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(fmt.Errorf("pop")) + + _, err := bm.BroadcastRootOrgDefinition(bm.ctx, &fftypes.Organization{ + ID: fftypes.NewUUID(), + }, &fftypes.Identity{ + Author: "anything - overridden", + Key: "0x12345", + }, fftypes.SystemTagDefineNamespace, false) + assert.Regexp(t, "pop", err) + + mim.AssertExpectations(t) +} diff --git a/internal/broadcast/manager.go b/internal/broadcast/manager.go index 0e1d63c500..8a47e7c3e6 100644 --- a/internal/broadcast/manager.go +++ b/internal/broadcast/manager.go @@ -39,7 +39,7 @@ type Manager interface { BroadcastDatatype(ctx context.Context, ns string, datatype *fftypes.Datatype, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) - BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool, identityResolved bool) (out *fftypes.Message, err error) + BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (out *fftypes.Message, err error) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) @@ -133,7 +133,7 @@ func (bm *broadcastManager) submitTXAndUpdateDB(ctx context.Context, batch *ffty return bm.batchpin.SubmitPinnedBatch(ctx, batch, contexts) } -func (bm *broadcastManager) broadcastMessageCommon(ctx context.Context, msg *fftypes.Message, waitConfirm bool, identityResolved bool) (*fftypes.Message, error) { +func (bm *broadcastManager) broadcastMessageCommon(ctx context.Context, msg *fftypes.Message, waitConfirm bool) (*fftypes.Message, error) { if !waitConfirm { // Seal the message @@ -146,7 +146,7 @@ func (bm *broadcastManager) broadcastMessageCommon(ctx context.Context, msg *fft } return bm.syncasync.SendConfirm(ctx, msg.Header.Namespace, func(requestID *fftypes.UUID) error { - _, err := bm.BroadcastMessageWithID(ctx, msg.Header.Namespace, requestID, nil, msg, false, identityResolved) + _, err := bm.BroadcastMessageWithID(ctx, msg.Header.Namespace, requestID, nil, msg, false) return err }) } diff --git a/internal/broadcast/manager_test.go b/internal/broadcast/manager_test.go index 681c9e41ae..c27ccc78ef 100644 --- a/internal/broadcast/manager_test.go +++ b/internal/broadcast/manager_test.go @@ -67,7 +67,7 @@ func TestBroadcastMessageGood(t *testing.T) { msg := &fftypes.Message{} bm.database.(*databasemocks.Plugin).On("InsertMessageLocal", mock.Anything, msg).Return(nil) - msgRet, err := bm.broadcastMessageCommon(context.Background(), msg, false, false) + msgRet, err := bm.broadcastMessageCommon(context.Background(), msg, false) assert.NoError(t, err) assert.Equal(t, msg, msgRet) @@ -87,7 +87,7 @@ func TestBroadcastMessageBad(t *testing.T) { } bm.database.(*databasemocks.Plugin).On("UpsertMessage", mock.Anything, msg, false).Return(nil) - _, err := bm.broadcastMessageCommon(context.Background(), msg, false, false) + _, err := bm.broadcastMessageCommon(context.Background(), msg, false) assert.Regexp(t, "FF10144", err) } diff --git a/internal/broadcast/message.go b/internal/broadcast/message.go index e03e67b74c..ef747e5011 100644 --- a/internal/broadcast/message.go +++ b/internal/broadcast/message.go @@ -26,16 +26,10 @@ import ( ) func (bm *broadcastManager) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) { - return bm.BroadcastMessageWithID(ctx, ns, nil, in, nil, waitConfirm, false) + return bm.BroadcastMessageWithID(ctx, ns, nil, in, nil, waitConfirm) } -func (bm *broadcastManager) BroadcastMessageWithResolvedID(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) { - return bm.BroadcastMessageWithID(ctx, ns, nil, in, nil, waitConfirm, true) -} - -// THIS IS WHERE THE NEW CODE FIRST CALLS ResolveInputIdentity -// IT already has an author and key here -func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool, identityResolved bool) (out *fftypes.Message, err error) { +func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (out *fftypes.Message, err error) { if unresolved != nil { resolved = &unresolved.Message } @@ -46,11 +40,9 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin resolved.Header.TxType = fftypes.TransactionTypeBatchPin } - if !identityResolved { - // Resolve the sending identity - if err := bm.identity.ResolveInputIdentity(ctx, &resolved.Header.Identity); err != nil { - return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) - } + // Resolve the sending identity + if err := bm.identity.ResolveInputIdentity(ctx, &resolved.Header.Identity); err != nil { + return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) } // We optimize the DB storage of all the parts of the message using transaction semantics (assuming those are supported by the DB plugin @@ -72,7 +64,7 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin return nil } - out, err = bm.broadcastMessageCommon(ctx, resolved, false, identityResolved) + out, err = bm.broadcastMessageCommon(ctx, resolved, false) return err }) if err != nil { @@ -83,7 +75,7 @@ func (bm *broadcastManager) BroadcastMessageWithID(ctx context.Context, ns strin if len(dataToPublish) > 0 { return bm.publishBlobsAndSend(ctx, resolved, dataToPublish, waitConfirm) } else if waitConfirm { - return bm.broadcastMessageCommon(ctx, resolved, true, identityResolved) + return bm.broadcastMessageCommon(ctx, resolved, true) } // The broadcastMessage function modifies the input message to create all the refs @@ -119,5 +111,5 @@ func (bm *broadcastManager) publishBlobsAndSend(ctx context.Context, msg *fftype } // Now we broadcast the message, as all data has been published - return bm.broadcastMessageCommon(ctx, msg, waitConfirm, false) + return bm.broadcastMessageCommon(ctx, msg, waitConfirm) } diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index a0dc30f729..e1b211ba1e 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -316,7 +316,7 @@ func (ag *aggregator) checkMaskedContextReady(ctx context.Context, msg *fftypes. if len(nextPins) == 0 { // If this is the first time we've seen the context, then this message is read as long as it is - // the first (nonce=0) message onw the context, for one of the members, and there aren't any earlier + // the first (nonce=0) message on the context, for one of the members, and there aren't any earlier // messages that are nonce=0. return ag.attemptContextInit(ctx, msg, topic, pinnedSequence, contextUnmasked, pin) } diff --git a/internal/events/batch_pin_complete.go b/internal/events/batch_pin_complete.go index 36894e66b8..c8bbc57279 100644 --- a/internal/events/batch_pin_complete.go +++ b/internal/events/batch_pin_complete.go @@ -33,28 +33,28 @@ import ( // // We must block here long enough to get the payload from the publicstorage, persist the messages in the correct // sequence, and also persist all the data. -func (em *eventManager) BatchPinComplete(bi blockchain.Plugin, batchPin *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error { +func (em *eventManager) BatchPinComplete(bi blockchain.Plugin, batchPin *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error { - log.L(em.ctx).Infof("-> BatchPinComplete txn=%s author=%s", protocolTxID, author) + log.L(em.ctx).Infof("-> BatchPinComplete txn=%s signingIdentity=%s", protocolTxID, signingIdentity) defer func() { - log.L(em.ctx).Infof("<- BatchPinComplete txn=%s author=%s", protocolTxID, author) + log.L(em.ctx).Infof("<- BatchPinComplete txn=%s signingIdentity=%s", protocolTxID, signingIdentity) }() log.L(em.ctx).Tracef("BatchPinComplete info: %+v", additionalInfo) if batchPin.BatchPaylodRef != "" { - return em.handleBroadcastPinComplete(batchPin, author, protocolTxID, additionalInfo) + return em.handleBroadcastPinComplete(batchPin, signingIdentity, protocolTxID, additionalInfo) } - return em.handlePrivatePinComplete(batchPin, author, protocolTxID, additionalInfo) + return em.handlePrivatePinComplete(batchPin, signingIdentity, protocolTxID, additionalInfo) } -func (em *eventManager) handlePrivatePinComplete(batchPin *blockchain.BatchPin, author string, protocolTxID string, additionalInfo fftypes.JSONObject) error { +func (em *eventManager) handlePrivatePinComplete(batchPin *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error { // Here we simple record all the pins as parked, and emit an event for the aggregator // to check whether the messages in the batch have been written. return em.retry.Do(em.ctx, "persist private batch pins", func(attempt int) (bool, error) { // We process the batch into the DB as a single transaction (if transactions are supported), both for // efficiency and to minimize the chance of duplicates (although at-least-once delivery is the core model) err := em.database.RunAsGroup(em.ctx, func(ctx context.Context) error { - valid, err := em.persistBatchTransaction(ctx, batchPin, author, protocolTxID, additionalInfo) + valid, err := em.persistBatchTransaction(ctx, batchPin, signingIdentity, protocolTxID, additionalInfo) if valid && err == nil { err = em.persistContexts(ctx, batchPin, true) } diff --git a/internal/events/batch_pin_complete_test.go b/internal/events/batch_pin_complete_test.go index ef02209f7c..d1fc1a9d97 100644 --- a/internal/events/batch_pin_complete_test.go +++ b/internal/events/batch_pin_complete_test.go @@ -219,7 +219,7 @@ func TestPersistBatchAuthorResolveFail(t *testing.T) { mim.On("ResolveSigningKeyIdentity", mock.Anything, mock.Anything).Return("", fmt.Errorf("pop")) batch.Hash = batch.Payload.Hash() valid, err := em.persistBatchFromBroadcast(context.Background(), batch, batchHash, "0x12345") - assert.Regexp(t, "pop", err) + assert.NoError(t, err) // retryable assert.False(t, valid) } diff --git a/internal/events/persist_batch.go b/internal/events/persist_batch.go index 13e2bcf990..78a9ec93a0 100644 --- a/internal/events/persist_batch.go +++ b/internal/events/persist_batch.go @@ -30,20 +30,26 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c // Verify that we can resolve the signing key back to this identity. // This is a specific rule for broadcasts, so we know the authenticity of the data. - author, err := em.identity.ResolveSigningKeyIdentity(ctx, signingKey) + resolvedAuthor, err := em.identity.ResolveSigningKeyIdentity(ctx, signingKey) if err != nil { - return false, err - } - - isRootOrgBroadcast, err := em.isRootOrgBroadcast(batch) - if err != nil { - return false, err + l.Errorf("Invalid batch '%s'. Author '%s' cound not be resolved: %s", batch.ID, batch.Author, err) + return false, nil // This is not retryable. skip this batch } // The special case of a root org broadcast is allowed to not have a resolved author, because it's not in the database yet - if !isRootOrgBroadcast && (author == "" || author != batch.Author) || signingKey != batch.Key { - l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Key, batch.Author, signingKey, author) - return false, nil // This is not retryable. skip this batch + if (resolvedAuthor == "" || resolvedAuthor != batch.Author) || signingKey != batch.Key { + if resolvedAuthor == "" && signingKey == batch.Key && em.isRootOrgBroadcast(batch) { + + // This is where a future "gatekeeper" plugin should sit, to allow pluggable authorization of new root + // identities joining the network + l.Infof("New root org broadcast: %s", batch.Author) + + } else { + + l.Errorf("Invalid batch '%s'. Key/author in batch '%s' / '%s' does not match resolved key/author '%s' / '%s'", batch.ID, batch.Key, batch.Author, signingKey, resolvedAuthor) + return false, nil // This is not retryable. skip this batch + + } } if !onchainHash.Equals(batch.Hash) { @@ -55,27 +61,30 @@ func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX c return valid, err } -func (em *eventManager) isRootOrgBroadcast(batch *fftypes.Batch) (bool, error) { +func (em *eventManager) isRootOrgBroadcast(batch *fftypes.Batch) bool { // Look into batch to see if it contains a message that contains a data item that is a root organization definition - for _, message := range batch.Payload.Messages { + if len(batch.Payload.Messages) > 0 { + message := batch.Payload.Messages[0] if message.Header.Type == fftypes.MessageTypeBroadcast { - for _, messageDataItem := range message.Data { - for _, batchDataItem := range batch.Payload.Data { + if len(message.Data) > 0 { + messageDataItem := message.Data[0] + if len(batch.Payload.Data) > 0 { + batchDataItem := batch.Payload.Data[0] if batchDataItem.ID.Equals(messageDataItem.ID) { var org *fftypes.Organization err := json.Unmarshal(batchDataItem.Value, &org) if err != nil { - return false, nil + return false } - if org != nil && org.Parent == "" { - return true, nil + if org != nil && org.Name != "" && org.ID != nil && org.Parent == "" { + return true } } } } } } - return false, nil + return false } // persistBatch performs very simple validation on each message/data element (hashes) and either persists diff --git a/internal/events/persist_batch_test.go b/internal/events/persist_batch_test.go new file mode 100644 index 0000000000..7f10497caa --- /dev/null +++ b/internal/events/persist_batch_test.go @@ -0,0 +1,166 @@ +// Copyright © 2021 Kaleido, Inc. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package events + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" + "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +func TestPersistBatchFromBroadcastRootOrg(t *testing.T) { + + em, cancel := newTestEventManager(t) + defer cancel() + + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKeyIdentity", em.ctx, mock.Anything).Return("", nil) + + mdi := em.database.(*databasemocks.Plugin) + mdi.On("UpsertBatch", em.ctx, mock.Anything, false).Return(fmt.Errorf(("pop"))) + + org := fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Parent: "", // root + } + orgBytes, err := json.Marshal(&org) + assert.NoError(t, err) + data := &fftypes.Data{ + ID: fftypes.NewUUID(), + Value: orgBytes, + } + + batch := &fftypes.Batch{ + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Key: "0x12345", + }, + Payload: fftypes.BatchPayload{ + TX: fftypes.TransactionRef{ + ID: fftypes.NewUUID(), + Type: fftypes.TransactionTypeBatchPin, + }, + Messages: []*fftypes.Message{ + { + Header: fftypes.MessageHeader{ + ID: fftypes.NewUUID(), + Type: fftypes.MessageTypeBroadcast, + Identity: fftypes.Identity{ + Key: "0x12345", + }, + }, + Data: fftypes.DataRefs{ + { + ID: data.ID, + Hash: data.Hash, + }, + }, + }, + }, + Data: []*fftypes.Data{ + data, + }, + }, + } + batch.Hash = batch.Payload.Hash() + + _, err = em.persistBatchFromBroadcast(em.ctx, batch, batch.Hash, "0x12345") + assert.EqualError(t, err, "pop") // Confirms we got to upserting the batch + +} + +func TestPersistBatchFromBroadcastRootOrgBadData(t *testing.T) { + + em, cancel := newTestEventManager(t) + defer cancel() + + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKeyIdentity", em.ctx, mock.Anything).Return("", nil) + + data := &fftypes.Data{ + ID: fftypes.NewUUID(), + Value: []byte("!badness"), + } + + batch := &fftypes.Batch{ + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Key: "0x12345", + }, + Payload: fftypes.BatchPayload{ + TX: fftypes.TransactionRef{ + ID: fftypes.NewUUID(), + Type: fftypes.TransactionTypeBatchPin, + }, + Messages: []*fftypes.Message{ + { + Header: fftypes.MessageHeader{ + ID: fftypes.NewUUID(), + Type: fftypes.MessageTypeBroadcast, + Identity: fftypes.Identity{ + Key: "0x12345", + }, + }, + Data: fftypes.DataRefs{ + { + ID: data.ID, + Hash: data.Hash, + }, + }, + }, + }, + Data: []*fftypes.Data{ + data, + }, + }, + } + batch.Hash = batch.Payload.Hash() + + valid, err := em.persistBatchFromBroadcast(em.ctx, batch, batch.Hash, "0x12345") + assert.NoError(t, err) + assert.False(t, valid) + +} + +func TestPersistBatchFromBroadcastNoRootOrgBadIdentity(t *testing.T) { + + em, cancel := newTestEventManager(t) + defer cancel() + + mim := em.identity.(*identitymanagermocks.Manager) + mim.On("ResolveSigningKeyIdentity", em.ctx, mock.Anything).Return("", nil) + + batch := &fftypes.Batch{ + ID: fftypes.NewUUID(), + Identity: fftypes.Identity{ + Key: "0x12345", + }, + } + batch.Hash = batch.Payload.Hash() + + valid, err := em.persistBatchFromBroadcast(em.ctx, batch, batch.Hash, "0x12345") + assert.NoError(t, err) + assert.False(t, valid) + +} diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index 8deedd7792..07cc26035a 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -37,6 +37,7 @@ type Manager interface { ResolveSigningKey(ctx context.Context, inputKey string) (outputKey string, err error) ResolveSigningKeyIdentity(ctx context.Context, signingKey string) (author string, err error) ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) + GetOrgKey(ctx context.Context) string OrgDID(org *fftypes.Organization) string GetLocalOrganization(ctx context.Context) (*fftypes.Organization, error) } @@ -119,14 +120,20 @@ func (im *identityManager) ResolveSigningKeyIdentity(ctx context.Context, signin } -func (im *identityManager) ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) { - if im.localOrgDID != "" { - return im.localOrgDID, nil - } +func (im *identityManager) GetOrgKey(ctx context.Context) string { orgKey := config.GetString(config.OrgKey) if orgKey == "" { orgKey = config.GetString(config.OrgIdentityDeprecated) } + return orgKey +} + +func (im *identityManager) ResolveLocalOrgDID(ctx context.Context) (localOrgDID string, err error) { + if im.localOrgDID != "" { + return im.localOrgDID, nil + } + orgKey := im.GetOrgKey(ctx) + im.localOrgDID, err = im.ResolveSigningKeyIdentity(ctx, orgKey) if err != nil { return "", i18n.WrapError(ctx, err, i18n.MsgLocalOrgLookupFailed, orgKey) diff --git a/internal/networkmap/register_node.go b/internal/networkmap/register_node.go index e4fd7eb2f9..44dd64b2ff 100644 --- a/internal/networkmap/register_node.go +++ b/internal/networkmap/register_node.go @@ -42,7 +42,7 @@ func (nm *networkMap) RegisterNode(ctx context.Context, waitConfirm bool) (node if node.Name == "" { orgName := config.GetString(config.OrgName) if orgName != "" { - node.Name = fmt.Sprintf("%s.node", config.GetString(config.OrgName)) + node.Name = fmt.Sprintf("%s.node", orgName) } } if node.Owner == "" || node.Name == "" { diff --git a/internal/networkmap/register_org.go b/internal/networkmap/register_org.go index 5f006bc378..82039b2f60 100644 --- a/internal/networkmap/register_org.go +++ b/internal/networkmap/register_org.go @@ -21,6 +21,7 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger-labs/firefly/internal/log" "github.com/hyperledger-labs/firefly/pkg/fftypes" ) @@ -43,6 +44,7 @@ func (nm *networkMap) findOrgsToRoot(ctx context.Context, idType, identity, pare func (nm *networkMap) getLocalOrgSigningKey(ctx context.Context) (localOrgSigningKey string, err error) { localOrgSigningKey = config.GetString(config.OrgKey) if localOrgSigningKey == "" { + log.L(ctx).Warnf("The %s config key has been deprecated. Use %s instead.", config.OrgIdentityDeprecated, config.OrgKey) localOrgSigningKey = config.GetString(config.OrgIdentityDeprecated) } localOrgSigningKey, err = nm.identity.ResolveSigningKey(ctx, localOrgSigningKey) diff --git a/internal/orchestrator/status.go b/internal/orchestrator/status.go index e3d68b05d5..c0b50a07c8 100644 --- a/internal/orchestrator/status.go +++ b/internal/orchestrator/status.go @@ -25,10 +25,7 @@ import ( func (or *orchestrator) GetStatus(ctx context.Context) (status *fftypes.NodeStatus, err error) { - orgKey := config.GetString(config.OrgKey) - if orgKey == "" { - orgKey = config.GetString(config.OrgIdentityDeprecated) - } + orgKey := or.identity.GetOrgKey(ctx) status = &fftypes.NodeStatus{ Node: fftypes.NodeStatusNode{ Name: config.GetString(config.NodeName), diff --git a/internal/orchestrator/status_test.go b/internal/orchestrator/status_test.go index 7ce0faf18b..324e39c0f0 100644 --- a/internal/orchestrator/status_test.go +++ b/internal/orchestrator/status_test.go @@ -22,8 +22,10 @@ import ( "github.com/hyperledger-labs/firefly/internal/config" "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" "github.com/hyperledger-labs/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" ) func TestGetStatusRegistered(t *testing.T) { @@ -48,6 +50,8 @@ func TestGetStatusRegistered(t *testing.T) { Name: "node1", Owner: "0x1111111", }, nil) + mim := or.identity.(*identitymanagermocks.Manager) + mim.On("GetOrgKey", mock.Anything).Return("0x1111111") status, err := or.GetStatus(or.ctx) assert.NoError(t, err) @@ -75,6 +79,8 @@ func TestGetStatusUnregistered(t *testing.T) { mdi := or.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByName", or.ctx, "org1").Return(nil, nil) + mim := or.identity.(*identitymanagermocks.Manager) + mim.On("GetOrgKey", mock.Anything).Return("0x1111111") status, err := or.GetStatus(or.ctx) assert.NoError(t, err) @@ -106,6 +112,9 @@ func TestGetStatusOrgOnlyRegistered(t *testing.T) { Name: "org1", }, nil) mdi.On("GetNode", or.ctx, "0x1111111", "node1").Return(nil, nil) + mim := or.identity.(*identitymanagermocks.Manager) + mim.On("GetOrgKey", mock.Anything).Return("0x1111111") + status, err := or.GetStatus(or.ctx) assert.NoError(t, err) @@ -131,6 +140,9 @@ func TestGetStatuOrgError(t *testing.T) { mdi := or.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByName", or.ctx, "org1").Return(nil, fmt.Errorf("pop")) + mim := or.identity.(*identitymanagermocks.Manager) + mim.On("GetOrgKey", mock.Anything).Return("0x1111111") + _, err := or.GetStatus(or.ctx) assert.EqualError(t, err, "pop") } @@ -152,6 +164,9 @@ func TestGetStatusNodeError(t *testing.T) { Name: "org1", }, nil) mdi.On("GetNode", or.ctx, "0x1111111", "node1").Return(nil, fmt.Errorf("pop")) + mim := or.identity.(*identitymanagermocks.Manager) + mim.On("GetOrgKey", mock.Anything).Return("0x1111111") + _, err := or.GetStatus(or.ctx) assert.EqualError(t, err, "pop") } diff --git a/internal/privatemessaging/privatemessaging_test.go b/internal/privatemessaging/privatemessaging_test.go index 46c6429076..9c3533e4d2 100644 --- a/internal/privatemessaging/privatemessaging_test.go +++ b/internal/privatemessaging/privatemessaging_test.go @@ -96,11 +96,11 @@ func TestDispatchBatchWithBlobs(t *testing.T) { } } - mim.On("ResolveInputIdentity", pm.ctx, mock.MatchedBy(func(identity *fftypes.Identity) bool { + mim.On("ResolveInputIdentity", pm.ctx, mock.Anything).Run(func(args mock.Arguments) { + identity := args[1].(*fftypes.Identity) assert.Equal(t, "org1", identity.Author) identity.Key = "0x12345" - return true - })).Return(nil) + }).Return(nil) mim.On("ResolveLocalOrgDID", pm.ctx).Return("localorg", nil) mdi.On("GetGroupByHash", pm.ctx, groupID).Return(&fftypes.Group{ Hash: fftypes.NewRandB32(), diff --git a/internal/privatemessaging/recipients.go b/internal/privatemessaging/recipients.go index a0988802f2..038db4e25d 100644 --- a/internal/privatemessaging/recipients.go +++ b/internal/privatemessaging/recipients.go @@ -105,7 +105,7 @@ func (pm *privateMessaging) resolveNode(ctx context.Context, org *fftypes.Organi return node, nil } -func (pm *privateMessaging) getReceipients(ctx context.Context, in *fftypes.MessageInOut) (gi *fftypes.GroupIdentity, err error) { +func (pm *privateMessaging) getRecipients(ctx context.Context, in *fftypes.MessageInOut) (gi *fftypes.GroupIdentity, err error) { localOrgDID, err := pm.identity.ResolveLocalOrgDID(ctx) if err != nil { @@ -176,7 +176,7 @@ func (pm *privateMessaging) resolveLocalNode(ctx context.Context, localOrgSignin } func (pm *privateMessaging) findOrGenerateGroup(ctx context.Context, in *fftypes.MessageInOut) (group *fftypes.Group, isNew bool, err error) { - gi, err := pm.getReceipients(ctx, in) + gi, err := pm.getRecipients(ctx, in) if err != nil { return nil, false, err } diff --git a/internal/privatemessaging/recipients_test.go b/internal/privatemessaging/recipients_test.go index 3a15ff94ff..6f1003cd9e 100644 --- a/internal/privatemessaging/recipients_test.go +++ b/internal/privatemessaging/recipients_test.go @@ -74,9 +74,9 @@ func TestResolveMemberListNewGroupE2E(t *testing.T) { assert.Nil(t, group.Ledger) } else { assert.Equal(t, orgDIDRemote, group.Members[0].Identity) - assert.Equal(t, *nodeIDRemote, *group.Members[1].Node) + assert.Equal(t, *nodeIDRemote, *group.Members[0].Node) assert.Equal(t, orgDIDLocal, group.Members[1].Identity) - assert.Equal(t, *nodeIDLocal, *group.Members[0].Node) + assert.Equal(t, *nodeIDLocal, *group.Members[1].Node) assert.Nil(t, group.Ledger) } @@ -203,6 +203,33 @@ func TestResolveMemberListLocalOrgUnregistered(t *testing.T) { } +func TestResolveMemberListLocalOrgLookupFailed(t *testing.T) { + + pm, cancel := newTestPrivateMessaging(t) + defer cancel() + + mim := pm.identity.(*identitymanagermocks.Manager) + mim.On("ResolveLocalOrgDID", pm.ctx).Return("", nil) + mim.On("GetLocalOrganization", pm.ctx).Return(nil, fmt.Errorf("pop")) + + err := pm.resolveReceipientList(pm.ctx, &fftypes.MessageInOut{ + Message: fftypes.Message{ + Header: fftypes.MessageHeader{ + Identity: fftypes.Identity{ + Author: "org1", + }, + }, + }, + Group: &fftypes.InputGroup{ + Members: []fftypes.MemberInput{ + {Identity: "org1"}, + }, + }, + }) + assert.EqualError(t, err, "pop") + +} + func TestResolveMemberListMissingLocalMemberLookupFailed(t *testing.T) { pm, cancel := newTestPrivateMessaging(t) diff --git a/internal/syscore/syscore.go b/internal/syscore/syscore.go deleted file mode 100644 index 18e6866458..0000000000 --- a/internal/syscore/syscore.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright © 2021 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package syscore - -import ( - "context" - - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/pkg/fftypes" -) - -// SystemCore specifies an interface for global utility functions, without creating a cycle between components -type SystemCore interface { - AddSystemEventListener(ns string, el system.EventListener) error - ResolveSigningIdentity(ctx context.Context, suppliedIdentity string) (*fftypes.Identity, error) -} diff --git a/mocks/broadcastmocks/manager.go b/mocks/broadcastmocks/manager.go index 0fce3705cc..a2f059f211 100644 --- a/mocks/broadcastmocks/manager.go +++ b/mocks/broadcastmocks/manager.go @@ -106,13 +106,13 @@ func (_m *Manager) BroadcastMessage(ctx context.Context, ns string, in *fftypes. return r0, r1 } -// BroadcastMessageWithID provides a mock function with given fields: ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved -func (_m *Manager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool, identityResolved bool) (*fftypes.Message, error) { - ret := _m.Called(ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved) +// BroadcastMessageWithID provides a mock function with given fields: ctx, ns, id, unresolved, resolved, waitConfirm +func (_m *Manager) BroadcastMessageWithID(ctx context.Context, ns string, id *fftypes.UUID, unresolved *fftypes.MessageInOut, resolved *fftypes.Message, waitConfirm bool) (*fftypes.Message, error) { + ret := _m.Called(ctx, ns, id, unresolved, resolved, waitConfirm) var r0 *fftypes.Message - if rf, ok := ret.Get(0).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool, bool) *fftypes.Message); ok { - r0 = rf(ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved) + if rf, ok := ret.Get(0).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool) *fftypes.Message); ok { + r0 = rf(ctx, ns, id, unresolved, resolved, waitConfirm) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*fftypes.Message) @@ -120,8 +120,8 @@ func (_m *Manager) BroadcastMessageWithID(ctx context.Context, ns string, id *ff } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool, bool) error); ok { - r1 = rf(ctx, ns, id, unresolved, resolved, waitConfirm, identityResolved) + if rf, ok := ret.Get(1).(func(context.Context, string, *fftypes.UUID, *fftypes.MessageInOut, *fftypes.Message, bool) error); ok { + r1 = rf(ctx, ns, id, unresolved, resolved, waitConfirm) } else { r1 = ret.Error(1) } diff --git a/mocks/identitymanagermocks/manager.go b/mocks/identitymanagermocks/manager.go index bdd13da76b..90b9f5d001 100644 --- a/mocks/identitymanagermocks/manager.go +++ b/mocks/identitymanagermocks/manager.go @@ -38,6 +38,20 @@ func (_m *Manager) GetLocalOrganization(ctx context.Context) (*fftypes.Organizat return r0, r1 } +// GetOrgKey provides a mock function with given fields: ctx +func (_m *Manager) GetOrgKey(ctx context.Context) string { + ret := _m.Called(ctx) + + var r0 string + if rf, ok := ret.Get(0).(func(context.Context) string); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // OrgDID provides a mock function with given fields: org func (_m *Manager) OrgDID(org *fftypes.Organization) string { ret := _m.Called(org) diff --git a/pkg/fftypes/organization_test.go b/pkg/fftypes/organization_test.go index 9244e4a956..a40d0aae00 100644 --- a/pkg/fftypes/organization_test.go +++ b/pkg/fftypes/organization_test.go @@ -18,6 +18,7 @@ package fftypes import ( "context" + "fmt" "testing" "github.com/stretchr/testify/assert" @@ -51,3 +52,15 @@ func TestOrganizationValidation(t *testing.T) { def.SetBroadcastMessage(NewUUID()) assert.NotNil(t, org.Message) } + +func TestGetDID(t *testing.T) { + + var org *Organization + assert.Equal(t, "", org.GetDID()) + + org = &Organization{ + ID: NewUUID(), + } + assert.Equal(t, fmt.Sprintf("did:firefly:org/%s", org.ID), org.GetDID()) + +} From 6a51881c6699224c7242de2f11786668d446da70 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Mon, 4 Oct 2021 14:49:03 -0400 Subject: [PATCH 09/15] Do the hyperledger-labs to hyperledger rework in branch to help merge Signed-off-by: Peter Broadhurst --- .github/workflows/docker.yml | 4 +- Dockerfile | 2 +- README.md | 22 ++++---- cmd/firefly.go | 10 ++-- cmd/firefly_test.go | 4 +- docs/_config.yml | 2 +- .../node_component_architecture.md | 2 +- docs/contributors/code_overview.md | 8 +-- docs/contributors/code_repositories.md | 16 +++--- docs/contributors/contributors.md | 2 +- docs/contributors/dev_environment_setup.md | 6 +-- docs/gettingstarted/broadcast_data.md | 4 +- docs/gettingstarted/define_datatype.md | 2 +- docs/gettingstarted/firefly_cli.md | 8 +-- docs/gettingstarted/private_send.md | 4 +- docs/gettingstarted/run_sample.md | 2 +- docs/gettingstarted/setup_env.md | 4 +- docs/keyconcepts/blockchain_protocols.md | 6 +-- docs/keyconcepts/data_exchange.md | 2 +- docs/keyconcepts/firefly_node.md | 2 +- docs/swagger/swagger.md | 2 +- go.mod | 5 +- go.sum | 6 --- internal/apiserver/admin_routes.go | 2 +- internal/apiserver/http_server.go | 8 +-- internal/apiserver/http_server_test.go | 2 +- internal/apiserver/restfilter.go | 6 +-- internal/apiserver/restfilter_test.go | 2 +- .../route_admin_delete_config_record.go | 4 +- .../route_admin_delete_config_record_test.go | 2 +- internal/apiserver/route_admin_get_config.go | 6 +-- .../route_admin_get_config_record.go | 8 +-- .../route_admin_get_config_record_test.go | 2 +- .../route_admin_get_config_records.go | 8 +-- .../route_admin_get_config_records_test.go | 2 +- .../apiserver/route_admin_get_config_test.go | 2 +- .../route_admin_put_config_record.go | 6 +-- .../route_admin_put_config_record_test.go | 2 +- .../apiserver/route_admin_put_config_reset.go | 6 +-- .../apiserver/route_delete_subscription.go | 6 +-- .../route_delete_subscription_test.go | 2 +- internal/apiserver/route_get_batch_by_id.go | 8 +-- .../apiserver/route_get_batch_by_id_test.go | 2 +- internal/apiserver/route_get_batches.go | 10 ++-- internal/apiserver/route_get_batches_test.go | 2 +- internal/apiserver/route_get_data.go | 10 ++-- internal/apiserver/route_get_data_blob.go | 8 +-- .../apiserver/route_get_data_blob_test.go | 2 +- internal/apiserver/route_get_data_by_id.go | 8 +-- .../apiserver/route_get_data_by_id_test.go | 2 +- internal/apiserver/route_get_data_msgs.go | 10 ++-- .../apiserver/route_get_data_msgs_test.go | 2 +- internal/apiserver/route_get_data_test.go | 2 +- .../apiserver/route_get_datatype_by_name.go | 8 +-- .../route_get_datatype_by_name_test.go | 2 +- internal/apiserver/route_get_datatypes.go | 10 ++-- .../apiserver/route_get_datatypes_by_id.go | 8 +-- .../route_get_datatypes_by_id_test.go | 2 +- .../apiserver/route_get_datatypes_test.go | 2 +- internal/apiserver/route_get_event_by_id.go | 8 +-- .../apiserver/route_get_event_by_id_test.go | 2 +- internal/apiserver/route_get_events.go | 10 ++-- internal/apiserver/route_get_events_test.go | 2 +- internal/apiserver/route_get_msg_by_id.go | 8 +-- .../apiserver/route_get_msg_by_id_test.go | 2 +- internal/apiserver/route_get_msg_data.go | 8 +-- internal/apiserver/route_get_msg_data_test.go | 2 +- internal/apiserver/route_get_msg_events.go | 10 ++-- .../apiserver/route_get_msg_events_test.go | 2 +- internal/apiserver/route_get_msg_ops.go | 8 +-- internal/apiserver/route_get_msg_ops_test.go | 2 +- internal/apiserver/route_get_msg_txn.go | 8 +-- internal/apiserver/route_get_msg_txn_test.go | 2 +- internal/apiserver/route_get_msgs.go | 10 ++-- internal/apiserver/route_get_msgs_test.go | 4 +- internal/apiserver/route_get_namespace.go | 8 +-- .../apiserver/route_get_namespace_test.go | 2 +- internal/apiserver/route_get_namespaces.go | 8 +-- .../apiserver/route_get_namespaces_test.go | 2 +- internal/apiserver/route_get_net_node.go | 6 +-- internal/apiserver/route_get_net_node_test.go | 4 +- internal/apiserver/route_get_net_nodes.go | 8 +-- .../apiserver/route_get_net_nodes_test.go | 4 +- internal/apiserver/route_get_net_org.go | 6 +-- internal/apiserver/route_get_net_org_test.go | 4 +- internal/apiserver/route_get_net_orgs.go | 8 +-- internal/apiserver/route_get_net_orgs_test.go | 4 +- internal/apiserver/route_get_op_by_id.go | 8 +-- internal/apiserver/route_get_op_by_id_test.go | 2 +- internal/apiserver/route_get_ops.go | 10 ++-- internal/apiserver/route_get_ops_test.go | 2 +- internal/apiserver/route_get_status.go | 6 +-- internal/apiserver/route_get_status_test.go | 2 +- .../apiserver/route_get_subscription_by_id.go | 8 +-- .../route_get_subscription_by_id_test.go | 2 +- internal/apiserver/route_get_subscriptions.go | 10 ++-- .../apiserver/route_get_subscriptions_test.go | 2 +- .../apiserver/route_get_token_accounts.go | 10 ++-- .../route_get_token_accounts_test.go | 4 +- .../apiserver/route_get_token_pool_by_name.go | 8 +-- .../route_get_token_pool_by_name_test.go | 4 +- internal/apiserver/route_get_token_pools.go | 10 ++-- .../apiserver/route_get_token_pools_test.go | 4 +- internal/apiserver/route_get_txn_by_id.go | 10 ++-- .../apiserver/route_get_txn_by_id_test.go | 2 +- internal/apiserver/route_get_txn_ops.go | 8 +-- internal/apiserver/route_get_txn_ops_test.go | 2 +- internal/apiserver/route_get_txns.go | 10 ++-- internal/apiserver/route_get_txns_test.go | 2 +- .../route_post_broadcast_datatype.go | 8 +-- .../route_post_broadcast_datatype_test.go | 4 +- .../apiserver/route_post_broadcast_message.go | 8 +-- .../route_post_broadcast_message_test.go | 4 +- .../route_post_broadcast_namespace.go | 6 +-- .../route_post_broadcast_namespace_test.go | 4 +- internal/apiserver/route_post_data.go | 8 +-- internal/apiserver/route_post_data_test.go | 6 +-- internal/apiserver/route_post_new_datatype.go | 8 +-- .../apiserver/route_post_new_datatype_test.go | 4 +- .../route_post_new_message_broadcast.go | 8 +-- .../route_post_new_message_broadcast_test.go | 4 +- .../route_post_new_message_private.go | 8 +-- .../route_post_new_message_private_test.go | 4 +- .../route_post_new_message_requestreply.go | 8 +-- ...oute_post_new_message_requestreply_test.go | 2 +- .../apiserver/route_post_new_namespace.go | 6 +-- .../route_post_new_namespace_test.go | 4 +- .../apiserver/route_post_new_node_self.go | 6 +-- .../route_post_new_node_self_test.go | 4 +- .../apiserver/route_post_new_organization.go | 6 +-- .../route_post_new_organization_self.go | 6 +-- .../route_post_new_organization_self_test.go | 4 +- .../route_post_new_organization_test.go | 4 +- .../apiserver/route_post_new_subscription.go | 10 ++-- .../route_post_new_subscription_test.go | 2 +- .../apiserver/route_post_register_node.go | 6 +-- .../apiserver/route_post_register_node_org.go | 6 +-- .../route_post_register_node_org_test.go | 4 +- .../route_post_register_node_test.go | 4 +- internal/apiserver/route_post_register_org.go | 6 +-- .../apiserver/route_post_register_org_test.go | 4 +- .../apiserver/route_post_request_message.go | 8 +-- .../route_post_request_message_test.go | 2 +- internal/apiserver/route_post_send_message.go | 8 +-- .../apiserver/route_post_send_message_test.go | 4 +- internal/apiserver/route_post_token_pool.go | 8 +-- .../apiserver/route_post_token_pool_test.go | 4 +- internal/apiserver/route_put_subscription.go | 8 +-- .../apiserver/route_put_subscription_test.go | 2 +- internal/apiserver/routes.go | 2 +- internal/apiserver/server.go | 18 +++---- internal/apiserver/server_cors.go | 4 +- internal/apiserver/server_cors_test.go | 4 +- internal/apiserver/server_test.go | 8 +-- internal/apiserver/static.go | 6 +-- internal/assets/manager.go | 14 ++--- internal/assets/manager_test.go | 20 +++---- internal/batch/batch_manager.go | 14 ++--- internal/batch/batch_manager_test.go | 12 ++--- internal/batch/batch_processor.go | 8 +-- internal/batch/batch_processor_test.go | 8 +-- internal/batchpin/batchpin.go | 8 +-- internal/batchpin/batchpin_test.go | 8 +-- internal/blockchain/bifactory/factory.go | 8 +-- internal/blockchain/ethereum/config.go | 4 +- internal/blockchain/ethereum/ethereum.go | 14 ++--- internal/blockchain/ethereum/ethereum_test.go | 16 +++--- internal/broadcast/datatype.go | 2 +- internal/broadcast/datatype_test.go | 8 +-- internal/broadcast/definition.go | 4 +- internal/broadcast/definition_test.go | 6 +-- internal/broadcast/manager.go | 24 ++++----- internal/broadcast/manager_test.go | 22 ++++---- internal/broadcast/message.go | 8 +-- internal/broadcast/message_test.go | 16 +++--- internal/broadcast/namespace.go | 2 +- internal/broadcast/namespace_test.go | 8 +-- internal/config/config.go | 6 +-- internal/config/config_test.go | 2 +- internal/data/blobstore.go | 12 ++--- internal/data/blobstore_test.go | 8 +-- internal/data/data_manager.go | 14 ++--- internal/data/data_manager_test.go | 10 ++-- internal/data/json_validator.go | 6 +-- internal/data/json_validator_test.go | 2 +- internal/data/validator.go | 2 +- internal/database/difactory/factory.go | 6 +-- internal/database/difactory/plugins_cgo.go | 6 +-- internal/database/difactory/plugins_nocgo.go | 4 +- internal/database/postgres/config.go | 2 +- internal/database/postgres/postgres.go | 6 +-- internal/database/postgres/postgres_test.go | 6 +-- internal/database/sqlcommon/batch_sql.go | 8 +-- internal/database/sqlcommon/batch_sql_test.go | 4 +- internal/database/sqlcommon/blob_sql.go | 8 +-- internal/database/sqlcommon/blob_sql_test.go | 6 +-- internal/database/sqlcommon/config.go | 2 +- .../database/sqlcommon/config_record_sql.go | 8 +-- .../sqlcommon/config_record_sql_test.go | 6 +-- internal/database/sqlcommon/data_sql.go | 8 +-- internal/database/sqlcommon/data_sql_test.go | 6 +-- internal/database/sqlcommon/datatype_sql.go | 8 +-- .../database/sqlcommon/datatype_sql_test.go | 6 +-- internal/database/sqlcommon/event_sql.go | 8 +-- internal/database/sqlcommon/event_sql_test.go | 4 +- internal/database/sqlcommon/filter_sql.go | 4 +- .../database/sqlcommon/filter_sql_test.go | 4 +- internal/database/sqlcommon/group_sql.go | 8 +-- internal/database/sqlcommon/group_sql_test.go | 6 +-- internal/database/sqlcommon/message_sql.go | 8 +-- .../database/sqlcommon/message_sql_test.go | 6 +-- internal/database/sqlcommon/namespace_sql.go | 8 +-- .../database/sqlcommon/namespace_sql_test.go | 6 +-- internal/database/sqlcommon/nextpin_sql.go | 8 +-- .../database/sqlcommon/nextpin_sql_test.go | 6 +-- internal/database/sqlcommon/node_sql.go | 8 +-- internal/database/sqlcommon/node_sql_test.go | 6 +-- internal/database/sqlcommon/nonce_sql.go | 8 +-- internal/database/sqlcommon/nonce_sql_test.go | 6 +-- internal/database/sqlcommon/offset_sql.go | 8 +-- .../database/sqlcommon/offset_sql_test.go | 6 +-- internal/database/sqlcommon/operation_sql.go | 8 +-- .../database/sqlcommon/operation_sql_test.go | 4 +- .../database/sqlcommon/organization_sql.go | 8 +-- .../sqlcommon/organization_sql_test.go | 6 +-- internal/database/sqlcommon/pin_sql.go | 8 +-- internal/database/sqlcommon/pin_sql_test.go | 6 +-- .../database/sqlcommon/provider_mock_test.go | 6 +-- .../sqlcommon/provider_sqlitego_test.go | 6 +-- internal/database/sqlcommon/sqlcommon.go | 10 ++-- internal/database/sqlcommon/sqlcommon_test.go | 6 +-- .../database/sqlcommon/subscription_sql.go | 8 +-- .../sqlcommon/subscription_sql_test.go | 4 +- .../database/sqlcommon/tokenaccount_sql.go | 8 +-- .../sqlcommon/tokenaccount_sql_test.go | 6 +-- internal/database/sqlcommon/tokenpool_sql.go | 8 +-- .../database/sqlcommon/tokenpool_sql_test.go | 6 +-- .../database/sqlcommon/transaction_sql.go | 8 +-- .../sqlcommon/transaction_sql_test.go | 4 +- internal/database/sqlite3/config.go | 4 +- internal/database/sqlite3/sqlite3.go | 6 +-- internal/database/sqlite3/sqlite3_test.go | 6 +-- internal/dataexchange/dxfactory/factory.go | 8 +-- internal/dataexchange/dxhttps/config.go | 4 +- internal/dataexchange/dxhttps/dxhttps.go | 14 ++--- internal/dataexchange/dxhttps/dxhttps_test.go | 12 ++--- internal/events/aggregator.go | 14 ++--- internal/events/aggregator_test.go | 12 ++--- internal/events/batch_pin_complete.go | 8 +-- internal/events/batch_pin_complete_test.go | 14 ++--- internal/events/bound_events_callbacks.go | 4 +- internal/events/change_event_listener.go | 4 +- internal/events/change_event_listener_test.go | 2 +- internal/events/dx_callbacks.go | 10 ++-- internal/events/dx_callbacks_test.go | 8 +-- internal/events/eifactory/factory.go | 12 ++--- internal/events/event_dispatcher.go | 18 +++---- internal/events/event_dispatcher_test.go | 18 +++---- internal/events/event_manager.go | 32 +++++------ internal/events/event_manager_test.go | 18 +++---- internal/events/event_notifier.go | 4 +- internal/events/event_poller.go | 8 +-- internal/events/event_poller_test.go | 8 +-- internal/events/offset_calc.go | 8 +-- internal/events/persist_batch.go | 6 +-- internal/events/persist_batch_test.go | 6 +-- internal/events/subscription_manager.go | 22 ++++---- internal/events/subscription_manager_test.go | 14 ++--- internal/events/system/config.go | 2 +- internal/events/system/events.go | 6 +-- internal/events/system/events_test.go | 8 +-- internal/events/token_pool_created.go | 8 +-- internal/events/token_pool_created_test.go | 8 +-- internal/events/transaction_update.go | 8 +-- internal/events/transaction_update_test.go | 6 +-- internal/events/webhooks/config.go | 4 +- internal/events/webhooks/webhooks.go | 12 ++--- internal/events/webhooks/webhooks_test.go | 8 +-- internal/events/websockets/config.go | 2 +- .../events/websockets/websocket_connection.go | 6 +-- internal/events/websockets/websockets.go | 10 ++-- internal/events/websockets/websockets_test.go | 14 ++--- internal/identity/identitymanager.go | 16 +++--- internal/identity/identitymanager_test.go | 10 ++-- internal/identity/iifactory/factory.go | 8 +-- internal/identity/tbd/config.go | 2 +- internal/identity/tbd/tbd.go | 4 +- internal/identity/tbd/tbd_test.go | 6 +-- internal/log/log_test.go | 2 +- internal/networkmap/data_query.go | 4 +- internal/networkmap/data_query_test.go | 6 +-- internal/networkmap/manager.go | 12 ++--- internal/networkmap/manager_test.go | 10 ++-- internal/networkmap/register_node.go | 6 +-- internal/networkmap/register_node_test.go | 12 ++--- internal/networkmap/register_org.go | 8 +-- internal/networkmap/register_org_test.go | 10 ++-- internal/oapispec/apirequest.go | 6 +-- internal/oapispec/openapi3.go | 6 +-- internal/oapispec/openapi3_test.go | 8 +-- internal/oapispec/routes.go | 6 +-- internal/orchestrator/bound_callbacks.go | 10 ++-- internal/orchestrator/bound_callbacks_test.go | 12 ++--- internal/orchestrator/config.go | 6 +-- internal/orchestrator/config_test.go | 4 +- internal/orchestrator/data_query.go | 6 +-- internal/orchestrator/data_query_test.go | 4 +- internal/orchestrator/message.go | 4 +- internal/orchestrator/message_test.go | 2 +- internal/orchestrator/orchestrator.go | 54 +++++++++---------- internal/orchestrator/orchestrator_test.go | 38 ++++++------- internal/orchestrator/persistence_events.go | 6 +-- .../orchestrator/persistence_events_test.go | 8 +-- internal/orchestrator/status.go | 4 +- internal/orchestrator/status_test.go | 8 +-- internal/orchestrator/subscriptions.go | 8 +-- internal/orchestrator/subscriptions_test.go | 6 +-- internal/privatemessaging/groupmanager.go | 10 ++-- .../privatemessaging/groupmanager_test.go | 8 +-- internal/privatemessaging/message.go | 4 +- internal/privatemessaging/message_test.go | 14 ++--- internal/privatemessaging/privatemessaging.go | 26 ++++----- .../privatemessaging/privatemessaging_test.go | 22 ++++---- internal/privatemessaging/recipients.go | 8 +-- internal/privatemessaging/recipients_test.go | 6 +-- internal/publicstorage/ipfs/config.go | 4 +- internal/publicstorage/ipfs/ipfs.go | 10 ++-- internal/publicstorage/ipfs/ipfs_test.go | 8 +-- internal/publicstorage/psfactory/factory.go | 8 +-- internal/restclient/config.go | 2 +- internal/restclient/ffresty.go | 8 +-- internal/restclient/ffresty_test.go | 4 +- internal/retry/retry.go | 4 +- internal/syncasync/sync_async_bridge.go | 12 ++--- internal/syncasync/sync_async_bridge_test.go | 8 +-- internal/syshandlers/reply_sender.go | 4 +- internal/syshandlers/reply_sender_test.go | 6 +-- internal/syshandlers/syshandler.go | 14 ++--- internal/syshandlers/syshandler_datatype.go | 4 +- .../syshandlers/syshandler_datatype_test.go | 6 +-- internal/syshandlers/syshandler_namespace.go | 4 +- .../syshandlers/syshandler_namespace_test.go | 4 +- .../syshandlers/syshandler_network_node.go | 4 +- .../syshandler_network_node_test.go | 6 +-- .../syshandlers/syshandler_network_org.go | 4 +- .../syshandler_network_org_test.go | 4 +- internal/syshandlers/syshandler_test.go | 12 ++--- internal/sysmessaging/sysevents.go | 2 +- internal/tokens/https/config.go | 4 +- internal/tokens/https/https.go | 14 ++--- internal/tokens/https/https_test.go | 14 ++--- internal/tokens/tifactory/factory.go | 8 +-- internal/wsclient/config.go | 4 +- internal/wsclient/wsclient.go | 10 ++-- internal/wsclient/wsclient_test.go | 4 +- kat/package.json | 2 +- main.go | 2 +- mocks/apiservermocks/server.go | 2 +- mocks/assetmocks/manager.go | 4 +- mocks/batchmocks/manager.go | 4 +- mocks/batchpinmocks/submitter.go | 2 +- mocks/blockchainmocks/callbacks.go | 4 +- mocks/blockchainmocks/plugin.go | 6 +-- mocks/broadcastmocks/manager.go | 2 +- mocks/databasemocks/callbacks.go | 4 +- mocks/databasemocks/plugin.go | 6 +-- mocks/dataexchangemocks/callbacks.go | 2 +- mocks/dataexchangemocks/plugin.go | 6 +-- mocks/datamocks/manager.go | 2 +- mocks/eventmocks/event_manager.go | 10 ++-- mocks/eventsmocks/callbacks.go | 4 +- mocks/eventsmocks/plugin.go | 6 +-- mocks/eventsmocks/plugin_all.go | 6 +-- mocks/identitymanagermocks/manager.go | 2 +- mocks/identitymocks/plugin.go | 4 +- mocks/networkmapmocks/manager.go | 4 +- mocks/orchestratormocks/orchestrator.go | 16 +++--- mocks/privatemessagingmocks/manager.go | 4 +- mocks/publicstoragemocks/plugin.go | 4 +- mocks/syncasyncmocks/bridge.go | 6 +-- mocks/syshandlersmocks/system_handlers.go | 4 +- mocks/sysmessagingmocks/system_events.go | 2 +- mocks/tokenmocks/callbacks.go | 4 +- mocks/tokenmocks/plugin.go | 6 +-- pkg/blockchain/plugin.go | 4 +- pkg/database/filter.go | 2 +- pkg/database/filter_test.go | 2 +- pkg/database/plugin.go | 6 +-- pkg/database/query_fields.go | 4 +- pkg/database/update.go | 2 +- pkg/database/update_test.go | 2 +- pkg/dataexchange/plugin.go | 4 +- pkg/events/plugin.go | 4 +- pkg/fftypes/batch.go | 2 +- pkg/fftypes/byteable.go | 2 +- pkg/fftypes/bytyetypes.go | 2 +- pkg/fftypes/data.go | 2 +- pkg/fftypes/datatype.go | 2 +- pkg/fftypes/group.go | 2 +- pkg/fftypes/jsondata.go | 4 +- pkg/fftypes/message.go | 2 +- pkg/fftypes/namearray.go | 2 +- pkg/fftypes/namespace.go | 2 +- pkg/fftypes/node.go | 2 +- pkg/fftypes/organization.go | 2 +- pkg/fftypes/sizeutils.go | 2 +- pkg/fftypes/sizeutils_test.go | 2 +- pkg/fftypes/subscription.go | 2 +- pkg/fftypes/timeutils.go | 4 +- pkg/fftypes/uuid.go | 2 +- pkg/fftypes/validations.go | 2 +- pkg/identity/plugin.go | 6 +-- pkg/publicstorage/plugin.go | 4 +- pkg/tokens/plugin.go | 4 +- .../firefly-go/chaincode/contract_test.go | 4 +- smart_contracts/fabric/firefly-go/firefly.go | 2 +- smart_contracts/fabric/firefly-go/go.mod | 2 +- solidity_firefly/package.json | 2 +- solidity_kat/package.json | 2 +- test/e2e/e2e_test.go | 2 +- test/e2e/restclient.go | 4 +- test/e2e/run.sh | 4 +- 422 files changed, 1363 insertions(+), 1372 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 20bf888d7b..22d38606d5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,9 +12,9 @@ jobs: - uses: actions/checkout@v2 - name: Build - run: docker build -t ghcr.io/hyperledger-labs/firefly:latest . + run: docker build -t ghcr.io/hyperledger/firefly:latest . - name: Push run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - docker push ghcr.io/hyperledger-labs/firefly:latest + docker push ghcr.io/hyperledger/firefly:latest diff --git a/Dockerfile b/Dockerfile index c0d1af860d..d1faffd438 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ RUN apk add make gcc build-base curl git WORKDIR /firefly ADD go.mod go.sum ./ RUN go mod download -ENV UI_RELEASE "https://github.com/hyperledger-labs/firefly-ui/releases/download/v0.3.1/v0.3.1_c0e2dbf.tgz" +ENV UI_RELEASE "https://github.com/hyperledger/firefly-ui/releases/download/v0.3.1/v0.3.1_c0e2dbf.tgz" RUN mkdir /firefly/frontend \ && curl -sLo - $UI_RELEASE | tar -C /firefly/frontend -zxvf - ADD . . diff --git a/README.md b/README.md index 46b768c586..80b15a4648 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # FireFly -[![codecov](https://codecov.io/gh/hyperledger-labs/firefly/branch/main/graph/badge.svg?token=QdEnpMqB1G)](https://codecov.io/gh/hyperledger-labs/firefly) -[![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger-labs/firefly)](https://goreportcard.com/report/github.com/hyperledger-labs/firefly) +[![codecov](https://codecov.io/gh/hyperledger/firefly/branch/main/graph/badge.svg?token=QdEnpMqB1G)](https://codecov.io/gh/hyperledger/firefly) +[![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger/firefly)](https://goreportcard.com/report/github.com/hyperledger/firefly) [![FireFy Documentation](https://img.shields.io/static/v1?label=FireFly&message=documentation&color=informational)](https://labs.hyperledger.org/firefly/) FireFly is a multiparty system for enterprise data flows, powered by blockchain. It solves all of the layers of complexity that sit between the low level blockchain and high level business processes and user interfaces. FireFly enables developers to build blockchain apps for enterprise radically faster by allowing them to focus on business logic instead of infrastructure. @@ -31,14 +31,14 @@ As such there are a number of repos, and the list will grow as the community evo But not to worry, one of those repos is a CLI designed to get you running with all the components you need in minutes! -- CLI / Developer experience - https://github.com/hyperledger-labs/firefly-cli -- UI Explorer - https://github.com/hyperledger-labs/firefly-ui -- Sample applications - https://github.com/hyperledger-labs/firefly-samples -- Core (this repo) - https://github.com/hyperledger-labs/firefly -- HTTP Data Exchange - https://github.com/hyperledger-labs/firefly-dataexchange-https -- Ethereum (Hyperledger Besu / Quorum) connector: https://github.com/hyperledger-labs/firefly-ethconnect -- Corda connector: https://github.com/hyperledger-labs/firefly-cordaconnect - contributed from Kaleido generation 1 - porting to generation 2 -- Hyperledger Fabric connector - in design phase, including collaboration with https://github.com/hyperledger-labs/fabric-smart-client +- CLI / Developer experience - https://github.com/hyperledger/firefly-cli +- UI Explorer - https://github.com/hyperledger/firefly-ui +- Sample applications - https://github.com/hyperledger/firefly-samples +- Core (this repo) - https://github.com/hyperledger/firefly +- HTTP Data Exchange - https://github.com/hyperledger/firefly-dataexchange-https +- Ethereum (Hyperledger Besu / Quorum) connector: https://github.com/hyperledger/firefly-ethconnect +- Corda connector: https://github.com/hyperledger/firefly-cordaconnect - contributed from Kaleido generation 1 - porting to generation 2 +- Hyperledger Fabric connector - in design phase, including collaboration with https://github.com/hyperledger/fabric-smart-client > Note only the projects that are primarily built to support FireFly are listed here, not all > of the ecosystem of projects that integrate underneath the plugins. See [below](#firefly-code-hierarchy) for @@ -46,7 +46,7 @@ But not to worry, one of those repos is a CLI designed to get you running with a ## Getting Started -Use the FireFly CLI for fast bootstrap: https://github.com/hyperledger-labs/firefly-cli +Use the FireFly CLI for fast bootstrap: https://github.com/hyperledger/firefly-cli ## Navigating this repo diff --git a/cmd/firefly.go b/cmd/firefly.go index d8e381c174..59391a31e6 100644 --- a/cmd/firefly.go +++ b/cmd/firefly.go @@ -26,11 +26,11 @@ import ( "syscall" "github.com/gorilla/mux" - "github.com/hyperledger-labs/firefly/internal/apiserver" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/orchestrator" + "github.com/hyperledger/firefly/internal/apiserver" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/orchestrator" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/firefly_test.go b/cmd/firefly_test.go index 473ea30e76..54f6372486 100644 --- a/cmd/firefly_test.go +++ b/cmd/firefly_test.go @@ -23,8 +23,8 @@ import ( "syscall" "testing" - "github.com/hyperledger-labs/firefly/mocks/apiservermocks" - "github.com/hyperledger-labs/firefly/mocks/orchestratormocks" + "github.com/hyperledger/firefly/mocks/apiservermocks" + "github.com/hyperledger/firefly/mocks/orchestratormocks" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/docs/_config.yml b/docs/_config.yml index 2e800c407d..19795e0218 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -3,7 +3,7 @@ logo: "firefly_logo.png" title: FireFly aux_links: "GitHub": - - "//github.com/hyperledger-labs/firefly" + - "//github.com/hyperledger/firefly" "Wiki": - "//wiki.hyperledger.org/display/labs/Firefly" "Chat": diff --git a/docs/architecture/node_component_architecture.md b/docs/architecture/node_component_architecture.md index 6f50bc415f..7ab6950750 100644 --- a/docs/architecture/node_component_architecture.md +++ b/docs/architecture/node_component_architecture.md @@ -57,6 +57,6 @@ What are the core runtime responsibilities, and pluggable elements - right side ## Code Structure What is the code structure *inside* the core. - - The [README.md](https://github.com/hyperledger-labs/firefly#readme) is the reference for this. + - The [README.md](https://github.com/hyperledger/firefly#readme) is the reference for this. - Developers contributing to FireFly, on the core, or building new plugins, need this level of detail. > - A reconciliation is underway to ensure the medium-level view correlates well with this code structure. diff --git a/docs/contributors/code_overview.md b/docs/contributors/code_overview.md index a1939479a2..edaa9e6d58 100644 --- a/docs/contributors/code_overview.md +++ b/docs/contributors/code_overview.md @@ -49,7 +49,7 @@ A few highlights: ## Directories -- [internal](https://github.com/hyperledger-labs/firefly/tree/main/internal): The core Golang implementation code -- [pkg](https://github.com/hyperledger-labs/firefly/tree/main/pkg): Interfaces intended for external project use -- [cmd](https://github.com/hyperledger-labs/firefly/tree/main/cmd): The command line entry point -- [solidity_firefly](https://github.com/hyperledger-labs/firefly/tree/main/solidity_firefly): Ethereum/Solidity smart contract code +- [internal](https://github.com/hyperledger/firefly/tree/main/internal): The core Golang implementation code +- [pkg](https://github.com/hyperledger/firefly/tree/main/pkg): Interfaces intended for external project use +- [cmd](https://github.com/hyperledger/firefly/tree/main/cmd): The command line entry point +- [solidity_firefly](https://github.com/hyperledger/firefly/tree/main/solidity_firefly): Ethereum/Solidity smart contract code diff --git a/docs/contributors/code_repositories.md b/docs/contributors/code_repositories.md index 6d8bfaaeb8..63515b541f 100644 --- a/docs/contributors/code_repositories.md +++ b/docs/contributors/code_repositories.md @@ -21,14 +21,14 @@ As such there are a number of repos, and the list will grow as the community evo But not to worry, one of those repos is a CLI designed to get you running with all the components you need in minutes! -- [CLI / Developer experience](https://github.com/hyperledger-labs/firefly-cli) -- [FireFly Samples](https://github.com/hyperledger-labs/firefly-samples) -- [UI Explorer](https://github.com/hyperledger-labs/firefly-ui) -- [Core](https://github.com/hyperledger-labs/firefly) -- [HTTP Data Exchange](https://github.com/hyperledger-labs/firefly-dataexchange-https) -- [Ethereum (Hyperledger Besu / Quorum) connector](https://github.com/hyperledger-labs/firefly-ethconnect) -- [Corda connector](https://github.com/hyperledger-labs/firefly-cordaconnect) -- Hyperledger Fabric connector - in design phase, including collaboration with the [Fabric Smart Client](https://github.com/hyperledger-labs/fabric-smart-client) project. +- [CLI / Developer experience](https://github.com/hyperledger/firefly-cli) +- [FireFly Samples](https://github.com/hyperledger/firefly-samples) +- [UI Explorer](https://github.com/hyperledger/firefly-ui) +- [Core](https://github.com/hyperledger/firefly) +- [HTTP Data Exchange](https://github.com/hyperledger/firefly-dataexchange-https) +- [Ethereum (Hyperledger Besu / Quorum) connector](https://github.com/hyperledger/firefly-ethconnect) +- [Corda connector](https://github.com/hyperledger/firefly-cordaconnect) +- Hyperledger Fabric connector - in design phase, including collaboration with the [Fabric Smart Client](https://github.com/hyperledger/fabric-smart-client) project. > Note only the projects that are primarily built to support FireFly are listed here, not all > of the ecosystem of projects that integrate underneath the plugins. diff --git a/docs/contributors/contributors.md b/docs/contributors/contributors.md index 12a3324ee4..b8167fad6d 100644 --- a/docs/contributors/contributors.md +++ b/docs/contributors/contributors.md @@ -30,7 +30,7 @@ https://wiki.hyperledger.org/display/CA/Setting+up+an+LFID ## Finding your first issue -If you're looking for somewhere to get started in the FireFly project and want something small and relatively easy, take a look at [issues tagged with "Good first issue"](https://github.com/search?q=repo%3Ahyperledger-labs%2Ffirefly+repo%3Ahyperledger-labs%2Ffirefly-fabconnect+repo%3Ahyperledger-labs%2Ffirefly-cli+repo%3Ahyperledger-labs%2Ffirefly-samples+repo%3Ahyperledger-labs%2Ffirefly-ethconnect+repo%3Ahyperledger-labs%2Ffirefly-dataexchange-https+repo%3Ahyperledger-labs%2Ffirefly-ui+repo%3Ahyperledger-labs%2Ffirefly-cordaconnect+label%3A%22Good+first+issue%22+state%3Aopen&type=Issues&ref=advsearch&l=&l=). You can definitely work on other things if you want to. These are only suggestions for easy places to get started. +If you're looking for somewhere to get started in the FireFly project and want something small and relatively easy, take a look at [issues tagged with "Good first issue"](https://github.com/search?q=repo%3Ahyperledger%2Ffirefly+repo%3Ahyperledger%2Ffirefly-fabconnect+repo%3Ahyperledger%2Ffirefly-cli+repo%3Ahyperledger%2Ffirefly-samples+repo%3Ahyperledger%2Ffirefly-ethconnect+repo%3Ahyperledger%2Ffirefly-dataexchange-https+repo%3Ahyperledger%2Ffirefly-ui+repo%3Ahyperledger%2Ffirefly-cordaconnect+label%3A%22Good+first+issue%22+state%3Aopen&type=Issues&ref=advsearch&l=&l=). You can definitely work on other things if you want to. These are only suggestions for easy places to get started. ## Setting up a local development environment Here are some detailed instructions on [Setting up a local development environment](./dev_environment_setup.html) diff --git a/docs/contributors/dev_environment_setup.md b/docs/contributors/dev_environment_setup.md index 6da7f93cff..a187c90585 100644 --- a/docs/contributors/dev_environment_setup.md +++ b/docs/contributors/dev_environment_setup.md @@ -29,14 +29,14 @@ You will need a few prerequisites set up on your machine before you can build Fi - GCC (?) - There are probably more that I'm forgetting... -The [FireFly CLI](https://github.com/hyperledger-labs/firefly-cli) is the recommended path for running a local development stack. It has its [own set of prerequisites](https://github.com/hyperledger-labs/firefly-cli#prerequisites) as well. +The [FireFly CLI](https://github.com/hyperledger/firefly-cli) is the recommended path for running a local development stack. It has its [own set of prerequisites](https://github.com/hyperledger/firefly-cli#prerequisites) as well. ## Building FireFly After installing dependencies, building FireFly from source is very easy. Just clone the repo: ``` -git clone git@github.com:hyperledger-labs/firefly.git && cd firefly +git clone git@github.com:hyperledger/firefly.git && cd firefly ``` And run the `Makefile` to run tests, and compile the app @@ -55,7 +55,7 @@ go install ## Install the CLI Please check the CLI Installation instructions for the best way to install the CLI on your machine: -https://github.com/hyperledger-labs/firefly-cli#install-the-cli +https://github.com/hyperledger/firefly-cli#install-the-cli ## Set up a development stack diff --git a/docs/gettingstarted/broadcast_data.md b/docs/gettingstarted/broadcast_data.md index ee509f0b54..2634bb04c1 100644 --- a/docs/gettingstarted/broadcast_data.md +++ b/docs/gettingstarted/broadcast_data.md @@ -54,7 +54,7 @@ nav_order: 4 Status: `202 Accepted` - the message is on it's way, but has not yet been confirmed. -> _Issue [#112](https://github.com/hyperledger-labs/firefly/issues/112) proposes adding +> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding > an option to wait for the message to be confirmed by the blockchain before returning, > with `200 OK`._ @@ -135,7 +135,7 @@ and pipe it into a multi-part form post to FireFly. > the `filename`, and `size`, to the JSON part of the `data` object for us._ ```sh -curl -sLo - https://github.com/hyperledger-labs/firefly/raw/main/docs/firefly_logo.png \ +curl -sLo - https://github.com/hyperledger/firefly/raw/main/docs/firefly_logo.png \ | curl --form autometa=true --form file=@- \ http://localhost:5000/api/v1/api/v1/namespaces/default/data ``` diff --git a/docs/gettingstarted/define_datatype.md b/docs/gettingstarted/define_datatype.md index 5adfa5e254..cb505ea581 100644 --- a/docs/gettingstarted/define_datatype.md +++ b/docs/gettingstarted/define_datatype.md @@ -67,7 +67,7 @@ Status: `202 Accepted` - a broadcast message has been sent, and on confirmation datatype will be created (unless it conflicts with another definition with the same `name` and `version` that was ordered onto the blockchain before this definition). -> _Issue [#112](https://github.com/hyperledger-labs/firefly/issues/112) proposes adding +> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding > an option to wait for the message to be confirmed by the blockchain before returning, > with `200 OK`._ diff --git a/docs/gettingstarted/firefly_cli.md b/docs/gettingstarted/firefly_cli.md index c2aa365080..dc219b4b91 100644 --- a/docs/gettingstarted/firefly_cli.md +++ b/docs/gettingstarted/firefly_cli.md @@ -22,17 +22,17 @@ The FireFly CLI helps you start and administer a local FireFly development envir ## References and Dependencies -* [CLI Repo README](https://github.com/hyperledger-labs/firefly-cli) +* [CLI Repo README](https://github.com/hyperledger/firefly-cli) * [Go](https://golang.org/doc/install) - latest version recommended (v1.16.5) - If you haven't installed Go previously, make sure to add to your `$PATH` env variable - `$HOME/go/bin` * [Docker](https://docs.docker.com/docker-for-mac/install/) - the CLI will download the requisite FireFly images and bootstrap a collection of containers (Ethereum adapter, FireFly Core, IPFS, local Ganache blockchain, postgres, etc.) ## Get the CLI -> Binary distributions coming soon - see https://github.com/hyperledger-labs/firefly/issues/77 +> Binary distributions coming soon - see https://github.com/hyperledger/firefly/issues/77 * On Go 1.16 or newer - - `go install github.com/hyperledger-labs/firefly-cli/ff@latest` + - `go install github.com/hyperledger/firefly-cli/ff@latest` * On earlier versions of Go - - `go get github.com/hyperledger-labs/firefly-cli/ff` + - `go get github.com/hyperledger/firefly-cli/ff` diff --git a/docs/gettingstarted/private_send.md b/docs/gettingstarted/private_send.md index ada782bceb..40501066eb 100644 --- a/docs/gettingstarted/private_send.md +++ b/docs/gettingstarted/private_send.md @@ -74,7 +74,7 @@ nav_order: 4 Status: `202 Accepted` - the message is on it's way, but has not yet been confirmed. -> _Issue [#112](https://github.com/hyperledger-labs/firefly/issues/112) proposes adding +> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding > an option to wait for the message to be confirmed by the blockchain before returning, > with `200 OK`._ @@ -213,7 +213,7 @@ and pipe it into a multi-part form post to FireFly. > the `filename`, and `size`, to the JSON part of the `data` object for us._ ```sh -curl -sLo - https://github.com/hyperledger-labs/firefly/raw/main/docs/firefly_logo.png \ +curl -sLo - https://github.com/hyperledger/firefly/raw/main/docs/firefly_logo.png \ | curl --form autometa=true --form file=@- \ http://localhost:5000/api/v1/api/v1/namespaces/default/data ``` diff --git a/docs/gettingstarted/run_sample.md b/docs/gettingstarted/run_sample.md index 58b4692293..5c8473234e 100644 --- a/docs/gettingstarted/run_sample.md +++ b/docs/gettingstarted/run_sample.md @@ -23,4 +23,4 @@ transactions, without needing to write any code. You can then use the code itself as a starting point for building your own apps, or learning the API. -Check out the samples here: [FireFly Samples Repo](https://github.com/hyperledger-labs/firefly-samples) +Check out the samples here: [FireFly Samples Repo](https://github.com/hyperledger/firefly-samples) diff --git a/docs/gettingstarted/setup_env.md b/docs/gettingstarted/setup_env.md index b9de4686ea..1be8a57c7a 100644 --- a/docs/gettingstarted/setup_env.md +++ b/docs/gettingstarted/setup_env.md @@ -42,13 +42,13 @@ The tooling is designed to be a helper, but not to hide or abstract things away - Adding a block explorer UI option is an enhancement tracked in #108 - Blockchain connector: one per member - The transaction and events interface for your blockchain node - - An instance of [firefly-ethconnect](https://github.com/hyperledger-labs/firefly-ethconnect) is the default option + - An instance of [firefly-ethconnect](https://github.com/hyperledger/firefly-ethconnect) is the default option - Shared storage: one per member - An [IPFS](https://ipfs.io/) node is the default option - Any data you upload, will only be available to other nodes within the stack - These storage nodes are automatically joined together into a private network - Data exchange: one per member - - An instance [HTTPS data exchange](https://github.com/hyperledger-labs/firefly-dataexchange-https) is the default option + - An instance [HTTPS data exchange](https://github.com/hyperledger/firefly-dataexchange-https) is the default option - Uses Mutual TLS for authentication and transport encryption - Automatically generates a self-signed certificate for each member - Database: one per member diff --git a/docs/keyconcepts/blockchain_protocols.md b/docs/keyconcepts/blockchain_protocols.md index ab3fce98d2..39266c3d5e 100644 --- a/docs/keyconcepts/blockchain_protocols.md +++ b/docs/keyconcepts/blockchain_protocols.md @@ -81,13 +81,13 @@ blockchain interface. There are sub-communities building the blockchain interfaces for each of the "big 3": - Ethereum (Hyperledger Besu, Quorum, Go-ethereum) - Status: Mature - - Repo: [hyperledger-labs/firefly-ethconnect](https://github.com/hyperledger-labs/firefly-ethconnect) + - Repo: [hyperledger/firefly-ethconnect](https://github.com/hyperledger/firefly-ethconnect) - Hyperledger Fabric - Status: Under active development - - Repo: [hyperledger-labs/firefly-fabricconnect](https://github.com/hyperledger-labs/firefly-fabricconnect) + - Repo: [hyperledger/firefly-fabricconnect](https://github.com/hyperledger/firefly-fabricconnect) - Corda - Status: Core transactions+events proved out. Seeking contributors - - Repo: [hyperledger-labs/firefly-fabricconnect](https://github.com/hyperledger-labs/firefly-fabricconnect) + - Repo: [hyperledger/firefly-fabricconnect](https://github.com/hyperledger/firefly-fabricconnect) > _Each FireFly network is tied to a single blockchain technology. Watch this space for > evolution of pluggable bridges for tokens, assets and data between networks through diff --git a/docs/keyconcepts/data_exchange.md b/docs/keyconcepts/data_exchange.md index d5235eb0c6..eab662b920 100644 --- a/docs/keyconcepts/data_exchange.md +++ b/docs/keyconcepts/data_exchange.md @@ -79,5 +79,5 @@ backed by Mutual TLS authentication. X509 certificate exchange is orchestrated b such that self-signed certificates can be used (or multiple PKI trust roots) and bound to the blockchain-backed identities of the organizations in FireFly. -See [hyperledger-labs/firefly-dataexchange-https](https://github.com/hyperledger-labs/firefly-dataexchange-https) +See [hyperledger/firefly-dataexchange-https](https://github.com/hyperledger/firefly-dataexchange-https) diff --git a/docs/keyconcepts/firefly_node.md b/docs/keyconcepts/firefly_node.md index 5867f010ee..7cb0539ac8 100644 --- a/docs/keyconcepts/firefly_node.md +++ b/docs/keyconcepts/firefly_node.md @@ -29,7 +29,7 @@ The minimum set of runtimes is as follows: - Public storage node - a network-wide peer-to-peer store of shared data - Data exchange - for private member to member communications of messages and files -> _Check out the [FireFly CLI](https://github.com/hyperledger-labs/firefly-cli) to get a +> _Check out the [FireFly CLI](https://github.com/hyperledger/firefly-cli) to get a > a multi-party system running on your laptop in minutes._ ## Pluggable microservices architecture diff --git a/docs/swagger/swagger.md b/docs/swagger/swagger.md index 4d66592619..2f225baabc 100644 --- a/docs/swagger/swagger.md +++ b/docs/swagger/swagger.md @@ -9,7 +9,7 @@ has_children: false This is the FireFly OpenAPI Specification document generated by FireFly -Note: The 'Try it out' buttons will not work on this page, because it's not running against a live version of FireFly. To actually try it out, we recommend using the [FireFly CLI](https://github.com/hyperledger-labs/firefly-cli) to start an instance on your local machine, then have a look at the API spec there. +Note: The 'Try it out' buttons will not work on this page, because it's not running against a live version of FireFly. To actually try it out, we recommend using the [FireFly CLI](https://github.com/hyperledger/firefly-cli) to start an instance on your local machine, then have a look at the API spec there. diff --git a/go.mod b/go.mod index aabdaf8fff..be6914dc01 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/hyperledger-labs/firefly +module github.com/hyperledger/firefly go 1.16 @@ -13,7 +13,6 @@ require ( github.com/go-openapi/swag v0.19.15 // indirect github.com/go-resty/resty/v2 v2.6.0 github.com/golang-migrate/migrate/v4 v4.14.2-0.20210521165626-8a1a8534dc64 - github.com/google/go-cmp v0.5.6 // indirect github.com/google/uuid v1.2.0 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.4.2 @@ -23,7 +22,6 @@ require ( github.com/karlseguin/ccache v2.0.3+incompatible github.com/karlseguin/expect v1.0.8 // indirect github.com/lib/pq v1.10.2 - github.com/likexian/gokit v0.24.7 github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-isatty v0.0.13 // indirect @@ -49,5 +47,4 @@ require ( golang.org/x/text v0.3.6 gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 - gotest.tools v2.2.0+incompatible ) diff --git a/go.sum b/go.sum index bf902ab5d7..a7d0412fa7 100644 --- a/go.sum +++ b/go.sum @@ -246,8 +246,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -416,8 +414,6 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/likexian/gokit v0.24.7 h1:jGb8rZTKFnk0tAY9Knd4FwQVLRVBaAEM1gY8C/y1sBQ= -github.com/likexian/gokit v0.24.7/go.mod h1:NCv1RDZK5kR0T2SfAl/vjIO6rsjszt2C/25TKxJalhs= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -907,7 +903,6 @@ golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1055,7 +1050,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/apiserver/admin_routes.go b/internal/apiserver/admin_routes.go index 5fada1a75d..d82b3a2a4e 100644 --- a/internal/apiserver/admin_routes.go +++ b/internal/apiserver/admin_routes.go @@ -16,7 +16,7 @@ package apiserver -import "github.com/hyperledger-labs/firefly/internal/oapispec" +import "github.com/hyperledger/firefly/internal/oapispec" var adminRoutes = []*oapispec.Route{ getConfig, diff --git a/internal/apiserver/http_server.go b/internal/apiserver/http_server.go index 98b7cc6df6..313a8e09db 100644 --- a/internal/apiserver/http_server.go +++ b/internal/apiserver/http_server.go @@ -26,10 +26,10 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) const ( diff --git a/internal/apiserver/http_server_test.go b/internal/apiserver/http_server_test.go index 90870a0a9f..4d21954907 100644 --- a/internal/apiserver/http_server_test.go +++ b/internal/apiserver/http_server_test.go @@ -35,7 +35,7 @@ import ( "time" "github.com/gorilla/mux" - "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger/firefly/internal/config" "github.com/stretchr/testify/assert" ) diff --git a/internal/apiserver/restfilter.go b/internal/apiserver/restfilter.go index da32554d64..1e52e03745 100644 --- a/internal/apiserver/restfilter.go +++ b/internal/apiserver/restfilter.go @@ -24,9 +24,9 @@ import ( "strconv" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" ) type filterResultsWithCount struct { diff --git a/internal/apiserver/restfilter_test.go b/internal/apiserver/restfilter_test.go index da0bd7c719..897bbd2f71 100644 --- a/internal/apiserver/restfilter_test.go +++ b/internal/apiserver/restfilter_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/database" "github.com/stretchr/testify/assert" ) diff --git a/internal/apiserver/route_admin_delete_config_record.go b/internal/apiserver/route_admin_delete_config_record.go index 5fb8bcee75..2d57a8b25a 100644 --- a/internal/apiserver/route_admin_delete_config_record.go +++ b/internal/apiserver/route_admin_delete_config_record.go @@ -19,8 +19,8 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" ) var deleteConfigRecord = &oapispec.Route{ diff --git a/internal/apiserver/route_admin_delete_config_record_test.go b/internal/apiserver/route_admin_delete_config_record_test.go index 57d13759ea..42c787f4a9 100644 --- a/internal/apiserver/route_admin_delete_config_record_test.go +++ b/internal/apiserver/route_admin_delete_config_record_test.go @@ -23,7 +23,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_admin_get_config.go b/internal/apiserver/route_admin_get_config.go index d52783560b..e21991bcfc 100644 --- a/internal/apiserver/route_admin_get_config.go +++ b/internal/apiserver/route_admin_get_config.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getConfig = &oapispec.Route{ diff --git a/internal/apiserver/route_admin_get_config_record.go b/internal/apiserver/route_admin_get_config_record.go index 68b06d2042..5b0f349af5 100644 --- a/internal/apiserver/route_admin_get_config_record.go +++ b/internal/apiserver/route_admin_get_config_record.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getConfigRecord = &oapispec.Route{ diff --git a/internal/apiserver/route_admin_get_config_record_test.go b/internal/apiserver/route_admin_get_config_record_test.go index f9fbe9b33c..0be29fa9fc 100644 --- a/internal/apiserver/route_admin_get_config_record_test.go +++ b/internal/apiserver/route_admin_get_config_record_test.go @@ -23,7 +23,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_admin_get_config_records.go b/internal/apiserver/route_admin_get_config_records.go index 984269f09e..18a1fe0785 100644 --- a/internal/apiserver/route_admin_get_config_records.go +++ b/internal/apiserver/route_admin_get_config_records.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getConfigRecords = &oapispec.Route{ diff --git a/internal/apiserver/route_admin_get_config_records_test.go b/internal/apiserver/route_admin_get_config_records_test.go index 553de324f4..50bd00e44b 100644 --- a/internal/apiserver/route_admin_get_config_records_test.go +++ b/internal/apiserver/route_admin_get_config_records_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_admin_get_config_test.go b/internal/apiserver/route_admin_get_config_test.go index e8dc66ee45..f498940266 100644 --- a/internal/apiserver/route_admin_get_config_test.go +++ b/internal/apiserver/route_admin_get_config_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_admin_put_config_record.go b/internal/apiserver/route_admin_put_config_record.go index 00efec0136..d8fd73c75a 100644 --- a/internal/apiserver/route_admin_put_config_record.go +++ b/internal/apiserver/route_admin_put_config_record.go @@ -20,9 +20,9 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) const anyJSONSchema = `{ diff --git a/internal/apiserver/route_admin_put_config_record_test.go b/internal/apiserver/route_admin_put_config_record_test.go index 295d899030..b86c529a25 100644 --- a/internal/apiserver/route_admin_put_config_record_test.go +++ b/internal/apiserver/route_admin_put_config_record_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_admin_put_config_reset.go b/internal/apiserver/route_admin_put_config_reset.go index f0750099c6..4a7c1d63d7 100644 --- a/internal/apiserver/route_admin_put_config_reset.go +++ b/internal/apiserver/route_admin_put_config_reset.go @@ -20,9 +20,9 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postResetConfig = &oapispec.Route{ diff --git a/internal/apiserver/route_delete_subscription.go b/internal/apiserver/route_delete_subscription.go index 806f8a0ec1..1af23e9235 100644 --- a/internal/apiserver/route_delete_subscription.go +++ b/internal/apiserver/route_delete_subscription.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" ) var deleteSubscription = &oapispec.Route{ diff --git a/internal/apiserver/route_delete_subscription_test.go b/internal/apiserver/route_delete_subscription_test.go index 3cd7826528..6f094f6db1 100644 --- a/internal/apiserver/route_delete_subscription_test.go +++ b/internal/apiserver/route_delete_subscription_test.go @@ -23,7 +23,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_batch_by_id.go b/internal/apiserver/route_get_batch_by_id.go index cc9b925990..e4ca9b2cc0 100644 --- a/internal/apiserver/route_get_batch_by_id.go +++ b/internal/apiserver/route_get_batch_by_id.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getBatchByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_batch_by_id_test.go b/internal/apiserver/route_get_batch_by_id_test.go index 8acec05eb9..7ab63c56a0 100644 --- a/internal/apiserver/route_get_batch_by_id_test.go +++ b/internal/apiserver/route_get_batch_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_batches.go b/internal/apiserver/route_get_batches.go index 27553b85fe..e15489d23a 100644 --- a/internal/apiserver/route_get_batches.go +++ b/internal/apiserver/route_get_batches.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getBatches = &oapispec.Route{ diff --git a/internal/apiserver/route_get_batches_test.go b/internal/apiserver/route_get_batches_test.go index 5a2595015f..c74a687a9f 100644 --- a/internal/apiserver/route_get_batches_test.go +++ b/internal/apiserver/route_get_batches_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_data.go b/internal/apiserver/route_get_data.go index 5b3156ddd6..305f4bdcfd 100644 --- a/internal/apiserver/route_get_data.go +++ b/internal/apiserver/route_get_data.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getData = &oapispec.Route{ diff --git a/internal/apiserver/route_get_data_blob.go b/internal/apiserver/route_get_data_blob.go index 0e7d359a96..5ba4258b30 100644 --- a/internal/apiserver/route_get_data_blob.go +++ b/internal/apiserver/route_get_data_blob.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" ) var getDataBlob = &oapispec.Route{ diff --git a/internal/apiserver/route_get_data_blob_test.go b/internal/apiserver/route_get_data_blob_test.go index 0fba98a290..7d22e1e3c8 100644 --- a/internal/apiserver/route_get_data_blob_test.go +++ b/internal/apiserver/route_get_data_blob_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/datamocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_data_by_id.go b/internal/apiserver/route_get_data_by_id.go index e3cb98866b..11c8bc955c 100644 --- a/internal/apiserver/route_get_data_by_id.go +++ b/internal/apiserver/route_get_data_by_id.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getDataByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_data_by_id_test.go b/internal/apiserver/route_get_data_by_id_test.go index 83bda593b5..acb670968e 100644 --- a/internal/apiserver/route_get_data_by_id_test.go +++ b/internal/apiserver/route_get_data_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_data_msgs.go b/internal/apiserver/route_get_data_msgs.go index 38457db09f..2999aed0eb 100644 --- a/internal/apiserver/route_get_data_msgs.go +++ b/internal/apiserver/route_get_data_msgs.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getDataMsgs = &oapispec.Route{ diff --git a/internal/apiserver/route_get_data_msgs_test.go b/internal/apiserver/route_get_data_msgs_test.go index 98ff0b0d72..28fe620391 100644 --- a/internal/apiserver/route_get_data_msgs_test.go +++ b/internal/apiserver/route_get_data_msgs_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_data_test.go b/internal/apiserver/route_get_data_test.go index 80a7722376..6a69d09370 100644 --- a/internal/apiserver/route_get_data_test.go +++ b/internal/apiserver/route_get_data_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_datatype_by_name.go b/internal/apiserver/route_get_datatype_by_name.go index 9891523a27..74fbfd9e9f 100644 --- a/internal/apiserver/route_get_datatype_by_name.go +++ b/internal/apiserver/route_get_datatype_by_name.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getDatatypeByName = &oapispec.Route{ diff --git a/internal/apiserver/route_get_datatype_by_name_test.go b/internal/apiserver/route_get_datatype_by_name_test.go index adefbb98cc..c69d1bd16f 100644 --- a/internal/apiserver/route_get_datatype_by_name_test.go +++ b/internal/apiserver/route_get_datatype_by_name_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_datatypes.go b/internal/apiserver/route_get_datatypes.go index 00fb87fefc..5eae50f398 100644 --- a/internal/apiserver/route_get_datatypes.go +++ b/internal/apiserver/route_get_datatypes.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getDatatypes = &oapispec.Route{ diff --git a/internal/apiserver/route_get_datatypes_by_id.go b/internal/apiserver/route_get_datatypes_by_id.go index c83dcecb79..d18ccdfa71 100644 --- a/internal/apiserver/route_get_datatypes_by_id.go +++ b/internal/apiserver/route_get_datatypes_by_id.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getDatatypeByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_datatypes_by_id_test.go b/internal/apiserver/route_get_datatypes_by_id_test.go index 7d65448909..362a1249bf 100644 --- a/internal/apiserver/route_get_datatypes_by_id_test.go +++ b/internal/apiserver/route_get_datatypes_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_datatypes_test.go b/internal/apiserver/route_get_datatypes_test.go index 7ea82cb45d..f77fcc23b1 100644 --- a/internal/apiserver/route_get_datatypes_test.go +++ b/internal/apiserver/route_get_datatypes_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_event_by_id.go b/internal/apiserver/route_get_event_by_id.go index c615c77f5c..bba6fd0d4a 100644 --- a/internal/apiserver/route_get_event_by_id.go +++ b/internal/apiserver/route_get_event_by_id.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getEventByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_event_by_id_test.go b/internal/apiserver/route_get_event_by_id_test.go index b778132854..a9bcce1421 100644 --- a/internal/apiserver/route_get_event_by_id_test.go +++ b/internal/apiserver/route_get_event_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_events.go b/internal/apiserver/route_get_events.go index ae442ba508..45fb340ed3 100644 --- a/internal/apiserver/route_get_events.go +++ b/internal/apiserver/route_get_events.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getEvents = &oapispec.Route{ diff --git a/internal/apiserver/route_get_events_test.go b/internal/apiserver/route_get_events_test.go index b975962674..775c822646 100644 --- a/internal/apiserver/route_get_events_test.go +++ b/internal/apiserver/route_get_events_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_msg_by_id.go b/internal/apiserver/route_get_msg_by_id.go index 8819bfac7e..d4fb5d0c25 100644 --- a/internal/apiserver/route_get_msg_by_id.go +++ b/internal/apiserver/route_get_msg_by_id.go @@ -20,10 +20,10 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getMsgByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_msg_by_id_test.go b/internal/apiserver/route_get_msg_by_id_test.go index e9d89f95a2..815298629e 100644 --- a/internal/apiserver/route_get_msg_by_id_test.go +++ b/internal/apiserver/route_get_msg_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_msg_data.go b/internal/apiserver/route_get_msg_data.go index abb9452c31..0dd8d57b09 100644 --- a/internal/apiserver/route_get_msg_data.go +++ b/internal/apiserver/route_get_msg_data.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getMsgData = &oapispec.Route{ diff --git a/internal/apiserver/route_get_msg_data_test.go b/internal/apiserver/route_get_msg_data_test.go index b35cb16f3c..6dc4879657 100644 --- a/internal/apiserver/route_get_msg_data_test.go +++ b/internal/apiserver/route_get_msg_data_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_msg_events.go b/internal/apiserver/route_get_msg_events.go index e357afda69..40fb69d6f0 100644 --- a/internal/apiserver/route_get_msg_events.go +++ b/internal/apiserver/route_get_msg_events.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getMsgEvents = &oapispec.Route{ diff --git a/internal/apiserver/route_get_msg_events_test.go b/internal/apiserver/route_get_msg_events_test.go index 4e578ca9e0..e70e03a69c 100644 --- a/internal/apiserver/route_get_msg_events_test.go +++ b/internal/apiserver/route_get_msg_events_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_msg_ops.go b/internal/apiserver/route_get_msg_ops.go index 716e3211b0..5e975f9952 100644 --- a/internal/apiserver/route_get_msg_ops.go +++ b/internal/apiserver/route_get_msg_ops.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getMsgOps = &oapispec.Route{ diff --git a/internal/apiserver/route_get_msg_ops_test.go b/internal/apiserver/route_get_msg_ops_test.go index 6e11e0937d..7efb10da55 100644 --- a/internal/apiserver/route_get_msg_ops_test.go +++ b/internal/apiserver/route_get_msg_ops_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_msg_txn.go b/internal/apiserver/route_get_msg_txn.go index 01dfd5df7a..1e45ca733a 100644 --- a/internal/apiserver/route_get_msg_txn.go +++ b/internal/apiserver/route_get_msg_txn.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getMsgTxn = &oapispec.Route{ diff --git a/internal/apiserver/route_get_msg_txn_test.go b/internal/apiserver/route_get_msg_txn_test.go index 906a2e27ff..dd1d0d4089 100644 --- a/internal/apiserver/route_get_msg_txn_test.go +++ b/internal/apiserver/route_get_msg_txn_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_msgs.go b/internal/apiserver/route_get_msgs.go index 735926bb00..f4c83c64ec 100644 --- a/internal/apiserver/route_get_msgs.go +++ b/internal/apiserver/route_get_msgs.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getMsgs = &oapispec.Route{ diff --git a/internal/apiserver/route_get_msgs_test.go b/internal/apiserver/route_get_msgs_test.go index 0489540a1e..a0010dd78c 100644 --- a/internal/apiserver/route_get_msgs_test.go +++ b/internal/apiserver/route_get_msgs_test.go @@ -21,8 +21,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_namespace.go b/internal/apiserver/route_get_namespace.go index b75cd97f82..f8cf89cc32 100644 --- a/internal/apiserver/route_get_namespace.go +++ b/internal/apiserver/route_get_namespace.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getNamespace = &oapispec.Route{ diff --git a/internal/apiserver/route_get_namespace_test.go b/internal/apiserver/route_get_namespace_test.go index 90594a8464..4befc39bec 100644 --- a/internal/apiserver/route_get_namespace_test.go +++ b/internal/apiserver/route_get_namespace_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_namespaces.go b/internal/apiserver/route_get_namespaces.go index fbc10c349b..e669f9f084 100644 --- a/internal/apiserver/route_get_namespaces.go +++ b/internal/apiserver/route_get_namespaces.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getNamespaces = &oapispec.Route{ diff --git a/internal/apiserver/route_get_namespaces_test.go b/internal/apiserver/route_get_namespaces_test.go index 6f40a774a6..6e8ff15982 100644 --- a/internal/apiserver/route_get_namespaces_test.go +++ b/internal/apiserver/route_get_namespaces_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_net_node.go b/internal/apiserver/route_get_net_node.go index 509798ce36..b4d9127bb5 100644 --- a/internal/apiserver/route_get_net_node.go +++ b/internal/apiserver/route_get_net_node.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getNetworkNode = &oapispec.Route{ diff --git a/internal/apiserver/route_get_net_node_test.go b/internal/apiserver/route_get_net_node_test.go index f41448a302..f94baa7200 100644 --- a/internal/apiserver/route_get_net_node_test.go +++ b/internal/apiserver/route_get_net_node_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_net_nodes.go b/internal/apiserver/route_get_net_nodes.go index bb06bd131e..729db03316 100644 --- a/internal/apiserver/route_get_net_nodes.go +++ b/internal/apiserver/route_get_net_nodes.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getNetworkNodes = &oapispec.Route{ diff --git a/internal/apiserver/route_get_net_nodes_test.go b/internal/apiserver/route_get_net_nodes_test.go index f89dc05d03..187a2e7298 100644 --- a/internal/apiserver/route_get_net_nodes_test.go +++ b/internal/apiserver/route_get_net_nodes_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_net_org.go b/internal/apiserver/route_get_net_org.go index 6a878940a1..5296238ac4 100644 --- a/internal/apiserver/route_get_net_org.go +++ b/internal/apiserver/route_get_net_org.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getNetworkOrg = &oapispec.Route{ diff --git a/internal/apiserver/route_get_net_org_test.go b/internal/apiserver/route_get_net_org_test.go index add7637945..abe4a2320b 100644 --- a/internal/apiserver/route_get_net_org_test.go +++ b/internal/apiserver/route_get_net_org_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_net_orgs.go b/internal/apiserver/route_get_net_orgs.go index 141cab0b1d..132aa10a0c 100644 --- a/internal/apiserver/route_get_net_orgs.go +++ b/internal/apiserver/route_get_net_orgs.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getNetworkOrgs = &oapispec.Route{ diff --git a/internal/apiserver/route_get_net_orgs_test.go b/internal/apiserver/route_get_net_orgs_test.go index 7afa119194..e78cab227d 100644 --- a/internal/apiserver/route_get_net_orgs_test.go +++ b/internal/apiserver/route_get_net_orgs_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_op_by_id.go b/internal/apiserver/route_get_op_by_id.go index 08c27338f3..ab26f42317 100644 --- a/internal/apiserver/route_get_op_by_id.go +++ b/internal/apiserver/route_get_op_by_id.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getOpByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_op_by_id_test.go b/internal/apiserver/route_get_op_by_id_test.go index 0b5e03257b..53873b1b1e 100644 --- a/internal/apiserver/route_get_op_by_id_test.go +++ b/internal/apiserver/route_get_op_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_ops.go b/internal/apiserver/route_get_ops.go index 51161d5fa4..4efc3f5940 100644 --- a/internal/apiserver/route_get_ops.go +++ b/internal/apiserver/route_get_ops.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getOps = &oapispec.Route{ diff --git a/internal/apiserver/route_get_ops_test.go b/internal/apiserver/route_get_ops_test.go index d142b87880..55422cdf42 100644 --- a/internal/apiserver/route_get_ops_test.go +++ b/internal/apiserver/route_get_ops_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_status.go b/internal/apiserver/route_get_status.go index f1cc33d534..be84e63390 100644 --- a/internal/apiserver/route_get_status.go +++ b/internal/apiserver/route_get_status.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getStatus = &oapispec.Route{ diff --git a/internal/apiserver/route_get_status_test.go b/internal/apiserver/route_get_status_test.go index 198f67253f..08f179622c 100644 --- a/internal/apiserver/route_get_status_test.go +++ b/internal/apiserver/route_get_status_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_subscription_by_id.go b/internal/apiserver/route_get_subscription_by_id.go index a056329b96..454bb1b4a8 100644 --- a/internal/apiserver/route_get_subscription_by_id.go +++ b/internal/apiserver/route_get_subscription_by_id.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getSubscriptionByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_subscription_by_id_test.go b/internal/apiserver/route_get_subscription_by_id_test.go index d8e2d1fa0b..8bbe7bd8d2 100644 --- a/internal/apiserver/route_get_subscription_by_id_test.go +++ b/internal/apiserver/route_get_subscription_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_subscriptions.go b/internal/apiserver/route_get_subscriptions.go index d62c9f5835..6f7e448a78 100644 --- a/internal/apiserver/route_get_subscriptions.go +++ b/internal/apiserver/route_get_subscriptions.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getSubscriptions = &oapispec.Route{ diff --git a/internal/apiserver/route_get_subscriptions_test.go b/internal/apiserver/route_get_subscriptions_test.go index 9b08d29783..c62069cf31 100644 --- a/internal/apiserver/route_get_subscriptions_test.go +++ b/internal/apiserver/route_get_subscriptions_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_token_accounts.go b/internal/apiserver/route_get_token_accounts.go index 52c37df18f..6e405a56a7 100644 --- a/internal/apiserver/route_get_token_accounts.go +++ b/internal/apiserver/route_get_token_accounts.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getTokenAccounts = &oapispec.Route{ diff --git a/internal/apiserver/route_get_token_accounts_test.go b/internal/apiserver/route_get_token_accounts_test.go index 0b3fc88996..58052137ca 100644 --- a/internal/apiserver/route_get_token_accounts_test.go +++ b/internal/apiserver/route_get_token_accounts_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/assetmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/assetmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_token_pool_by_name.go b/internal/apiserver/route_get_token_pool_by_name.go index 54475711ac..aeef91f802 100644 --- a/internal/apiserver/route_get_token_pool_by_name.go +++ b/internal/apiserver/route_get_token_pool_by_name.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getTokenPoolByName = &oapispec.Route{ diff --git a/internal/apiserver/route_get_token_pool_by_name_test.go b/internal/apiserver/route_get_token_pool_by_name_test.go index a1d7f14cc0..86f1015bef 100644 --- a/internal/apiserver/route_get_token_pool_by_name_test.go +++ b/internal/apiserver/route_get_token_pool_by_name_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/assetmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/assetmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_token_pools.go b/internal/apiserver/route_get_token_pools.go index b96954e68d..0050ab8aef 100644 --- a/internal/apiserver/route_get_token_pools.go +++ b/internal/apiserver/route_get_token_pools.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getTokenPools = &oapispec.Route{ diff --git a/internal/apiserver/route_get_token_pools_test.go b/internal/apiserver/route_get_token_pools_test.go index 3e218c49bb..668fa47f4d 100644 --- a/internal/apiserver/route_get_token_pools_test.go +++ b/internal/apiserver/route_get_token_pools_test.go @@ -20,8 +20,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/assetmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/assetmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_txn_by_id.go b/internal/apiserver/route_get_txn_by_id.go index af4d1e63c1..b16f22c68f 100644 --- a/internal/apiserver/route_get_txn_by_id.go +++ b/internal/apiserver/route_get_txn_by_id.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getTxnByID = &oapispec.Route{ diff --git a/internal/apiserver/route_get_txn_by_id_test.go b/internal/apiserver/route_get_txn_by_id_test.go index 7959925110..7ae38c7d48 100644 --- a/internal/apiserver/route_get_txn_by_id_test.go +++ b/internal/apiserver/route_get_txn_by_id_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_txn_ops.go b/internal/apiserver/route_get_txn_ops.go index 12c3f5411c..946270310c 100644 --- a/internal/apiserver/route_get_txn_ops.go +++ b/internal/apiserver/route_get_txn_ops.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getTxnOps = &oapispec.Route{ diff --git a/internal/apiserver/route_get_txn_ops_test.go b/internal/apiserver/route_get_txn_ops_test.go index 626c2fffe8..29e9ff190a 100644 --- a/internal/apiserver/route_get_txn_ops_test.go +++ b/internal/apiserver/route_get_txn_ops_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_get_txns.go b/internal/apiserver/route_get_txns.go index 1b2d2a4478..6942d7d3bd 100644 --- a/internal/apiserver/route_get_txns.go +++ b/internal/apiserver/route_get_txns.go @@ -19,11 +19,11 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var getTxns = &oapispec.Route{ diff --git a/internal/apiserver/route_get_txns_test.go b/internal/apiserver/route_get_txns_test.go index 419e086d6d..ba4515590a 100644 --- a/internal/apiserver/route_get_txns_test.go +++ b/internal/apiserver/route_get_txns_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_broadcast_datatype.go b/internal/apiserver/route_post_broadcast_datatype.go index bce6d36e5a..8fa1c20bd8 100644 --- a/internal/apiserver/route_post_broadcast_datatype.go +++ b/internal/apiserver/route_post_broadcast_datatype.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postBroadcastDatatype = &oapispec.Route{ diff --git a/internal/apiserver/route_post_broadcast_datatype_test.go b/internal/apiserver/route_post_broadcast_datatype_test.go index eb9d4bdab4..1a2cc91a99 100644 --- a/internal/apiserver/route_post_broadcast_datatype_test.go +++ b/internal/apiserver/route_post_broadcast_datatype_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_broadcast_message.go b/internal/apiserver/route_post_broadcast_message.go index 7814ab4b94..e6302bba70 100644 --- a/internal/apiserver/route_post_broadcast_message.go +++ b/internal/apiserver/route_post_broadcast_message.go @@ -20,10 +20,10 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postBroadcastMessage = &oapispec.Route{ diff --git a/internal/apiserver/route_post_broadcast_message_test.go b/internal/apiserver/route_post_broadcast_message_test.go index 8c0519067d..bae77fbd9a 100644 --- a/internal/apiserver/route_post_broadcast_message_test.go +++ b/internal/apiserver/route_post_broadcast_message_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_broadcast_namespace.go b/internal/apiserver/route_post_broadcast_namespace.go index 17b01e03c0..750b95cad8 100644 --- a/internal/apiserver/route_post_broadcast_namespace.go +++ b/internal/apiserver/route_post_broadcast_namespace.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postBroadcastNamespace = &oapispec.Route{ diff --git a/internal/apiserver/route_post_broadcast_namespace_test.go b/internal/apiserver/route_post_broadcast_namespace_test.go index be580b81d3..b00dbce76f 100644 --- a/internal/apiserver/route_post_broadcast_namespace_test.go +++ b/internal/apiserver/route_post_broadcast_namespace_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_data.go b/internal/apiserver/route_post_data.go index a8718d6b45..c936cf5108 100644 --- a/internal/apiserver/route_post_data.go +++ b/internal/apiserver/route_post_data.go @@ -22,10 +22,10 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postData = &oapispec.Route{ diff --git a/internal/apiserver/route_post_data_test.go b/internal/apiserver/route_post_data_test.go index 616a79230c..13cb3f6caa 100644 --- a/internal/apiserver/route_post_data_test.go +++ b/internal/apiserver/route_post_data_test.go @@ -24,9 +24,9 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_datatype.go b/internal/apiserver/route_post_new_datatype.go index a003534a89..9f42824347 100644 --- a/internal/apiserver/route_post_new_datatype.go +++ b/internal/apiserver/route_post_new_datatype.go @@ -20,10 +20,10 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postNewDatatype = &oapispec.Route{ diff --git a/internal/apiserver/route_post_new_datatype_test.go b/internal/apiserver/route_post_new_datatype_test.go index 0ef17fabe5..e20ce8ef9f 100644 --- a/internal/apiserver/route_post_new_datatype_test.go +++ b/internal/apiserver/route_post_new_datatype_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_message_broadcast.go b/internal/apiserver/route_post_new_message_broadcast.go index ebd739d59d..99aaa9a99c 100644 --- a/internal/apiserver/route_post_new_message_broadcast.go +++ b/internal/apiserver/route_post_new_message_broadcast.go @@ -21,10 +21,10 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var broadcastSchema = `{ diff --git a/internal/apiserver/route_post_new_message_broadcast_test.go b/internal/apiserver/route_post_new_message_broadcast_test.go index 9339349b91..c14eed6403 100644 --- a/internal/apiserver/route_post_new_message_broadcast_test.go +++ b/internal/apiserver/route_post_new_message_broadcast_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_message_private.go b/internal/apiserver/route_post_new_message_private.go index 4d8452ced6..8a641740ec 100644 --- a/internal/apiserver/route_post_new_message_private.go +++ b/internal/apiserver/route_post_new_message_private.go @@ -21,10 +21,10 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var privateSendSchema = `{ diff --git a/internal/apiserver/route_post_new_message_private_test.go b/internal/apiserver/route_post_new_message_private_test.go index 6647e5e926..aeffc049c3 100644 --- a/internal/apiserver/route_post_new_message_private_test.go +++ b/internal/apiserver/route_post_new_message_private_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/privatemessagingmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_message_requestreply.go b/internal/apiserver/route_post_new_message_requestreply.go index 372c525a45..e2d0d16b68 100644 --- a/internal/apiserver/route_post_new_message_requestreply.go +++ b/internal/apiserver/route_post_new_message_requestreply.go @@ -20,10 +20,10 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postNewMessageRequestReply = &oapispec.Route{ diff --git a/internal/apiserver/route_post_new_message_requestreply_test.go b/internal/apiserver/route_post_new_message_requestreply_test.go index eeb44f733f..a9f939026f 100644 --- a/internal/apiserver/route_post_new_message_requestreply_test.go +++ b/internal/apiserver/route_post_new_message_requestreply_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_namespace.go b/internal/apiserver/route_post_new_namespace.go index 6bd0ad6ad2..d45f1fbddf 100644 --- a/internal/apiserver/route_post_new_namespace.go +++ b/internal/apiserver/route_post_new_namespace.go @@ -20,9 +20,9 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postNewNamespace = &oapispec.Route{ diff --git a/internal/apiserver/route_post_new_namespace_test.go b/internal/apiserver/route_post_new_namespace_test.go index 7a33732a08..2e5af0ef04 100644 --- a/internal/apiserver/route_post_new_namespace_test.go +++ b/internal/apiserver/route_post_new_namespace_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_node_self.go b/internal/apiserver/route_post_new_node_self.go index bc4e0cd482..7ba50507e7 100644 --- a/internal/apiserver/route_post_new_node_self.go +++ b/internal/apiserver/route_post_new_node_self.go @@ -21,9 +21,9 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postNodesSelf = &oapispec.Route{ diff --git a/internal/apiserver/route_post_new_node_self_test.go b/internal/apiserver/route_post_new_node_self_test.go index f76807c68b..f1fc28e1f3 100644 --- a/internal/apiserver/route_post_new_node_self_test.go +++ b/internal/apiserver/route_post_new_node_self_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_organization.go b/internal/apiserver/route_post_new_organization.go index 2571bbcc28..a6b9f94e74 100644 --- a/internal/apiserver/route_post_new_organization.go +++ b/internal/apiserver/route_post_new_organization.go @@ -20,9 +20,9 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postNewOrganization = &oapispec.Route{ diff --git a/internal/apiserver/route_post_new_organization_self.go b/internal/apiserver/route_post_new_organization_self.go index c007475ba7..86b79f5a4c 100644 --- a/internal/apiserver/route_post_new_organization_self.go +++ b/internal/apiserver/route_post_new_organization_self.go @@ -21,9 +21,9 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postNewOrganizationSelf = &oapispec.Route{ diff --git a/internal/apiserver/route_post_new_organization_self_test.go b/internal/apiserver/route_post_new_organization_self_test.go index 67d76a2c02..a33c0f4343 100644 --- a/internal/apiserver/route_post_new_organization_self_test.go +++ b/internal/apiserver/route_post_new_organization_self_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_organization_test.go b/internal/apiserver/route_post_new_organization_test.go index 38412b5f9f..ecd8035238 100644 --- a/internal/apiserver/route_post_new_organization_test.go +++ b/internal/apiserver/route_post_new_organization_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_new_subscription.go b/internal/apiserver/route_post_new_subscription.go index ad767f66a7..34d01a363e 100644 --- a/internal/apiserver/route_post_new_subscription.go +++ b/internal/apiserver/route_post_new_subscription.go @@ -23,11 +23,11 @@ import ( "github.com/getkin/kin-openapi/openapi3" "github.com/getkin/kin-openapi/openapi3gen" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/events/eifactory" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/events/eifactory" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) func newSubscriptionSchemaGenerator(ctx context.Context) string { diff --git a/internal/apiserver/route_post_new_subscription_test.go b/internal/apiserver/route_post_new_subscription_test.go index 5cd1dcfa18..fe7f189959 100644 --- a/internal/apiserver/route_post_new_subscription_test.go +++ b/internal/apiserver/route_post_new_subscription_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_register_node.go b/internal/apiserver/route_post_register_node.go index fbe1c64604..bfbddcc2a8 100644 --- a/internal/apiserver/route_post_register_node.go +++ b/internal/apiserver/route_post_register_node.go @@ -20,9 +20,9 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postRegisterNode = &oapispec.Route{ diff --git a/internal/apiserver/route_post_register_node_org.go b/internal/apiserver/route_post_register_node_org.go index 1b875616cb..b8684a7ec0 100644 --- a/internal/apiserver/route_post_register_node_org.go +++ b/internal/apiserver/route_post_register_node_org.go @@ -20,9 +20,9 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postRegisterNodeOrg = &oapispec.Route{ diff --git a/internal/apiserver/route_post_register_node_org_test.go b/internal/apiserver/route_post_register_node_org_test.go index 4971c1faaa..94c5c10497 100644 --- a/internal/apiserver/route_post_register_node_org_test.go +++ b/internal/apiserver/route_post_register_node_org_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_register_node_test.go b/internal/apiserver/route_post_register_node_test.go index f4bd40c4e9..29a67cc349 100644 --- a/internal/apiserver/route_post_register_node_test.go +++ b/internal/apiserver/route_post_register_node_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_register_org.go b/internal/apiserver/route_post_register_org.go index da4d55876c..9fa3c5ff7c 100644 --- a/internal/apiserver/route_post_register_org.go +++ b/internal/apiserver/route_post_register_org.go @@ -19,9 +19,9 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postRegisterOrg = &oapispec.Route{ diff --git a/internal/apiserver/route_post_register_org_test.go b/internal/apiserver/route_post_register_org_test.go index a90df1928c..3e7792adcf 100644 --- a/internal/apiserver/route_post_register_org_test.go +++ b/internal/apiserver/route_post_register_org_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_request_message.go b/internal/apiserver/route_post_request_message.go index c83e83ac04..784b6b5787 100644 --- a/internal/apiserver/route_post_request_message.go +++ b/internal/apiserver/route_post_request_message.go @@ -20,10 +20,10 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postRequestMessage = &oapispec.Route{ diff --git a/internal/apiserver/route_post_request_message_test.go b/internal/apiserver/route_post_request_message_test.go index 2cb94b9f74..e7b71bd912 100644 --- a/internal/apiserver/route_post_request_message_test.go +++ b/internal/apiserver/route_post_request_message_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_send_message.go b/internal/apiserver/route_post_send_message.go index 0c031afcc1..47e6f2c2c0 100644 --- a/internal/apiserver/route_post_send_message.go +++ b/internal/apiserver/route_post_send_message.go @@ -20,10 +20,10 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postSendMessage = &oapispec.Route{ diff --git a/internal/apiserver/route_post_send_message_test.go b/internal/apiserver/route_post_send_message_test.go index 8858c9c31d..ac9402190a 100644 --- a/internal/apiserver/route_post_send_message_test.go +++ b/internal/apiserver/route_post_send_message_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/privatemessagingmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_post_token_pool.go b/internal/apiserver/route_post_token_pool.go index 3852f86a8e..7eba2b5442 100644 --- a/internal/apiserver/route_post_token_pool.go +++ b/internal/apiserver/route_post_token_pool.go @@ -20,10 +20,10 @@ import ( "net/http" "strings" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var postTokenPool = &oapispec.Route{ diff --git a/internal/apiserver/route_post_token_pool_test.go b/internal/apiserver/route_post_token_pool_test.go index 54be3ea80f..bf7c99b9f0 100644 --- a/internal/apiserver/route_post_token_pool_test.go +++ b/internal/apiserver/route_post_token_pool_test.go @@ -22,8 +22,8 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/mocks/assetmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/assetmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/route_put_subscription.go b/internal/apiserver/route_put_subscription.go index 5939d1ff36..7acefed9e2 100644 --- a/internal/apiserver/route_put_subscription.go +++ b/internal/apiserver/route_put_subscription.go @@ -19,10 +19,10 @@ package apiserver import ( "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/pkg/fftypes" ) var putSubscription = &oapispec.Route{ diff --git a/internal/apiserver/route_put_subscription_test.go b/internal/apiserver/route_put_subscription_test.go index f650a453e6..932a3614c8 100644 --- a/internal/apiserver/route_put_subscription_test.go +++ b/internal/apiserver/route_put_subscription_test.go @@ -22,7 +22,7 @@ import ( "net/http/httptest" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/apiserver/routes.go b/internal/apiserver/routes.go index 6bf416fe46..025388f4cd 100644 --- a/internal/apiserver/routes.go +++ b/internal/apiserver/routes.go @@ -16,7 +16,7 @@ package apiserver -import "github.com/hyperledger-labs/firefly/internal/oapispec" +import "github.com/hyperledger/firefly/internal/oapispec" const emptyObjectSchema = `{"type": "object"}` diff --git a/internal/apiserver/server.go b/internal/apiserver/server.go index 8bbb291cf2..22d0301018 100644 --- a/internal/apiserver/server.go +++ b/internal/apiserver/server.go @@ -31,15 +31,15 @@ import ( "github.com/ghodss/yaml" "github.com/gorilla/mux" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/events/eifactory" - "github.com/hyperledger-labs/firefly/internal/events/websockets" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/internal/orchestrator" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/events/eifactory" + "github.com/hyperledger/firefly/internal/events/websockets" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/internal/orchestrator" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ffcodeExtractor = regexp.MustCompile(`^(FF\d+):`) diff --git a/internal/apiserver/server_cors.go b/internal/apiserver/server_cors.go index 0d26110fbf..268f19e651 100644 --- a/internal/apiserver/server_cors.go +++ b/internal/apiserver/server_cors.go @@ -20,8 +20,8 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/log" "github.com/rs/cors" ) diff --git a/internal/apiserver/server_cors_test.go b/internal/apiserver/server_cors_test.go index 5ab6f9f263..5e9982aa7e 100644 --- a/internal/apiserver/server_cors_test.go +++ b/internal/apiserver/server_cors_test.go @@ -20,8 +20,8 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/likexian/gokit/assert" + "github.com/hyperledger/firefly/internal/config" + "github.com/stretchr/testify/assert" ) func TestServerCorsDisabled(t *testing.T) { diff --git a/internal/apiserver/server_test.go b/internal/apiserver/server_test.go index 186582cb7e..61398d262a 100644 --- a/internal/apiserver/server_test.go +++ b/internal/apiserver/server_test.go @@ -29,10 +29,10 @@ import ( "github.com/getkin/kin-openapi/openapi3" "github.com/gorilla/mux" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/oapispec" - "github.com/hyperledger-labs/firefly/mocks/orchestratormocks" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/oapispec" + "github.com/hyperledger/firefly/mocks/orchestratormocks" "github.com/stretchr/testify/assert" ) diff --git a/internal/apiserver/static.go b/internal/apiserver/static.go index 63c6a5f567..9edf12e960 100644 --- a/internal/apiserver/static.go +++ b/internal/apiserver/static.go @@ -23,9 +23,9 @@ import ( "path/filepath" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) type staticHandler struct { diff --git a/internal/assets/manager.go b/internal/assets/manager.go index 37681f72a4..683aa8b53b 100644 --- a/internal/assets/manager.go +++ b/internal/assets/manager.go @@ -19,13 +19,13 @@ package assets import ( "context" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" ) type Manager interface { diff --git a/internal/assets/manager_test.go b/internal/assets/manager_test.go index 91651f12a8..766588ba6c 100644 --- a/internal/assets/manager_test.go +++ b/internal/assets/manager_test.go @@ -19,16 +19,16 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" - "github.com/hyperledger-labs/firefly/mocks/tokenmocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/syncasyncmocks" + "github.com/hyperledger/firefly/mocks/tokenmocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/batch/batch_manager.go b/internal/batch/batch_manager.go index c9b36a1b3d..eda010725a 100644 --- a/internal/batch/batch_manager.go +++ b/internal/batch/batch_manager.go @@ -22,13 +22,13 @@ import ( "sync" "time" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) const ( diff --git a/internal/batch/batch_manager_test.go b/internal/batch/batch_manager_test.go index 772806506c..d939f1fa44 100644 --- a/internal/batch/batch_manager_test.go +++ b/internal/batch/batch_manager_test.go @@ -22,12 +22,12 @@ import ( "testing" "time" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/batch/batch_processor.go b/internal/batch/batch_processor.go index cee0bfb740..de5e3abb13 100644 --- a/internal/batch/batch_processor.go +++ b/internal/batch/batch_processor.go @@ -24,10 +24,10 @@ import ( "fmt" "time" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) type batchWork struct { diff --git a/internal/batch/batch_processor_test.go b/internal/batch/batch_processor_test.go index 02e459c962..fb02babaf3 100644 --- a/internal/batch/batch_processor_test.go +++ b/internal/batch/batch_processor_test.go @@ -21,10 +21,10 @@ import ( "testing" "time" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/batchpin/batchpin.go b/internal/batchpin/batchpin.go index ac2faa9f2c..5ecd2a5e8b 100644 --- a/internal/batchpin/batchpin.go +++ b/internal/batchpin/batchpin.go @@ -19,10 +19,10 @@ package batchpin import ( "context" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) type Submitter interface { diff --git a/internal/batchpin/batchpin_test.go b/internal/batchpin/batchpin_test.go index 404e10e04c..5932e741fc 100644 --- a/internal/batchpin/batchpin_test.go +++ b/internal/batchpin/batchpin_test.go @@ -21,10 +21,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/blockchain/bifactory/factory.go b/internal/blockchain/bifactory/factory.go index 2ba2d234e4..58b84d30a4 100644 --- a/internal/blockchain/bifactory/factory.go +++ b/internal/blockchain/bifactory/factory.go @@ -19,10 +19,10 @@ package bifactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/blockchain/ethereum" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/internal/blockchain/ethereum" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/blockchain" ) var plugins = []blockchain.Plugin{ diff --git a/internal/blockchain/ethereum/config.go b/internal/blockchain/ethereum/config.go index 17f0531113..5b19d71437 100644 --- a/internal/blockchain/ethereum/config.go +++ b/internal/blockchain/ethereum/config.go @@ -17,8 +17,8 @@ package ethereum import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/wsclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/wsclient" ) const ( diff --git a/internal/blockchain/ethereum/ethereum.go b/internal/blockchain/ethereum/ethereum.go index 8be5390687..544fc6dace 100644 --- a/internal/blockchain/ethereum/ethereum.go +++ b/internal/blockchain/ethereum/ethereum.go @@ -25,13 +25,13 @@ import ( "strings" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/fftypes" ) const ( diff --git a/internal/blockchain/ethereum/ethereum_test.go b/internal/blockchain/ethereum/ethereum_test.go index e5ea9e47dc..2b20532278 100644 --- a/internal/blockchain/ethereum/ethereum_test.go +++ b/internal/blockchain/ethereum/ethereum_test.go @@ -25,14 +25,14 @@ import ( "testing" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/wsmocks" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/wsmocks" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/jarcoal/httpmock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/broadcast/datatype.go b/internal/broadcast/datatype.go index 73033821e1..52ace611ae 100644 --- a/internal/broadcast/datatype.go +++ b/internal/broadcast/datatype.go @@ -19,7 +19,7 @@ package broadcast import ( "context" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (bm *broadcastManager) BroadcastDatatype(ctx context.Context, ns string, datatype *fftypes.Datatype, waitConfirm bool) (*fftypes.Message, error) { diff --git a/internal/broadcast/datatype_test.go b/internal/broadcast/datatype_test.go index ef22e44be1..03305c19c0 100644 --- a/internal/broadcast/datatype_test.go +++ b/internal/broadcast/datatype_test.go @@ -21,10 +21,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/broadcast/definition.go b/internal/broadcast/definition.go index 2529d76ea6..5d786456de 100644 --- a/internal/broadcast/definition.go +++ b/internal/broadcast/definition.go @@ -20,8 +20,8 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (bm *broadcastManager) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { diff --git a/internal/broadcast/definition_test.go b/internal/broadcast/definition_test.go index f6ee5f17a1..05eda60c2b 100644 --- a/internal/broadcast/definition_test.go +++ b/internal/broadcast/definition_test.go @@ -20,9 +20,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/broadcast/manager.go b/internal/broadcast/manager.go index 8a47e7c3e6..ae866e212b 100644 --- a/internal/broadcast/manager.go +++ b/internal/broadcast/manager.go @@ -21,18 +21,18 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/batch" - "github.com/hyperledger-labs/firefly/internal/batchpin" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/internal/batch" + "github.com/hyperledger/firefly/internal/batchpin" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/publicstorage" ) type Manager interface { diff --git a/internal/broadcast/manager_test.go b/internal/broadcast/manager_test.go index c27ccc78ef..f222ae6c63 100644 --- a/internal/broadcast/manager_test.go +++ b/internal/broadcast/manager_test.go @@ -21,17 +21,17 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/batchmocks" - "github.com/hyperledger-labs/firefly/mocks/batchpinmocks" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/batchmocks" + "github.com/hyperledger/firefly/mocks/batchpinmocks" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/mocks/syncasyncmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/broadcast/message.go b/internal/broadcast/message.go index ef747e5011..7640a0aac8 100644 --- a/internal/broadcast/message.go +++ b/internal/broadcast/message.go @@ -19,10 +19,10 @@ package broadcast import ( "context" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (bm *broadcastManager) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) { diff --git a/internal/broadcast/message_test.go b/internal/broadcast/message_test.go index c10d1b6692..874d786ca8 100644 --- a/internal/broadcast/message_test.go +++ b/internal/broadcast/message_test.go @@ -24,14 +24,14 @@ import ( "io/ioutil" "testing" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/mocks/syncasyncmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/broadcast/namespace.go b/internal/broadcast/namespace.go index 2289cb0d43..a0bcd4ac3d 100644 --- a/internal/broadcast/namespace.go +++ b/internal/broadcast/namespace.go @@ -19,7 +19,7 @@ package broadcast import ( "context" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (bm *broadcastManager) BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace, waitConfirm bool) (*fftypes.Message, error) { diff --git a/internal/broadcast/namespace_test.go b/internal/broadcast/namespace_test.go index f640570ccc..fb78a1869c 100644 --- a/internal/broadcast/namespace_test.go +++ b/internal/broadcast/namespace_test.go @@ -21,10 +21,10 @@ import ( "strings" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/config/config.go b/internal/config/config.go index da624912b5..34b42e09f4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -29,9 +29,9 @@ import ( "strings" "time" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/sirupsen/logrus" "github.com/spf13/viper" diff --git a/internal/config/config_test.go b/internal/config/config_test.go index c51c661329..49a7b77f7b 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -25,7 +25,7 @@ import ( "testing" "time" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/internal/data/blobstore.go b/internal/data/blobstore.go index 5ac90db4e4..2daa29d967 100644 --- a/internal/data/blobstore.go +++ b/internal/data/blobstore.go @@ -23,12 +23,12 @@ import ( "io" "github.com/docker/go-units" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/publicstorage" ) type blobStore struct { diff --git a/internal/data/blobstore_test.go b/internal/data/blobstore_test.go index 95a4985bca..418bba8814 100644 --- a/internal/data/blobstore_test.go +++ b/internal/data/blobstore_test.go @@ -27,10 +27,10 @@ import ( "testing" "testing/iotest" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/data/data_manager.go b/internal/data/data_manager.go index a997a7cf8a..82d36e3b51 100644 --- a/internal/data/data_manager.go +++ b/internal/data/data_manager.go @@ -22,13 +22,13 @@ import ( "io" "time" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/publicstorage" "github.com/karlseguin/ccache" ) diff --git a/internal/data/data_manager_test.go b/internal/data/data_manager_test.go index 13eb94f42d..097030d726 100644 --- a/internal/data/data_manager_test.go +++ b/internal/data/data_manager_test.go @@ -21,11 +21,11 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/data/json_validator.go b/internal/data/json_validator.go index 04a18291ec..0a79d4ff1c 100644 --- a/internal/data/json_validator.go +++ b/internal/data/json_validator.go @@ -20,9 +20,9 @@ import ( "context" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/xeipuuv/gojsonschema" ) diff --git a/internal/data/json_validator_test.go b/internal/data/json_validator_test.go index aaf53ba4c1..a9efe17668 100644 --- a/internal/data/json_validator_test.go +++ b/internal/data/json_validator_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/data/validator.go b/internal/data/validator.go index c984f65d4a..5cd70da2de 100644 --- a/internal/data/validator.go +++ b/internal/data/validator.go @@ -19,7 +19,7 @@ package data import ( "context" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" ) type Validator interface { diff --git a/internal/database/difactory/factory.go b/internal/database/difactory/factory.go index e17876737d..bbd27087a5 100644 --- a/internal/database/difactory/factory.go +++ b/internal/database/difactory/factory.go @@ -19,9 +19,9 @@ package difactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/database" ) var pluginsByName = make(map[string]database.Plugin) diff --git a/internal/database/difactory/plugins_cgo.go b/internal/database/difactory/plugins_cgo.go index 12d7e4d6aa..047114ca4a 100644 --- a/internal/database/difactory/plugins_cgo.go +++ b/internal/database/difactory/plugins_cgo.go @@ -20,9 +20,9 @@ package difactory import ( - "github.com/hyperledger-labs/firefly/internal/database/postgres" - "github.com/hyperledger-labs/firefly/internal/database/sqlite3" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/database/postgres" + "github.com/hyperledger/firefly/internal/database/sqlite3" + "github.com/hyperledger/firefly/pkg/database" ) var plugins = []database.Plugin{ diff --git a/internal/database/difactory/plugins_nocgo.go b/internal/database/difactory/plugins_nocgo.go index f33a53f319..28892ad449 100644 --- a/internal/database/difactory/plugins_nocgo.go +++ b/internal/database/difactory/plugins_nocgo.go @@ -19,8 +19,8 @@ package difactory import ( - "github.com/hyperledger-labs/firefly/internal/database/postgres" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/database/postgres" + "github.com/hyperledger/firefly/pkg/database" ) var plugins = []database.Plugin{ diff --git a/internal/database/postgres/config.go b/internal/database/postgres/config.go index 416e866f02..1304a2edce 100644 --- a/internal/database/postgres/config.go +++ b/internal/database/postgres/config.go @@ -17,7 +17,7 @@ package postgres import ( - "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger/firefly/internal/config" ) func (psql *Postgres) InitPrefix(prefix config.Prefix) { diff --git a/internal/database/postgres/postgres.go b/internal/database/postgres/postgres.go index 07f95c9c7b..e1f2f5620c 100644 --- a/internal/database/postgres/postgres.go +++ b/internal/database/postgres/postgres.go @@ -24,9 +24,9 @@ import ( sq "github.com/Masterminds/squirrel" migratedb "github.com/golang-migrate/migrate/v4/database" "github.com/golang-migrate/migrate/v4/database/postgres" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/database/sqlcommon" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/database/sqlcommon" + "github.com/hyperledger/firefly/pkg/database" // Import pq driver _ "github.com/lib/pq" diff --git a/internal/database/postgres/postgres_test.go b/internal/database/postgres/postgres_test.go index cb8ba9fdda..53cea8930b 100644 --- a/internal/database/postgres/postgres_test.go +++ b/internal/database/postgres/postgres_test.go @@ -21,9 +21,9 @@ import ( "testing" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/database/sqlcommon" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/database/sqlcommon" + "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/batch_sql.go b/internal/database/sqlcommon/batch_sql.go index eba3ae6e76..4e04b2f9f3 100644 --- a/internal/database/sqlcommon/batch_sql.go +++ b/internal/database/sqlcommon/batch_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/batch_sql_test.go b/internal/database/sqlcommon/batch_sql_test.go index b702fbc5eb..d172842b97 100644 --- a/internal/database/sqlcommon/batch_sql_test.go +++ b/internal/database/sqlcommon/batch_sql_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/blob_sql.go b/internal/database/sqlcommon/blob_sql.go index 62dcc50d32..97963d4f31 100644 --- a/internal/database/sqlcommon/blob_sql.go +++ b/internal/database/sqlcommon/blob_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/blob_sql_test.go b/internal/database/sqlcommon/blob_sql_test.go index 022a9e8183..13839c0b19 100644 --- a/internal/database/sqlcommon/blob_sql_test.go +++ b/internal/database/sqlcommon/blob_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/config.go b/internal/database/sqlcommon/config.go index 716fbffd5e..c27a46244b 100644 --- a/internal/database/sqlcommon/config.go +++ b/internal/database/sqlcommon/config.go @@ -19,7 +19,7 @@ package sqlcommon import ( "fmt" - "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger/firefly/internal/config" ) const ( diff --git a/internal/database/sqlcommon/config_record_sql.go b/internal/database/sqlcommon/config_record_sql.go index dba739c557..7f086c152c 100644 --- a/internal/database/sqlcommon/config_record_sql.go +++ b/internal/database/sqlcommon/config_record_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/config_record_sql_test.go b/internal/database/sqlcommon/config_record_sql_test.go index 42a924273a..f9eb4ab195 100644 --- a/internal/database/sqlcommon/config_record_sql_test.go +++ b/internal/database/sqlcommon/config_record_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/data_sql.go b/internal/database/sqlcommon/data_sql.go index a872577e18..f5c87c42fe 100644 --- a/internal/database/sqlcommon/data_sql.go +++ b/internal/database/sqlcommon/data_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/data_sql_test.go b/internal/database/sqlcommon/data_sql_test.go index 1ef51121b4..3291af2ed0 100644 --- a/internal/database/sqlcommon/data_sql_test.go +++ b/internal/database/sqlcommon/data_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/datatype_sql.go b/internal/database/sqlcommon/datatype_sql.go index 36c94bc23a..b19f014c67 100644 --- a/internal/database/sqlcommon/datatype_sql.go +++ b/internal/database/sqlcommon/datatype_sql.go @@ -22,10 +22,10 @@ import ( "fmt" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/datatype_sql_test.go b/internal/database/sqlcommon/datatype_sql_test.go index cf6c507bae..4f4eeb6fe9 100644 --- a/internal/database/sqlcommon/datatype_sql_test.go +++ b/internal/database/sqlcommon/datatype_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/event_sql.go b/internal/database/sqlcommon/event_sql.go index a2dab0cbd4..6ccd35407e 100644 --- a/internal/database/sqlcommon/event_sql.go +++ b/internal/database/sqlcommon/event_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/event_sql_test.go b/internal/database/sqlcommon/event_sql_test.go index b4b2681034..178a3dcd29 100644 --- a/internal/database/sqlcommon/event_sql_test.go +++ b/internal/database/sqlcommon/event_sql_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/filter_sql.go b/internal/database/sqlcommon/filter_sql.go index 66b41bd919..fb25b380d9 100644 --- a/internal/database/sqlcommon/filter_sql.go +++ b/internal/database/sqlcommon/filter_sql.go @@ -22,8 +22,8 @@ import ( "strings" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/database" ) func (s *SQLCommon) filterSelect(ctx context.Context, tableName string, sel sq.SelectBuilder, filter database.Filter, typeMap map[string]string, defaultSort []string, preconditions ...sq.Sqlizer) (sq.SelectBuilder, sq.Sqlizer, *database.FilterInfo, error) { diff --git a/internal/database/sqlcommon/filter_sql_test.go b/internal/database/sqlcommon/filter_sql_test.go index 70a5cb15cb..a6d5d22763 100644 --- a/internal/database/sqlcommon/filter_sql_test.go +++ b/internal/database/sqlcommon/filter_sql_test.go @@ -22,8 +22,8 @@ import ( "testing" "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/group_sql.go b/internal/database/sqlcommon/group_sql.go index 89c1fd49ad..d0d15bb8da 100644 --- a/internal/database/sqlcommon/group_sql.go +++ b/internal/database/sqlcommon/group_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/group_sql_test.go b/internal/database/sqlcommon/group_sql_test.go index d6325c4e5a..be1b167ab0 100644 --- a/internal/database/sqlcommon/group_sql_test.go +++ b/internal/database/sqlcommon/group_sql_test.go @@ -24,9 +24,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/message_sql.go b/internal/database/sqlcommon/message_sql.go index 4813c432fb..f2c96988b2 100644 --- a/internal/database/sqlcommon/message_sql.go +++ b/internal/database/sqlcommon/message_sql.go @@ -22,10 +22,10 @@ import ( "fmt" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/message_sql_test.go b/internal/database/sqlcommon/message_sql_test.go index 40745004ec..5eb4c4f119 100644 --- a/internal/database/sqlcommon/message_sql_test.go +++ b/internal/database/sqlcommon/message_sql_test.go @@ -24,9 +24,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/namespace_sql.go b/internal/database/sqlcommon/namespace_sql.go index f0af794b1e..9fa8b55931 100644 --- a/internal/database/sqlcommon/namespace_sql.go +++ b/internal/database/sqlcommon/namespace_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/namespace_sql_test.go b/internal/database/sqlcommon/namespace_sql_test.go index a1b6872875..2faae64b1f 100644 --- a/internal/database/sqlcommon/namespace_sql_test.go +++ b/internal/database/sqlcommon/namespace_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/nextpin_sql.go b/internal/database/sqlcommon/nextpin_sql.go index fc7fd00cf8..ac0d98c936 100644 --- a/internal/database/sqlcommon/nextpin_sql.go +++ b/internal/database/sqlcommon/nextpin_sql.go @@ -22,10 +22,10 @@ import ( "fmt" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/nextpin_sql_test.go b/internal/database/sqlcommon/nextpin_sql_test.go index 70e18de102..2593bedb8d 100644 --- a/internal/database/sqlcommon/nextpin_sql_test.go +++ b/internal/database/sqlcommon/nextpin_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/node_sql.go b/internal/database/sqlcommon/node_sql.go index ed7964fed5..be177b923a 100644 --- a/internal/database/sqlcommon/node_sql.go +++ b/internal/database/sqlcommon/node_sql.go @@ -22,10 +22,10 @@ import ( "fmt" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/node_sql_test.go b/internal/database/sqlcommon/node_sql_test.go index 74ad6273a4..15ab487962 100644 --- a/internal/database/sqlcommon/node_sql_test.go +++ b/internal/database/sqlcommon/node_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/nonce_sql.go b/internal/database/sqlcommon/nonce_sql.go index 9c08cc84b8..d222616a13 100644 --- a/internal/database/sqlcommon/nonce_sql.go +++ b/internal/database/sqlcommon/nonce_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/nonce_sql_test.go b/internal/database/sqlcommon/nonce_sql_test.go index 735c790195..b225c6823c 100644 --- a/internal/database/sqlcommon/nonce_sql_test.go +++ b/internal/database/sqlcommon/nonce_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/offset_sql.go b/internal/database/sqlcommon/offset_sql.go index dbc1b1ffa7..a93a1a47e4 100644 --- a/internal/database/sqlcommon/offset_sql.go +++ b/internal/database/sqlcommon/offset_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/offset_sql_test.go b/internal/database/sqlcommon/offset_sql_test.go index 08b9373bee..6434b6824d 100644 --- a/internal/database/sqlcommon/offset_sql_test.go +++ b/internal/database/sqlcommon/offset_sql_test.go @@ -25,9 +25,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/operation_sql.go b/internal/database/sqlcommon/operation_sql.go index f989fd661f..ef7fa1465a 100644 --- a/internal/database/sqlcommon/operation_sql.go +++ b/internal/database/sqlcommon/operation_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/operation_sql_test.go b/internal/database/sqlcommon/operation_sql_test.go index 936a919d69..db1adabaef 100644 --- a/internal/database/sqlcommon/operation_sql_test.go +++ b/internal/database/sqlcommon/operation_sql_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/organization_sql.go b/internal/database/sqlcommon/organization_sql.go index a686836fea..bdb2236754 100644 --- a/internal/database/sqlcommon/organization_sql.go +++ b/internal/database/sqlcommon/organization_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/organization_sql_test.go b/internal/database/sqlcommon/organization_sql_test.go index 263ebd1423..e1ff563071 100644 --- a/internal/database/sqlcommon/organization_sql_test.go +++ b/internal/database/sqlcommon/organization_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/pin_sql.go b/internal/database/sqlcommon/pin_sql.go index efe3ca40a2..a18ecba564 100644 --- a/internal/database/sqlcommon/pin_sql.go +++ b/internal/database/sqlcommon/pin_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/pin_sql_test.go b/internal/database/sqlcommon/pin_sql_test.go index 1c8021136b..5ccce6bce4 100644 --- a/internal/database/sqlcommon/pin_sql_test.go +++ b/internal/database/sqlcommon/pin_sql_test.go @@ -22,9 +22,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/provider_mock_test.go b/internal/database/sqlcommon/provider_mock_test.go index 41e8bc5f30..19479d1876 100644 --- a/internal/database/sqlcommon/provider_mock_test.go +++ b/internal/database/sqlcommon/provider_mock_test.go @@ -23,9 +23,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" sq "github.com/Masterminds/squirrel" migratedb "github.com/golang-migrate/migrate/v4/database" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/database" ) // testProvider uses the datadog mocking framework diff --git a/internal/database/sqlcommon/provider_sqlitego_test.go b/internal/database/sqlcommon/provider_sqlitego_test.go index 5330d0f6ea..cdef373d30 100644 --- a/internal/database/sqlcommon/provider_sqlitego_test.go +++ b/internal/database/sqlcommon/provider_sqlitego_test.go @@ -27,9 +27,9 @@ import ( sq "github.com/Masterminds/squirrel" migratedb "github.com/golang-migrate/migrate/v4/database" "github.com/golang-migrate/migrate/v4/database/sqlite3" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/database" "github.com/stretchr/testify/assert" // Import SQLite driver diff --git a/internal/database/sqlcommon/sqlcommon.go b/internal/database/sqlcommon/sqlcommon.go index df3da4dfe9..ef67e1b113 100644 --- a/internal/database/sqlcommon/sqlcommon.go +++ b/internal/database/sqlcommon/sqlcommon.go @@ -22,11 +22,11 @@ import ( sq "github.com/Masterminds/squirrel" "github.com/golang-migrate/migrate/v4" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" // Import migrate file source _ "github.com/golang-migrate/migrate/v4/source/file" diff --git a/internal/database/sqlcommon/sqlcommon_test.go b/internal/database/sqlcommon/sqlcommon_test.go index b73be66332..f8ec1c68cd 100644 --- a/internal/database/sqlcommon/sqlcommon_test.go +++ b/internal/database/sqlcommon/sqlcommon_test.go @@ -25,8 +25,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" sq "github.com/Masterminds/squirrel" "github.com/golang-migrate/migrate/v4" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -237,7 +237,7 @@ func TestTXConcurrency(t *testing.T) { // the well adopted CGO implementation. // When the e2e DB tests move to being able to be run against any database, this // test should be included. - // (additional refactor required - see https://github.com/hyperledger-labs/firefly/issues/119) + // (additional refactor required - see https://github.com/hyperledger/firefly/issues/119) _, err := s.db.Exec(` CREATE TABLE testconc ( seq INTEGER PRIMARY KEY AUTOINCREMENT, val VARCHAR(256) ); diff --git a/internal/database/sqlcommon/subscription_sql.go b/internal/database/sqlcommon/subscription_sql.go index af05e5f219..f559dfb88f 100644 --- a/internal/database/sqlcommon/subscription_sql.go +++ b/internal/database/sqlcommon/subscription_sql.go @@ -22,10 +22,10 @@ import ( "fmt" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/subscription_sql_test.go b/internal/database/sqlcommon/subscription_sql_test.go index e61c39d38a..2167686442 100644 --- a/internal/database/sqlcommon/subscription_sql_test.go +++ b/internal/database/sqlcommon/subscription_sql_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/tokenaccount_sql.go b/internal/database/sqlcommon/tokenaccount_sql.go index 86cd731c83..22c553d9c4 100644 --- a/internal/database/sqlcommon/tokenaccount_sql.go +++ b/internal/database/sqlcommon/tokenaccount_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/tokenaccount_sql_test.go b/internal/database/sqlcommon/tokenaccount_sql_test.go index c2b5953751..2cf37eaa78 100644 --- a/internal/database/sqlcommon/tokenaccount_sql_test.go +++ b/internal/database/sqlcommon/tokenaccount_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/database/sqlcommon/tokenpool_sql.go b/internal/database/sqlcommon/tokenpool_sql.go index 6bf91de824..a5962c00c2 100644 --- a/internal/database/sqlcommon/tokenpool_sql.go +++ b/internal/database/sqlcommon/tokenpool_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/tokenpool_sql_test.go b/internal/database/sqlcommon/tokenpool_sql_test.go index 94a080480f..a6820483fa 100644 --- a/internal/database/sqlcommon/tokenpool_sql_test.go +++ b/internal/database/sqlcommon/tokenpool_sql_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlcommon/transaction_sql.go b/internal/database/sqlcommon/transaction_sql.go index 9d2f4f6032..482b0eefae 100644 --- a/internal/database/sqlcommon/transaction_sql.go +++ b/internal/database/sqlcommon/transaction_sql.go @@ -21,10 +21,10 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/internal/database/sqlcommon/transaction_sql_test.go b/internal/database/sqlcommon/transaction_sql_test.go index 5bb7a69604..d6e7bfbd2b 100644 --- a/internal/database/sqlcommon/transaction_sql_test.go +++ b/internal/database/sqlcommon/transaction_sql_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/database/sqlite3/config.go b/internal/database/sqlite3/config.go index 15edbda15f..ba9883a364 100644 --- a/internal/database/sqlite3/config.go +++ b/internal/database/sqlite3/config.go @@ -20,8 +20,8 @@ package sqlite3 import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/database/sqlcommon" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/database/sqlcommon" ) const ( diff --git a/internal/database/sqlite3/sqlite3.go b/internal/database/sqlite3/sqlite3.go index 01bf3ad833..dd21962135 100644 --- a/internal/database/sqlite3/sqlite3.go +++ b/internal/database/sqlite3/sqlite3.go @@ -27,9 +27,9 @@ import ( sq "github.com/Masterminds/squirrel" migratedb "github.com/golang-migrate/migrate/v4/database" migratesqlite3 "github.com/golang-migrate/migrate/v4/database/sqlite3" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/database/sqlcommon" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/database/sqlcommon" + "github.com/hyperledger/firefly/pkg/database" // Import the derivation of SQLite3 CGO suported by golang-migrate _ "github.com/mattn/go-sqlite3" diff --git a/internal/database/sqlite3/sqlite3_test.go b/internal/database/sqlite3/sqlite3_test.go index 7f083c782f..a5390829f6 100644 --- a/internal/database/sqlite3/sqlite3_test.go +++ b/internal/database/sqlite3/sqlite3_test.go @@ -23,9 +23,9 @@ import ( "testing" sq "github.com/Masterminds/squirrel" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/database/sqlcommon" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/database/sqlcommon" + "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/stretchr/testify/assert" ) diff --git a/internal/dataexchange/dxfactory/factory.go b/internal/dataexchange/dxfactory/factory.go index 08c39cf9c1..10947b6c36 100644 --- a/internal/dataexchange/dxfactory/factory.go +++ b/internal/dataexchange/dxfactory/factory.go @@ -19,10 +19,10 @@ package dxfactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/dataexchange/dxhttps" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/dataexchange/dxhttps" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/dataexchange" ) var plugins = []dataexchange.Plugin{ diff --git a/internal/dataexchange/dxhttps/config.go b/internal/dataexchange/dxhttps/config.go index 1d4e4332e7..d0eb7d6d16 100644 --- a/internal/dataexchange/dxhttps/config.go +++ b/internal/dataexchange/dxhttps/config.go @@ -17,8 +17,8 @@ package dxhttps import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/wsclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/wsclient" ) func (h *HTTPS) InitPrefix(prefix config.Prefix) { diff --git a/internal/dataexchange/dxhttps/dxhttps.go b/internal/dataexchange/dxhttps/dxhttps.go index 8d1db2585a..25fc4748cd 100644 --- a/internal/dataexchange/dxhttps/dxhttps.go +++ b/internal/dataexchange/dxhttps/dxhttps.go @@ -24,13 +24,13 @@ import ( "net/http" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" ) type HTTPS struct { diff --git a/internal/dataexchange/dxhttps/dxhttps_test.go b/internal/dataexchange/dxhttps/dxhttps_test.go index bf3555e8f9..0a9487f27e 100644 --- a/internal/dataexchange/dxhttps/dxhttps_test.go +++ b/internal/dataexchange/dxhttps/dxhttps_test.go @@ -25,12 +25,12 @@ import ( "net/url" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/wsmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/wsmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/jarcoal/httpmock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index e1b211ba1e..4977115488 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -22,13 +22,13 @@ import ( "database/sql/driver" "encoding/binary" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/internal/syshandlers" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/internal/syshandlers" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) const ( diff --git a/internal/events/aggregator_test.go b/internal/events/aggregator_test.go index c3c5e11cba..c932b1eba9 100644 --- a/internal/events/aggregator_test.go +++ b/internal/events/aggregator_test.go @@ -22,12 +22,12 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/syshandlersmocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/batch_pin_complete.go b/internal/events/batch_pin_complete.go index c8bbc57279..849f0dc14e 100644 --- a/internal/events/batch_pin_complete.go +++ b/internal/events/batch_pin_complete.go @@ -21,10 +21,10 @@ import ( "encoding/json" "io" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) // BatchPinComplete is called in-line with a particular ledger's stream of events, so while we diff --git a/internal/events/batch_pin_complete_test.go b/internal/events/batch_pin_complete_test.go index d1fc1a9d97..32a4f9e32b 100644 --- a/internal/events/batch_pin_complete_test.go +++ b/internal/events/batch_pin_complete_test.go @@ -24,13 +24,13 @@ import ( "io/ioutil" "testing" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/bound_events_callbacks.go b/internal/events/bound_events_callbacks.go index 61938255a6..354590c676 100644 --- a/internal/events/bound_events_callbacks.go +++ b/internal/events/bound_events_callbacks.go @@ -17,8 +17,8 @@ package events import ( - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" ) type boundCallbacks struct { diff --git a/internal/events/change_event_listener.go b/internal/events/change_event_listener.go index f7f7206335..e16867c2bd 100644 --- a/internal/events/change_event_listener.go +++ b/internal/events/change_event_listener.go @@ -20,8 +20,8 @@ import ( "context" "sync" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) type changeEventListener struct { diff --git a/internal/events/change_event_listener_test.go b/internal/events/change_event_listener_test.go index e704a76d6c..f77052d89d 100644 --- a/internal/events/change_event_listener_test.go +++ b/internal/events/change_event_listener_test.go @@ -19,7 +19,7 @@ package events import ( "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/events/dx_callbacks.go b/internal/events/dx_callbacks.go index 1e45b090dc..eede36818f 100644 --- a/internal/events/dx_callbacks.go +++ b/internal/events/dx_callbacks.go @@ -20,11 +20,11 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (em *eventManager) MessageReceived(dx dataexchange.Plugin, peerID string, data []byte) error { diff --git a/internal/events/dx_callbacks_test.go b/internal/events/dx_callbacks_test.go index 96864d009c..6dea5bad66 100644 --- a/internal/events/dx_callbacks_test.go +++ b/internal/events/dx_callbacks_test.go @@ -21,10 +21,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/syshandlersmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/eifactory/factory.go b/internal/events/eifactory/factory.go index 0bc57fe963..158a28a167 100644 --- a/internal/events/eifactory/factory.go +++ b/internal/events/eifactory/factory.go @@ -19,12 +19,12 @@ package eifactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/internal/events/webhooks" - "github.com/hyperledger-labs/firefly/internal/events/websockets" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/events" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/events/system" + "github.com/hyperledger/firefly/internal/events/webhooks" + "github.com/hyperledger/firefly/internal/events/websockets" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/events" ) var plugins = []events.Plugin{ diff --git a/internal/events/event_dispatcher.go b/internal/events/event_dispatcher.go index 1b4afe5d7c..99312890f7 100644 --- a/internal/events/event_dispatcher.go +++ b/internal/events/event_dispatcher.go @@ -22,15 +22,15 @@ import ( "fmt" "sync" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/internal/syshandlers" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/internal/syshandlers" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" ) const ( diff --git a/internal/events/event_dispatcher_test.go b/internal/events/event_dispatcher_test.go index 958197744a..b67468f7d5 100644 --- a/internal/events/event_dispatcher_test.go +++ b/internal/events/event_dispatcher_test.go @@ -22,15 +22,15 @@ import ( "regexp" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/mocks/syshandlersmocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/eventsmocks" + "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/event_manager.go b/internal/events/event_manager.go index 20cd46bb0b..d2a8a1cfe5 100644 --- a/internal/events/event_manager.go +++ b/internal/events/event_manager.go @@ -22,22 +22,22 @@ import ( "encoding/json" "strconv" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/events/eifactory" - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/internal/syshandlers" - "github.com/hyperledger-labs/firefly/internal/sysmessaging" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/events/eifactory" + "github.com/hyperledger/firefly/internal/events/system" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/internal/syshandlers" + "github.com/hyperledger/firefly/internal/sysmessaging" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/pkg/tokens" ) type EventManager interface { diff --git a/internal/events/event_manager_test.go b/internal/events/event_manager_test.go index 3d2ef48b44..0518d747ea 100644 --- a/internal/events/event_manager_test.go +++ b/internal/events/event_manager_test.go @@ -21,15 +21,15 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/mocks/syshandlersmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/events/system" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/eventsmocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/event_notifier.go b/internal/events/event_notifier.go index 96c5508d6b..07918ad302 100644 --- a/internal/events/event_notifier.go +++ b/internal/events/event_notifier.go @@ -20,8 +20,8 @@ import ( "context" "sync" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" ) type eventNotifier struct { diff --git a/internal/events/event_poller.go b/internal/events/event_poller.go index 9d6bc694b8..88211b63b7 100644 --- a/internal/events/event_poller.go +++ b/internal/events/event_poller.go @@ -22,10 +22,10 @@ import ( "sync" "time" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) type eventPoller struct { diff --git a/internal/events/event_poller_test.go b/internal/events/event_poller_test.go index 3da0291bd1..dcd1dee6f2 100644 --- a/internal/events/event_poller_test.go +++ b/internal/events/event_poller_test.go @@ -22,10 +22,10 @@ import ( "testing" "time" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/offset_calc.go b/internal/events/offset_calc.go index b1fc53fa2c..0928bf5695 100644 --- a/internal/events/offset_calc.go +++ b/internal/events/offset_calc.go @@ -20,10 +20,10 @@ import ( "context" "strconv" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func calcFirstOffset(ctx context.Context, di database.Plugin, pfe *fftypes.SubOptsFirstEvent) (firstOffset int64, err error) { diff --git a/internal/events/persist_batch.go b/internal/events/persist_batch.go index 78a9ec93a0..431b7f313e 100644 --- a/internal/events/persist_batch.go +++ b/internal/events/persist_batch.go @@ -20,9 +20,9 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (em *eventManager) persistBatchFromBroadcast(ctx context.Context /* db TX context*/, batch *fftypes.Batch, onchainHash *fftypes.Bytes32, signingKey string) (valid bool, err error) { diff --git a/internal/events/persist_batch_test.go b/internal/events/persist_batch_test.go index 7f10497caa..a23443e842 100644 --- a/internal/events/persist_batch_test.go +++ b/internal/events/persist_batch_test.go @@ -21,9 +21,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/subscription_manager.go b/internal/events/subscription_manager.go index 32da49367d..3cd8d9a2d8 100644 --- a/internal/events/subscription_manager.go +++ b/internal/events/subscription_manager.go @@ -21,17 +21,17 @@ import ( "regexp" "sync" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/events/eifactory" - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/internal/syshandlers" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/events/eifactory" + "github.com/hyperledger/firefly/internal/events/system" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/internal/syshandlers" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" ) type subscription struct { diff --git a/internal/events/subscription_manager_test.go b/internal/events/subscription_manager_test.go index 0b92abca2a..f442e93f4b 100644 --- a/internal/events/subscription_manager_test.go +++ b/internal/events/subscription_manager_test.go @@ -21,13 +21,13 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/mocks/syshandlersmocks" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/eventsmocks" + "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/system/config.go b/internal/events/system/config.go index 0e2488429a..48d58903d3 100644 --- a/internal/events/system/config.go +++ b/internal/events/system/config.go @@ -17,7 +17,7 @@ package system import ( - "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger/firefly/internal/config" ) const ( diff --git a/internal/events/system/events.go b/internal/events/system/events.go index 7583e919d7..e8fc53477b 100644 --- a/internal/events/system/events.go +++ b/internal/events/system/events.go @@ -20,9 +20,9 @@ import ( "context" "sync" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" ) const ( diff --git a/internal/events/system/events_test.go b/internal/events/system/events_test.go index a46c814ba1..403da047fb 100644 --- a/internal/events/system/events_test.go +++ b/internal/events/system/events_test.go @@ -21,10 +21,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/eventsmocks" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/token_pool_created.go b/internal/events/token_pool_created.go index 628cdee28b..54d7e45780 100644 --- a/internal/events/token_pool_created.go +++ b/internal/events/token_pool_created.go @@ -19,10 +19,10 @@ package events import ( "context" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" ) func (em *eventManager) persistTokenPoolTransaction(ctx context.Context, pool *fftypes.TokenPool, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) (valid bool, err error) { diff --git a/internal/events/token_pool_created_test.go b/internal/events/token_pool_created_test.go index 7c46bf27f4..0c3f9acb34 100644 --- a/internal/events/token_pool_created_test.go +++ b/internal/events/token_pool_created_test.go @@ -20,10 +20,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/tokenmocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/tokenmocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/transaction_update.go b/internal/events/transaction_update.go index abf1a9fd81..e5bf51616f 100644 --- a/internal/events/transaction_update.go +++ b/internal/events/transaction_update.go @@ -17,10 +17,10 @@ package events import ( - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (em *eventManager) TxSubmissionUpdate(plugin fftypes.Named, tx string, txState fftypes.OpStatus, errorMessage string, additionalInfo fftypes.JSONObject) error { diff --git a/internal/events/transaction_update_test.go b/internal/events/transaction_update_test.go index d78e995fae..13b4ff581a 100644 --- a/internal/events/transaction_update_test.go +++ b/internal/events/transaction_update_test.go @@ -20,9 +20,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/webhooks/config.go b/internal/events/webhooks/config.go index 4c120417eb..03024fd059 100644 --- a/internal/events/webhooks/config.go +++ b/internal/events/webhooks/config.go @@ -17,8 +17,8 @@ package webhooks import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" ) func (wh *WebHooks) InitPrefix(prefix config.Prefix) { diff --git a/internal/events/webhooks/webhooks.go b/internal/events/webhooks/webhooks.go index 64f51fd1f6..171b1cc3c6 100644 --- a/internal/events/webhooks/webhooks.go +++ b/internal/events/webhooks/webhooks.go @@ -28,12 +28,12 @@ import ( "strings" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" ) type WebHooks struct { diff --git a/internal/events/webhooks/webhooks_test.go b/internal/events/webhooks/webhooks_test.go index e98b6d483f..6559bab10e 100644 --- a/internal/events/webhooks/webhooks_test.go +++ b/internal/events/webhooks/webhooks_test.go @@ -25,10 +25,10 @@ import ( "testing" "github.com/gorilla/mux" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/eventsmocks" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/events/websockets/config.go b/internal/events/websockets/config.go index f12ec832c2..4dd5c665d4 100644 --- a/internal/events/websockets/config.go +++ b/internal/events/websockets/config.go @@ -16,7 +16,7 @@ package websockets -import "github.com/hyperledger-labs/firefly/internal/config" +import "github.com/hyperledger/firefly/internal/config" const ( bufferSizeDefault = "16Kb" diff --git a/internal/events/websockets/websocket_connection.go b/internal/events/websockets/websocket_connection.go index fbcb5faca4..9f69a13f41 100644 --- a/internal/events/websockets/websocket_connection.go +++ b/internal/events/websockets/websocket_connection.go @@ -25,9 +25,9 @@ import ( "sync" "github.com/gorilla/websocket" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) type websocketStartedSub struct { diff --git a/internal/events/websockets/websockets.go b/internal/events/websockets/websockets.go index 7111edfacf..cf2e63cf8b 100644 --- a/internal/events/websockets/websockets.go +++ b/internal/events/websockets/websockets.go @@ -22,11 +22,11 @@ import ( "sync" "github.com/gorilla/websocket" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" ) type WebSockets struct { diff --git a/internal/events/websockets/websockets_test.go b/internal/events/websockets/websockets_test.go index f60daeaf54..3e9a0522e4 100644 --- a/internal/events/websockets/websockets_test.go +++ b/internal/events/websockets/websockets_test.go @@ -26,13 +26,13 @@ import ( "strings" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/mocks/eventsmocks" - "github.com/hyperledger-labs/firefly/pkg/events" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/mocks/eventsmocks" + "github.com/hyperledger/firefly/pkg/events" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index 07cc26035a..1b1048835e 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -22,13 +22,13 @@ import ( "strings" "time" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/identity" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/identity" "github.com/karlseguin/ccache" ) @@ -183,7 +183,7 @@ func (im *identityManager) cachedOrgLookupByAuthor(ctx context.Context, author s cached.Extend(im.identityCacheTTL) org = cached.Value().(*fftypes.Organization) } else { - // TODO: Per comments in https://github.com/hyperledger-labs/firefly/issues/187 we need to resolve whether "Organization" + // TODO: Per comments in https://github.com/hyperledger/firefly/issues/187 we need to resolve whether "Organization" // is the right thing to resolve here. We might want to fall-back to that in the case of plain string, but likely // we need something more sophisticated here where we have an Identity object in the database. if strings.HasPrefix(author, fftypes.FireflyOrgDIDPrefix) { diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go index 38a4bdc257..454c551e1d 100644 --- a/internal/identity/identitymanager_test.go +++ b/internal/identity/identitymanager_test.go @@ -21,11 +21,11 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/identity/iifactory/factory.go b/internal/identity/iifactory/factory.go index 1dbe032d67..1b7992617c 100644 --- a/internal/identity/iifactory/factory.go +++ b/internal/identity/iifactory/factory.go @@ -19,10 +19,10 @@ package iifactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity/tbd" - "github.com/hyperledger-labs/firefly/pkg/identity" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity/tbd" + "github.com/hyperledger/firefly/pkg/identity" ) var plugins = []identity.Plugin{ diff --git a/internal/identity/tbd/config.go b/internal/identity/tbd/config.go index 874729510f..ebb27eb366 100644 --- a/internal/identity/tbd/config.go +++ b/internal/identity/tbd/config.go @@ -17,7 +17,7 @@ package tbd import ( - "github.com/hyperledger-labs/firefly/internal/config" + "github.com/hyperledger/firefly/internal/config" ) func (tbd *TBD) InitPrefix(prefix config.Prefix) { diff --git a/internal/identity/tbd/tbd.go b/internal/identity/tbd/tbd.go index 762794e330..fbf6363ba7 100644 --- a/internal/identity/tbd/tbd.go +++ b/internal/identity/tbd/tbd.go @@ -19,8 +19,8 @@ package tbd import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/identity" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/identity" ) // TBD is a null implementation of the Identity Interface to avoid breaking configuration created with the previous "onchain" plugin diff --git a/internal/identity/tbd/tbd_test.go b/internal/identity/tbd/tbd_test.go index d5de9b0481..70c313cf00 100644 --- a/internal/identity/tbd/tbd_test.go +++ b/internal/identity/tbd/tbd_test.go @@ -20,9 +20,9 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" - "github.com/hyperledger-labs/firefly/pkg/identity" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/identitymocks" + "github.com/hyperledger/firefly/pkg/identity" "github.com/stretchr/testify/assert" ) diff --git a/internal/log/log_test.go b/internal/log/log_test.go index 28ec1046e7..d78aa22c8b 100644 --- a/internal/log/log_test.go +++ b/internal/log/log_test.go @@ -20,8 +20,8 @@ import ( "context" "testing" - "github.com/likexian/gokit/assert" "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" ) func TestLogContext(t *testing.T) { diff --git a/internal/networkmap/data_query.go b/internal/networkmap/data_query.go index 5fac897276..397238cff0 100644 --- a/internal/networkmap/data_query.go +++ b/internal/networkmap/data_query.go @@ -19,8 +19,8 @@ package networkmap import ( "context" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (nm *networkMap) GetOrganizationByID(ctx context.Context, id string) (*fftypes.Organization, error) { diff --git a/internal/networkmap/data_query_test.go b/internal/networkmap/data_query_test.go index 5b8384d32b..af4c72023c 100644 --- a/internal/networkmap/data_query_test.go +++ b/internal/networkmap/data_query_test.go @@ -19,9 +19,9 @@ package networkmap import ( "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/networkmap/manager.go b/internal/networkmap/manager.go index 458c451238..aedb597663 100644 --- a/internal/networkmap/manager.go +++ b/internal/networkmap/manager.go @@ -19,12 +19,12 @@ package networkmap import ( "context" - "github.com/hyperledger-labs/firefly/internal/broadcast" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/broadcast" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" ) type Manager interface { diff --git a/internal/networkmap/manager_test.go b/internal/networkmap/manager_test.go index ae142ec7bc..6988ed749a 100644 --- a/internal/networkmap/manager_test.go +++ b/internal/networkmap/manager_test.go @@ -20,11 +20,11 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" "github.com/stretchr/testify/assert" ) diff --git a/internal/networkmap/register_node.go b/internal/networkmap/register_node.go index 44dd64b2ff..f8b78b40e2 100644 --- a/internal/networkmap/register_node.go +++ b/internal/networkmap/register_node.go @@ -20,9 +20,9 @@ import ( "context" "fmt" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (nm *networkMap) RegisterNode(ctx context.Context, waitConfirm bool) (node *fftypes.Node, msg *fftypes.Message, err error) { diff --git a/internal/networkmap/register_node_test.go b/internal/networkmap/register_node_test.go index 14996207da..a093819b25 100644 --- a/internal/networkmap/register_node_test.go +++ b/internal/networkmap/register_node_test.go @@ -20,12 +20,12 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/networkmap/register_org.go b/internal/networkmap/register_org.go index 82039b2f60..d3fa61f787 100644 --- a/internal/networkmap/register_org.go +++ b/internal/networkmap/register_org.go @@ -19,10 +19,10 @@ package networkmap import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (nm *networkMap) findOrgsToRoot(ctx context.Context, idType, identity, parent string) (err error) { diff --git a/internal/networkmap/register_org_test.go b/internal/networkmap/register_org_test.go index 801e26e584..066616fc45 100644 --- a/internal/networkmap/register_org_test.go +++ b/internal/networkmap/register_org_test.go @@ -20,11 +20,11 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/oapispec/apirequest.go b/internal/oapispec/apirequest.go index 541bdea6a8..4010247190 100644 --- a/internal/oapispec/apirequest.go +++ b/internal/oapispec/apirequest.go @@ -20,9 +20,9 @@ import ( "context" "net/http" - "github.com/hyperledger-labs/firefly/internal/orchestrator" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/orchestrator" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) type APIRequest struct { diff --git a/internal/oapispec/openapi3.go b/internal/oapispec/openapi3.go index 45b50f38e6..b52df533ac 100644 --- a/internal/oapispec/openapi3.go +++ b/internal/oapispec/openapi3.go @@ -29,9 +29,9 @@ import ( "github.com/getkin/kin-openapi/openapi3" "github.com/getkin/kin-openapi/openapi3gen" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) func SwaggerGen(ctx context.Context, routes []*Route, url string) *openapi3.T { diff --git a/internal/oapispec/openapi3_test.go b/internal/oapispec/openapi3_test.go index 168dd10203..0b0b2ff5ca 100644 --- a/internal/oapispec/openapi3_test.go +++ b/internal/oapispec/openapi3_test.go @@ -23,10 +23,10 @@ import ( "testing" "github.com/ghodss/yaml" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/oapispec/routes.go b/internal/oapispec/routes.go index 520b376ead..a2d8c5068a 100644 --- a/internal/oapispec/routes.go +++ b/internal/oapispec/routes.go @@ -19,9 +19,9 @@ package oapispec import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/database" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/database" ) // Route defines each API operation on the REST API of Firefly diff --git a/internal/orchestrator/bound_callbacks.go b/internal/orchestrator/bound_callbacks.go index 0f6c8873a1..3a4e8eb71f 100644 --- a/internal/orchestrator/bound_callbacks.go +++ b/internal/orchestrator/bound_callbacks.go @@ -17,11 +17,11 @@ package orchestrator import ( - "github.com/hyperledger-labs/firefly/internal/events" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/events" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" ) type boundCallbacks struct { diff --git a/internal/orchestrator/bound_callbacks_test.go b/internal/orchestrator/bound_callbacks_test.go index 1e01e60c00..4e8fd632fe 100644 --- a/internal/orchestrator/bound_callbacks_test.go +++ b/internal/orchestrator/bound_callbacks_test.go @@ -20,12 +20,12 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/eventmocks" - "github.com/hyperledger-labs/firefly/mocks/tokenmocks" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/eventmocks" + "github.com/hyperledger/firefly/mocks/tokenmocks" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/orchestrator/config.go b/internal/orchestrator/config.go index 8818b47181..fffd989543 100644 --- a/internal/orchestrator/config.go +++ b/internal/orchestrator/config.go @@ -19,9 +19,9 @@ package orchestrator import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (or *orchestrator) GetConfig(ctx context.Context) fftypes.JSONObject { diff --git a/internal/orchestrator/config_test.go b/internal/orchestrator/config_test.go index 06086f5e52..1103e41b38 100644 --- a/internal/orchestrator/config_test.go +++ b/internal/orchestrator/config_test.go @@ -21,8 +21,8 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/orchestrator/data_query.go b/internal/orchestrator/data_query.go index 9a173811ce..a181c86180 100644 --- a/internal/orchestrator/data_query.go +++ b/internal/orchestrator/data_query.go @@ -20,9 +20,9 @@ import ( "context" "database/sql/driver" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (or *orchestrator) verifyNamespaceSyntax(ctx context.Context, ns string) error { diff --git a/internal/orchestrator/data_query_test.go b/internal/orchestrator/data_query_test.go index d843959808..d5b3ef972b 100644 --- a/internal/orchestrator/data_query_test.go +++ b/internal/orchestrator/data_query_test.go @@ -21,8 +21,8 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/orchestrator/message.go b/internal/orchestrator/message.go index 2bf2091434..c79a6b3e12 100644 --- a/internal/orchestrator/message.go +++ b/internal/orchestrator/message.go @@ -19,8 +19,8 @@ package orchestrator import ( "context" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (or *orchestrator) RequestReply(ctx context.Context, ns string, msg *fftypes.MessageInOut) (reply *fftypes.MessageInOut, err error) { diff --git a/internal/orchestrator/message_test.go b/internal/orchestrator/message_test.go index 9f81135827..91152f110e 100644 --- a/internal/orchestrator/message_test.go +++ b/internal/orchestrator/message_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index f62b012db0..470c56a038 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -20,33 +20,33 @@ import ( "context" "fmt" - "github.com/hyperledger-labs/firefly/internal/assets" - "github.com/hyperledger-labs/firefly/internal/batch" - "github.com/hyperledger-labs/firefly/internal/batchpin" - "github.com/hyperledger-labs/firefly/internal/blockchain/bifactory" - "github.com/hyperledger-labs/firefly/internal/broadcast" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/database/difactory" - "github.com/hyperledger-labs/firefly/internal/dataexchange/dxfactory" - "github.com/hyperledger-labs/firefly/internal/events" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/internal/identity/iifactory" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/networkmap" - "github.com/hyperledger-labs/firefly/internal/privatemessaging" - "github.com/hyperledger-labs/firefly/internal/publicstorage/psfactory" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/internal/syshandlers" - "github.com/hyperledger-labs/firefly/internal/tokens/tifactory" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - idplugin "github.com/hyperledger-labs/firefly/pkg/identity" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/assets" + "github.com/hyperledger/firefly/internal/batch" + "github.com/hyperledger/firefly/internal/batchpin" + "github.com/hyperledger/firefly/internal/blockchain/bifactory" + "github.com/hyperledger/firefly/internal/broadcast" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/database/difactory" + "github.com/hyperledger/firefly/internal/dataexchange/dxfactory" + "github.com/hyperledger/firefly/internal/events" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/internal/identity/iifactory" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/networkmap" + "github.com/hyperledger/firefly/internal/privatemessaging" + "github.com/hyperledger/firefly/internal/publicstorage/psfactory" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/internal/syshandlers" + "github.com/hyperledger/firefly/internal/tokens/tifactory" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" + idplugin "github.com/hyperledger/firefly/pkg/identity" + "github.com/hyperledger/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/pkg/tokens" ) var ( diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go index 81012b1809..2cf167731e 100644 --- a/internal/orchestrator/orchestrator_test.go +++ b/internal/orchestrator/orchestrator_test.go @@ -21,25 +21,25 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/tokens/tifactory" - "github.com/hyperledger-labs/firefly/mocks/assetmocks" - "github.com/hyperledger-labs/firefly/mocks/batchmocks" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/eventmocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/identitymocks" - "github.com/hyperledger-labs/firefly/mocks/networkmapmocks" - "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/mocks/tokenmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/tokens/tifactory" + "github.com/hyperledger/firefly/mocks/assetmocks" + "github.com/hyperledger/firefly/mocks/batchmocks" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/eventmocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/identitymocks" + "github.com/hyperledger/firefly/mocks/networkmapmocks" + "github.com/hyperledger/firefly/mocks/privatemessagingmocks" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/mocks/tokenmocks" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/orchestrator/persistence_events.go b/internal/orchestrator/persistence_events.go index 74aae3264a..a7e27d4f7c 100644 --- a/internal/orchestrator/persistence_events.go +++ b/internal/orchestrator/persistence_events.go @@ -17,9 +17,9 @@ package orchestrator import ( - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (or *orchestrator) attemptChangeEventDispatch(ev *fftypes.ChangeEvent) { diff --git a/internal/orchestrator/persistence_events_test.go b/internal/orchestrator/persistence_events_test.go index 6a2e3c3162..98f353cc53 100644 --- a/internal/orchestrator/persistence_events_test.go +++ b/internal/orchestrator/persistence_events_test.go @@ -20,10 +20,10 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/mocks/batchmocks" - "github.com/hyperledger-labs/firefly/mocks/eventmocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/batchmocks" + "github.com/hyperledger/firefly/mocks/eventmocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func TestMessageCreated(t *testing.T) { diff --git a/internal/orchestrator/status.go b/internal/orchestrator/status.go index c0b50a07c8..6476c05d71 100644 --- a/internal/orchestrator/status.go +++ b/internal/orchestrator/status.go @@ -19,8 +19,8 @@ package orchestrator import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (or *orchestrator) GetStatus(ctx context.Context) (status *fftypes.NodeStatus, err error) { diff --git a/internal/orchestrator/status_test.go b/internal/orchestrator/status_test.go index 324e39c0f0..3caec04c10 100644 --- a/internal/orchestrator/status_test.go +++ b/internal/orchestrator/status_test.go @@ -20,10 +20,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/orchestrator/subscriptions.go b/internal/orchestrator/subscriptions.go index 872c92e1d3..062879c3b8 100644 --- a/internal/orchestrator/subscriptions.go +++ b/internal/orchestrator/subscriptions.go @@ -19,10 +19,10 @@ package orchestrator import ( "context" - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/events/system" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (or *orchestrator) CreateSubscription(ctx context.Context, ns string, subDef *fftypes.Subscription) (*fftypes.Subscription, error) { diff --git a/internal/orchestrator/subscriptions_test.go b/internal/orchestrator/subscriptions_test.go index 8d9eacf8f7..d9d87bcd6b 100644 --- a/internal/orchestrator/subscriptions_test.go +++ b/internal/orchestrator/subscriptions_test.go @@ -21,9 +21,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/events/system" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/events/system" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/privatemessaging/groupmanager.go b/internal/privatemessaging/groupmanager.go index 8c349d5c93..8852b70847 100644 --- a/internal/privatemessaging/groupmanager.go +++ b/internal/privatemessaging/groupmanager.go @@ -21,11 +21,11 @@ import ( "encoding/json" "time" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/karlseguin/ccache" ) diff --git a/internal/privatemessaging/groupmanager_test.go b/internal/privatemessaging/groupmanager_test.go index 2d4460e956..b7b76924ce 100644 --- a/internal/privatemessaging/groupmanager_test.go +++ b/internal/privatemessaging/groupmanager_test.go @@ -21,10 +21,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/privatemessaging/message.go b/internal/privatemessaging/message.go index b7712fd35e..9519955c32 100644 --- a/internal/privatemessaging/message.go +++ b/internal/privatemessaging/message.go @@ -20,8 +20,8 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (pm *privateMessaging) SendMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) { diff --git a/internal/privatemessaging/message_test.go b/internal/privatemessaging/message_test.go index 8c39159cc6..4bbb3deb52 100644 --- a/internal/privatemessaging/message_test.go +++ b/internal/privatemessaging/message_test.go @@ -21,13 +21,13 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/syncasyncmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/privatemessaging/privatemessaging.go b/internal/privatemessaging/privatemessaging.go index 97be2a886a..8b7a711023 100644 --- a/internal/privatemessaging/privatemessaging.go +++ b/internal/privatemessaging/privatemessaging.go @@ -20,19 +20,19 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/batch" - "github.com/hyperledger-labs/firefly/internal/batchpin" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/identity" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/retry" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/pkg/blockchain" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/batch" + "github.com/hyperledger/firefly/internal/batchpin" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/identity" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/retry" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/pkg/blockchain" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/karlseguin/ccache" ) diff --git a/internal/privatemessaging/privatemessaging_test.go b/internal/privatemessaging/privatemessaging_test.go index 9c3533e4d2..207aefb7e7 100644 --- a/internal/privatemessaging/privatemessaging_test.go +++ b/internal/privatemessaging/privatemessaging_test.go @@ -21,17 +21,17 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/syncasync" - "github.com/hyperledger-labs/firefly/mocks/batchmocks" - "github.com/hyperledger-labs/firefly/mocks/batchpinmocks" - "github.com/hyperledger-labs/firefly/mocks/blockchainmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/mocks/syncasyncmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/syncasync" + "github.com/hyperledger/firefly/mocks/batchmocks" + "github.com/hyperledger/firefly/mocks/batchpinmocks" + "github.com/hyperledger/firefly/mocks/blockchainmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/mocks/syncasyncmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/privatemessaging/recipients.go b/internal/privatemessaging/recipients.go index 038db4e25d..604818aad4 100644 --- a/internal/privatemessaging/recipients.go +++ b/internal/privatemessaging/recipients.go @@ -20,10 +20,10 @@ import ( "context" "fmt" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (pm *privateMessaging) resolveReceipientList(ctx context.Context, in *fftypes.MessageInOut) error { diff --git a/internal/privatemessaging/recipients_test.go b/internal/privatemessaging/recipients_test.go index 6f1003cd9e..edc1528315 100644 --- a/internal/privatemessaging/recipients_test.go +++ b/internal/privatemessaging/recipients_test.go @@ -21,9 +21,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/identitymanagermocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/identitymanagermocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/publicstorage/ipfs/config.go b/internal/publicstorage/ipfs/config.go index 8fd5c9edc0..450dc98ddd 100644 --- a/internal/publicstorage/ipfs/config.go +++ b/internal/publicstorage/ipfs/config.go @@ -17,8 +17,8 @@ package ipfs import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" ) const ( diff --git a/internal/publicstorage/ipfs/ipfs.go b/internal/publicstorage/ipfs/ipfs.go index 71f64ded07..f08109cd04 100644 --- a/internal/publicstorage/ipfs/ipfs.go +++ b/internal/publicstorage/ipfs/ipfs.go @@ -24,11 +24,11 @@ import ( "io" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/pkg/publicstorage" ) type IPFS struct { diff --git a/internal/publicstorage/ipfs/ipfs_test.go b/internal/publicstorage/ipfs/ipfs_test.go index 9a360244a4..8f428d4c46 100644 --- a/internal/publicstorage/ipfs/ipfs_test.go +++ b/internal/publicstorage/ipfs/ipfs_test.go @@ -24,10 +24,10 @@ import ( "net/http" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/mocks/publicstoragemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/mocks/publicstoragemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/jarcoal/httpmock" "github.com/stretchr/testify/assert" ) diff --git a/internal/publicstorage/psfactory/factory.go b/internal/publicstorage/psfactory/factory.go index 6574dc8d24..60af7f22ca 100644 --- a/internal/publicstorage/psfactory/factory.go +++ b/internal/publicstorage/psfactory/factory.go @@ -19,10 +19,10 @@ package psfactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/publicstorage/ipfs" - "github.com/hyperledger-labs/firefly/pkg/publicstorage" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/publicstorage/ipfs" + "github.com/hyperledger/firefly/pkg/publicstorage" ) var plugins = []publicstorage.Plugin{ diff --git a/internal/restclient/config.go b/internal/restclient/config.go index a8c7fc4993..9585197fad 100644 --- a/internal/restclient/config.go +++ b/internal/restclient/config.go @@ -16,7 +16,7 @@ package restclient -import "github.com/hyperledger-labs/firefly/internal/config" +import "github.com/hyperledger/firefly/internal/config" const ( defaultRetryEnabled = false diff --git a/internal/restclient/ffresty.go b/internal/restclient/ffresty.go index e253b28025..c42bc341c0 100644 --- a/internal/restclient/ffresty.go +++ b/internal/restclient/ffresty.go @@ -26,10 +26,10 @@ import ( "time" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) type retryCtxKey struct{} diff --git a/internal/restclient/ffresty_test.go b/internal/restclient/ffresty_test.go index c079b7f30e..4911839ab4 100644 --- a/internal/restclient/ffresty_test.go +++ b/internal/restclient/ffresty_test.go @@ -23,8 +23,8 @@ import ( "strings" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" "github.com/jarcoal/httpmock" "github.com/stretchr/testify/assert" ) diff --git a/internal/retry/retry.go b/internal/retry/retry.go index 8a3b28204e..907136ea4a 100644 --- a/internal/retry/retry.go +++ b/internal/retry/retry.go @@ -20,8 +20,8 @@ import ( "context" "time" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" ) const ( diff --git a/internal/syncasync/sync_async_bridge.go b/internal/syncasync/sync_async_bridge.go index ea19bb8f37..fae5361399 100644 --- a/internal/syncasync/sync_async_bridge.go +++ b/internal/syncasync/sync_async_bridge.go @@ -21,12 +21,12 @@ import ( "sync" "time" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/sysmessaging" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/sysmessaging" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Bridge translates synchronous (HTTP API) calls, into asynchronously sending a diff --git a/internal/syncasync/sync_async_bridge_test.go b/internal/syncasync/sync_async_bridge_test.go index 0c9c1e8cae..9303f0634d 100644 --- a/internal/syncasync/sync_async_bridge_test.go +++ b/internal/syncasync/sync_async_bridge_test.go @@ -21,10 +21,10 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/sysmessagingmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/sysmessagingmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/syshandlers/reply_sender.go b/internal/syshandlers/reply_sender.go index b6acd3bbef..655a6abeaf 100644 --- a/internal/syshandlers/reply_sender.go +++ b/internal/syshandlers/reply_sender.go @@ -19,8 +19,8 @@ package syshandlers import ( "context" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (sh *systemHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { diff --git a/internal/syshandlers/reply_sender_test.go b/internal/syshandlers/reply_sender_test.go index 7b30e912df..b2f23a7ee9 100644 --- a/internal/syshandlers/reply_sender_test.go +++ b/internal/syshandlers/reply_sender_test.go @@ -21,9 +21,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/mocks/privatemessagingmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/mock" ) diff --git a/internal/syshandlers/syshandler.go b/internal/syshandlers/syshandler.go index 4a41ad8d19..b145f52462 100644 --- a/internal/syshandlers/syshandler.go +++ b/internal/syshandlers/syshandler.go @@ -20,13 +20,13 @@ import ( "context" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/broadcast" - "github.com/hyperledger-labs/firefly/internal/data" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/privatemessaging" - "github.com/hyperledger-labs/firefly/pkg/database" - "github.com/hyperledger-labs/firefly/pkg/dataexchange" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/broadcast" + "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/privatemessaging" + "github.com/hyperledger/firefly/pkg/database" + "github.com/hyperledger/firefly/pkg/dataexchange" + "github.com/hyperledger/firefly/pkg/fftypes" ) // SystemHandlers interface allows components to call broadcast/private messaging functions internally (without import cycles) diff --git a/internal/syshandlers/syshandler_datatype.go b/internal/syshandlers/syshandler_datatype.go index 49d3be0fb7..89ca1c73d6 100644 --- a/internal/syshandlers/syshandler_datatype.go +++ b/internal/syshandlers/syshandler_datatype.go @@ -19,8 +19,8 @@ package syshandlers import ( "context" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (sh *systemHandlers) handleDatatypeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { diff --git a/internal/syshandlers/syshandler_datatype_test.go b/internal/syshandlers/syshandler_datatype_test.go index 24e1d68424..a33ddcb6f4 100644 --- a/internal/syshandlers/syshandler_datatype_test.go +++ b/internal/syshandlers/syshandler_datatype_test.go @@ -22,9 +22,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/syshandlers/syshandler_namespace.go b/internal/syshandlers/syshandler_namespace.go index aff0233dc1..186ea15d53 100644 --- a/internal/syshandlers/syshandler_namespace.go +++ b/internal/syshandlers/syshandler_namespace.go @@ -19,8 +19,8 @@ package syshandlers import ( "context" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (sh *systemHandlers) handleNamespaceBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { diff --git a/internal/syshandlers/syshandler_namespace_test.go b/internal/syshandlers/syshandler_namespace_test.go index 98a97f9e18..dc47a8e0cc 100644 --- a/internal/syshandlers/syshandler_namespace_test.go +++ b/internal/syshandlers/syshandler_namespace_test.go @@ -22,8 +22,8 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/syshandlers/syshandler_network_node.go b/internal/syshandlers/syshandler_network_node.go index 913b05fdf2..83ec1a102d 100644 --- a/internal/syshandlers/syshandler_network_node.go +++ b/internal/syshandlers/syshandler_network_node.go @@ -19,8 +19,8 @@ package syshandlers import ( "context" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (sh *systemHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { diff --git a/internal/syshandlers/syshandler_network_node_test.go b/internal/syshandlers/syshandler_network_node_test.go index 9a63f370b7..3c420070c1 100644 --- a/internal/syshandlers/syshandler_network_node_test.go +++ b/internal/syshandlers/syshandler_network_node_test.go @@ -22,9 +22,9 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/syshandlers/syshandler_network_org.go b/internal/syshandlers/syshandler_network_org.go index 9f90d4be8b..5f87f9b1ce 100644 --- a/internal/syshandlers/syshandler_network_org.go +++ b/internal/syshandlers/syshandler_network_org.go @@ -19,8 +19,8 @@ package syshandlers import ( "context" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/pkg/fftypes" ) func (sh *systemHandlers) handleOrganizationBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { diff --git a/internal/syshandlers/syshandler_network_org_test.go b/internal/syshandlers/syshandler_network_org_test.go index 20f707cb4b..b2f7f7e338 100644 --- a/internal/syshandlers/syshandler_network_org_test.go +++ b/internal/syshandlers/syshandler_network_org_test.go @@ -22,8 +22,8 @@ import ( "fmt" "testing" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/syshandlers/syshandler_test.go b/internal/syshandlers/syshandler_test.go index 96b26c4246..4fa0f942cd 100644 --- a/internal/syshandlers/syshandler_test.go +++ b/internal/syshandlers/syshandler_test.go @@ -20,12 +20,12 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/mocks/broadcastmocks" - "github.com/hyperledger-labs/firefly/mocks/databasemocks" - "github.com/hyperledger-labs/firefly/mocks/dataexchangemocks" - "github.com/hyperledger-labs/firefly/mocks/datamocks" - "github.com/hyperledger-labs/firefly/mocks/privatemessagingmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/mocks/broadcastmocks" + "github.com/hyperledger/firefly/mocks/databasemocks" + "github.com/hyperledger/firefly/mocks/dataexchangemocks" + "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/privatemessagingmocks" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/sysmessaging/sysevents.go b/internal/sysmessaging/sysevents.go index 90f5069fcb..a4e235de0f 100644 --- a/internal/sysmessaging/sysevents.go +++ b/internal/sysmessaging/sysevents.go @@ -16,7 +16,7 @@ package sysmessaging -import "github.com/hyperledger-labs/firefly/internal/events/system" +import "github.com/hyperledger/firefly/internal/events/system" // SystemEvents specifies the internal interface, without creating a cycle type SystemEvents interface { diff --git a/internal/tokens/https/config.go b/internal/tokens/https/config.go index 4b8d7f93e1..bef6d815d3 100644 --- a/internal/tokens/https/config.go +++ b/internal/tokens/https/config.go @@ -17,8 +17,8 @@ package https import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/wsclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/wsclient" ) func (h *HTTPS) InitPrefix(prefix config.PrefixArray) { diff --git a/internal/tokens/https/https.go b/internal/tokens/https/https.go index 86e806e1fd..e784c09e6c 100644 --- a/internal/tokens/https/https.go +++ b/internal/tokens/https/https.go @@ -21,13 +21,13 @@ import ( "encoding/json" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" ) type HTTPS struct { diff --git a/internal/tokens/https/https_test.go b/internal/tokens/https/https_test.go index f9069d6ae7..52dd1ec649 100644 --- a/internal/tokens/https/https_test.go +++ b/internal/tokens/https/https_test.go @@ -26,13 +26,13 @@ import ( "net/url" "testing" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/wsclient" - "github.com/hyperledger-labs/firefly/mocks/tokenmocks" - "github.com/hyperledger-labs/firefly/mocks/wsmocks" - "github.com/hyperledger-labs/firefly/pkg/fftypes" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/wsclient" + "github.com/hyperledger/firefly/mocks/tokenmocks" + "github.com/hyperledger/firefly/mocks/wsmocks" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/tokens" "github.com/jarcoal/httpmock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/tokens/tifactory/factory.go b/internal/tokens/tifactory/factory.go index 4c7f3e1490..b008efa206 100644 --- a/internal/tokens/tifactory/factory.go +++ b/internal/tokens/tifactory/factory.go @@ -19,10 +19,10 @@ package tifactory import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/tokens/https" - "github.com/hyperledger-labs/firefly/pkg/tokens" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/tokens/https" + "github.com/hyperledger/firefly/pkg/tokens" ) var plugins = []tokens.Plugin{ diff --git a/internal/wsclient/config.go b/internal/wsclient/config.go index a2c59bcfc1..3d36b770b6 100644 --- a/internal/wsclient/config.go +++ b/internal/wsclient/config.go @@ -17,8 +17,8 @@ package wsclient import ( - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" ) const ( diff --git a/internal/wsclient/wsclient.go b/internal/wsclient/wsclient.go index 03c91c317b..b9f4a400e1 100644 --- a/internal/wsclient/wsclient.go +++ b/internal/wsclient/wsclient.go @@ -25,11 +25,11 @@ import ( "net/url" "github.com/gorilla/websocket" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" - "github.com/hyperledger-labs/firefly/internal/restclient" - "github.com/hyperledger-labs/firefly/internal/retry" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" + "github.com/hyperledger/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/retry" ) type WSAuthConfig struct { diff --git a/internal/wsclient/wsclient_test.go b/internal/wsclient/wsclient_test.go index c29f32198a..437454d2d0 100644 --- a/internal/wsclient/wsclient_test.go +++ b/internal/wsclient/wsclient_test.go @@ -24,8 +24,8 @@ import ( "testing" "github.com/gorilla/websocket" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/restclient" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/restclient" "github.com/stretchr/testify/assert" ) diff --git a/kat/package.json b/kat/package.json index adcc275ca2..ade95df96b 100644 --- a/kat/package.json +++ b/kat/package.json @@ -26,7 +26,7 @@ "mock-require": "^3.0.3", "mongodb": "^3.6.3", "nanoid": "^3.1.21", - "nedb": "git+https://github.com:hyperledger-labs/nedb.git", + "nedb": "git+https://github.com:hyperledger/nedb.git", "nedb-promises": "^4.1.0", "proxyquire": "^2.1.3", "socket.io": "^2.3.0", diff --git a/main.go b/main.go index df96ae6322..b4e95d3a65 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ import ( "fmt" "os" - "github.com/hyperledger-labs/firefly/cmd" + "github.com/hyperledger/firefly/cmd" ) func main() { diff --git a/mocks/apiservermocks/server.go b/mocks/apiservermocks/server.go index a0b7e204da..fd2fcc3815 100644 --- a/mocks/apiservermocks/server.go +++ b/mocks/apiservermocks/server.go @@ -5,7 +5,7 @@ package apiservermocks import ( context "context" - orchestrator "github.com/hyperledger-labs/firefly/internal/orchestrator" + orchestrator "github.com/hyperledger/firefly/internal/orchestrator" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/assetmocks/manager.go b/mocks/assetmocks/manager.go index f83b672c90..c91910ca10 100644 --- a/mocks/assetmocks/manager.go +++ b/mocks/assetmocks/manager.go @@ -5,8 +5,8 @@ package assetmocks import ( context "context" - database "github.com/hyperledger-labs/firefly/pkg/database" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + database "github.com/hyperledger/firefly/pkg/database" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/batchmocks/manager.go b/mocks/batchmocks/manager.go index 96a64a4fb6..79d7bf7b00 100644 --- a/mocks/batchmocks/manager.go +++ b/mocks/batchmocks/manager.go @@ -3,8 +3,8 @@ package batchmocks import ( - batch "github.com/hyperledger-labs/firefly/internal/batch" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + batch "github.com/hyperledger/firefly/internal/batch" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/batchpinmocks/submitter.go b/mocks/batchpinmocks/submitter.go index 5eb8c742b6..2902e504e2 100644 --- a/mocks/batchpinmocks/submitter.go +++ b/mocks/batchpinmocks/submitter.go @@ -5,7 +5,7 @@ package batchpinmocks import ( context "context" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/blockchainmocks/callbacks.go b/mocks/blockchainmocks/callbacks.go index 0d988c139a..0b53d260af 100644 --- a/mocks/blockchainmocks/callbacks.go +++ b/mocks/blockchainmocks/callbacks.go @@ -3,8 +3,8 @@ package blockchainmocks import ( - blockchain "github.com/hyperledger-labs/firefly/pkg/blockchain" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + blockchain "github.com/hyperledger/firefly/pkg/blockchain" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/blockchainmocks/plugin.go b/mocks/blockchainmocks/plugin.go index 7d0934a8ca..816fcf651f 100644 --- a/mocks/blockchainmocks/plugin.go +++ b/mocks/blockchainmocks/plugin.go @@ -3,12 +3,12 @@ package blockchainmocks import ( - config "github.com/hyperledger-labs/firefly/internal/config" - blockchain "github.com/hyperledger-labs/firefly/pkg/blockchain" + config "github.com/hyperledger/firefly/internal/config" + blockchain "github.com/hyperledger/firefly/pkg/blockchain" context "context" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/broadcastmocks/manager.go b/mocks/broadcastmocks/manager.go index a2f059f211..33f73f9f89 100644 --- a/mocks/broadcastmocks/manager.go +++ b/mocks/broadcastmocks/manager.go @@ -5,7 +5,7 @@ package broadcastmocks import ( context "context" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/databasemocks/callbacks.go b/mocks/databasemocks/callbacks.go index 7c31a1932f..4306bef230 100644 --- a/mocks/databasemocks/callbacks.go +++ b/mocks/databasemocks/callbacks.go @@ -3,8 +3,8 @@ package databasemocks import ( - database "github.com/hyperledger-labs/firefly/pkg/database" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + database "github.com/hyperledger/firefly/pkg/database" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/databasemocks/plugin.go b/mocks/databasemocks/plugin.go index 8ec855a038..4f43a5691b 100644 --- a/mocks/databasemocks/plugin.go +++ b/mocks/databasemocks/plugin.go @@ -5,11 +5,11 @@ package databasemocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" - database "github.com/hyperledger-labs/firefly/pkg/database" + database "github.com/hyperledger/firefly/pkg/database" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/dataexchangemocks/callbacks.go b/mocks/dataexchangemocks/callbacks.go index b3ca38b6bf..416166d8b1 100644 --- a/mocks/dataexchangemocks/callbacks.go +++ b/mocks/dataexchangemocks/callbacks.go @@ -3,7 +3,7 @@ package dataexchangemocks import ( - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/dataexchangemocks/plugin.go b/mocks/dataexchangemocks/plugin.go index dda6fa2991..4775a00fd2 100644 --- a/mocks/dataexchangemocks/plugin.go +++ b/mocks/dataexchangemocks/plugin.go @@ -5,11 +5,11 @@ package dataexchangemocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" - dataexchange "github.com/hyperledger-labs/firefly/pkg/dataexchange" + dataexchange "github.com/hyperledger/firefly/pkg/dataexchange" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" io "io" diff --git a/mocks/datamocks/manager.go b/mocks/datamocks/manager.go index 79b1b76dd1..7e78552c89 100644 --- a/mocks/datamocks/manager.go +++ b/mocks/datamocks/manager.go @@ -5,7 +5,7 @@ package datamocks import ( context "context" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" io "io" diff --git a/mocks/eventmocks/event_manager.go b/mocks/eventmocks/event_manager.go index eae0aac0f1..e0785dcd25 100644 --- a/mocks/eventmocks/event_manager.go +++ b/mocks/eventmocks/event_manager.go @@ -5,17 +5,17 @@ package eventmocks import ( context "context" - blockchain "github.com/hyperledger-labs/firefly/pkg/blockchain" + blockchain "github.com/hyperledger/firefly/pkg/blockchain" - dataexchange "github.com/hyperledger-labs/firefly/pkg/dataexchange" + dataexchange "github.com/hyperledger/firefly/pkg/dataexchange" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" - system "github.com/hyperledger-labs/firefly/internal/events/system" + system "github.com/hyperledger/firefly/internal/events/system" - tokens "github.com/hyperledger-labs/firefly/pkg/tokens" + tokens "github.com/hyperledger/firefly/pkg/tokens" ) // EventManager is an autogenerated mock type for the EventManager type diff --git a/mocks/eventsmocks/callbacks.go b/mocks/eventsmocks/callbacks.go index 8c92fd82dc..0c7bd522de 100644 --- a/mocks/eventsmocks/callbacks.go +++ b/mocks/eventsmocks/callbacks.go @@ -3,8 +3,8 @@ package eventsmocks import ( - events "github.com/hyperledger-labs/firefly/pkg/events" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + events "github.com/hyperledger/firefly/pkg/events" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/eventsmocks/plugin.go b/mocks/eventsmocks/plugin.go index 3b82abc603..1288aaa2e7 100644 --- a/mocks/eventsmocks/plugin.go +++ b/mocks/eventsmocks/plugin.go @@ -5,11 +5,11 @@ package eventsmocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" - events "github.com/hyperledger-labs/firefly/pkg/events" + events "github.com/hyperledger/firefly/pkg/events" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/eventsmocks/plugin_all.go b/mocks/eventsmocks/plugin_all.go index d29e2cd28b..550385038e 100644 --- a/mocks/eventsmocks/plugin_all.go +++ b/mocks/eventsmocks/plugin_all.go @@ -5,11 +5,11 @@ package eventsmocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" - events "github.com/hyperledger-labs/firefly/pkg/events" + events "github.com/hyperledger/firefly/pkg/events" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/identitymanagermocks/manager.go b/mocks/identitymanagermocks/manager.go index 90b9f5d001..9ce7cdd070 100644 --- a/mocks/identitymanagermocks/manager.go +++ b/mocks/identitymanagermocks/manager.go @@ -5,7 +5,7 @@ package identitymanagermocks import ( context "context" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/identitymocks/plugin.go b/mocks/identitymocks/plugin.go index 699adb1673..d7cb3f3e04 100644 --- a/mocks/identitymocks/plugin.go +++ b/mocks/identitymocks/plugin.go @@ -5,9 +5,9 @@ package identitymocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" - identity "github.com/hyperledger-labs/firefly/pkg/identity" + identity "github.com/hyperledger/firefly/pkg/identity" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/networkmapmocks/manager.go b/mocks/networkmapmocks/manager.go index f44e2fa6b4..6c95e1774d 100644 --- a/mocks/networkmapmocks/manager.go +++ b/mocks/networkmapmocks/manager.go @@ -5,8 +5,8 @@ package networkmapmocks import ( context "context" - database "github.com/hyperledger-labs/firefly/pkg/database" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + database "github.com/hyperledger/firefly/pkg/database" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/orchestratormocks/orchestrator.go b/mocks/orchestratormocks/orchestrator.go index 636158e43d..a0b94421fa 100644 --- a/mocks/orchestratormocks/orchestrator.go +++ b/mocks/orchestratormocks/orchestrator.go @@ -3,24 +3,24 @@ package orchestratormocks import ( - assets "github.com/hyperledger-labs/firefly/internal/assets" - broadcast "github.com/hyperledger-labs/firefly/internal/broadcast" + assets "github.com/hyperledger/firefly/internal/assets" + broadcast "github.com/hyperledger/firefly/internal/broadcast" context "context" - data "github.com/hyperledger-labs/firefly/internal/data" + data "github.com/hyperledger/firefly/internal/data" - database "github.com/hyperledger-labs/firefly/pkg/database" + database "github.com/hyperledger/firefly/pkg/database" - events "github.com/hyperledger-labs/firefly/internal/events" + events "github.com/hyperledger/firefly/internal/events" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" - networkmap "github.com/hyperledger-labs/firefly/internal/networkmap" + networkmap "github.com/hyperledger/firefly/internal/networkmap" - privatemessaging "github.com/hyperledger-labs/firefly/internal/privatemessaging" + privatemessaging "github.com/hyperledger/firefly/internal/privatemessaging" ) // Orchestrator is an autogenerated mock type for the Orchestrator type diff --git a/mocks/privatemessagingmocks/manager.go b/mocks/privatemessagingmocks/manager.go index 078bb7f352..faf5e8284a 100644 --- a/mocks/privatemessagingmocks/manager.go +++ b/mocks/privatemessagingmocks/manager.go @@ -5,8 +5,8 @@ package privatemessagingmocks import ( context "context" - database "github.com/hyperledger-labs/firefly/pkg/database" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + database "github.com/hyperledger/firefly/pkg/database" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/publicstoragemocks/plugin.go b/mocks/publicstoragemocks/plugin.go index 5fc17c2308..8bb210dfc2 100644 --- a/mocks/publicstoragemocks/plugin.go +++ b/mocks/publicstoragemocks/plugin.go @@ -5,13 +5,13 @@ package publicstoragemocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" io "io" mock "github.com/stretchr/testify/mock" - publicstorage "github.com/hyperledger-labs/firefly/pkg/publicstorage" + publicstorage "github.com/hyperledger/firefly/pkg/publicstorage" ) // Plugin is an autogenerated mock type for the Plugin type diff --git a/mocks/syncasyncmocks/bridge.go b/mocks/syncasyncmocks/bridge.go index 99879b1b85..9070d581c2 100644 --- a/mocks/syncasyncmocks/bridge.go +++ b/mocks/syncasyncmocks/bridge.go @@ -5,12 +5,12 @@ package syncasyncmocks import ( context "context" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" - syncasync "github.com/hyperledger-labs/firefly/internal/syncasync" + syncasync "github.com/hyperledger/firefly/internal/syncasync" - sysmessaging "github.com/hyperledger-labs/firefly/internal/sysmessaging" + sysmessaging "github.com/hyperledger/firefly/internal/sysmessaging" ) // Bridge is an autogenerated mock type for the Bridge type diff --git a/mocks/syshandlersmocks/system_handlers.go b/mocks/syshandlersmocks/system_handlers.go index eb51c591a9..12031e33ad 100644 --- a/mocks/syshandlersmocks/system_handlers.go +++ b/mocks/syshandlersmocks/system_handlers.go @@ -5,8 +5,8 @@ package syshandlersmocks import ( context "context" - database "github.com/hyperledger-labs/firefly/pkg/database" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + database "github.com/hyperledger/firefly/pkg/database" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" ) diff --git a/mocks/sysmessagingmocks/system_events.go b/mocks/sysmessagingmocks/system_events.go index 39e1ada90e..640983e492 100644 --- a/mocks/sysmessagingmocks/system_events.go +++ b/mocks/sysmessagingmocks/system_events.go @@ -5,7 +5,7 @@ package sysmessagingmocks import ( mock "github.com/stretchr/testify/mock" - system "github.com/hyperledger-labs/firefly/internal/events/system" + system "github.com/hyperledger/firefly/internal/events/system" ) // SystemEvents is an autogenerated mock type for the SystemEvents type diff --git a/mocks/tokenmocks/callbacks.go b/mocks/tokenmocks/callbacks.go index e7ae5f08d0..a70e889d49 100644 --- a/mocks/tokenmocks/callbacks.go +++ b/mocks/tokenmocks/callbacks.go @@ -3,10 +3,10 @@ package tokenmocks import ( - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" - tokens "github.com/hyperledger-labs/firefly/pkg/tokens" + tokens "github.com/hyperledger/firefly/pkg/tokens" ) // Callbacks is an autogenerated mock type for the Callbacks type diff --git a/mocks/tokenmocks/plugin.go b/mocks/tokenmocks/plugin.go index 1157a59b47..df9cae4bc9 100644 --- a/mocks/tokenmocks/plugin.go +++ b/mocks/tokenmocks/plugin.go @@ -5,13 +5,13 @@ package tokenmocks import ( context "context" - config "github.com/hyperledger-labs/firefly/internal/config" + config "github.com/hyperledger/firefly/internal/config" - fftypes "github.com/hyperledger-labs/firefly/pkg/fftypes" + fftypes "github.com/hyperledger/firefly/pkg/fftypes" mock "github.com/stretchr/testify/mock" - tokens "github.com/hyperledger-labs/firefly/pkg/tokens" + tokens "github.com/hyperledger/firefly/pkg/tokens" ) // Plugin is an autogenerated mock type for the Plugin type diff --git a/pkg/blockchain/plugin.go b/pkg/blockchain/plugin.go index aa410f264a..e3e06e4b42 100644 --- a/pkg/blockchain/plugin.go +++ b/pkg/blockchain/plugin.go @@ -19,8 +19,8 @@ package blockchain import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Plugin is the interface implemented by each blockchain plugin diff --git a/pkg/database/filter.go b/pkg/database/filter.go index 1143f23558..75eec2c717 100644 --- a/pkg/database/filter.go +++ b/pkg/database/filter.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // Filter is the output of the builder diff --git a/pkg/database/filter_test.go b/pkg/database/filter_test.go index 988bdead68..d82788215f 100644 --- a/pkg/database/filter_test.go +++ b/pkg/database/filter_test.go @@ -21,7 +21,7 @@ import ( "database/sql/driver" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/pkg/database/plugin.go b/pkg/database/plugin.go index 8ef2743738..996ff63dce 100644 --- a/pkg/database/plugin.go +++ b/pkg/database/plugin.go @@ -19,9 +19,9 @@ package database import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) var ( diff --git a/pkg/database/query_fields.go b/pkg/database/query_fields.go index 9e4ec4d1e5..2a33369aa8 100644 --- a/pkg/database/query_fields.go +++ b/pkg/database/query_fields.go @@ -26,8 +26,8 @@ import ( "strconv" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/pkg/fftypes" ) // QueryFactory creates a filter builder in the given context, and contains the rules on diff --git a/pkg/database/update.go b/pkg/database/update.go index 47a72c22dd..42b59ed5c6 100644 --- a/pkg/database/update.go +++ b/pkg/database/update.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // UpdateBuilder is the output of the builder diff --git a/pkg/database/update_test.go b/pkg/database/update_test.go index 13acf70ca4..c452c68f5c 100644 --- a/pkg/database/update_test.go +++ b/pkg/database/update_test.go @@ -18,7 +18,7 @@ import ( "context" "testing" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" ) diff --git a/pkg/dataexchange/plugin.go b/pkg/dataexchange/plugin.go index 41fcc536ee..baaca15fd8 100644 --- a/pkg/dataexchange/plugin.go +++ b/pkg/dataexchange/plugin.go @@ -20,8 +20,8 @@ import ( "context" "io" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Plugin is the interface implemented by each data exchange plugin diff --git a/pkg/events/plugin.go b/pkg/events/plugin.go index ea18421c4c..15177c24c6 100644 --- a/pkg/events/plugin.go +++ b/pkg/events/plugin.go @@ -19,8 +19,8 @@ package events import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Plugin is the interface implemented by event interface diff --git a/pkg/fftypes/batch.go b/pkg/fftypes/batch.go index 2da07fa93b..7fa96eeaf7 100644 --- a/pkg/fftypes/batch.go +++ b/pkg/fftypes/batch.go @@ -22,7 +22,7 @@ import ( "database/sql/driver" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) type Batch struct { diff --git a/pkg/fftypes/byteable.go b/pkg/fftypes/byteable.go index 889ba15ef8..30b9fe87c7 100644 --- a/pkg/fftypes/byteable.go +++ b/pkg/fftypes/byteable.go @@ -21,7 +21,7 @@ import ( "crypto/sha256" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/log" ) // Byteable uses raw encode/decode to preserve field order, and can handle any types of field. diff --git a/pkg/fftypes/bytyetypes.go b/pkg/fftypes/bytyetypes.go index 6995408a38..e6e461f80b 100644 --- a/pkg/fftypes/bytyetypes.go +++ b/pkg/fftypes/bytyetypes.go @@ -24,7 +24,7 @@ import ( "hash" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // Bytes32 is a holder of a hash, that can be used to correlate onchain data with off-chain data. diff --git a/pkg/fftypes/data.go b/pkg/fftypes/data.go index 3bf5ef0ae0..c94b1b493a 100644 --- a/pkg/fftypes/data.go +++ b/pkg/fftypes/data.go @@ -22,7 +22,7 @@ import ( "encoding/json" "fmt" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) type DataRef struct { diff --git a/pkg/fftypes/datatype.go b/pkg/fftypes/datatype.go index 40fe3e8740..8b4de5c5df 100644 --- a/pkg/fftypes/datatype.go +++ b/pkg/fftypes/datatype.go @@ -19,7 +19,7 @@ package fftypes import ( "context" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) type ValidatorType = FFEnum diff --git a/pkg/fftypes/group.go b/pkg/fftypes/group.go index a892281e5a..4080e0347d 100644 --- a/pkg/fftypes/group.go +++ b/pkg/fftypes/group.go @@ -23,7 +23,7 @@ import ( "fmt" "sort" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) type GroupIdentity struct { diff --git a/pkg/fftypes/jsondata.go b/pkg/fftypes/jsondata.go index 3794cae1b7..489cae0d37 100644 --- a/pkg/fftypes/jsondata.go +++ b/pkg/fftypes/jsondata.go @@ -24,8 +24,8 @@ import ( "strconv" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" ) // JSONObject is a holder of a hash, that can be used to correlate onchain data with off-chain data. diff --git a/pkg/fftypes/message.go b/pkg/fftypes/message.go index 44b3c37a92..cd0870d399 100644 --- a/pkg/fftypes/message.go +++ b/pkg/fftypes/message.go @@ -21,7 +21,7 @@ import ( "crypto/sha256" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) const ( diff --git a/pkg/fftypes/namearray.go b/pkg/fftypes/namearray.go index 8c89d25ef4..6821070fff 100644 --- a/pkg/fftypes/namearray.go +++ b/pkg/fftypes/namearray.go @@ -22,7 +22,7 @@ import ( "fmt" "strings" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // FFNameArray is an array of strings, each conforming to the requirements diff --git a/pkg/fftypes/namespace.go b/pkg/fftypes/namespace.go index db17f06e9c..338a86780a 100644 --- a/pkg/fftypes/namespace.go +++ b/pkg/fftypes/namespace.go @@ -20,7 +20,7 @@ import ( "context" "fmt" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // NamespaceType describes when the namespace was created from local configuration, or broadcast through the network diff --git a/pkg/fftypes/node.go b/pkg/fftypes/node.go index 8e2d406eda..f82e64ce99 100644 --- a/pkg/fftypes/node.go +++ b/pkg/fftypes/node.go @@ -19,7 +19,7 @@ package fftypes import ( "context" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // Node is a FireFly node within the network diff --git a/pkg/fftypes/organization.go b/pkg/fftypes/organization.go index f6ed435772..4e40f3e7c2 100644 --- a/pkg/fftypes/organization.go +++ b/pkg/fftypes/organization.go @@ -22,7 +22,7 @@ import ( "strings" "unicode" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) const ( diff --git a/pkg/fftypes/sizeutils.go b/pkg/fftypes/sizeutils.go index 7a3cf7dc31..cd573a2b50 100644 --- a/pkg/fftypes/sizeutils.go +++ b/pkg/fftypes/sizeutils.go @@ -20,7 +20,7 @@ import ( "context" "github.com/docker/go-units" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/log" ) // ParseToByteSize is a standard handling of a number of bytes, in config or API options diff --git a/pkg/fftypes/sizeutils_test.go b/pkg/fftypes/sizeutils_test.go index 52a7e8b5e4..af38a2dcd4 100644 --- a/pkg/fftypes/sizeutils_test.go +++ b/pkg/fftypes/sizeutils_test.go @@ -19,7 +19,7 @@ package fftypes import ( "testing" - "gotest.tools/assert" + "github.com/stretchr/testify/assert" ) func TestByteSize(t *testing.T) { diff --git a/pkg/fftypes/subscription.go b/pkg/fftypes/subscription.go index a0ac82ac64..296d01d34d 100644 --- a/pkg/fftypes/subscription.go +++ b/pkg/fftypes/subscription.go @@ -21,7 +21,7 @@ import ( "database/sql/driver" "encoding/json" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // SubscriptionFilter contains regular expressions to match against events. All must match for an event to be dispatched to a subscription diff --git a/pkg/fftypes/timeutils.go b/pkg/fftypes/timeutils.go index 7c1e10020b..362f23fb46 100644 --- a/pkg/fftypes/timeutils.go +++ b/pkg/fftypes/timeutils.go @@ -23,8 +23,8 @@ import ( "strconv" "time" - "github.com/hyperledger-labs/firefly/internal/i18n" - "github.com/hyperledger-labs/firefly/internal/log" + "github.com/hyperledger/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/log" ) // FFTime is serialized to JSON on the API in RFC3339 nanosecond UTC time diff --git a/pkg/fftypes/uuid.go b/pkg/fftypes/uuid.go index 4a31f6e825..c1226a773a 100644 --- a/pkg/fftypes/uuid.go +++ b/pkg/fftypes/uuid.go @@ -21,7 +21,7 @@ import ( "database/sql/driver" "github.com/google/uuid" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) // UUID is a wrapper on a UUID implementation, ensuring Value handles nil diff --git a/pkg/fftypes/validations.go b/pkg/fftypes/validations.go index 04adb17d4e..4aede21f1b 100644 --- a/pkg/fftypes/validations.go +++ b/pkg/fftypes/validations.go @@ -20,7 +20,7 @@ import ( "context" "regexp" - "github.com/hyperledger-labs/firefly/internal/i18n" + "github.com/hyperledger/firefly/internal/i18n" ) var ( diff --git a/pkg/identity/plugin.go b/pkg/identity/plugin.go index 276f2d003e..79aeb46ffa 100644 --- a/pkg/identity/plugin.go +++ b/pkg/identity/plugin.go @@ -19,8 +19,8 @@ package identity import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Plugin is the interface implemented by each identity plugin @@ -46,7 +46,7 @@ type Plugin interface { // solutions into FireFly is required. However, the immediate shift in Sep 2021 moved to defining // a strong enough identity construct within FireFly to map from/to. // - // See issue https://github.com/hyperledger-labs/firefly/issues/187 to contribute to the discussion + // See issue https://github.com/hyperledger/firefly/issues/187 to contribute to the discussion } diff --git a/pkg/publicstorage/plugin.go b/pkg/publicstorage/plugin.go index 86b8c2ace5..4580587f0a 100644 --- a/pkg/publicstorage/plugin.go +++ b/pkg/publicstorage/plugin.go @@ -20,8 +20,8 @@ import ( "context" "io" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Plugin is the interface implemented by each Public Storage plugin diff --git a/pkg/tokens/plugin.go b/pkg/tokens/plugin.go index 216c3e6cce..6d1b4a7661 100644 --- a/pkg/tokens/plugin.go +++ b/pkg/tokens/plugin.go @@ -19,8 +19,8 @@ package tokens import ( "context" - "github.com/hyperledger-labs/firefly/internal/config" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/internal/config" + "github.com/hyperledger/firefly/pkg/fftypes" ) // Plugin is the interface implemented by each tokens plugin diff --git a/smart_contracts/fabric/firefly-go/chaincode/contract_test.go b/smart_contracts/fabric/firefly-go/chaincode/contract_test.go index eb0cc58105..2d749c6ce9 100644 --- a/smart_contracts/fabric/firefly-go/chaincode/contract_test.go +++ b/smart_contracts/fabric/firefly-go/chaincode/contract_test.go @@ -3,11 +3,11 @@ package chaincode_test import ( "testing" - "github.com/hyperledger-labs/firefly/chaincode-go/chaincode" - "github.com/hyperledger-labs/firefly/chaincode-go/chaincode/mocks" "github.com/hyperledger/fabric-chaincode-go/pkg/cid" "github.com/hyperledger/fabric-chaincode-go/shim" "github.com/hyperledger/fabric-contract-api-go/contractapi" + "github.com/hyperledger/firefly/chaincode-go/chaincode" + "github.com/hyperledger/firefly/chaincode-go/chaincode/mocks" "github.com/stretchr/testify/require" ) diff --git a/smart_contracts/fabric/firefly-go/firefly.go b/smart_contracts/fabric/firefly-go/firefly.go index 8f7e10b7cf..c865efc6e9 100644 --- a/smart_contracts/fabric/firefly-go/firefly.go +++ b/smart_contracts/fabric/firefly-go/firefly.go @@ -7,8 +7,8 @@ package main import ( "log" - "github.com/hyperledger-labs/firefly/chaincode-go/chaincode" "github.com/hyperledger/fabric-contract-api-go/contractapi" + "github.com/hyperledger/firefly/chaincode-go/chaincode" ) func main() { diff --git a/smart_contracts/fabric/firefly-go/go.mod b/smart_contracts/fabric/firefly-go/go.mod index be02046847..2cbdf3cabf 100644 --- a/smart_contracts/fabric/firefly-go/go.mod +++ b/smart_contracts/fabric/firefly-go/go.mod @@ -1,4 +1,4 @@ -module github.com/hyperledger-labs/firefly/chaincode-go +module github.com/hyperledger/firefly/chaincode-go go 1.16 diff --git a/solidity_firefly/package.json b/solidity_firefly/package.json index fef9facd27..fd96eae09b 100644 --- a/solidity_firefly/package.json +++ b/solidity_firefly/package.json @@ -1,5 +1,5 @@ { - "name": "@hyperledger-labs/assettrail-contracts", + "name": "@hyperledger/assettrail-contracts", "version": "0.0.1", "dependencies": { "@openzeppelin/contracts": "^3.2.0", diff --git a/solidity_kat/package.json b/solidity_kat/package.json index fef9facd27..fd96eae09b 100644 --- a/solidity_kat/package.json +++ b/solidity_kat/package.json @@ -1,5 +1,5 @@ { - "name": "@hyperledger-labs/assettrail-contracts", + "name": "@hyperledger/assettrail-contracts", "version": "0.0.1", "dependencies": { "@openzeppelin/contracts": "^3.2.0", diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index b3451b607a..7f10b7c9fd 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -33,7 +33,7 @@ import ( "github.com/go-resty/resty/v2" "github.com/gorilla/websocket" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/test/e2e/restclient.go b/test/e2e/restclient.go index feb25c3794..894f0712ff 100644 --- a/test/e2e/restclient.go +++ b/test/e2e/restclient.go @@ -27,9 +27,9 @@ import ( "time" "github.com/go-resty/resty/v2" - "github.com/hyperledger-labs/firefly/pkg/fftypes" + "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gotest.tools/assert" ) var ( diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 1832b3f846..3e79a537df 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -35,11 +35,11 @@ if [ "$CREATE_STACK" == "true" ]; then fi if [ "$BUILD_FIREFLY" == "true" ]; then - docker build -t ghcr.io/hyperledger-labs/firefly:latest ../.. + docker build -t ghcr.io/hyperledger/firefly:latest ../.. fi if [ "$DOWNLOAD_CLI" == "true" ]; then - go install github.com/hyperledger-labs/firefly-cli/ff@latest + go install github.com/hyperledger/firefly-cli/ff@latest fi if [ "$CREATE_STACK" == "true" ]; then From 631fb312980503d67dc5b547ce3f100047e9c496 Mon Sep 17 00:00:00 2001 From: Andrew Richardson Date: Tue, 5 Oct 2021 15:32:46 -0400 Subject: [PATCH 10/15] Fix persist_batch test Signed-off-by: Andrew Richardson --- internal/events/persist_batch_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/events/persist_batch_test.go b/internal/events/persist_batch_test.go index a23443e842..1f6a11a72b 100644 --- a/internal/events/persist_batch_test.go +++ b/internal/events/persist_batch_test.go @@ -65,7 +65,7 @@ func TestPersistBatchFromBroadcastRootOrg(t *testing.T) { { Header: fftypes.MessageHeader{ ID: fftypes.NewUUID(), - Type: fftypes.MessageTypeBroadcast, + Type: fftypes.MessageTypeDefinition, Identity: fftypes.Identity{ Key: "0x12345", }, From bf6c22fd368050e7c59f5918838a910237084aab Mon Sep 17 00:00:00 2001 From: Andrew Richardson Date: Tue, 5 Oct 2021 16:30:20 -0400 Subject: [PATCH 11/15] Remove "author" field from token pool As of now, token operations will not include any identity mapping - overriding any identities for token operations will require passing a string that is understood by the underlying connector (ie an Ethereum address). For convenience, this defaults to the identity of the local org. Signed-off-by: Andrew Richardson --- .../000030_create_key_fields.down.sql | 1 - .../postgres/000030_create_key_fields.up.sql | 4 +- .../sqlite/000030_create_key_fields.down.sql | 1 - .../sqlite/000030_create_key_fields.up.sql | 3 +- docs/swagger/swagger.yaml | 18 --------- internal/assets/manager.go | 11 ++++-- internal/assets/manager_test.go | 38 +++++++++++-------- internal/assets/token_pool_created.go | 4 +- internal/database/sqlcommon/tokenpool_sql.go | 4 -- .../database/sqlcommon/tokenpool_sql_test.go | 5 +-- internal/syshandlers/syshandler_tokenpool.go | 2 +- pkg/database/plugin.go | 1 - pkg/fftypes/tokenpool.go | 24 ++++++------ 13 files changed, 46 insertions(+), 70 deletions(-) diff --git a/db/migrations/postgres/000030_create_key_fields.down.sql b/db/migrations/postgres/000030_create_key_fields.down.sql index 65af617474..01e423d308 100644 --- a/db/migrations/postgres/000030_create_key_fields.down.sql +++ b/db/migrations/postgres/000030_create_key_fields.down.sql @@ -2,5 +2,4 @@ BEGIN; ALTER TABLE batches DROP COLUMN "key"; ALTER TABLE messages DROP COLUMN "key"; ALTER TABLE tokenpool DROP COLUMN "key"; -ALTER TABLE tokenpool DROP COLUMN "author"; COMMIT; diff --git a/db/migrations/postgres/000030_create_key_fields.up.sql b/db/migrations/postgres/000030_create_key_fields.up.sql index 8a299ea83f..088430cbd6 100644 --- a/db/migrations/postgres/000030_create_key_fields.up.sql +++ b/db/migrations/postgres/000030_create_key_fields.up.sql @@ -9,9 +9,7 @@ UPDATE messages SET "key" = ""; ALTER TABLE messages ALTER COLUMN "key" SET NOT NULL; ALTER TABLE tokenpool ADD "key" VARCHAR(1024); -ALTER TABLE tokenpool ADD "author" VARCHAR(1024); -UPDATE tokenpool SET "key" = "", "author" = ""; +UPDATE tokenpool SET "key" = ""; ALTER TABLE tokenpool ALTER COLUMN "key" SET NOT NULL; -ALTER TABLE tokenpool ALTER COLUMN "author" SET NOT NULL; COMMIT; diff --git a/db/migrations/sqlite/000030_create_key_fields.down.sql b/db/migrations/sqlite/000030_create_key_fields.down.sql index 37a47a98c8..30dc05481c 100644 --- a/db/migrations/sqlite/000030_create_key_fields.down.sql +++ b/db/migrations/sqlite/000030_create_key_fields.down.sql @@ -1,4 +1,3 @@ ALTER TABLE batches DROP COLUMN "key"; ALTER TABLE messages DROP COLUMN "key"; ALTER TABLE tokenpool DROP COLUMN "key"; -ALTER TABLE tokenpool DROP COLUMN "author"; diff --git a/db/migrations/sqlite/000030_create_key_fields.up.sql b/db/migrations/sqlite/000030_create_key_fields.up.sql index ab34add9a7..10e9b7edb1 100644 --- a/db/migrations/sqlite/000030_create_key_fields.up.sql +++ b/db/migrations/sqlite/000030_create_key_fields.up.sql @@ -5,5 +5,4 @@ ALTER TABLE messages ADD COLUMN "key" VARCHAR(1024); UPDATE messages SET "key" = ""; ALTER TABLE tokenpool ADD COLUMN "key" VARCHAR(1024); -ALTER TABLE tokenpool ADD COLUMN "author" VARCHAR(1024); -UPDATE tokenpool SET "key" = "", "author" = ""; +UPDATE tokenpool SET "key" = ""; diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index fe8fc49bc9..5bb1dd1dfc 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -4295,11 +4295,6 @@ paths: schema: default: 120s type: string - - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' - in: query - name: author - schema: - type: string - description: 'Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^' in: query name: created @@ -4386,8 +4381,6 @@ paths: schema: items: properties: - author: - type: string config: additionalProperties: {} type: object @@ -4453,15 +4446,10 @@ paths: application/json: schema: properties: - author: - type: string config: additionalProperties: {} type: object key: - enum: - - fungible - - nonfungible type: string name: type: string @@ -4479,8 +4467,6 @@ paths: application/json: schema: properties: - author: - type: string config: additionalProperties: {} type: object @@ -4514,8 +4500,6 @@ paths: application/json: schema: properties: - author: - type: string config: additionalProperties: {} type: object @@ -4583,8 +4567,6 @@ paths: application/json: schema: properties: - author: - type: string config: additionalProperties: {} type: object diff --git a/internal/assets/manager.go b/internal/assets/manager.go index 6f025db2bf..f7cf4c1974 100644 --- a/internal/assets/manager.go +++ b/internal/assets/manager.go @@ -124,9 +124,12 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id return nil, err } - err := am.identity.ResolveInputIdentity(ctx, &pool.Identity) - if err != nil { - return nil, i18n.WrapError(ctx, err, i18n.MsgAuthorInvalid) + if pool.Key == "" { + org, err := am.identity.GetLocalOrganization(ctx) + if err != nil { + return nil, err + } + pool.Key = org.Identity } plugin, err := am.selectTokenPlugin(ctx, typeName) @@ -172,7 +175,7 @@ func (am *assetManager) CreateTokenPoolWithID(ctx context.Context, ns string, id "", fftypes.OpTypeTokensCreatePool, fftypes.OpStatusPending, - pool.Author) + "") addTokenPoolCreateInputs(op, pool) err = am.database.UpsertOperation(ctx, op, false) if err != nil { diff --git a/internal/assets/manager_test.go b/internal/assets/manager_test.go index 1c7eb3d3a7..93dcbe3ec5 100644 --- a/internal/assets/manager_test.go +++ b/internal/assets/manager_test.go @@ -43,9 +43,6 @@ func newTestAssets(t *testing.T) (*assetManager, func()) { mbm := &broadcastmocks.Manager{} mti := &tokenmocks.Plugin{} mti.On("Name").Return("ut_tokens").Maybe() - mim.On("ResolveInputIdentity", mock.Anything, mock.MatchedBy(func(identity *fftypes.Identity) bool { - return identity.Author == "org1" - })).Return(nil).Maybe() ctx, cancel := context.WithCancel(context.Background()) a, err := NewAssetManager(ctx, mdi, mim, mdm, msa, mbm, map[string]tokens.Plugin{"magic-tokens": mti}) rag := mdi.On("RunAsGroup", ctx, mock.Anything).Maybe() @@ -80,20 +77,17 @@ func TestCreateTokenPoolBadNamespace(t *testing.T) { assert.EqualError(t, err, "pop") } -func TestCreateTokenPoolBadIdentity(t *testing.T) { +func TestCreateTokenPoolIdentityFail(t *testing.T) { am, cancel := newTestAssets(t) defer cancel() mdm := am.data.(*datamocks.Manager) mim := am.identity.(*identitymanagermocks.Manager) mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) - mim.On("ResolveInputIdentity", mock.Anything, mock.MatchedBy(func(identity *fftypes.Identity) bool { - assert.Equal(t, "wrong", identity.Author) - return true - })).Return(fmt.Errorf("pop")) + mim.On("GetLocalOrganization", context.Background()).Return(nil, fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "test", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "wrong"}}, false) - assert.Regexp(t, "pop", err) + _, err := am.CreateTokenPool(context.Background(), "ns1", "test", &fftypes.TokenPool{}, false) + assert.EqualError(t, err, "pop") } func TestCreateTokenPoolBadConnector(t *testing.T) { @@ -101,9 +95,11 @@ func TestCreateTokenPoolBadConnector(t *testing.T) { defer cancel() mdm := am.data.(*datamocks.Manager) + mim := am.identity.(*identitymanagermocks.Manager) + mim.On("GetLocalOrganization", context.Background()).Return(&fftypes.Organization{Identity: "0x12345"}, nil).Maybe() mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) - _, err := am.CreateTokenPool(context.Background(), "ns1", "bad", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "bad", &fftypes.TokenPool{}, false) assert.Regexp(t, "FF10272", err) } @@ -114,6 +110,8 @@ func TestCreateTokenPoolFail(t *testing.T) { mdi := am.database.(*databasemocks.Plugin) mdm := am.data.(*datamocks.Manager) mti := am.tokens["magic-tokens"].(*tokenmocks.Plugin) + mim := am.identity.(*identitymanagermocks.Manager) + mim.On("GetLocalOrganization", context.Background()).Return(&fftypes.Organization{Identity: "0x12345"}, nil).Maybe() mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) mdi.On("UpsertTransaction", context.Background(), mock.MatchedBy(func(tx *fftypes.Transaction) bool { return tx.Subject.Type == fftypes.TransactionTypeTokenPool @@ -121,7 +119,7 @@ func TestCreateTokenPoolFail(t *testing.T) { mdi.On("UpsertOperation", mock.Anything, mock.Anything, false).Return(nil) mti.On("CreateTokenPool", context.Background(), mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) assert.Regexp(t, "pop", err) } @@ -131,10 +129,12 @@ func TestCreateTokenPoolTransactionFail(t *testing.T) { mdi := am.database.(*databasemocks.Plugin) mdm := am.data.(*datamocks.Manager) + mim := am.identity.(*identitymanagermocks.Manager) + mim.On("GetLocalOrganization", context.Background()).Return(&fftypes.Organization{Identity: "0x12345"}, nil).Maybe() mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) mdi.On("UpsertTransaction", context.Background(), mock.Anything, false).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) assert.Regexp(t, "pop", err) } @@ -144,13 +144,15 @@ func TestCreateTokenPoolOperationFail(t *testing.T) { mdi := am.database.(*databasemocks.Plugin) mdm := am.data.(*datamocks.Manager) + mim := am.identity.(*identitymanagermocks.Manager) + mim.On("GetLocalOrganization", context.Background()).Return(&fftypes.Organization{Identity: "0x12345"}, nil).Maybe() mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) mdi.On("UpsertTransaction", context.Background(), mock.MatchedBy(func(tx *fftypes.Transaction) bool { return tx.Subject.Type == fftypes.TransactionTypeTokenPool }), false).Return(nil) mdi.On("UpsertOperation", mock.Anything, mock.Anything, false).Return(fmt.Errorf("pop")) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) assert.Regexp(t, "pop", err) } @@ -161,6 +163,8 @@ func TestCreateTokenPoolSuccess(t *testing.T) { mdi := am.database.(*databasemocks.Plugin) mdm := am.data.(*datamocks.Manager) mti := am.tokens["magic-tokens"].(*tokenmocks.Plugin) + mim := am.identity.(*identitymanagermocks.Manager) + mim.On("GetLocalOrganization", context.Background()).Return(&fftypes.Organization{Identity: "0x12345"}, nil).Maybe() mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil) mti.On("CreateTokenPool", context.Background(), mock.Anything, mock.Anything, mock.Anything).Return(nil) mdi.On("UpsertTransaction", context.Background(), mock.MatchedBy(func(tx *fftypes.Transaction) bool { @@ -168,7 +172,7 @@ func TestCreateTokenPoolSuccess(t *testing.T) { }), false).Return(nil) mdi.On("UpsertOperation", mock.Anything, mock.Anything, false).Return(nil) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, false) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, false) assert.NoError(t, err) } @@ -182,6 +186,8 @@ func TestCreateTokenPoolConfirm(t *testing.T) { mdm := am.data.(*datamocks.Manager) msa := am.syncasync.(*syncasyncmocks.Bridge) mti := am.tokens["magic-tokens"].(*tokenmocks.Plugin) + mim := am.identity.(*identitymanagermocks.Manager) + mim.On("GetLocalOrganization", context.Background()).Return(&fftypes.Organization{Identity: "0x12345"}, nil).Maybe() mdm.On("VerifyNamespaceExists", context.Background(), "ns1").Return(nil).Times(2) mti.On("CreateTokenPool", context.Background(), mock.Anything, mock.MatchedBy(func(pool *fftypes.TokenPool) bool { return pool.ID == requestID @@ -197,7 +203,7 @@ func TestCreateTokenPoolConfirm(t *testing.T) { }). Return(nil, nil) - _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{Identity: fftypes.Identity{Author: "org1"}}, true) + _, err := am.CreateTokenPool(context.Background(), "ns1", "magic-tokens", &fftypes.TokenPool{}, true) assert.NoError(t, err) } diff --git a/internal/assets/token_pool_created.go b/internal/assets/token_pool_created.go index 6b5d377007..08cebf4068 100644 --- a/internal/assets/token_pool_created.go +++ b/internal/assets/token_pool_created.go @@ -40,9 +40,7 @@ func (am *assetManager) TokenPoolCreated(tk tokens.Plugin, tokenType fftypes.Tok TokenPool: fftypes.TokenPool{ Type: tokenType, ProtocolID: protocolID, - Identity: fftypes.Identity{ - Key: signingIdentity, - }, + Key: signingIdentity, }, ProtocolTxID: protocolTxID, } diff --git a/internal/database/sqlcommon/tokenpool_sql.go b/internal/database/sqlcommon/tokenpool_sql.go index 5a7cfe2b6a..ff1da36aaf 100644 --- a/internal/database/sqlcommon/tokenpool_sql.go +++ b/internal/database/sqlcommon/tokenpool_sql.go @@ -40,7 +40,6 @@ var ( "created", "tx_type", "tx_id", - "author", "key", } tokenPoolFilterFieldMap = map[string]string{ @@ -91,7 +90,6 @@ func (s *SQLCommon) UpsertTokenPool(ctx context.Context, pool *fftypes.TokenPool Set("message_id", pool.Message). Set("tx_type", pool.TX.Type). Set("tx_id", pool.TX.ID). - Set("author", pool.Author). Set("key", pool.Key). Where(sq.Eq{"id": pool.ID}), func() { @@ -117,7 +115,6 @@ func (s *SQLCommon) UpsertTokenPool(ctx context.Context, pool *fftypes.TokenPool pool.Created, pool.TX.Type, pool.TX.ID, - pool.Author, pool.Key, ), func() { @@ -145,7 +142,6 @@ func (s *SQLCommon) tokenPoolResult(ctx context.Context, row *sql.Rows) (*fftype &pool.Created, &pool.TX.Type, &pool.TX.ID, - &pool.Author, &pool.Key, ) if err != nil { diff --git a/internal/database/sqlcommon/tokenpool_sql_test.go b/internal/database/sqlcommon/tokenpool_sql_test.go index 8dce472d00..61040847db 100644 --- a/internal/database/sqlcommon/tokenpool_sql_test.go +++ b/internal/database/sqlcommon/tokenpool_sql_test.go @@ -50,10 +50,7 @@ func TestTokenPoolE2EWithDB(t *testing.T) { Type: fftypes.TransactionTypeTokenPool, ID: fftypes.NewUUID(), }, - Identity: fftypes.Identity{ - Key: "0x12345", - Author: "did:firefly:org/abcd", - }, + Key: "0x12345", } s.callbacks.On("UUIDCollectionNSEvent", database.CollectionTokenPools, fftypes.ChangeEventTypeCreated, "ns1", poolID, mock.Anything). diff --git a/internal/syshandlers/syshandler_tokenpool.go b/internal/syshandlers/syshandler_tokenpool.go index 71885bd2d7..d68b6972d2 100644 --- a/internal/syshandlers/syshandler_tokenpool.go +++ b/internal/syshandlers/syshandler_tokenpool.go @@ -75,7 +75,7 @@ func (sh *systemHandlers) persistTokenPool(ctx context.Context, pool *fftypes.To Subject: fftypes.TransactionSubject{ Namespace: pool.Namespace, Type: fftypes.TransactionTypeTokenPool, - Signer: pool.Author, + Signer: pool.Key, Reference: pool.ID, }, ProtocolID: pool.ProtocolTxID, diff --git a/pkg/database/plugin.go b/pkg/database/plugin.go index 94611e4a75..f1181b92f6 100644 --- a/pkg/database/plugin.go +++ b/pkg/database/plugin.go @@ -749,7 +749,6 @@ var TokenPoolQueryFactory = &queryFields{ "namespace": &StringField{}, "name": &StringField{}, "protocolid": &StringField{}, - "author": &StringField{}, "key": &StringField{}, "symbol": &StringField{}, "message": &UUIDField{}, diff --git a/pkg/fftypes/tokenpool.go b/pkg/fftypes/tokenpool.go index 27abe5ca8b..c41d4a46a4 100644 --- a/pkg/fftypes/tokenpool.go +++ b/pkg/fftypes/tokenpool.go @@ -28,18 +28,18 @@ var ( ) type TokenPool struct { - ID *UUID `json:"id,omitempty"` - Type TokenType `json:"type" ffenum:"tokentype"` - Namespace string `json:"namespace,omitempty"` - Name string `json:"name,omitempty"` - ProtocolID string `json:"protocolId,omitempty"` - Identity - Symbol string `json:"symbol,omitempty"` - Connector string `json:"connector,omitempty"` - Message *UUID `json:"message,omitempty"` - Created *FFTime `json:"created,omitempty"` - Config JSONObject `json:"config,omitempty"` - TX TransactionRef `json:"tx,omitempty"` + ID *UUID `json:"id,omitempty"` + Type TokenType `json:"type" ffenum:"tokentype"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + ProtocolID string `json:"protocolId,omitempty"` + Key string `json:"key,omitempty"` + Symbol string `json:"symbol,omitempty"` + Connector string `json:"connector,omitempty"` + Message *UUID `json:"message,omitempty"` + Created *FFTime `json:"created,omitempty"` + Config JSONObject `json:"config,omitempty"` + TX TransactionRef `json:"tx,omitempty"` } type TokenPoolAnnouncement struct { From 9589c03a968853cdc6ff9be4c39a90df5f937da4 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Wed, 6 Oct 2021 15:04:43 -0400 Subject: [PATCH 12/15] Validate parent org Signed-off-by: Peter Broadhurst --- .../syshandlers/syshandler_network_org.go | 16 +++++ .../syshandler_network_org_test.go | 72 +++++++++++++++++-- 2 files changed, 81 insertions(+), 7 deletions(-) diff --git a/internal/syshandlers/syshandler_network_org.go b/internal/syshandlers/syshandler_network_org.go index 5f87f9b1ce..df819c103f 100644 --- a/internal/syshandlers/syshandler_network_org.go +++ b/internal/syshandlers/syshandler_network_org.go @@ -37,6 +37,22 @@ func (sh *systemHandlers) handleOrganizationBroadcast(ctx context.Context, msg * return false, nil } + if org.Parent != "" { + parent, err := sh.database.GetOrganizationByIdentity(ctx, org.Parent) + if err != nil { + return false, err // We only return database errors + } + if parent == nil { + l.Warnf("Unable to process organization broadcast %s - parent identity not found: %s", msg.Header.ID, org.Parent) + return false, nil + } + + if msg.Header.Key != parent.Identity { + l.Warnf("Unable to process organization broadcast %s - incorrect signature. Expected=%s Received=%s", msg.Header.ID, parent.Identity, msg.Header.Author) + return false, nil + } + } + existing, err := sh.database.GetOrganizationByIdentity(ctx, org.Identity) if err == nil && existing == nil { existing, err = sh.database.GetOrganizationByName(ctx, org.Name) diff --git a/internal/syshandlers/syshandler_network_org_test.go b/internal/syshandlers/syshandler_network_org_test.go index b2f7f7e338..0c7818c80c 100644 --- a/internal/syshandlers/syshandler_network_org_test.go +++ b/internal/syshandlers/syshandler_network_org_test.go @@ -28,9 +28,16 @@ import ( "github.com/stretchr/testify/mock" ) -func TestHandleSystemBroadcastOrgOk(t *testing.T) { +func TestHandleSystemBroadcastChildOrgOk(t *testing.T) { sh := newTestSystemHandlers(t) + parentOrg := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org2", + Identity: "0x23456", + Description: "parent org", + } + org := &fftypes.Organization{ ID: fftypes.NewUUID(), Name: "org1", @@ -46,6 +53,7 @@ func TestHandleSystemBroadcastOrgOk(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(parentOrg, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, nil) mdi.On("GetOrganizationByName", mock.Anything, "org1").Return(nil, nil) mdi.On("GetOrganizationByID", mock.Anything, org.ID).Return(nil, nil) @@ -66,9 +74,16 @@ func TestHandleSystemBroadcastOrgOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastOrgDupOk(t *testing.T) { +func TestHandleSystemBroadcastChildOrgDupOk(t *testing.T) { sh := newTestSystemHandlers(t) + parentOrg := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org2", + Identity: "0x23456", + Description: "parent org", + } + org := &fftypes.Organization{ ID: fftypes.NewUUID(), Name: "org1", @@ -84,7 +99,8 @@ func TestHandleSystemBroadcastOrgDupOk(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x23456"}, nil) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(parentOrg, nil) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(org, nil) mdi.On("UpsertOrganization", mock.Anything, mock.Anything, true).Return(nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ @@ -102,9 +118,16 @@ func TestHandleSystemBroadcastOrgDupOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { +func TestHandleSystemBroadcastChildOrgBadKey(t *testing.T) { sh := newTestSystemHandlers(t) + parentOrg := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org2", + Identity: "0x23456", + Description: "parent org", + } + org := &fftypes.Organization{ ID: fftypes.NewUUID(), Name: "org1", @@ -119,6 +142,41 @@ func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { Value: fftypes.Byteable(b), } + mdi := sh.database.(*databasemocks.Plugin) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(parentOrg, nil) + valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + Header: fftypes.MessageHeader{ + Namespace: "ns1", + Identity: fftypes.Identity{ + Author: "did:firefly:org/0x23456", + Key: "0x34567", + }, + Tag: string(fftypes.SystemTagDefineOrganization), + }, + }, []*fftypes.Data{data}) + assert.False(t, valid) + assert.NoError(t, err) + + mdi.AssertExpectations(t) +} + +func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { + sh := newTestSystemHandlers(t) + + org := &fftypes.Organization{ + ID: fftypes.NewUUID(), + Name: "org1", + Identity: "0x12345", + Parent: "", // the mismatch + Description: "my org", + Profile: fftypes.JSONObject{"some": "info"}, + } + b, err := json.Marshal(&org) + assert.NoError(t, err) + data := &fftypes.Data{ + Value: fftypes.Byteable(b), + } + mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x9999"}, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ @@ -258,7 +316,7 @@ func TestHandleSystemBroadcastGetParentFail(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, fmt.Errorf("pop")) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, fmt.Errorf("pop")) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", @@ -282,7 +340,7 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { ID: fftypes.NewUUID(), Name: "org1", Identity: "0x12345", - Parent: "", + Parent: "0x23456", Description: "my org", Profile: fftypes.JSONObject{"some": "info"}, } @@ -293,7 +351,7 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { } mdi := sh.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", mock.Anything, org.Identity).Return(&fftypes.Organization{Identity: "0x12345", Parent: "0x99999"}, nil) + mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, nil) valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", From 6f1aaeaaf552a8353f7c88ad6f8577730b7ac7f0 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Wed, 6 Oct 2021 15:08:16 -0400 Subject: [PATCH 13/15] Restore coverage blip due to message type change Signed-off-by: Peter Broadhurst --- internal/events/persist_batch_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/events/persist_batch_test.go b/internal/events/persist_batch_test.go index 1f6a11a72b..908327b17d 100644 --- a/internal/events/persist_batch_test.go +++ b/internal/events/persist_batch_test.go @@ -117,7 +117,7 @@ func TestPersistBatchFromBroadcastRootOrgBadData(t *testing.T) { { Header: fftypes.MessageHeader{ ID: fftypes.NewUUID(), - Type: fftypes.MessageTypeBroadcast, + Type: fftypes.MessageTypeDefinition, Identity: fftypes.Identity{ Key: "0x12345", }, From bee2f7abac45ea1666d0fc9cbdbbcadca88739ce Mon Sep 17 00:00:00 2001 From: Andrew Richardson Date: Wed, 6 Oct 2021 14:59:12 -0400 Subject: [PATCH 14/15] Resolve local org DID when fetching Signed-off-by: Andrew Richardson --- internal/identity/identitymanager.go | 6 +++++- internal/identity/identitymanager_test.go | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go index 1b1048835e..83d264300d 100644 --- a/internal/identity/identitymanager.go +++ b/internal/identity/identitymanager.go @@ -77,7 +77,11 @@ func NewIdentityManager(ctx context.Context, di database.Plugin, ii identity.Plu } func (im *identityManager) GetLocalOrganization(ctx context.Context) (*fftypes.Organization, error) { - return im.cachedOrgLookupByAuthor(ctx, im.localOrgDID) + orgDID, err := im.ResolveLocalOrgDID(ctx) + if err != nil { + return nil, err + } + return im.cachedOrgLookupByAuthor(ctx, orgDID) } func (im *identityManager) OrgDID(org *fftypes.Organization) string { diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go index 546fb43d4a..155afa6c7f 100644 --- a/internal/identity/identitymanager_test.go +++ b/internal/identity/identitymanager_test.go @@ -397,7 +397,7 @@ func TestResolveLocalOrgDIDSuccess(t *testing.T) { assert.Equal(t, org, localOrg) mbi.AssertExpectations(t) - + mdi.AssertExpectations(t) } func TestResolveLocalOrgDIDFail(t *testing.T) { @@ -406,15 +406,18 @@ func TestResolveLocalOrgDIDFail(t *testing.T) { mbi := im.blockchain.(*blockchainmocks.Plugin) mbi.On("ResolveSigningKey", ctx, "key1").Return("key1resolved", nil).Once() mdi := im.database.(*databasemocks.Plugin) - mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(nil, fmt.Errorf("pop")).Once() + mdi.On("GetOrganizationByIdentity", ctx, "key1resolved").Return(nil, fmt.Errorf("pop")).Twice() config.Set(config.OrgIdentityDeprecated, "key1") _, err := im.ResolveLocalOrgDID(ctx) assert.Regexp(t, "FF10290", err) - mbi.AssertExpectations(t) + _, err = im.GetLocalOrganization(ctx) + assert.Regexp(t, "FF10290", err) + mbi.AssertExpectations(t) + mdi.AssertExpectations(t) } func TestResolveLocalOrgDIDNotFound(t *testing.T) { From 6f62a4aba3d2cdafef5e1cec4932875fc6dd1ce0 Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Wed, 6 Oct 2021 15:56:30 -0400 Subject: [PATCH 15/15] Fixed empty string delimiter in SQL migration scripts Signed-off-by: Jim Zhang --- db/migrations/postgres/000030_create_key_fields.up.sql | 6 +++--- db/migrations/sqlite/000030_create_key_fields.up.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/migrations/postgres/000030_create_key_fields.up.sql b/db/migrations/postgres/000030_create_key_fields.up.sql index 088430cbd6..403ed1aa0b 100644 --- a/db/migrations/postgres/000030_create_key_fields.up.sql +++ b/db/migrations/postgres/000030_create_key_fields.up.sql @@ -1,15 +1,15 @@ BEGIN; ALTER TABLE batches ADD "key" VARCHAR(1024); -UPDATE batches SET "key" = ""; +UPDATE batches SET "key" = ''; ALTER TABLE batches ALTER COLUMN "key" SET NOT NULL; ALTER TABLE messages ADD "key" VARCHAR(1024); -UPDATE messages SET "key" = ""; +UPDATE messages SET "key" = ''; ALTER TABLE messages ALTER COLUMN "key" SET NOT NULL; ALTER TABLE tokenpool ADD "key" VARCHAR(1024); -UPDATE tokenpool SET "key" = ""; +UPDATE tokenpool SET "key" = ''; ALTER TABLE tokenpool ALTER COLUMN "key" SET NOT NULL; COMMIT; diff --git a/db/migrations/sqlite/000030_create_key_fields.up.sql b/db/migrations/sqlite/000030_create_key_fields.up.sql index 10e9b7edb1..a6d269dfe8 100644 --- a/db/migrations/sqlite/000030_create_key_fields.up.sql +++ b/db/migrations/sqlite/000030_create_key_fields.up.sql @@ -1,8 +1,8 @@ ALTER TABLE batches ADD COLUMN "key" VARCHAR(1024); -UPDATE batches SET "key" = ""; +UPDATE batches SET "key" = ''; ALTER TABLE messages ADD COLUMN "key" VARCHAR(1024); -UPDATE messages SET "key" = ""; +UPDATE messages SET "key" = ''; ALTER TABLE tokenpool ADD COLUMN "key" VARCHAR(1024); -UPDATE tokenpool SET "key" = ""; +UPDATE tokenpool SET "key" = '';