-
Notifications
You must be signed in to change notification settings - Fork 615
feat: Simulate enqueued public functions and locate failing constraints on them #1853
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
Changes from 17 commits
a509429
408c83c
1ff4bd8
3d14c40
8233a82
7c09e7a
7eda8a4
aba3018
4894747
e706da1
213e465
7e9fad9
21e7a0b
87b53b2
ff46ce9
204386f
c90822a
98f2690
c11a01f
e0db983
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { | |
| LogType, | ||
| MerkleTreeId, | ||
| SiblingPath, | ||
| SimulationError, | ||
| Tx, | ||
| TxHash, | ||
| } from '@aztec/types'; | ||
|
|
@@ -370,4 +371,19 @@ export class HttpNode implements AztecNode { | |
| const response = await (await fetch(url.toString())).json(); | ||
| return response.blockData; | ||
| } | ||
|
|
||
| /** | ||
| * Simulates the public part of a transaction with the current state. | ||
| * @param tx - The transaction to simulate. | ||
| **/ | ||
| public async simulatePublicPart(tx: Tx) { | ||
|
sirasistant marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aside from the name, does it make sense to send a full tx object? Shouldn't we be just sending the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to send the whole TX for some reasons:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point. And I know this is probably a bigger discussion, but how does this impact privacy? Should we enable the RPC server to run its own public simulations and gas estimations, by just requiring the state it needs from the node? Or would that leak information as well?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's ok, since you send to the node for simulation the same data you'd send the node for submission of the TX. I think in this case it's similar to ethereum, if you don't want the node to track which transaction came from which IP, you can run the node yourself and rely on the gossip p2p networking. |
||
| const url = new URL(`${this.baseUrl}/simulate-tx`); | ||
| const init: RequestInit = {}; | ||
| init['method'] = 'POST'; | ||
| init['body'] = tx.toBuffer(); | ||
| const response = await (await fetch(url, init)).json(); | ||
| if (response.simulationError) { | ||
| throw SimulationError.fromJSON(response.simulationError); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.