diff --git a/relayer/pkg/chainlink/ocr2/contract_transmitter.go b/relayer/pkg/chainlink/ocr2/contract_transmitter.go index 89cfd4bad..ef2b61c7b 100644 --- a/relayer/pkg/chainlink/ocr2/contract_transmitter.go +++ b/relayer/pkg/chainlink/ocr2/contract_transmitter.go @@ -95,7 +95,7 @@ func (c *contractTransmitter) Transmit( return err } - err = c.txm.Enqueue(c.accountAddress, c.senderAddress, starknetrpc.FunctionCall{ + err = c.txm.Enqueue(ctx, c.accountAddress, c.senderAddress, starknetrpc.FunctionCall{ ContractAddress: c.contractAddress, EntryPointSelector: starknetutils.GetSelectorFromNameFelt("transmit"), Calldata: calldata, diff --git a/relayer/pkg/chainlink/txm/txm.go b/relayer/pkg/chainlink/txm/txm.go index 2469cadc1..30ca5e29f 100644 --- a/relayer/pkg/chainlink/txm/txm.go +++ b/relayer/pkg/chainlink/txm/txm.go @@ -27,7 +27,7 @@ const ( ) type TxManager interface { - Enqueue(accountAddress *felt.Felt, publicKey *felt.Felt, txFn starknetrpc.FunctionCall) error + Enqueue(ctx context.Context, accountAddress *felt.Felt, publicKey *felt.Felt, txFn starknetrpc.FunctionCall) error InflightCount() (int, int) } @@ -483,12 +483,12 @@ func (txm *starktxm) HealthReport() map[string]error { return map[string]error{txm.Name(): txm.Healthy()} } -func (txm *starktxm) Enqueue(accountAddress, publicKey *felt.Felt, tx starknetrpc.FunctionCall) error { +func (txm *starktxm) Enqueue(ctx context.Context, accountAddress, publicKey *felt.Felt, tx starknetrpc.FunctionCall) error { // validate key exists for sender // use the embedded Loopp Keystore to do this; the spec and design // encourage passing nil data to the loop.Keystore.Sign as way to test // existence of a key - if _, err := txm.ks.Loopp().Sign(context.Background(), publicKey.String(), nil); err != nil { + if _, err := txm.ks.Loopp().Sign(ctx, publicKey.String(), nil); err != nil { return fmt.Errorf("enqueue: failed to sign: %+w", err) } diff --git a/relayer/pkg/chainlink/txm/txm_test.go b/relayer/pkg/chainlink/txm/txm_test.go index 74d27fc53..460843cb8 100644 --- a/relayer/pkg/chainlink/txm/txm_test.go +++ b/relayer/pkg/chainlink/txm/txm_test.go @@ -20,11 +20,13 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/loop" adapters "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/starknet" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/txm/mocks" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet" ) func TestIntegration_Txm(t *testing.T) { + ctx := tests.Context(t) n := 2 // number of txs per key // url := SetupLocalStarknetNode(t) url := "http://127.0.0.1:5050" @@ -100,7 +102,7 @@ func TestIntegration_Txm(t *testing.T) { selector := starknetutils.GetSelectorFromNameFelt("totalSupply") for i := 0; i < n; i++ { - require.NoError(t, txm.Enqueue(accountAddress, publicKey, starknetrpc.FunctionCall{ + require.NoError(t, txm.Enqueue(ctx, accountAddress, publicKey, starknetrpc.FunctionCall{ ContractAddress: contractAddress, // send to ETH token contract EntryPointSelector: selector, }))