Skip to content

Instantly share code, notes, and snippets.

View Fraser999's full-sized avatar

Fraser Hutchison Fraser999

  • Dalrymple, Scotland.
View GitHub Profile
@Fraser999
Fraser999 / casper_node_networking_protocol_1.5.0.md
Created August 9, 2022 17:59
Casper Node Networking Protocol (Mainnet Protocol Version 1.5.0)

Casper Node Networking Protocol (Mainnet Protocol Version 1.5.0)

This is a description of the casper-node's networking protocol. This document follows the conventions laid out in RFC2119.

Connection level

Any casper-node taking part in the casper network SHOULD open connections to every other casper-node it is aware of and has not blocked. These connections are established using TLS, presenting a client certificate.

Reciprocity, retries and data direction

@Fraser999
Fraser999 / rpc.discovery.json
Created April 21, 2021 19:03
The OpenRPC-compatible schema describing the JSON-RPC API of the Casper network at version 1.0.0.
{
"openrpc":"1.0.0-rc1",
"info":{
"version":"1.0.0",
"title":"Client API of Casper Node",
"description":"This describes the JSON-RPC 2.0 API of a node on the Casper network.",
"contact":{
"name":"CasperLabs",
"url":"https://casperlabs.io"
},
@Fraser999
Fraser999 / install-upgrade.sh
Last active April 16, 2021 15:33
nctl upgrade scripts
#!/usr/bin/bash
set -o errexit
set -o pipefail
ACTIVATION_POINT=1
NODE_V2="/home/fraser/Rust/casper-node/target/release/casper-node"
V2=1_1_0
V2_SEMVER=1.1.0
@Fraser999
Fraser999 / chainspec.toml.diff
Created February 5, 2021 16:33
Diff between chainspec <= 0.7.3 and later
1c1,9
< [genesis]
---
> [protocol]
> # Protocol version.
> version = '1.0.0'
>
> [protocol.activation_point]
> # This protocol version becomes active at the start of this era.
> era_id = 0
{
"components": {
"schemas": {
"Account": {
"description": "Structure representing a user's account, stored in global state.",
"properties": {
"account_hash": {
"$ref": "#/components/schemas/AccountHash"
},
"action_thresholds": {
@Fraser999
Fraser999 / bench.txt
Created November 17, 2020 14:00
Benchmarks of wrapped bytes
serialize_vector_of_i32s
time: [105.88 us 106.06 us 106.26 us]
change: [+3.7910% +3.9990% +4.2281%] (p = 0.00 < 0.05)
Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
3 (3.00%) high mild
3 (3.00%) high severe
deserialize_vector_of_i32s
time: [2.3306 us 2.3336 us 2.3372 us]
@Fraser999
Fraser999 / Default (without system contracts).txt
Created March 27, 2020 18:43
Benchmarks without gas metering injected
tps/transfer_to_existing_account_multiple_execs/3/false
time: [4.1253 ms 4.1331 ms 4.1398 ms]
thrpt: [724.67 elem/s 725.85 elem/s 727.22 elem/s]
change:
time: [-18.142% -17.929% -17.739%] (p = 0.00 < 0.05)
thrpt: [+21.564% +21.846% +22.162%]
Performance has improved.
tps/transfer_to_existing_account_multiple_deploys_per_exec/3/false
time: [4.4451 ms 4.5028 ms 4.5329 ms]
thrpt: [661.83 elem/s 666.25 elem/s 674.91 elem/s]
tps/transfer_to_existing_account_multiple_execs/3
time: [299.34 ms 300.82 ms 304.37 ms]
thrpt: [9.8563 elem/s 9.9726 elem/s 10.022 elem/s]
change:
time: [+97.665% +101.15% +105.00%] (p = 0.00 < 0.05)
thrpt: [-51.218% -50.285% -49.409%]
Performance has regressed.
Benchmarking tps/transfer_to_existing_account_multiple_deploys_per_exec/3: Warming up for 3.0000 s
Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 15.9s or reduce sample count to 10
tps/transfer_to_existing_account_multiple_deploys_per_exec/3
@Fraser999
Fraser999 / DocOpt.cmake
Created October 5, 2015 03:00
Example showing ExternalProject_Add for DocOpt
include(ExternalProject)
# Set default ExternalProject root directory
set_directory_properties(PROPERTIES EP_PREFIX "${CMAKE_BINARY_DIR}/Third Party")
set(InstallPath "${CMAKE_BINARY_DIR}/Installed Dependencies")
# Add DocOpt
ExternalProject_Add(
DocOpt
@Fraser999
Fraser999 / deferred_function.cc
Created October 29, 2013 20:44
Shows results of `wait_for` on a deferred function.
#include <chrono>
#include <future>
#include <iostream>
#include <string>
#include <thread>
void DoStuff() {
std::cout << "Starting task.\n";
std::this_thread::sleep_for(std::chrono::seconds(2));
}