-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(base_rollup_circuit): base rollup impl (wip) (#99)
* add basic contract deployment test for private kernel * chore(base_rollup): scaffold * feat(base_rollup): scaffold * fix(base_rollup): var name changes * feat(base_rollup): historical subtree membership checks * feat(merge_rollup) merge rollup types * clean(merge): clean types and scaffold * refactor(merge): seperate merge and base rollup * fix(base): rename messup * clean(merge): pr review * initial test setup * fix: paths and prints * deleted deps * minor tweaks * fix(merge|base): aggregation object naming issue * fix: change interface of base rollup * fix witness init * fix(ts): update bindings (#108) * refactor(merge): seperate merge and base rollup * initial test setup * fix(ts-bindings): reduce roots to calldatahash * fix: remove prover id * fix: base rollup pub inputs ts tests * remove deps * rm gtest * fix: scuffed rebase * fix: scuffed rebase cont. * fix: update tests --------- Co-authored-by: cheethas <[email protected]> Co-authored-by: LHerskind <[email protected]> * fix(ts): update incorrect constant parity * fix(base): update vk pointer handling (#111) * fix: bb update * fix: update head * fix:(base): remove subtrees from interface (#110) * update inputs and outputs of base per new miro dg * update types and bindings * fix ts bindings for base * Adding tests for base rollup + sha256 (#114) * tests: tiny tests added * fix: insert zero-leaf in contract + use sha256 + change calldata hash -> 2 fields * fix: run tests in ci + remove log * fix: fix tests * fix: fix comments * fix: better comment * feat(base): insert commitments and contracts into end trees (#116) * insert commitments and contracts into end trees * fix merkle membership refactoring * add new root to snapshot * fix per pr comments * update ts constants * fix per pr comments * fix: Update rollup sha256 input + add test with "meaningful" input (#118) * feat(base): nullifier tree impl (#119) * chore(bb): update branch * feat: impl nullifier logic * fix(base): naming and miscalculations * fix: update subtree sibling path depth constants * fix: more nits --------- Co-authored-by: cheethas <[email protected]> --------- Co-authored-by: dbanks12 <[email protected]> Co-authored-by: cheethas <[email protected]> Co-authored-by: LHerskind <[email protected]> Co-authored-by: David Banks <[email protected]> Co-authored-by: Rahul Kothari <[email protected]> Co-authored-by: Lasse Herskind <[email protected]>
- Loading branch information
1 parent
c2fa51a
commit 5b275db
Showing
36 changed files
with
1,345 additions
and
373 deletions.
There are no files selected for viewing
Submodule barretenberg
updated
20 files
This file contains 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
aztec3_circuits_abis_tests | ||
aztec3_circuits_apps_tests | ||
aztec3_circuits_kernel_tests | ||
aztec3_circuits_rollup_tests | ||
aztec3_circuits_recursion_tests |
This file contains 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 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
1 change: 1 addition & 0 deletions
1
cpp/src/aztec3/circuits/abis/private_kernel/new_contract_data.hpp
This file contains 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 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 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
102 changes: 102 additions & 0 deletions
102
cpp/src/aztec3/circuits/abis/rollup/base/base_rollup_public_inputs.hpp
This file contains 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,102 @@ | ||
#pragma once | ||
#include <barretenberg/stdlib/recursion/aggregation_state/aggregation_state.hpp> | ||
#include <aztec3/utils/types/native_types.hpp> | ||
#include <aztec3/utils/types/circuit_types.hpp> | ||
#include <aztec3/utils/types/convert.hpp> | ||
#include "../../append_only_tree_snapshot.hpp" | ||
#include "../../append_only_tree_snapshot.hpp" | ||
#include "../constant_rollup_data.hpp" | ||
|
||
namespace aztec3::circuits::abis { | ||
|
||
using aztec3::utils::types::CircuitTypes; | ||
using aztec3::utils::types::NativeTypes; | ||
using std::is_same; | ||
|
||
template <typename NCT> struct BaseRollupPublicInputs { | ||
typedef typename NCT::fr fr; | ||
typedef typename NCT::AggregationObject AggregationObject; | ||
|
||
AggregationObject end_aggregation_object; | ||
ConstantRollupData<NCT> constants; | ||
|
||
AppendOnlyTreeSnapshot<NCT> start_private_data_tree_snapshot; | ||
AppendOnlyTreeSnapshot<NCT> end_private_data_tree_snapshot; | ||
|
||
AppendOnlyTreeSnapshot<NCT> start_nullifier_tree_snapshot; | ||
AppendOnlyTreeSnapshot<NCT> end_nullifier_tree_snapshot; | ||
|
||
AppendOnlyTreeSnapshot<NCT> start_contract_tree_snapshot; | ||
AppendOnlyTreeSnapshot<NCT> end_contract_tree_snapshot; | ||
|
||
// Hashes (probably sha256) to make public inputs constant-sized (to then be unpacked on-chain) | ||
// UPDATE we should instead just hash all of the below into a single value. See big diagram of sha256 hashing | ||
// bottom-right of here. | ||
// TODO I've put `fr`, but these hash values' types might need to be two fields if we want all 256-bits, for | ||
// security purposes. | ||
std::array<fr, 2> calldata_hash; | ||
|
||
bool operator==(BaseRollupPublicInputs<NCT> const&) const = default; | ||
}; | ||
|
||
template <typename NCT> void read(uint8_t const*& it, BaseRollupPublicInputs<NCT>& obj) | ||
{ | ||
using serialize::read; | ||
|
||
read(it, obj.end_aggregation_object); | ||
read(it, obj.constants); | ||
read(it, obj.start_private_data_tree_snapshot); | ||
read(it, obj.end_private_data_tree_snapshot); | ||
read(it, obj.start_nullifier_tree_snapshot); | ||
read(it, obj.end_nullifier_tree_snapshot); | ||
read(it, obj.start_contract_tree_snapshot); | ||
read(it, obj.end_contract_tree_snapshot); | ||
read(it, obj.calldata_hash); | ||
}; | ||
|
||
template <typename NCT> void write(std::vector<uint8_t>& buf, BaseRollupPublicInputs<NCT> const& obj) | ||
{ | ||
using serialize::write; | ||
|
||
write(buf, obj.end_aggregation_object); | ||
write(buf, obj.constants); | ||
write(buf, obj.start_private_data_tree_snapshot); | ||
write(buf, obj.end_private_data_tree_snapshot); | ||
write(buf, obj.start_nullifier_tree_snapshot); | ||
write(buf, obj.end_nullifier_tree_snapshot); | ||
write(buf, obj.start_contract_tree_snapshot); | ||
write(buf, obj.end_contract_tree_snapshot); | ||
write(buf, obj.calldata_hash); | ||
}; | ||
|
||
template <typename NCT> std::ostream& operator<<(std::ostream& os, BaseRollupPublicInputs<NCT> const& obj) | ||
{ | ||
return os << "end_aggregation_object:\n" | ||
<< obj.end_aggregation_object | ||
<< "\n" | ||
"constants:\n" | ||
<< obj.constants | ||
<< "\n" | ||
"start_private_data_tree_snapshot:\n" | ||
<< obj.start_private_data_tree_snapshot | ||
<< "\n" | ||
"end_private_data_tree_snapshot:\n" | ||
<< obj.start_private_data_tree_snapshot | ||
<< "\n" | ||
"start_nullifier_tree_snapshot:\n" | ||
<< obj.start_nullifier_tree_snapshot | ||
<< "\n" | ||
"end_nullifier_tree_snapshots:\n" | ||
<< obj.end_nullifier_tree_snapshot | ||
<< "\n" | ||
"start_contract_tree_snapshot:\n" | ||
<< obj.start_contract_tree_snapshot | ||
<< "\n" | ||
"end_contract_tree_snapshot:\n" | ||
<< obj.end_contract_tree_snapshot | ||
<< "\n" | ||
"calldata_hash: " | ||
<< obj.calldata_hash << "\n"; | ||
} | ||
|
||
} // namespace aztec3::circuits::abis |
This file contains 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
40 changes: 40 additions & 0 deletions
40
cpp/src/aztec3/circuits/abis/rollup/merge/merge_rollup_inputs.hpp
This file contains 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,40 @@ | ||
#pragma once | ||
#include "aztec3/circuits/abis/append_only_tree_snapshot.hpp" | ||
#include <aztec3/circuits/abis/rollup/merge/previous_rollup_data.hpp> | ||
#include <aztec3/utils/types/native_types.hpp> | ||
#include <aztec3/utils/types/circuit_types.hpp> | ||
#include <aztec3/utils/types/convert.hpp> | ||
#include <type_traits> | ||
|
||
namespace aztec3::circuits::abis { | ||
|
||
using aztec3::utils::types::CircuitTypes; | ||
using aztec3::utils::types::NativeTypes; | ||
using std::is_same; | ||
|
||
template <typename NCT> struct MergeRollupInputs { | ||
std::array<PreviousRollupData<NCT>, 2> previous_rollup_data; | ||
|
||
bool operator==(MergeRollupInputs<NCT> const&) const = default; | ||
}; | ||
|
||
template <typename NCT> void read(uint8_t const*& it, MergeRollupInputs<NCT>& obj) | ||
{ | ||
using serialize::read; | ||
|
||
read(it, obj.previous_rollup_data); | ||
}; | ||
|
||
template <typename NCT> void write(std::vector<uint8_t>& buf, MergeRollupInputs<NCT> const& obj) | ||
{ | ||
using serialize::write; | ||
|
||
write(buf, obj.previous_rollup_data); | ||
}; | ||
|
||
template <typename NCT> std::ostream& operator<<(std::ostream& os, MergeRollupInputs<NCT> const& obj) | ||
{ | ||
return os << "previous_rollup_data: " << obj.previous_rollup_data << "\n"; | ||
}; | ||
|
||
} // namespace aztec3::circuits::abis |
Oops, something went wrong.