53 Commits

Author SHA1 Message Date
Jordan Hrycaj
ca07c40a48
Fearture/poa clique tuning (#765)
* Provide API

details:
  API is bundled via clique.nim.

* Set extraValidation as default for PoA chains

why:
  This triggers consensus verification and an update of the list
  of authorised signers. These signers are integral part of the
  PoA block chain.

todo:
  Option argument to control validation for the nimbus binary.

* Fix snapshot state block number

why:
  Using sub-sequence here, so the len() function was wrong.

* Optional start where block verification begins

why:
  Can speed up time building loading initial parts of block chain. For
  PoA, this allows to prove & test that authorised signers can be
  (correctly) calculated starting at any point on the block chain.

todo:
  On Goerli around blocks #193537..#197568, processing time increases
  disproportionally -- needs to be understand

* For Clique test, get old grouping back (7 transactions per log entry)

why:
  Forgot to change back after troubleshooting

* Fix field/function/module-name misunderstanding

why:
  Make compilation work

* Use eth_types.blockHash() rather than utils.hash() in Clique modules

why:
  Prefer lib module

* Dissolve snapshot_misc.nim

details:
  .. into clique_verify.nim (the other source file clique_unused.nim
  is inactive)

* Hide unused AsyncLock in Clique descriptor

details:
  Unused here but was part of the Go reference implementation

* Remove fakeDiff flag from Clique descriptor

details:
  This flag was a kludge in the Go reference implementation used for the
  canonical tests. The tests have been adapted so there is no need for
  the fakeDiff flag and its implementation.

* Not observing minimum distance from epoch sync point

why:
  For compiling PoA state, the go implementation will walk back to the
  epoch header with at least 90000 blocks apart from the current header
  in the absence of other synchronisation points.

  Here just the nearest epoch header is used. The assumption is that all
  the checkpoints before have been vetted already regardless of the
  current branch.

details:
  The behaviour of using the nearest vs the minimum distance epoch is
  controlled by a flag and can be changed at run time.

* Analysing processing time (patch adds some debugging/visualisation support)

why:
  At the first half million blocks of the Goerli replay, blocks on the
  interval #194854..#196224 take exceptionally long to process, but not
  due to PoA processing.

details:
  It turns out that much time is spent in p2p/excecutor.processBlock()
  where the elapsed transaction execution time is significantly greater
  for many of these blocks.

  Between the 1371 blocks #194854..#196224 there are 223 blocks with more
  than 1/2 seconds execution time whereas there are only 4 such blocks
  before and 13 such after this range up to #504192.

* fix debugging symbol in clique_desc (causes CI failing)

* Fixing canonical reference tests

why:
  Two errors were introduced earlier but ovelooked:
   1. "Remove fakeDiff flag .." patch was incomplete
   2. "Not observing minimum distance .." introduced problem w/tests 23/24

details:
  Fixing 2. needed to revert the behaviour by setting the
  applySnapsMinBacklog flag for the Clique descriptor. Also a new
  test was added to lock the new behaviour.

* Remove cruft

why:
  Clique/PoA processing was intended to take place somewhere in
  executor/process_block.processBlock() but was decided later to run
  from chain/persist_block.persistBlock() instead.

* Update API comment

* ditto
2021-07-30 15:06:51 +01:00
Jordan Hrycaj
fbff3aea68
Feature/goerli replay clique poa (#743)
* extract unused clique/mining support into separate file

why:
  mining is currently unsupported by nimbus

* Replay first 51840 transactions from Goerli block chain

why:
  Currently Goerli is loaded but the block headers are not verified.
  Replaying allows real data PoA development.

details:
  Simple stupid gzipped dump/undump layer for debugging based on
  the zlib module (no nim-faststream support.)

  This is a replay running against p2p/chain.persistBlocks() where
  the data were captured from.

* prepare stubs for PoA engine

* split executor source into sup-modules

why:
  make room for updates, clique integration should go into
  executor/update_poastate.nim

* Simplify p2p/executor.processBlock() function prototype

why:
  vmState argument always wraps basicChainDB

* split processBlock() into sub-functions

why:
  isolate the part where it will support clique/poa

* provided additional processTransaction() function prototype without _fork_ argument

why:
  with the exception of some tests, the _fork_ argument is always derived
  from the other prototype argument _vmState_

details:
  similar situation with makeReceipt()

* provide new processBlock() version explicitly supporting PoA

details:
  The new processBlock() version supporting PoA is the general one also
  supporting non-PoA networks, it needs an additional _Clique_ descriptor
  function argument for PoA state (if any.)
  The old processBlock() function without the _Clique_ descriptor argument
  retorns an error on PoA networgs (e.g. Goerli.)

* re-implemented Clique descriptor as _ref object_

why:
  gives more flexibility when moving around the descriptor object

details:
  also cleaned up a bit the clique sources

* comments for clarifying handling of Clique/PoA state descriptor
2021-07-06 14:14:45 +01:00
Jamie Lokier
5e718bcbe2
EVM: Remove most unused imports of vm_* files
Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-06-01 16:54:38 +01:00
jangko
f6a0e4bcbd
fixes wrong usage of chainId in places where it should be networkId
fixes #643
2021-05-12 09:45:09 +07:00
jangko
39ce2390ae
fixes getRecipient: using sender param instead of calculating sender itself
usually, there is always a sender around `getRecipient` call.
no need to recalculate sender. and more important, in some of
JSON-RPC/GraphQL call, the sender is come from `rpcCallData`,
not from `tx.getSender`. or in ohter situation when the tx is
an unsigned tx, without `r,s,v` fields to calculate sender.
2021-05-04 15:31:47 +07:00
jangko
82d4f6a2d4
fixes getReceipts proc signature in db_chain.nim
instead of using header as input param, now getReceipts using
receiptRoot hash, the intention is clearer and less data passed around
when we only using receiptRoot instead of whole block header.
2021-04-24 10:51:05 +07:00
Jordan Hrycaj
00ba7a2718
merge vm_forks and vm_opcode_values => vm_type2
why:
  all types, but they cannot be merged int vm_types because of a circular
  dependency.
2021-03-31 17:53:15 +01:00
Jordan Hrycaj
3a3e4d5707
provide vm_forks as import/export wrapper
details:
  moved original vm/interpreter/vm_forks.nim => vm/interpreter/nvm_forks.nim
2021-03-31 16:03:34 +01:00
jangko
336efdb0c3
implement web3, net, and some eth namespace rpc 2020-07-22 23:57:55 +07:00
jangko
f401622782
cache miner address instead of recalculation 2020-06-22 07:48:23 +07:00
jangko
3931c1ff5c
fix tracer to support testnet 2020-06-19 17:51:53 +07:00
jangko
eabacb0a33
allow nimbus to read geth database 2020-06-18 13:16:25 +07:00
jangko
844071033a
fix at various places related to missing accounts_cache.persist call 2020-06-01 13:45:32 +07:00
Jacek Sieka
4ade5797ee
rlp: don't use ranges / experimental features (#495) 2020-04-20 20:12:44 +02:00
andri lim
87bae2bb78
switch to new toFork 2020-04-12 18:02:59 +07:00
Jacek Sieka
2763bd0dd5
std_shims -> stew 2019-07-07 12:12:01 +02:00
andri lim
6295e6a7e4
fix touched miner problem, GST +25 2019-04-26 07:31:11 +07:00
andri lim
03435c7beb
gst and processTransaction unification 2019-04-18 07:56:57 +07:00
andri lim
0b87151195
remove head from processBlock 2019-03-21 09:44:53 +07:00
Ștefan Talpalaru
a67edd693a
assert() -> doAssert() 2019-03-13 22:36:54 +01:00
andri lim
b303786128
fix tracer regression 2019-03-07 22:16:39 +07:00
andri lim
86de4faa81 make test green 2019-02-27 13:30:18 +02:00
andri lim
8193a4ae6a refactor gas used in transaction 2019-02-27 13:30:18 +02:00
andri lim
2c032ad1ab refactor utils 2019-02-27 13:30:18 +02:00
andri lim
fdc34a4cf6 fixes vmState construction 2019-02-15 17:20:51 +02:00
andri lim
817bce3555 premix report page: modify header section to display block summary 2019-02-06 18:42:03 +01:00
andri lim
c71a842050 fix 'dumpBlockState' in tracer.nim 2019-02-06 18:42:03 +01:00
Yuriy Glukhov
481c6cf4ed Use nim-eth (#224) 2019-02-05 20:15:50 +01:00
andri lim
e104153379 add premix and browser launcher code 2019-01-15 15:30:25 +02:00
andri lim
f1bb0d1b31 poststate processing 2019-01-15 15:30:25 +02:00
andri lim
7c4cb7a58e add report page 2019-01-15 15:30:25 +02:00
andri lim
0a6b3505f2 add dumper tool 2019-01-15 15:30:25 +02:00
andri lim
b93d809805 fix internal transactions account tracing 2019-01-06 13:17:25 +02:00
andri lim
e78fb72ef6 fixes #188 2019-01-06 13:16:45 +02:00
andri lim
7683f68c15 fix statediff bug 2019-01-06 11:43:38 +02:00
andri lim
5cf43c2909 implement dumpDebuggingMetaData 2019-01-06 11:43:38 +02:00
andri lim
8a6d351c22 add internal transactions dump 2019-01-06 11:43:38 +02:00
andri lim
9db4e9296a add tracer test 2019-01-06 11:43:38 +02:00
andri lim
e3fee70f0a fixes tracer 2019-01-06 11:43:38 +02:00
andri lim
890e8e11a4 dumpDebuggingMetaData stub 2019-01-06 11:43:38 +02:00
andri lim
3a355e0569 implement debug_traceBlock 2019-01-06 11:43:38 +02:00
andri lim
6dc4b0be9a implement dumpBlockState 2019-01-06 11:43:38 +02:00
andri lim
35c1c7e075 move block processing to executor 2019-01-06 11:43:38 +02:00
andri lim
f613f8b3c6 add dumpBlockState stub 2019-01-06 11:43:38 +02:00
andri lim
403e12b91f add statediff to traceTransaction 2019-01-06 11:43:38 +02:00
andri lim
9d6dbceefc add enable/disableTracing to vm_state 2019-01-06 11:43:38 +02:00
andri lim
b29f5b1321 put traceTransaction into action 2018-12-05 22:01:29 +07:00
andri lim
fe5ddf757b fix trace returnValue 2018-12-05 22:01:29 +07:00
andri lim
572de41507 tracing opcode return value 2018-12-05 22:01:29 +07:00
andri lim
0b7b577af6 add more options to debug_traceTransaction 2018-12-05 22:01:29 +07:00