Skip to content

Instantly share code, notes, and snippets.

View notlesh's full-sized avatar

Stephen Shelton notlesh

View GitHub Profile
{
block: {
header: {
parentHash: 0x4d6419ffa9bc491edfaaff046e6444ae6b91a075acb3e6cf1bbbfd0133f56ada,
number: 427,541,
stateRoot: 0xe79958aae9ceaf0f94a28c7e597e42f811914299cbbca5ce5ec1e71ab10fc6ef,
extrinsicsRoot: 0x28d2a3193513c3f8f23e9ec4bb98e4ffaec3a1121793eebd54e706c1d17123b6,
digest: {
logs: [
{
@notlesh
notlesh / test_acct_size_cost.rs
Created August 10, 2021 19:59
test relationship between number of storage items and CPU overehead
#[test]
fn test_timing() {
use std::time::{Instant, Duration};
use frame_benchmarking::{account};
use frame_support::traits::ExistenceRequirement;
println!("test_timing() .........");
/// Create a funded user
fn create_funded_user<T: Config>(
@notlesh
notlesh / moonbeam_panic.log
Created January 22, 2021 15:29
Panic from moonbeam while importing blocks
2021-01-21 21:06:31 ✨ Imported #3916 (0x50af…0fcb)
2021-01-21 21:06:34 [Relaychain] 💤 Idle (3 peers), best: #7960 (0x6d03…b969), finalized #7958 (0x5918…3f21), ⬇ 39.6kiB/s ⬆ 43.0kiB/s
2021-01-21 21:06:34 💤 Idle (10 peers), best: #3915 (0x9f22…6ce5), finalized #3914 (0xf2e3…c208), ⬇ 14.9kiB/s ⬆ 30.7kiB/s
2021-01-21 21:06:36 [Relaychain] ✨ Imported #7961 (0x8cb7…4e04)
2021-01-21 21:06:39 [Relaychain] 💤 Idle (3 peers), best: #7961 (0x8cb7…4e04), finalized #7958 (0x5918…3f21), ⬇ 40.8kiB/s ⬆ 44.8kiB/s
2021-01-21 21:06:39 💤 Idle (10 peers), best: #3915 (0x9f22…6ce5), finalized #3914 (0xf2e3…c208), ⬇ 12.2kiB/s ⬆ 119.2kiB/s
2021-01-21 21:06:42 [Relaychain] ✨ Imported #7962 (0x7f69…b95f)
2021-01-21 21:06:43 💔 Block announcement validation errored: Timeout while waiting for relay-chain block `0xa523…94c2` to be imported.
2021-01-21 21:06:44 [Relaychain] 💤 Idle (3 peers), best: #7962 (0x7f69…b95f), finalized #7959 (0x046f…38f1), ⬇ 37.3kiB/s ⬆ 39.8kiB/s
2021-01-21 21:06:44 💤
@notlesh
notlesh / frontier_dependency_hell.md
Last active January 13, 2021 14:36
Frontier Dependency Hell

In my v0.5-hotfixes branch, I'm running into problems with multiple versions of primitive-types. Example compile error:

error[E0308]: mismatched types
   --> frame/evm/src/runner/stack.rs:369:44
    |
369 |                         Module::<T>::remove_account_if_empty(&address);
    |                                                              ^^^^^^^^
    |
    = note: expected reference `&H160`
@notlesh
notlesh / boom.gdb
Created July 10, 2020 18:30
wtf lokinet stack
>>> bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007fe486ffa859 in __GI_abort () at abort.c:79
#2 0x00007fe486bf6951 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007fe486c0247c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007fe486c024e7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007fe486ad1d03 in std::thread::~thread (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/c++/9/thread:139
#6 lokimq::LokiMQ::run_info::~run_info (this=<optimized out>, __in_chrg=<optimized out>) at /home/stephen/dev/loki-network/external/loki-mq/lokimq/lokimq.h:656
#7 std::_Head_base<0ul, lokimq::LokiMQ::run_info, false>::~_Head_base (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/c++/9/tuple:120
#8 std::_Tuple_impl<0ul, lokimq::LokiMQ::run_info, bool, std::queue<std::pair<lokimq::detail::Batch*, int>, std::deque<std::pair<lokimq::detail::Batch*, int>, std::allocator<std::pair<lokimq::detail::Batch*,
@notlesh
notlesh / endpoint_config_table
Created April 23, 2020 20:04
Notes and a table attempting to describe config options related to endpoints of various flavors
There are multiple config sections which all trickle down into endpoint config options (SetOption()).
These SetOption() functions appear in multiple places (which are used to group the options enumerated
below). These are:
- ExitEndpoint::SetOption()
- TunEndpoint::SetOption()
- Endpoint::SetOption()
- EndpointState::SetOption()
The config sections that are interrelated are:
- [network]
@notlesh
notlesh / clang-format-8-default-configuration.conf
Created April 2, 2020 20:47
clang-format-8 default configuration
---
Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
@notlesh
notlesh / sample.ini
Created March 25, 2020 16:57
wip - conf generation
# this configuration was auto generated with 'sane' defaults
# change these values as desired
[router]
# number of crypto worker threads
threads=4
# path to store signed RC
contact-file=/home/stephen/.lokinet/self.signed
# path to store transport private key
@notlesh
notlesh / config.diff
Last active March 17, 2020 20:15
Using visitors instead of for-each
diff --git a/llarp/config/definition.cpp b/llarp/config/definition.cpp
index 5e45dee6..f6f8800a 100644
--- a/llarp/config/definition.cpp
+++ b/llarp/config/definition.cpp
@@ -60,17 +60,27 @@ Configuration::lookupDefinitionOrThrow(string_view section, string_view name)
const_cast<const Configuration*>(this)->lookupDefinitionOrThrow(section, name));
}
+using SectionVisitor = std::function<void(const std::string&, const DefinitionMap&)>;
+const auto visitSections = [](const SectionMap& sections, SectionVisitor visitor) {
@notlesh
notlesh / config2.2.hpp
Last active March 16, 2020 18:33
config2.2.hpp
/// non-templated base class for all config definition types.
struct ConfigDefinitionBase
{
ConfigDefinitionBase(std::string section_,
std::string name_,
bool required_,
bool multiValued_);
virtual ~ConfigDefinitionBase();