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

Log Event Trigger Capability Development: Part 3 #14637

Merged
merged 6 commits into from
Oct 9, 2024
Merged
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
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)
kidambisrinivas marked this conversation as resolved.
Show resolved Hide resolved
}

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
Loading