Skip to content

Commit

Permalink
Small fixes (#13926)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier authored Jul 25, 2024
1 parent 3ecb954 commit e7552f8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ func peerToNode(nopID uint32, p peer) (kcr.CapabilitiesRegistryNodeParams, error
}, nil
}

func newCapabilityConfig() *capabilitiespb.CapabilityConfig {
return &capabilitiespb.CapabilityConfig{
DefaultConfig: values.Proto(values.EmptyMap()).GetMapValue(),
}
}

// Run expects the following environment variables to be set:
//
// 1. Deploys the CapabilitiesRegistry contract
Expand Down Expand Up @@ -312,9 +318,16 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) {
panic(err)
}

cc := newCapabilityConfig()
ccb, err := proto.Marshal(cc)
if err != nil {
panic(err)
}

cfgs := []kcr.CapabilitiesRegistryCapabilityConfiguration{
{
CapabilityId: ocrid,
Config: ccb,
},
}
_, err = reg.AddDON(env.Owner, ps, cfgs, true, true, 2)
Expand Down Expand Up @@ -360,9 +373,16 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) {
panic(err)
}

cc = newCapabilityConfig()
ccb, err = proto.Marshal(cc)
if err != nil {
panic(err)
}

cfgs = []kcr.CapabilitiesRegistryCapabilityConfiguration{
{
CapabilityId: wid,
Config: ccb,
},
}
_, err = reg.AddDON(env.Owner, ps, cfgs, true, false, 1)
Expand Down
14 changes: 8 additions & 6 deletions core/services/registrysyncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func newReader(ctx context.Context, lggr logger.Logger, relayer contractReaderFa
}

func (s *registrySyncer) Start(ctx context.Context) error {
return s.StartOnce("testAsyncMessageBroker", func() error {
return s.StartOnce("RegistrySyncer", func() error {
s.wg.Add(1)
go func() {
defer s.wg.Done()
Expand Down Expand Up @@ -304,10 +304,12 @@ func toDONInfo(don kcr.CapabilitiesRegistryDONInfo) *capabilities.DON {
}

return &capabilities.DON{
ID: don.Id,
ConfigVersion: don.ConfigCount,
Members: peerIDs,
F: don.F,
ID: don.Id,
ConfigVersion: don.ConfigCount,
Members: peerIDs,
F: don.F,
IsPublic: don.IsPublic,
AcceptsWorkflows: don.AcceptsWorkflows,
}
}

Expand All @@ -318,7 +320,7 @@ func (s *registrySyncer) AddLauncher(launchers ...Launcher) {
}

func (s *registrySyncer) Close() error {
return s.StopOnce("testAsyncMessageBroker", func() error {
return s.StopOnce("RegistrySyncer", func() error {
close(s.stopCh)
s.wg.Wait()
return nil
Expand Down
4 changes: 2 additions & 2 deletions core/services/registrysyncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ func TestReader_Integration(t *testing.T) {
DON: capabilities.DON{
ID: 1,
ConfigVersion: 1,
IsPublic: false,
AcceptsWorkflows: false,
IsPublic: true,
AcceptsWorkflows: true,
F: 1,
Members: toPeerIDs(nodeSet),
},
Expand Down

0 comments on commit e7552f8

Please sign in to comment.