Skip to content

Commit b322ded

Browse files
insipxdvdplmemostov
authored
Refactor Tracing (#273)
* Refactor tracing This commit refactors tracing to work with the latest tracing changes in substrate that came with the `RPC for state tracing` PR. Some things in the tracing code were refactored, particularly with reference to executing blocks in order to make the code easier to understand. * add wasm for 8.30 * refactor tracing for changes to state tracing in substrate * Revert "refactor tracing for changes to state tracing in substrate" This reverts commit aa2221a. * add missing method to main_backend, add a common test crate * start creating tests for state tracing * Wasm Binaries & Tests - create macro to pull polkadot blocks from different runtime versions - binaries for 8.30 * Revert changing self.last_max in `blocks.rs` * add blocks for v25 26 and 27 * remove test for now * remove superfluous logline * AlwaysWasm -> NativeElseWasm * fix logs * log::error! * logs * create type-definitions for dot_runtime_api function return value * comment for decl_block_data * remove panic * license headers, update Cargo.lock * Update test-common/Cargo.toml Co-authored-by: David <dvdplm@gmail.com> * Update substrate-archive/src/actors.rs Co-authored-by: David <dvdplm@gmail.com> * remove dead_code in comments * block_hash -> hash, block_num -> number * thorw error when dispatcher fails * expand docs a bit * Don't destroy Mutex in execute_with_tracing Instead of destroying the mutex, which has the possiblity of panicking, prefer to allocate and drain(..) from the mutex. * Update substrate and Polkadot use `ReadRuntimeVersion` instead of `CallInWasmExt` for gathering runtime versions. Instead of calling into wasm, ReadRuntimeVersion will read the text header of a wasm blob first to check if the version exists there. * update substrate & polkadot * add integration test crate * revert integration_tests crae * some cleanup * revert updating to latest substrate * compile polkadot-archive * update dependencies * update dependencies to latest substrate/polkadot * update node-template * use temp substrate branch * dont use live data for unit tests * Write unit tests for TraceHandler Dont use stateful data from Polkadot live chains. * refine test * remove unused from test-wasm * add some asserts for test * Update substrate-archive/src/tasks.rs Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> * update dependencies to latest substrate * style lints * normalize wasm blob names, add 8.30 compiled with older rust compiler * add 0.9.0 and 0.9.1 * add 0.9.2 * add 0.9.3 * use code_substitutes for call executor * update polkadot-service * add especially compiled wasm blobs * Update substrate-archive-backend/src/frontend.rs Co-authored-by: David <dvdplm@gmail.com> * nits * remove duplicate wasm * build 8.30 with earlier compiler version * clippy lints * update polkadot-service dev dep * remove node-template check from actions * split up actions into separate jobs * name actions accordingly * fix node-template workflow * check on pull_request and push to master * check on push to release too * style lints * skip wasm build when checking archive library * skip wasm build on code lints * simplify return type of prepare_block() * Remove CurrentSpan & unnecesary clones - Removes CurrentSpan since that is being deprecated in tracing-subscriber - to facilitate the removal of CurrentSpan, we turn the `TraceHandler` from a `Subscriber` into a `Layer`. This allows us to create a subscriber in `scoped_trace` with tokio's `Registry` type which tracks the `current_span`, and therefore parent-child relationships, for us. - Removed `block_num` and `hash` from the instantiation of `TraceHandler`. `TraceHandler` just needs to be able to track arbitrary spans & events, and the context of those spans & events may be attached after-the-fact. Since we track them with a default dispatcher per-thread, we already did this. Therefore also adding `block_num` and `hash` to `TraceHandler` just created unnecessary cloning and blocknum per-span/event. * code style Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
1 parent cd6a446 commit b322ded

File tree

19 files changed

+693
-3208
lines changed

19 files changed

+693
-3208
lines changed

.github/workflows/archive.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040

4141
- name: Check Code
4242
uses: actions-rs/cargo@v1
43+
env:
44+
SKIP_WASM_BUILD: 1
4345
with:
4446
command: check
4547
args: --all-targets

.github/workflows/lint.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,32 @@ jobs:
3636

3737
- name: Check Code Format
3838
uses: actions-rs/cargo@v1
39+
env:
40+
SKIP_WASM_BUILD: 1
3941
with:
4042
command: fmt
4143
args: --all -- --check
4244

4345
- name: Check Code Format For `node-template-archive`
4446
uses: actions-rs/cargo@v1
47+
env:
48+
SKIP_WASM_BUILD: 1
4549
with:
4650
command: fmt
4751
args: --manifest-path bin/node-template-archive/Cargo.toml -- --check
4852

4953
- name: Check Code Format For `polkadot-archive`
5054
uses: actions-rs/cargo@v1
55+
env:
56+
SKIP_WASM_BUILD: 1
5157
with:
5258
command: fmt
5359
args: --manifest-path bin/polkadot-archive/Cargo.toml -- --check
5460

5561
- name: Code Lint
5662
uses: actions-rs/cargo@v1
63+
env:
64+
SKIP_WASM_BUILD: 1
5765
with:
5866
command: clippy
5967
args: -- -D warnings

0 commit comments

Comments
 (0)