Skip to content

feat: txe state machine#13836

Merged
sklppy88 merged 2 commits into
masterfrom
ek/feat/13221/txe-state-machine
May 1, 2025
Merged

feat: txe state machine#13836
sklppy88 merged 2 commits into
masterfrom
ek/feat/13221/txe-state-machine

Conversation

@sklppy88

@sklppy88 sklppy88 commented Apr 25, 2025

Copy link
Copy Markdown
Contributor

This PR removes the TXe node with an implementation of a TXe state machine which combines an aztec node, and a custom archiver / synchronizer.

Note: Because of the extension of ArchiverStoreHelper, there was a clash of getBlocks, in one interface it was expected to receive L2Blocks, and in the other PublishedBlocks. To solve this, I have renamed getBlocks on the ArchiverStoreHelper to getPublishedBlocks. But doing so I also did the same renaming on the ArchiverDataStore because it seems to better match the signature anyways.

sklppy88 commented Apr 25, 2025

Copy link
Copy Markdown
Contributor Author

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

@sklppy88 sklppy88 changed the title init feat: txe state machine Apr 25, 2025
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch 3 times, most recently from fcc8540 to 8e927b7 Compare April 25, 2025 15:53
@sklppy88 sklppy88 requested a review from Thunkar April 25, 2025 15:53
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch from 8e927b7 to 1388af7 Compare April 28, 2025 09:12
@sklppy88 sklppy88 changed the base branch from master to graphite-base/13836 April 28, 2025 09:59
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch from 1388af7 to 790c690 Compare April 28, 2025 09:59
@sklppy88 sklppy88 changed the base branch from graphite-base/13836 to ek/fix/global-variable-builder-correct-interface April 28, 2025 09:59
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch from 790c690 to 1e1a517 Compare April 28, 2025 10:00
@sklppy88 sklppy88 force-pushed the ek/fix/global-variable-builder-correct-interface branch from 3892f4e to 4b513b3 Compare April 28, 2025 10:00
let args = [test_account.keys.ivpk_m.inner.x, test_account.keys.ivpk_m.inner.y];
let _ = context.call_private_function(address, selector, args);

cheatcodes::advance_blocks_by(1);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sneaking this fix in as it's better after and is not required above.

? Math.min(limit, Math.max((await this.store.getProvenL2BlockNumber()) - from + 1, 0))
: limit;
return limitWithProven === 0 ? [] : await this.store.getBlocks(from, limitWithProven);
return limitWithProven === 0 ? [] : await this.store.getPublishedBlocks(from, limitWithProven);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This renaming is done to let txe archiver extend the archiver data store due to types. I feel like it's okay because the naming better reflects what it actually does now.

* store would need to include otherwise while exposing fewer functions and logic directly to the archiver.
*/
class ArchiverStoreHelper
export class ArchiverStoreHelper

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exported to allow imported from txe


getChainId(): Promise<Fr> {
return Promise.resolve(this.node.getChainId().then(id => new Fr(id)));
return Promise.resolve(new Fr(this.CHAIN_ID));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sneaking this fix in

@sklppy88 sklppy88 marked this pull request as ready for review April 28, 2025 10:09
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch 2 times, most recently from c1e8135 to 7e35402 Compare April 28, 2025 10:43
Base automatically changed from ek/fix/global-variable-builder-correct-interface to master April 28, 2025 13:38
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch from 7e35402 to 9516fc1 Compare April 28, 2025 13:40
"@aztec/archiver": "workspace:^",
"@aztec/aztec-node": "workspace:^",
"@aztec/aztec.js": "workspace:^",
"@aztec/bb-prover": "workspace:^",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this dep needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good eye, I think though I'm importing import { TestCircuitVerifier } from '@aztec/bb-prover/test'; when creating the node, so unfortunately yes :/

@Thunkar Thunkar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, but I would check with someone from alpha-team for the archiver refactor!

@sklppy88 sklppy88 requested a review from alexghr April 29, 2025 09:13
@sklppy88

Copy link
Copy Markdown
Contributor Author

LGTM, but I would check with someone from alpha-team for the archiver refactor!

Thanks, good idea ! Have requested a review from @alexghr 🙏

@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch from 0a2a966 to 62877a7 Compare May 1, 2025 10:55
@sklppy88 sklppy88 force-pushed the ek/feat/13221/txe-state-machine branch from 62877a7 to 5afa42c Compare May 1, 2025 10:58
import { convertToMultiaddr, createLibP2PPeerIdFromPrivateKey } from '../util.js';
import { setAztecEnrKey } from '../versioning.js';

export { ENR };

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exported this so downstream I have access to it without having to install ENR


const stateMachine = await TXEStateMachine.create(store);
const syncDataProvider = stateMachine.syncDataProvider;
const nativeWorldStateService = stateMachine.synchronizer.nativeWorldStateService;

@sklppy88 sklppy88 May 1, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's done this way to maintain backwards compatibility / minimize changes needed in this PR

@sklppy88 sklppy88 added this pull request to the merge queue May 1, 2025
Merged via the queue into master with commit e032787 May 1, 2025
@sklppy88 sklppy88 deleted the ek/feat/13221/txe-state-machine branch May 1, 2025 12:29
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.

2 participants