Skip to content

Commit

Permalink
Use default mode aggregator for all non-streams triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
kidambisrinivas committed Oct 2, 2024
1 parent e724e5f commit f1156eb
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions core/capabilities/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (

"google.golang.org/protobuf/proto"

"github.com/smartcontractkit/chainlink-common/pkg/capabilities"
"github.com/smartcontractkit/chainlink-common/pkg/capabilities/triggers"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/values"

"github.com/smartcontractkit/libocr/ragep2p"
ragetypes "github.com/smartcontractkit/libocr/ragep2p/types"

"github.com/smartcontractkit/chainlink-common/pkg/capabilities"
capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
"github.com/smartcontractkit/chainlink-common/pkg/capabilities/triggers"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/values"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/target"
remotetypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types"
Expand Down Expand Up @@ -253,24 +252,25 @@ func (w *launcher) addRemoteCapabilities(ctx context.Context, myDON registrysync
switch capability.CapabilityType {
case capabilities.CapabilityTypeTrigger:
newTriggerFn := func(info capabilities.CapabilityInfo) (capabilityService, error) {
if !strings.HasPrefix(info.ID, "streams-trigger") {
return nil, errors.New("not supported: trigger capability does not have id = streams-trigger")
}

codec := streams.NewCodec(w.lggr)

signers, err := signersFor(remoteDON, state)
if err != nil {
return nil, err
var aggregator remotetypes.Aggregator
if strings.HasPrefix(info.ID, "streams-trigger") {
codec := streams.NewCodec(w.lggr)

signers, err := signersFor(remoteDON, state)
if err != nil {
return nil, err
}

aggregator = triggers.NewMercuryRemoteAggregator(
codec,
signers,
int(remoteDON.F+1),
w.lggr,
)
} else {
aggregator = remote.NewDefaultModeAggregator(2*uint32(remoteDON.F) + 1)
}

aggregator := triggers.NewMercuryRemoteAggregator(
codec,
signers,
int(remoteDON.F+1),
w.lggr,
)

// TODO: We need to implement a custom, Mercury-specific
// aggregator here, because there is no guarantee that
// all trigger events in the workflow will have the same
Expand Down

0 comments on commit f1156eb

Please sign in to comment.