Skip to content

Commit

Permalink
temp fix to chainreader error when no workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ettec committed Dec 13, 2024
1 parent 8f1b956 commit 9b52367
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"
"time"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand All @@ -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)

Expand Down
8 changes: 6 additions & 2 deletions core/services/workflows/syncer/workflow_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"iter"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9b52367

Please sign in to comment.