Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: intial private kernel #549

Merged
merged 47 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
55e6016
prelim / very-broken commit where Jean and I started implementing the…
dbanks12 May 11, 2023
c3d954b
merge in master
dbanks12 May 11, 2023
ac8f8f0
wip - fix some compilation issues, remove unused imports, remove
May 12, 2023
ea7816d
wip - some minor changes and comments after pairing with David
May 12, 2023
6f01a62
Merge branch 'master' into db-jm/initial-private-kernel
May 12, 2023
080d814
wip: additional compilation fixes
May 16, 2023
0fe88a6
Merge branch 'master' into db-jm/initial-private-kernel
May 16, 2023
952095e
Refactor helper functions in private kernel tests
May 16, 2023
1a4cfb6
wip - Fix linking issue and comment out some tests
May 16, 2023
75d5b17
wip - repair native and circuit tests
May 16, 2023
f294a0a
wip - include using double quotes and remove unused code
May 17, 2023
6c73b8a
wip - fixing circuit_create_proof_cbinds test and adapting
May 17, 2023
64678ea
wip - fix clang tidy issue
May 17, 2023
3575556
Merge branch 'master' into db-jm/initial-private-kernel
May 17, 2023
9f8ebe2
wip - post master merger fixes and remove test on new nullifiers
May 17, 2023
a5b378f
wip - fix clang tidy issue
May 17, 2023
f4e5e1e
Merge branch 'master' into db-jm/intial-private-kernel
May 19, 2023
9a6c83c
wip - fix clang tidy issue
May 19, 2023
7c07ed3
wip - fix typescript tests and data structure split
May 19, 2023
0b5dc0e
wip - format typescript
May 19, 2023
7df1400
wip - replace CONSTRUCTOR_ARGS by FUNCTION_ARGS
May 19, 2023
bd1b7ad
Merge branch 'master' into db-jm/intial-private-kernel
May 19, 2023
f0ae663
wip - add nullifier and l1-l2-message tree roots in initial private
May 19, 2023
db30ebd
Merge branch 'master' into db-jm/intial-private-kernel
May 22, 2023
9bbef1c
wip - post merge fix
May 22, 2023
e71af78
Migrate common.hpp functions into non-templated ones
May 22, 2023
886363b
refactor(sol): use Hash.sha256ToField library where required (#637)
Maddiaa0 May 22, 2023
3cd5293
fix: Add checks for arg-type (#638)
LHerskind May 22, 2023
3ecd3bc
fix: naming consistency in messaging (messageHash -> message) (#641)
Maddiaa0 May 22, 2023
9cabcff
chore: remove unknown casts in archiver test (#648)
spalladino May 22, 2023
e58cf6d
Consolidation code for contract_logic
May 23, 2023
a325ad5
Merge branch 'master' into db-jm/intial-private-kernel
May 23, 2023
49246df
e2e fixing: Initialise public and private call stack and comment out …
May 23, 2023
bbd8517
Merge branch 'master' into db-jm/intial-private-kernel
May 23, 2023
c416a33
Renaming file native_private_kernel_initial.XPP into
May 23, 2023
c8df3b4
Rename native_private_kernel_circuit into
May 23, 2023
7f8c144
Simplify if/else clause on deployment contract boolean in contract logic
May 23, 2023
f7832d5
Merge branch 'master' into db-jm/intial-private-kernel
May 23, 2023
bb55316
abis test snapshot - restore from master for vk hash
May 25, 2023
58fa033
Remove old TODO comments
May 25, 2023
ab006b0
Fork FUNCTION_ARGS into FUNCTION/CONSTRUCTOR_ARGS generator indices
May 25, 2023
b7c56b8
Move code copying public/private_call_stack in PKC init
May 25, 2023
8f00d8b
Clang tidy fix
May 25, 2023
b5177e9
Merge branch 'master' into db-jm/intial-private-kernel
May 25, 2023
61e3a7b
Add clarifications into a comment
May 25, 2023
332762f
Added comments
May 25, 2023
58864f3
remove empty lines
May 25, 2023
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
1 change: 0 additions & 1 deletion circuits/cpp/src/aztec3/circuits/abis/.test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "index.hpp"
#include "previous_kernel_data.hpp"
#include "private_kernel/private_inputs.hpp"

#include "aztec3/circuits/abis/combined_accumulated_data.hpp"

Expand Down
12 changes: 9 additions & 3 deletions circuits/cpp/src/aztec3/circuits/abis/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "private_circuit_public_inputs.hpp"
#include "tx_context.hpp"
#include "tx_request.hpp"
#include "private_kernel/private_inputs.hpp"
#include "private_kernel/private_kernel_inputs_inner.hpp"
#include "public_kernel/public_kernel_inputs.hpp"
#include "public_kernel/public_kernel_inputs_no_previous_kernel.hpp"
#include "rollup/base/base_or_merge_rollup_public_inputs.hpp"
Expand All @@ -18,6 +18,7 @@

#include "aztec3/circuits/abis/combined_accumulated_data.hpp"
#include "aztec3/circuits/abis/new_contract_data.hpp"
#include "aztec3/circuits/abis/private_kernel/private_kernel_inputs_init.hpp"
#include "aztec3/circuits/abis/signed_tx_request.hpp"
#include "aztec3/circuits/abis/types.hpp"
#include <aztec3/circuits/hash.hpp>
Expand Down Expand Up @@ -441,9 +442,14 @@ WASM_EXPORT const char* abis__test_roundtrip_serialize_signed_tx_request(uint8_t
return as_string_output<aztec3::circuits::abis::SignedTxRequest<NT>>(input, size);
}

WASM_EXPORT const char* abis__test_roundtrip_serialize_private_kernel_inputs(uint8_t const* input, uint32_t* size)
WASM_EXPORT const char* abis__test_roundtrip_serialize_private_kernel_inputs_inner(uint8_t const* input, uint32_t* size)
{
return as_string_output<aztec3::circuits::abis::private_kernel::PrivateInputs<NT>>(input, size);
return as_string_output<aztec3::circuits::abis::private_kernel::PrivateKernelInputsInner<NT>>(input, size);
}

WASM_EXPORT const char* abis__test_roundtrip_serialize_private_kernel_inputs_init(uint8_t const* input, uint32_t* size)
{
return as_string_output<aztec3::circuits::abis::private_kernel::PrivateKernelInputsInit<NT>>(input, size);
}

WASM_EXPORT const char* abis__test_roundtrip_serialize_kernel_circuit_public_inputs(uint8_t const* input,
Expand Down
1 change: 0 additions & 1 deletion circuits/cpp/src/aztec3/circuits/abis/c_bind.test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "c_bind.h"

#include "function_leaf_preimage.hpp"
#include "tx_request.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,75 +1,64 @@
#pragma once

#include "private_call_data.hpp"
#include "../combined_accumulated_data.hpp"
#include "../previous_kernel_data.hpp"
#include "../signed_tx_request.hpp"

#include <aztec3/utils/types/circuit_types.hpp>
#include <aztec3/utils/types/convert.hpp>
#include <aztec3/utils/types/native_types.hpp>

#include <barretenberg/stdlib/primitives/witness/witness.hpp>
#include "aztec3/utils/types/circuit_types.hpp"
#include "aztec3/utils/types/native_types.hpp"

namespace aztec3::circuits::abis::private_kernel {

using aztec3::utils::types::CircuitTypes;
using aztec3::utils::types::NativeTypes;
using std::is_same;

template <typename NCT> struct PrivateInputs {
template <typename NCT> struct PrivateKernelInputsInit {
using fr = typename NCT::fr;
using boolean = typename NCT::boolean;

SignedTxRequest<NCT> signed_tx_request{};
PreviousKernelData<NCT> previous_kernel{};
PrivateCallData<NCT> private_call{};

boolean operator==(PrivateInputs<NCT> const& other) const
boolean operator==(PrivateKernelInputsInit<NCT> const& other) const
{
return signed_tx_request == other.signed_tx_request && previous_kernel == other.previous_kernel &&
private_call == other.private_call;
return signed_tx_request == other.signed_tx_request && private_call == other.private_call;
};

template <typename Composer> PrivateInputs<CircuitTypes<Composer>> to_circuit_type(Composer& composer) const
template <typename Composer>
PrivateKernelInputsInit<CircuitTypes<Composer>> to_circuit_type(Composer& composer) const
{
static_assert((std::is_same<NativeTypes, NCT>::value));

PrivateInputs<CircuitTypes<Composer>> private_inputs = {
PrivateKernelInputsInit<CircuitTypes<Composer>> private_inputs = {
// TODO to_ct(signature),
signed_tx_request.to_circuit_type(composer),
previous_kernel.to_circuit_type(composer),
private_call.to_circuit_type(composer),
};

return private_inputs;
};
};

template <typename NCT> void read(uint8_t const*& it, PrivateInputs<NCT>& private_inputs)
template <typename NCT> void read(uint8_t const*& it, PrivateKernelInputsInit<NCT>& private_inputs)
{
using serialize::read;

read(it, private_inputs.signed_tx_request);
read(it, private_inputs.previous_kernel);
read(it, private_inputs.private_call);
};

template <typename NCT> void write(std::vector<uint8_t>& buf, PrivateInputs<NCT> const& private_inputs)
template <typename NCT> void write(std::vector<uint8_t>& buf, PrivateKernelInputsInit<NCT> const& private_inputs)
{
using serialize::write;

write(buf, private_inputs.signed_tx_request);
write(buf, private_inputs.previous_kernel);
write(buf, private_inputs.private_call);
};

template <typename NCT> std::ostream& operator<<(std::ostream& os, PrivateInputs<NCT> const& private_inputs)
template <typename NCT> std::ostream& operator<<(std::ostream& os, PrivateKernelInputsInit<NCT> const& private_inputs)
{
return os << "signed_tx_request:\n"
<< private_inputs.signed_tx_request << "\n"
<< "previous_kernel:\n"
<< private_inputs.previous_kernel << "\n"
<< "private_call:\n"
<< private_inputs.private_call << "\n";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once

#include "private_call_data.hpp"
#include "../previous_kernel_data.hpp"

#include "aztec3/utils/types/circuit_types.hpp"
#include "aztec3/utils/types/convert.hpp"
#include "aztec3/utils/types/native_types.hpp"

#include <barretenberg/stdlib/primitives/witness/witness.hpp>

namespace aztec3::circuits::abis::private_kernel {

using aztec3::utils::types::CircuitTypes;
using aztec3::utils::types::NativeTypes;
using std::is_same;

template <typename NCT> struct PrivateKernelInputsInner {
using fr = typename NCT::fr;
using boolean = typename NCT::boolean;

PreviousKernelData<NCT> previous_kernel{};
PrivateCallData<NCT> private_call{};

boolean operator==(PrivateKernelInputsInner<NCT> const& other) const
{
return previous_kernel == other.previous_kernel && private_call == other.private_call;
};

template <typename Composer>
PrivateKernelInputsInner<CircuitTypes<Composer>> to_circuit_type(Composer& composer) const
{
static_assert((std::is_same<NativeTypes, NCT>::value));

PrivateKernelInputsInner<CircuitTypes<Composer>> private_inputs = {
previous_kernel.to_circuit_type(composer),
private_call.to_circuit_type(composer),
};

return private_inputs;
};
};

template <typename NCT> void read(uint8_t const*& it, PrivateKernelInputsInner<NCT>& private_inputs)
{
using serialize::read;

read(it, private_inputs.previous_kernel);
read(it, private_inputs.private_call);
};

template <typename NCT> void write(std::vector<uint8_t>& buf, PrivateKernelInputsInner<NCT> const& private_inputs)
{
using serialize::write;

write(buf, private_inputs.previous_kernel);
write(buf, private_inputs.private_call);
};

template <typename NCT> std::ostream& operator<<(std::ostream& os, PrivateKernelInputsInner<NCT> const& private_inputs)
{
return os << "previous_kernel:\n"
<< private_inputs.previous_kernel << "\n"
<< "private_call:\n"
<< private_inputs.private_call << "\n";
}

} // namespace aztec3::circuits::abis::private_kernel
Loading