Skip to content

Commit

Permalink
Takes proto object instead of bytes on `FromCapabilitiesRegistryCapab…
Browse files Browse the repository at this point in the history
…ility`
  • Loading branch information
vyzaldysanchez committed Jan 10, 2025
1 parent c74668e commit 66ec891
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions deployment/keystone/changeset/internal/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ type RegisteredCapability struct {
Config []byte
}

func FromCapabilitiesRegistryCapability(capReg *capabilities_registry.CapabilitiesRegistryCapability, e deployment.Environment, registryChainSelector uint64, cfg []byte) (*RegisteredCapability, error) {
func FromCapabilitiesRegistryCapability(capReg *capabilities_registry.CapabilitiesRegistryCapability, cfg *capabilitiespb.CapabilityConfig, e deployment.Environment, registryChainSelector uint64) (*RegisteredCapability, error) {
registry, _, err := GetRegistryContract(&e, registryChainSelector)
if err != nil {
return nil, fmt.Errorf("failed to get registry: %w", err)
Expand All @@ -435,10 +435,17 @@ func FromCapabilitiesRegistryCapability(capReg *capabilities_registry.Capabiliti
if err != nil {
return nil, fmt.Errorf("failed to call GetHashedCapabilityId for capability %v: %w", capReg, err)
}
if cfg == nil {
return nil, fmt.Errorf("config is required for capability %v", capReg)
}
cfgB, err := proto.Marshal(cfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal config for capability %v: %w", capReg, err)
}
return &RegisteredCapability{
CapabilitiesRegistryCapability: *capReg,
ID: id,
Config: cfg,
Config: cfgB,
}, nil
}

Expand Down

0 comments on commit 66ec891

Please sign in to comment.