Commit Graph

2228 Commits

Author SHA1 Message Date
jangko 01a27ff328
EIP-2930: optional access list
the new AccessListTx contains address and storage keys
that will go into global access list. and this come with
prices.... in ether
2021-05-16 19:54:48 +07:00
jangko a2712c5c7a
eip2718: fixes test_rpc.nim 2021-05-15 18:09:36 +07:00
jangko a2f77e8627
eip2718: rename vm2 ChainId op code to ChainIdOp
this is to avoid clash with ChainId type
imported from eth/common
2021-05-15 18:09:36 +07:00
jangko 96d1969017
bump nim-eth: eip2718 typed transaction envelope
these series of commits labelled eip2718 will pave the way for
eip2930: optional access lists
2021-05-15 18:09:36 +07:00
jangko 87c6ec7309
eip2718: add tx validate for AccessListTx 2021-05-15 18:09:36 +07:00
jangko 77f080c8c2
eip2718: nimbus is compileable 2021-05-15 18:09:36 +07:00
jangko 79044f1e92
eip2718: test_blockchain_json pass test 2021-05-15 18:09:35 +07:00
jangko 2a9c3982d9
remove code duplication from test_blockchain_json
now test_blockchain_json is using block validation code
from p2p/executor.nim instead of using it's own
block validation code.

this will reduce maintenance cost and fixes #592.
2021-05-14 15:37:30 +07:00
jangko db65f92e66
refactor vmConfiguration in test_blockchain_json
instead of using it's own blockNumber to Fork calculation,
we switch to ChainConfig to Fork to ensure smooth transition
when using common block validator.
2021-05-14 15:37:29 +07:00
jangko beb274d98c
remove unnecessary codes from test_blockchain_json
except for genesis block, we are not parsing block header from json
node anymore.

we parse block headers from block RLP, it is the same thing.
2021-05-14 15:37:29 +07:00
Jordan Hrycaj d1348824f8
update conversion to start option argument inside hive container (#658)
why:
  not overloading genesis.json by converted version, using new file
  with edited contents
2021-05-14 08:56:21 +01:00
jangko fe92942fa2
update hive/ethereum/consensus stat
from: ethereum/consensus:  16556 pass, 11643 fail, 28199 total
to  : ethereum/consensus:  27353 pass,   892 fail, 28245 total
2021-05-14 08:18:54 +07:00
jangko 911bc0b1c3
update mapper.jq in hive_integration/nimbus
this changes is required due to recent #654.
custom genesis and chain config parser are fixed
and the genesis fields are grouped into "genesis"
field, similar with chain config fields,
they are grouped in "config" field.
2021-05-13 18:09:28 +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
jangko 6966324f3b
add our own hive/graphql simulator into hive_integration
now we can run hive/graphql test without using hive or docker.
it's useful for debugging session. but lacking nice result report
like real hive.
2021-05-12 21:21:53 +07:00
jangko a57ac65c8c
fixes --customnetwork parser
now it can ignore an optional fork e.g. MuirGlacier
2021-05-12 19:05:32 +07:00
jangko 97f4226171
update berlin fork number in config.nim
also update test_forkid because of berlin changes
2021-05-12 17:24:27 +07:00
jangko 8ec72e86bc
update hive/rpc stat
from: ethereum/rpc:            0 pass,     1 fail,     1 total
to  : ethereum/rpc:            3 pass,    35 fail,    38 total
2021-05-12 12:55:29 +07:00
jangko 5ee918f4ef
fixes test_graphql crash due to recent changes related to `chainId`
now test_graphql takes another route to initialize the empty db
that is safer instead of bypassing commonly used route.
2021-05-12 09:45:09 +07: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 2d3d450075
fixes `validateFixedLenHex` in graphql/ethapi.nim
now it can detect too long hex besides padding too short hex
2021-05-12 08:12:26 +07:00
jangko 86939d9248
fixes `Forks can't be assigned out of order` error in hive
this is a quick fix for #635, allow us to run hive test again
2021-05-12 07:54:37 +07:00
kdeme 273a94ed76 Bump nim-eth to get better exception tracking 2021-05-12 00:35:37 +03:00
jangko a401f43155
update hive/graphql stat in hive_integration/README.md
from: ethereum/graphql:       34 pass,    12 fail,    46 total
to  : ethereum/graphql:       36 pass,    10 fail,    46 total
2021-05-11 08:50:53 +07:00
jangko d0546becfb
add query complexity calculator to graphql/ethapi
this will allow us to pass two more hive tests
2021-05-10 22:22:04 +07:00
jangko 03784848eb
bump nim-graphql version from 0.2.12 to 0.2.14
enhancements:
- scalar `Float` now have proper validation
- seqs are not copied anymore in some places, but using system.move

bugfixes:
- `removeWhitespaces` in test_common no longer eat white spaces
  from quoted string.
- `skipWhitespace` in lexer.nim now preserve \r\n instead of replace it with \n

new features:
- add custom instrument infrastructure
- add Query Complexity instrumen
2021-05-10 22:22:04 +07:00
jangko d2c0d2f534
add '--nat:0.0.0.0' flag to hive_integration/nimbus/nimbus.sh
trying Jacek suggestion in #591, I added nat setting to
nimbus-eth1 hive shell script. visible difference after adding
this flag is the nat library not complaining about
"the gateway does not support nat-pmp" anymore.

but the slow startup time described in #591 is yet to be measured
again, although I already see improvement when executing
ethereum/consensus category in hive.
2021-05-07 19:48:10 +07:00
jangko 6b639c6f0a
update hive_integration/README.md section 'Current state of the tests'
before: ethereum/graphql:       31 pass,    15 fail,    46 total
after : ethereum/graphql:       34 pass,    12 fail,    46 total
2021-05-07 19:45:59 +07:00
jangko 7f509a00df
bump nim-graphql from 0.2.10 to 0.2.12
- enhancements:
  - response stream reform:
    - allow for more response stream implementation easily

- features:
  - add NodeRespStream:
    - return AST produced by execution engine instead of serialize
      it into json or something else

  - add store flag to parseSchema and parseQuery family:
    - with this additional flag, both query and schema can be marked
      with stored flag
    - purge also become selective when purging queries
    - dog fooding the introspection schema loader using this flag

bugfixes:
  - next fields will continue execution if there is error:
    - if one field failed, it will not terminate subsequent fields
      execution, but errors are kept.
  - propagate inner field error to it's parent
    - Since Non-Null type fields cannot be null, field errors are propagated to be
      handled by the parent field. If the parent field may be null then it resolves
      to null, otherwise if it is a Non-Null type, the field error is further
      propagated to it’s parent field.

    - If a List type wraps a Non-Null type, and one of the elements of that list
      resolves to null, then the entire list must resolve to null. If the List type
      is also wrapped in a Non-Null, the field error continues to propagate upwards.

    - If all fields from the root of the request to the source of the field error
      return Non-Null types, then the "data" entry in the response should be null.
2021-05-07 17:38:51 +07:00
jangko 76189c6357
fixes graphql.scalar.Bytes32
relaxing the rigid length validation of Bytes32 scalar.
allow it to parse hex less than 64 bytes, and add leading
zeroes if needed.
2021-05-05 19:48:56 +07:00
jangko b8c55229e7
implement graphql.Query.account
although this is not part of EIP 1767
but the hive test cases derived from besu
test cases contains this.
we add this now to pass more test hive.graphql cases
2021-05-05 19:18:35 +07:00
jangko 9e055bd15f
update hive_integration/README.md
from: ethereum/graphql:        1 pass,    46 fail,    46 total
to:   ethereum/graphql:       31 pass,    15 fail,    46 total
2021-05-05 18:43:26 +07:00
jangko cf9ed5c2ca
bump nim-graphql
fixes stupid bug in http gzip func
2021-05-05 16:49:30 +07:00
jangko 331a95f363
bump nim-graphql from from 0.2.8 to 0.2.10
- fixes httpserver gzip crc32 calculation
- catch exception and turn it into error code in
  public api functions
2021-05-05 14:07:28 +07:00
jangko 9c04202412
using inheritance on Node in graphql resolvers
this remove usage of unsafe cast
2021-05-05 11:20:12 +07:00
jangko dabff33689
turn all CatchableError into error code, not only EVMError 2021-05-05 11:20:12 +07:00
jangko 0cdda3c437
bump nim-graphql from 0.2.6 to 0.2.8
- AST node now is inheritable
2021-05-05 11:20:12 +07:00
jangko ad1edd9af6
fixes graphql test cases
after recent bugfix in graphql resolvers, many of
test cases need to updated too
2021-05-05 11:20:12 +07:00
jangko 0dd6d1e3d4
add some comments to graphql/sendRawTransaction
the comment is about missing things need to be addressed
by sendRawTransaction
2021-05-05 11:20:11 +07:00
jangko 728f3a24be
fixes `rpcMakeCall`: using parent.stateRoot
instead of using header.stateRoot, now it is using parent.stateRoot
2021-05-05 11:20:11 +07:00
jangko c200cebb1d
fixes various bugs in graphql/ethapi.nim 2021-05-05 11:00:12 +07:00
Jamie Lokier 1574136a25
Precompiles: Change precompile tests to use fixtureCallEvm
Move the EVM setup and call in precompile tests to `fixtureCallEvm` in
`call_evm`.  Extra return values needed for testing are returned specially, and
the convention for reporting gas used is changed to match `asmCallEvm`.

Although the precompile tests used `execPrecompiles` before, `executeOpcodes`
does perfectly well as a substitute, allowing `fixtureCallEvm` to be shared.

_Significantly, this patch also makes `Computation` more or less an internal
type of the EVM now._

Nothing outside the EVM (except `call_evm`) needs access any more to
`Computation`, `execComputation`, `executeOpcodes` or `execPrecompiles`.
Many imports can be trimmed, some files removed, and EVMC is much closer.

(As a bonus, the functions in `call_evm` reveal what capabilities parts of the
program have needed over time, makes certain bugs and inconsistencies clearer,
and suggests how to refactor into a more useful shared entry point.)

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-05 02:31:46 +01:00
Jamie Lokier 751068a4d4
EVM call: Simplify and make consistent how to select the fork
Allow the fork to be specified consistently through an `option[Fork]` instead
of varying inconsistencies depending on which call.  When fork is not
specified, the `BaseVMState` code picks the correct fork by default for the
block number and chain.

This change actually deletes code, because a number of functions (RPC etc) had
redundant code to pick the fork, which always resolved to same as default.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-05 02:26:21 +01:00
Jamie Lokier 236a65d598
Fixtures: Make fixture "vm json tests" use new function fixtureCallEvm
Move the EVM setup and call in fixtures "vm json tests" to new function
`fixtureCallEvm` in `call_evm`.  Extra return values needed for testing are
returned specially.

This entry point is different from all other `..CallEvm` type functions,
because it uses `executeOpcodes` instead of `execComputation`, so it doesn't
update the account balance or nonce on entry and exit from the EVM.

The new code is a bit redundant and simplistic intentionally, as the purpose is
to move functionality to `call_evm` with high confidence nothing really
changed.  The calls will be jointly refactored afterwards to merge differences.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-04 15:21:15 +01:00
Jamie Lokier 9e99bb6cd9
Fixtures: Prepare fixtureSetupComputation to support fixtureCallEvm
In the `text_vm_json` ("fixtures") test code, there is another variant of
`rpcSetupComputation` and `txSetupComputation` with slightly different
paremeters.  The similarity is obvious.

It is a special setup for testing, though, as it requires slightly different
parameters.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-04 15:21:14 +01: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 c46b7186ca
update graphql test case because of bugfixes in nim-graphql
recent introspection bugfixes in nim-graphql alter the result
of introspection system.
2021-05-04 14:26:10 +07:00
jangko 10142ad711
add missing `disableParamFiltering` in test_graphql.nim
if there is no `disableParamFiltering()`, and the test is run via
all_tests.nim, no test unit will be executed
2021-05-04 13:03:08 +07:00
jangko 44601157f3
bump nim-graphql from 0.2.4 to 0.2.6
bugfixes:
- empty list should be allowed as argument value or input field value

features:
- add `parseSchemas`
2021-05-04 13:01:33 +07:00
Jamie Lokier d2586c3a73
Assembler: Make macro_assembler tests use new function asmCallEvm
Move the EVM setup and call in `macro_assembler` (`runVM`) entirely to new
function `asmCallEvm` in `call_evm`.  Extra return values needed for
testing are returned specially from `asmCallEvm`.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-04 01:36:00 +01:00