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

Remove deprecated tracing API #429

Merged
merged 1 commit into from
Sep 25, 2019
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
1 change: 0 additions & 1 deletion bindings/rust/evmc-declare/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ fn build_create_fn(names: &VMNameSet) -> proc_macro2::TokenStream {
execute: Some(__evmc_execute),
get_capabilities: Some(__evmc_get_capabilities),
set_option: None,
set_tracer: None,
name: unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(#static_name_ident.as_bytes()).as_ptr() as *const i8 },
version: unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(#static_version_ident.as_bytes()).as_ptr() as *const i8 },
};
Expand Down
1 change: 0 additions & 1 deletion bindings/rust/evmc-vm/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ mod tests {
destroy: None,
execute: None,
get_capabilities: None,
set_tracer: None,
set_option: None,
};

Expand Down
1 change: 0 additions & 1 deletion examples/example_precompiles_vm/example_precompiles_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ extern "C" EVMC_EXPORT evmc_instance* evmc_create_example_precompiles_vm()
execute,
[](evmc_instance*) { return evmc_capabilities_flagset{EVMC_CAPABILITY_PRECOMPILES}; },
nullptr,
nullptr,
};
return &instance;
}
89 changes: 0 additions & 89 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,84 +854,6 @@ typedef uint32_t evmc_capabilities_flagset;
*/
typedef evmc_capabilities_flagset (*evmc_get_capabilities_fn)(struct evmc_instance* instance);

/**
* The opaque type representing a Client-side tracer object.
*
* @deprecated Deprecated since EVMC 6.3, see evmc_instance::set_tracer().
*/
struct evmc_tracer_context;

/**
* The callback to trace instructions execution in an EVM.
*
* This function informs the Client what instruction has been executed in the EVM implementation
* and what are the results of executing this particular instruction.
* The message level information (like call depth, destination address, etc.) are not provided here.
* This piece of information can be acquired by inspecting messages being sent to the EVM in
* ::evmc_execute_fn and the results of the messages execution.
*
* @deprecated Deprecated since EVMC 6.3, see evmc_instance::set_tracer().
*
* @param context The pointer to the Client-side tracing context. This allows to
* implement the tracer in OOP manner.
* @param code_offset The current instruction position in the code.
* @param status_code The status code of the instruction execution.
* @param gas_left The amount of the gas left after the instruction execution.
* @param stack_num_items The current EVM stack height after the instruction execution.
* @param pushed_stack_item The top EVM stack item pushed as the result of the instruction
* execution. This value is null when the instruction does not push
* anything to the stack.
* @param memory_size The size of the EVM memory after the instruction execution.
* @param changed_memory_offset The offset in number of bytes of the beginning of the memory area
* modified as the result of the instruction execution.
* The Client MAY use this information together with
* @p changed_memory_size and @p changed_memory to incrementally
* update the copy of the full VM's memory.
* @param changed_memory_size The size of the memory area modified as the result of
* the instruction execution.
* @param changed_memory The pointer to the memory area modified as the result of
* the instruction execution.
* The Client MAY access the pointed memory area
* (limited by the @p changed_memory_size) only during the current
* execution of the evmc_trace_callback().
* The pointer MUST NOT be stored by the Client.
* The Client MUST NOT assume that
* `changed_memory - changed_memory_offset` is a valid base pointer
* of the VM memory.
*/
typedef void (*evmc_trace_callback)(struct evmc_tracer_context* context,
size_t code_offset,
enum evmc_status_code status_code,
int64_t gas_left,
size_t stack_num_items,
const evmc_uint256be* pushed_stack_item,
size_t memory_size,
size_t changed_memory_offset,
size_t changed_memory_size,
const uint8_t* changed_memory);

/**
* Sets the EVM instruction tracer.
*
* When the tracer is set in the EVM instance, the EVM SHOULD call back the tracer with information
* about instructions execution in the EVM.
* @see ::evmc_trace_callback.
*
* This will overwrite the previous settings (the callback and the context).
*
* @deprecated Deprecated since EVMC 6.3, see evmc_instance::set_tracer().
*
* @param instance The EVM instance.
* @param callback The tracer callback function. This argument MAY be NULL to disable previously
* set tracer.
* @param context The Client-side tracer context. This argument MAY be NULL in case the tracer
* does not require any context. This argument MUST be NULL if the callback
* argument is NULL.
*/
typedef void (*evmc_set_tracer_fn)(struct evmc_instance* instance,
evmc_trace_callback callback,
struct evmc_tracer_context* context);


/**
* The EVM instance.
Expand Down Expand Up @@ -990,17 +912,6 @@ struct evmc_instance
*/
evmc_get_capabilities_fn get_capabilities;

/**
* Optional pointer to function setting the EVM instruction tracer.
*
* If the EVM does not support this feature the pointer can be NULL.
*
* @deprecated
* Since EVMC 6.3, the tracing API has been deprecated as there have been some
* design flaws discovered. New API is expected to be introduced in future.
*/
evmc_set_tracer_fn set_tracer;

/**
* Optional pointer to function modifying VM's options.
*
Expand Down
14 changes: 0 additions & 14 deletions include/evmc/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,6 @@ static inline enum evmc_set_option_result evmc_set_option(struct evmc_instance*
return EVMC_SET_OPTION_INVALID_NAME;
}

/**
* Sets the tracer callback for the VM instance, if the feature is supported by the VM.
*
* @see evmc_set_tracer_fn
*/
EVMC_DEPRECATED
static inline void evmc_set_tracer(struct evmc_instance* instance,
evmc_trace_callback callback,
struct evmc_tracer_context* context)
{
if (instance->set_tracer)
instance->set_tracer(instance, callback, context);
}

/**
* Executes code in the VM instance.
*
Expand Down
7 changes: 3 additions & 4 deletions test/unittests/test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ TEST(cpp, vm)

TEST(cpp, vm_set_option)
{
evmc_instance raw_instance = {EVMC_ABI_VERSION, "", "", nullptr,
nullptr, nullptr, nullptr, nullptr};
evmc_instance raw_instance = {EVMC_ABI_VERSION, "", "", nullptr, nullptr, nullptr, nullptr};
raw_instance.destroy = [](evmc_instance*) {};

auto vm = evmc::VM{&raw_instance};
Expand All @@ -294,8 +293,8 @@ TEST(cpp, vm_move)
{
static int destroy_counter = 0;
const auto template_instance =
evmc_instance{EVMC_ABI_VERSION, "", "", [](evmc_instance*) { ++destroy_counter; },
nullptr, nullptr, nullptr, nullptr};
evmc_instance{EVMC_ABI_VERSION, "", "", [](evmc_instance*) { ++destroy_counter; },
nullptr, nullptr, nullptr};

EXPECT_EQ(destroy_counter, 0);
{
Expand Down
9 changes: 4 additions & 5 deletions test/unittests/test_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class loader : public ::testing::Test
/// Creates a VM mock with only destroy() method.
static evmc_instance* create_vm_barebone()
{
static auto instance = evmc_instance{EVMC_ABI_VERSION, "vm_barebone", "", destroy,
nullptr, nullptr, nullptr, nullptr};
static auto instance =
evmc_instance{EVMC_ABI_VERSION, "vm_barebone", "", destroy, nullptr, nullptr, nullptr};
++create_count;
return &instance;
}
Expand All @@ -85,7 +85,7 @@ class loader : public ::testing::Test
constexpr auto wrong_abi_version = 1985;
static_assert(wrong_abi_version != EVMC_ABI_VERSION, "");
static auto instance =
evmc_instance{wrong_abi_version, "", "", destroy, nullptr, nullptr, nullptr, nullptr};
evmc_instance{wrong_abi_version, "", "", destroy, nullptr, nullptr, nullptr};
++create_count;
return &instance;
}
Expand All @@ -94,8 +94,7 @@ class loader : public ::testing::Test
static evmc_instance* create_vm_with_set_option() noexcept
{
static auto instance = evmc_instance{
EVMC_ABI_VERSION, "vm_with_set_option", "", destroy, nullptr, nullptr, nullptr,
set_option};
EVMC_ABI_VERSION, "vm_with_set_option", "", destroy, nullptr, nullptr, set_option};
++create_count;
return &instance;
}
Expand Down
9 changes: 0 additions & 9 deletions test/vmtester/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,6 @@ TEST_F(evmc_vm_test, set_option_unknown_value)
}
}

TEST_F(evmc_vm_test, set_tracer)
{
static const auto tracer_callback =
[](evmc_tracer_context*, size_t, evmc_status_code, int64_t, size_t, const evmc_uint256be*,
size_t, size_t, size_t, const uint8_t*) noexcept {};
if (vm->set_tracer)
vm->set_tracer(vm, tracer_callback, nullptr);
}

TEST_F(evmc_vm_test, precompile_test)
{
// This logic is based on and should match the description in EIP-2003.
Expand Down