Skip to content

Conversation

@shorsher
Copy link
Member

@shorsher shorsher commented Jun 15, 2022

Each namespace now has a unique firefly contract subscription

To support a subscription per namespace, the fireflyContract config section has been replaced with the contracts array section under the multiparty config.

Example:

blockchain:
- name: blockchain0
  type: ethereum
  ethereum:
    ethconnect:
      url: http://ethconnect_0:8080
      topic: "0"
      
namespaces:
  default: default
  predefined:
  - name: default
    remoteName: default
    description: Default predefined namespace
    plugins: [database0, blockchain0, dataexchange0, sharedstorage0, erc20_erc721]
    multiparty:
      enabled: true
      org:
        name: org0
        description: org0
        key: 0x123456
      contract:
        - location:
            address: 0x4ae50189462b0e5d52285f59929d037f790771a6 
          firstEvent: oldest
  • location is a yaml object containing blockchain plugin configuration
  • firstEvent is replacing fromBlock, supporting values of newest or oldest

This PR also introduces a new component, multiparty manager, that is responsible for managing the active firefly contract and interfacing with the blockchain plugin on behalf of that contract.

The subscription names will now also contain the name of the namespace it's associated with:

  • Ethereum: namespaceName_abiName_instanceUniqueHash
  • Fabric: namespaceName_event

@shorsher shorsher marked this pull request as draft June 15, 2022 21:00
@shorsher shorsher force-pushed the ns-event-streams branch 2 times, most recently from 59229b1 to ae731eb Compare June 20, 2022 03:20
@shorsher shorsher marked this pull request as ready for review June 20, 2022 03:20
@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2022

Codecov Report

Merging #865 (3d8ba8e) into main (7a340a9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 3d8ba8e differs from pull request most recent head 5341f8d. Consider uploading reports for the commit 5341f8d to get more accurate results

@@           Coverage Diff           @@
##             main     #865   +/-   ##
=======================================
  Coverage   99.96%   99.96%           
=======================================
  Files         299      300    +1     
  Lines       19481    19508   +27     
=======================================
+ Hits        19475    19502   +27     
  Misses          5        5           
  Partials        1        1           
Impacted Files Coverage Δ
internal/blockchain/ethereum/config.go 100.00% <ø> (ø)
internal/blockchain/fabric/config.go 100.00% <ø> (ø)
internal/coreconfig/coreconfig.go 100.00% <ø> (ø)
pkg/core/namespace.go 100.00% <ø> (ø)
internal/batchpin/batchpin.go 100.00% <100.00%> (ø)
internal/batchpin/operations.go 100.00% <100.00%> (ø)
internal/blockchain/ethereum/ethereum.go 100.00% <100.00%> (ø)
internal/blockchain/ethereum/eventstream.go 100.00% <100.00%> (ø)
internal/blockchain/fabric/eventstream.go 100.00% <100.00%> (ø)
internal/blockchain/fabric/fabric.go 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a340a9...5341f8d. Read the comment docs.

@shorsher
Copy link
Member Author

shorsher commented Jun 20, 2022

Note: I was not sure if I needed to make changes to the ContractManager to use the new MultipartyManager instead of directly interfacing with the blockchain plugin. @awrichar I know we spoke about this briefly, but since the contract manager deals with custom contracts I did not think it needs to be aware of the multiparty manager.

shorsher added 12 commits June 21, 2022 11:59
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Update the eth plugin tests to accomodate the changes for subscriptions
per namespace

Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
  - added tests for multiparty manager

Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
 - additional code comments in blockchain plugin implementations
 - updated config descriptions

Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
We've settled on a predictable structure for `Info`, so putting these
fields in a well-defined struct.

Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
@shorsher shorsher changed the title Create firefly subscription per namespace Create firefly contract subscription per namespace Jun 21, 2022
 - added handling for all existing subscription names
 - added improved logging to inform users to upgrade subscriptions
 - added namespaced subscription names to fabric

Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
Signed-off-by: Alex Shorsher <alex.shorsher@kaleido.io>
@awrichar awrichar merged commit 2d0dbb9 into hyperledger:main Jun 22, 2022
@awrichar awrichar deleted the ns-event-streams branch June 22, 2022 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants