From 6cfff8e5164331081d8d9e82468c56ae3a3e0904 Mon Sep 17 00:00:00 2001 From: Gabriel Paradiso Date: Wed, 8 Jan 2025 13:28:19 +0100 Subject: [PATCH] chore: moved this to chainlink repo --- pkg/workflows/utils.go | 13 ------------- pkg/workflows/utils_test.go | 27 --------------------------- 2 files changed, 40 deletions(-) diff --git a/pkg/workflows/utils.go b/pkg/workflows/utils.go index 91eaaa42e..2d6816c75 100644 --- a/pkg/workflows/utils.go +++ b/pkg/workflows/utils.go @@ -4,8 +4,6 @@ import ( "crypto/sha256" "encoding/hex" "strings" - - "github.com/smartcontractkit/chainlink-common/pkg/logger" ) func EncodeExecutionID(workflowID, eventID string) (string, error) { @@ -86,14 +84,3 @@ func HashTruncateName(name string) [10]byte { return result } - -// HexDecodeWorkflowName makes the best effort to decode the hex workflow name. -// In case of failure it will log the error and return the input name. -func HexDecodeWorkflowName(encoded string, logger logger.Logger) string { - decoded, err := hex.DecodeString(encoded) - if err != nil { - logger.Errorf("failed to decode WorkflowName %q: %v", encoded, err) - return encoded - } - return string(decoded) -} diff --git a/pkg/workflows/utils_test.go b/pkg/workflows/utils_test.go index 7d7ebdf67..ae506a7df 100644 --- a/pkg/workflows/utils_test.go +++ b/pkg/workflows/utils_test.go @@ -5,7 +5,6 @@ import ( "encoding/hex" "testing" - "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -100,29 +99,3 @@ func TestNormalizeWorkflowName(t *testing.T) { }) } } - -func TestHexDecodeWorkflowName(t *testing.T) { - tt := []struct { - name string - input string - expected string - }{ - { - name: "OK-correct_workflow_name", - input: "776f726b666c6f772d6e616d65", - expected: "workflow-name", - }, - { - name: "NOK-incorrect_workflow_name", - input: "776f726b666c6f772d6e616d65!", - expected: "776f726b666c6f772d6e616d65!", - }, - } - - for _, tc := range tt { - t.Run(tc.name, func(t *testing.T) { - result := HexDecodeWorkflowName(tc.input, logger.TestSugared(t)) - require.Equal(t, tc.expected, result) - }) - } -}