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

Use GetSourceChainConfig instead of OffRampGetAllSourceChainConfigs #527

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

reductionista
Copy link
Collaborator

@reductionista reductionista commented Jan 31, 2025

There isn't any efficient way to implement OffRampGetAllSourceChainConfigs on Solana, due to the information being spread across many different Accounts while not having the seeds passed as input params to determine the PDA's for those accounts. GetSourceChainConfig works on both evm & solana

Note:
We could do it using getProgramAccounts, but this requires account indexing to be enabled on the rpc server, doubling memory requirements to run it. We could also get around it by storing a list of the PDA's in an account with a fixed prefix, but this would require us to have a maximum limit on the number of chains we support. If the maximum limit was too high, it would waste costly on-chain storage space without actually using it. Too low, and we'd have to update the smart contracts when we hit the limit.

@reductionista reductionista force-pushed the domino/get_all_chain_configs branch from 47b91ad to f85fc49 Compare January 31, 2025 04:43
@reductionista reductionista changed the title Add ExtendedBatchGetLatestValues Use GetSourceChainConfig instead of OffRampGetAllSourceChainConfigs Jan 31, 2025
@reductionista reductionista force-pushed the domino/get_all_chain_configs branch 8 times, most recently from 70b1616 to 7aed7b5 Compare February 4, 2025 22:01
@reductionista reductionista force-pushed the domino/get_all_chain_configs branch from 7aed7b5 to 3113af7 Compare February 4, 2025 22:09
@reductionista reductionista marked this pull request as ready for review February 4, 2025 22:09
@reductionista reductionista requested a review from a team as a code owner February 4, 2025 22:09
Copy link
Collaborator

@prashantkumar1982 prashantkumar1982 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, but I don't have too much context on this codebase.
So please get some approvals from others too, who know this code.

Comment on lines +1180 to +1182
results, _, err := r.contractReaders[r.destChain].ExtendedBatchGetLatestValues(
ctx, contractreader.ExtendedBatchGetLatestValuesRequest{consts.ContractNameOffRamp: contractBatch},
false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Previously this was using an Unconfirmed confidence level. What level is used with batch get?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's ignored anyway on Solana. Looks like it does default to Unconfirmed on EVM, and the possibility of overriding the default looks mostly implemented. Not sure why they didn't expose that feature in the API:
https://github.com/smartcontractkit/chainlink/blob/develop/core/services/relay/evm/read/batch.go#L132-L140

https://github.com/smartcontractkit/chainlink/blob/develop/core/services/relay/evm/read/bindings.go#L177

Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

LGTM, nice!

Copy link

github-actions bot commented Feb 6, 2025

Metric domino/get_all_chain_configs main
Coverage 75.9% 75.7%

@reductionista reductionista merged commit 13db1ad into main Feb 7, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants