Feat: sol-ts parity checks for decoder-encoder#412
Conversation
Maddiaa0
left a comment
There was a problem hiding this comment.
Some comments from a little onceover
| } | ||
| } | ||
|
|
||
| bytes shit_block = |
There was a problem hiding this comment.
Whoops, will remove 💩.
| "Invalid diff root" | ||
| ); | ||
| } | ||
| function testEmptyBlocks() public { |
There was a problem hiding this comment.
Nice refactor on this, looks alot nicer
| @@ -0,0 +1,19 @@ | |||
| // SPDX-License-Identifier: UNLICENSED | |||
| pragma solidity >=0.8.18; | |||
| @@ -0,0 +1,63 @@ | |||
| /** | |||
There was a problem hiding this comment.
rather than all of these files with bytecode copied and pasted, would we just be better off symlinking the artifacts like what was done in AC?
| await setTxHistoricTreeRoots(tx); | ||
|
|
||
| // Calculate what would be the tree roots after the txs from the first base rollup land and update mock circuit output | ||
| await updateExpectedTreesFromTxs(txsLeft); |
There was a problem hiding this comment.
this could be moved into a helper function as it shows up alot in other sequencer tests
| const decodedRes = await decodeHelper.methods.decode(block.encode()).call(); | ||
| const stateInRollup = await rollup.methods.rollupStateHash().call(); | ||
|
|
||
| // @note There seems to be something wrong here. The Bytes32 returned are actually strings :( |
| @@ -14,17 +38,38 @@ const anvilHost = process.env.ANVIL_HOST ?? 'http://127.0.0.1:8545'; | |||
| const chainId = 31337; | |||
|
|
|||
| describe.skip('L1Publisher integration', () => { | |||
There was a problem hiding this comment.
The tests were set as skipped before due to requiring an anvil instance running, which was not part of the setup. Maybe @ludamad got insights on better solution. Here simply replacing the old block publisher tests.
There was a problem hiding this comment.
This is a tech debt so I created a ticket for it. Would make sense to address this in separate PR.
|
|
||
| // Deploy Rollup and unverifiedDataEmitter contracts | ||
| const decodeHelper = new DecoderHelper(ethRpc, undefined, { from: deployer, gas: 1e6 }); | ||
| await decodeHelper.deploy().send().getReceipt(); |
There was a problem hiding this comment.
would rename decodeHelper to decoderHelper for consistency + please update the comment above.
| @@ -14,17 +38,38 @@ const anvilHost = process.env.ANVIL_HOST ?? 'http://127.0.0.1:8545'; | |||
| const chainId = 31337; | |||
|
|
|||
| describe.skip('L1Publisher integration', () => { | |||
There was a problem hiding this comment.
This is a tech debt so I created a ticket for it. Would make sense to address this in separate PR.
| this.getCalldataHash(), | ||
| ); | ||
| const temp = toBigIntBE(sha256(buf)); | ||
| const p = BigInt('21888242871839275222246405745257275088548364400416034343698204186575808495617'); |
There was a problem hiding this comment.
| const p = BigInt('21888242871839275222246405745257275088548364400416034343698204186575808495617'); | |
| // Prime order of BN254 curve | |
| const p = BigInt('21888242871839275222246405745257275088548364400416034343698204186575808495617'); |
| ) | ||
| dstOffset := add(dstOffset, mul(2, 0x20)) | ||
|
|
||
| // Kernel1.contract.aztecaddress |
There was a problem hiding this comment.
| // Kernel1.contract.aztecaddress | |
| // Kernel1.contract.aztecAddress |
| ) | ||
| dstOffset := add(dstOffset, 0x20) | ||
|
|
||
| // Kernel2.contract.aztecaddress |
There was a problem hiding this comment.
| // Kernel2.contract.aztecaddress | |
| // Kernel2.contract.aztecAddress |
| for (let i = 0; i < leafCount; i++) { | ||
| const commitmentPerBase = KERNEL_NEW_COMMITMENTS_LENGTH * 2; | ||
| const nullifierPerBase = KERNEL_NEW_NULLIFIERS_LENGTH * 2; | ||
| const publicDataWritesPerBase = STATE_TRANSITIONS_LENGTH * 2; // @note why is this constant named differently? |
There was a problem hiding this comment.
@note why is this constant named differently?
What name did you expect here?
There was a problem hiding this comment.
If you look at the commitments and nullifier constants you see that there are KERNEL_ prefix making it clear that this is per kernel, for STATE_TRANSITIONS_LENTGH it is not clear if per kernel, per rollup or whatever it is. Also that it is called STATE_TRANSITIONS here but public data writes other places, and state transition could also be the general one from StartStateHash to EndStateHash.
There was a problem hiding this comment.
Ok, good catch. In that case replacing STATE_TRANSITIONS with KERNEL_PUB_DATA_WRITES everywhere sounds good to me. It should probably be done in a separate PR but I don't really care if you do it in the same one. If you are too busy with other things I would have time to pick it up once we merge this.
There was a problem hiding this comment.
I can do it. Have one for L2 -> L1 stuff that right now is part of my other pr, but might be better to just have one with the naming 🤷
There was a problem hiding this comment.
@benesjan or @PhilWindle, is there both a function limit and a kernel limit, and do they differ? e.g., for new commitments, there are both a function limit and a kernel limit but the value is the same atm, but have you used the value as a function or kenel?
Description
Closes #272, #399 and #404
Updates computation of calldata hash, needs to be extended in native implementation as well to have parity between CPP, SOL and TS (see #413).
The calldata hash between CPP and (SOL/TS) will not hit parity until BB is fixed to make WASM and CPP use same generators for hash computations.
Checklist: