From 8a127e247a3247d8faa0b088ca902233f4e1e707 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 23 May 2024 22:19:38 -0400 Subject: [PATCH] Use full capability versioning in workflow yaml --- core/services/workflows/delegate_test.go | 8 +-- core/services/workflows/engine_test.go | 36 ++++++------ .../workflows/execution_strategy_test.go | 2 +- core/services/workflows/models_test.go | 58 +++++++++---------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/core/services/workflows/delegate_test.go b/core/services/workflows/delegate_test.go index 1a99400af68..e50d9c5f689 100644 --- a/core/services/workflows/delegate_test.go +++ b/core/services/workflows/delegate_test.go @@ -75,7 +75,7 @@ targets: [] owner := "00000000000000000000000000000000000000aa" workflow := ` triggers: - - id: "mercury-trigger@1" + - id: "mercury-trigger@1.0.0" config: feedIds: - "0x1111111111111111111100000000000000000000000000000000000000000000" @@ -83,7 +83,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" consensus: - - id: "offchain_reporting@2" + - id: "offchain_reporting@2.0.0" ref: "evm_median" inputs: observations: @@ -105,14 +105,14 @@ consensus: abi: "mercury_reports bytes[]" targets: - - id: "write_polygon-testnet-mumbai@3" + - id: "write_polygon-testnet-mumbai@3.0.0" inputs: report: "$(evm_median.outputs.report)" config: address: "0x3F3554832c636721F1fD1822Ccca0354576741Ef" params: ["$(report)"] abi: "receive(report bytes)" - - id: "write_ethereum-testnet-sepolia@4" + - id: "write_ethereum-testnet-sepolia@4.0.0" inputs: report: "$(evm_median.outputs.report)" config: diff --git a/core/services/workflows/engine_test.go b/core/services/workflows/engine_test.go index 5d78c83b09c..c350c02e6c6 100644 --- a/core/services/workflows/engine_test.go +++ b/core/services/workflows/engine_test.go @@ -24,7 +24,7 @@ import ( const hardcodedWorkflow = ` triggers: - - id: "mercury-trigger@1" + - id: "mercury-trigger@1.0.0" config: feedIds: - "0x1111111111111111111100000000000000000000000000000000000000000000" @@ -32,7 +32,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" consensus: - - id: "offchain_reporting@1" + - id: "offchain_reporting@1.0.0" ref: "evm_median" inputs: observations: @@ -54,14 +54,14 @@ consensus: abi: "mercury_reports bytes[]" targets: - - id: "write_polygon-testnet-mumbai@1" + - id: "write_polygon-testnet-mumbai@1.0.0" inputs: report: "$(evm_median.outputs.report)" config: address: "0x3F3554832c636721F1fD1822Ccca0354576741Ef" params: ["$(report)"] abi: "receive(report bytes)" - - id: "write_ethereum-testnet-sepolia@1" + - id: "write_ethereum-testnet-sepolia@1.0.0" inputs: report: "$(evm_median.outputs.report)" config: @@ -208,7 +208,7 @@ func TestEngineWithHardcodedWorkflow(t *testing.T) { target2 := newMockCapability( capabilities.MustNewCapabilityInfo( - "write_ethereum-testnet-sepolia@1", + "write_ethereum-testnet-sepolia@1.0.0", capabilities.CapabilityTypeTarget, "a write capability targeting ethereum sepolia testnet", nil, @@ -248,7 +248,7 @@ func TestEngineWithHardcodedWorkflow(t *testing.T) { const ( simpleWorkflow = ` triggers: - - id: "mercury-trigger@1" + - id: "mercury-trigger@1.0.0" config: feedlist: - "0x1111111111111111111100000000000000000000000000000000000000000000" # ETHUSD @@ -256,7 +256,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" # BTCUSD consensus: - - id: "offchain_reporting@1" + - id: "offchain_reporting@1.0.0" ref: "evm_median" inputs: observations: @@ -278,7 +278,7 @@ consensus: abi: "mercury_reports bytes[]" targets: - - id: "write_polygon-testnet-mumbai@1" + - id: "write_polygon-testnet-mumbai@1.0.0" inputs: report: "$(evm_median.outputs.report)" config: @@ -291,7 +291,7 @@ targets: func mockTrigger(t *testing.T) (capabilities.TriggerCapability, capabilities.CapabilityResponse) { mt := &mockTriggerCapability{ CapabilityInfo: capabilities.MustNewCapabilityInfo( - "mercury-trigger@1", + "mercury-trigger@1.0.0", capabilities.CapabilityTypeTrigger, "issues a trigger when a mercury report is received.", nil, @@ -314,7 +314,7 @@ func mockTrigger(t *testing.T) (capabilities.TriggerCapability, capabilities.Cap func mockNoopTrigger(t *testing.T) capabilities.TriggerCapability { mt := &mockTriggerCapability{ CapabilityInfo: capabilities.MustNewCapabilityInfo( - "mercury-trigger@1", + "mercury-trigger@1.0.0", capabilities.CapabilityTypeTrigger, "issues a trigger when a mercury report is received.", nil, @@ -327,7 +327,7 @@ func mockNoopTrigger(t *testing.T) capabilities.TriggerCapability { func mockFailingConsensus() *mockCapability { return newMockCapability( capabilities.MustNewCapabilityInfo( - "offchain_reporting@1", + "offchain_reporting@1.0.0", capabilities.CapabilityTypeConsensus, "an ocr3 consensus capability", nil, @@ -341,7 +341,7 @@ func mockFailingConsensus() *mockCapability { func mockConsensus() *mockCapability { return newMockCapability( capabilities.MustNewCapabilityInfo( - "offchain_reporting@1", + "offchain_reporting@1.0.0", capabilities.CapabilityTypeConsensus, "an ocr3 consensus capability", nil, @@ -367,7 +367,7 @@ func mockConsensus() *mockCapability { func mockTarget() *mockCapability { return newMockCapability( capabilities.MustNewCapabilityInfo( - "write_polygon-testnet-mumbai@1", + "write_polygon-testnet-mumbai@1.0.0", capabilities.CapabilityTypeTarget, "a write capability targeting polygon mumbai testnet", nil, @@ -410,7 +410,7 @@ func TestEngine_ErrorsTheWorkflowIfAStepErrors(t *testing.T) { const ( multiStepWorkflow = ` triggers: - - id: "mercury-trigger@1" + - id: "mercury-trigger@1.0.0" config: feedlist: - "0x1111111111111111111100000000000000000000000000000000000000000000" # ETHUSD @@ -418,7 +418,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" # BTCUSD actions: - - id: "read_chain_action@1" + - id: "read_chain_action@1.0.0" ref: "read_chain_action" config: {} inputs: @@ -426,7 +426,7 @@ actions: - "$(trigger.outputs)" consensus: - - id: "offchain_reporting@1" + - id: "offchain_reporting@1.0.0" ref: "evm_median" inputs: observations: @@ -449,7 +449,7 @@ consensus: abi: "mercury_reports bytes[]" targets: - - id: "write_polygon-testnet-mumbai@1" + - id: "write_polygon-testnet-mumbai@1.0.0" inputs: report: "$(evm_median.outputs.report)" config: @@ -463,7 +463,7 @@ func mockAction() (*mockCapability, values.Value) { outputs := values.NewString("output") return newMockCapability( capabilities.MustNewCapabilityInfo( - "read_chain_action@1", + "read_chain_action@1.0.0", capabilities.CapabilityTypeAction, "a read chain action", nil, diff --git a/core/services/workflows/execution_strategy_test.go b/core/services/workflows/execution_strategy_test.go index 7409a1bc430..f73a358479a 100644 --- a/core/services/workflows/execution_strategy_test.go +++ b/core/services/workflows/execution_strategy_test.go @@ -30,7 +30,7 @@ func TestScheduledExecutionStrategy_LocalDON(t *testing.T) { // schedule. mt := newMockCapability( capabilities.MustNewCapabilityInfo( - "write_polygon-testnet-mumbai@1", + "write_polygon-testnet-mumbai@1.0.0", capabilities.CapabilityTypeTarget, "a write capability targeting polygon mumbai testnet", nil, diff --git a/core/services/workflows/models_test.go b/core/services/workflows/models_test.go index 5ec3e8c1fa9..c5e9be32e82 100644 --- a/core/services/workflows/models_test.go +++ b/core/services/workflows/models_test.go @@ -21,18 +21,18 @@ func TestParse_Graph(t *testing.T) { name: "basic example", yaml: ` triggers: - - id: "a-trigger@1" + - id: "a-trigger@1.0.0" config: {} actions: - - id: "an-action@1" + - id: "an-action@1.0.0" config: {} ref: "an-action" inputs: trigger_output: $(trigger.outputs) consensus: - - id: "a-consensus@1" + - id: "a-consensus@1.0.0" config: {} ref: "a-consensus" inputs: @@ -40,7 +40,7 @@ consensus: an-action_output: $(an-action.outputs) targets: - - id: "a-target@1" + - id: "a-target@1.0.0" config: {} ref: "a-target" inputs: @@ -64,24 +64,24 @@ targets: name: "circular relationship", yaml: ` triggers: - - id: "a-trigger@1" + - id: "a-trigger@1.0.0" config: {} actions: - - id: "an-action@1" + - id: "an-action@1.0.0" config: {} ref: "an-action" inputs: trigger_output: $(trigger.outputs) output: $(a-second-action.outputs) - - id: "a-second-action@1" + - id: "a-second-action@1.0.0" config: {} ref: "a-second-action" inputs: output: $(an-action.outputs) consensus: - - id: "a-consensus@1" + - id: "a-consensus@1.0.0" config: {} ref: "a-consensus" inputs: @@ -89,7 +89,7 @@ consensus: an-action_output: $(an-action.outputs) targets: - - id: "a-target@1" + - id: "a-target@1.0.0" config: {} ref: "a-target" inputs: @@ -101,29 +101,29 @@ targets: name: "indirect circular relationship", yaml: ` triggers: - - id: "a-trigger@1" + - id: "a-trigger@1.0.0" config: {} actions: - - id: "an-action@1" + - id: "an-action@1.0.0" config: {} ref: "an-action" inputs: trigger_output: $(trigger.outputs) action_output: $(a-third-action.outputs) - - id: "a-second-action@1" + - id: "a-second-action@1.0.0" config: {} ref: "a-second-action" inputs: output: $(an-action.outputs) - - id: "a-third-action@1" + - id: "a-third-action@1.0.0" config: {} ref: "a-third-action" inputs: output: $(a-second-action.outputs) consensus: - - id: "a-consensus@1" + - id: "a-consensus@1.0.0" config: {} ref: "a-consensus" inputs: @@ -131,7 +131,7 @@ consensus: an-action_output: $(an-action.outputs) targets: - - id: "a-target@1" + - id: "a-target@1.0.0" config: {} ref: "a-target" inputs: @@ -143,11 +143,11 @@ targets: name: "relationship doesn't exist", yaml: ` triggers: - - id: "a-trigger@1" + - id: "a-trigger@1.0.0" config: {} actions: - - id: "an-action@1" + - id: "an-action@1.0.0" config: {} ref: "an-action" inputs: @@ -155,14 +155,14 @@ actions: action_output: $(missing-action.outputs) consensus: - - id: "a-consensus@1" + - id: "a-consensus@1.0.0" config: {} ref: "a-consensus" inputs: an-action_output: $(an-action.outputs) targets: - - id: "a-target@1" + - id: "a-target@1.0.0" config: {} ref: "a-target" inputs: @@ -174,27 +174,27 @@ targets: name: "two trigger nodes", yaml: ` triggers: - - id: "a-trigger@1" + - id: "a-trigger@1.0.0" config: {} - - id: "a-second-trigger@1" + - id: "a-second-trigger@1.0.0" config: {} actions: - - id: "an-action@1" + - id: "an-action@1.0.0" config: {} ref: "an-action" inputs: trigger_output: $(trigger.outputs) consensus: - - id: "a-consensus@1" + - id: "a-consensus@1.0.0" config: {} ref: "a-consensus" inputs: an-action_output: $(an-action.outputs) targets: - - id: "a-target@1" + - id: "a-target@1.0.0" config: {} ref: "a-target" inputs: @@ -217,25 +217,25 @@ targets: name: "non-trigger step with no dependent refs", yaml: ` triggers: - - id: "a-trigger@1" + - id: "a-trigger@1.0.0" config: {} - - id: "a-second-trigger@1" + - id: "a-second-trigger@1.0.0" config: {} actions: - - id: "an-action@1" + - id: "an-action@1.0.0" config: {} ref: "an-action" inputs: hello: "world" consensus: - - id: "a-consensus@1" + - id: "a-consensus@1.0.0" config: {} ref: "a-consensus" inputs: trigger_output: $(trigger.outputs) action_output: $(an-action.outputs) targets: - - id: "a-target@1" + - id: "a-target@1.0.0" config: {} ref: "a-target" inputs: