-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[DPA-1151]: fix: handle duplicate chain id across network better for ethkeys, ethTransactions & chains query. #14791
[DPA-1151]: fix: handle duplicate chain id across network better for ethkeys, ethTransactions & chains query. #14791
Conversation
8915795
to
f116714
Compare
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
b402d38
to
d93a55f
Compare
0be8692
to
41a6b00
Compare
5f85e57
to
7f834e2
Compare
7f834e2
to
780e581
Compare
780e581
to
e9a7615
Compare
Does this PR need a corresponding operator-ui change? |
@jmank88 I dont believe so. Since the types are generated on the fly, the schema is always updated. However because the |
a58e3e5
to
38a40ad
Compare
We currently have a loader `loadByIDs` but this does not take into consideration when same Id exists across different network. Eg if solana and ethereum both have chain ID 1. `loadByIDs` will either return an error or worst returns an incorrect results. `loadByRelayIDs` rectifies this by performing lookup with ID and Network. JIRA: https://smartcontract-it.atlassian.net/browse/DPA-1151
Update ethKeys & ethTransaction query to use the new dataloader `GetChainByRelayID` as the existing loader does not handle duplicate Id across different network.
Allow chain lookup by network and chain Id so we can differentiate same chain id in different networks. JIRA: https://smartcontract-it.atlassian.net/browse/DPA-1151
38a40ad
to
dc96cdc
Compare
Quality Gate passedIssues Measures |
func GetChainByRelayID(ctx context.Context, id string) (*commonTypes.ChainStatusWithID, error) { | ||
ldr := For(ctx) | ||
|
||
thunk := ldr.ChainsByRelayIDLoader.Load(ctx, dataloader.StringKey(id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does thunk
mean as a var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question, in this context, thunk is just promise, but mainly i was following the rest of the data loaders, they seem to call the value returned by load
thunk
@@ -45,6 +46,7 @@ func New(app chainlink.Application) *Dataloader { | |||
app: app, | |||
|
|||
ChainsByIDLoader: dataloader.NewBatchedLoader(chains.loadByIDs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a ticket to clean out the ChainsByIDLoader
usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, there is still code using it for backwards compatibility as it is exposed via API, and to be honest i dont know enough about how this repo works and removing this is a breaking change for the API, like we would have to communicate to consumers to not use this or monitor the usage of it.
I recommend going through each commit one at a time for better reviewing experience
We currently have a loader
loadByIDs
but this does not take into consideration when same Id exists across different network. It has a bug in there where it will either return an error or worst returns an incorrect results from a different chain. Eg if solana and ethereum both have chain ID 1.loadByRelayIDs
rectifies this by performing lookup with ID and Network. It migratesethKeys
,ethTransactions
andchain
to use the new loader.This PR also introduce lookup for
chain
query to include network argument.Node
andNodes
graphQL query are still using theloadByIDs
loader. To fix them, we need to rewrite Node and Nodes to fetch relayid from the relayer and use that to perform lookup.JIRA: https://smartcontract-it.atlassian.net/browse/DPA-1151
Chain query with network lookup