Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable non-multiparty namespaces #878

Merged
merged 27 commits into from
Jul 6, 2022
Merged

Conversation

awrichar
Copy link
Contributor

@awrichar awrichar commented Jun 23, 2022

Part of FIR-12.

  • Selectively disable managers and routes depending on the features available in a given namespace.
  • Move methods that create definitions into the definitions package (so it now has the definition "senders" alongside the definition "handlers"). When multiparty is disabled, the senders call directly to the matched handlers without an intermediate broadcast message.

Potential migration-breaking change: the deprecated dataexchange.type key no longer has a default of ffdx. Older config files that omitted this key will fail to parse. See #882.

@codecov-commenter
Copy link

codecov-commenter commented Jun 23, 2022

Codecov Report

Merging #878 (784a4db) into main (52e7744) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #878      +/-   ##
==========================================
+ Coverage   99.96%   99.97%   +0.01%     
==========================================
  Files         299      302       +3     
  Lines       19500    19650     +150     
==========================================
+ Hits        19494    19646     +152     
+ Misses          5        4       -1     
+ Partials        1        0       -1     
Impacted Files Coverage Δ
internal/apiserver/routes.go 100.00% <ø> (ø)
internal/broadcast/manager.go 100.00% <ø> (ø)
internal/coreconfig/coreconfig.go 100.00% <ø> (ø)
internal/events/event_dispatcher.go 100.00% <ø> (ø)
internal/orchestrator/bound_callbacks.go 100.00% <ø> (ø)
internal/privatemessaging/privatemessaging.go 100.00% <ø> (ø)
internal/shareddownload/download_manager.go 100.00% <ø> (ø)
internal/apiserver/route_get_data_blob.go 100.00% <100.00%> (ø)
internal/apiserver/route_get_group_by_id.go 100.00% <100.00%> (ø)
internal/apiserver/route_get_groups.go 100.00% <100.00%> (ø)
... and 51 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 52e7744...784a4db. Read the comment docs.

@awrichar awrichar force-pushed the definitions2 branch 4 times, most recently from f988a66 to 1322d87 Compare June 24, 2022 20:53
@awrichar awrichar changed the title Enable gateway-mode namespaces Enable "gateway-mode" namespaces Jun 27, 2022
… Sender

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
If multiparty mode is disabled for a given namespace, do not initialize the
multipary manager or any of the messaging managers.

Adjust other components and routes to deal with these managers potentially
being nil.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Due to spf13/viper#1386, array keys with mixed
case are not parsed correctly. At least for the time being, mitigate
by changing some keys to all lowercase.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
To align with other components, Definition Sender is the entry point for initiating
the creation of contract FFIs/APIs, but it calls out to Contract Manager for
validation.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
No need to create a message in this case.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Avoid starting plugins more than once.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
@awrichar awrichar marked this pull request as ready for review June 28, 2022 19:15
@awrichar awrichar requested a review from shorsher as a code owner June 28, 2022 19:15
@awrichar awrichar changed the title Enable "gateway-mode" namespaces Enable non-multiparty namespaces Jun 28, 2022
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Copy link
Member

@shorsher shorsher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, thank you!

@@ -44,7 +44,7 @@ func InitConfig(config config.ArraySection) {
}

func InitConfigDeprecated(config config.Section) {
config.AddKnownKey(coreconfig.PluginConfigType, NewFFDXPluginName)
config.AddKnownKey(coreconfig.PluginConfigType)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making a note we might want to log or track somewhere that there is no longer a default. Migration guide 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I tagged this PR with "migration consideration" in the hopes that one of us remembers why. Thankfully the CLI has explicitly populated "type" for a while (since hyperledger/firefly-cli#156). However, we will want to cut a 1.0.x patch release that includes #882, and recommend upgrading to that and fixing all config warnings as part of the migration journey to 1.1.

@@ -700,7 +730,7 @@ func (nm *namespaceManager) loadNamespace(ctx context.Context, name string, inde
config.Multiparty.Contracts = contracts
p, err = nm.validateMultiPartyConfig(ctx, name, plugins)
} else {
p, err = nm.validateGatewayConfig(ctx, name, plugins)
p, err = nm.validateNonMultipartyConfig(ctx, name, plugins)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Farewell gateway 👋🏻

@awrichar awrichar merged commit 3b19da1 into hyperledger:main Jul 6, 2022
@awrichar awrichar deleted the definitions2 branch July 6, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants