feat: measuring node round trips #19291
Open
+146
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Fixes https://linear.app/aztec-labs/issue/F-230/improve-benchmarks
In this PR I measure the number of node round trips. This is achieved by updating
ProxiedNodeto track this. This is done by having aninFlightCountcounter tracking num current rpc calls. This allows us to group parallel rpc calls into the same round trip.Note that the
ProxiedNodeis not used onnextbut when I activated it with the following change:#getSimulatorForTx(overrides?: { contracts?: ContractOverrides }) { const proxyContractDataProvider = ProxiedContractDataProviderFactory.create( this.contractDataProvider, overrides?.contracts, ); return new ContractFunctionSimulator( proxyContractDataProvider, this.noteDataProvider, this.keyStore, this.addressDataProvider, - this.node, + ProxiedNodeFactory.create(this.node), this.anchorBlockDataProvider, this.senderTaggingDataProvider, this.recipientTaggingDataProvider, this.senderAddressBook, this.capsuleDataProvider, this.privateEventDataProvider, this.simulator, ); }I got what looks like reasonable values when running
src/bench/client_flows/amm.test.ts:The linked issue F-230 seems to have a wider scope than just the round trip measurements so not sure if we want to fully close it with this PR.