Skip to content

Instantly share code, notes, and snippets.

View niklasad1's full-sized avatar

Niklas Adolfsson niklasad1

View GitHub Profile
@niklasad1
niklasad1 / bench.rs
Last active April 27, 2021 09:47
Bench jsonrpc types v1 vs v2
pub mod batch_input;
use jsonrpsee_types::v2::{response::*, error::*};
criterion_group!(benches, v);
criterion_main!(benches);
enum OutputV2 {
Single(JsonRpcResponse<'static, Value>),
Notif(JsonRpcNotifResponse<Value>),
This file has been truncated, but you can view the full file.
[2021-01-27T16:08:35Z DEBUG jsonrpsee_ws_client::transport] send: {"jsonrpc":"2.0","method":"state_getPairs","params":["0x"],"id":0}
[2021-01-27T16:08:36Z DEBUG jsonrpsee_ws_client::transport] recv: {"jsonrpc":"2.0","result":[["0x11f3ba2e1cdd6d62f2ff9b5589e7ff81ba7fb8745735dc3be2a2c61a72c39e78","0x18d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a4890b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20e659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c"],["0x1cb6f36e027abb2091cfb5110ab5087f06155b3cd9a8c9e5e9a23fd5dc13a5ed","0xabda052000000000"],["0x1cb6f36e027abb2091cfb5110ab5087f5e0621c4869aa60c02be9adcc98a0d1d","0x088eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a480100000000000000d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0100000000000000"],["0x1c
@niklasad1
niklasad1 / Dockerfile
Last active February 28, 2022 15:15 — forked from pepyakin/Dockerfile
Polkadot Raspberry PI cross-compile build
# Put this file in the root of substrate / polkadot directory and build the image using
# the following command
#
# docker build -t <container id> .
#
# you can pick <container id> yourself. For example: `johndoe/rpi-cross`.
#
FROM rust:latest
instruction: STATICCALL, sender: 0x6280441cc35b50bbcc8c38bb7ecf325f3a190e97, receiver: 0x0000000000000000000000000000000000000001
Ext::call, sender: 0x6280441cc35b50bbcc8c38bb7ecf325f3a190e97, receiver: 0x0000000000000000000000000000000000000001, data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 56, 170, 212, 235, 103, 78, 32, 114, 129, 120, 157, 184, 65, 199, 93, 145, 185, 231, 115, 67, 245, 185, 238, 127, 232, 249, 229, 162, 249, 58, 196, 53, 80, 113, 95, 192, 97, 28, 204, 161, 15, 87, 80, 79, 139, 7, 52, 93, 43, 51, 78, 239, 81, 235, 127, 15, 92, 210, 179, 4, 37, 93, 53, 203], value: Some(0)
execute_instruction; TRAP, sender: 0x6280441cc35b50bbcc8c38bb7ecf325f3a190e97, receiver: 0x0000000000000000000000000000000000000001
step_inner; TRAP; sender: 0xa550cf4f03bd2417cf83c8a652703cdc33c016ee receiver: 0x6280441cc35b50bbcc8c38bb7ecf325f3a190e97
exec; TRAP; sender
@niklasad1
niklasad1 / after_secp256k1.txt
Created April 7, 2020 09:51
after secp256k1 update
header:
Header {
parent_hash: 0xc00cf5e6733d4029d50fcf52e255dcaebae8505860ccfafe8a84ab1f2d3e0e75,
timestamp: 1579884350,
number: 2056970,
author: 0x0000000000000000000000000000000000000000,
transactions_root: 0xa03579dbb1bb8e4a97b9cbcbb765f7d4cec31f1333dd9eaad8969872d5eed193,
uncles_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347,
extra_data: [216, 131, 1, 9, 10, 132, 103, 101, 116, 104, 136, 103, 111, 49, 46, 49, 51, 46, 54, 133, 108, 105, 110, 117, 120, 0, 0, 0, 0, 0, 0, 0, 148, 112, 57, 149, 85, 137, 211, 250, 65, 94, 188, 157, 170, 5, 221, 242, 133, 144, 221, 221, 17, 40, 18, 179, 46, 223, 232, 199, 13, 185, 170, 82, 10, 131, 224, 70, 170, 20, 139, 179, 212, 20, 185, 199, 250, 174, 249, 202, 222, 209, 173, 242, 69, 204, 248, 148, 72, 21, 247, 64, 203, 228, 4, 54, 0],
@niklasad1
niklasad1 / block_before.txt
Created April 7, 2020 09:24
before secp256k update
'header:
Header {
parent_hash: 0xc00cf5e6733d4029d50fcf52e255dcaebae8505860ccfafe8a84ab1f2d3e0e75,
timestamp: 1579884350,
number: 2056970,
author: 0x0000000000000000000000000000000000000000,
transactions_root: 0xa03579dbb1bb8e4a97b9cbcbb765f7d4cec31f1333dd9eaad8969872d5eed193,
uncles_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347,
extra_data: [216, 131, 1, 9, 10, 132, 103, 101, 116, 104, 136, 103, 111, 49, 46, 49, 51, 46, 54, 133, 108, 105, 110, 117, 120, 0, 0, 0, 0, 0, 0, 0, 148, 112, 57, 149, 85, 137, 211, 250, 65, 94, 188, 157, 170, 5, 221, 242, 133, 144, 221, 221, 17, 40, 18, 179, 46, 223, 232, 199, 13, 185, 170, 82, 10, 131, 224, 70, 170, 20, 139, 179, 212, 20, 185, 199, 250, 174, 249, 202, 222, 209, 173, 242, 69, 204, 248, 148, 72, 21, 247, 64, 203, 228, 4, 54, 0],
state_root: 0xd305b5aefa4f3e6c953023acf20bb3165c823e42a350e76df2b32789a7d0c536,
2020-04-06 12:23:59 Syncing #2056969 0xc00c…0e75 354.20 blk/s 787.2 tx/s 166.5 Mgas/s 0+15500 Qed #2072682 15/25 peers 5 MiB chain 128 MiB db 95 MiB queue 43 MiB sync RPC: 0 conn, 0 req/s, 0 µs
2020-04-06 12:23:59 Stage 5 block verification failed for #2056970 (0x721a…7b75)
Error: Block(InvalidStateRoot(Mismatch { expected: 0xd305b5aefa4f3e6c953023acf20bb3165c823e42a350e76df2b32789a7d0c536, found: 0x2566bf5ac1202a6e1174810dfb0288c0bc3a6c4bbb80c7a3686b1ac148fea296 }))
2020-04-06 12:23:59
Bad block detected: Block error: Invalid state root in header: Expected 0xd305…c536, found 0x2566…a296
RLP: f90aeef9025ca0c00cf5e6733d4029d50fcf52e255dcaebae8505860ccfafe8a84ab1f2d3e0e75a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0d305b5aefa4f3e6c953023acf20bb3165c823e42a350e76df2b32789a7d0c536a0a03579dbb1bb8e4a97b9cbcbb765f7d4cec31f1333dd9eaad8969872d5eed193a02beba12b0119d01367e0dc672e7d219d1820c319f8c64f39780254b56a9538e3b901000000000000
➜ SGX-hardware (master) ✗ ./test-sgx
eax: 906ea ebx: b100800 ecx: 7ffafbbf edx: bfebfbff
stepping 10
model 14
family 6
processor type 0
extended model 9
extended family 0
smx: 0
@niklasad1
niklasad1 / dump.txt
Created March 10, 2020 19:04
OpenEthereum CI
Running `/Users/runner/runners/2.165.2/work/openethereum/openethereum/target/release/build/parity-snappy-sys-1cd8cb56dfd03300/build-script-build`
error: failed to run custom build command for `parity-snappy-sys v0.1.2`
##[error]failed to run custom build command for `parity-snappy-sys v0.1.2`
Caused by:
process didn't exit successfully: `/Users/runner/runners/2.165.2/work/openethereum/openethereum/target/release/build/parity-snappy-sys-1cd8cb56dfd03300/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parity-snappy-sys-0.1.2/snappy" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DCMAKE_INSTALL_PREFIX=/Users/runner/runners/2.165.2/work/openethereum/openethereum/target/release/build/parity-snappy-sys-a52e155243d24918/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=R
@niklasad1
niklasad1 / git.patch
Created March 10, 2020 10:28
[stablecoin]: make it compile
diff --git a/src/ringbuffer.rs b/src/ringbuffer.rs
index 600f9ed..a57a88f 100644
--- a/src/ringbuffer.rs
+++ b/src/ringbuffer.rs
@@ -4,27 +4,27 @@ use frame_support::storage::{StorageValue, StorageMap};
pub type Index = u16;
-pub struct RingBufferTransient<T> {
+pub struct RingBufferTransient<T, I, B, M> {