Skip to content

Commit

Permalink
Merge branch 'develop' into feat/bump-chainlink-common
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgard authored Oct 17, 2024
2 parents b8e70d3 + b58b76e commit cb4c30d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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
4 changes: 3 additions & 1 deletion relayer/pkg/chainlink/txm/txm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
}))
Expand Down

0 comments on commit cb4c30d

Please sign in to comment.