Repository: hyperledger/firefly (go)

Issue:
1.1 migration /api/v1/status inconsistency
I've attempted to upgrade my firefly instance from 1.0 to 1.1-rc using the migration guide

When starting up 1.1 for the first time, an API call to `/api/v1/status` shows my org is registered, but my node is not [see below for full response].  

I was expecting both the org and the node to be unregistered at this point in the migration, as the guide instructs us the org and node will need to be reregistered manually in a later step

However, a call to `/api/v1/network/organizations` returns `[]` which is in line with expectations

`/api/v1/status`
```
{
  "namespace": {
    "name": "default",
    "networkName": "default",
    "description": "",
    "created": "2022-08-31T19:30:38.411907442Z"
  },
  "node": {
    "name": "zzak1jp9qi",
    "registered": false
  },
  "org": {
    "name": "zzak1jp9qi",
    "registered": true,
    "did": "did:firefly:org/zzak1jp9qi",
    "id": "ecf12f34-f5a2-47d2-b81a-8b2897329a17",
    "verifiers": [
      {
        "type": "ethereum_address",
        "value": "0xa45436691a6574ca6c873578730af4f0a6e210ec"
      }
    ]
  },
  "plugins": {
    "blockchain": [
      {
        "name": "blockchain0",
        "pluginType": "ethereum"
      }
    ],
    "database": [
      {
        "name": "database0",
        "pluginType": "sqlite3"
      }
    ],
    "dataExchange": [
      {
        "name": "dataexchange0",
        "pluginType": "ffdx"
      }
    ],
    "events": [
      {
        "pluginType": "system"
      },
      {
        "pluginType": "websockets"
      },
      {
        "pluginType": "webhooks"
      }
    ],
    "identity": [],
    "sharedStorage": [
      {
        "name": "sharedstorage0",
        "pluginType": "ipfs"
      }
    ],
    "tokens": [
      {
        "name": "erc20_erc721",
        "pluginType": "fftokens"
      }
    ]
  },
  "multiparty": {
    "enabled": true,
    "contract": {
      "active": {
        "index": 0,
        "location": {
          "address": "0x359ce02812c4e08b492e7c2543216f98bfff7550"
        },
        "info": {
          "subscription": "sb-0319aaa9-9338-4901-5d12-543d0848d3a0",
          "version": 1
        }
      }
    }
  }
}
```



Pull request:
remove legacy namespace query for organizations
closes #1032 

Patch:
diff --git a/docs/tutorials/custom_contracts/ethereum.md b/docs/tutorials/custom_contracts/ethereum.md
index 77ff405d1..28a609b47 100644
--- a/docs/tutorials/custom_contracts/ethereum.md
+++ b/docs/tutorials/custom_contracts/ethereum.md
@@ -549,7 +549,7 @@ Here is an example of sending 100 wei with a transaction:
 
 Now that we've seen how to submit transactions and preform read-only queries to the blockchain, let's look at how to receive blockchain events so we know when things are happening in realtime.
 
-If you look at the source code for the smart contract we're working with above, you'll notice that it emits an event when the stored value of the integer is set. In order to receive these events, we first need to instruct FireFly to listen for this specific type of blockchain event. To do this, we create an **Event Listener**. The `/contracts/listeners` endpoint is RESTful so there are `POST`, `GET`, and `DELETE` methods available on it. To create a new listener, we will make a `POST` request. We are going to tell FireFly to listen to events with name `"Changed"` from the FireFly Interface we defined earlier, referenced by its ID. We will also tell FireFly which contract address we expect to emit these events, and the topic to assign these events to. Topics are a way for applications to subscribe to events they are interested in.
+If you look at the source code for the smart contract we're working with above, you'll notice that it emits an event when the stored value of the integer is set. In order to receive these events, we first need to instruct FireFly to listen for this specific type of blockchain event. To do this, we create an **Event Listener**. The `/contracts/listeners` endpoint is RESTful so there are `POST`, `GET`, and `DELETE` methods available on it. To create a new listener, we will make a `POST` request. We are going to tell FireFly to listen to events with name `"Changed"` from the FireFly Interface we defined earlier, referenced by its ID. We will also tell FireFly which contract address we expect to emit these events.
 
 ### Request
 
@@ -564,71 +564,14 @@ If you look at the source code for the smart contract we're working with above,
     "address": "0xa5ea5d0a6b2eaf194716f0cc73981939dca26da1"
   },
   "eventPath": "Changed",
-  "options": {
-    "firstEvent": "new"
-  },
-  "topic": "simple-storage"
-}
-```
-
-### Response
-
-```json
-{
-  "id": "1bfa3b0f-3d90-403e-94a4-af978d8c5b14",
-  "interface": {
-    "id": "8bdd27a5-67c1-4960-8d1e-7aa31b9084d3"
-  },
-  "namespace": "default",
-  "name": "sb-66209ffc-d355-4ac0-7151-bc82490ca9df",
-  "protocolId": "sb-66209ffc-d355-4ac0-7151-bc82490ca9df",
-  "location": {
-    "address": "0xa5ea5d0a6b2eaf194716f0cc73981939dca26da1"
-  },
-  "created": "2022-02-17T22:02:36.34549538Z",
-  "event": {
-    "name": "Changed",
-    "description": "",
-    "params": [
-      {
-        "name": "from",
-        "schema": {
-          "type": "string",
-          "details": {
-            "type": "address",
-            "internalType": "address",
-            "indexed": true
-          }
-        }
-      },
-      {
-        "name": "value",
-        "schema": {
-          "type": "integer",
-          "details": {
-            "type": "uint256",
-            "internalType": "uint256"
-          }
-        }
-      }
-    ]
-  },
   "options": {
     "firstEvent": "oldest"
   }
 }
 ```
 
-We can see in the response, that FireFly pulls all the schema information from the FireFly Interface that we broadcasted earlier and creates the listener with that schema. This is useful so that we don't have to enter all of that data again.
-
-
-### Querying listener status
-
-If you are interested in learning about the current state of a listener you have created, you can query with the `fetchstatus` parameter. For FireFly stacks with an EVM compatible blockchain connector, the response will include checkpoint information and if the listener is currently in catchup mode.
-
-#### Request / Response
+### Response
 
-`GET` `http://localhost:5000/api/v1/namespaces/default/contracts/listeners/1bfa3b0f-3d90-403e-94a4-af978d8c5b14?fetchstatus`
 ```json
 {
   "id": "1bfa3b0f-3d90-403e-94a4-af978d8c5b14",
@@ -669,20 +612,13 @@ If you are interested in learning about the current state of a listener you have
       }
     ]
   },
-  "status": {
-    "checkpoint": {
-        "block": 0,
-        "transactionIndex": -1,
-        "logIndex": -1
-    },
-    "catchup": true
-  },
   "options": {
     "firstEvent": "oldest"
   }
 }
 ```
 
+We can see in the response, that FireFly pulls all the schema information from the FireFly Interface that we broadcasted earlier and creates the listener with that schema. This is useful so that we don't have to enter all of that data again.
 
 ## Subscribe to events from our contract
 
@@ -811,36 +747,6 @@ You can see in the event received over the WebSocket connection, the blockchain
 
 In the event, we can also see the `blockchainevent` itself, which has an `output` object. These are the `params` in our FireFly Interface, and the actual output of the event. Here we can see the `value` is `3` which is what we set the integer to in our original transaction.
 
-### Subscription offset
-If you query by the ID of your subscription with the `fetchstatus` parameter, you can see its current `offset`.
-
-`GET` `http://localhost:5000/api/v1/namespaces/default/subscriptions/f826269c-65ed-4634-b24c-4f399ec53a32`
-```json
-{
-  "id": "f826269c-65ed-4634-b24c-4f399ec53a32",
-  "namespace": "default",
-  "name": "simple-storage",
-  "transport": "websockets",
-  "filter": {
-    "events": "blockchain_event_received",
-    "message": {},
-    "transaction": {},
-    "blockchainevent": {
-      "listener": "1bfa3b0f-3d90-403e-94a4-af978d8c5b14"
-    }
-  },
-  "options": {
-    "firstEvent": "-1",
-    "withData": false
-  },
-  "status": {
-    "offset": 20
-  }
-  "created": "2022-03-15T17:35:30.131698921Z",
-  "updated": null
-}
-```
-
 **You've reached the end of the main guide to working with custom smart contracts in FireFly**. Hopefully this was helpful and gives you what you need to get up and running with your own contracts. There are several additional ways to invoke or query smart contracts detailed below, so feel free to keep reading if you're curious.
 
 ## Appendix I: Work with a custom contract without creating a named API
diff --git a/docs/tutorials/events.md b/docs/tutorials/events.md
index 0bf3edc1a..c87293eb9 100644
--- a/docs/tutorials/events.md
+++ b/docs/tutorials/events.md
@@ -134,7 +134,7 @@ it received):
 { "type": "ack", "id": "617db63-2cf5-4fa3-8320-46150cbb5372" }
 ```
 
-> _You must send an acknowledgement for every message, or you will stop receiving messages_.
+> _You must send an acknowledgement for every message, or you will stop receiving messages.
 
 ### Set up the WebSocket subscription
 
@@ -180,7 +180,3 @@ Example connection URL:
 - `namespace=default` - event listeners are scoped to a namespace
 - `name=app1` - the subscription name
 
-
-## Custom Contract Events
-
-If you are interested in learning more about events for custom smart contracts, please see the [Working with custom smart contracts](./custom_contracts/index.md) section.
diff --git a/internal/identity/identitymanager.go b/internal/identity/identitymanager.go
index 9f7c9707d..dfed896e1 100644
--- a/internal/identity/identitymanager.go
+++ b/internal/identity/identitymanager.go
@@ -415,11 +415,6 @@ func (im *identityManager) cachedIdentityLookupByVerifierRef(ctx context.Context
 	if err != nil {
 		return nil, err
 	} else if verifier == nil {
-		if namespace != core.LegacySystemNamespace && im.multiparty != nil && im.multiparty.GetNetworkVersion() == 1 {
-			// For V1 networks, fall back to LegacySystemNamespace for looking up identities
-			// This assumes that the system namespace shares a database with this manager's namespace!
-			return im.cachedIdentityLookupByVerifierRef(ctx, core.LegacySystemNamespace, verifierRef)
-		}
 		return nil, err
 	}
 	identity, err := im.database.GetIdentityByID(ctx, namespace, verifier.Identity)


Test patch:
diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go
index 5f4377b52..ac21b68bd 100644
--- a/internal/identity/identitymanager_test.go
+++ b/internal/identity/identitymanager_test.go
@@ -173,14 +173,12 @@ func TestResolveInputSigningIdentityAnonymousKeyWithAuthorOk(t *testing.T) {
 	mbi := im.blockchain.(*blockchainmocks.Plugin)
 	mmp := im.multiparty.(*multipartymocks.Manager)
 	mbi.On("NormalizeSigningKey", ctx, "mykey123").Return("fullkey123", nil)
-	mmp.On("GetNetworkVersion").Return(1)
 
 	idID := fftypes.NewUUID()
 
 	mdi := im.database.(*databasemocks.Plugin)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "fullkey123").Return(nil, nil)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "fullkey123").Return(nil, nil)
-	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, core.LegacySystemNamespace, "fullkey123").Return(nil, nil)
 	mdi.On("GetIdentityByDID", ctx, "ns1", "did:firefly:ns/ns1/myid").
 		Return(&core.Identity{
 			IdentityBase: core.IdentityBase{
@@ -214,12 +212,10 @@ func TestResolveInputSigningIdentityKeyWithNoAuthorFail(t *testing.T) {
 	mbi := im.blockchain.(*blockchainmocks.Plugin)
 	mmp := im.multiparty.(*multipartymocks.Manager)
 	mbi.On("NormalizeSigningKey", ctx, "mykey123").Return("fullkey123", nil)
-	mmp.On("GetNetworkVersion").Return(1)
 
 	mdi := im.database.(*databasemocks.Plugin)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "fullkey123").Return(nil, nil)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "fullkey123").Return(nil, nil)
-	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, core.LegacySystemNamespace, "fullkey123").Return(nil, nil)
 
 	msgIdentity := &core.SignerRef{
 		Key: "mykey123",
@@ -281,15 +277,12 @@ func TestResolveInputSigningIdentityByKeyNotFound(t *testing.T) {
 	mbi := im.blockchain.(*blockchainmocks.Plugin)
 	mmp := im.multiparty.(*multipartymocks.Manager)
 	mbi.On("NormalizeSigningKey", ctx, "mykey123").Return("fullkey123", nil)
-	mmp.On("GetNetworkVersion").Return(1)
 
 	mdi := im.database.(*databasemocks.Plugin)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "fullkey123").
 		Return(nil, nil)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "fullkey123").
 		Return(nil, nil)
-	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, core.LegacySystemNamespace, "fullkey123").
-		Return(nil, nil)
 	mdi.On("GetIdentityByDID", ctx, "ns1", "did:firefly:ns/ns1/unknown").
 		Return(nil, nil)
 
@@ -619,12 +612,10 @@ func TestResolveDefaultSigningIdentityNotFound(t *testing.T) {
 
 	mbi := im.blockchain.(*blockchainmocks.Plugin)
 	mmp := im.multiparty.(*multipartymocks.Manager)
-	mmp.On("GetNetworkVersion").Return(1)
 	mmp.On("RootOrg").Return(multiparty.RootOrg{})
 
 	mdi := im.database.(*databasemocks.Plugin)
 	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "key12345").Return(nil, nil)
-	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, core.LegacySystemNamespace, "key12345").Return(nil, nil)
 
 	err := im.resolveDefaultSigningIdentity(ctx, &core.SignerRef{})
 	assert.Regexp(t, "FF10281", err)
@@ -635,52 +626,6 @@ func TestResolveDefaultSigningIdentityNotFound(t *testing.T) {
 
 }
 
-func TestResolveDefaultSigningIdentitySystemFallback(t *testing.T) {
-
-	ctx, im := newTestIdentityManager(t)
-	im.multipartyRootVerifier = &core.VerifierRef{
-		Type:  core.VerifierTypeEthAddress,
-		Value: "key12345",
-	}
-
-	id := &core.Identity{
-		IdentityBase: core.IdentityBase{
-			ID:        fftypes.NewUUID(),
-			DID:       "did:firefly:org/org1",
-			Namespace: "ns1",
-			Name:      "org1",
-			Type:      core.IdentityTypeOrg,
-		},
-	}
-	verifier := &core.Verifier{
-		Identity: id.ID,
-		VerifierRef: core.VerifierRef{
-			Value: "key12345",
-		},
-	}
-
-	mbi := im.blockchain.(*blockchainmocks.Plugin)
-	mmp := im.multiparty.(*multipartymocks.Manager)
-	mmp.On("GetNetworkVersion").Return(1)
-	mmp.On("RootOrg").Return(multiparty.RootOrg{Name: "org1"})
-
-	mdi := im.database.(*databasemocks.Plugin)
-	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, "ns1", "key12345").Return(nil, nil)
-	mdi.On("GetVerifierByValue", ctx, core.VerifierTypeEthAddress, core.LegacySystemNamespace, "key12345").Return(verifier, nil)
-	mdi.On("GetIdentityByID", ctx, core.LegacySystemNamespace, id.ID).Return(id, nil)
-
-	ref := &core.SignerRef{}
-	err := im.resolveDefaultSigningIdentity(ctx, ref)
-	assert.NoError(t, err)
-	assert.Equal(t, "did:firefly:org/org1", ref.Author)
-	assert.Equal(t, "key12345", ref.Key)
-
-	mbi.AssertExpectations(t)
-	mdi.AssertExpectations(t)
-	mmp.AssertExpectations(t)
-
-}
-
 func TestGetMultipartyRootVerifierResolveFailed(t *testing.T) {
 
 	ctx, im := newTestIdentityManager(t)