fix(txe): committing after txs#20714
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
| ): Promise<Fr[]>; | ||
| // TODO(F-335): Drop this from here as it's not a real oracle handler - it's only called from | ||
| // RPCTranslator::txeGetPrivateEvents and never from Noir. | ||
| syncContractNonOracleMethod(contractAddress: AztecAddress, scope: AztecAddress, jobId: string): Promise<void>; |
There was a problem hiding this comment.
I needed this to be able to trigger contract sync from txeGetPrivateEvents in RPCTranslator. It was not possible to do it from txeGetPrivateEvents in TXEOracleTopLevelContext because there we don't have access to the stateMachine and hence it's impossible to commit there after the sync is done.
|
|
||
| async syncContractNonOracleMethod(contractAddress: AztecAddress, scope: AztecAddress, jobId: string) { | ||
| if (contractAddress.equals(DEFAULT_ADDRESS)) { | ||
| this.logger.debug(`Skipping sync in txeGetPrivateEvents because the events correspond to the default address.`); |
There was a problem hiding this comment.
why is this exception needed?
There was a problem hiding this comment.
This is because these tests work in top level context and have there address set to DEFAULT_ADDRESS. DEFAULT_ADDRESS is some kind of fake address and is set to the number of 42.
This is pretty messy but a lot of TXE is pretty messy so would not bother with this now (and until we are sure that the current TXE model makes sense).
BEGIN_COMMIT_OVERRIDE refactor: aztec new and init creating 2 crates (#20681) fix: hodgepodge of small things (#20720) test: aztec new scaffold works (#20711) feat: add `aztec profile` command with gate count profiling (#20695) fix(txe): committing after txs (#20714) feat: add aztec profile flamegraph command (#20741) feat: printing out public contract function debug logs in a tx (#20749) END_COMMIT_OVERRIDE

Job handling in TXE was broken and it has been working until now because everything we have been querying was obtainable within one job. This is not the case with private events because those are obtainable only after being committed.
I described here TXE is in a need of a large refactor but Nico said on slack that we are not yet confident enough in the current design for it to be worth it to invest time in it. For this reason I have created this ugly PR that makes it all work but results in the abstractions being thoroughly broken. I think it's an ok interim solution.
The main problems fixed here:
txeGetPrivateEventsget executed,jobIdinTXEOracleTopLevelContextwas set to just the initialjobIdand was not correctly updated.Issue 3. was handled by me passing the jobId down to individual functions that needed it.