From 9b523678e7ca7dce8a04a06869ae2d33f2cc1038 Mon Sep 17 00:00:00 2001 From: Matthew Pendrey Date: Fri, 13 Dec 2024 10:45:28 +0000 Subject: [PATCH] temp fix to chainreader error when no workflows --- .../remote/executable/request/client_request_test.go | 8 ++++++++ core/services/workflows/syncer/workflow_registry.go | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/capabilities/remote/executable/request/client_request_test.go b/core/capabilities/remote/executable/request/client_request_test.go index c46fd1363a0..3c843cf038b 100644 --- a/core/capabilities/remote/executable/request/client_request_test.go +++ b/core/capabilities/remote/executable/request/client_request_test.go @@ -6,6 +6,7 @@ import ( "testing" "time" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -25,6 +26,13 @@ const ( workflowExecutionID1 = "95ef5e32deb99a10ee6804bc4af13855687559d7ff6552ac6dbb2ce0abbadeed" ) +func Test_Hex(t *testing.T) { + b := []byte{} + + strResult := hexutil.Encode(b) + assert.Equal(t, "", strResult) +} + func Test_ClientRequest_MessageValidation(t *testing.T) { lggr := logger.TestLogger(t) diff --git a/core/services/workflows/syncer/workflow_registry.go b/core/services/workflows/syncer/workflow_registry.go index 223fbe8e758..fbbaa2e6207 100644 --- a/core/services/workflows/syncer/workflow_registry.go +++ b/core/services/workflows/syncer/workflow_registry.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "iter" + "strings" "sync" "time" @@ -222,8 +223,11 @@ func (w *workflowRegistry) Start(_ context.Context) error { w.lggr.Debugw("Loading initial workflows for DON", "DON", don.ID) loadWorkflowsHead, err := w.initialWorkflowsStateLoader.LoadWorkflows(ctx, don) if err != nil { - w.lggr.Errorw("failed to load workflows", "err", err) - return + // TODO - this is a temporary fix to handle the case where the contract is empty, to track: https://smartcontract-it.atlassian.net/browse/CAPPL-393 + if !strings.Contains(err.Error(), "attempting to unmarshal an empty string while arguments are expected") { + w.lggr.Errorw("failed to load workflows", "err", err) + return + } } reader, err := w.getContractReader(ctx)