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

Custom subconfigurations for a tree #155

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Custom subconfigurations for a tree #155

wants to merge 7 commits into from

Conversation

meling
Copy link
Member

@meling meling commented Dec 31, 2021

  • Added Configuration.Contains(nodeID)
  • Changed WithNodeIDs(ids []uint32) to ids ...uint32
  • Custom subconfigurations for a tree

This makes it easier to use with single entry node IDs.
This implements methods for constructing subconfigurations.
The example implementation provided herein is for a binary tree
that can be used for signature aggregation such as Handle.
This makes it easier to use with single entry node IDs.
This implements methods for constructing subconfigurations.
The example implementation provided herein is for a binary tree
that can be used for signature aggregation such as Handle.
@johningve
Copy link
Member

Looking at the SubConfigurations function, the mgr parameter could easily be replaced by an interface returning the raw manager instead of passing the raw manager directly:

// AsRawManager provides access to the underlying RawManager of a generated Manager.
type AsRawManager interface {
	// AsRaw returns a pointer to the underlying RawManager.
	AsRaw() *RawManager
}
 // Derive subconfigurations from the manager's base configuration.
-func SubConfigurations(mgr *RawManager, opt SubConfigOption) ([]RawConfiguration, error) {
+func SubConfigurations(mgr AsRawManager, opt SubConfigOption) ([]RawConfiguration, error) {
        if opt == nil {
                return nil, ConfigCreationError(fmt.Errorf("missing required subconfiguration option"))
        }
-       return opt.subConfig(mgr)
+       return opt.subConfig(mgr.AsRaw())
 }

This makes it possible to pass a generated manager as the argument to the function, but then there is the problem of converting the raw configurations returned by the function back into generated configurations. Do you have any ideas on how to make this work?

@johningve
Copy link
Member

Of course, one solution is to move this function into the generated code, but that would necessitate changes to the SubConfigOption interface and further increase the number of APIs exposed by gorums that are not intended to be used outside of generated code.

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.

2 participants