refactor(pxe): avoid expensive toTx() call when computing tx hash#23136
Merged
Conversation
295dc4c to
4369cc0
Compare
Contributor
|
@nchamo I think this is a bit leaky. PXE needs to know a bit about how tx hashes get computed (use public inputs, pass in via the data field). Maybe we could add a simple helper to the |
Contributor
|
That being said, this PR is a very small but meaningful change. So if my suggestion proves to be a rabbit hole, let's just merge this |
Contributor
Author
|
Like the suggestion @dbanks12 , makes a lot of sense |
dbanks12
approved these changes
May 11, 2026
AztecBot
pushed a commit
that referenced
this pull request
May 11, 2026
Collaborator
|
✅ Successfully backported to backport-to-v4-next-staging #23142. |
benesjan
added a commit
that referenced
this pull request
May 12, 2026
BEGIN_COMMIT_OVERRIDE fix(sequencer): bounded sweep instead of event scan for governance proposal check (#22989) fix(sequencer): bounded sweep instead of event scan for governance proposal check (#22989) (#23001) chore: route backport CI failure notifications to #backports channel (#21779) fix: (A-589) epochs l1 reorgs test (#20999) chore: Accumulated backports to v4 (#23065) fix(bb-prover): use temp directory for avm_verify (#23138) chore: notify on v4-next sync (#23139) refactor(pxe): use findLeavesIndexes for read request verification (#23123) refactor(pxe): skip storage reads for never-updated contracts (#23131) fix(pxe): skip registerContractFunctionSignatures when no public fns (#23134) chore: Update Noir to nightly-2026-04-15 (#22572) chore: Update Noir to nightly-2026-04-16 (#22594) chore: Update Noir to nightly-2026-04-17 (#22633) chore: Update Noir to nightly-2026-04-23 (#22653) chore: Update Noir to nightly-2026-04-28 (#22755) chore: Update Noir to nightly-2026-05-01 (#22836) chore: Update Noir to nightly-2026-05-05 (#22911) chore: Update Noir to nightly-2026-05-11 (#23023) chore: backport noir sync PRs to backport-to-v4-next-staging (#23148) refactor(pxe): prefetch updated class id hints per unique contract (#23130) chore(aztec-nr): Public self constructor function to prevent static byte code size blow up (#23062) chore: merge v4 into backport-to-v4-next-staging (#23140) chore(aztec-nr): Public self constructor function (backport #23062) (#23156) refactor(pxe): avoid expensive toTx() call when computing tx hash (#23136) END_COMMIT_OVERRIDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
(await txProvingResult.toTx()).txHashwithawait Tx.computeTxHash({ data: publicInputs })inproveTx, and remove the corresponding TODO.Why this is safe and worth doing
TxProvingResult.toTx()passesthis.publicInputsdirectly asdatatoTx.create(proven_tx.ts:28-29).Tx.createcomputes the hash viaTx.computeTxHash(fields)(tx.ts:159), which only readsfields.data(tx.ts:151-155). So callingTx.computeTxHash({ data: publicInputs })produces the same hash while skipping work that doesn't contribute to it:PrivateCallExecutionResulttree to collect and sort contract class logsTx(with proof, logs, calldata) only to read one field and discard the restA short version of this rationale lives inline in
pxe.ts.