Commit Graph

73 Commits

Author SHA1 Message Date
DaniPopes 16f9fab75c
fix: enable doc_cfg feature for docsrs (#2294) 2023-03-22 16:29:10 -07:00
James Prestwich 080bb2e068
Prestwich/gas escalator dangle (#2284)
* fix: prevent gas escalator dangling tasks

* chore: lockfile

* refactor: avoid holding lock for a long time

* refactor: cleanup

* chore: changelog and docs

* tests: fix test in name

* docs: add a lot of info to the gasescalator docs

* reset changelog as it'll be automatically managed in the future

---------

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2023-03-21 11:18:41 -07:00
DaniPopes 439a0c7de0
chore(deps): bump and use workspace dependencies (#2222)
* chore: update all deps

* chore: update dependabot

* chore: separate ethers package from workspace

* chore: package metadata

* chore: use package.*.workspace = true

* fix: docs.rs build

* chore: update examples manifests

* chore: use workspace dependencies for ethers-* crates

* fix: test

* chore: use workspace dependencies for all dependencies

* chore: pin rust-crypto

* chore: add license field to example crates

* fixes

* more fixes

* fix: test

* last fixes

* fix: wasm

* fix: docs.rs build

* fix

* fix: wasm-pack error

see also https://github.com/rustwasm/wasm-pack/issues/1238

* fix: wasm deps and example

* ci: update

* fix: wasm tests

* fix: eip712 tests

* fix: windows ci

* fix

* chore: update docsrs metadata

* chore: bump version to match crates.io

* chore: rm bad release.toml config

* chore: rm release.toml

bad configuration

* chore: add exclude to workspace

* fix: middleware

* fix: solc feature flags

* chore: run cargo upgrade

* chore: update deps

* chore: update remaining deps

* undo fix

* update lock

* bump yubi

* fix: update coins-* and fix spki breaking changes
2023-03-16 12:28:35 -07:00
DaniPopes f9086e703c
fix: docsrs builds final (#2235)
* fix

* fix: middleware

* fix: update rustc flags

* docs: add comment
2023-03-08 14:58:44 -08:00
James Prestwich e54666b467
fix: init guard in noncemanager (#2227) 2023-03-04 18:37:50 -07:00
DaniPopes da743fc8b2
ci/test: improve CI jobs and tests (#2189)
* ci: move to scripts directory

* nits

* ci: improve main CI jobs

* fix: install script

* fix

* fix: use curl for windows installation

* fix: wasm typo

* tests: move to single binary

* chore: clippy

* chore: clippy

* chore: clippy

* fix: test command

* fix: quote tests

* update script

* fix: action exclude

* fix: dev deps

* fix: only run wasm in own job

* ci: add aarch64 targets

* test: rm useless test

* ci: update security audit

* ci: add deny CI

* chore: rm unused audit.toml

* chore: update geth.rs

* ci: remove unusable targets

* fix: install script path

* fix: wasm

* improve script

* fix: failing ci

* fix: contract tests

* ci: improve install script

* update middleware tests

* move integration etherscan tests to tests/ dir

* fix: eip2930 access_list field name

* add pendingtransaction must_use

* add random anvil comment

* ci: add miri job

* ci: simplify

* fixci

* Revert "add pendingtransaction must_use"

This reverts commit 770b21b4a3.

* fix: macos script

* fix: use curl in script

* unused ci

* update script

* fix wasm

* rm_miri

* fix: signer test

* fix: wasm ci

* fix: ipc test

* fix: live celo tests

* fix: abi online source test

* fix: windows paths in test

* chore: update serial_test

* ci: run live tests separately

* fix: provider tests

* fix: unused var

* fix: feature

* fix merge

* fix: etherscan key tests

* ci: rm duplicate audit

* fix: split etherscan test ci

* fix: etherscan test

* fix: generate multiple unused ports

* fix: source test

* fix: udeps

* rm unused
2023-02-28 17:26:27 -07:00
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
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 ef6e7f41a1
Refactor: organize ethers-providers (#2159)
* feature: bubble up jsonrpc error response via trait

* refactor: ClientError to TransportError

* refactor: FromErr to MiddlewareError

* tests: fix test with middlewareerror

* fix: doctest

* fix: fix custom middleware example

* feature: as_serde_error

* docs: for error traits

* fix: custom example and unnecessary ref

* refactor: in progress organization

* refactor: continue cleaning up

* refactor: finish changing crate layout

* refactor: fix test imports

* refactor: move convenience impl into toolbox

* chore: changelog

* docs: make them suck less

* fix: remove deprecation

* fix: DaniPopes's nits
2023-02-20 15:55:36 -08:00
James Prestwich 0c16eb971d
Prestwich/event no lifetime (#2105)
* refactor(breaking): remove lifetime from Event

* fix: example updated to use new event
2023-02-13 17:14:38 -08:00
georgewhewell c0fd8326f0
chore(clippy): fix bare urls in abigen (#2133) 2023-02-10 11:49:27 -08:00
Gyuho Lee 3ed83d5dd3
nonce_manager: remove current nonce load when initialized (#2013)
If nonce was just initialized, no need for store and load.
Just return the stored value without load.

Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>

Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
2023-01-05 11:47:05 +02:00
Matthias Seitz fcef7c70ad
fix: gwei wei wrong u256 constant (#1992) 2022-12-30 12:46:52 +02:00
DaniPopes bb4af1c134
fix(middleware): oracles, tests (#1944)
* fix(middleware): oracles, tests

* fix: use util

* fix: make blocknative api key optional

* make response fields public

* import orders

* docs: oracle trait

* fix: make response fns public

* chore: clippy

* fix: doc tests
2022-12-18 13:45:47 +02:00
Andrea Simeoni e5aa4518d7
Docs: Middleware library (#1912)
* Updated the middleware README heading

* fix docs CI

* Added heading description for the main middlewares

* Restructure README examples

* Fix docs CI

* Fix MiddlewareBuilder function docs

* Typos inside the middleware README

Co-authored-by: Andrea Simeoni <>
2022-12-02 12:57:59 -08:00
Andrea Simeoni 16ab3d5820
Feat middleware stack builder (#1890)
* ProviderBuilder struct + docs

* README

* Docs typos

* Removed useless Arc
Rename module

* Unit tests

* cargo +nightly fmt

* CHANGELOG

* CHANGELOG typo

* ci: fix docs job

* review: Removed Option<M>. Builder functions directly consume self.

* feat: `with_signer` builder function

* feat: `nonce_manager` builder function

* feat: `gas_oracle` builder function

* Unit tests

* Docs

* fix: cargo +nightly fmt

* Update ethers-middleware/src/builder.rs

Typo

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* Builder functions provided as a trait
Update docs
Update tests

* cargo +nightly fmt

* CHANGELOG

Co-authored-by: Andrea Simeoni <>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-11-28 12:16:21 -08:00
DaniPopes debd6fec3d
chore: clippy (#1812)
* chore: clippy

* fmt
2022-11-07 15:43:11 -08:00
Kristian Gaylord 22fae3f8e7
enhance signer middleware to automatically switch legacy (#1832) 2022-11-07 12:27:45 -08:00
Matthias Seitz 676f039230
chore(clippy): make clippy happy (#1778) 2022-10-11 10:49:05 -07:00
DaniPopes db75e3628e
feat(core): add utility methods to NameOrAddress (#1720)
* feat: NameOrAddress impls

* feat: add to_addr to TypedTransaction

* fix: use NameOrAddress for ens

* chore: clippy

* dont clone
2022-09-19 10:51:04 -07:00
Remco Bloemen 49b4ac7acb
More gas oracles (#1251)
* Deriver auto_impls for GasOracle

* Provider as GasOracle

* impl fill_transaction in GasOracleMiddleware
2022-08-20 16:04:08 -07:00
Nicolas Gotchac 68fba606c2
Don't auto-generate an AccessList when sending/filling a tx (#1619)
Add an optionnal `block` parameter to the gas estimation method
2022-08-19 14:33:12 -07:00
Matthias Seitz c75608eda1
ci: rm pinned nightly (#1541)
* ci: rm pinned nightly

* chore(clippy): make clippy happy
2022-07-31 19:00:31 -07:00
Matthias Seitz 83e2684824
refactor: use expanded EthEvent impl (#1499) 2022-07-24 03:16:23 +02:00
Dan Cline c0a5962bc4
fix(middleware): use signer chain when tx is None (#1377) 2022-06-14 13:16:41 -07:00
naiba 214d24dfd2
fix: wrong unit for gas_price (ether -> gwei) (#1316) 2022-06-02 08:58:03 -07:00
Matthias Seitz 89bc6420bb
test: replace ganache with anvil (#1286)
* 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>
2022-06-01 08:22:39 -07:00
Remco Bloemen 18b4ef4e47
Robust gas oracles (#1222)
* Pass reqwest Client to constructors

* Add Median oracle aggregator

* DRY

* Weighted median

* Add cache layer

* Simplify lifetimes

* Add with_client constructors

* Update GasNow urls

* Add u256_from_f64_saturating

* Add polygon oracle

* Fixes

* Fix lints

* Remove dbg statements
2022-05-06 08:16:43 -07:00
Matthias Seitz ce3ebaefa0
chore(clippy): make clippy happy (#1230) 2022-05-06 08:15:49 -07:00
oblique 6faceb20d7
feat: Relax `Clone` requirements when `Arc<M>` is used (#1183)
`#[derive(Clone)]` was implementing `Clone` only if `M` was `Clone`,
however because of `Arc<M>` this can be relaxed.
2022-04-27 15:33:22 +03:00
georgewhewell a866cd5726
feat: blocknative gas oracle (#1175)
* gas oracle: add more error variants

* gas oracle: adds BlockNative oracle

* pdate changelog
2022-04-25 08:50:55 -07:00
Luke Tchang 1cc42cbba0
fix(timelag): normalize block if block = None (#1146)
* fix(timelag): normalize block if block = None

* lint: nightly formatter

Co-authored-by: James <james@prestwi.ch>
2022-04-14 12:20:35 -07:00
Dan Cline 1d14f9d26e
Ensure a consistent chain ID between a signer and provider in SignerMiddleware (#1095)
* feat(middleware): fetch chainid from middleware

Require SignerMiddleware to fetch the inner middleware's to set for the
signer. SignerMiddleware now requires an instantiated middleware with
an accessible get_chainid method.

* ci: update ganache

newer ganache version is needed to specify the ganache provider chain id
in tests

* set SignerMiddleware constructor return to result

* create new method for pulling chainid

* add consistent chainid CHANGELOG entry

* remove awaits

* switch test_derive_eip712 to use consistent signer

 * remove gas estimation equality assert in deploy_and_call_contract -
   updated version of ganache no longer returns the same value for gas
   estimation and gas_used

* revert with_signer to non-async non-result

* cargo fmt

* expand SignerMiddleware::new comment

* remove doc indent
2022-04-10 10:55:30 -07:00
Matthias Seitz 916e9a7334
chore(clippy): add some deny lints (#1064)
* feat: add deny lints

* trim ethers core

* trim ethers eip712

* deny ethers contract derive

* deny ethers contract abigen

* deny ethers contract

* deny ethers providers

* chore: add denies and fix unused deps

* doc: fix links

* fix: wasm build

* doc: fix links

* doc: fix links

* doc: fix inline doc links

* docs: fix intra doc links
2022-03-19 10:05:39 -07:00
Meet Mangukiya b642230c7d
feat(signer): set from on tx before calling eth_call, eth_createAccessList, eth_estimateGas (#1021) 2022-03-14 13:27:06 +02:00
teebaumcrypto 2b178e9cf7
Add pub fn initialize_nonce in NonceMiddleManager (#840)
* Public function added "initialize_nonce"

Initialize the nonce manager with the current nonce

* Update CHANGELOG.md

* return generic

* Added current nonce as return value
Will now compile.

* Load nonce to return, fixes compile.

* chore: fmt

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-01-31 21:04:26 +02:00
Dan Cline 01544ec4b7
Implement RLP decoding for transactions (#805)
* Implement RLP decoding for transactions

* set chain_id in fill_transaction
2022-01-30 21:21:16 +02:00
Matthias Seitz e24117a1e1
chore(clippy): make clippy happy (#705) 2021-12-19 06:28:38 +02:00
James Prestwich 3338cdead1
feature: set nonce in fill transaction (#687)
* feature: set nonce in fill transaction

* chore: update changelog

* refactor: remove nonce_setting in fill_transaction

* refactor: set nonce in send_escalating
2021-12-14 00:50:13 +02:00
Alexey Shekhirin dd2c589102
feat(etherscan, middleware): implement gas endpoints and use in oracle middleware (#621)
* feat(etherscan, middleware): implement gas-related endpoints and use them in gas oracle

* cleanup deps

* better comment

* revertme: add debug print

* Revert "revertme: add debug print"

This reverts commit 63993642c4.

* make etherscan tests serial

* run each etherscan test at least 200ms

* 200ms -> 250ms

* Revert "200ms -> 250ms"

This reverts commit 29c7f6ed9a.

* add separate etherscan key for celo tests

* 200ms -> 250ms

* add Chain::Sepolia to match
2021-11-27 09:54:20 +02:00
Georgios Konstantopoulos bb3a2fd27c
release: 0.6.0 (#611)
* release(core): 0.6.0

* release(providers): 0.6.0

* release(contract-abigen): 0.6.0

* release(contract-derive): 0.6.0

* release(derive-eip712): 0.2.0

* release(ethers-solc): 0.1.0

* release(contract): 0.6.0

* release(etherscan): 0.2.0

* release(signers): 0.6.0

* release(middleware): 0.6.0

* chore: update dev deps

* refactor(core): move docs to readme

* refactor(contract): move docs to readme

* refactor(providers): move docs to readme

* chore: bump ethers cargo toml

* refactor(signers): move docs to readme

* refactor(middleware): move docs to readme

* fix(ethers): adjust re-exports to allow searching internal packages

* docs: fix broken links

we cannot use relative crate imports because the readmes
are also imported by the parent crate

* alias readmes to be accessible to ethers crate
2021-11-23 21:23:12 +02:00
Luke Tchang 8eac1997f4
fix: remove const lag so it can be passed in as runtime variable (#587) 2021-11-16 16:03:26 -08:00
James Prestwich 0f22afeb49
Prestwich/escalator fixes (#581)
* refactor: handle nonce-too-low cases indicating previous conf.

* feature: add sign_transaction to Middleware trait and fix escalation signing
2021-11-14 14:26:02 +02:00
Luke Tchang 4db37cad84
fix: adds TimeLag::new() (#568) 2021-11-10 14:38:19 +02:00
Matthias Seitz dcf20022c6
chore: add rustfmt.toml (#537)
* chore: add rustfmt.toml

* rustfmt

* chore: Update readme with fmt info

* ci: update ci

* chore: rustfmt

* rustfmt

* rustfmt

* ci: install libudev

* chore(clippy): make clippy happy

* chore(clippy): make clippy happy

* revert ci

* ci: install libudev
2021-10-29 14:29:35 +02:00
Georgios Konstantopoulos b96c73ac3b
chore: remove GasNow api since it's deprecated (#508)
:rip:
2021-10-15 14:05:54 +03:00
James Prestwich 57736ed232
feature: first draft timelag middleware (#457)
* feature: first draft timelag middleware

* chore: add 1 line docstrings

* fix: address PR comments

- imports to top of file
- expect with message
- fill_transaction fix

* bug: fix fill_transaction error return

* refactor: make receipt filtering less ugly

* fix: make trait impl wasm compatible

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-09-17 12:38:35 -05:00
Georgios Konstantopoulos 38c7f5030f
chore: remove cyclical dependencies (#410)
* chore(core): remove ethers dep

* chore(providers): remove ethers dep

tests using higher-rank crates are temporarily disabled

* chore(middleware): remove ethers dep and move tests over from providers

* chore(signers): remove ethers dep

* fix(contracts): correctly determine ethers sub-crates & remove ethers

* fix: re-enable tests for all members

* fix: make contract compile without middleware dep

move over the test using middleware to ethers-middleware

* chore: cargo fmt

* chore(contract): add missing import

* WIP

* WIP

* fix(middleware): use rustls as dev dep

* chore: cargo fmt

* fix: use different key for nonce manager to avoid nonce conflicts

* chore: fix celo test ported over to middlewares

the test had the same private key with an existing middleware test,
causing potential nonce reuses

it now also uses a different storage contract, so we had to change
it to use u256 instead of string

* fix(middleware): enable contracts/celo feature

* chore: ignore non-eip2718 txs to rinkeby
2021-08-29 00:06:29 +03:00
Matthias Seitz ea566663d4
feat: wasm support (#390)
* feat: partial wasm32 support

* make compile for wasm32

* feat: att async-trait attr

* make compatible with wasm

* add type alias for archs

* rustfmt

* add wasm ci

* make compile with wasm-pack test

* make compile with wasm-pack test

* make compile with wasm-pack test

* make compile with wasm-pack test

* ci: disable wasmpack

* feat: use wasm timer delay

* feat: add wasm provider

* rustfmt

* misc refactor

* add wasm example

* make example a directory

* untrack error log

* move profile to root

* fix unused imports

* ci: enable wasm-pack test

* style: unify websocket implementations

* fix: typos

* fix: make policy compatible with wasm target

* chore: do not include ethers-wasm example as top level workspace member

* chore: modify wasm32 dependencies

* chore: make note about getrandom

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-08-23 12:56:44 +03:00
Matthias Seitz 8587b3e9b3
feat: add basic policy middleware (#400)
* feat: initial policy design

* docs: add some docs
2021-08-23 11:30:26 +03:00