* add genesis tests from hive
* add another genesis from hive
* add execution-apis genesis
* add correct u64 hex decoding in GenesisAccount
* use default chainid of 1 without config
* add genesis test field asserts
* use better serde(default) settings
* feat(core): expose genesis and private key in Geth
* expose the genesis and clique_private_key fields in GethInstance
* add tests which initialize geth with clique_private_key, making sure
the genesis and clique_private_key fields are exposed on the
GethInstance
* add clique p2p port test
* refactor tests to clean up properly
* fix(core): fix geth --init temp dir race condition
* previously, if multiple instances of geth were spawned concurrently,
only one directory would be used to populate geth's genesis.json.
this can lead to a race condition where the genesis.json would be
re-written by a second instance, before the first instance reads the
genesis.json for populating its db and genesis block with the geth
--init command. this was possible because directory returned by
std::env::temp_dir() is often shared
* fixes the race condition by using tempfile::tempdir(), which creates
a unique directory per call to tempdir()
* only use tempfile on non-wasm32
* feat(providers): add personal key mgmt rpcs
* add personal_importRawKey and personal_unlockAccount
* expose geth personal api
* do not prefix with 0x
* serialize privkey as string
* add allow-insecure-unlock option to Geth
* fix(core): set GethInstance p2p_port in spawn
* previously, spawning Geth with disabled discovery would not actually
set the p2p port in the returned GethInstance. This is because it
would only pass the port to the geth command. If the value started as
None, it would remain to be None in the GethInstance even though a
port was passed to the command.
* adds tests for the existence of ports in GethInstance
* remove rpc port test
* rpc port test doesn't make sense because it will always be set, it is
not an Option
* use sigterm instead of sigkill
* use sigint instead of sigterm
* run tests in different directories
* prevents flaky behavior because cargo runs tests in parallel, if the
default directory were used, each GethInstance would fight for geth's
file system lock.
* remove nix as a dep
* sigkill works for now
* if geth is in non-dev mode, it has been explicitly set by either
disabling discovery or setting a p2p port. To prevent geth from
crashing if another process is using the default p2p port, always set
the p2p port if geth is in non-dev mode.
* tell Geth to expose the admin namespace
* wip: add admin namespace support
* add networking and peer related structs
* add rest of chain config fields
* add datadir to geth
* fix data dir ref
* add dev flag to geth
* set dev only if block_time is not set
* put mutually exclusive options in an enum
* make block_time use the devmode enum
* add p2p port to geth
* add basic impls for admin endpoints
* move from_int_or_hex to ethers-core utils
* fix nodeinfo protocol field
* the type is better represented by a struct which can have either eth
or snap
* add chain id and discovery toggle for Geth
* remove PeerEvent
* should re-add when peer event endpoints are implemented
* simplify serde options for admin responses
* change signature for peer modification apis
* these admin apis accept an enode, which _may_ be an enr, but could
also be a legacy enode "v4" url.
* add note on where `ChainConfig` fields come from
* add note on PeerInfo about the source of fields
* add admin namespace support to CHANGELOG
* update pr number in changelog
* cargo fmt
* move chainconfig to genesis in utils
* accept genesis file in geth
* add genesis writing to geth spawn
* finally get geth nodes to connect
* import io::Read in provider tests
* fix PeerInfo and use enode id for provider test
* make clippy happy
* improve documentation for genesis module
* remove not(wasm) attributes on genesis module
* remove debugging printlns
* remove io::Read from provider tests
* add failing post merge test case
* add full mainnet nodeinfo for testing
* support deserializing json bignums to U256
* the serde_json arbitrary_precision feature is necessary so the
serde_json::Number variant of `IntOrHexOrBigNum` can be converted
into a string and fed into U256::from_dec_string
* fix from_int_or_hex_opt doc string
* remove third variant from IntOrHex
* unnecessary since serde_json::Number handles smaller ints as well
* add comments for ids
* fix enode id type in admin_peers provider test
* fix admin typo in Cargo.toml
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* add method to wait on a gethinstance adding a peer
* fix dial loop and wait_to_add_peer doc comments
* update geth
* the build can be updated by changing the GETH_BUILD env var
* wait for geth to exit on drop
* remove unnecessary wait
* fix mid-handshake PeerInfo deserialization
* remove println
* make tests less flaky
* handle discovery with the rest of the non dev opts
* dump geth stderr to debug failing ci test
* add method which dumps the unread stderr of the geth instance into a
string
* remove call_raw debug println
* bug is due to authrpc endpoint being in use
* use unused port when authrpc port is not specified
* remove dump_stderr from GethInstance
* did not work properly anyways
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* Added support for I256 in format_units. Added two complement support for I256.
* Add I256 support into parse_units
Co-authored-by: Dave Belvedere <dave@protonmail.com>
* ci: install anvil
* test: use anvil instead of ganache
* ci: fix anvil ver
* ci: re-enable example tests
* test: remove unnecessary assertions
* test: enable anvil launch test
* docs: typo
* test: fix anvil chain id
* ci: install ganache
Ganache is needed for the Ganache tests
* chore: remove legacy feature from some examples
* ci: correctly build examples
* test: use correct account balance for anvil
* chore: remove sub_id == 1 check
this was only possible in ganache because it gives serial
sub ids, but in every other reasonable client the ids are generated
randomly, so we cannot test for its value
* test: ensure txs are different
There is a bug in Ganache's mempool which accepts duplicate transactions (here with the same nonce), whereas here we pre-set all the nonces so that they end up having a different transaction hash.
* test: ignore ganache tests
* fix: terzor api changes
* ci(examples): install Anvil, remove geth/ganache
* test(provider): Anvil instead of Geth
some tests start to fail now
* fix: revert usage of Anvil in ipc tests
Anvil does not support IPC yet
* fix: update examples script
* ci: use anvil for wasm example
* replace last ganache usage
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
The U256 priority fees were being coerced into u32, which was not big
enough for actual values. The overflow was happening but not checked.
This led to a possible divide-by-zero panic in this code as well.
This change does the math as I256 -- overkill, but it works.
* fix: do not panic on invalid units conversion
This is done by switching the From implementations to TryFrom and
making the conversion functions return a thiserror Error instead of
the previous Boxed error object
* chore: update changelog