ethclient/simulated: implement new sim backend (#28202)
This is a rewrite of the 'simulated backend', an implementation of the ethclient interfaces which is backed by a simulated blockchain. It was getting annoying to maintain the old version of the simulated backend feature because there was a lot of code duplication with the main client. The new version is built using parts that we already have: an in-memory geth node instance running in developer mode provides the chain, while the Go API is provided by ethclient. A backwards-compatibility wrapper is provided, but the simulated backend has also moved to a more sensible import path: github.com/ethereum/go-ethereum/ethclient/simulated --------- Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com>
This commit is contained in:
co-authored by
Felix Lange
Gary Rong
parent
9e018ce3a5
commit
2d08c99009
@@ -199,6 +199,16 @@ type GasPricer interface {
|
||||
SuggestGasPrice(ctx context.Context) (*big.Int, error)
|
||||
}
|
||||
|
||||
// GasPricer1559 provides access to the EIP-1559 gas price oracle.
|
||||
type GasPricer1559 interface {
|
||||
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
|
||||
}
|
||||
|
||||
// FeeHistoryReader provides access to the fee history oracle.
|
||||
type FeeHistoryReader interface {
|
||||
FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*FeeHistory, error)
|
||||
}
|
||||
|
||||
// FeeHistory provides recent fee market data that consumers can use to determine
|
||||
// a reasonable maxPriorityFeePerGas value.
|
||||
type FeeHistory struct {
|
||||
@@ -239,3 +249,13 @@ type GasEstimator interface {
|
||||
type PendingStateEventer interface {
|
||||
SubscribePendingTransactions(ctx context.Context, ch chan<- *types.Transaction) (Subscription, error)
|
||||
}
|
||||
|
||||
// BlockNumberReader provides access to the current block number.
|
||||
type BlockNumberReader interface {
|
||||
BlockNumber(ctx context.Context) (uint64, error)
|
||||
}
|
||||
|
||||
// ChainIDReader provides access to the chain ID.
|
||||
type ChainIDReader interface {
|
||||
ChainID(ctx context.Context) (*big.Int, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user