Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
<i>foo</i>

Martin Holst Swende holiman

💭
<i>foo</i>
View GitHub Profile
@holiman
holiman / gist:2cc4ccf268bd45901aec741e06288cc4
Created May 4, 2020
I'm analyzing all contract code at block 9666637. I dumped out all code (22G), and am now doing a filtering: only code containing - At least one JUMP or JUMPI, - At least one BEGINSUB (0xB2) - And a JUMPDEST after the BEGINSUB
View gist:2cc4ccf268bd45901aec741e06288cc4
This file has been truncated, but you can view the full file.
View Caching.md

Part one: Caching in consensus

The magic of caching

It's sometimes said, within software engineering, that there are no 'golden bullets' -- magical stuff that automatically fixes all of your problems. But actually, there is something that is pretty close to a golden bullet in many scenarios. After everything has been stretched to the limit, but the software still falls short of the demands being put on it, there's one thing that engineers will reach for: The Cache.

A cache layer can scale something orders of magnitude, it can and should be used wherever appropriate. When we can put in a caching layer, we suddenly have a shelve where we can put "stuff" that might be useful later. It's great.

Caching, and perhaps more specifically cache invalidation, is generally considered as a difficult problem, and it can of course be tuned and experimented with at length, before it's fully matured. Do we want least-recently-used eviction? Least-frequently-used? Do we want strict eviction guarantees, or is fuzz

@holiman
holiman / dbreads.md
Last active Apr 21, 2019
This is taken during a fast-sync, in the phase where we download state/headers/bodes/receipts simultaneously. All lines that are leveldb-internal have been removed, thus the top item is empty -- that's the internal leveldb compaction routine. The second item is the init, which reads a lot on startup but does not grow over time.
View dbreads.md

2 GB from


115 MB from

ethdb/leveldb/leveldb.go:93
core/rawdb/database.go:47
node/service.go:47
View Old chain miners.md

These blocks have been mined on the old mainnet chain, presumably having failed to update the miner software for the Constantinople fork - a waste of money...

block 7280000 miner 0x06b8c5883ec71bc3f4b332081519f23834c8706e extradata .......geth.go1.10.4.linux
block 7280001 miner 0x96338149e9f6c262d4cb7aeec1cf4c652079a11c extradata .......Parity-Ethereum.1.30.1.li
block 7280002 miner 0x28974b4a92e7be907418722b37446f2eb60184cc extradata .......geth.go1.10.linux
block 7280003 miner 0x06b8c5883ec71bc3f4b332081519f23834c8706e extradata .......geth.go1.10.4.linux
block 7280004 miner 0x96338149e9f6c262d4cb7aeec1cf4c652079a11c extradata .......Parity-Ethereum.1.30.1.li
block 7280005 miner 0x8e59176cd996342da6fdf20c85cb02bca095d552 extradata .Grupo+58
block 7280006 miner 0x96338149e9f6c262d4cb7aeec1cf4c652079a11c extradata .......Parity-Ethereum.1.30.1.li
View SstoreCallToSelfSubRefundBelowZero.json
{
"SstoreCallToSelfSubRefundBelowZero": {
"_info": {
"comment": "Test where accnt has slot 1 value of '2', is cleared, then calls itself and overwrites with '3', causing a refund-deduction in second call context",
"filledwith": "manaually filled by @holiman",
"lllcversion": "none",
"source": "none",
"sourceHash": "none"
},
"env": {
View result.md

parity stateroot:0xa054d80c3c6192476447b6fdb3276af19400068432949c28431e5cc3e63d3c3f,, geth stateroot: 0x3ba0188e00002fd15395c3acca8cbbca76dbe56f5f2214d7fb12c1c348aaa965

View testcase.json
trace
```
#cat /tmp/evmlab/artefacts/ropsten_mini-combined_trace.log
[*] pc 0 op PUSH1( 96) gas 0x23ccaa depth 0 stack []
[*] pc 2 op SLOAD( 84) gas 0x23cca7 depth 0 stack ['0x3']
[*] pc 3 op CALLER( 51) gas 0x23cbdf depth 0 stack ['0x0']
[*] pc 4 op ADDRESS( 48) gas 0x23cbdd depth 0 stack ['0x0', '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b']
[*] pc 5 op EQ( 20) gas 0x23cbdb depth 0 stack ['0x0', '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0xe12d6474ac4964b9f23812bf3375c1fe637ad3b6']
[*] pc 6 op PUSH1( 96) gas 0x23cbd8 depth 0 stack ['0x0', '0x0']
[*] pc 8 op JUMPI( 87) gas 0x23cbd5 depth 0 stack ['0x0', '0x0', '0x1d']
@holiman
holiman / clip.sh
Created Sep 25, 2018
best script ever, place it as `~/bin/clip`
View clip.sh
#!/bin/bash
# Linux version
# Use this script to pipe in/out of the clipboard
#
# Usage: someapp | clipboard # Pipe someapp's output into clipboard
# clipboard | someapp # Pipe clipboard's content into someapp
#
if command -v xclip 1>/dev/null; then
if [[ -p /dev/stdin ]] ; then
View Test_process.md

Current status and problems

Currently, tests are checked in to the tests repo, which contains several things:

  • Manually crafted tests, like bcForkBlockTestCopier.json in the src/BlockchaintestsFiller/ directory. The 'filler' directories contain various tests that are 'to be filled'.
  • Generalized state tests. These are also unfilled, and contain basically prestate, and the expect-section for various 'indexes'. Indexes are used to generalize the test. Example test 'Bazonk':
    • Run this test with gas 2000001, then 400000, on Constantinople and Homestead.
View debugger.md

Writing an EVM-debugger for Geth

This document provides some ideas on how someone fairly easily could build the basic blocks for a debugger using geth.

Integration

The tracer interface defines four methods that a 'tracer' needs to implement:

You can’t perform that action at this time.