Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ethclient/simulated: implement new sim backend #28202

Merged
merged 32 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f0b5799
eth/catalyst: accounts/abi/bind/backend: implement new sim backend
MariusVanDerWijden Sep 26, 2023
8887559
accounts/abi/bind/backends: fix bugs, add basic test
MariusVanDerWijden Sep 26, 2023
d50932f
accounts/abi/bind/backends: new sim backend, ported tests, fixed tests
MariusVanDerWijden Nov 22, 2023
790ce4a
accounts/abi/bind/backends: revert to old interface for constructor
MariusVanDerWijden Nov 27, 2023
6ff924a
eth/catalyst: add comments
MariusVanDerWijden Nov 27, 2023
b608a39
accounts/abi/bind/backends: fail if transaction is not send
MariusVanDerWijden Nov 29, 2023
cb549c9
accounts/abi/bind/backends: fix review comments
MariusVanDerWijden Dec 1, 2023
71eec44
accounts/abi/backends: change SimulatedBackend to interface
fjl Dec 1, 2023
8cc2571
accounts/abi/bind/backends: add suggest gas tip cap
MariusVanDerWijden Dec 4, 2023
7e95bfb
accounts/abi/bind/backends: make sure SimulatedBackend interface sati…
MariusVanDerWijden Dec 5, 2023
c16d8a4
accounts/abi/bind/backends: fix test
MariusVanDerWijden Dec 5, 2023
e8d658b
ethereum: add interfaces for missing methods
fjl Dec 5, 2023
2af4549
accounts/abi/bind/backends: use new interfaces
fjl Dec 5, 2023
4978688
ethclient/simulated: move backend to new package
MariusVanDerWijden Dec 7, 2023
6544403
accounts/abi/bind: use LogFilterer interface
fjl Dec 7, 2023
6fb6d5c
accounts/abi/bind/backends: adjust comment
fjl Dec 8, 2023
b5da90d
ethclient/simulated: disable discovery
fjl Dec 8, 2023
373e65b
ethclient/simulated: split up backend and client
fjl Dec 8, 2023
8eb927b
ethclient/simulated: move interface assertion to tests
fjl Dec 8, 2023
2a12a97
all: fix typo and comments
rjl493456442 Dec 11, 2023
45953a9
ethclient/simulated: unexport NewWithNode
MariusVanDerWijden Dec 18, 2023
d71bfff
eth/catalyst: add comment
MariusVanDerWijden Dec 18, 2023
e648fb5
eth/catalyst: rework rollback procedure
MariusVanDerWijden Dec 19, 2023
c557960
core/txpool/legacypool: remove all txs if called with negative gasTip
MariusVanDerWijden Dec 19, 2023
7ab3038
eth/catalyst: properly flush txs
MariusVanDerWijden Dec 19, 2023
9c754a0
accounts/abi: use deprecated, ignore in lint
MariusVanDerWijden Dec 19, 2023
12c05b9
accounts/abi: don't use the deprecated, fix tests
MariusVanDerWijden Dec 19, 2023
a327647
ethclient/simulated: added comments
MariusVanDerWijden Jan 8, 2024
6b29940
eth/catalyst: apply lightclients suggestions
MariusVanDerWijden Jan 8, 2024
f016bff
ethclient/simulated: split gasTipCap and feeHistory interfaces
MariusVanDerWijden Jan 9, 2024
f895169
ethereum: rename to GasPricer1559
fjl Jan 10, 2024
d3b0135
accounts/abi/bind: embed more interfaces instead of redeclaring methods
fjl Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 11 additions & 32 deletions accounts/abi/bind/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ type BlockHashContractCaller interface {
// used when the user does not provide some needed values, but rather leaves it up
// to the transactor to decide.
type ContractTransactor interface {
ethereum.GasEstimator
ethereum.GasPricer
ethereum.GasPricer1559
ethereum.TransactionSender

// HeaderByNumber returns a block header from the current canonical chain. If
// number is nil, the latest known header is returned.
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
Expand All @@ -93,38 +98,6 @@ type ContractTransactor interface {

// PendingNonceAt retrieves the current pending nonce associated with an account.
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

// SuggestGasPrice retrieves the currently suggested gas price to allow a timely
// execution of a transaction.
SuggestGasPrice(ctx context.Context) (*big.Int, error)

// SuggestGasTipCap retrieves the currently suggested 1559 priority fee to allow
// a timely execution of a transaction.
SuggestGasTipCap(ctx context.Context) (*big.Int, error)

// EstimateGas tries to estimate the gas needed to execute a specific
// transaction based on the current pending state of the backend blockchain.
// There is no guarantee that this is the true gas limit requirement as other
// transactions may be added or removed by miners, but it should provide a basis
// for setting a reasonable default.
EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)

// SendTransaction injects the transaction into the pending pool for execution.
SendTransaction(ctx context.Context, tx *types.Transaction) error
}

// ContractFilterer defines the methods needed to access log events using one-off
// queries or continuous event subscriptions.
type ContractFilterer interface {
// FilterLogs executes a log filter operation, blocking during execution and
// returning all the results in one batch.
//
// TODO(karalabe): Deprecate when the subscription one can return past data too.
FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

// SubscribeFilterLogs creates a background log filtering operation, returning
// a subscription immediately, which can be used to stream the found events.
SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
}

// DeployBackend wraps the operations needed by WaitMined and WaitDeployed.
Expand All @@ -133,6 +106,12 @@ type DeployBackend interface {
CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
}

// ContractFilterer defines the methods needed to access log events using one-off
// queries or continuous event subscriptions.
type ContractFilterer interface {
ethereum.LogFilterer
}

// ContractBackend defines the methods needed to work with contracts on a read-write basis.
type ContractBackend interface {
ContractCaller
Expand Down