-
Notifications
You must be signed in to change notification settings - Fork 308
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
Add E2E calldataHash test (sol/ts/cpp) #431
Conversation
d1702c4
to
2a95d3a
Compare
circuits/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp
Show resolved
Hide resolved
@@ -183,7 +180,7 @@ TEST_F(root_rollup_tests, native_check_block_hashes_empty_blocks) | |||
EXPECT_FALSE(composer.failed()); | |||
|
|||
// Expected hash of public inputs for an empty L2 block. Also used in the contract tests. | |||
fr const expected_hash = uint256_t("11840efc30e9fcbdd0aae30da2a5b441132420b4f0cc4ffd6bdc41888845f775"); | |||
fr const expected_hash = uint256_t("23f698e487c4e1b7383889f8864bc19591773d136c364c01d980bd13d0786ba1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we recalculate this value? Is it viable to calculate it on the fly in the test instead of hardcoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its values from the l2-block-publisher.test.ts
, there to make sure that they are on par.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LHerskind please put there a comment that the value is from l2-block-publisher.test.ts
@@ -120,6 +120,43 @@ export class RootRollupPublicInputs { | |||
return new RootRollupPublicInputs(...RootRollupPublicInputs.getFields(fields)); | |||
} | |||
|
|||
static makeFake() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename to empty()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was my original name, but used makefake as it cointained the aggregation object that was named makefake so assumed there was a reason the underlying was not called empty and that it should convey that as well.
expect(l2Block.number).toEqual(blockNumber); | ||
expect(l2Block.getCalldataHash()).toEqual(rootRollupPublicInputs.sha256CalldataHash()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this check is the only reason why we're exposing the root rollup simulation output from the block builder, then I'd make it a responsibility of the block builder to make this check instead, and revert the change to its interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Cheethas and I spoke about it. Main annoyance with that it broke some tests, but probably better to fix those mocks anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goodbye StandaloneBlockBuilder, you served well!
We could use this opportunity to rename the circuit_block_builder to just block_builder. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please i beg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, what should we do with the interface? Currently there is a BlockBuilder interface, should we still keep that or just have the block builder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On interfaces, is there a reason we are not naming them starting on I
or similar, always have a headache looking through the code and not knowing if it is an interface or not before following it to the root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to SoloBlockBuilder as we will probably see the distributed block builder further down the road, and not having issues with interface and class having same name
// 8 commitments (4 per kernel) -> 8 fields | ||
// 8 nullifiers (4 per kernel) -> 8 fields | ||
// 8 public state transitions (4 per kernel) -> 16 fields | ||
// 2 contract deployments (1 per kernel) -> 6 fields | ||
std::array<NT::fr, 38> calldata_hash_inputs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this 38 could be derived out of constants in constants.hpp using constexprs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as long as we are not adding new types or anything but extending current lists should be fine.
return await makeProcessedTx(publicTx, kernelOutput, makeProof()); | ||
}; | ||
|
||
it('Build 2 blocks of 4 txs building on each other', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the actual block builder here, rather than manually assembling the block? Seems like it'd lead to less duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just good ol' debt.
615c7e2
to
8daacbe
Compare
7fab833
to
1ab7588
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just went through the comments from Santiago and Sean and they mostly seem sufficiently addressed. Once you address my comments feel free to merge it.
kernel_data[1].public_inputs.end.new_commitments[i] = fr(i + 4 + 1); | ||
std::vector<uint8_t> input_data = test_utils::utils::get_empty_calldata_leaf(); | ||
|
||
// Update commitment and nullifiers in kernels and testing byte array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Update commitment and nullifiers in kernels and testing byte array. | |
// Update commitments and nullifiers in kernels and testing byte array. |
|
||
// Update commitment and nullifiers in kernels and testing byte array. | ||
// Commitments and nullifiers are 32 bytes long, so we can update them in the byte array by offsetting by 32 bytes | ||
// for every insertion As there are two kernels in every leaf, nullifiers are offset by 8 elements (8*32) To insert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// for every insertion As there are two kernels in every leaf, nullifiers are offset by 8 elements (8*32) To insert | |
// for every insertion. As there are two kernels in every leaf, nullifiers are offset by 8 elements (8*32). To insert |
// Update commitment and nullifiers in kernels and testing byte array. | ||
// Commitments and nullifiers are 32 bytes long, so we can update them in the byte array by offsetting by 32 bytes | ||
// for every insertion As there are two kernels in every leaf, nullifiers are offset by 8 elements (8*32) To insert | ||
// correctly, the insertions of values from the second kernel must be offset by 4*32 bytes (kernel_offset) Further |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// correctly, the insertions of values from the second kernel must be offset by 4*32 bytes (kernel_offset) Further | |
// correctly, the insertions of values from the second kernel must be offset by 4*32 bytes (kernel_offset). Further |
@@ -183,7 +180,7 @@ TEST_F(root_rollup_tests, native_check_block_hashes_empty_blocks) | |||
EXPECT_FALSE(composer.failed()); | |||
|
|||
// Expected hash of public inputs for an empty L2 block. Also used in the contract tests. | |||
fr const expected_hash = uint256_t("11840efc30e9fcbdd0aae30da2a5b441132420b4f0cc4ffd6bdc41888845f775"); | |||
fr const expected_hash = uint256_t("23f698e487c4e1b7383889f8864bc19591773d136c364c01d980bd13d0786ba1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LHerskind please put there a comment that the value is from l2-block-publisher.test.ts
Description
Fixes #390 and #399.
test_utils/utils.cpp
to have proper index and tree generation.standalone_block_builder
circuit_block_builder
tosolo_block_builder
l2-block-publisher
tests are unfunctional since #408 was merged in. But @benesjan is addresseing this with #458.Checklist: