Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion pkg/solana/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ type WorkflowConfig struct {
}

func (w *WorkflowConfig) IsEnabled() bool {
return w.ForwarderAddress != nil || w.ForwarderState != nil || w.FromAddress != nil
return (w.ForwarderAddress != nil && !w.ForwarderAddress.IsZero()) ||
(w.ForwarderState != nil && !w.ForwarderState.IsZero()) ||
(w.FromAddress != nil && !w.FromAddress.IsZero())
Comment on lines +75 to +77
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These come through zeroed rather than nil by default.

}

func (w *WorkflowConfig) SetFrom(f *WorkflowConfig) {
Expand Down
8 changes: 7 additions & 1 deletion pkg/solana/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package config
import (
"testing"

"github.com/smartcontractkit/chainlink-common/pkg/config"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-common/pkg/config"
)

func TestValidateConfig(t *testing.T) {
Expand Down Expand Up @@ -59,3 +60,8 @@ func TestValidateConfig(t *testing.T) {
require.NoError(t, node.ValidateConfig())
})
}

func TestWorkflowConfigSetEnabled(t *testing.T) {
var cfg WorkflowConfig
require.False(t, cfg.IsEnabled())
}
3 changes: 1 addition & 2 deletions pkg/solana/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (r *Relayer) Start(ctx context.Context) error {
if err != nil {
return err
}
//TODO only "enabled" check
if wfCfg := r.chain.Config().WF(); wfCfg.IsEnabled() {
if r.capabilitiesRegistry == nil {
r.lggr.Errorw("workflow config is provided but capabilities registry is not set")
Expand All @@ -102,7 +101,7 @@ func (r *Relayer) Start(ctx context.Context) error {
}
}

wt, err := writetarget.New(ctx, r.chain, r.chain.MultiClient(), r.chain.TxManager(), info, r.lggr)
wt, err := writetarget.New(r.chain, r.chain.MultiClient(), r.chain.TxManager(), info, r.lggr)
if err != nil {
return fmt.Errorf("failed to initialise write target capability: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/solana/write_target/write_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Chain interface {
Config() config.Config
}

func New(ctx context.Context, chain Chain, reader client.Reader, txm Txm, chainInfo commontypes.ChainInfo, lggr logger.Logger) (capabilities.ExecutableCapability, error) {
func New(chain Chain, reader client.Reader, txm Txm, chainInfo commontypes.ChainInfo, lggr logger.Logger) (capabilities.ExecutableCapability, error) {
chainID := chain.ID()

id := GenerateWriteTargetName(chainID)
Expand Down
Loading