Skip to content

Instantly share code, notes, and snippets.


Viktor Kirilov onqtam

View GitHub Profile
onqtam /
Last active Dec 11, 2020
A proposal to split Ethereum witnesses into 2 parts


This is a proposal to split witnesses into 2 complementary parts: data and proofs, allowing for stateless clients to process just the necessary data without the merkle proofs (and thus greatly reducing network traffic) and without proving the stateRoot, while retaining a high degree of certainty for the data being processed thanks to a new witnessHash field in the block header (a hash of the hashes of the data and the merkle proofs) secured by the consensus layer, with the option to retrieve the proofs as well and fully validate the state transition.

The biggest motivation for this is the reduction of witness sizes, which are dominated by merkle proofs. An additional benefit might be faster stateless client execution and faster beam sync (a new-ish take on it) if the stateRoot check is postponed (compared to constantly re-merkelizing the state trie all the way up to the top after every block).

Detailed description

The data part of a witness

onqtam /
Last active Oct 8, 2020
running a local geth instance for nimbus

In order to use a local instance of geth you'd have to follow these steps:

  1. Make sure to have installed geth and to have it accessible on the commandline (added to PATH, etc):
  2. Run it with the following parameters: geth --ws --gcmode archive
    • --ws: enable the websocket RPC API so Nimbus can query the Eth1 chain using Web3 API calls
    • --gcmode archive: without this Nimbus won't be able to sync because calls to eth_call will be failing due to missing trie nodes more than 128 blocks away from the current head of the Eth1 chain. This however requires more disk space - in the case of the Goerli testnet this increases the chaindata folder from <10GB to 60GB+.
    • if you'd like to connect to an Eth2 testnet (like Medalla) instead of Eth2 mainnet you'd have to also pass --goerli so that geth connects to the Goerli Eth1 testnet where the deposit contract f
View __VA_NARG__.cpp!msg/comp.std.c/d-6Mj5Lko_s/5R6bMWTEbzQJ
/* The PP_NARG macro returns the number of arguments that have been
* passed to it.
#define PP_NARG(...) \
#define PP_NARG_(...) \
View optimize_bool.cpp
// compile with and without optimizations (GCC) - are '1' and '0' the only possibilities? :)
#include <cstdio>
void print(int x) { printf("x = %d!\n", x); }
int main() {
bool* b = new bool;
print(*b ? 1 : 0);
View fast_static.h
#pragma once
#ifdef __GNUC__
#pragma GCC system_header // to silence "ISO C++11 requires at least one argument for the "..." in a variadic macro"
#endif // __GNUC__
#include <utility> // std::forward
#include <memory> // placement new
#ifdef __clang__
View multi_virtual_inheritance_mindfuck.cpp
#include <iostream>
struct A {
virtual void foo() = 0;
struct B {
virtual void foo() = 0;
View this_is_null.cpp
class FirstBase {
int firstBaseData;
class SecondBase {
void Method()
if( this == 0 ) {
printf( "this == 0");
View for_each_argument.cpp
#include <iostream>
template <class F, class... Args>
void for_each_argument(F f, Args&&... args) {
[](...){}((f(std::forward<Args>(args)), 0)...);
void print(int in) {
std::cout << in << std::endl;
View exit().cpp
#include <cstdlib>
#include <iostream>
using namespace std;
struct RAII {
RAII() { cout << "ctor" << endl; }
~RAII() { cout << "dtor" << endl; }
RAII global; // dtor WILL be called!
View overloaded_operators_for_enum.cpp
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
enum class Crap {
A = 0,