Skip to content

Instantly share code, notes, and snippets.

View djrtwo's full-sized avatar

danny djrtwo

  • Ctrl^T
  • New Orleans
View GitHub Profile
@djrtwo
djrtwo / sanity_check_tests.yaml
Last active March 14, 2019 01:01
sample v0.5.0 tests
title: Sanity tests
summary: Basic sanity checks from phase 0 spec pythonization. All tests are run with
`verify_signatures` as set to False.
test_suite: beacon_state
fork: tchaikovsky
version: v0.5.0
test_cases:
- name: test_empty_block_transition
config: {SHARD_COUNT: 8, TARGET_COMMITTEE_SIZE: 4, MAX_BALANCE_CHURN_QUOTIENT: 32,
MAX_INDICES_PER_SLASHABLE_VOTE: 4096, MAX_EXIT_DEQUEUES_PER_EPOCH: 4, SHUFFLE_ROUND_COUNT: 90,
@djrtwo
djrtwo / yaml_gen.py
Last active March 12, 2019 13:54
stub for state tests
import yaml
from sanity_check import (
create_genesis_state,
test_empty_block_transition,
)
def generate_yaml_test(pre_state, blocks, post_state, config, fields, root=False):
pass
@djrtwo
djrtwo / block_benchmarks-py_beacon_chain_v2.1.csv
Created September 27, 2018 12:23
Block benchmarks in python beacon chain v2.1
num_attestations validators_per_attestation total_validators total_deposits block_process_seconds crystallized_state_bytes active_state_bytes block_bytes
2 244 31250 1000000 0.1017 4056416 4494 562
16 305 312500 10000000 1.0099 40074336 7324 3392
16 3051 3125000 100000000 10.1837 400074336 12812 8880
@pytest.fixture
def base_tester():
> return EthereumTester(PyEVMBackend())
tests/conftest.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venv/lib/python3.6/site-packages/eth_tester/backends/pyevm/main.py:262: in __init__
self.reset_to_genesis()
venv/lib/python3.6/site-packages/eth_tester/backends/pyevm/main.py:293: in reset_to_genesis
self.account_keys, self.chain = setup_tester_chain()
@djrtwo
djrtwo / casper_abi.json
Last active May 7, 2018 10:05
current casper abi
[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'in
@djrtwo
djrtwo / casper_rewards.py
Last active April 12, 2018 02:22
script used to model rewards in casper FFG
import argparse
import math
from copy import copy
def sqrt_of_total_deposits(deposits):
return math.sqrt(deposits)
def reward_vote(deposit, reward_factor):
@djrtwo
djrtwo / count_bytes.py
Created August 9, 2017 18:47
Count zero and non-zero bytes in hex string
txdata = "606060405260405160808061067283398101604090815281516020830151918301516060909301519092905b42811161003457fe5b60008054600181016100468382610100565b916000526020600020900160005b8154600160a060020a038089166101009390930a928302920219161790555060008054600181016100858382610100565b916000526020600020900160005b8154600160a060020a038088166101009390930a928302920219161790555060008054600181016100c48382610100565b916000526020600020900160005b8154600160a060020a038087166101009390930a928302920219161790555060028190555b5050505061014b565b8154818355818115116101245760008381526020902061012491810190830161012a565b5b505050565b61014891905b808211156101445760008155600101610130565b5090565b90565b6105188061015a6000396000f300606060405236156100a15763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663120b205381146100a35780634ecb35c4146100c557806366d003ac146100f557806367e404ce146101215780636cc6cde11461014d5780637022b58e1461017957806393c0e83a1461018b578063a79a3cee146101ba578063ac4c25b2146101de578063c7fe23a3146101f057
0xa4be607be0a6cceff581ef35c0cdc47a7532ff54

Keybase proof

I hereby claim:

  • I am djrtwo on github.
  • I am djrtwo (https://keybase.io/djrtwo) on keybase.
  • I have a public key whose fingerprint is BC36 0E10 F260 190A ED4C A920 7171 EB67 5087 B817

To claim this, I am signing this object: