Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rfq-relayer): wait for finality before proving #3062

Merged
merged 18 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 15 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
2 changes: 1 addition & 1 deletion services/rfq/guard/guardconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
for chainID, chainCfg := range relayerCfg.GetChains() {
cfg.Chains[chainID] = ChainConfig{
RFQAddress: chainCfg.RFQAddress,
Confirmations: chainCfg.Confirmations,
Confirmations: chainCfg.FinalityConfirmations,

Check warning on line 119 in services/rfq/guard/guardconfig/config.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/guardconfig/config.go#L119

Added line #L119 was not covered by tests
}
}
return cfg
Expand Down
4 changes: 4 additions & 0 deletions services/rfq/guard/guarddb/base/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
TxHash string
// Status is the status of the event
Status guarddb.PendingProvenStatus
// BlockNumber is the block number of the event
BlockNumber uint64
}

// FromPendingProven converts a quote request to an object that can be stored in the db.
Expand All @@ -52,6 +54,7 @@
TransactionID: hexutil.Encode(proven.TransactionID[:]),
TxHash: proven.TxHash.Hex(),
Status: proven.Status,
BlockNumber: proven.BlockNumber,

Check warning on line 57 in services/rfq/guard/guarddb/base/model.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/guarddb/base/model.go#L57

Added line #L57 was not covered by tests
}
}

Expand All @@ -73,6 +76,7 @@
TransactionID: transactionID,
TxHash: common.HexToHash(p.TxHash),
Status: p.Status,
BlockNumber: p.BlockNumber,

Check warning on line 79 in services/rfq/guard/guarddb/base/model.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/guarddb/base/model.go#L79

Added line #L79 was not covered by tests
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions services/rfq/guard/guarddb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type PendingProven struct {
TransactionID [32]byte
TxHash common.Hash
Status PendingProvenStatus
BlockNumber uint64
}

// PendingProvenStatus is the status of a quote request in the db.
Expand Down
42 changes: 41 additions & 1 deletion services/rfq/guard/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
TransactionID: event.TransactionId,
TxHash: event.TransactionHash,
Status: guarddb.ProveCalled,
BlockNumber: event.Raw.BlockNumber,

Check warning on line 85 in services/rfq/guard/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/service/handlers.go#L85

Added line #L85 was not covered by tests
}
err = g.db.StorePendingProven(ctx, proven)
if err != nil {
Expand Down Expand Up @@ -115,7 +116,17 @@
metrics.EndSpanWithErr(span, err)
}()

// first, get the corresponding bridge request
// first, verify that the prove tx is finalized
finalized, err := g.isFinalized(ctx, int(proven.Origin), proven.BlockNumber)
if err != nil {
return fmt.Errorf("could not check if tx is finalized: %w", err)
}
span.SetAttributes(attribute.Bool("finalized", finalized))
if !finalized {
return nil
}

Check warning on line 127 in services/rfq/guard/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/service/handlers.go#L120-L127

Added lines #L120 - L127 were not covered by tests

// get the corresponding bridge request
bridgeRequest, err := g.db.GetBridgeRequestByID(ctx, proven.TransactionID)
if err != nil {
return fmt.Errorf("could not get bridge request for txid %s: %w", hexutil.Encode(proven.TransactionID[:]), err)
Expand Down Expand Up @@ -242,3 +253,32 @@
}
return true
}

// isFinalized checks if a transaction is finalized versus the configured confirmations threshold.
func (g *Guard) isFinalized(ctx context.Context, chainID int, txBlockNumber uint64) (bool, error) {
span := trace.SpanFromContext(ctx)

client, err := g.client.GetChainClient(ctx, chainID)
if err != nil {
return false, fmt.Errorf("could not get chain client: %w", err)
}

Check warning on line 264 in services/rfq/guard/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/service/handlers.go#L258-L264

Added lines #L258 - L264 were not covered by tests

currentBlockNumber, err := client.BlockNumber(ctx)
if err != nil {
return false, fmt.Errorf("could not get block number: %w", err)
}

Check warning on line 269 in services/rfq/guard/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/service/handlers.go#L266-L269

Added lines #L266 - L269 were not covered by tests

chainCfg, ok := g.cfg.Chains[chainID]
if !ok {
return false, fmt.Errorf("could not get chain config for chain %d", chainID)
}
threshBlockNumber := txBlockNumber + chainCfg.Confirmations
span.SetAttributes(
attribute.Int("chain_id", chainID),
attribute.Int("current_block_number", int(currentBlockNumber)),
attribute.Int("tx_block_number", int(txBlockNumber)),
attribute.Int("confirmations", int(chainCfg.Confirmations)),
)

return currentBlockNumber >= threshBlockNumber, nil

Check warning on line 283 in services/rfq/guard/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/service/handlers.go#L271-L283

Added lines #L271 - L283 were not covered by tests
}
2 changes: 2 additions & 0 deletions services/rfq/relayer/relconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ type ChainConfig struct {
RFQAddress string `yaml:"rfq_address"`
// Confirmations is the number of required confirmations.
Confirmations uint64 `yaml:"confirmations"`
// FinalityConfirmations is the number of required confirmations before proving.
FinalityConfirmations uint64 `yaml:"prove_confirmations"`
// Tokens is a map of token name -> token config.
Tokens map[string]TokenConfig `yaml:"tokens"`
// NativeToken is the native token of the chain (pays gas).
Expand Down
14 changes: 14 additions & 0 deletions services/rfq/relayer/relconfig/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@
return value, nil
}

// GetFinalityConfirmations returns the FinalityConfirmations for the given chainID.
func (c Config) GetFinalityConfirmations(chainID int) (value uint64, err error) {
rawValue, err := c.getChainConfigValue(chainID, "FinalityConfirmations")
if err != nil {
return value, err
}

Check warning on line 223 in services/rfq/relayer/relconfig/getters.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/relconfig/getters.go#L219-L223

Added lines #L219 - L223 were not covered by tests

value, ok := rawValue.(uint64)
if !ok {
return value, fmt.Errorf("failed to cast FinalityConfirmations to int")
}
return value, nil

Check warning on line 229 in services/rfq/relayer/relconfig/getters.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/relconfig/getters.go#L225-L229

Added lines #L225 - L229 were not covered by tests
}
Comment on lines +219 to +230
Copy link
Contributor

Choose a reason for hiding this comment

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

Add unit tests for the new function.

The function should include unit tests to ensure its correctness.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 221-223: services/rfq/relayer/relconfig/getters.go#L221-L223
Added lines #L221 - L223 were not covered by tests


[warning] 225-226: services/rfq/relayer/relconfig/getters.go#L225-L226
Added lines #L225 - L226 were not covered by tests


[warning] 228-229: services/rfq/relayer/relconfig/getters.go#L228-L229
Added lines #L228 - L229 were not covered by tests


Correct the error message in the type assertion failure.

The error message should mention uint64 instead of int.

- return value, fmt.Errorf("failed to cast FinalityConfirmations to int")
+ return value, fmt.Errorf("failed to cast FinalityConfirmations to uint64")
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (c Config) GetFinalityConfirmations(chainID int) (value uint64, err error) {
rawValue, err := c.getChainConfigValue(chainID, "FinalityConfirmations")
if err != nil {
return value, err
}
value, ok := rawValue.(uint64)
if !ok {
return value, fmt.Errorf("failed to cast FinalityConfirmations to int")
}
return value, nil
}
func (c Config) GetFinalityConfirmations(chainID int) (value uint64, err error) {
rawValue, err := c.getChainConfigValue(chainID, "FinalityConfirmations")
if err != nil {
return value, err
}
value, ok := rawValue.(uint64)
if !ok {
return value, fmt.Errorf("failed to cast FinalityConfirmations to uint64")
}
return value, nil
}
Tools
GitHub Check: codecov/patch

[warning] 221-223: services/rfq/relayer/relconfig/getters.go#L221-L223
Added lines #L221 - L223 were not covered by tests


[warning] 225-226: services/rfq/relayer/relconfig/getters.go#L225-L226
Added lines #L225 - L226 were not covered by tests


[warning] 228-229: services/rfq/relayer/relconfig/getters.go#L228-L229
Added lines #L228 - L229 were not covered by tests


// GetNativeToken returns the NativeToken for the given chainID.
func (c Config) GetNativeToken(chainID int) (value string, err error) {
rawValue, err := c.getChainConfigValue(chainID, "NativeToken")
Expand Down
2 changes: 1 addition & 1 deletion services/rfq/relayer/reldb/base/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (s Store) UpdateRelayNonce(ctx context.Context, id [32]byte, nonce uint64)
}

func isValidStateTransition(prevStatus, status reldb.QuoteRequestStatus) bool {
if status == reldb.DeadlineExceeded || status == reldb.WillNotProcess {
if status == reldb.DeadlineExceeded || status == reldb.WillNotProcess || status == reldb.RelayRaceLost {
return true
}
return status >= prevStatus
Expand Down
69 changes: 67 additions & 2 deletions services/rfq/relayer/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,36 @@
// Step 6: ProvePosting
//
// This is the sixth step in the bridge process. Here we submit the claim transaction to the origin chain.
func (q *QuoteRequestHandler) handleRelayCompleted(ctx context.Context, _ trace.Span, request reldb.QuoteRequest) (err error) {
// relays been completed, it's time to go back to the origin chain and try to prove
func (q *QuoteRequestHandler) handleRelayCompleted(ctx context.Context, span trace.Span, request reldb.QuoteRequest) (err error) {

Check warning on line 381 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L381

Added line #L381 was not covered by tests
// fetch the block of the relay transaction to confirm that it has been finalized
relayBlockNumber, err := q.getRelayBlockNumber(ctx, request)
if err != nil {

Check warning on line 384 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L383-L384

Added lines #L383 - L384 were not covered by tests
// relay tx must have gotten reorged; mark as RelayRaceLost
span.SetAttributes(attribute.String("receipt_error", err.Error()))
err = q.db.UpdateQuoteRequestStatus(ctx, request.TransactionID, reldb.RelayRaceLost, nil)
if err != nil {
return fmt.Errorf("could not update request status: %w", err)
}
return fmt.Errorf("could not get relay block number: %w", err)
}

Check warning on line 392 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L391-L392

Added lines #L391 - L392 were not covered by tests

currentBlockNumber := q.Origin.LatestBlock()
proveConfirmations, err := q.cfg.GetFinalityConfirmations(int(q.Dest.ChainID))
if err != nil {
return fmt.Errorf("could not get prove confirmations: %w", err)
}

span.SetAttributes(
attribute.Int("current_block_number", int(currentBlockNumber)),
attribute.Int("relay_block_number", int(relayBlockNumber)),
attribute.Int("prove_confirmations", int(proveConfirmations)),
)
if currentBlockNumber < relayBlockNumber+proveConfirmations {
span.AddEvent("not enough confirmations")
return nil
}

Check warning on line 409 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L400-L409

Added lines #L400 - L409 were not covered by tests
Comment on lines +392 to +420
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure sufficient test coverage for new logic in handleRelayCompleted.

The changes in handleRelayCompleted introduce significant logic related to transaction finality checks. However, static analysis indicates that these lines are not covered by tests. Ensuring that new logic is adequately tested is crucial for maintaining the reliability of the system, especially given the critical nature of blockchain transaction handling.

Please add unit tests to cover the new logic introduced in this method. If you need assistance with this, I can help generate the unit testing code or open a GitHub issue to track this task.

Tools
GitHub Check: codecov/patch

[warning] 381-381: services/rfq/relayer/service/handlers.go#L381
Added line #L381 was not covered by tests


[warning] 383-384: services/rfq/relayer/service/handlers.go#L383-L384
Added lines #L383 - L384 were not covered by tests


[warning] 391-392: services/rfq/relayer/service/handlers.go#L391-L392
Added lines #L391 - L392 were not covered by tests


[warning] 400-409: services/rfq/relayer/service/handlers.go#L400-L409
Added lines #L400 - L409 were not covered by tests

// relay has been finalized, it's time to go back to the origin chain and try to prove
Copy link
Collaborator

Choose a reason for hiding this comment

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

@dwasse we need to do a check similar to Guard's isProveValid here to handle the case where our relay tx was reorged.

In the event where we submitted a tx, witnessed a BridgeRelayed event, and later on this tx was reorged and ended up being reverted, we need a way for the Relayer to mark the tx as RelayRaceLost here (I'm not sure if we can safely assume that we will index the correct event with another relayer before that).

The current code will still get a valid receipt for DestTxHash, it's just the receipt will not have a corresponding BridgeRelayed event there.

_, err = q.Origin.SubmitTransaction(ctx, func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) {
tx, err = q.Origin.Bridge.Prove(transactor, request.RawRequest, request.DestTxHash)
if err != nil {
Expand All @@ -399,6 +427,43 @@
return nil
}

// getRelayBlockNumber fetches the block number of the relay transaction for a given quote request.
func (q *QuoteRequestHandler) getRelayBlockNumber(ctx context.Context, request reldb.QuoteRequest) (blockNumber uint64, err error) {
// fetch the transaction receipt for corresponding tx hash

Check warning on line 432 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L430-L432

Added lines #L430 - L432 were not covered by tests
var receipt *types.Receipt
err = retry.WithBackoff(ctx, func(context.Context) error {
receipt, err = q.Dest.Client.TransactionReceipt(ctx, request.DestTxHash)
if err != nil {
return fmt.Errorf("could not get transaction receipt: %w", err)
}
return nil
}, retry.WithMaxTotalTime(15*time.Second))
if err != nil {

Check warning on line 441 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L441

Added line #L441 was not covered by tests
return blockNumber, fmt.Errorf("could not get get receipt: %w", err)
}
parser, err := fastbridge.NewParser(q.Dest.Bridge.Address())
if err != nil {

Check warning on line 445 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L443-L445

Added lines #L443 - L445 were not covered by tests
return blockNumber, fmt.Errorf("could not create parser: %w", err)
}

// check that a Relayed event was emitted
for _, log := range receipt.Logs {
if log == nil {
continue
}

Check failure on line 453 in services/rfq/relayer/service/handlers.go

View workflow job for this annotation

GitHub Actions / Lint (services/rfq)

Duplicate words (get) found (dupword)
_, parsedEvent, ok := parser.ParseEvent(*log)
if !ok {
continue
}
_, ok = parsedEvent.(*fastbridge.FastBridgeBridgeRelayed)

Check warning on line 458 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L449-L458

Added lines #L449 - L458 were not covered by tests
if ok {
return receipt.BlockNumber.Uint64(), nil
}
}

Check warning on line 463 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L461-L463

Added lines #L461 - L463 were not covered by tests
return blockNumber, fmt.Errorf("relayed event not found for dest tx hash: %s", request.DestTxHash.Hex())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor getRelayBlockNumber to handle errors more gracefully and ensure event parsing is robust.

The method getRelayBlockNumber fetches the block number of a relay transaction, which is crucial for ensuring that the transaction has been finalized. However, there are several areas where the error handling and event parsing could be improved:

  1. Error Handling: The method retries fetching the transaction receipt but does not handle potential continuous failures beyond the retry limit. This could lead to unhandled errors in critical transaction handling logic.
  2. Event Parsing: The loop checking for a Relayed event does not account for possible anomalies like missing or malformed logs.

Consider implementing more comprehensive error handling strategies and robust log parsing to ensure the reliability of this method. Here's a proposed refactor for better error handling and event parsing:

func (q *QuoteRequestHandler) getRelayBlockNumber(ctx context.Context, request reldb.QuoteRequest) (blockNumber uint64, err error) {
    var receipt *types.Receipt
    err = retry.WithBackoff(ctx, func(context.Context) error {
        receipt, err = q.Dest.Client.TransactionReceipt(ctx, request.DestTxHash)
        if err != nil {
            return fmt.Errorf("could not get transaction receipt: %w", err)
        }
        return nil
    }, retry.WithMaxTotalTime(15*time.Second))
    if err != nil {
        return blockNumber, fmt.Errorf("could not get receipt after retries: %w", err)
    }
    parser, err := fastbridge.NewParser(q.Dest.Bridge.Address())
    if err != nil {
        return blockNumber, fmt.Errorf("could not create parser: %w", err)
    }
    found := false
    for _, log := range receipt.Logs {
        if log == nil {
            continue
        }
        _, parsedEvent, ok := parser.ParseEvent(*log)
        if ok {
            if _, ok := parsedEvent.(*fastbridge.FastBridgeBridgeRelayed); ok {
                found = true
                blockNumber = receipt.BlockNumber.Uint64()
                break
            }
        }
    }
    if !found {
        return blockNumber, fmt.Errorf("relayed event not found for dest tx hash: %s", request.DestTxHash.Hex())
    }
    return blockNumber, nil
}

This refactor includes a check to ensure all retries are exhausted before returning an error and improves clarity in event parsing.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// getRelayBlockNumber fetches the block number of the relay transaction for a given quote request.
func (q *QuoteRequestHandler) getRelayBlockNumber(ctx context.Context, request reldb.QuoteRequest) (blockNumber uint64, err error) {
// fetch the transaction receipt for corresponding tx hash
var receipt *types.Receipt
err = retry.WithBackoff(ctx, func(context.Context) error {
receipt, err = q.Dest.Client.TransactionReceipt(ctx, request.DestTxHash)
if err != nil {
return fmt.Errorf("could not get transaction receipt: %w", err)
}
return nil
}, retry.WithMaxTotalTime(15*time.Second))
if err != nil {
return blockNumber, fmt.Errorf("could not get get receipt: %w", err)
}
parser, err := fastbridge.NewParser(q.Dest.Bridge.Address())
if err != nil {
return blockNumber, fmt.Errorf("could not create parser: %w", err)
}
// check that a Relayed event was emitted
for _, log := range receipt.Logs {
if log == nil {
continue
}
_, parsedEvent, ok := parser.ParseEvent(*log)
if !ok {
continue
}
_, ok = parsedEvent.(*fastbridge.FastBridgeBridgeRelayed)
if ok {
return receipt.BlockNumber.Uint64(), nil
}
}
return blockNumber, fmt.Errorf("relayed event not found for dest tx hash: %s", request.DestTxHash.Hex())
}
func (q *QuoteRequestHandler) getRelayBlockNumber(ctx context.Context, request reldb.QuoteRequest) (blockNumber uint64, err error) {
var receipt *types.Receipt
err = retry.WithBackoff(ctx, func(context.Context) error {
receipt, err = q.Dest.Client.TransactionReceipt(ctx, request.DestTxHash)
if err != nil {
return fmt.Errorf("could not get transaction receipt: %w", err)
}
return nil
}, retry.WithMaxTotalTime(15*time.Second))
if err != nil {
return blockNumber, fmt.Errorf("could not get receipt after retries: %w", err)
}
parser, err := fastbridge.NewParser(q.Dest.Bridge.Address())
if err != nil {
return blockNumber, fmt.Errorf("could not create parser: %w", err)
}
found := false
for _, log := range receipt.Logs {
if log == nil {
continue
}
_, parsedEvent, ok := parser.ParseEvent(*log)
if ok {
if _, ok := parsedEvent.(*fastbridge.FastBridgeBridgeRelayed); ok {
found = true
blockNumber = receipt.BlockNumber.Uint64()
break
}
}
}
if !found {
return blockNumber, fmt.Errorf("relayed event not found for dest tx hash: %s", request.DestTxHash.Hex())
}
return blockNumber, nil
}
Tools
GitHub Check: codecov/patch

[warning] 430-432: services/rfq/relayer/service/handlers.go#L430-L432
Added lines #L430 - L432 were not covered by tests


[warning] 441-441: services/rfq/relayer/service/handlers.go#L441
Added line #L441 was not covered by tests


[warning] 443-445: services/rfq/relayer/service/handlers.go#L443-L445
Added lines #L443 - L445 were not covered by tests


[warning] 449-458: services/rfq/relayer/service/handlers.go#L449-L458
Added lines #L449 - L458 were not covered by tests


[warning] 461-463: services/rfq/relayer/service/handlers.go#L461-L463
Added lines #L461 - L463 were not covered by tests

GitHub Check: Lint (services/rfq)

[failure] 453-453:
Duplicate words (get) found (dupword)


Check warning on line 466 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L465-L466

Added lines #L465 - L466 were not covered by tests
// handleProofProvided handles the ProofProvided event emitted by the Bridge.
// Step 7: ProvePosted
//
Expand Down
4 changes: 4 additions & 0 deletions services/rfq/relayer/service/statushandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"github.com/synapsecns/sanguine/services/rfq/relayer/chain"
"github.com/synapsecns/sanguine/services/rfq/relayer/inventory"
"github.com/synapsecns/sanguine/services/rfq/relayer/quoter"
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"github.com/synapsecns/sanguine/services/rfq/util"
"go.opentelemetry.io/otel/attribute"
Expand Down Expand Up @@ -54,6 +55,8 @@
handlerMtx mapmutex.StringMapMutex
// balanceMtx is the mutex for balances.
balanceMtx mapmutex.StringMapMutex
// cfg is the relayer config.
cfg relconfig.Config
}

func getBalanceMtxKey(chainID uint32, token common.Address) string {
Expand Down Expand Up @@ -88,6 +91,7 @@
mutexMiddlewareFunc: r.mutexMiddleware,
handlerMtx: r.handlerMtx,
balanceMtx: r.balanceMtx,
cfg: r.cfg,

Check warning on line 94 in services/rfq/relayer/service/statushandler.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/statushandler.go#L94

Added line #L94 was not covered by tests
}

// wrap in deadline middleware since the relay has not yet happened
Expand Down
Loading