2018-12-25 12:10:04 +00:00
|
|
|
import
|
2019-02-06 10:43:44 +00:00
|
|
|
json, os, eth/common, stint, chronicles, byteutils, nimcrypto, eth/rlp,
|
2019-02-05 19:15:50 +00:00
|
|
|
eth/trie/db, ../nimbus/db/[db_chain, capturedb, storage_types, select_backend],
|
2018-12-25 12:10:04 +00:00
|
|
|
../nimbus/[tracer, vm_types, config],
|
|
|
|
../nimbus/p2p/chain
|
|
|
|
|
|
|
|
proc dumpTest(chainDB: BaseChainDB, blockNumber: int) =
|
|
|
|
let
|
|
|
|
blockNumber = blockNumber.u256
|
|
|
|
parentNumber = blockNumber - 1
|
|
|
|
|
|
|
|
var
|
|
|
|
memoryDB = newMemoryDB()
|
|
|
|
captureDB = newCaptureDB(chainDB.db, memoryDB)
|
|
|
|
captureTrieDB = trieDB captureDB
|
|
|
|
captureChainDB = newBaseChainDB(captureTrieDB, false)
|
|
|
|
|
|
|
|
let
|
|
|
|
parent = captureChainDB.getBlockHeader(parentNumber)
|
|
|
|
header = captureChainDB.getBlockHeader(blockNumber)
|
|
|
|
headerHash = header.blockHash
|
|
|
|
blockBody = captureChainDB.getBlockBody(headerHash)
|
|
|
|
chain = newChain(captureChainDB)
|
|
|
|
headers = @[header]
|
|
|
|
bodies = @[blockBody]
|
|
|
|
|
2019-01-01 03:55:40 +00:00
|
|
|
captureChainDB.setHead(parent, true)
|
2018-12-25 12:10:04 +00:00
|
|
|
discard chain.persistBlocks(headers, bodies)
|
|
|
|
|
|
|
|
var metaData = %{
|
|
|
|
"blockNumber": %blockNumber.toHex
|
|
|
|
}
|
|
|
|
|
|
|
|
metaData.dumpMemoryDB(memoryDB)
|
|
|
|
writeFile("block" & $blockNumber & ".json", metaData.pretty())
|
|
|
|
|
|
|
|
proc main() =
|
|
|
|
# 97 block with uncles
|
|
|
|
# 46147 block with first transaction
|
|
|
|
# 46400 block with transaction
|
|
|
|
# 46402 block with first contract: failed
|
|
|
|
# 47205 block with first success contract
|
|
|
|
# 48712 block with 5 transactions
|
|
|
|
# 48915 block with contract
|
|
|
|
# 49018 first problematic block
|
|
|
|
# 52029 first block with receipts logs
|
|
|
|
# 66407 failed transaction
|
|
|
|
|
|
|
|
# nimbus --rpcapi: eth, debug --prune: archive
|
|
|
|
|
|
|
|
var conf = getConfiguration()
|
|
|
|
let db = newChainDb(conf.dataDir)
|
|
|
|
let trieDB = trieDB db
|
|
|
|
let chainDB = newBaseChainDB(trieDB, false)
|
|
|
|
|
|
|
|
chainDB.dumpTest(97)
|
2018-12-31 03:28:12 +00:00
|
|
|
chainDB.dumpTest(98) # no uncles and no tx
|
2018-12-25 12:10:04 +00:00
|
|
|
chainDB.dumpTest(46147)
|
|
|
|
chainDB.dumpTest(46400)
|
|
|
|
chainDB.dumpTest(46402)
|
|
|
|
chainDB.dumpTest(47205)
|
|
|
|
chainDB.dumpTest(48712)
|
|
|
|
chainDB.dumpTest(48915)
|
2018-12-31 03:28:12 +00:00
|
|
|
chainDB.dumpTest(49018)
|
2019-02-07 06:00:20 +00:00
|
|
|
chainDB.dumpTest(49439) # call opcode bug
|
|
|
|
chainDB.dumpTest(49891) # number opcode bug
|
|
|
|
chainDB.dumpTest(50111) # apply message bug
|
2019-02-26 01:45:32 +00:00
|
|
|
chainDB.dumpTest(78458 )
|
|
|
|
chainDB.dumpTest(81383 ) # tracer gas cost, stop opcode
|
|
|
|
chainDB.dumpTest(81666 ) # create opcode
|
|
|
|
chainDB.dumpTest(85858 ) # call oog
|
|
|
|
chainDB.dumpTest(116524) # codecall address
|
|
|
|
chainDB.dumpTest(146675) # precompiled contracts ecRecover
|
|
|
|
chainDB.dumpTest(196647) # not enough gas to call
|
|
|
|
chainDB.dumpTest(226147) # create return gas
|
|
|
|
chainDB.dumpTest(226522) # return
|
|
|
|
chainDB.dumpTest(231501) # selfdestruct
|
|
|
|
chainDB.dumpTest(243826) # create contract self destruct
|
|
|
|
chainDB.dumpTest(248032) # signextend over/undeflow
|
|
|
|
chainDB.dumpTest(299804) # GasInt overflow
|
|
|
|
chainDB.dumpTest(420301) # computation gas cost LTE(<=) 0 to LT(<) 0
|
|
|
|
chainDB.dumpTest(512335) # create apply message
|
2019-03-11 13:18:28 +00:00
|
|
|
chainDB.dumpTest(47216) # regression
|
|
|
|
chainDB.dumpTest(652148) # contract transfer bug
|
|
|
|
chainDB.dumpTest(668910) # uncleared logs bug
|
|
|
|
chainDB.dumpTest(1017395) # sha256 and ripemd precompiles wordcount bug
|
|
|
|
chainDB.dumpTest(1149150) # need to swallow precompiles errors
|
2019-03-13 07:48:08 +00:00
|
|
|
chainDB.dumpTest(1155095) # homestead codeCost OOG
|
|
|
|
chainDB.dumpTest(1317742) # CREATE childmsg sender
|
2019-03-19 09:43:38 +00:00
|
|
|
chainDB.dumpTest(1368834) # writepadded regression padding len
|
|
|
|
chainDB.dumpTest(1417555) # writepadded regression zero len
|
2019-04-06 14:26:11 +00:00
|
|
|
chainDB.dumpTest(1_431_916) # deep recursion stack overflow problem
|
|
|
|
chainDB.dumpTest(1_487_668) # getScore uint64 vs uint256 overflow
|
2019-04-06 15:41:36 +00:00
|
|
|
chainDB.dumpTest(1_920_000) # the DAO fork
|
|
|
|
chainDB.dumpTest(1_927_662) # fork comparison bug in postExecuteVM
|
2018-12-25 12:10:04 +00:00
|
|
|
|
2019-02-07 06:00:20 +00:00
|
|
|
when isMainModule:
|
|
|
|
var message: string
|
|
|
|
|
|
|
|
## Processing command line arguments
|
|
|
|
if processArguments(message) != Success:
|
|
|
|
echo message
|
|
|
|
quit(QuitFailure)
|
|
|
|
else:
|
|
|
|
if len(message) > 0:
|
|
|
|
echo message
|
|
|
|
quit(QuitSuccess)
|
|
|
|
|
|
|
|
try:
|
|
|
|
main()
|
|
|
|
except:
|
|
|
|
echo getCurrentExceptionMsg()
|