This bump is required by `TransactionHost` coming next.
There have been many changes to `nim-evmc` since earlier developments on
`nimbus-eth1`. The types in the API have changed, and there is no longer a
need to cast the function types.
This commit bumps the submodule while keeping with EVMC API 7.5 for now.
`.gitmodules` is updated to follow the module branch `api-version-7.5`.
Submodule changes:
> Nim: Function casts no longer required, type-checking finally works
> Nim: Make the test host use exactly the type signatures in the API
> add github action script
> Nim: Export `evmc_create_vm_name_fn`
> Nim: Use `var` instead of `ptr` for arguments that are pass-by-ref
> Nim: Fix missing `ptr` in signature of `execute`
> Nim: Use `ptr` in `release` for API consistency
> Nim: Disable "Imported and not used" warning in test program
> Nim: Remove unnecessary exports from the Nim example host/VM
> Nim: Simplify Nim C++ codegen bug workaround
> Nim: Add type and documentation for `evmc_create_example_fn`
> Nim: Workaround Nim compiler bug with Nim 1.2.10
> Nim: Workaround Nim compiler bug with `uint32`-sized bitset
> Nim: Use a more varied bit pattern in `get_capabilities` test
> Nim: Convert `evmc_capabilities` to Nim bitset
> Nim: Convert `evmc_flags` to Nim bitset
> Nim: Compile time verify that target C enums are `int` sized
> Nim: Recognise that target C enums are not always `cint`
> Nim: Make `evmc_status_code` a normal enum
> Nim: Use `csize_t` in test program and Nim example host/VM
> Nim: Use `csize_t` in the VM support API
> Nim: Use `csize_t` in appropriate places to match EVMC API
> Nim: Use binary-compatible C99 `bool` without target assumptions
> Version (README): Announce we support EVMC 7.5.0 and Istanbul fork
> Doc: Tweak GitHub badges on README
> Doc: Make title fit on GitHub page without wrapping
> Doc: README edits
> Doc: Update the README for 2021 - the year of Nimbus!
> License: Add licensing info about third-party files
> License: Update license text in README
> License: Fix incorrect name of Apache v2 license file and tweak
> License: Add missing MIT license file
> Nim: Add and update copyright headers
> Nim: Update Nim API to follow EVMC API 7.5.0
> Nim: Update doc comments and fix formatting
> Make the tests work with the new C++ mini-EVM in EVMC 7.5.0
> Change C++ `example_host` to workaround Nim -> C call type mismatch
> The EVMC package expects C++14 now
> Upgrade C++ `example_host` in `tests/evmc_c` to EVMC 7.5.0
> Upgrade C++ `example_vm` in `tests/evmc_c` to EVMC 7.5.0
> Upgrade C/C++ headers in `tests/evmc_c` to EVMC 7.5.0
Signed-off-by: Jamie Lokier <jamie@shareable.org>
This fixes a bug spotted by @mjfh that was introduced by commit 2a7ccceb:
try:
if not c.continuation.isNil:
(c.continuation)()
c.continuation = nil
c.selectVM(fork)
except CatchableError as e:
...
The call to `(c.continuation)()` was moved by 2a7ccceb inside the `try` so
that, like all the Op functions do already, if the continuation raises, the
interpreter's general catch turns the exception into a an error status result.
But if the continuation raises an exception, `continuation` is not cleared in
the next line, and at the next resumption the continuation is called again.
It may loop doing this.
This doesn't currently happen because the continuations don't really raise, but
it's still a correctness issue.
This fix also allows a continuation to spawn a second continuation, if it
encounters a second suspension point. This also doesn't happen currently,
but the pattern will become useful with async EVM.
Signed-off-by: Jamie Lokier <jamie@shareable.org>
The conditions mentioned in the old TODO comment have been checked. All
fixtures have either 40 hex digits or empty string for "to". There is a test
with all-zeros, and it means send to that account, not contract creation.
Empty string means contract creation.
This patch does not change the relaxed parsing where fewer than 40 digits is
accepted. We should probably be stricter about this.
Signed-off-by: Jamie Lokier <jamie@shareable.org>
There is no valid `CREATE_CONTRACT_ADDRESS`. Some places on the internet say
account zero means contract creation, but that's not correct.
Transactions to `ZERO_ADDRESS` are legitimate transfers to that account, not
contract creations. They are used to "burn" Eth. People also send Eth to
address zero by accident, unrecoverably, due to poor user interface issues.
Signed-off-by: Jamie Lokier <jamie@shareable.org>
Each place in `call_evm` that sets up an EVM call calculates the new contract
address for contract creations. But it's redundant, because `newComputation`
ignores the provided value and does the calculation again.
Remove the unused address calculation.
This is also a step to merging different entry points and EVMC. This change
ends up with the same value in both `msg.contractAddress` and `msg.codeAddress`
for every entry point, and this is good because it matches the EVMC message
structure, where they are replaced by only one value called `msg.destination`
Signed-off-by: Jamie Lokier <jamie@shareable.org>
`c.executeOpcodes` is called by some JSON fixture tests. These tests bypass
some of the setup and return, and because of this call, continuations aren't
processed either. Opcodes that use continuations will behave incorrectly.
The opcodes used in these particular tests don't use continuations currently,
so just add some assertions to verify this remains the case.
This is only used by local tests, and the call to `c.executeOpcodes` will be
replaced by the common entry point (that handles things like this correctly in
all cases) so we don't need to spend more time on this.
Signed-off-by: Jamie Lokier <jamie@shareable.org>
why:
previously, table data were stored with the table iterator. while
loading a table with permuted entries will always reconstruct equivalent
tables (in the sense of `==`), serialisation data are not comparable.
this patch produces always the same serialised data for equivalent
tables.
why:
source-local unit tests would hardly be triggered by github CI as rightly
criticised with the last patch.
details:
source-local unit tests have been moved to tests folder.
this version also contains rlp serialisation code so rlp encode/decode
will apply tranparently. this is not needed in p2p/validate but will be
useful with the clique protocol.
why:
to be used in Clique consensus protocol which suggests 4k cache entries.
the previous implementation used OrderTable[] which has complexity O(n)
for deleting entries.
additional flags we use:
- [x] HIVE_NETWORK_ID network ID number to use for the eth protocol
- [x] HIVE_LOGLEVEL client loglevel (0-5)
- [x] HIVE_GRAPHQL_ENABLED enables graphql on port 8545
hive always set 'HIVE_FORK_DAO_VOTE' to '1'.
set 'daoForkSupport' to 'true' if only 'HIVE_FORK_DAO_BLOCK'
is set by hive, not depends only on 'HIVE_FORK_DAO_VOTE'.
This is because 'nimbus-eth1' internal is different compared to 'geth'.
after EIP2718/EIP2930, we have additional fields:
type AccessTuple {
address: Address!
storageKeys : [Bytes32!]
}
type Transaction {
r: BigInt!
s: BigInt!
v: BigInt!
# Envelope transaction support
type: Int
accessList: [AccessTuple!]
}
close#606
now we have hive simulators written in nim:
- ethereum/consensus
- ethereum/graphql
Using these simulators, we can debug test cases without have to run
hive or docker.
when a skipped test case not in the skip list
but skipped using `testStatusIMPL`, the generated
markdown file list it as failed.
now that bug is fixed.