Commit Graph

387 Commits

Author SHA1 Message Date
DaniPopes 203e350940
docs: fix broken links, update documentation (#2203)
* docs: fix broken links

* docs: update READMEs and module-level documentation
2023-02-27 13:03:17 -07:00
DaniPopes f59153ba66
fix(core): i256 docs (#2187)
* fix(core): i256 docs

* add doc
2023-02-24 16:44:47 -08:00
DaniPopes 7e12f3ba36
feat(core): improve I256 implementation (#2180)
* feat(core): improve I256 implementation

* chore: reorganize impls

* chore: update docs, add attributes, use Self

* fix: signum

* chore: use inline(always), update implementations

* fix: use usize for shifting, add more shift ops

* feat: make arithmetic ops generic to match U256

* chore: clippy

* chore: return
2023-02-23 16:21:41 -08:00
James Prestwich 2090bf560e
Expose contract revert errors in the ContractError struct (#2172)
* feature: spelunk for revert errors

* feature: bubble up revert to contract error

* feature: bubble up reverts to multicall

* fix: correctly remove signature when deserializing EthErrors

* chore: remove redundant test

* chore: clippy

* fix: allow empty revert string

* docs: add all missing rustdoc for ethers-contract

* chore: rustfmt

* chore: Changelog

* fix: danipope test comment
2023-02-22 14:52:25 -08:00
James Prestwich ee5e3e52c0
fmt: run rustfmt (#2176) 2023-02-21 16:52:20 -08:00
DaniPopes e55b8116f3
feat(contract): improve Multicall result handling (#2164)
* nits

* clippy

* ordering

* move

* chore: edition 2021

* chore: detokenize nit

* feat(contract): improve Multicall result handling

* docs: update CHANGELOG.md

* feat: make fields public

* chore: clippy
2023-02-20 18:50:28 -08:00
DaniPopes 3732de844c
fix(abigen): builtin trait derives (#2170)
* fix(abigen): builtin trait derives

* refactor: EthDisplay

* feat(derive): improve type detection

* chore: cleanup

* chore: edition 2021

* chore: clippy

* chore: use unreachable
2023-02-20 16:27:43 -08:00
Muhammad Syahrul Nizam 33ed94851c
chore: added canto network (#2171) 2023-02-20 13:51:06 -08:00
Dan Cline 228f944726
use Option for CliqueConfig fields (#2162) 2023-02-17 12:01:12 -08:00
WillQ fd83e203b4
feat: add debug for geth default api (#2140) 2023-02-15 10:54:58 -08:00
DaniPopes a69036f07b
fix(core): block FromStr implementation (#2155) 2023-02-14 13:15:58 -08:00
Dan Cline a064657234
fix(core): test hive genesis parsing (#2145)
* 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
2023-02-13 17:06:57 -08:00
Matthias Seitz a474a95cc5
chore: use arbiscan urls for arbitrum goerli (#2127) 2023-02-10 11:51:32 -08:00
YuFei Wang 14be402f40
feat: add support for Geth built-in tracer and config (#2121)
* feat: add 4byteTracer

* feat: add prestateTracer

* feat: add noopTracer

* refactor: geth tracer layout

* feat: call tracer config

* fix: compatible with legacy call trace

* feat: pre state tracer config

* test: serialize/deserialize tracer

* refactor: deserialize type

* style: update refs

* chore: update CHANGELOG.md

* style: json string to object
2023-02-07 10:50:44 -08:00
James Prestwich e5e4da07c5
feature: allow signature to recover typed_data payloads (#2120)
* feature: allow signature to recover typed_data payloads

* fix: under feature flag and Changelog

* fix: undo accidental doc mangling
2023-02-06 13:27:35 -08:00
Matthias Seitz 0bb6f51082
chore: add convenient from impls (#2112) 2023-02-05 17:33:25 -08:00
DaniPopes cabb15e346
feat(abi): packed encoding (#2104)
* feat(abi): packed encoding

* clippy

* fix: use least number of bits for int/uint

* docs: update CHANGELOG.md

* fix: doctest
2023-02-04 19:23:27 -08:00
Matthias Seitz a544d4076c
feat: add DerefMut for OtherFields (#2109) 2023-02-02 11:12:52 -08:00
Vid Kersic 7e7f9041b3
feat: add support for js tracer to geth trace, fix different return types (#2064)
* feat: add support for js tracer to geth trace, fix different return types

* chore: fix clippy

* chore: update geth structs
2023-01-31 09:58:06 -08:00
DaniPopes 9b7d184fd6
feat(core): more type parsing (#2095)
* feat(core): more type parsing

* c

* doc
2023-01-31 09:37:33 -08:00
DaniPopes 93e1850646
refactor/feat(abigen,types): add bytes::Bytes static methods, refactor struct declaration (#2089)
* refactor: final struct expansion

* feat(types): implement bytes::Bytes static methods

* feat: use static Bytes for bytecode

* chore: add rustfmt skip directive

* clippy
2023-01-30 12:12:35 -08:00
Matthias Seitz 71c6fd4928
feat: add convenience impl From Log (#2087) 2023-01-30 12:06:46 -08:00
Dan Cline 9ebc5b378c
feat(core): expose genesis and private key in Geth (#2091)
* 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
2023-01-30 11:57:34 -08:00
Matthias Seitz ff05a8762b
fix: add getrandom with js feature for wasm (#2076) 2023-01-27 13:14:26 -05:00
Dan Cline e9a808e84f
fix(core): fix geth --init temp dir race condition (#2068)
* 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
2023-01-21 18:13:40 -08:00
Georgios Konstantopoulos b8fa524e8e
feat(core/geth): enable Clique mode (#2063)
* feat(core/geth): add method for initing Clique genesis

* feat(core/geth): add Clique mode

this is ported from https://github.com/paradigmxyz/reth/pull/623/files\#diff-99e7bcdfb85c75ffe5fb2ccfbc5fd8234fced6704c34b622fbf24289b8522515R228-R245

* feat(core/geth): disable discovery in clique mode

* examples: add Geth Clique example
2023-01-19 10:49:47 -08:00
Georgios Konstantopoulos 27761d7acc chore: derive default for enums 2023-01-13 11:07:52 -08:00
Dan Cline 3a01682edf
feat(core): switch shanghaiBlock to shanghaiTime (#2049)
* geth switched to time-based forking in
   https://github.com/ethereum/go-ethereum/pull/25878, this changes the
   name of the `shanghai_block` field to `shanghaiTime` so it is
   compatible with geth.
2023-01-13 10:19:25 -08:00
DaniPopes b4b153a364
perf(utils): avoid unnecessary allocations (#2046)
* perf(utils): avoid unnecessary allocations

* docs: add more to_checksum information

* docs

* use address
2023-01-11 19:20:35 -08:00
joshieDo 3c65997eae
feat(core): add `strum::EnumIter` and `strum::EnumCount` to `Chain` (#2043)
* add strum EnumIter and EnumCount to Chain

* clippy
2023-01-11 19:17:46 -08:00
Matthias Seitz 01d3e4310f
feat: support parsing bytecode from evm object (#2024) 2023-01-07 16:22:07 +02:00
DaniPopes 2aa7bc3b99
chore(core): alias&export error as ParseChainError (#2022)
* chore(core): alias&export error as ParseChainError

`pub use TryFromPrimitiveError as ParseChainError`
for backwards compatibility

* fix: comment

* fully alias
2023-01-07 11:14:25 +02:00
Chris Cordle c684220144
feat: Add arbitrum nova api and chain id 42170 (#2020)
* Add arbitrum nova api and chain id

* chore: fmt

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2023-01-06 11:32:54 +02:00
WillQ 4a8a6ad259
abigen adopt hardhat generated bytecode (#2012)
* abigen adopt hardhat generated bytecode

* update changelog
2023-01-05 11:46:32 +02:00
Dan Cline c0e607da1e
feat(providers): support personal account apis (#2009)
* 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
2023-01-04 23:35:44 +02:00
Dan Cline 9147ee8e63
feat(core): add ability to take geth stderr (#2010)
* makes the geth logs accessible by using take() on the GethInstance
   stderr
2023-01-04 23:31:48 +02:00
Dan Cline 5f2476510b
feat(providers): add mining related apis (#2008)
* feat(providers): add miner_start endpoint

* add other mining related apis

 * add eth_mining
 * add miner_stop

* expose Geth miner rpc api
2023-01-04 23:30:03 +02:00
DaniPopes 97582cc346
feat(core, contract): improve `determine_ethers_crates` (#1988)
* refactor: determine_ethers_crates

* feat: improve crate resolution

* export new types and functions

* export

* fix: file name check

* fix: invert condition and check CARGO_MANIFEST_DIR

* use abigen macro to generate multicall

* chore: rm debug

* rm unnecessary .replace

* chore: clippy

* chore: clippy

* Revert "chore: clippy"

This reverts commit bd220f308d.

* Revert "chore: clippy"

This reverts commit 5550f4e856.

* add tests

* better tests, docs

* add another test

* fix docs

* refactor: add an environment struct for determining ethers crates

* fix: use fmt::Debug to escape paths

* docs: rename and rm old docs

* feat: use global path for crates

* fix: docs

* chore: move rand impl to tests mod
2023-01-03 15:11:57 +02:00
Dan Cline 228f9607fe
feat(core): expose all genesis related structs (#1975) 2022-12-30 14:48:47 +02:00
Georgios Konstantopoulos 48dbbbd829 chore: clippy 2022-12-30 14:18:58 +02:00
Vid Kersic b27c7b0773
feat: debug_traceCall (#1949)
* feat: debug_traceCall

* chore: update changelog

* fix: rebase to master and change tracer from string to enum
2022-12-25 13:33:05 +02:00
DaniPopes e007ea01b1
feat(core): chain macros and impls (#1958) 2022-12-22 14:44:51 +02:00
Dan Cline 6efa7ca85f
fix(core): decode to correctly in Transaction (#1946)
* would not correctly decode a create transaction because 0x80 was not
   properly decoded
2022-12-18 13:40:43 +02:00
Matthias Seitz e86183e935
feat: make geth executable configurable (#1947)
* feat: make geth executable configurable

* Update ethers-core/src/utils/geth.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update ethers-core/src/utils/geth.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2022-12-18 13:33:40 +02:00
Dan Cline ea10f4b4df
fix(core): set `GethInstance` p2p_port in spawn (#1933)
* 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
2022-12-09 09:42:23 -08:00
joshieDo 92e726921a
chore: add celo chain (#1932)
* add celo chain

* add missing chain case

* clippy & fmt
2022-12-07 21:37:11 -08:00
Matthias Seitz 3dfc04f9fe
chore(clippy): make clippy happy (#1923) 2022-12-05 22:05:33 -08:00
Andrea Simeoni 59dd541f2a
added new line were missing (#1928)
Co-authored-by: Andrea Simeoni <>
2022-12-05 22:05:02 -08:00
MouseLess.eth 913f15dc84
fix: remove `OpCode` enum and update `VMOperation`'s `op` field type (#1904)
* remove OpCode enum and update VMOperation's op field

* restore opcodes + update 0x20 to keccak256

* enum to deserialize opcodes into known or unknown

* Update ethers-core/src/types/trace/mod.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* fix typo: ExecutedInstruction

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-02 12:51:16 -08:00
odysseas.eth 3bf9025d2f
feat: impl Serialize for Chain (#1917)
* feat: impl Serialize for Chain

* fix: add deps
2022-12-02 12:12:34 -08:00