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

[wip] feat: implement quicknode geth vs reth output comparison #775

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jsy1218
Copy link
Member

@jsy1218 jsy1218 commented Jul 2, 2024

Paradigm RETH just realized production read 1.0.0. QuickNode is ready for us to consume the production-ready dedicated RETH cluster as well. Before we switch over, we will need to ensure every RPC output from RETH client is the same as QuickNode GETH client.

I will write the unit test as part of this PR as well.

@jsy1218 jsy1218 changed the title feat: implement quicknode geth vs reth output comparison [wip] feat: implement quicknode geth vs reth output comparison Jul 2, 2024
Copy link
Member Author

jsy1218 commented Jul 2, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jsy1218 and the rest of your teammates on Graphite Graphite

@jsy1218 jsy1218 marked this pull request as ready for review July 2, 2024 01:23
@graphite-app graphite-app bot requested review from cgkol, mikeki, a team, xrsv and uni-guillaume July 2, 2024 01:26
Copy link

graphite-app bot commented Jul 2, 2024

Graphite Automations

"Request reviewers once CI passes on routing-api repo" took an action on this PR • (07/02/24)

6 reviewers were added and 1 assignee was added to this PR based on 's automation.

Copy link
Collaborator

@cgkol cgkol left a comment

Choose a reason for hiding this comment

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

lets do it!

Copy link
Contributor

@mikeki mikeki left a comment

Choose a reason for hiding this comment

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

Early comments/questions

Comment on lines +244 to +262
logRpcResponseMatch(method: string, otherProvider: SingleJsonRpcProvider) {
metric.putMetric(
`${this.metricPrefix}_other_provider_${otherProvider.providerId}_method_${method}_rpc_match`,
1,
MetricLoggerUnit.Count
)
}

logRpcResponseMismatch(method: string, otherProvider: SingleJsonRpcProvider) {
metric.putMetric(
`${this.metricPrefix}_other_provider_${otherProvider.providerId}_method_${method}_rpc_mismatch`,
1,
MetricLoggerUnit.Count
)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

should these 2 be in UniJsonRpcProvider? it kind of feels like SingleJsonRpcProvider doesn't need to know about these methods but I could be convinced otherwise

Copy link
Member Author

Choose a reason for hiding this comment

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

Eventually all those stuffs should be migrated to the standalone RPC service. I'm not too worried about the small gymnastics like this.

@@ -230,7 +231,20 @@ export class UniJsonRpcProvider extends StaticJsonRpcProvider {
// Within each provider latency shadow evaluation, we should do block I/O,
// because NodeJS runs in single thread, so it's important to make sure
// we benchmark the latencies correctly based on the single-threaded sequential evaluation.
await provider.evaluateLatency(methodName, args)
const evaluatedProviderResponse = await (provider as any)[`evaluateLatency`](methodName, ...args)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to cast to any?

Copy link
Member Author

Choose a reason for hiding this comment

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

actually we don't need to. I was copy paste

const result = await (selectedProvider as any)[`${fnName}`](...args)

// 0.5
// ]
// }
const serializedProviderResponse = JSON.stringify(providerResponse)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jsy1218, apologies for the drive-by comment, but one thing to be careful of here is that JSON.stringify does not preserve the order for keys in an object (it does, however, preserve array ordering). You may want to consider a deeper comparison as there's a chance this leads to a high number of false negatives.

@xrsv
Copy link
Contributor

xrsv commented Jul 2, 2024

@jsy1218 just curious what are the benefits switching to RETH? is it supposed to be faster?

@jsy1218
Copy link
Member Author

jsy1218 commented Jul 2, 2024

@jsy1218 just curious what are the benefits switching to RETH? is it supposed to be faster?

@xrsv Short-term, we benefit from a faster quote (presumably RETH output has the same correctness as GETH). Long-term, the entire ethereum ecosystem benefit from a higher throughput, better performance for full/archive node syncing, better client diversity from GETH, etc. I see Uniswap switching from GETH to RETH for high up-time full-node use case will bring positive effect to those long-term benefits overtime.

@jsy1218 jsy1218 force-pushed the jsy1218/route-168-implement-quicknode-geth-vs-reth-output-comparison branch from 283d9e7 to d66b28e Compare July 3, 2024 20:05
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.

None yet

5 participants