Skip to content
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

Circuit examples #22

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include(CMakeFindDependencyMacro)
find_dependency(crypto3 REQUIRED)
find_dependency(blueprint_crypto3 REQUIRED)
find_dependency(crypto3_blueprint REQUIRED)
find_dependency(evmc REQUIRED)
find_dependency(intx REQUIRED)
find_dependency(ethash REQUIRED)
Expand Down
86 changes: 71 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
flake-utils.follows = "flake-utils";
};
};
nil_crypto3 = {
nil-crypto3 = {
url = "https://github.com/NilFoundation/crypto3";
type = "git";
submodules = true;
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
nil_zkllvm_blueprint = {
nil-zkllvm-blueprint = {
url = "https://github.com/NilFoundation/zkllvm-blueprint";
type = "git";
submodules = true;
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
nil_crypto3.follows = "nil_crypto3";
nil-crypto3.follows = "nil-crypto3";
};
};
};
Expand All @@ -50,12 +50,12 @@
# Add more complicated logic here if you need to have debug packages
resolveInput = input: input.packages.${system}.default;

nil_inputs = with inputs; [
nil_crypto3
nil_zkllvm_blueprint
nil-inputs = with inputs; [
nil-crypto3
nil-zkllvm-blueprint
];

nil_packages = map resolveInput nil_inputs;
nil-packages = map resolveInput nil-inputs;

defaultNativeBuildInputs = with pkgs; [
cmake
Expand All @@ -77,7 +77,7 @@
ethash
];
in
deps ++ nil_packages;
deps ++ nil-packages;

devInputs = [ pkgs.clang_17 ];

Expand Down
4 changes: 2 additions & 2 deletions lib/assigner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ add_library(${PROJECT_NAME} STATIC ${evmone_sources})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)

find_package(crypto3 REQUIRED)
find_package(blueprint_crypto3 REQUIRED)
find_package(crypto3_blueprint REQUIRED)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/evmone>)

target_link_libraries(${PROJECT_NAME}
PUBLIC evmc::evmc intx::intx crypto3::all blueprint ethash::keccak)
PUBLIC evmc::evmc intx::intx crypto3::all crypto3::blueprint ethash::keccak)

set_target_properties(
${PROJECT_NAME}
Expand Down
7 changes: 6 additions & 1 deletion lib/assigner/evmone/execution_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>

#include <zkevm_word.hpp>
#include <rw.hpp>

namespace nil {
namespace blueprint {
Expand Down Expand Up @@ -143,6 +144,9 @@ class ExecutionState
evmc_status_code status = EVMC_SUCCESS;
size_t output_offset = 0;
size_t output_size = 0;

std::size_t call_id;
std::vector<nil::blueprint::rw_operation<BlueprintFieldType>> rw_trace;
std::shared_ptr<nil::blueprint::assigner<BlueprintFieldType>> assigner;

private:
Expand All @@ -167,12 +171,13 @@ class ExecutionState

ExecutionState(const evmc_message& message, evmc_revision revision,
const evmc_host_interface& host_interface, evmc_host_context* host_ctx, bytes_view _code,
bytes_view _data, std::shared_ptr<nil::blueprint::assigner<BlueprintFieldType>> _assigner) noexcept
bytes_view _data, size_t _call_id, std::shared_ptr<nil::blueprint::assigner<BlueprintFieldType>> _assigner) noexcept
: msg{&message},
host{host_interface, host_ctx},
rev{revision},
original_code{_code},
data{_data},
call_id{_call_id},
assigner{_assigner}
{}

Expand Down
Loading
Loading