ethergo

module
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2024 License: MIT

README

Ethergo

Go Reference Go Report Card

Overview

Ethergo is a comprehensive embedded test suite for Synapse, built using the Go programming language. It provides the functionality to deploy contracts to various backends, streamlining the testing process for different types of blockchain networks. The module is organized into several subdirectories, each dedicated to specific aspects of the testing process, such as backends, chain interaction, contract management, and signing utilities.

Some key components of Ethergo include:

  • Backends: Ethergo supports different test backends for testing against various types of chains, including Anvil, Ganache, Geth, Preset, and Simulated backends.
  • Chain: This subdirectory provides tools for chain interaction, such as a chain client, a chain watcher, a deterministic gas estimator, and a client interface for the chain watcher.
  • Contracts: This section contains interfaces for working with contracts, including deployer and manager functionalities.
  • Manager: The manager is responsible for handling contract deployments.
  • Signer: Ethergo offers signing and transaction submission utilities, with various adapters for signing transactions and handling race conditions with nonces. It also includes a wallet interface capable of importing keys from seed phrases, private keys, and mnemonics.

To see a working example of Ethergo in action, refer to the example folder, which provides a complete demonstration of how to use the deployer and manager components. Please note that the APIs are subject to change.

Directory Structure

root
├── backends: Contains different test backends for testing against different types of chains
│   ├── anvil: Contains the anvil backend. This is useful for fork testing and requires docker. It aloso contains cheatcodes for testing detailed [here](https://book.getfoundry.sh/anvil/)
│   ├── ganache: Contains the ganache backend. This is useful for fork testing and requires docker. This is currently using an older version of ganache, but will be updated to use the latest version. See [here](https://github.com/trufflesuite/ganache) for details.
│   ├── geth: Contains an embedded geth backend. This is useful for testing against a local geth instance without forking capabilities. This does not require docker and runs fully embedded in the go application, as such it is faster than the docker-based backends, but less versatile. Used when an rpc address is needed for a localnet.
│   ├── preset: Contains a number of preset backends for testing.
│   ├── simulated: The fastest backend, this does not expose an rpc endpoint and uses geth's [simulated backend](https://goethereumbook.org/en/client-simulated/)
├── chain: Contains a client for interacting with the chain. This will be removed in a future version. Please use [client](./client) going forward.
│   ├── chainwatcher: Watches the chain for events, blocks and logs
│   ├── client: Contains eth clients w/ rate limiting, workarounds for bugs in some chains, etc.
│   ├── gas: Contains a deterministic gas estimator
│   ├── watcher: Client interface for chain watcher.
├── contracts: Contains interfaces for using contracts with the deployer + manager
├── client: Contains an open tracing compatible ethclient with batching.
├── example: Contains a full featured example of how to use deployer + manager
├── forker: Allows the use of fork tests in live chains without docker using an anvil binary.
├── listener: Drop-in contract listener
├── manager: Manages contract deployments.
├── mocks: Contains mocks for testing various data types (transactions, addresses, logs, etc)
├── parser: Parse hardhat deployments
│   ├── hardhat: Parses hardhat deployments
│   ├── abi: Parses abi function input
│   ├── rpc: Parses rpc requests/responses
├── signer: Signing + tx submission utilities
│   ├── nonce: Automatically handles race conditions with nonces, used in backends.
│   ├── signer: Various adapters for signing transactions
│     ├── awssigner: Use AWS KMS to sign transactions
│     ├── gcpsigner: Use GCP Cloud KMS to sign transactions
│     ├── localsigner: Use a local signer to sign transactions
│   ├── wallet: Wallet contains a wallet interface. It is capable of importing keys from seed phrases, private keys, and mnemonics.
├── submitter: Generic tx submitter, currently not stable enough for general use.
├── util: various utilities used throughout the library

Directories

Path Synopsis
Package backends provides different kinds of backends you can test against that conform to a common interface thesse allow you to test eth functionality against a variety of backends
Package backends provides different kinds of backends you can test against that conform to a common interface thesse allow you to test eth functionality against a variety of backends
Package chain contains a common interface for running commands against evm rpc's.
Package chain contains a common interface for running commands against evm rpc's.
Package client implements the Ethereum RPC API client with tracing and batch requests.
Package client implements the Ethereum RPC API client with tracing and batch requests.
Package contracts contains contract types
Package contracts contains contract types
Package deployer contains utilities for deploying test contracts
Package deployer contains utilities for deploying test contracts
Package example defines an example project that uses ethergo
Package example defines an example project that uses ethergo
Package forker allows a user to fork an arbitrary blockchain and make rpc calls against it.
Package forker allows a user to fork an arbitrary blockchain and make rpc calls against it.
Package internal contains dev dependencies required for running developer tasks (coverage testing, etc) that are not required by the project itself.
Package internal contains dev dependencies required for running developer tasks (coverage testing, etc) that are not required by the project itself.
Package listener is the listener used to pull in chain events
Package listener is the listener used to pull in chain events
Package manager manages deployers to make them as simple as possible
Package manager manages deployers to make them as simple as possible
Package mocks mocks address, clients, etc for evm chains TODO: rename this package, as it's ignored by codecov.
Package mocks mocks address, clients, etc for evm chains TODO: rename this package, as it's ignored by codecov.
parser
Package signer provides a common interface for signing
Package signer provides a common interface for signing
Package submitter provides a simple interface for submitting txs to multiple chains and retrying.
Package submitter provides a simple interface for submitting txs to multiple chains and retrying.
Package util contains eth type utils
Package util contains eth type utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL