Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

offchain - rpc batch caller lib + use it for offramp rpc calls#233

Merged
dimkouv merged 18 commits intoccip-developfrom
perf/batch-get-tokens
Nov 2, 2023
Merged

offchain - rpc batch caller lib + use it for offramp rpc calls#233
dimkouv merged 18 commits intoccip-developfrom
perf/batch-get-tokens

Conversation

@dimkouv
Copy link
Contributor

@dimkouv dimkouv commented Oct 25, 2023

Implemented the following interface

type EvmBatchCaller interface {
	BatchCall(ctx context.Context, blockNumber uint64, calls []EvmCall) ([]DataAndErr, error)
}

And created a new offRampReader method that utilizes it.

GetDestinationTokensFromSourceTokens(context.Context, []common.Address) ([]common.Address, error)

Limit of rpc batch calls is set to:

RPC_BATCH_LIMIT = 100

And with back-off policy four retries are going to be made each with the following batch sizes:

100, 20, 4, 1

	// back off multiplier defines the rate of reducing the batch size limit for retried calls.
	// For example if limit is 20 and multiplier is 4:
	// 1.        20
	// 2. 20/4 = 5
	// 3. 5/4  = 1

@dimkouv dimkouv changed the title (wip) rpc batch call offchain - rpc batch caller lib + use it for offramp rpc calls Oct 26, 2023
Copy link
Contributor

@mateusz-sekara mateusz-sekara left a comment

Choose a reason for hiding this comment

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

Looks good to me. However, as a follow-up, I think it's worth investigating using the same value as the one provided in the toml file smartcontractkit/chainlink#9119

This way, maybe we could avoid backoff in the code because NOPs, in case of any issues, can lower the batch RPC limit themselves. @connorwstein wdyt? Worth asking core team about they opinion on this approach anyway.

@connorwstein
Copy link
Collaborator

Looks good to me. However, as a follow-up, I think it's worth investigating using the same value as the one provided in the toml file smartcontractkit/chainlink#9119

This way, maybe we could avoid backoff in the code because NOPs, in case of any issues, can lower the batch RPC limit themselves. @connorwstein wdyt? Worth asking core team about they opinion on this approach anyway.

Yeah I think at least standardizing on defaults per chain across all services makes sense. In that case I think the parameter would need to move out of Gas estimation to a more general place though. I think backoff code is straightforward enough prob worth to keep for its graceful degradation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants