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

Unified client for regular and tracing nodes #791

Merged
merged 32 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5c09079
separate tracing into client-only and runtime/common
nanocryk Sep 6, 2021
e26e4a7
small additional changes
nanocryk Sep 6, 2021
7adfd47
update tests
nanocryk Sep 7, 2021
5e2519a
Merge remote-tracking branch 'origin/master' into jeremy-tracing-refa…
nanocryk Sep 7, 2021
7057089
fix type
nanocryk Sep 7, 2021
eca2d8c
move back api trait at root of the crate
nanocryk Sep 7, 2021
178e069
fix more paths
nanocryk Sep 7, 2021
0b31bf4
merge
nanocryk Sep 8, 2021
ff0ab83
remove support for v1
nanocryk Sep 8, 2021
99c8ad4
handle manual block initialization
nanocryk Sep 8, 2021
80515c9
remove header from debug Runtime API + cleanup
nanocryk Sep 9, 2021
811ec3d
Always initialize
tgmichel Sep 10, 2021
6ba4032
keep deprecated host functions
nanocryk Sep 10, 2021
f91e8a0
remove logs in host functions
nanocryk Sep 10, 2021
86edae4
Remove `evm-tracing` feature from client
tgmichel Sep 13, 2021
6b4817f
Remove bogus `evm_tracer` impl
tgmichel Sep 13, 2021
8df5f87
Merge branch 'master' into jeremy-tracing-client-substitutes-support
tgmichel Sep 16, 2021
ff4da7c
Update cargo.lock
tgmichel Sep 16, 2021
bcfec6b
Try fix CI
tgmichel Sep 16, 2021
f77ca55
Move evm tracing integration tests
tgmichel Sep 16, 2021
3b677ab
CI run evm tracing integration tests
tgmichel Sep 16, 2021
6b7974e
Cleanup
tgmichel Sep 16, 2021
0035c33
Remove `EventV2` alias
tgmichel Sep 16, 2021
284917b
Merge branch 'master' into jeremy-tracing-client-substitutes-support
tgmichel Sep 16, 2021
3c17e17
Use `runtime-substitutes-0.30.1` evm branch
tgmichel Sep 17, 2021
906f04f
`debug` or `trace` namespaces require `--wasm-runtime-overrides`
tgmichel Sep 20, 2021
0534abf
Fix CI
tgmichel Sep 22, 2021
78b6b42
CallInner type is `lowercase`
tgmichel Sep 22, 2021
3548cff
Substrate pin `crystalin-v0.9.9-block-response-length#63b0bdf`
tgmichel Sep 22, 2021
77691aa
Merge branch 'master' into jeremy-tracing-client-substitutes-support
tgmichel Sep 22, 2021
695b082
Set `wasm-runtime-overrides` arg in ts tests
tgmichel Sep 22, 2021
0227277
Prettier
tgmichel Sep 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ jobs:
run: |
env
cargo build --release --all
- name: Build Tracing Node
if: contains(github.event.pull_request.labels.*.name, 'A10-evmtracing')
run: |
env
cargo build --release -p moonbeam -p moonbase-runtime --features moonbase-runtime/evm-tracing
- name: Verify node version
run: |
GIT_COMMIT=`git log -1 --format="%H" | cut -c1-7`
Expand All @@ -231,6 +236,9 @@ jobs:
echo "$MB_VERSION" | grep $GIT_COMMIT
- name: Unit tests
run: cargo test --release --all
- name: Unit tests (tracing)
if: contains(github.event.pull_request.labels.*.name, 'A10-evmtracing')
run: cargo test --release -p moonbase-runtime -p moonbeam-runtime -p moonriver-runtime --test evm_tracing --features evm-tracing

# We determine whether there are unmodified Cargo.lock files by:
# 1. Asking git for a list of all modified files
Expand Down Expand Up @@ -294,6 +302,18 @@ jobs:
cd ../tests
npm install
node_modules/.bin/mocha --parallel -j 7 -r ts-node/register 'tests/**/test-*.ts'
- name: Typescript evm-tracing tests (against dev service)
if: contains(github.event.pull_request.labels.*.name, 'A10-evmtracing')
env:
BINARY_PATH: ../build/moonbeam
# `debug` or `trace` require `--wasm-runtime-overrides`. For CI we can provide any directory.
ETHAPI_CMD: --ethapi=txpool,debug,trace --wasm-runtime-overrides ../build
run: |
cd moonbeam-types-bundle
npm install
cd ../tests
npm install
node_modules/.bin/mocha --parallel -j 7 -r ts-node/register 'tracing-tests/**/test-*.ts'

# We determine whether there are unmodified package-lock.json files by:
# 1. Asking git for a list of all modified files
Expand Down Expand Up @@ -367,7 +387,7 @@ jobs:
- name: Build Tracing Node
run: |
env
cargo build --release -p moonbeam --features evm-tracing
cargo build --release -p moonbeam -p moonbase-runtime --features moonbase-runtime/evm-tracing
tgmichel marked this conversation as resolved.
Show resolved Hide resolved
- name: Save moonbeam tracing binary
run: |
mkdir -p build
Expand Down Expand Up @@ -408,7 +428,8 @@ jobs:
- name: Typescript evm-tracing tests (against dev service)
env:
BINARY_PATH: ../build/moonbeam-tracing
ETHAPI_CMD: --ethapi=txpool,debug,trace
# `debug` or `trace` require `--wasm-runtime-overrides`. For CI we can provide any directory.
ETHAPI_CMD: --ethapi=txpool,debug,trace --wasm-runtime-overrides ../build
run: |
cd tests
node_modules/.bin/mocha --parallel -j 7 -r ts-node/register 'tracing-tests/**/test-*.ts'
Expand Down
9 changes: 9 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"panel": "new"
}
},
{
"label": "Build Moonbeam (debug symbols + tracing)",
"type": "shell",
"command": "RUSTFLAGS=-g cargo build --release --features=evm-tracing",
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Run single test file in debug mode",
"type": "shell",
Expand Down
45 changes: 35 additions & 10 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ panic = 'unwind'

# Fix EVM tracing impact in block production pipeline.
[patch.crates-io]
evm = { git = "https://github.com/purestake/evm", branch = "jeremy-optimize-disabled-tracing"}
evm-runtime = { git = "https://github.com/purestake/evm", branch = "jeremy-optimize-disabled-tracing" }
evm-gasometer = { git = "https://github.com/purestake/evm", branch = "jeremy-optimize-disabled-tracing" }
evm = { git = "https://github.com/purestake/evm", branch = "runtime-substitutes-0.30.1"}
evm-runtime = { git = "https://github.com/purestake/evm", branch = "runtime-substitutes-0.30.1" }
evm-gasometer = { git = "https://github.com/purestake/evm", branch = "runtime-substitutes-0.30.1" }
14 changes: 14 additions & 0 deletions client/evm-tracing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "moonbeam-client-evm-tracing"
version = '0.1.0'
authors = ['PureStake']
edition = '2018'
homepage = 'https://moonbeam.network'
license = 'GPL-3.0-only'
repository = 'https://github.com/PureStake/moonbeam/'

[dependencies]
moonbeam-rpc-primitives-debug = { path = "../../primitives/rpc/debug" }
evm-tracing-events = { path = "../../primitives/rpc/evm-tracing-events" }
ethereum-types = { version = "0.12.0" }
serde = { version = "1.0", features = ["derive"] }
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

use crate::proxy::v2::call_list::Listener;
use crate::single::TransactionTrace;
use crate::listeners::call_list::Listener;
use moonbeam_rpc_primitives_debug::api::single::TransactionTrace;

pub struct Response;
pub struct Formatter;

#[cfg(feature = "std")]
impl super::TraceResponseBuilder for Response {
impl super::ResponseFormatter for Formatter {
type Listener = Listener;
type Response = TransactionTrace;

fn build(listener: Listener) -> Option<TransactionTrace> {
fn format(listener: Listener) -> Option<TransactionTrace> {
if let Some(entry) = listener.entries.last() {
return Some(TransactionTrace::CallList(
entry.into_iter().map(|(_, value)| value.clone()).collect(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ pub mod blockscout;
pub mod raw;
pub mod trace_filter;

use crate::proxy::v2::Listener;
#[cfg(feature = "std")]
pub use blockscout::Formatter as Blockscout;
pub use raw::Formatter as Raw;
pub use trace_filter::Formatter as TraceFilter;

use evm_tracing_events::Listener;
use serde::Serialize;

#[cfg(feature = "std")]
pub trait TraceResponseBuilder {
pub trait ResponseFormatter {
type Listener: Listener;
type Response: Serialize;

fn build(listener: Self::Listener) -> Option<Self::Response>;
fn format(listener: Self::Listener) -> Option<Self::Response>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

use crate::proxy::v2::raw::Listener;
use crate::single::TransactionTrace;
use crate::listeners::raw::Listener;
use moonbeam_rpc_primitives_debug::api::single::TransactionTrace;

pub struct Response;
pub struct Formatter;

#[cfg(feature = "std")]
impl super::TraceResponseBuilder for Response {
impl super::ResponseFormatter for Formatter {
type Listener = Listener;
type Response = TransactionTrace;

fn build(listener: Listener) -> Option<TransactionTrace> {
fn format(listener: Listener) -> Option<TransactionTrace> {
Some(TransactionTrace::Raw {
step_logs: listener.step_logs,
gas: listener.final_gas.into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

use crate::block::{
TransactionTrace, TransactionTraceAction, TransactionTraceOutput, TransactionTraceResult,
use crate::listeners::call_list::Listener;
use ethereum_types::H256;
use moonbeam_rpc_primitives_debug::api::{
block::{
TransactionTrace, TransactionTraceAction, TransactionTraceOutput, TransactionTraceResult,
},
single::CallInner,
CallResult, CreateResult, CreateType,
};
use crate::proxy::v2::call_list::Listener;
use crate::{single::CallInner, CallResult, CreateResult, CreateType};

pub use ethereum_types::{H160, H256, U256};
pub struct Formatter;

pub struct Response;

#[cfg(feature = "std")]
impl super::TraceResponseBuilder for Response {
impl super::ResponseFormatter for Formatter {
type Listener = Listener;
type Response = Vec<TransactionTrace>;

fn build(mut listener: Listener) -> Option<Vec<TransactionTrace>> {
fn format(mut listener: Listener) -> Option<Vec<TransactionTrace>> {
// Remove empty BTreeMaps pushed to `entries`.
// I.e. InvalidNonce or other pallet_evm::runner exits
listener.entries.retain(|x| !x.is_empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

pub mod evm_gasometer_types;
pub mod evm_runtime_types;
pub mod evm_types;
//! This crate contains the client-side part that interacts with our "v2" tracing design.

pub use evm_gasometer_types::GasometerEvent;
pub use evm_runtime_types::RuntimeEvent;
pub use evm_types::EvmEvent;
pub mod formatters;
pub mod listeners;