Skip to content

Commit

Permalink
pkg/chainlink: add Context to TxManager.Enqueue
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Oct 13, 2024
1 parent 74dc7a6 commit 4986a7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion relayer/pkg/chainlink/ocr2/contract_transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions relayer/pkg/chainlink/txm/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

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

Expand Down

0 comments on commit 4986a7d

Please sign in to comment.