Skip to content
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

feat(vc): re-execution before attestation #8958

Closed
wants to merge 117 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
b51e908
feat: cleanup publisher
LHerskind Aug 22, 2024
da2eb7a
refactor: get rid of timetraveler from l1-publisher
LHerskind Aug 28, 2024
3388966
feat: revert if timestamp in future
LHerskind Aug 28, 2024
13a60a3
feat: including txhashes explicitly in the rollup attestations
Maddiaa0 Aug 29, 2024
86026f2
temp
Maddiaa0 Aug 30, 2024
f3eac5b
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Aug 30, 2024
fc7a04a
temp
Maddiaa0 Aug 30, 2024
9eed298
temp
Maddiaa0 Sep 2, 2024
cc09455
temp
Maddiaa0 Sep 2, 2024
06f950f
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 2, 2024
4727cd9
temp: get passing with txhash payloads
Maddiaa0 Sep 3, 2024
b4c2a46
fix: make sure transactions are available in the tx pool
Maddiaa0 Sep 5, 2024
4a8d178
chore: remove logs
Maddiaa0 Sep 5, 2024
b4324fc
fmt
Maddiaa0 Sep 5, 2024
052641a
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 5, 2024
a803a94
🪿
Maddiaa0 Sep 5, 2024
164c117
chore: validator tests
Maddiaa0 Sep 6, 2024
27da59d
Add timeouts to individual reqresp connections
Maddiaa0 Sep 6, 2024
9e7d2d8
fix
Maddiaa0 Sep 6, 2024
3c8e1b9
chore: include tests for specific error messages
Maddiaa0 Sep 6, 2024
9a738e5
fmt
Maddiaa0 Sep 6, 2024
c10260c
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 6, 2024
045af5a
clean
Maddiaa0 Sep 6, 2024
73d26ec
🧹
Maddiaa0 Sep 6, 2024
d358228
chore: fix sequencing tests
Maddiaa0 Sep 7, 2024
4b31953
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 7, 2024
2f82a8f
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 Sep 7, 2024
f673593
fmt
Maddiaa0 Sep 7, 2024
a15ab17
fmt
Maddiaa0 Sep 7, 2024
2e3f80b
fmt solidity
Maddiaa0 Sep 7, 2024
ae2a05e
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 Sep 7, 2024
5734006
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 7, 2024
1bde1fe
fix: test hash
Maddiaa0 Sep 8, 2024
c775b26
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 Sep 8, 2024
7a50a2b
exp: adjust test nodes
Maddiaa0 Sep 8, 2024
72f98bd
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 Sep 8, 2024
998f38c
chore: add reqresp configuration values to p2p config
Maddiaa0 Sep 8, 2024
1c2b151
fix: use abi.encode vs encodePacked
Maddiaa0 Sep 11, 2024
e6e7f6b
fix
Maddiaa0 Sep 11, 2024
6f417fc
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 11, 2024
cde6283
fix: merge fix
Maddiaa0 Sep 11, 2024
8290c99
fmt
Maddiaa0 Sep 11, 2024
b13ca93
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 Sep 11, 2024
1452017
Merge branch 'master' into md/check-tx-requests-before-signing
Maddiaa0 Sep 11, 2024
120c9a3
Merge branch 'md/check-tx-requests-before-signing' into md/09-06-add_…
Maddiaa0 Sep 11, 2024
b189270
feat: initial rate limiter impl
Maddiaa0 Sep 11, 2024
9b90fe1
Merge branch 'master' into md/09-06-add_timeouts_to_individual_reqres…
Maddiaa0 Sep 11, 2024
b7d815f
Merge branch 'md/09-06-add_timeouts_to_individual_reqresp_connections…
Maddiaa0 Sep 11, 2024
97a6a14
feat: tests + documentation
Maddiaa0 Sep 11, 2024
0e22558
test: add to reqresp.test.ts
Maddiaa0 Sep 11, 2024
b464dcf
Merge branch 'master' into md/add-rate-limits-to-reqresp-peers
Maddiaa0 Sep 11, 2024
d0da214
fix: add todo pr number
Maddiaa0 Sep 11, 2024
2b46268
feat: introduce new light signer
Maddiaa0 Sep 12, 2024
65d009a
chore: migrations
Maddiaa0 Sep 12, 2024
69aa4a0
chore: proliferate
Maddiaa0 Sep 12, 2024
d109853
chore: remove signature lib from leonidas
Maddiaa0 Sep 12, 2024
d3cf4b8
fmt
Maddiaa0 Sep 12, 2024
dc06395
Merge branch 'master' into md/replace-viem-in-validator
Maddiaa0 Sep 13, 2024
d762096
fmt + fix test
Maddiaa0 Sep 13, 2024
afb46ca
fmt
Maddiaa0 Sep 13, 2024
37929f5
document secp256 helpers
Maddiaa0 Sep 13, 2024
1cb6687
clean
Maddiaa0 Sep 13, 2024
62b7c72
clean
Maddiaa0 Sep 13, 2024
421470e
fix: validator pk validation
Maddiaa0 Sep 16, 2024
f0f87a4
fix: reinstante eip712
Maddiaa0 Sep 16, 2024
40303d0
Merge branch 'master' into md/replace-viem-in-validator
Maddiaa0 Sep 16, 2024
7a33bef
refactor: remove multiple public dbs
Maddiaa0 Sep 16, 2024
9ec4fb1
fix
Maddiaa0 Sep 16, 2024
6f35ee8
fix
Maddiaa0 Sep 16, 2024
2e80f83
chore: make phase manager less noisy
Maddiaa0 Sep 16, 2024
3927ab9
feat: add re-ex to validator config
Maddiaa0 Sep 13, 2024
c80af0e
chore: rename header in avm to historicalHeader
Maddiaa0 Sep 20, 2024
d204f9d
Merge branch 'master' into md/validator-re-ex
Maddiaa0 Sep 20, 2024
e5377b3
temp
Maddiaa0 Sep 20, 2024
6931bdc
Merge branch 'master' into md/validator-re-ex
Maddiaa0 Sep 24, 2024
4c6a2d3
feat: validator's sync then re-ex
Maddiaa0 Sep 24, 2024
a7124ae
add: reex test
Maddiaa0 Sep 25, 2024
7f927f9
use spam contract to test re-ex
Maddiaa0 Sep 25, 2024
31e53c8
Merge branch 'master' into md/validator-re-ex
Maddiaa0 Sep 30, 2024
4023746
temp
Maddiaa0 Sep 30, 2024
a7416ad
temp
Maddiaa0 Sep 30, 2024
c848c89
feat: snapshotting for e2e p2p tests
Maddiaa0 Sep 30, 2024
c55bb14
fmt
Maddiaa0 Sep 30, 2024
b678b89
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 Oct 1, 2024
d72ee95
fix
Maddiaa0 Oct 1, 2024
3342623
fmt
Maddiaa0 Oct 1, 2024
08398c3
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 Oct 1, 2024
871a319
fix
Maddiaa0 Oct 1, 2024
20730dc
fix
Maddiaa0 Oct 1, 2024
b12f81f
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 Oct 1, 2024
481537e
fix: enable additional params in e2e tests
Maddiaa0 Oct 1, 2024
f4ab1bd
fix: e2e_test script
Maddiaa0 Oct 1, 2024
0c26bf3
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 Oct 1, 2024
a6ca6c7
chore: use new snapshotting infra
Maddiaa0 Oct 1, 2024
af95b82
fix: wait on validator deploymnets
Maddiaa0 Oct 1, 2024
500ab6f
temp
Maddiaa0 Oct 2, 2024
638c9bb
Merge branch 'master' into md/validator-re-ex
Maddiaa0 Oct 2, 2024
50e3ba7
fix: reex with nested calls
Maddiaa0 Oct 2, 2024
bd2d765
fmt
Maddiaa0 Oct 2, 2024
049fb75
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 Oct 2, 2024
c6056cf
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 Oct 2, 2024
6f0aaea
clean
Maddiaa0 Oct 2, 2024
5c50f07
fix: anvil failures issue
Maddiaa0 Oct 2, 2024
01e8eca
fmt
Maddiaa0 Oct 2, 2024
295ef75
Merge branch 'master' into md/e2e-p2p-snapshots
Maddiaa0 Oct 2, 2024
863457c
bump number of nodes in reqresp test
Maddiaa0 Oct 2, 2024
294ed73
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 Oct 2, 2024
e416dd4
fix
Maddiaa0 Oct 2, 2024
9726085
Merge branch 'md/e2e-p2p-snapshots' into md/validator-re-ex
Maddiaa0 Oct 2, 2024
e653028
chore: further testing
Maddiaa0 Oct 3, 2024
bebea79
fmt
Maddiaa0 Oct 3, 2024
58861dc
chore: restore tx validator
Maddiaa0 Oct 3, 2024
367ae2e
fix: dependency cycle in circuits.js
Maddiaa0 Oct 3, 2024
8da85d4
fix: yarn prepare
Maddiaa0 Oct 3, 2024
7fd3b4f
nargo fmt
Maddiaa0 Oct 3, 2024
2f54025
chore: revert header changes
Maddiaa0 Oct 3, 2024
cde3d51
fmt
Maddiaa0 Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion noir-projects/noir-contracts/contracts/spam_contract/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use dep::aztec::macros::aztec;
#[aztec]
contract Spam {

global MAX_EXTERNAL_CALL_SPAM = 4;

use dep::aztec::{
prelude::{Map, AztecAddress, PublicMutable},
encrypted_logs::{encrypted_note_emission::encode_and_encrypt_note_unconstrained},
Expand All @@ -29,7 +31,12 @@ contract Spam {
}

#[private]
fn spam(nullifier_seed: Field, nullifier_count: u32, call_public: bool) {
fn spam(
nullifier_seed: Field,
nullifier_count: u32,
call_public: bool,
call_recursive_spam: bool
) {
let caller = context.msg_sender();
let caller_keys = get_public_keys(caller);
let amount = U128::from_integer(1);
Expand Down Expand Up @@ -58,6 +65,10 @@ contract Spam {
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
).enqueue(&mut context);
}

if (call_recursive_spam) {
Spam::at(context.this_address()).public_spam_with_external_call(0, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL).enqueue(&mut context);
}
}

#[public]
Expand All @@ -69,4 +80,28 @@ contract Spam {
storage.public_balances.at(i as Field).write(prev + one);
}
}

// TODO(md): add something to the public spam such that we can test further enqueued calls
#[public]
#[internal]
fn public_spam_with_external_call(start: u32, end: u32) {
let one = U128::from_integer(1);
for i in start..end {
let prev = storage.public_balances.at(i as Field).read();
storage.public_balances.at(i as Field).write(prev + one);
}

Spam::at(context.this_address()).recursive_spam(0).call(&mut context);
}

#[public]
fn recursive_spam(counter: u32) {
let one = U128::from_integer(1);
if (counter < MAX_EXTERNAL_CALL_SPAM) {
let prev = storage.public_balances.at(counter as Field).read();
storage.public_balances.at(counter as Field).write(prev + one);

Spam::at(context.this_address()).recursive_spam(counter + 1).call(&mut context);
}
}
}
2 changes: 1 addition & 1 deletion yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class AztecNodeService implements AztecNode {

const simulationProvider = await createSimulationProvider(config, log);

const validatorClient = createValidatorClient(config, p2pClient);
const validatorClient = createValidatorClient(config, p2pClient, worldStateSynchronizer, archiver, telemetry);

// now create the sequencer
const sequencer = config.disableSequencer
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/circuits.js/src/hash/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Fr } from '@aztec/foundation/fields';
import { numToUInt8, numToUInt16BE, numToUInt32BE } from '@aztec/foundation/serialize';

import { GeneratorIndex } from '../constants.gen.js';
import { type ScopedL2ToL1Message, VerificationKey } from '../structs/index.js';
import { type ScopedL2ToL1Message } from '../structs/l2_to_l1_message.js';
import { VerificationKey } from '../structs/verification_key.js';

/**
* Computes a hash of a given verification key.
Expand Down
10 changes: 10 additions & 0 deletions yarn-project/circuits.js/src/structs/public_data_update_request.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { type AztecAddress } from '@aztec/foundation/aztec-address';
import { Fr } from '@aztec/foundation/fields';
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';

import { inspect } from 'util';

import { computePublicDataTreeLeafSlot } from '../hash/hash.js';
import { type ContractStorageUpdateRequest } from './contract_storage_update_request.js';

/**
* Write operations on the public data tree including the previous value.
*/
Expand Down Expand Up @@ -74,6 +78,12 @@ export class PublicDataUpdateRequest {
return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
}

static fromContractStorageUpdateRequest(contractAddress: AztecAddress, updateRequest: ContractStorageUpdateRequest) {
const leafSlot = computePublicDataTreeLeafSlot(contractAddress, updateRequest.storageSlot);

return new PublicDataUpdateRequest(leafSlot, updateRequest.newValue, updateRequest.counter);
}

static empty() {
return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ VERSION 0.8

e2e-p2p:
LOCALLY
RUN ./scripts/e2e_test.sh ./src/e2e_p2p_network.test.ts
RUN ./scripts/e2e_test.sh ./src/e2e_p2p/ --runInBand

e2e-l1-with-wall-time:
LOCALLY
Expand Down
6 changes: 4 additions & 2 deletions yarn-project/end-to-end/scripts/e2e_test.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/bash

# Usage: ./e2e_test.sh <test>
# Usage: ./e2e_test.sh <test> <...extra_args>
# Optional environment variables:
# HARDWARE_CONCURRENCY (default: "")

set -eu

# Main positional parameter
TEST="$1"
shift

# Default values for environment variables
HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}"
FAKE_PROOFS="${FAKE_PROOFS:-}"
Expand All @@ -18,4 +20,4 @@ if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotoco
exit 1
fi

docker run -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" -e FAKE_PROOFS="$FAKE_PROOFS" --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG "$TEST"
docker run -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" -e FAKE_PROOFS="$FAKE_PROOFS" --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG "$TEST" $@
76 changes: 76 additions & 0 deletions yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { type AztecNodeService } from '@aztec/aztec-node';
import { sleep } from '@aztec/aztec.js';

import fs from 'fs';

import { type NodeContext, createNodes } from '../fixtures/setup_p2p_test.js';
import { P2PNetworkTest, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { createPXEServiceAndSubmitTransactions } from './shared.js';

// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
const NUM_NODES = 4;
const NUM_TXS_PER_NODE = 2;
const BOOT_NODE_UDP_PORT = 40600;

const DATA_DIR = './data/gossip';

describe('e2e_p2p_network', () => {
let t: P2PNetworkTest;
let nodes: AztecNodeService[];

beforeEach(async () => {
t = await P2PNetworkTest.create('e2e_p2p_network', NUM_NODES, BOOT_NODE_UDP_PORT);
await t.applyBaseSnapshots();
await t.setup();
});

afterEach(async () => {
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('should rollup txs from all peers', async () => {
// create the bootstrap node for the network
if (!t.bootstrapNodeEnr) {
throw new Error('Bootstrap node ENR is not available');
}
// create our network of nodes and submit txs into each of them
// the number of txs per node and the number of txs per rollup
// should be set so that the only way for rollups to be built
// is if the txs are successfully gossiped around the nodes.
const contexts: NodeContext[] = [];
t.logger.info('Creating nodes');
nodes = await createNodes(
t.ctx.aztecNodeConfig,
t.peerIdPrivateKeys,
t.bootstrapNodeEnr,
NUM_NODES,
BOOT_NODE_UDP_PORT,
DATA_DIR,
);

// wait a bit for peers to discover each other
await sleep(4000);

t.logger.info('Submitting transactions');
for (const node of nodes) {
const context = await createPXEServiceAndSubmitTransactions(t.logger, node, NUM_TXS_PER_NODE);
contexts.push(context);
}

t.logger.info('Waiting for transactions to be mined');
// now ensure that all txs were successfully mined
await Promise.all(
contexts.flatMap((context, i) =>
context.txs.map(async (tx, j) => {
t.logger.info(`Waiting for tx ${i}-${j}: ${await tx.getTxHash()} to be mined`);
return tx.wait({ timeout: WAIT_FOR_TX_TIMEOUT });
}),
),
);
t.logger.info('All transactions mined');
});
});
Loading
Loading