Commit Graph

202 Commits

Author SHA1 Message Date
jangko c9cfebfa97
config: rearrange getConfiguration usage
avoid using getConfiguration inside object construction and
replace it with passing suitable param
2021-09-08 08:07:10 +07:00
jangko 34972c6cea
config: remove accounts management from NimbusConfiguration
a new AccountsManager and EthContext is created for managing
keystore and accounts

this is a preparation for new config using ConfUtils
2021-09-07 22:02:29 +07:00
bmoo b09ad5cacb
code cleanup removed unused imports 2021-08-18 10:35:36 +07:00
Jamie Lokier 5ddfd7dd05
RPC: Calculate `eth_protocolVersion` from live protocol
In RPC `eth_protocolVersion`, look at the live `EthereumNode` to find which
version of `eth/NN` protocol is active, instead of trusting a compile-time
constant.  It's better to check dynamically.  GraphQL already does this.

As a result, the RPC code doesn't depend on `eth_protocol` any more.

To make sure there are no more accidental users of the old constant,
`protocolVersion` is no longer exported from `protocol_eth65`.

(The simplest way to support `eth/65` was to make `eth_protocolVersion` use
`protocol_eth65.protocolVersion`, to get 65.  But that's silly.  More
seriously, when we add another version (`eth/66`) running alongside `eth/65`,
that expression would still compile ok yet return the wrong value, while still
passing the RPC test suite.)

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-07-27 14:12:51 +01:00
Jamie Lokier bb282a5348
RPC: Add comment about `eth_protocolVersion` expectations
While looking at the RPC `eth_protocolVersion` to see exactly what it should
report when there are multiple `eth/NN` versions supported by a node, I found
some differences in the documentation:

- The old Ethereum wiki documents it as returning a decimal string.

- But Infura documents it as returning 0x-prefixed hex string.

- Geth 1.10.0 has removed this call entirely "as it makes no sense".

https://eth.wiki/json-rpc/API#eth_protocolversion
https://infura.io/docs/ethereum/json-rpc/eth-protocolVersion
https://blog.ethereum.org/2021/03/03/geth-v1-10-0/#compatibility
Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-07-27 14:12:49 +01:00
Jamie Lokier 00647b373c
Sync: Switch other modules over to the `eth/65` module
Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-07-27 14:12:41 +01:00
jangko 4a188788bd
preparation for EIP-1559 implementation
- unify signTx in test_helper and signTransaction in rpc_utils
  and put it into transaction.nim
- clean up mess by previous EIP-2930
2021-06-29 07:33:48 +07:00
Jamie Lokier ef7773daa6
Whisper: Remove Whisper-specific hexstring/JSON/key storage support
Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-06-01 18:12:48 +01:00
Jamie Lokier 613f06e61c
Whisper: Remove all the main Whisper code (config, startup, RPC etc)
This is the main patch which removes Whisper code from `nimbus-eth1` code.
It removes all configuration, help, startup, JSON-RPC calls and most types.

Note, there is still Whisper functionality in `nim-eth`.  Also, the "wrapper"
under `wrappers/` isn't dealt with by this change, but it's not built by
default (and might not currently work).

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-06-01 18:12:48 +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 ec1af91370
implement "net_nodeInfo" rpc
fixes #569
2021-05-19 16:35:13 +07:00
jangko 77f080c8c2
eip2718: nimbus is compileable 2021-05-15 18:09:36 +07:00
jangko f2491e6307
fixes crappy custom genesis and chain config parser
instead of using stdlib/json, now we switch to json_serialization
the result is much tidier code and more robust when parsing
optional fields.

fixes #635
2021-05-13 16:04:08 +07:00
Jamie Lokier 8bda81496a
RPC: Move EVM-calling function estimateGas to rpcEstimateGas
`estimateGas` used by JSON-RPC is another way to setup and call the EVM,
also used by GraphQL.  Move it to `transaction/call_evm`.

This function has too much direct knowledge of details that shouldn't be used
outside transaction handling code, details we need to change when changing the
db and transaction memory layer.

Moving this one exposed quite a bit of abstraction leakage, as it calls
directly to the hexary trie db around `processTransaction`.

It looks like the _intended_ functionality of `estimateGas` is similar to
`rpcDoCall` with the only real difference being to not store the final state.
It looks like the extra stuff in `estimateGas` compared with `doCall` is a
messy workaround for computation not exposing the right API ("don't save final
state") for RPC to use.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-03 10:59:10 +01:00
Jamie Lokier 2732af99eb
RPC: Move EVM-calling function doCall to rpcDoCall
`doCall` used by JSON-RPC is another way to setup and call the EVM.
Move it to `transaction/call_evm`.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-03 10:59:07 +01:00
Jamie Lokier 7c3b7ab7a8
RPC: Gather EVM-calling functions to one place; rpcSetupComputation
Start gathering the functions that call the EVM into one place,
`transaction/call_evm.nim`.

This is first of a series of changes to gather all ways the EVM is called to
one place.  Duplicate, slightly different setup functions have accumulated over
time, each with some knowledge of EVM internals.  When they are brought
together, these methods will be changed to use a single entry point to the EVM,
allowing the entry point to be refactored, EVMC to be completed, and async
concurrency to be implemented on top.  This also simplifies the callers.

First, a helper function used by RPC and GraphQL to make EVM calls without
permanently modifying the account state.  `setupComputation` ->
`rpcSetupComputation`.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-03 10:59:05 +01:00
jangko 3dfc1501f0
modify estimateGas in rpc_utils.nim and it can be reusable for graphql too 2021-04-24 10:56:22 +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 eee24de450
provide vm_message as import/export wrapper
details:
  moved original vm/message.nim => vm/nvm_message.nim
2021-03-31 16:47:02 +01:00
Jordan Hrycaj cf3a356d76
provide vm_computation as import/export wrapper
details:
  moved original vm/computation.nim => vm/nvm_computation.nim
2021-03-31 16:38:10 +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 8486c1834c fixes #558, use distinct uint for ChainId and NetworkId to prevent confusion 2021-02-14 11:01:27 +07:00
jangko f987e86562
implement more eth rpc 2020-07-30 14:21:11 +07:00
jangko 9c38266ba7
implement eth_estimateGas 2020-07-29 12:42:32 +07:00
jangko c9802edfce
setup block and state env for more complex eth rpc tests 2020-07-28 23:48:45 +07:00
jangko bb89a296dd
implement eth_signTransaction, eth_sendTransaction, eth_sendRawTransaction, eth_call 2020-07-24 19:44:36 +07:00
jangko 7819dae7ce
implement eth_signTransaction 2020-07-23 22:30:42 +07:00
jangko f82dff64fa
implement more eth rpc and keystore management 2020-07-23 14:54:32 +07:00
jangko 336efdb0c3
implement web3, net, and some eth namespace rpc 2020-07-22 23:57:55 +07:00
jangko 207065746c
reduce more warnings 2020-07-21 13:25:27 +07:00
jangko 845671bf0a
fix compilation error following breaking changes in nim-eth 2020-07-20 13:50:05 +07:00
jangko 12ddfee675
fix compilation error related to lib-secp256k1 changes 2020-06-24 17:07:33 +07:00
jangko 438ad832cc
fix rpc/p2p.nim 2020-06-22 10:59:24 +07:00
jangko 844071033a
fix at various places related to missing accounts_cache.persist call 2020-06-01 13:45:32 +07:00
kdeme 769228418e Remove wakunode and waku rpc code from repository 2020-05-07 20:49:14 +03:00
Jacek Sieka 4ade5797ee
rlp: don't use ranges / experimental features (#495) 2020-04-20 20:12:44 +02:00
andri lim 860d8e9705
fix rpc/p2p 2020-04-13 09:41:18 +07:00
andri lim 87bae2bb78
switch to new toFork 2020-04-12 18:02:59 +07:00
Jacek Sieka 1d472cf090
Eth keys (#482)
* bump nim-eth, fix deprecated calls
2020-04-05 15:12:48 +02:00
kdeme 55fb1294ed
Check all subscribed topics in quicksim + bump vendor/nim-eth 2020-02-14 11:36:37 +01:00
kdeme b959b14109
Update to use waku topic-interest 2020-02-07 08:59:19 +01:00
Kim De Mey a2478baeff
Merge pull request #446 from status-im/waku-queue-fixes
Bump vendor/nim-eth for waku/whisper queue fixes
2020-01-23 22:50:12 +01:00
andri lim d656f7f701 rename 'txContext' to 'setupTxContext' 2020-01-23 18:07:44 +02:00
kdeme 4ec126afaf
More cosmetic changes 2020-01-23 15:40:41 +01:00
andri lim e8ec1706ed fixes rpc compilation error 2020-01-23 12:39:36 +02:00
Zahary Karadjov d23a33a80c Cosmetic improvements 2020-01-23 12:39:36 +02:00
kdeme ca6890b026 Change Waku RPC methods prefix 2020-01-23 12:39:36 +02:00
kdeme d56655d278 Move WhisperKeys to KeyStorage 2020-01-23 12:39:36 +02:00
kdeme 776f924e39 Small fixes/improvements 2020-01-23 12:39:36 +02:00