Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
get_bytecode.hpp
Go to the documentation of this file.
1#pragma once
2#include "exec_pipe.hpp"
3#include <filesystem>
4#include <iostream>
5#include <iterator>
6
10inline std::vector<uint8_t> gunzip(const std::string& path)
11{
12 std::string command = "gunzip -c \"" + path + "\"";
13 return bb::exec_pipe(command);
14}
15
16inline std::vector<uint8_t> get_bytecode(const std::string& bytecodePath)
17{
18 if (bytecodePath == "-") {
20 }
21 std::filesystem::path filePath = bytecodePath;
22 if (filePath.extension() == ".json") {
23 // Try reading json files as if they are a Nargo build artifact
24 std::string command = "jq -r '.bytecode' \"" + bytecodePath + "\" | base64 -d | gunzip -c";
25 return bb::exec_pipe(command);
26 }
27
28 // For other extensions, assume file is a raw ACIR program
29 return gunzip(bytecodePath);
30}
std::vector< uint8_t > get_bytecode(const std::string &bytecodePath)
std::vector< uint8_t > gunzip(const std::string &path)
std::vector< uint8_t > exec_pipe(const std::string &command)
Definition exec_pipe.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13