Documentation
¶
Index ¶
- type AnvilContainer
- type BlockResponse
- type CurrentBlockResponse
- type GethContainer
- type RPCClient
- func (m *RPCClient) AnvilAutoImpersonate(b bool) error
- func (m *RPCClient) AnvilDropTransaction(params []interface{}) error
- func (m *RPCClient) AnvilMine(params []interface{}) error
- func (m *RPCClient) AnvilSetAutoMine(flag bool) error
- func (m *RPCClient) AnvilSetBlockGasLimit(params []interface{}) error
- func (m *RPCClient) AnvilSetMinGasPrice(gas uint64) error
- func (m *RPCClient) AnvilSetNextBlockBaseFeePerGas(gas *big.Int) error
- func (m *RPCClient) AnvilSetStorageAt(params []interface{}) error
- func (m *RPCClient) AnvilTxPoolStatus(params []interface{}) (*TxStatusResponse, error)
- func (m *RPCClient) BlockNumber() (int64, error)
- func (m *RPCClient) EVMIncreaseTime(seconds uint64) error
- func (m *RPCClient) GetHeaderByNumber(blockNumber int64) (*types.Header, error)
- func (m *RPCClient) GethSetHead(blocksBack int) error
- func (m *RPCClient) PrintBlockBaseFee() error
- type RemoteAnvilMiner
- type TxStatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnvilContainer ¶
type AnvilContainer struct { testcontainers.Container URL string }
func StartAnvil ¶
func StartAnvil(params []string) (*AnvilContainer, error)
type BlockResponse ¶
type CurrentBlockResponse ¶
type CurrentBlockResponse struct {
Result string `json:"result"`
}
type GethContainer ¶
type GethContainer struct { testcontainers.Container URL string }
type RPCClient ¶
type RPCClient struct { URL string // contains filtered or unexported fields }
RPCClient is an RPC client for various node simulators API Reference https://book.getfoundry.sh/reference/anvil/ TODO: fix in next PRs nolint
func New ¶
New creates new RPC client that can be used with Geth or Anvil this is a high level wrapper for common calls we use
func (*RPCClient) AnvilAutoImpersonate ¶
AnvilAutoImpersonate sets auto impersonification to true or false
func (*RPCClient) AnvilDropTransaction ¶
AnvilDropTransaction removes transaction from tx pool API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilMine ¶
AnvilMine calls "evm_mine", mines one or more blocks, see the reference on RPCClient API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetAutoMine ¶
AnvilSetAutoMine calls "evm_setAutomine", turns automatic mining on, see the reference on RPCClient API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetBlockGasLimit ¶
AnvilSetBlockGasLimit sets next block gas limit API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetMinGasPrice ¶
AnvilSetMinGasPrice sets min gas price (pre-EIP-1559 anvil is required) API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetNextBlockBaseFeePerGas ¶
AnvilSetNextBlockBaseFeePerGas sets next block base fee per gas value API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetStorageAt ¶
AnvilSetStorageAt sets storage at address API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilTxPoolStatus ¶
func (m *RPCClient) AnvilTxPoolStatus(params []interface{}) (*TxStatusResponse, error)
AnvilTxPoolStatus calls "txpool_status", returns txpool status, see the reference on RPCClient API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) BlockNumber ¶
Call "eth_blockNumber" to get the current block number
func (*RPCClient) EVMIncreaseTime ¶
EVMIncreaseTime jumps forward in time by `seconds`. The parameter is a JSON number (in seconds)
func (*RPCClient) GetHeaderByNumber ¶
GetHeaderByNumber retrieves block details by block number this is purely debug method to verify the gas chaos is applied
func (*RPCClient) GethSetHead ¶
func (*RPCClient) PrintBlockBaseFee ¶
PrintBlockBaseFee prints block base fee this is purely debug method to verify gas chaos is applied
type RemoteAnvilMiner ¶
type RemoteAnvilMiner struct { Client *RPCClient // contains filtered or unexported fields }
RemoteAnvilMiner is a remote miner for Anvil node Allows to control blocks emission more precisely to mimic real networks workload
func NewRemoteAnvilMiner ¶
func NewRemoteAnvilMiner(url string, headers http.Header) *RemoteAnvilMiner
NewRemoteAnvilMiner creates a new remote miner client
func (*RemoteAnvilMiner) MineBatch ¶
func (m *RemoteAnvilMiner) MineBatch(capacity int64, checkInterval time.Duration, sendInterval time.Duration)
MineBatch checks the pending transactions in the pool, if threshold is reached mines the block and repeat the process
func (*RemoteAnvilMiner) MinePeriodically ¶
func (m *RemoteAnvilMiner) MinePeriodically(interval time.Duration)
MinePeriodically mines blocks with a specified interval should be used when Anvil mining is off
type TxStatusResponse ¶
type TxStatusResponse struct { Result struct { Pending string `json:"pending"` } `json:"result"` }
TxStatusResponse common RPC response body