diff --git a/lib/grpc-interfaces b/lib/grpc-interfaces index cba7c3f1c..50bb97695 160000 --- a/lib/grpc-interfaces +++ b/lib/grpc-interfaces @@ -1 +1 @@ -Subproject commit cba7c3f1c53b83bee83d8a1e5a1074591279220f +Subproject commit 50bb97695a51bf26c175d4b2b7ebad38fbae86b1 diff --git a/lib/machine-emulator-defines b/lib/machine-emulator-defines index fc2473ac7..f8823b9ae 160000 --- a/lib/machine-emulator-defines +++ b/lib/machine-emulator-defines @@ -1 +1 @@ -Subproject commit fc2473ac74d485b40f53f45f874b67abcb6843af +Subproject commit f8823b9ae680f04e832f5bbb9fbbd0ee67791fca diff --git a/src/cartesi-machine.lua b/src/cartesi-machine.lua index 484c1218c..d7f9ef29a 100755 --- a/src/cartesi-machine.lua +++ b/src/cartesi-machine.lua @@ -632,9 +632,6 @@ local options = { rollup = rollup or {} rollup.rx_buffer = { start = 0x60000000, length = 2 << 20 } rollup.tx_buffer = { start = 0x60200000, length = 2 << 20 } - rollup.input_metadata = { start = 0x60400000, length = 4096 } - rollup.voucher_hashes = { start = 0x60600000, length = 2 << 20 } - rollup.notice_hashes = { start = 0x60800000, length = 2 << 20 } htif_yield_automatic = true htif_yield_manual = true return true @@ -1667,9 +1664,6 @@ else assert(remote_address, "rollup requires --remote-address for snapshot/rollback") check_rollup_memory_range_config(config.rollup.tx_buffer, "tx-buffer") check_rollup_memory_range_config(config.rollup.rx_buffer, "rx-buffer") - check_rollup_memory_range_config(config.rollup.input_metadata, "input-metadata") - check_rollup_memory_range_config(config.rollup.voucher_hashes, "voucher-hashes") - check_rollup_memory_range_config(config.rollup.notice_hashes, "notice-hashes") end local cycles = machine:read_mcycle() if initial_hash then diff --git a/src/clua-machine-util.cpp b/src/clua-machine-util.cpp index a49272e5f..1f5fbe8f5 100644 --- a/src/clua-machine-util.cpp +++ b/src/clua-machine-util.cpp @@ -835,12 +835,6 @@ static void push_cm_rollup_config(lua_State *L, const cm_rollup_config *r) { lua_setfield(L, -2, "rx_buffer"); // rollup push_cm_memory_range_config(L, &r->tx_buffer); // rollup tx_buffer lua_setfield(L, -2, "tx_buffer"); // rollup - push_cm_memory_range_config(L, &r->input_metadata); // rollup input_metadata - lua_setfield(L, -2, "input_metadata"); // rollup - push_cm_memory_range_config(L, &r->voucher_hashes); // rollup voucher_hashes - lua_setfield(L, -2, "voucher_hashes"); // rollup - push_cm_memory_range_config(L, &r->notice_hashes); // rollup notice_hashes - lua_setfield(L, -2, "notice_hashes"); // rollup } /// \brief Pushes cm_flash_drive_configs to the Lua stack @@ -982,15 +976,6 @@ static void check_cm_rollup_config(lua_State *L, int tabidx, cm_rollup_config *r lua_pop(L, 1); lua_getfield(L, -1, "tx_buffer"); clua_check_cm_memory_range_config(L, -1, "rollup rx buffer", &r->tx_buffer); - lua_pop(L, 1); - lua_getfield(L, -1, "input_metadata"); - clua_check_cm_memory_range_config(L, -1, "rollup input metadata", &r->input_metadata); - lua_pop(L, 1); - lua_getfield(L, -1, "voucher_hashes"); - clua_check_cm_memory_range_config(L, -1, "rollup voucher hashes", &r->voucher_hashes); - lua_pop(L, 1); - lua_getfield(L, -1, "notice_hashes"); - clua_check_cm_memory_range_config(L, -1, "rollup notice hashes", &r->notice_hashes); lua_pop(L, 2); } diff --git a/src/json-util.cpp b/src/json-util.cpp index 5ef64354e..f278ff963 100644 --- a/src/json-util.cpp +++ b/src/json-util.cpp @@ -916,9 +916,6 @@ void ju_get_opt_field(const nlohmann::json &j, const K &key, rollup_config &valu const auto new_path = path + to_string(key) + "/"; ju_get_field(jconfig, "rx_buffer"s, value.rx_buffer, new_path); ju_get_field(jconfig, "tx_buffer"s, value.tx_buffer, new_path); - ju_get_field(jconfig, "input_metadata"s, value.input_metadata, new_path); - ju_get_field(jconfig, "voucher_hashes"s, value.voucher_hashes, new_path); - ju_get_field(jconfig, "notice_hashes"s, value.notice_hashes, new_path); } template void ju_get_opt_field(const nlohmann::json &j, const uint64_t &key, rollup_config &value, @@ -940,9 +937,6 @@ void ju_get_opt_field(const nlohmann::json &j, const K &key, std::optional(const nlohmann::json &j, const uint64_t &key, @@ -1159,9 +1153,6 @@ void to_json(nlohmann::json &j, const rollup_config &config) { j = nlohmann::json{ {"rx_buffer", config.rx_buffer}, {"tx_buffer", config.tx_buffer}, - {"input_metadata", config.input_metadata}, - {"voucher_hashes", config.voucher_hashes}, - {"notice_hashes", config.notice_hashes}, }; } diff --git a/src/machine-c-api.cpp b/src/machine-c-api.cpp index cc70975aa..7dc8167db 100644 --- a/src/machine-c-api.cpp +++ b/src/machine-c-api.cpp @@ -286,8 +286,7 @@ static std::optional convert_from_c(const cm_rollup_conf return {}; } cartesi::rollup_config new_cpp_rollup_config{convert_from_c(&c_config->rx_buffer), - convert_from_c(&c_config->tx_buffer), convert_from_c(&c_config->input_metadata), - convert_from_c(&c_config->voucher_hashes), convert_from_c(&c_config->notice_hashes)}; + convert_from_c(&c_config->tx_buffer)}; return new_cpp_rollup_config; } @@ -299,9 +298,6 @@ static cm_rollup_config convert_to_c(const std::optional } new_c_rollup_config.rx_buffer = convert_to_c(cpp_config->rx_buffer); new_c_rollup_config.tx_buffer = convert_to_c(cpp_config->tx_buffer); - new_c_rollup_config.input_metadata = convert_to_c(cpp_config->input_metadata); - new_c_rollup_config.voucher_hashes = convert_to_c(cpp_config->voucher_hashes); - new_c_rollup_config.notice_hashes = convert_to_c(cpp_config->notice_hashes); return new_c_rollup_config; } @@ -708,9 +704,6 @@ void cm_delete_machine_config(const cm_machine_config *config) { delete[] config->tlb.image_filename; delete[] config->rollup.rx_buffer.image_filename; delete[] config->rollup.tx_buffer.image_filename; - delete[] config->rollup.input_metadata.image_filename; - delete[] config->rollup.voucher_hashes.image_filename; - delete[] config->rollup.notice_hashes.image_filename; delete[] config->uarch.ram.image_filename; delete config; diff --git a/src/machine-c-api.h b/src/machine-c-api.h index 88e9c3682..4d67895b2 100644 --- a/src/machine-c-api.h +++ b/src/machine-c-api.h @@ -235,9 +235,6 @@ typedef struct { // NOLINT(modernize-use-using) bool has_value; ///< Represents whether the rest of the struct have been filled cm_memory_range_config rx_buffer; ///< RX buffer memory range cm_memory_range_config tx_buffer; ///< TX buffer memory range - cm_memory_range_config input_metadata; ///< Input metadata memory range - cm_memory_range_config voucher_hashes; ///< Voucher hashes memory range - cm_memory_range_config notice_hashes; ///< Notice hashes memory range } cm_rollup_config; /// \brief microarchitecture RAM configuration diff --git a/src/machine-config.cpp b/src/machine-config.cpp index 4ef3d19ad..d2dd96072 100644 --- a/src/machine-config.cpp +++ b/src/machine-config.cpp @@ -55,9 +55,6 @@ static void adjust_image_filenames(machine_config &c, const std::string &dir) { auto &r = c.rollup.value(); r.rx_buffer.image_filename = c.get_image_filename(dir, r.rx_buffer); r.tx_buffer.image_filename = c.get_image_filename(dir, r.tx_buffer); - r.input_metadata.image_filename = c.get_image_filename(dir, r.input_metadata); - r.voucher_hashes.image_filename = c.get_image_filename(dir, r.voucher_hashes); - r.notice_hashes.image_filename = c.get_image_filename(dir, r.notice_hashes); } if (c.uarch.ram.length > 0) { diff --git a/src/machine-config.h b/src/machine-config.h index 372886a9c..132e81240 100644 --- a/src/machine-config.h +++ b/src/machine-config.h @@ -115,9 +115,8 @@ struct htif_config final { struct rollup_config { // NOLINT(bugprone-exception-escape) memory_range_config rx_buffer{}; ///< RX buffer memory_range_config tx_buffer{}; ///< TX buffer - memory_range_config input_metadata{}; ///< Buffer for input metadata - memory_range_config voucher_hashes{}; ///< Buffer for the voucher hash array - memory_range_config notice_hashes{}; ///< Buffer for the notice hash array + memory_range_config hash_types{}; ///< + memory_range_config hash_values{}; ///< }; /// \brief Machine state configuration diff --git a/src/machine.cpp b/src/machine.cpp index 11354de32..28a713c63 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -100,33 +100,6 @@ const pma_entry::flags machine::m_rollup_tx_buffer_flags{ PMA_ISTART_DID::rollup_tx_buffer // DID }; -const pma_entry::flags machine::m_rollup_input_metadata_flags{ - true, // R - false, // W - false, // X - true, // IR - true, // IW - PMA_ISTART_DID::rollup_input_metadata // DID -}; - -const pma_entry::flags machine::m_rollup_voucher_hashes_flags{ - true, // R - true, // W - false, // X - true, // IR - true, // IW - PMA_ISTART_DID::rollup_voucher_hashes // DID -}; - -const pma_entry::flags machine::m_rollup_notice_hashes_flags{ - true, // R - true, // W - false, // X - true, // IR - true, // IW - PMA_ISTART_DID::rollup_notice_hashes // DID -}; - pma_entry machine::make_memory_range_pma_entry(const std::string &description, const memory_range_config &c) { if (c.image_filename.empty()) { return make_callocd_memory_pma_entry(description, c.start, c.length); @@ -146,20 +119,6 @@ pma_entry machine::make_rollup_tx_buffer_pma_entry(const memory_range_config &c) return make_memory_range_pma_entry("rollup tx buffer memory range"s, c).set_flags(m_rollup_tx_buffer_flags); } -pma_entry machine::make_rollup_input_metadata_pma_entry(const memory_range_config &c) { - return make_memory_range_pma_entry("rollup input metadata memory range"s, c) - .set_flags(m_rollup_input_metadata_flags); -} - -pma_entry machine::make_rollup_voucher_hashes_pma_entry(const memory_range_config &c) { - return make_memory_range_pma_entry("rollup voucher hashes memory range"s, c) - .set_flags(m_rollup_voucher_hashes_flags); -} - -pma_entry machine::make_rollup_notice_hashes_pma_entry(const memory_range_config &c) { - return make_memory_range_pma_entry("rollup notice hashes memory range"s, c).set_flags(m_rollup_notice_hashes_flags); -} - pma_entry &machine::register_pma_entry(pma_entry &&pma) { if (m_s.pmas.capacity() <= m_s.pmas.size()) { // NOLINT(readability-static-accessed-through-instance) throw std::runtime_error{"too many PMAs when adding "s + pma.get_description()}; @@ -205,12 +164,6 @@ static bool DID_is_protected(PMA_ISTART_DID DID) { return false; case PMA_ISTART_DID::rollup_tx_buffer: return false; - case PMA_ISTART_DID::rollup_input_metadata: - return false; - case PMA_ISTART_DID::rollup_voucher_hashes: - return false; - case PMA_ISTART_DID::rollup_notice_hashes: - return false; default: return true; } @@ -378,17 +331,11 @@ machine::machine(const machine_config &c, const machine_runtime_config &r) : // Register rollup memory ranges if (m_c.rollup.has_value()) { if (m_c.rollup->rx_buffer.length == 0 || m_c.rollup->rx_buffer.start == 0 || - m_c.rollup->tx_buffer.length == 0 || m_c.rollup->tx_buffer.start == 0 || - m_c.rollup->input_metadata.length == 0 || m_c.rollup->input_metadata.start == 0 || - m_c.rollup->voucher_hashes.length == 0 || m_c.rollup->voucher_hashes.start == 0 || - m_c.rollup->notice_hashes.length == 0 || m_c.rollup->notice_hashes.start == 0) { + m_c.rollup->tx_buffer.length == 0 || m_c.rollup->tx_buffer.start == 0) { throw std::invalid_argument{"incomplete rollup configuration"}; } register_pma_entry(make_rollup_tx_buffer_pma_entry(m_c.rollup->tx_buffer)); register_pma_entry(make_rollup_rx_buffer_pma_entry(m_c.rollup->rx_buffer)); - register_pma_entry(make_rollup_input_metadata_pma_entry(m_c.rollup->input_metadata)); - register_pma_entry(make_rollup_voucher_hashes_pma_entry(m_c.rollup->voucher_hashes)); - register_pma_entry(make_rollup_notice_hashes_pma_entry(m_c.rollup->notice_hashes)); } // Register HTIF device @@ -553,9 +500,6 @@ machine_config machine::get_serialization_config(void) const { auto &r = c.rollup.value(); r.rx_buffer.image_filename.clear(); r.tx_buffer.image_filename.clear(); - r.input_metadata.image_filename.clear(); - r.voucher_hashes.image_filename.clear(); - r.notice_hashes.image_filename.clear(); } c.uarch.processor.cycle = read_uarch_cycle(); c.uarch.processor.halt_flag = read_uarch_halt_flag(); @@ -660,9 +604,6 @@ void machine::store_pmas(const machine_config &c, const std::string &dir) const const auto &r = c.rollup.value(); store_memory_pma(find_pma_entry(r.rx_buffer.start), dir); store_memory_pma(find_pma_entry(r.tx_buffer.start), dir); - store_memory_pma(find_pma_entry(r.input_metadata.start), dir); - store_memory_pma(find_pma_entry(r.voucher_hashes.start), dir); - store_memory_pma(find_pma_entry(r.notice_hashes.start), dir); } if (!m_uarch.get_state().ram.get_istart_E()) { store_memory_pma(m_uarch.get_state().ram, dir); diff --git a/src/machine.h b/src/machine.h index 2b913da3c..118ad9829 100644 --- a/src/machine.h +++ b/src/machine.h @@ -64,9 +64,6 @@ class machine final { static const pma_entry::flags m_flash_drive_flags; ///< PMA flags used for flash drives static const pma_entry::flags m_rollup_rx_buffer_flags; ///< PMA flags used for rollup rx buffer static const pma_entry::flags m_rollup_tx_buffer_flags; ///< PMA flags used for rollup tx buffer - static const pma_entry::flags m_rollup_input_metadata_flags; ///< PMA flags used for rollup input metadata - static const pma_entry::flags m_rollup_voucher_hashes_flags; ///< PMA flags used for rollup voucher hashes - static const pma_entry::flags m_rollup_notice_hashes_flags; ///< PMA flags used for rollup notice hashes /// \brief Allocates a new PMA entry. /// \param pma PMA entry to add to machine. @@ -95,21 +92,6 @@ class machine final { /// \returns New PMA entry with tx buffer flags already set. static pma_entry make_rollup_tx_buffer_pma_entry(const memory_range_config &c); - /// \brief Creates a new rollup input metadata PMA entry. - /// \param c Memory range configuration. - /// \returns New PMA entry with rollup input metadata flags already set. - static pma_entry make_rollup_input_metadata_pma_entry(const memory_range_config &c); - - /// \brief Creates a new rollup voucher hashes PMA entry. - /// \param c Memory range configuration. - /// \returns New PMA entry with rollup voucher hashes flags already set. - static pma_entry make_rollup_voucher_hashes_pma_entry(const memory_range_config &c); - - /// \brief Creates a new rollup notice hahes PMA entry. - /// \param c Memory range configuration. - /// \returns New PMA entry with rollup notice hashes flags already set. - static pma_entry make_rollup_notice_hashes_pma_entry(const memory_range_config &c); - /// \brief Saves PMAs into files for serialization /// \param config Machine config to be stored /// \param directory Directory where PMAs will be stored diff --git a/src/pma-constants.h b/src/pma-constants.h index 70091a660..66edf2122 100644 --- a/src/pma-constants.h +++ b/src/pma-constants.h @@ -106,9 +106,6 @@ enum class PMA_ISTART_DID { HTIF = PMA_HTIF_DID_DEF, ///< DID for HTIF device rollup_rx_buffer = PMA_ROLLUP_RX_BUFFER_DID_DEF, ///< DID for rollup receive buffer rollup_tx_buffer = PMA_ROLLUP_TX_BUFFER_DID_DEF, ///< DID for rollup transmit buffer - rollup_input_metadata = PMA_ROLLUP_INPUT_METADATA_DID_DEF, ///< DID for rollup input metadata memory range - rollup_voucher_hashes = PMA_ROLLUP_VOUCHER_HASHES_DID_DEF, ///< DID for rollup voucher hashes memory range - rollup_notice_hashes = PMA_ROLLUP_NOTICE_HASHES_DID_DEF, ///< DID for rollup notice hashes memory range }; } // namespace cartesi diff --git a/src/protobuf-util.cpp b/src/protobuf-util.cpp index 65c37fc39..7372da372 100644 --- a/src/protobuf-util.cpp +++ b/src/protobuf-util.cpp @@ -38,9 +38,6 @@ void set_proto_memory_range(const memory_range_config &m, CartesiMachine::Memory void set_proto_rollup(const rollup_config &r, CartesiMachine::RollupConfig *proto_r) { set_proto_memory_range(r.rx_buffer, proto_r->mutable_rx_buffer()); set_proto_memory_range(r.tx_buffer, proto_r->mutable_tx_buffer()); - set_proto_memory_range(r.input_metadata, proto_r->mutable_input_metadata()); - set_proto_memory_range(r.voucher_hashes, proto_r->mutable_voucher_hashes()); - set_proto_memory_range(r.notice_hashes, proto_r->mutable_notice_hashes()); } void set_proto_machine_config(const machine_config &c, CartesiMachine::MachineConfig *proto_c) { @@ -793,15 +790,6 @@ rollup_config get_proto_rollup_config(const CartesiMachine::RollupConfig &proto_ if (proto_r.has_tx_buffer()) { r.tx_buffer = get_proto_memory_range_config(proto_r.tx_buffer()); } - if (proto_r.has_input_metadata()) { - r.input_metadata = get_proto_memory_range_config(proto_r.input_metadata()); - } - if (proto_r.has_voucher_hashes()) { - r.voucher_hashes = get_proto_memory_range_config(proto_r.voucher_hashes()); - } - if (proto_r.has_input_metadata()) { - r.notice_hashes = get_proto_memory_range_config(proto_r.notice_hashes()); - } return r; }