-
Notifications
You must be signed in to change notification settings - Fork 597
feat(val): reex #9768
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
Merged
+525
−80
Merged
feat(val): reex #9768
Changes from all commits
Commits
Show all changes
170 commits
Select commit
Hold shift + click to select a range
b51e908
feat: cleanup publisher
LHerskind da2eb7a
refactor: get rid of timetraveler from l1-publisher
LHerskind 3388966
feat: revert if timestamp in future
LHerskind 13a60a3
feat: including txhashes explicitly in the rollup attestations
Maddiaa0 86026f2
temp
Maddiaa0 f3eac5b
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 fc7a04a
temp
Maddiaa0 9eed298
temp
Maddiaa0 cc09455
temp
Maddiaa0 06f950f
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 4727cd9
temp: get passing with txhash payloads
Maddiaa0 b4c2a46
fix: make sure transactions are available in the tx pool
Maddiaa0 4a8d178
chore: remove logs
Maddiaa0 b4324fc
fmt
Maddiaa0 052641a
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 a803a94
🪿
Maddiaa0 164c117
chore: validator tests
Maddiaa0 27da59d
Add timeouts to individual reqresp connections
Maddiaa0 9e7d2d8
fix
Maddiaa0 3c8e1b9
chore: include tests for specific error messages
Maddiaa0 9a738e5
fmt
Maddiaa0 c10260c
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 045af5a
clean
Maddiaa0 73d26ec
🧹
Maddiaa0 d358228
chore: fix sequencing tests
Maddiaa0 4b31953
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 2f82a8f
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 f673593
fmt
Maddiaa0 a15ab17
fmt
Maddiaa0 2e3f80b
fmt solidity
Maddiaa0 ae2a05e
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 5734006
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 1bde1fe
fix: test hash
Maddiaa0 c775b26
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 7a50a2b
exp: adjust test nodes
Maddiaa0 72f98bd
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 998f38c
chore: add reqresp configuration values to p2p config
Maddiaa0 1c2b151
fix: use abi.encode vs encodePacked
Maddiaa0 e6e7f6b
fix
Maddiaa0 6f417fc
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 cde6283
fix: merge fix
Maddiaa0 8290c99
fmt
Maddiaa0 b13ca93
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 1452017
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 120c9a3
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 b189270
feat: initial rate limiter impl
Maddiaa0 9b90fe1
Merge branch 'master' into md/09-06-add_timeouts_to_individual_reqres…
Maddiaa0 b7d815f
Merge branch 'md/09-06-add_timeouts_to_individual_reqresp_connections…
Maddiaa0 97a6a14
feat: tests + documentation
Maddiaa0 0e22558
test: add to reqresp.test.ts
Maddiaa0 b464dcf
Merge branch 'master' into md/add-rate-limits-to-reqresp-peers
Maddiaa0 d0da214
fix: add todo pr number
Maddiaa0 2b46268
feat: introduce new light signer
Maddiaa0 65d009a
chore: migrations
Maddiaa0 69aa4a0
chore: proliferate
Maddiaa0 d109853
chore: remove signature lib from leonidas
Maddiaa0 d3cf4b8
fmt
Maddiaa0 dc06395
Merge branch 'master' into md/replace-viem-in-validator
Maddiaa0 d762096
fmt + fix test
Maddiaa0 afb46ca
fmt
Maddiaa0 37929f5
document secp256 helpers
Maddiaa0 1cb6687
clean
Maddiaa0 62b7c72
clean
Maddiaa0 421470e
fix: validator pk validation
Maddiaa0 f0f87a4
fix: reinstante eip712
Maddiaa0 40303d0
Merge branch 'master' into md/replace-viem-in-validator
Maddiaa0 7a33bef
refactor: remove multiple public dbs
Maddiaa0 9ec4fb1
fix
Maddiaa0 6f35ee8
fix
Maddiaa0 2e80f83
chore: make phase manager less noisy
Maddiaa0 3927ab9
feat: add re-ex to validator config
Maddiaa0 c80af0e
chore: rename header in avm to historicalHeader
Maddiaa0 d204f9d
Merge branch 'master' into md/validator-re-ex
Maddiaa0 e5377b3
temp
Maddiaa0 6931bdc
Merge branch 'master' into md/validator-re-ex
Maddiaa0 4c6a2d3
feat: validator's sync then re-ex
Maddiaa0 a7124ae
add: reex test
Maddiaa0 7f927f9
use spam contract to test re-ex
Maddiaa0 31e53c8
Merge branch 'master' into md/validator-re-ex
Maddiaa0 4023746
temp
Maddiaa0 a7416ad
temp
Maddiaa0 c848c89
feat: snapshotting for e2e p2p tests
Maddiaa0 c55bb14
fmt
Maddiaa0 b678b89
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 d72ee95
fix
Maddiaa0 3342623
fmt
Maddiaa0 08398c3
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 871a319
fix
Maddiaa0 20730dc
fix
Maddiaa0 b12f81f
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 481537e
fix: enable additional params in e2e tests
Maddiaa0 f4ab1bd
fix: e2e_test script
Maddiaa0 0c26bf3
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 a6ca6c7
chore: use new snapshotting infra
Maddiaa0 af95b82
fix: wait on validator deploymnets
Maddiaa0 500ab6f
temp
Maddiaa0 638c9bb
Merge branch 'master' into md/validator-re-ex
Maddiaa0 50e3ba7
fix: reex with nested calls
Maddiaa0 bd2d765
fmt
Maddiaa0 049fb75
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 c6056cf
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 6f0aaea
clean
Maddiaa0 5c50f07
fix: anvil failures issue
Maddiaa0 01e8eca
fmt
Maddiaa0 295ef75
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 863457c
bump number of nodes in reqresp test
Maddiaa0 294ed73
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 e416dd4
fix
Maddiaa0 9726085
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 e653028
chore: further testing
Maddiaa0 bebea79
fmt
Maddiaa0 58861dc
chore: restore tx validator
Maddiaa0 367ae2e
fix: dependency cycle in circuits.js
Maddiaa0 8da85d4
fix: yarn prepare
Maddiaa0 7fd3b4f
nargo fmt
Maddiaa0 2f54025
chore: revert header changes
Maddiaa0 cde3d51
fmt
Maddiaa0 e1b8f88
remove processor
Maddiaa0 65260e7
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 0a591c3
feat: re-ex with shared block building logic
Maddiaa0 29c80ab
fmt test
Maddiaa0 6c1ef2e
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 f74945c
fmt
Maddiaa0 1202cd4
fix: remove duplicate
Maddiaa0 9ad8bac
fix: remove simulator from validator deps
Maddiaa0 0fd38f5
fix: clean
Maddiaa0 682539d
fix: reenable "flakey" p2p tests
Maddiaa0 8151e7b
fix: add e2e p2p to test config
Maddiaa0 b3f7f2c
chore: run cluster with reex
Maddiaa0 d7dec72
fix: validator script
Maddiaa0 22eab85
fix
Maddiaa0 d77b1f4
run seperately
Maddiaa0 1748069
fix: extend allowlist to matching prefixes
Maddiaa0 dbe9432
fix: shorten reqresp test name
Maddiaa0 4e76f7e
reex by default
Maddiaa0 f3fd818
fix fmt
Maddiaa0 fccfb7a
Merge branch 'md/re-enable-p2p' into md/dumb-re-ex
Maddiaa0 730803a
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 fe62a9f
fix: simplify matching script
Maddiaa0 028c637
fix: simplify labels
Maddiaa0 80db367
fix: sync to immediate block
Maddiaa0 1fac13d
Merge branch 'master' into md/re-enable-p2p
Maddiaa0 391899a
fmt
Maddiaa0 c31ea1d
Merge branch 'md/re-enable-p2p' into md/dumb-re-ex
Maddiaa0 dc82880
fix: add reex test
Maddiaa0 a912ecd
fix: pr comments, re-ex rejection test
Maddiaa0 037a79d
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 622fde4
fix: do not abbreviate reex
Maddiaa0 5eee7ea
fix
Maddiaa0 82f3946
fmt
Maddiaa0 108298b
fix
Maddiaa0 dd81a42
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 91c5f4d
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 2c997ed
merge fix
Maddiaa0 3779488
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 4649808
fmt
Maddiaa0 56237ed
fix: logging change
Maddiaa0 15a20d8
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 78f879c
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 f97ce86
fix: merge fix
Maddiaa0 19e17cc
fix: boxes
Maddiaa0 a040102
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 205e03b
fix: prover-agent.yaml syntax
ludamad 66328f0
try to fix kind test runner
ludamad ca52e6d
Update ci.yml
ludamad b147e86
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 87dae4b
fix
Maddiaa0 36dd9d5
Revert "Update ci.yml"
Maddiaa0 2620c83
Revert "try to fix kind test runner"
Maddiaa0 dab2406
Merge branch 'master' into md/dumb-re-ex
Maddiaa0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| import { type AztecNodeService } from '@aztec/aztec-node'; | ||
| import { type SentTx, sleep } from '@aztec/aztec.js'; | ||
|
|
||
| /* eslint-disable-next-line no-restricted-imports */ | ||
| import { BlockProposal, SignatureDomainSeperator, getHashedSignaturePayload } from '@aztec/circuit-types'; | ||
|
|
||
| import { beforeAll, describe, it, jest } from '@jest/globals'; | ||
| import fs from 'fs'; | ||
|
|
||
| import { createNodes } from '../fixtures/setup_p2p_test.js'; | ||
| import { P2PNetworkTest } from './p2p_network.js'; | ||
| import { submitComplexTxsTo } from './shared.js'; | ||
|
|
||
| const NUM_NODES = 4; | ||
| const NUM_TXS_PER_NODE = 1; | ||
| const BOOT_NODE_UDP_PORT = 41000; | ||
|
|
||
| const DATA_DIR = './data/re-ex'; | ||
|
|
||
| describe('e2e_p2p_reex', () => { | ||
| let t: P2PNetworkTest; | ||
| let nodes: AztecNodeService[]; | ||
|
|
||
| beforeAll(async () => { | ||
| nodes = []; | ||
|
|
||
| t = await P2PNetworkTest.create({ | ||
| testName: 'e2e_p2p_reex', | ||
| numberOfNodes: NUM_NODES, | ||
| basePort: BOOT_NODE_UDP_PORT, | ||
| }); | ||
|
|
||
| t.logger.verbose('Setup account'); | ||
| await t.setupAccount(); | ||
|
|
||
| t.logger.verbose('Deploy spam contract'); | ||
| await t.deploySpamContract(); | ||
|
|
||
| t.logger.verbose('Apply base snapshots'); | ||
| await t.applyBaseSnapshots(); | ||
|
|
||
| t.logger.verbose('Setup nodes'); | ||
| await t.setup(); | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| // shutdown all nodes. | ||
| await t.stopNodes(nodes); | ||
| await t.teardown(); | ||
| for (let i = 0; i < NUM_NODES; i++) { | ||
| fs.rmSync(`${DATA_DIR}-${i}`, { recursive: true, force: true }); | ||
| } | ||
| }); | ||
|
|
||
| it('validators should re-execute transactions before attesting', async () => { | ||
| // create the bootstrap node for the network | ||
| if (!t.bootstrapNodeEnr) { | ||
| throw new Error('Bootstrap node ENR is not available'); | ||
| } | ||
|
|
||
| t.ctx.aztecNodeConfig.validatorReexecute = true; | ||
|
|
||
| nodes = await createNodes( | ||
| t.ctx.aztecNodeConfig, | ||
| t.peerIdPrivateKeys, | ||
| t.bootstrapNodeEnr, | ||
| NUM_NODES, | ||
| BOOT_NODE_UDP_PORT, | ||
| ); | ||
|
|
||
| // Hook into the node and intercept re-execution logic, ensuring that it was infact called | ||
| const reExecutionSpies = []; | ||
| for (const node of nodes) { | ||
| // Make sure the nodes submit faulty proposals, in this case a faulty proposal is one where we remove one of the transactions | ||
| // Such that the calculated archive will be different! | ||
| jest.spyOn((node as any).p2pClient, 'broadcastProposal').mockImplementation(async (...args: unknown[]) => { | ||
| // We remove one of the transactions, therefore the block root will be different! | ||
| const proposal = args[0] as BlockProposal; | ||
| const { txHashes } = proposal.payload; | ||
|
|
||
| // We need to mutate the proposal, so we cast to any | ||
| (proposal.payload as any).txHashes = txHashes.slice(0, txHashes.length - 1); | ||
|
|
||
| // We sign over the proposal using the node's signing key | ||
| // Abusing javascript to access the nodes signing key | ||
| const signer = (node as any).sequencer.sequencer.validatorClient.validationService.keyStore; | ||
| const newProposal = new BlockProposal( | ||
| proposal.payload, | ||
| await signer.signMessage(getHashedSignaturePayload(proposal.payload, SignatureDomainSeperator.blockProposal)), | ||
| ); | ||
|
|
||
| return (node as any).p2pClient.p2pService.propagate(newProposal); | ||
| }); | ||
|
|
||
| // Store re-execution spys node -> sequencer Client -> seqeuncer -> validator | ||
| const spy = jest.spyOn((node as any).sequencer.sequencer.validatorClient, 'reExecuteTransactions'); | ||
| reExecutionSpies.push(spy); | ||
| } | ||
|
|
||
| // wait a bit for peers to discover each other | ||
| await sleep(4000); | ||
|
|
||
| nodes.forEach(node => { | ||
| node.getSequencer()?.updateSequencerConfig({ | ||
| minTxsPerBlock: NUM_TXS_PER_NODE, | ||
| maxTxsPerBlock: NUM_TXS_PER_NODE, | ||
| }); | ||
| }); | ||
| const txs = await submitComplexTxsTo(t.logger, t.spamContract!, NUM_TXS_PER_NODE); | ||
|
|
||
| // We ensure that the transactions are NOT mined | ||
| try { | ||
| await Promise.all( | ||
| txs.map(async (tx: SentTx, i: number) => { | ||
| t.logger.info(`Waiting for tx ${i}: ${await tx.getTxHash()} to be mined`); | ||
| return tx.wait(); | ||
| }), | ||
| ); | ||
| } catch (e) { | ||
| t.logger.info('Failed to mine all txs, as planned'); | ||
| } | ||
|
|
||
| // Expect that all of the re-execution attempts failed with an invalid root | ||
| for (const spy of reExecutionSpies) { | ||
| for (const result of spy.mock.results) { | ||
| await expect(result.value).rejects.toThrow('Validator Error: Re-execution state mismatch'); | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ export class LightweightBlockBuilder implements BlockBuilder { | |
| constructor(private db: MerkleTreeWriteOperations, private telemetry: TelemetryClient) {} | ||
|
|
||
| async startNewBlock(numTxs: number, globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void> { | ||
| this.logger.verbose('Starting new block', { numTxs, globalVariables, l1ToL2Messages }); | ||
| this.logger.verbose('Starting new block', { numTxs, globalVariables: globalVariables.toJSON(), l1ToL2Messages }); | ||
|
Collaborator
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. 👍 |
||
| this.numTxs = numTxs; | ||
| this.globalVariables = globalVariables; | ||
| this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP); | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.