Hyperledger Fabric - 身份 0 不满足主体:身份是不同 MSP 的成员

Hyperledger Fabric - identity 0 does not satisfy principal: The identity is a member of a different MSP

我正在尝试使用节点 sdk 更新 hyperledger fabric 中的现有通道。我只是想将批量大小从 10 增加到 11(可以在官方配置更新示例中找到)。我的配置更新如下所示:

{
  "channel_id": "mychannel",
  "read_set": {
    "groups": {
      "Orderer": {}
    }
  },
  "write_set": {
    "groups": {
      "Orderer": {
        "values": {
          "BatchSize": {
            "mod_policy": "Admins",
            "value": {
              "absolute_max_bytes": 102760448,
              "max_message_count": 11,
              "preferred_max_bytes": 524288
            },
            "version": "1"
          }
        }
      }
    }
  }
}

用户注册如下:

ORG1_TOKEN=$(curl -s -X POST \
  http://localhost:4000/users \
  -H "content-type: application/x-www-form-urlencoded" \
  -d 'username=jim&orgName=org1')

我 运行 在 Docker 容器上的网络,并使用所有图像和二进制文件的版本 1.0.2。

我创建了一个 update-channel.js 函数,与余额转移示例的 app 文件夹中的 create-channel.js 函数非常相似。我使用 configtxlator 将 json 更新转换为二进制文件:

superagent.post('http://127.0.0.1:7059/protolator/encode/common.ConfigUpdate',
            configFile)
            .buffer()
            .end((error, res) => {
                error ? reject(error) : resolve(res.body);
            });

当我签名并将更新的配置推送给订购者时,我收到以下错误消息:

0xc42011e558 identity 0 does not satisfy principal: The identity is a
   member of a different MSP (expected OrdererMSP, got Org1MSP)
principal evaluation fails 
... 
Rejecting CONFIG_UPDATE because: Error
   authorizing update: Error validating DeltaSet: Policy for [Values]
   /Channel/Orderer/BatchSize not satisfied: Failed to reach implicit
   threshold of 1 sub-policies, required 1 remaining

我可以想象这个问题与我为 Org1 注册了一个用户有关。我的解决方案是在 OrdererOrg 上注册一个用户(这甚至可能吗)?或者我需要更改我的配置更新 json?

我们找到了解决方案。您确实需要订购者组织管理员签名。我们将网络配置更改为还包含订购者的管理员和 mspid 信息,然后使用管理员对配置更新进行签名:

"orderer": {
            "mspid": "OrdererMSP",
            "url": "grpcs://orderer.example.com:7050",
            "server-hostname": "orderer.example.com",
            "tls_cacerts": "../artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt",
            "admin": {
                "key": "../artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore",
                "cert": "../artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts"
            }
        } 

然后签名对象包含订购者组织管理信息:

client.signChannelConfig(channelConfig);

这应该会导致频道更新成功。

这是为了更新订购者部分下的任何渠道配置项。如果涉及申请部分,则需要获取参与组织(通过其管理员)的签名并提交给订购者。