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

Cappl 3 ph #15125

Closed
wants to merge 68 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
dad2833
Trigger build with CRON & KVSTORE standard capability binaries
justinkaseman Oct 7, 2024
95dbcca
@chainlink.contracts release v1.3.0 (#14812)
chainchad Nov 5, 2024
8800b27
fix: arm64 builds with goreleaser 2.4.x (#15110)
erikburt Nov 5, 2024
70df806
CCIP-4105: adds OZ AccessControl support to the registry module (#15067)
RensR Nov 5, 2024
c3b5d37
Remove shallow checkout for changeset detection (#15113)
HenryNguyen5 Nov 5, 2024
9ac0d6b
removing dot seperator in path (#15120)
patrickhuie19 Nov 5, 2024
645858a
Add workflows
cedric-cordenier Nov 5, 2024
13474d1
Add workflows
cedric-cordenier Nov 5, 2024
cf987bf
Add missing workflows extra_files
cedric-cordenier Nov 5, 2024
5f7884a
Try optional copy tmp/workflows
justinkaseman Nov 5, 2024
96b0cfc
trigger build
justinkaseman Nov 5, 2024
0d7ff26
Create dummy registry
cedric-cordenier Nov 6, 2024
c8d7b2f
Update workflow
cedric-cordenier Nov 6, 2024
17680cf
give hardcoded workflow a name + id
justinkaseman Nov 6, 2024
fe4e07c
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 7, 2024
444ffa0
Bump common
cedric-cordenier Nov 7, 2024
399ed46
Correct logger
cedric-cordenier Nov 7, 2024
235d85b
Incorporate KeyId into workflow
cedric-cordenier Nov 7, 2024
a98566c
compress binary
cedric-cordenier Nov 7, 2024
a69ca05
GetUnfinished fix
cedric-cordenier Nov 7, 2024
3fc7c0d
feat: implement timeout
agparadiso Nov 7, 2024
8351987
Trivial fixes
cedric-cordenier Nov 8, 2024
9bcfd92
Update workflow
cedric-cordenier Nov 8, 2024
bdb71f5
WIP
cedric-cordenier Nov 4, 2024
9057057
WIP
cedric-cordenier Nov 4, 2024
f2913f4
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 10, 2024
372e7f5
Correct length for owner
cedric-cordenier Nov 11, 2024
3af0eaf
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 11, 2024
25958e3
Update common
cedric-cordenier Nov 11, 2024
a23cfa3
Update common
cedric-cordenier Nov 11, 2024
9210653
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 11, 2024
cd5d456
Update workflow
cedric-cordenier Nov 11, 2024
b7ad741
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 11, 2024
3b809eb
Update common
cedric-cordenier Nov 12, 2024
4f895fc
Update common
cedric-cordenier Nov 12, 2024
6881be9
Remove extra replace, with a more targeted one. (#15018)
cgruber Nov 11, 2024
8471920
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 12, 2024
b877917
Log out the WorkflowPublicKey
cedric-cordenier Nov 13, 2024
d7ae86c
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 13, 2024
79f982c
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 13, 2024
611cc4b
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 14, 2024
dcb9784
Bump common
cedric-cordenier Nov 14, 2024
195189f
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 15, 2024
2b3af8b
Bump common
cedric-cordenier Nov 15, 2024
510bfc0
Update workflow name
cedric-cordenier Nov 18, 2024
54faaf4
Add second workflow
cedric-cordenier Nov 20, 2024
58b51f9
Update registry to run two workflows; add updated workflows
cedric-cordenier Nov 20, 2024
30bb2f9
Update artifacts
cedric-cordenier Nov 20, 2024
0bcb61f
Merge branch 'develop' into CAPPL-3-ph
cedric-cordenier Nov 20, 2024
13034bd
Update go.sum
cedric-cordenier Nov 20, 2024
43ac99c
Update workflows
cedric-cordenier Nov 20, 2024
c5f0bf1
Update PoR workflow with timestamp adjustment
cedric-cordenier Nov 20, 2024
d65ddec
Update workflows
cedric-cordenier Nov 21, 2024
2c79077
merge develop
justinkaseman Nov 21, 2024
93b05ee
Revert "chore(workflows): stub out event handlers (#15313)"
justinkaseman Nov 21, 2024
1608708
Revert "feat(workflows): adds registry syncer (#15277)"
justinkaseman Nov 21, 2024
630193a
Update hardcoded wasm workflows
justinkaseman Nov 21, 2024
f5e6fe5
Update workflows
cedric-cordenier Nov 22, 2024
22c235a
One more update
cedric-cordenier Nov 22, 2024
cc98bbd
One more update
cedric-cordenier Nov 22, 2024
9214ffc
Update hardcoded workflow with CLI generated binary
justinkaseman Nov 26, 2024
7856854
Revert "feat(workflows/handler): adds all event handlers (#15400)"
justinkaseman Nov 27, 2024
2a691fe
Revert "feat(handler): implements handle workflow registered event (#…
justinkaseman Nov 27, 2024
4af21d5
Revert "feat(workflows): adds orm methods for managing specs (#15356)"
justinkaseman Nov 27, 2024
aafd7bd
Revert "chore(workflows): stub out event handlers (#15313)"
justinkaseman Nov 27, 2024
68401d8
Revert "feat(workflows): adds registry syncer (#15277)"
justinkaseman Nov 27, 2024
f8a7688
Merge branch 'develop' into CAPPL-3-ph
justinkaseman Nov 27, 2024
4da22ce
Revert "[CAPPL-316] implement FetchFunc (#15424)"
justinkaseman Nov 27, 2024
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
Prev Previous commit
Next Next commit
Revert "chore(workflows): stub out event handlers (#15313)"
This reverts commit 86ab654.
  • Loading branch information
justinkaseman committed Nov 21, 2024
commit 93b05ee8d9a87b3e66d9a521f6e030bde21d5f57
Original file line number Diff line number Diff line change
@@ -117,8 +117,6 @@ func Test_SecretsWorker(t *testing.T) {
contractReader,
fetcherFn,
wfRegistryAddr.Hex(),
nil,
nil,
syncer.WithTicker(giveTicker.C),
)

64 changes: 0 additions & 64 deletions core/services/workflows/syncer/engine_registry.go

This file was deleted.

141 changes: 6 additions & 135 deletions core/services/workflows/syncer/handler.go
Original file line number Diff line number Diff line change
@@ -3,170 +3,41 @@ package syncer
import (
"context"
"encoding/hex"
"errors"
"fmt"

"github.com/smartcontractkit/chainlink-common/pkg/types/core"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/workflows/store"
)

var ErrNotImplemented = errors.New("not implemented")

// WorkflowRegistryrEventType is the type of event that is emitted by the WorkflowRegistry
type WorkflowRegistryEventType string

var (
// ForceUpdateSecretsEvent is emitted when a request to force update a workflows secrets is made
ForceUpdateSecretsEvent WorkflowRegistryEventType = "WorkflowForceUpdateSecretsRequestedV1"

// WorkflowRegisteredEvent is emitted when a workflow is registered
WorkflowRegisteredEvent WorkflowRegistryEventType = "WorkflowRegisteredV1"

// WorkflowUpdatedEvent is emitted when a workflow is updated
WorkflowUpdatedEvent WorkflowRegistryEventType = "WorkflowUpdatedV1"

// WorkflowPausedEvent is emitted when a workflow is paused
WorkflowPausedEvent WorkflowRegistryEventType = "WorkflowPausedV1"

// WorkflowActivatedEvent is emitted when a workflow is activated
WorkflowActivatedEvent WorkflowRegistryEventType = "WorkflowActivatedV1"

// WorkflowDeletedEvent is emitted when a workflow is deleted
WorkflowDeletedEvent WorkflowRegistryEventType = "WorkflowDeletedV1"
)

// WorkflowRegistryForceUpdateSecretsRequestedV1 is a chain agnostic definition of the WorkflowRegistry
// ForceUpdateSecretsRequested event.
type WorkflowRegistryForceUpdateSecretsRequestedV1 struct {
SecretsURLHash []byte
Owner []byte
WorkflowName string
}

type WorkflowRegistryWorkflowRegisteredV1 struct {
WorkflowID [32]byte
WorkflowOwner []byte
DonID uint32
Status uint8
WorkflowName string
BinaryURL string
ConfigURL string
SecretsURL string
}

type WorkflowRegistryWorkflowUpdatedV1 struct {
OldWorkflowID [32]byte
WorkflowOwner []byte
DonID uint32
NewWorkflowID [32]byte
WorkflowName string
BinaryURL string
ConfigURL string
SecretsURL string
}

type WorkflowRegistryWorkflowPausedV1 struct {
WorkflowID [32]byte
WorkflowOwner []byte
DonID uint32
WorkflowName string
}

type WorkflowRegistryWorkflowActivatedV1 struct {
WorkflowID [32]byte
WorkflowOwner []byte
DonID uint32
WorkflowName string
}

type WorkflowRegistryWorkflowDeletedV1 struct {
WorkflowID [32]byte
WorkflowOwner []byte
DonID uint32
WorkflowName string
}

// eventHandler is a handler for WorkflowRegistryEvent events. Each event type has a corresponding
// method that handles the event.
type eventHandler struct {
lggr logger.Logger
orm WorkflowSecretsDS
fetcher FetcherFunc
workflowStore store.Store
capRegistry core.CapabilitiesRegistry
engineRegistry *engineRegistry
lggr logger.Logger
orm ORM
fetcher FetcherFunc
}

// newEventHandler returns a new eventHandler instance.
func newEventHandler(
lggr logger.Logger,
orm ORM,
gateway FetcherFunc,
workflowStore store.Store,
capRegistry core.CapabilitiesRegistry,
engineRegistry *engineRegistry,
) *eventHandler {
return &eventHandler{
lggr: lggr,
orm: orm,
fetcher: gateway,
workflowStore: workflowStore,
capRegistry: capRegistry,
engineRegistry: engineRegistry,
lggr: lggr,
orm: orm,
fetcher: gateway,
}
}

func (h *eventHandler) Handle(ctx context.Context, event WorkflowRegistryEvent) error {
switch event.EventType {
case ForceUpdateSecretsEvent:
return h.forceUpdateSecretsEvent(ctx, event)
case WorkflowRegisteredEvent:
return h.workflowRegisteredEvent(ctx, event)
case WorkflowUpdatedEvent:
return h.workflowUpdatedEvent(ctx, event)
case WorkflowPausedEvent:
return h.workflowPausedEvent(ctx, event)
case WorkflowActivatedEvent:
return h.workflowActivatedEvent(ctx, event)
default:
return fmt.Errorf("event type unsupported: %v", event.EventType)
}
}

// workflowRegisteredEvent handles the WorkflowRegisteredEvent event type.
// TODO: Implement this method
func (h *eventHandler) workflowRegisteredEvent(
_ context.Context,
_ WorkflowRegistryEvent,
) error {
return ErrNotImplemented
}

// workflowUpdatedEvent handles the WorkflowUpdatedEvent event type.
func (h *eventHandler) workflowUpdatedEvent(
_ context.Context,
_ WorkflowRegistryEvent,
) error {
return ErrNotImplemented
}

// workflowPausedEvent handles the WorkflowPausedEvent event type.
func (h *eventHandler) workflowPausedEvent(
_ context.Context,
_ WorkflowRegistryEvent,
) error {
return ErrNotImplemented
}

// workflowActivatedEvent handles the WorkflowActivatedEvent event type.
func (h *eventHandler) workflowActivatedEvent(
_ context.Context,
_ WorkflowRegistryEvent,
) error {
return ErrNotImplemented
}

// forceUpdateSecretsEvent handles the ForceUpdateSecretsEvent event type.
func (h *eventHandler) forceUpdateSecretsEvent(
ctx context.Context,
10 changes: 5 additions & 5 deletions core/services/workflows/syncer/handler_test.go
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ func Test_Handler(t *testing.T) {
}
mockORM.EXPECT().GetSecretsURLByHash(matches.AnyContext, giveHash).Return(giveURL, nil)
mockORM.EXPECT().Update(matches.AnyContext, giveHash, "contents").Return(int64(1), nil)
h := newEventHandler(lggr, mockORM, fetcher, nil, nil, nil)
h := newEventHandler(lggr, mockORM, fetcher)
err = h.Handle(ctx, giveEvent)
require.NoError(t, err)
})
@@ -52,7 +52,7 @@ func Test_Handler(t *testing.T) {
return []byte("contents"), nil
}

h := newEventHandler(lggr, mockORM, fetcher, nil, nil, nil)
h := newEventHandler(lggr, mockORM, fetcher)
err := h.Handle(ctx, giveEvent)
require.Error(t, err)
require.Contains(t, err.Error(), "event type unsupported")
@@ -61,7 +61,7 @@ func Test_Handler(t *testing.T) {
t.Run("fails to get secrets url", func(t *testing.T) {
mockORM := mocks.NewORM(t)
ctx := testutils.Context(t)
h := newEventHandler(lggr, mockORM, nil, nil, nil, nil)
h := newEventHandler(lggr, mockORM, nil)
giveURL := "https://original-url.com"
giveBytes, err := crypto.Keccak256([]byte(giveURL))
require.NoError(t, err)
@@ -101,7 +101,7 @@ func Test_Handler(t *testing.T) {
return nil, assert.AnError
}
mockORM.EXPECT().GetSecretsURLByHash(matches.AnyContext, giveHash).Return(giveURL, nil)
h := newEventHandler(lggr, mockORM, fetcher, nil, nil, nil)
h := newEventHandler(lggr, mockORM, fetcher)
err = h.Handle(ctx, giveEvent)
require.Error(t, err)
require.ErrorIs(t, err, assert.AnError)
@@ -128,7 +128,7 @@ func Test_Handler(t *testing.T) {
}
mockORM.EXPECT().GetSecretsURLByHash(matches.AnyContext, giveHash).Return(giveURL, nil)
mockORM.EXPECT().Update(matches.AnyContext, giveHash, "contents").Return(0, assert.AnError)
h := newEventHandler(lggr, mockORM, fetcher, nil, nil, nil)
h := newEventHandler(lggr, mockORM, fetcher)
err = h.Handle(ctx, giveEvent)
require.Error(t, err)
require.ErrorIs(t, err, assert.AnError)
58 changes: 0 additions & 58 deletions core/services/workflows/syncer/mocks/orm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading