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: zip and silo and propagate private logs #10308

Merged
merged 35 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
69d6c90
Propagate private logs.
LeilaWang Nov 18, 2024
52b284a
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 19, 2024
433be33
Remake constants.
LeilaWang Nov 20, 2024
f16ea61
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 20, 2024
bf08d3e
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 20, 2024
41166f8
Silo first field of log payload.
LeilaWang Nov 25, 2024
eb3ee10
Changes in ts.
LeilaWang Nov 25, 2024
92575e4
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 25, 2024
6b4c09b
Fix.
LeilaWang Nov 26, 2024
e8ea051
Update fixtures.
LeilaWang Nov 26, 2024
1c605c3
Update TxDecoder.
LeilaWang Nov 26, 2024
b783f0c
fmt
LeilaWang Nov 26, 2024
1fa001a
Fix.
LeilaWang Nov 26, 2024
7c1d952
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 26, 2024
942258a
Fix.
LeilaWang Nov 26, 2024
6d048b4
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 26, 2024
93f383d
Fix.
LeilaWang Nov 27, 2024
18b3d9f
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 27, 2024
858a014
Update gas meter.
LeilaWang Nov 27, 2024
9be351a
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 27, 2024
37323e3
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 27, 2024
eb95040
Fix.
LeilaWang Nov 27, 2024
f2912ff
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 27, 2024
a5475df
Fix.
LeilaWang Nov 27, 2024
e4c6133
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 27, 2024
3a58469
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 27, 2024
d2a7840
Increase anvil gas limit.
LeilaWang Nov 28, 2024
a5a6155
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 28, 2024
22cb75a
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 28, 2024
4749e2d
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 28, 2024
67af47b
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 28, 2024
79299f5
Update comments.
LeilaWang Nov 28, 2024
f5a8d84
Fix.
LeilaWang Nov 28, 2024
240ec0e
Merge remote-tracking branch 'origin/master' into lw/private_logs
LeilaWang Nov 28, 2024
09ce48b
Reduce max private logs per tx.
LeilaWang Nov 29, 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
Prev Previous commit
Next Next commit
Fix.
  • Loading branch information
LeilaWang committed Nov 28, 2024
commit f5a8d84d9a2b805867fff053e1738810e3322c7b
37 changes: 19 additions & 18 deletions yarn-project/end-to-end/src/e2e_event_logs.test.ts
Original file line number Diff line number Diff line change
@@ -85,43 +85,44 @@ describe('Logs', () => {
});

it('emits multiple events as encrypted logs and decodes them', async () => {
const preimage = makeTuple(5, makeTuple.bind(undefined, 4, Fr.random)) as Tuple<Tuple<Fr, 4>, 5>;
const preimages = makeTuple(5, makeTuple.bind(undefined, 4, Fr.random)) as Tuple<Tuple<Fr, 4>, 5>;

const txs = await Promise.all(
[...new Array(5)].map((_, i) =>
testLogContract.methods.emit_encrypted_events(wallets[1].getAddress(), preimage[i]).send().wait(),
preimages.map(preimage =>
testLogContract.methods.emit_encrypted_events(wallets[1].getAddress(), preimage).send().wait(),
),
);
const firstTx = txs[0];
const lastTx = txs[txs.length - 1];
const firstBlockNumber = Math.min(...txs.map(tx => tx.blockNumber!));
const lastBlockNumber = Math.max(...txs.map(tx => tx.blockNumber!));
const numBlocks = lastBlockNumber - firstBlockNumber + 1;

// We get all the events we can decrypt with either our incoming or outgoing viewing keys

const collectedEvent0s = await wallets[0].getEncryptedEvents<ExampleEvent0>(
TestLogContract.events.ExampleEvent0,
firstTx.blockNumber!,
lastTx.blockNumber! - firstTx.blockNumber! + 1,
firstBlockNumber,
numBlocks,
);

const collectedEvent0sWithIncoming = await wallets[0].getEncryptedEvents<ExampleEvent0>(
TestLogContract.events.ExampleEvent0,
firstTx.blockNumber!,
lastTx.blockNumber! - firstTx.blockNumber! + 1,
firstBlockNumber,
numBlocks,
// This function can be called specifying the viewing public keys associated with the encrypted event.
[wallets[0].getCompleteAddress().publicKeys.masterIncomingViewingPublicKey],
);

const collectedEvent0sWithOutgoing = await wallets[0].getEncryptedEvents<ExampleEvent0>(
TestLogContract.events.ExampleEvent0,
firstTx.blockNumber!,
lastTx.blockNumber! - firstTx.blockNumber! + 1,
firstBlockNumber,
numBlocks,
[wallets[0].getCompleteAddress().publicKeys.masterOutgoingViewingPublicKey],
);

const collectedEvent1s = await wallets[0].getEncryptedEvents<ExampleEvent1>(
TestLogContract.events.ExampleEvent1,
firstTx.blockNumber!,
lastTx.blockNumber! - firstTx.blockNumber! + 1,
firstBlockNumber,
numBlocks,
[wallets[0].getCompleteAddress().publicKeys.masterIncomingViewingPublicKey],
);

@@ -132,22 +133,22 @@ describe('Logs', () => {

const emptyEvent1s = await wallets[0].getEncryptedEvents<ExampleEvent1>(
TestLogContract.events.ExampleEvent1,
firstTx.blockNumber!,
lastTx.blockNumber! - firstTx.blockNumber! + 1,
firstBlockNumber,
numBlocks,
[wallets[0].getCompleteAddress().publicKeys.masterOutgoingViewingPublicKey],
);

expect(emptyEvent1s.length).toBe(0);

const exampleEvent0Sort = (a: ExampleEvent0, b: ExampleEvent0) => (a.value0 > b.value0 ? 1 : -1);
expect(collectedEvent0sWithIncoming.sort(exampleEvent0Sort)).toStrictEqual(
preimage
preimages
.map(preimage => ({ value0: preimage[0].toBigInt(), value1: preimage[1].toBigInt() }))
.sort(exampleEvent0Sort),
);

expect(collectedEvent0sWithOutgoing.sort(exampleEvent0Sort)).toStrictEqual(
preimage
preimages
.map(preimage => ({ value0: preimage[0].toBigInt(), value1: preimage[1].toBigInt() }))
.sort(exampleEvent0Sort),
);
@@ -158,7 +159,7 @@ describe('Logs', () => {

const exampleEvent1Sort = (a: ExampleEvent1, b: ExampleEvent1) => (a.value2 > b.value2 ? 1 : -1);
expect(collectedEvent1s.sort(exampleEvent1Sort)).toStrictEqual(
preimage
preimages
.map(preimage => ({
value2: new AztecAddress(preimage[2]),
// We get the last byte here because value3 is of type u8