Skip to content

Instantly share code, notes, and snippets.

View rjl493456442's full-sized avatar
🐢

rjl493456442

🐢
View GitHub Profile
@rjl493456442
rjl493456442 / write_delay_analysis.py
Created December 19, 2017 08:13
go ethereum write delay analysis script
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import numpy
write_delay_n = "n count"
write_delay_duration = "count"
n_statistic = {}

Master

Branch:      Master
Import type: GC mode
Result:      
Import done in 9h7m49.111791041s.

Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
@rjl493456442
rjl493456442 / MiningImprovement.md
Created April 20, 2018 05:58
Mining improvement proposal

Mining improvement proposal

Simple Summary

It is cheap for GPU miner to switch the mining block, so we can dynamically adjust the mining block in a single mining round to make sure the mining block almost includes the transactions with highest fee price and includes as much valid uncle blocks as possible.

Motivation

  • A transaction that the user pays for a very high fee price may need to wait for a round of mining time before it can be processed.
  • The time window for a round of mining is too large, so that the miner’s fee-based transaction selection strategy is not always optimal.
@rjl493456442
rjl493456442 / Simple_checkpoint_syncing.md
Last active August 1, 2018 12:50
Simple checkpoint syncing

Simple Checkpoint Syncing

The purpose of this version checkpoint syncing is only to replace the hard-coded checkpoint information in the code, making the checkpoint updating more flexible.

Note: The current version of checkpoint syncing is still centralized.

Pre-requisites

  • Deploy a checkpoint registrar contract on the mainnet.
@rjl493456442
rjl493456442 / panic.md
Created September 12, 2018 02:03
Light client syncing panic

INFO [09-05|19:46:37.378] Imported new block headers count=2048 elapsed=843.440ms number=2865968 hash=a8200d…b1995b paused=0 INFO [09-05|19:46:38.429] Imported new block headers count=2048 elapsed=987.899ms number=2868016 hash=203c4a…10a30d paused=0 INFO [09-05|19:46:39.731] Imported new block headers count=2048 elapsed=1.200s number=2870064 hash=534235…393bd2 paused=0 INFO [09-05|19:46:40.658] Imported new block headers count=2048 elapsed=862.367ms number=2872112 hash=8cc4cc…1fe7ab paused=0 INFO [09-05|19:46:41.470] Imported new block headers count=1984 elapsed=749.669ms number=2874096 hash=831834…8eb2b0 paused=0 WARN [09-05|19:47:04.344] Rolled back headers count=2048 header=2874096->2872048 fast=0->0 block=0->0 WARN [09-05|19:47:04.344] Synchronisation failed, retrying err="receipt download canceled (requested)" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmen

@rjl493456442
rjl493456442 / checkpoint.md
Created September 14, 2018 05:51
light client hard-coded checkpoint history

Mainnet:

	SectionIdx:  187,
	SectionHead: common.HexToHash("e6baa034efa31562d71ff23676512dec6562c1ad0301e08843b907e81958c696"),
	CHTRoot:     common.HexToHash("28001955219719cf06de1b08648969139d123a9835fc760547a1e4dabdabc15a"),
	BloomRoot:   common.HexToHash("395ca2373fc662720ac6b58b3bbe71f68aa0f38b63b2d3553dd32ff3c51eebc4"),

	SectionIdx:  179,
	SectionHead: common.HexToHash("ae778e455492db1183e566fa0c67f954d256fdd08618f6d5a393b0e24576d0ea"),

CHTRoot: common.HexToHash("646b338f9ca74d936225338916be53710ec84020b89946004a8605f04c817f16"),

@rjl493456442
rjl493456442 / tx_pool_sim.py
Created October 18, 2018 12:04
transaction packing simulator
#!/usr/bin/python
# -*- coding: utf-8 -*-
import string
import random
import time
GAS_BLOCK_LIMIT = 8000000
GAS_UPPER_LIMIT = 300000
GAS_LOWER_LIMIT = 21000
This file has been truncated, but you can view the full file.
[hyperchain@vm1 ~]$ docker logs -f 3ab430f80997
Args: [185660, %Indexer.Block.Fetcher{broadcast: :realtime, callback_module: Indexer.Block.Realtime.Fetcher, json_rpc_named_arguments: [transport: EthereumJSONRPC.HTTP, transport_options: [http: EthereumJSONRPC.HTTP.HTTPoison, url: "http://localhost:8545", http_options: [recv_timeout: 60000, timeout: 60000, hackney: [pool: :ethereum_jsonrpc]]], variant: EthereumJSONRPC.Geth], receipts_batch_size: 250, receipts_concurrency: 10}, false]
11:31:41.616 [error] Task #PID<0.7185.9> started from Indexer.Block.Realtime.Fetcher terminating
** (stop) exited in: :gen_server.call(Explorer.Repo.Pool, {:checkout, #Reference<0.2744686043.4038590465.166179>, true}, 5000)
** (EXIT) time out
(stdlib) gen_server.erl:223: :gen_server.call/3
(poolboy) src/poolboy.erl:55: :poolboy.checkout/3
(db_connection) lib/db_connection/poolboy.ex:41: DBConnection.Poolboy.checkout/2
(db_connection) lib/db_connection.ex:928: DBConnection.checkout/2
(db_connection) lib/d
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 23bdce560..87d6f0779 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -31,13 +31,12 @@ import (
 	"github.com/ethereum/go-ethereum/accounts"
 	"github.com/ethereum/go-ethereum/accounts/keystore"
 	"github.com/ethereum/go-ethereum/cmd/utils"
+	"github.com/ethereum/go-ethereum/common"
@rjl493456442
rjl493456442 / Dockerfile
Created February 22, 2019 05:46
blockscout dockerfile
# This dockerfile will combine all the stuff needed by blockscout
# into a single docker image for puppeth usage.
# Components include: local geth, postgres.
# Build go-ethereum
FROM ethereum/client-go:latest as builder
# Build postgres && blockscout
FROM bitwalker/alpine-elixir-phoenix:latest