-
Notifications
You must be signed in to change notification settings - Fork 615
feat: add api for inclusion proof of outgoing message in block #4562 #4899
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
Merged
Changes from 28 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
b98035d
initial
c28bfe1
Fix
49b21ea
fix
60a74df
Fix
a7ddb10
test
0eb9bff
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
sklppy88 938bd24
Fix
af62933
yarn fmt
b3bcbef
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
sklppy88 7d07e45
test
07ffed2
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
sklppy88 8c78f29
fix
537746c
fix
23dcd71
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
sklppy88 cc0c9db
fix
a8645ed
Fix
4733842
formatting
63d5c1e
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
sklppy88 a5c4a45
comment
18e0373
comment
65b767b
add outbox to test
0649e1e
why
3b23aba
test
5cc60d8
fix test
1ecf545
yarn format
262d12f
add index
8e90550
fix test
8d505f0
yarn fmt
b5deb10
addressing comments
49a52e4
add comment
8951eab
adf
88b78f3
fix test finally
3c718ee
Update yarn-project/aztec-node/src/aztec-node/server.ts
sklppy88 46bfb8a
comments
389f9f5
fix
822b34a
Merge remote-tracking branch 'origin/ek/feat/l2-to-l1-message-inclusi…
3d6f4b1
comments
9a8e5e8
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
sklppy88 ba37adb
Merge branch 'master' into ek/feat/l2-to-l1-message-inclusion-api
ddbd6d0
try this
8d27808
test
0726c84
asdf
94ab391
test
8e0c88e
asdf
3b8c350
test
ed4227a
test
1115877
fix
25f3ae4
fix comment
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { AccountWalletWithPrivateKey, AztecNode, EthAddress, Fr, SiblingPath } from '@aztec/aztec.js'; | ||
| import { SHA256 } from '@aztec/merkle-tree'; | ||
| import { TestContract } from '@aztec/noir-contracts.js'; | ||
|
|
||
| import { beforeEach, describe, expect, it } from '@jest/globals'; | ||
|
|
||
| import { setup } from './fixtures/utils.js'; | ||
|
|
||
| describe('E2E Outbox Tests', () => { | ||
|
sklppy88 marked this conversation as resolved.
|
||
| let teardown: () => void; | ||
| let aztecNode: AztecNode; | ||
| const sha256 = new SHA256(); | ||
| let contract: TestContract; | ||
| let wallets: AccountWalletWithPrivateKey[]; | ||
|
|
||
| beforeEach(async () => { | ||
| ({ teardown, aztecNode, wallets } = await setup(1)); | ||
|
|
||
| const receipt = await TestContract.deploy(wallets[0]).send().wait(); | ||
| contract = receipt.contract; | ||
| }, 100_000); | ||
|
|
||
| afterAll(() => teardown()); | ||
|
|
||
| it('Inserts a new out message, and verifies sibling paths of both the new message, and its zeroed sibling', async () => { | ||
| const { blockNumber } = await contract.methods | ||
| .create_l2_to_l1_message_arbitrary_recipient_public(42069, EthAddress.ZERO) | ||
| .send() | ||
| .wait(); | ||
|
|
||
| const block = await aztecNode.getBlock(blockNumber!); | ||
|
|
||
| const l2ToL1Messages = block?.body.txEffects.flatMap(txEffect => | ||
| txEffect.l2ToL1Msgs.map(l2ToL1Message => l2ToL1Message.toBuffer()), | ||
| ); | ||
|
|
||
| const [, siblingPath] = await aztecNode.getL2ToL1MessageIndexAndSiblingPath(blockNumber!, Fr.ZERO); | ||
|
|
||
| expect(siblingPath.pathSize).toBe(2); | ||
|
|
||
| const expectedSiblingPath = new SiblingPath(siblingPath.pathSize, [ | ||
| l2ToL1Messages![0], | ||
| sha256.hash(Fr.ZERO.toBuffer(), Fr.ZERO.toBuffer()), | ||
| ]); | ||
|
|
||
| expect(siblingPath.toString()).toBe(expectedSiblingPath.toString()); | ||
|
|
||
| const [, siblingPathAlt] = await aztecNode.getL2ToL1MessageIndexAndSiblingPath( | ||
| blockNumber!, | ||
| Fr.fromBuffer(l2ToL1Messages![0]), | ||
| ); | ||
|
|
||
| expect(siblingPathAlt.pathSize).toBe(2); | ||
|
|
||
| const expectedSiblingPathAlt = new SiblingPath(siblingPath.pathSize, [ | ||
| Fr.ZERO.toBuffer(), | ||
| sha256.hash(Fr.ZERO.toBuffer(), Fr.ZERO.toBuffer()), | ||
| ]); | ||
|
|
||
| expect(siblingPathAlt.toString()).toBe(expectedSiblingPathAlt.toString()); | ||
|
sklppy88 marked this conversation as resolved.
Outdated
|
||
| }, 360_000); | ||
| }); | ||
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,25 @@ | ||
| import { sha256 } from '@aztec/foundation/crypto'; | ||
| import { Hasher } from '@aztec/types/interfaces'; | ||
|
|
||
| /** | ||
| * A helper class encapsulating SHA256 hash functionality. | ||
| * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific | ||
| * purposes. | ||
| */ | ||
| export class SHA256 implements Hasher { | ||
| /* | ||
| * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific | ||
| * purposes. | ||
| */ | ||
| public hash(lhs: Uint8Array, rhs: Uint8Array): Buffer { | ||
| return sha256(Buffer.concat([Buffer.from(lhs), Buffer.from(rhs)])); | ||
| } | ||
|
|
||
| /* | ||
| * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific | ||
| * purposes. | ||
| */ | ||
| public hashInputs(inputs: Buffer[]): Buffer { | ||
| return sha256(Buffer.concat(inputs)); | ||
| } | ||
| } |
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.