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

feat(keystone): add capabilities and add nops as mcms proposals #15887

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions deployment/keystone/changeset/internal/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,14 @@ type RegisterCapabilitiesRequest struct {
Env *deployment.Environment
RegistryChainSelector uint64
DonToCapabilities map[string][]capabilities_registry.CapabilitiesRegistryCapability

// if UseMCMS is true, a batch proposal is returned and no transaction is confirmed on chain.
UseMCMS bool
}

type RegisterCapabilitiesResponse struct {
DonToCapabilities map[string][]RegisteredCapability
Ops *timelock.BatchChainOperation
}

type RegisteredCapability struct {
Expand Down Expand Up @@ -492,22 +496,27 @@ func RegisterCapabilities(lggr logger.Logger, req RegisterCapabilitiesRequest) (
lggr.Warn("no new capabilities to register")
return &RegisterCapabilitiesResponse{}, nil
}
// not using mcms; ignore proposals
_, err = AddCapabilities(lggr, &contracts, registryChain, capabilities, false)

ops, err := AddCapabilities(lggr, &contracts, registryChain, capabilities, req.UseMCMS)
MStreet3 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return nil, fmt.Errorf("failed to add capabilities: %w", err)
}

resp.Ops = ops

return resp, nil
}

type RegisterNOPSRequest struct {
Env *deployment.Environment
RegistryChainSelector uint64
Nops []capabilities_registry.CapabilitiesRegistryNodeOperator
UseMCMS bool
}

type RegisterNOPSResponse struct {
Nops []*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded
Ops *timelock.BatchChainOperation
}

func RegisterNOPS(ctx context.Context, lggr logger.Logger, req RegisterNOPSRequest) (*RegisterNOPSResponse, error) {
Expand Down Expand Up @@ -550,6 +559,22 @@ func RegisterNOPS(ctx context.Context, lggr logger.Logger, req RegisterNOPSReque
err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)
return nil, fmt.Errorf("failed to call AddNodeOperators: %w", err)
}

if req.UseMCMS {
MStreet3 marked this conversation as resolved.
Show resolved Hide resolved
resp.Ops = &timelock.BatchChainOperation{
ChainIdentifier: mcms.ChainIdentifier(registryChain.Selector),
Batch: []mcms.Operation{
{
To: registry.Address(),
Data: tx.Data(),
Value: big.NewInt(0),
},
},
}

return resp, nil
}

// for some reason that i don't understand, the confirm must be called before the WaitMined or the latter will hang
// (at least for a simulated backend chain)
_, err = registryChain.Confirm(tx)
Expand Down
Loading