Skip to content
Open
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
4 changes: 2 additions & 2 deletions libraries/libfc/src/network/http/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ class http_client_impl {
auto deadline = epoch + boost::posix_time::microseconds(_deadline.time_since_epoch().count());
FC_ASSERT(dest.host(), "No host set on URL");

string path = dest.path() ? dest.path()->generic_string() : "/";
std::string path = dest.path() ? dest.path()->generic_string() : "/";
if (dest.query()) {
path = path + "?" + *dest.query();
}

string host_str = *dest.host();
std::string host_str = *dest.host();
if (dest.port()) {
auto port = *dest.port();
auto proto_iter = default_proto_ports.find(dest.proto());
Expand Down
16 changes: 10 additions & 6 deletions plugins/subst_api_plugin/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
#include "subst_plugin.hpp"


#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type) \
#define CALL_WITH_400(api_name, category, api_handle, api_namespace, call_name, http_response_code, params_type) \
{std::string("/v1/" #api_name "/" #call_name), \
api_category::category,\
[api_handle](string&&, string&& body, url_response_callback&& cb) mutable { \
auto deadline = api_handle.start(); \
try { \
auto params = parse_params<api_namespace::call_name ## _params, params_type>(body);\
FC_CHECK_DEADLINE(deadline);\
fc::variant result( api_handle.call_name( std::move(params), deadline ) ); \
cb(http_response_code, deadline, std::move(result)); \
cb(http_response_code, std::move(result)); \
} catch (...) { \
http_plugin::handle_exception(#api_name, #call_name, body, cb); \
} \
}}

#define SUBST_CALL(call_name, http_response_code, params_type) \
CALL_WITH_400(subst, subst_api, eosio::subst_apis, call_name, http_response_code, params_type)
#define SUBST_RO_CALL(call_name, http_response_code, params_type) \
CALL_WITH_400(subst, chain_ro, subst_api, eosio::subst_apis, call_name, http_response_code, params_type)

#define SUBST_RW_CALL(call_name, http_response_code, params_type) \
CALL_WITH_400(subst, chain_rw, subst_api, eosio::subst_apis, call_name, http_response_code, params_type)


namespace eosio {
Expand Down Expand Up @@ -131,12 +134,13 @@ namespace eosio {

#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
// if oc mode is enabled fetch code descriptor
std::optional<eosvmoc_tier>& eosvmoc = sctx.get_eosvmoc();
auto& eosvmoc = sctx.get_eosvmoc();
if (eosvmoc && meta->og_hash() != digest_type()) {
status_eosvmoc_cache ocvm_status;

chain::eosvmoc::code_cache_base::get_cd_failure failure = chain::eosvmoc::code_cache_base::get_cd_failure::temporary;
const code_descriptor* cd = eosvmoc->cc.get_descriptor_for_code(
true,
code_obj->code_hash,
code_obj->vm_version,
false,
Expand Down
12 changes: 6 additions & 6 deletions plugins/subst_api_plugin/subst_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace eosio {
// read only
_http_plugin->add_api({

SUBST_CALL(status, 200, http_params_types::possible_no_params)
SUBST_RO_CALL(status, 200, http_params_types::possible_no_params)

}, appbase::exec_queue::read_only);

Expand All @@ -34,12 +34,12 @@ namespace eosio {
wlog("subst-admin-apis enabled, don\'t expose these to ");
_http_plugin->add_api({

SUBST_CALL(upsert, 200, http_params_types::params_required),
SUBST_CALL(activate, 200, http_params_types::possible_no_params),
SUBST_CALL(deactivate, 200, http_params_types::possible_no_params),
SUBST_CALL(remove, 200, http_params_types::possible_no_params),
SUBST_RW_CALL(upsert, 200, http_params_types::params_required),
SUBST_RW_CALL(activate, 200, http_params_types::possible_no_params),
SUBST_RW_CALL(deactivate, 200, http_params_types::possible_no_params),
SUBST_RW_CALL(remove, 200, http_params_types::possible_no_params),

SUBST_CALL(fetch_manifest, 200, http_params_types::no_params)
SUBST_RW_CALL(fetch_manifest, 200, http_params_types::no_params)

}, appbase::exec_queue::read_write, appbase::priority::highest);
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/subst_plugin/substitution_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace eosio {

#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
// remove eosvmoc code cache if present
std::optional<eosvmoc_tier>& eosvmoc = get_eosvmoc();
auto& eosvmoc = get_eosvmoc();

if (eosvmoc) {
eosvmoc->cc.free_code(cobj->code_hash, cobj->vm_version);
Expand Down Expand Up @@ -336,7 +336,7 @@ namespace eosio {
auto it = manif_obj.find(chain_id);
if (it != manif_obj.end()) {
for (auto subst_entry : (*it).value().get_object()) {
bpath url_path = *(target_url.path());
std::filesystem::path url_path = *(target_url.path());
auto wasm_url_path = url_path.remove_filename() / chain_id / subst_entry.value().get_string();

auto wasm_url = fc::url(
Expand Down
9 changes: 2 additions & 7 deletions plugins/subst_plugin/substitution_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#endif


typedef boost::filesystem::path bpath;


namespace http = boost::beast::http;


Expand All @@ -41,8 +38,6 @@ namespace eosio {
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
using chain::eosvmoc::code_descriptor;
using chain::eosvmoc::code_cache_async;

typedef chain::wasm_interface_impl::eosvmoc_tier eosvmoc_tier;
#endif

struct by_account;
Expand Down Expand Up @@ -127,8 +122,8 @@ namespace eosio {
void reset_caches(const name& account);

#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
// get a reference to wasm iface eosvmoc_tier optional field
std::optional<eosvmoc_tier>& get_eosvmoc() {
// get ptr to wasm iface eosvmoc_tier
std::unique_ptr<chain::wasm_interface_impl::eosvmoc_tier>& get_eosvmoc() {
return control->get_wasm_interface().my->eosvmoc;
}
#endif
Expand Down