From eced371913899ca213f0385964c31c0e4dfbaae1 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Mon, 22 Jan 2024 17:47:41 -0700 Subject: [PATCH 01/17] save --- documentation/src/SUMMARY.md | 2 +- documentation/src/index.md | 191 +++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 documentation/src/index.md diff --git a/documentation/src/SUMMARY.md b/documentation/src/SUMMARY.md index 9c592cd4..204da7e5 100644 --- a/documentation/src/SUMMARY.md +++ b/documentation/src/SUMMARY.md @@ -1,5 +1,5 @@ # Summary - +[Arbiter](./index.md) - [Introduction](./introduction/introduction.md) - [Getting Started / Installation](./getting_started/getting_started.md) - [Setting up Simulations](./getting_started/setting_up_simulations.md) diff --git a/documentation/src/index.md b/documentation/src/index.md new file mode 100644 index 00000000..d65fada7 --- /dev/null +++ b/documentation/src/index.md @@ -0,0 +1,191 @@ +# Arbiter +**Arbiter** is a framework for stateful Ethereum smart-contract simulation. +The framework features an [`ethers-rs`](https://github.com/gakonst/ethers-rs) middleware built on top of [revm](https://github.com/bluealloy/revm) which allows the end user to interact with a sandboxed `revm` instance as if it were an Ethereum node. +This provides a familiar interface for interacting with the Ethereum Virtual Machine (EVM), but with unrivaled speed. +Furthermore, Arbiter provides containment and management for simulations. For a running list of vulnerabilities found with Arbiter, please see the [Vulnerability Corpus](./documentation/src/contributing/vulnerability_corpus.md). + +## Overview +The Arbiter workspace has three crates: +- `arbiter`: The binary crate that exposes a command line interface for initializing simulations via a templated repository and generating contract bindings needed for the simulation. +- `arbiter-core`: The lib crate that contains the core logic for the Arbiter framework including the `RevmMiddleware` discussed before, the `Environment` which envelopes simulations, and the `Manager` who controls a collection of environments. +- `arbiter-derive`: The lib crate that contains custom derive macros for more succinct simulation building. + +The purpose of Arbiter is to provide a toolset to construct arbitrary agents (defined in Rust, by smart contracts, or even other foreign function interfaces) and have these agents interact with an Ethereum-like environment of your design. +All contract bytecode is run directly using a blazing-fast EVM instance `revm` (which is used in live RPC nodes such as [`reth`](https://github.com/paradigmxyz/reth)) so that your contracts are tested in the exact same type of environment that they are deployed in. + +## Motivation + +Smart contract engineers need to test their contracts against a wide array of potentially adversarial environments and contract parameters. +The static stateless testing of contracts can only take you so far. +To truly test the security of a contract, you need to test it against a wide array of dynamic environments that encompass the externalities of Ethereum mainnet. +We wanted to do just that with Arbiter. + +Both smart contract and financial engineers come together in Decentralized Finance (DeFi) to build and deploy a wide array of complex decentralized applications as well as financial strategies respectively. +For the latter, a financial engineer may want to test their strategies against thousands of market conditions, contract settings, shocks, and autonomous or random or even AI agents all while making sure their strategy isn't vulnerable to bytecode-level exploits. + +To configure such a rich simulation environment on a test or local network is also possible with Arbiter by a change in choice of middleware. +The most efficient choice for getting robust, yet quick, simulations would bypass any networking and use a low level language's implementation of the EVM. +Furthermore, we can gain control over the EVM worldstate by working directly on `revm`. +We would like the user to have a choice in how they want to simulate their contracts and Arbiter provides that choice. + +### Sim Driven Development and Strategization + +Test driven development is a popular engineering practice to write tests first, which fail, and implement logic to get the test to eventually pass. +With simulation driven development, it's possible to build "tests" that can only pass if the *incentives* actually work. For example, a sim driven test might be `is_loan_liquidated`, and a simulation must be made for a liquidator agent to do the liquidation. +This approach significantly improves the testing of economic systems and other mechanism designs, which is important in the world of networks that are mostly incentive driven. + +The same goes with developing strategies that one would like to deploy on a live Ethereum network. +One can use Arbiter to simulate their strategy with an intended goal and see if it actually works. +This is especially important in the world of DeFi where strategies are often a mix of on and offchain and are susceptible to exploits. + +## Installation + +To install Arbiter, you will need to have Rust installed on your machine. +You can install Rust by following the instructions [here](https://www.rust-lang.org/tools/install). +Once you have Rust installed, you can install Arbiter by running the following commands: + +```bash +cargo install arbiter +``` +This will install the Arbiter binary on your machine. You can then run `arbiter --help` to see that Arbiter was installed properly as well as see the help menu. + +## Command Line Interface + +The Arbiter binary provides a CLI for creating new project much like [Foundry](https://github.com/foundry-rs/foundry), which Arbiter aims to work alongside with. +It also gives you the abilities to fork a state of an EVM network and store it to disk so that you can use this fork in a simulation. + +### Initialization +To create a new project, you should have Foundry installed. +You can find the installation [here](https://getfoundry.sh/). +To create a new Arbiter project, you can run: + +```bash +arbiter init your-project-name +cd your-project-name +``` + +This initializes a new Arbiter project with a template. You can generate the bindings again by running: + +```bash +arbiter bind +``` + +The template is executable at this point and you can run it by running: +```bash +cargo run +``` + +**Optional Arguments** + +You can run `arbiter init --no-git` to remove the `.git` directory from the template upon initialization. + + +### Bindings + +You can load or write your own smart contracts in the `arbiter-bindings/contracts/` directory and begin writing your own simulations. +Arbiter treats Rust smart-contract bindings as first-class citizens. The contract bindings are generated via Foundry's `forge` command. +`arbiter bind` wraps `forge` with some convenience features that will generate all your bindings to src/bindings as a rust module. +[Foundry](https://github.com/foundry-rs/foundry) power-users are welcome to use `forge` directly. + + +### Forking + +To fork a state of an EVM network, you must first create a fork config file. +An example is provided in the `example_fork` directory. +Essentially, you provide your storage location for the data, the network you want the block number you want, and metadata about the contracts you want to fork. + +```bash +arbiter fork +``` + +This will create a fork of the network you specified in the config file and store it in the location you specified. +It can then be loaded into an `arbiter-core` `Environment` by using the `Fork::from_disk()` method. + +Forking is done this way to make sure that all emulation done does not require a constant connection to an RPC-endpoint. + +**Optional Arguments** +You can run `arbiter fork --overwrite` to overwrite the fork if it already exists. + + +### Optional Arguments + +You can run `arbiter init --no-git` to remove the `.git` directory from the template upon initialization. + + +## Documentation + +To see the documentation for the Arbiter crates, please visit the following: +- [`arbiter`](https://docs.rs/crate/arbiter/) +- [`arbiter-bindings`](https://docs.rs/crate/arbiter-bindings/) +- [`arbiter-core`](https://docs.rs/arbiter-core/) +- [`arbiter-derive`](https://docs.rs/arbiter-derive/) + +You will also find each of these on crates.io. + +## Benchmarks + +In `arbiter-core`, we have a a small benchmarking suite that compares the `RevmMiddleware` implementation over the `Environment` to the [Anvil](https://github.com/foundry-rs/foundry/tree/master/crates/anvil) local testnet chain implementation. +The biggest reasons why we chose to build Arbiter was to gain more control over the EVM environment and to have a more robust simulation framework, but we also wanted to gain in speed which is why we chose to build our own interface over `revm` as opposed to using Anvil (which does use `revm` under the hood). +For the following, Anvil was set to mine blocks for each transaction as opposed to setting an enforced block time and the `Environment` was set with a block rate of 10.0 (this was chosen somewhat arbitrarily as we will add in more block control in the future). +Preliminary benchmarks of the `RevmMiddleware` interface over `revm` against Anvil are given in the following table. + +to run the benchmarking code yourself, you can run: +```bash +cargo bench --package arbiter-core +``` + +bench from 10/24/23 arbiter-core v0.6.3 +| Operation | RevmMiddleware | Anvil | Relative Difference | +|-----------------|-----------------|--------------|---------------------| +| Deploy | 238.975µs | 7712.436µs | ~32.2729x | +| Lookup | 565.617µs | 17880.124µs | ~31.6117x | +| Stateless Call | 1402.524µs | 10397.55µs | ~7.413456x | +| Stateful Call | 2043.88µs | 154553.225µs | ~75.61756x | + + +bench from 06/??/23ish arbiter-core v0.4.?? +| Operation | RevmMiddleware | Anvil | Relative Difference | +|-----------------|-----------------|--------------|---------------------| +| Deploy | 241.819µs | 8.215446ms | ~33.97x | +| Lookup | 480.319µs | 13.052063ms | ~27.17x | +| Stateless Call | 4.03235ms | 10.238771ms | ~2.53x | +| Stateful Call | 843.296µs | 153.102478ms | ~181.55x | + +The above can be described by: +- Deploy: Deploying a contract to the EVM. +We deployed both `ArbiterToken` and `ArbiterMath` in this method, so you can divide the time by two to get an estimate for the time it takes to deploy a single contract. + +- Lookup: Looking up a the `balanceOf` for a client's address for `ArbiterToken`. +We called `ArbiterToken`'s `balanceOf` function 100 times in this method. +Divide by 100 to get the time it takes to lookup a single balance. + +- Stateless Call: Calling a contract that does not mutate state. +We called `ArbiterMath`'s `cdf` function 100 times in this method. +Divide by 100 to get the time it takes to call a single stateless function. + +- Stateful Call: Calling a contract that mutates state. +We called `ArbiterToken`'s `mint` function 100 times in this call. +Divide by 100 to get the time it takes to call a single stateful function. + +The benchmarking code can be found in the `arbiter-core/benches/` directory and these specific times were achieved over a 1000 run average. +The above was achieved running `cargo bench --package arbiter-core` which will automatically run with the release profile. +Times were achieved on an Apple Macbook Pro M1 Max with 8 performance and 2 efficiency cores, and with 32GB of RAM. + +Of course, the use cases of Anvil and the `RevmMiddleware` can be different. +Anvil represents a more realistic environment with networking and mining, while the `RevmMiddleware` is simpler environment with the bare essentials to running stateful simulations. +Anvil also mines blocks for each transaction, while the `RevmMiddleware` does not. +We hope to improve our API to allow the end user to be able to interface with their own choice of EVM environment to suit what ever their needs may be! + +Please let us know if you find any issues with these benchmarks or if you have any suggestions on how to improve them! + +## Testing + +If you contribute please write tests for any new code you write, To run the tests, you can run: + +```bash +cargo test --all --all-features +``` + +## Contributing + +See our [Contributing Guidelines](https://github.com/primitivefinance/arbiter/blob/main/.github/CONTRIBUTING.md) From b9d56be55b8ccc4e44b0ca62892da06d85228769 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Mon, 22 Jan 2024 18:02:03 -0700 Subject: [PATCH 02/17] restructure --- documentation/src/SUMMARY.md | 9 ++ .../src/getting_started/getting_started.md | 32 +++- documentation/src/index.md | 145 +----------------- documentation/src/usage/arbiter_cli.md | 1 + documentation/src/usage/arbiter_core.md | 1 + documentation/src/usage/arbiter_engine.md | 1 + documentation/src/usage/index.md | 1 + 7 files changed, 45 insertions(+), 145 deletions(-) create mode 100644 documentation/src/usage/arbiter_cli.md create mode 100644 documentation/src/usage/arbiter_core.md create mode 100644 documentation/src/usage/arbiter_engine.md create mode 100644 documentation/src/usage/index.md diff --git a/documentation/src/SUMMARY.md b/documentation/src/SUMMARY.md index 204da7e5..5dcf5d82 100644 --- a/documentation/src/SUMMARY.md +++ b/documentation/src/SUMMARY.md @@ -3,11 +3,20 @@ - [Introduction](./introduction/introduction.md) - [Getting Started / Installation](./getting_started/getting_started.md) - [Setting up Simulations](./getting_started/setting_up_simulations.md) + +# Usage +- [Overview](./usage/index.md) + - [Arbiter CLI](./usage/arbiter_cli.md) + - [Arbiter Core](./usage/arbiter_core.md) + - [Arbiter Engine](./usage/arbiter_engine.md) + +# Methodology - [Anomaly Detection](./introduction/anomaly_detection.md) - [Auditing](./auditing/auditing.md) - [Risk](./risk/risk_metrics.md) - [Metrics](./risk/metrics.md) +# Engagement - [Contributing](./contributing/contributing.md) - [Project Architecture](./contributing/architecture.md) - [Vulnerability Corpus](./contributing/vulnerability_corpus.md) diff --git a/documentation/src/getting_started/getting_started.md b/documentation/src/getting_started/getting_started.md index 15dfcb37..afef0268 100644 --- a/documentation/src/getting_started/getting_started.md +++ b/documentation/src/getting_started/getting_started.md @@ -37,8 +37,17 @@ To create a new Arbiter project: arbiter init your-new-project cd your-new-project ``` +This initializes a new Arbiter project with a template. +You can run `arbiter init --no-git` to remove the `.git` directory from the template upon initialization. -This initializes a new Arbiter project with a template. You can generate the bindings again by running: +### Bindings + +You can load or write your own smart contracts in the `arbiter-bindings/contracts/` directory and begin writing your own simulations. +Arbiter treats Rust smart-contract bindings as first-class citizens. +The contract bindings are generated via Foundry's `forge` command. +`arbiter bind` wraps `forge` with some convenience features that will generate all your bindings to src/bindings as a rust module. +[Foundry](https://github.com/foundry-rs/foundry) power-users are welcome to use `forge` directly. +You can generate the bindings again by running: ```bash arbiter bind @@ -57,4 +66,23 @@ The template is executable at this point and you can run it by running: cargo run ``` -You can load or write your own smart contracts in the templates `contracts/` directory and begin writing your own simulations. Arbiter treats Rust smart-contract bindings as first-class citizens. The contract bindings are generated via Foundry's forge command. arbiter bind wraps forge with some convenience features that will generate all your bindings to `src/bindings` as a rust module. Foundry power-users are welcome to use forge directly. You can also manage project dependencies using git submodules via `forge install`. The [Foundry book](https://book.getfoundry.sh/reference/forge/forge-install) provides further details on managing project dependencies and other features. \ No newline at end of file +You can load or write your own smart contracts in the templates `contracts/` directory and begin writing your own simulations. Arbiter treats Rust smart-contract bindings as first-class citizens. The contract bindings are generated via Foundry's forge command. arbiter bind wraps forge with some convenience features that will generate all your bindings to `src/bindings` as a rust module. Foundry power-users are welcome to use forge directly. You can also manage project dependencies using git submodules via `forge install`. The [Foundry book](https://book.getfoundry.sh/reference/forge/forge-install) provides further details on managing project dependencies and other features. + + +### Forking + +To fork a state of an EVM network, you must first create a fork config file. +An example is provided in the `example_fork` directory. +Essentially, you provide your storage location for the data, the network you want the block number you want, and metadata about the contracts you want to fork. + +```bash +arbiter fork +``` + +This will create a fork of the network you specified in the config file and store it in the location you specified. +It can then be loaded into an `arbiter-core` `Environment` by using the `Fork::from_disk()` method. + +Forking is done this way to make sure that all emulation done does not require a constant connection to an RPC-endpoint. + +**Optional Arguments** +You can run `arbiter fork --overwrite` to overwrite the fork if it already exists. \ No newline at end of file diff --git a/documentation/src/index.md b/documentation/src/index.md index d65fada7..6569f64c 100644 --- a/documentation/src/index.md +++ b/documentation/src/index.md @@ -8,13 +8,12 @@ Furthermore, Arbiter provides containment and management for simulations. For a The Arbiter workspace has three crates: - `arbiter`: The binary crate that exposes a command line interface for initializing simulations via a templated repository and generating contract bindings needed for the simulation. - `arbiter-core`: The lib crate that contains the core logic for the Arbiter framework including the `RevmMiddleware` discussed before, the `Environment` which envelopes simulations, and the `Manager` who controls a collection of environments. -- `arbiter-derive`: The lib crate that contains custom derive macros for more succinct simulation building. +- `arbiter-engine`: The lib crate that provides abstractions for building simulations and more. The purpose of Arbiter is to provide a toolset to construct arbitrary agents (defined in Rust, by smart contracts, or even other foreign function interfaces) and have these agents interact with an Ethereum-like environment of your design. All contract bytecode is run directly using a blazing-fast EVM instance `revm` (which is used in live RPC nodes such as [`reth`](https://github.com/paradigmxyz/reth)) so that your contracts are tested in the exact same type of environment that they are deployed in. ## Motivation - Smart contract engineers need to test their contracts against a wide array of potentially adversarial environments and contract parameters. The static stateless testing of contracts can only take you so far. To truly test the security of a contract, you need to test it against a wide array of dynamic environments that encompass the externalities of Ethereum mainnet. @@ -38,154 +37,14 @@ The same goes with developing strategies that one would like to deploy on a live One can use Arbiter to simulate their strategy with an intended goal and see if it actually works. This is especially important in the world of DeFi where strategies are often a mix of on and offchain and are susceptible to exploits. -## Installation - -To install Arbiter, you will need to have Rust installed on your machine. -You can install Rust by following the instructions [here](https://www.rust-lang.org/tools/install). -Once you have Rust installed, you can install Arbiter by running the following commands: - -```bash -cargo install arbiter -``` -This will install the Arbiter binary on your machine. You can then run `arbiter --help` to see that Arbiter was installed properly as well as see the help menu. - -## Command Line Interface - -The Arbiter binary provides a CLI for creating new project much like [Foundry](https://github.com/foundry-rs/foundry), which Arbiter aims to work alongside with. -It also gives you the abilities to fork a state of an EVM network and store it to disk so that you can use this fork in a simulation. - -### Initialization -To create a new project, you should have Foundry installed. -You can find the installation [here](https://getfoundry.sh/). -To create a new Arbiter project, you can run: - -```bash -arbiter init your-project-name -cd your-project-name -``` - -This initializes a new Arbiter project with a template. You can generate the bindings again by running: - -```bash -arbiter bind -``` - -The template is executable at this point and you can run it by running: -```bash -cargo run -``` - -**Optional Arguments** - -You can run `arbiter init --no-git` to remove the `.git` directory from the template upon initialization. - - -### Bindings - -You can load or write your own smart contracts in the `arbiter-bindings/contracts/` directory and begin writing your own simulations. -Arbiter treats Rust smart-contract bindings as first-class citizens. The contract bindings are generated via Foundry's `forge` command. -`arbiter bind` wraps `forge` with some convenience features that will generate all your bindings to src/bindings as a rust module. -[Foundry](https://github.com/foundry-rs/foundry) power-users are welcome to use `forge` directly. - - -### Forking - -To fork a state of an EVM network, you must first create a fork config file. -An example is provided in the `example_fork` directory. -Essentially, you provide your storage location for the data, the network you want the block number you want, and metadata about the contracts you want to fork. - -```bash -arbiter fork -``` - -This will create a fork of the network you specified in the config file and store it in the location you specified. -It can then be loaded into an `arbiter-core` `Environment` by using the `Fork::from_disk()` method. - -Forking is done this way to make sure that all emulation done does not require a constant connection to an RPC-endpoint. - -**Optional Arguments** -You can run `arbiter fork --overwrite` to overwrite the fork if it already exists. - - -### Optional Arguments - -You can run `arbiter init --no-git` to remove the `.git` directory from the template upon initialization. - - -## Documentation - +## Developer Documentation To see the documentation for the Arbiter crates, please visit the following: - [`arbiter`](https://docs.rs/crate/arbiter/) - [`arbiter-bindings`](https://docs.rs/crate/arbiter-bindings/) - [`arbiter-core`](https://docs.rs/arbiter-core/) -- [`arbiter-derive`](https://docs.rs/arbiter-derive/) You will also find each of these on crates.io. -## Benchmarks - -In `arbiter-core`, we have a a small benchmarking suite that compares the `RevmMiddleware` implementation over the `Environment` to the [Anvil](https://github.com/foundry-rs/foundry/tree/master/crates/anvil) local testnet chain implementation. -The biggest reasons why we chose to build Arbiter was to gain more control over the EVM environment and to have a more robust simulation framework, but we also wanted to gain in speed which is why we chose to build our own interface over `revm` as opposed to using Anvil (which does use `revm` under the hood). -For the following, Anvil was set to mine blocks for each transaction as opposed to setting an enforced block time and the `Environment` was set with a block rate of 10.0 (this was chosen somewhat arbitrarily as we will add in more block control in the future). -Preliminary benchmarks of the `RevmMiddleware` interface over `revm` against Anvil are given in the following table. - -to run the benchmarking code yourself, you can run: -```bash -cargo bench --package arbiter-core -``` - -bench from 10/24/23 arbiter-core v0.6.3 -| Operation | RevmMiddleware | Anvil | Relative Difference | -|-----------------|-----------------|--------------|---------------------| -| Deploy | 238.975µs | 7712.436µs | ~32.2729x | -| Lookup | 565.617µs | 17880.124µs | ~31.6117x | -| Stateless Call | 1402.524µs | 10397.55µs | ~7.413456x | -| Stateful Call | 2043.88µs | 154553.225µs | ~75.61756x | - - -bench from 06/??/23ish arbiter-core v0.4.?? -| Operation | RevmMiddleware | Anvil | Relative Difference | -|-----------------|-----------------|--------------|---------------------| -| Deploy | 241.819µs | 8.215446ms | ~33.97x | -| Lookup | 480.319µs | 13.052063ms | ~27.17x | -| Stateless Call | 4.03235ms | 10.238771ms | ~2.53x | -| Stateful Call | 843.296µs | 153.102478ms | ~181.55x | - -The above can be described by: -- Deploy: Deploying a contract to the EVM. -We deployed both `ArbiterToken` and `ArbiterMath` in this method, so you can divide the time by two to get an estimate for the time it takes to deploy a single contract. - -- Lookup: Looking up a the `balanceOf` for a client's address for `ArbiterToken`. -We called `ArbiterToken`'s `balanceOf` function 100 times in this method. -Divide by 100 to get the time it takes to lookup a single balance. - -- Stateless Call: Calling a contract that does not mutate state. -We called `ArbiterMath`'s `cdf` function 100 times in this method. -Divide by 100 to get the time it takes to call a single stateless function. - -- Stateful Call: Calling a contract that mutates state. -We called `ArbiterToken`'s `mint` function 100 times in this call. -Divide by 100 to get the time it takes to call a single stateful function. - -The benchmarking code can be found in the `arbiter-core/benches/` directory and these specific times were achieved over a 1000 run average. -The above was achieved running `cargo bench --package arbiter-core` which will automatically run with the release profile. -Times were achieved on an Apple Macbook Pro M1 Max with 8 performance and 2 efficiency cores, and with 32GB of RAM. - -Of course, the use cases of Anvil and the `RevmMiddleware` can be different. -Anvil represents a more realistic environment with networking and mining, while the `RevmMiddleware` is simpler environment with the bare essentials to running stateful simulations. -Anvil also mines blocks for each transaction, while the `RevmMiddleware` does not. -We hope to improve our API to allow the end user to be able to interface with their own choice of EVM environment to suit what ever their needs may be! - -Please let us know if you find any issues with these benchmarks or if you have any suggestions on how to improve them! - -## Testing - -If you contribute please write tests for any new code you write, To run the tests, you can run: - -```bash -cargo test --all --all-features -``` - ## Contributing See our [Contributing Guidelines](https://github.com/primitivefinance/arbiter/blob/main/.github/CONTRIBUTING.md) diff --git a/documentation/src/usage/arbiter_cli.md b/documentation/src/usage/arbiter_cli.md new file mode 100644 index 00000000..42284478 --- /dev/null +++ b/documentation/src/usage/arbiter_cli.md @@ -0,0 +1 @@ +# Arbiter CLI diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md new file mode 100644 index 00000000..4103a82d --- /dev/null +++ b/documentation/src/usage/arbiter_core.md @@ -0,0 +1 @@ +# Arbiter Core diff --git a/documentation/src/usage/arbiter_engine.md b/documentation/src/usage/arbiter_engine.md new file mode 100644 index 00000000..09db3bba --- /dev/null +++ b/documentation/src/usage/arbiter_engine.md @@ -0,0 +1 @@ +# Arbiter Engine diff --git a/documentation/src/usage/index.md b/documentation/src/usage/index.md new file mode 100644 index 00000000..8f04b05a --- /dev/null +++ b/documentation/src/usage/index.md @@ -0,0 +1 @@ +# Usage From 768c21e5eac926738a76665a98c75a0328b64f76 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Mon, 22 Jan 2024 18:25:03 -0700 Subject: [PATCH 03/17] add: `Environment` docs --- arbiter-core/src/environment/instruction.rs | 1 + documentation/src/usage/arbiter_core.md | 37 +++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/arbiter-core/src/environment/instruction.rs b/arbiter-core/src/environment/instruction.rs index 0adab195..ed268ce2 100644 --- a/arbiter-core/src/environment/instruction.rs +++ b/arbiter-core/src/environment/instruction.rs @@ -154,6 +154,7 @@ pub(crate) enum EnvironmentData { /// The query is for the balance of an account given by the inner `Address`. Balance(ethers::types::Address), + // TODO: Rename this to `Nonce`? /// The query is for the nonce of an account given by the inner `Address`. TransactionCount(ethers::types::Address), } diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index 4103a82d..47109079 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -1 +1,38 @@ # Arbiter Core +The `arbiter-core` crate is the core of the Arbiter framework. +It contains the `Environment` struct which acts as an EVM sandbox and the `RevmMiddleware` which gives a convenient interface for interacting with contracts deployed into the `Environment`. +The API provided by `RevmMiddleware` is that of the `Middleware` trait in the `ethers-rs` crate, therefore it looks and feels just like you're interacting with a live network when you work with an Arbiter `Environment`. +The only notable differences are in the control you have over this `Environment` compared to something like Anvil, a testnet, or a live network. + +## Environment +The `Environment` owns a `revm` instance for processing EVM bytecode. +To make the `Environment` performent and flexible, it runs on its own system thread and receives all communication via `Instruction`s sent to it via a `Sender`. + +### Instructions +`Instruction`s have been added to over time, but at the moment we allow for the following: +- `Instruction::AddAccount`: Add an account to the `Environment`'s world state. This is usually called by the `RevmMiddleware` when a new client is created. +- `Instruction::BlockUpdate`: Update the `Environment`'s block number and block timestamp. This can be handled by an external agent in a simulation, if desired. +- `Instruction::Cheatcode`: Execute one of the `Cheatcodes` on the `Environment`'s world state. +The `Cheatcodes` include: + - `Cheatcodes::Deal`: Used to set the raw ETH balance of a user. Useful when you need to pay gas fees in a transaction. + - `Cheatcodes::Load`: Gets the value of a storage slot of an account. + - `Cheatcodes::Store`: Sets the value of a storage slot of an account. + - `Cheatcodes::Access`: Gets the account at an address. +- `Instruction::Query`: Allows for querying the `Environment`'s world state and current configuration. Anything in the `EnvironmentData` enum is accessible via this instruction. + - `EnvironmentData::BlockNumber`: Gets the current block number of the `Environment`. + - `EnvironmentData::BlockTimestamp`: Gets the current block timestamp of the `Environment`. + - `EnvironmentData::GasPrice`: Gets the current gas price of the `Environment`. + - `EnvironmentData::Balance`: Gets the current ETH balance of an account. + - `EnvironmentData::TransactionCount`: Gets the current nonce of an account. +- `Instruction::Stop`: Stops the `Environment`'s thread and echos out to any listeners to shut down their event streams. This can be used when handling errors or reverts, or just when you're done with the `Environment`. +- `Instruction::Transaction`: Executes a transaction on the `Environment`'s world state. This is usually called by the `RevmMiddleware` when a client sends a ETH-call or state-changing transaction. + +The `RevmMiddleware` provides methods for sending the above instructions to an associated `Environment` so that you do not have to interact with the `Environment` directly! + +### Events +The `Environment` also emits Ethereum events and errors/reverts to clients who are set to listen to them. +To do so, we use a `tokio::sync::broadcast` channel and the `RevmMiddleware` manages subscriptions to these events. +As for errors or reverts, we are working on making the flow of handling these more graceful so that your own program or agents can decide how to handle them. + +## RevmMiddleware +The `RevmMiddleware` is the main interface for interacting with an `Environment`. \ No newline at end of file From 3a214410ee0b08b61c49aa9d1a4bddeda82d6baf Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Tue, 23 Jan 2024 15:27:01 -0700 Subject: [PATCH 04/17] Update arbiter_core.md --- documentation/src/usage/arbiter_core.md | 38 ++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index 47109079..c0629676 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -7,6 +7,28 @@ The only notable differences are in the control you have over this `Environment` ## Environment The `Environment` owns a `revm` instance for processing EVM bytecode. To make the `Environment` performent and flexible, it runs on its own system thread and receives all communication via `Instruction`s sent to it via a `Sender`. +The `Socket` is a struct owned by the `Environment` that manages all inward and outward communication with the `Environment`'s clients, such as the `Instruction` channel. + +### Usage +To create an `Environment`, we use a builder pattern that allows you to pre-load an `Environment` with your own database. +We can do the following to create a default `Environment`: +```rust +use arbiter_core::environment::builder::EnvironmentBuilder; + +let env = EnvironmentBuilder::new().build(); +``` +Note that the call to `.build()` will start the `Environment`'s thread and begin processing `Instruction`s. + +If you have a database that has been forked from a live network, it has likely been serialized to disk. +In which case, you can do something like this: +```rust +use arbiter_core::environment::builder::EnvironmentBuilder; +use arbiter_core::environment::fork::Fork; + +let fork = Fork::from_disk("path/to/forked/database").unwrap(); +let env = EnvironmentBuilder::new().db(fork).build(); +``` +This will create an `Environment` that has been forked from the database at the given path and is ready to receive `Instruction`s. ### Instructions `Instruction`s have been added to over time, but at the moment we allow for the following: @@ -35,4 +57,18 @@ To do so, we use a `tokio::sync::broadcast` channel and the `RevmMiddleware` man As for errors or reverts, we are working on making the flow of handling these more graceful so that your own program or agents can decide how to handle them. ## RevmMiddleware -The `RevmMiddleware` is the main interface for interacting with an `Environment`. \ No newline at end of file +The `RevmMiddleware` is the main interface for interacting with an `Environment`. +We implement the `ethers-rs` `Middleware` trait so that you may work with contract bindings generated by `forge` or `arbiter bind` as if you were interacting with a live network. +Not all methods are implemented, but the relevant ones are. + +`RevmMiddleware` owns a `Connection` which is the client's interface to the `Environment`'s `Socket`. +This `Connection` acts much like a WebSocket connection and is used to send `Instruction`s and receive their outcome from the `Environment` as well as subscribe to events. +To make this `Connection` and `RevmMiddleware` flexible, we also implement (for both) the `JsonRpcClient` and `PubSubClient` traits. + +We also provide `RevmMiddleware` a wallet so that it can be associated to an account in the `Environment`'s world state. +The `wallet: EOA` field of `RevmMiddleware` is decided upon creation of the `RevmMiddleware` and, if the wallet is generated from calling `RevmMiddleware::new()`, wallet will be of `EOA::Wallet(Wallet)` which allows for `RevmMiddleware` to sign transactions if need be. +It is possible to create accounts from a forked database, in which case you would call `RevmMiddleware::new_from_forked_eoa()` and the wallet would be of `EOA::Forked(Address)`. +This type is unable to sign as it is effectively impossible to recover the signing key from an address. +Fortunately, for almost every usecase of `RevmMiddleware`, you will not need to sign transactions, so this distinction does not matter. + +### Usage From 18e40c25aba071a782685cf69d7b141ba4e8d69d Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 11:21:56 -0700 Subject: [PATCH 05/17] improving mdbook testing --- .github/workflows/book.yaml | 9 ++++++ .gitignore | 4 ++- arbiter-core/src/environment/fork.rs | 2 +- book.toml | 5 +++ documentation/src/usage/arbiter_core.md | 42 +++++++++++++++++++++++-- 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index d0e54a82..f378fa35 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -24,6 +24,15 @@ jobs: mkdir mdbook curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo `pwd`/mdbook >> $GITHUB_PATH + + - name: Install Rust (mdbook-keeper requires Rust) + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Install mdbook-keeper + run: cargo install mdbook-keeper - name: Install mdbook-template run: | diff --git a/.gitignore b/.gitignore index e5d62e4a..7baa747c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,6 @@ arbiter/ book arbiter-core/data -example_fork/test.json \ No newline at end of file +example_fork/test.json + +doctest_cache/ \ No newline at end of file diff --git a/arbiter-core/src/environment/fork.rs b/arbiter-core/src/environment/fork.rs index cdcbc221..f4aa360e 100644 --- a/arbiter-core/src/environment/fork.rs +++ b/arbiter-core/src/environment/fork.rs @@ -47,7 +47,7 @@ impl Fork { // Read the file let mut cwd = env::current_dir().unwrap(); cwd.push(path); - info!("Reading db from: {:?}", cwd); + print!("Reading db from: {:?}", cwd); let data = fs::read_to_string(cwd).unwrap(); // Deserialize the JSON data to your OutputData type diff --git a/book.toml b/book.toml index ed0a550b..54d89269 100644 --- a/book.toml +++ b/book.toml @@ -27,6 +27,11 @@ include-src = false block-delimiter = { left = "$$", right = "$$" } inline-delimiter = { left = "$", right = "$" } +[preprocessor.keeper] +command = "mdbook-keeper" +manifest_dir = "." +externs = ["arbiter_core", "arbiter_bindings", "tokio"] + [output.linkcheck] optional = true follow-web-links = true \ No newline at end of file diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index c0629676..947e471c 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -15,7 +15,9 @@ We can do the following to create a default `Environment`: ```rust use arbiter_core::environment::builder::EnvironmentBuilder; -let env = EnvironmentBuilder::new().build(); +fn main() { + let env = EnvironmentBuilder::new().build(); +} ``` Note that the call to `.build()` will start the `Environment`'s thread and begin processing `Instruction`s. @@ -25,8 +27,11 @@ In which case, you can do something like this: use arbiter_core::environment::builder::EnvironmentBuilder; use arbiter_core::environment::fork::Fork; -let fork = Fork::from_disk("path/to/forked/database").unwrap(); -let env = EnvironmentBuilder::new().db(fork).build(); +fn main() { + let path_to_fork = "../example_fork/fork_into_test.json"; + let fork = Fork::from_disk(path_to_fork).unwrap(); + let env = EnvironmentBuilder::new().db(fork).build(); +} ``` This will create an `Environment` that has been forked from the database at the given path and is ready to receive `Instruction`s. @@ -72,3 +77,34 @@ This type is unable to sign as it is effectively impossible to recover the signi Fortunately, for almost every usecase of `RevmMiddleware`, you will not need to sign transactions, so this distinction does not matter. ### Usage + +To create a `RevmMiddleware` that is associated with an account in the `Environment`'s world state, we can do the following: +```rust +use arbiter_core::middleware::RevmMiddleware; +use arbiter_core::environment::builder::EnvironmentBuilder; + +fn main() { + let env = EnvironmentBuilder::new().build(); + + // Create a client for the above `Environment` with an ID + let id = "alice"; + let alice = RevmMiddleware::new(&env, Some(id)); + + // Create a client without an ID + let client = RevmMiddleware::new(&env, None); +} +``` +These created clients can then get access to making calls and transactions to contracts deployed into the `Environment`'s world state. We can do the following: +```rust +use arbiter_core::middleware::RevmMiddleware; +use arbiter_core::environment::builder::EnvironmentBuilder; +use arbiter_bindings::bindings::arbiter_token::ArbiterToken; + +#[tokio::main] +fn main() { + let env = EnvironmentBuilder::new().build(); + let client = RevmMiddleware::new(&env, None); + + // Deploy a contract + let contract = ArbiterToken::deploy(&client, ("ARB", "Arbiter Token", 18)).send().await.unwrap().await.unwrap(); +} \ No newline at end of file From 179c87023a0cd3b5bcbee9add5a141f2c0e18707 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 11:23:58 -0700 Subject: [PATCH 06/17] save --- book.toml | 2 +- documentation/Cargo.toml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 documentation/Cargo.toml diff --git a/book.toml b/book.toml index 54d89269..c165d4b1 100644 --- a/book.toml +++ b/book.toml @@ -29,7 +29,7 @@ inline-delimiter = { left = "$", right = "$" } [preprocessor.keeper] command = "mdbook-keeper" -manifest_dir = "." +manifest_dir = "./documentation/" externs = ["arbiter_core", "arbiter_bindings", "tokio"] [output.linkcheck] diff --git a/documentation/Cargo.toml b/documentation/Cargo.toml new file mode 100644 index 00000000..91b00394 --- /dev/null +++ b/documentation/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "arbiter-documentation" +version = "0.0.0" +edition = "2021" + +[dependencies] +arbiter-core = { path = "../arbiter-core" } \ No newline at end of file From a20091802495b0c7af4fe1b653c4a04ccb78fba8 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 11:32:18 -0700 Subject: [PATCH 07/17] improvement --- Cargo.lock | 9 +++++++++ Cargo.toml | 2 +- documentation/Cargo.toml | 4 +++- documentation/src/lib.rs | 0 documentation/src/usage/arbiter_core.md | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 documentation/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 8f1f1783..d55533f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -299,6 +299,15 @@ dependencies = [ "tracing-test", ] +[[package]] +name = "arbiter-documentation" +version = "0.0.0" +dependencies = [ + "arbiter-bindings", + "arbiter-core", + "tokio", +] + [[package]] name = "arbiter-engine" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index e5283640..ec37abee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] # List of crates included in this workspace -members = [ "arbiter-bindings", "arbiter-core", "arbiter-engine"] +members = [ "arbiter-bindings", "arbiter-core", "arbiter-engine", "documentation"] # List of crates excluded from this workspace exclude = ["benches"] diff --git a/documentation/Cargo.toml b/documentation/Cargo.toml index 91b00394..296ddafe 100644 --- a/documentation/Cargo.toml +++ b/documentation/Cargo.toml @@ -4,4 +4,6 @@ version = "0.0.0" edition = "2021" [dependencies] -arbiter-core = { path = "../arbiter-core" } \ No newline at end of file +arbiter-core = { path = "../arbiter-core" } +arbiter-bindings = { path = "../arbiter-bindings" } +tokio.workspace = true \ No newline at end of file diff --git a/documentation/src/lib.rs b/documentation/src/lib.rs new file mode 100644 index 00000000..e69de29b diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index 947e471c..b12624a2 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -101,7 +101,7 @@ use arbiter_core::environment::builder::EnvironmentBuilder; use arbiter_bindings::bindings::arbiter_token::ArbiterToken; #[tokio::main] -fn main() { +async fn main() { let env = EnvironmentBuilder::new().build(); let client = RevmMiddleware::new(&env, None); From 24c82726234fc59487da1d30fda733ab57cb9cd2 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 11:46:15 -0700 Subject: [PATCH 08/17] rework workflow --- .github/workflows/book.yaml | 76 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index f378fa35..9d415082 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -12,57 +12,70 @@ on: merge_group: jobs: - test: + setup: runs-on: ubuntu-latest - name: test + outputs: + mdbook-path: ${{ steps.mdbook-path.outputs.path }} + mdbook-template-path: ${{ steps.mdbook-template-path.outputs.path }} + mdbook-linkcheck-path: ${{ steps.mdbook-linkcheck-path.outputs.path }} steps: - uses: actions/checkout@v3 - - name: Install mdbook - run: | - mkdir mdbook - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook - echo `pwd`/mdbook >> $GITHUB_PATH - - - name: Install Rust (mdbook-keeper requires Rust) + # Install Rust + - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: stable override: true + components: rustfmt, clippy - - name: Install mdbook-keeper - run: cargo install mdbook-keeper + # Install mdbook + - name: Install mdbook + run: | + mkdir mdbook + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + id: mdbook-path + working-directory: ${{ github.workspace }} + continue-on-error: false + # Install mdbook-template - name: Install mdbook-template run: | mkdir mdbook-template curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template - echo `pwd`/mdbook-template >> $GITHUB_PATH + id: mdbook-template-path + working-directory: ${{ github.workspace }} + continue-on-error: false - - name: Run tests - run: mdbook test + # Install mdbook-linkcheck + - name: Install mdbook-linkcheck + run: | + mkdir mdbook-linkcheck + curl -sSL -o mdbook-linkcheck.zip https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip + unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck + chmod +x mdbook-linkcheck/mdbook-linkcheck + id: mdbook-linkcheck-path + working-directory: ${{ github.workspace }} + continue-on-error: false lint: + needs: setup runs-on: ubuntu-latest name: lint steps: - uses: actions/checkout@v3 - - name: Install mdbook-linkcheck - run: | - mkdir mdbook-linkcheck - curl -sSL -o mdbook-linkcheck.zip https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip - unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck - chmod +x `pwd`/mdbook-linkcheck/mdbook-linkcheck - echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH - - name: Run linkcheck run: mdbook-linkcheck --standalone + env: + PATH: ${{ needs.setup.outputs.mdbook-linkcheck-path }}:$PATH build: + needs: setup runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 with: @@ -70,24 +83,15 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@nightly + - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Install mdbook - run: | - mkdir mdbook - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook - echo `pwd`/mdbook >> $GITHUB_PATH - - - name: Install mdbook-template - run: | - mkdir mdbook-template - curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template - echo `pwd`/mdbook-template >> $GITHUB_PATH - - name: Build book - run: mdbook build documentation + run: mdbook build + env: + PATH: ${{ needs.setup.outputs.mdbook-path }}:$PATH - name: Build docs - run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps \ No newline at end of file + run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps From 5d35e9c9572cce2c71a5449328eb6b6900b72d76 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 11:54:17 -0700 Subject: [PATCH 09/17] Update book.yaml --- .github/workflows/book.yaml | 50 ++++++++----------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index 9d415082..8e034f23 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v3 # Install Rust - - name: Install Rust + - name: install rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -31,32 +31,18 @@ jobs: components: rustfmt, clippy # Install mdbook - - name: Install mdbook - run: | - mkdir mdbook - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook - id: mdbook-path - working-directory: ${{ github.workspace }} + - name: install mdbook + run: cargo install mdbook --vers "^0.4.35" continue-on-error: false - # Install mdbook-template - - name: Install mdbook-template - run: | - mkdir mdbook-template - curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template - id: mdbook-template-path - working-directory: ${{ github.workspace }} + # Install mdbook-linkcheck + - name: install mdbook-linkcheck + run: cargo install mdbook-linkcheck continue-on-error: false - # Install mdbook-linkcheck - - name: Install mdbook-linkcheck - run: | - mkdir mdbook-linkcheck - curl -sSL -o mdbook-linkcheck.zip https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip - unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck - chmod +x mdbook-linkcheck/mdbook-linkcheck - id: mdbook-linkcheck-path - working-directory: ${{ github.workspace }} + # Install mdbook-keeper + - name: install mdbook-keeper + run: cargo install mdbook-keeper --version "^0.4.0" continue-on-error: false lint: @@ -67,10 +53,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Run linkcheck + - name: run linkcheck run: mdbook-linkcheck --standalone - env: - PATH: ${{ needs.setup.outputs.mdbook-linkcheck-path }}:$PATH build: needs: setup @@ -81,17 +65,5 @@ jobs: with: fetch-depth: 0 - - name: Install toolchain - uses: dtolnay/rust-toolchain@nightly - - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - - name: Build book + - name: build book run: mdbook build - env: - PATH: ${{ needs.setup.outputs.mdbook-path }}:$PATH - - - name: Build docs - run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps From ebecebbbcea580b3d240c86f59bd52dbae3f1465 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 12:04:27 -0700 Subject: [PATCH 10/17] fixes --- .github/workflows/book.yaml | 53 +++++++++++-------------- documentation/src/lib.rs | 1 + documentation/src/usage/arbiter_core.md | 2 +- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index 8e034f23..e3ce984c 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -12,52 +12,30 @@ on: merge_group: jobs: - setup: + lint: runs-on: ubuntu-latest - outputs: - mdbook-path: ${{ steps.mdbook-path.outputs.path }} - mdbook-template-path: ${{ steps.mdbook-template-path.outputs.path }} - mdbook-linkcheck-path: ${{ steps.mdbook-linkcheck-path.outputs.path }} + name: lint steps: - uses: actions/checkout@v3 # Install Rust - - name: install rust toolchain + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable override: true components: rustfmt, clippy - # Install mdbook - - name: install mdbook - run: cargo install mdbook --vers "^0.4.35" - continue-on-error: false - # Install mdbook-linkcheck - - name: install mdbook-linkcheck + - name: Install mdbook-linkcheck run: cargo install mdbook-linkcheck - continue-on-error: false - - # Install mdbook-keeper - - name: install mdbook-keeper - run: cargo install mdbook-keeper --version "^0.4.0" - continue-on-error: false - - lint: - needs: setup - runs-on: ubuntu-latest - name: lint - - steps: - - uses: actions/checkout@v3 - - name: run linkcheck + # Run linkcheck + - name: Run linkcheck run: mdbook-linkcheck --standalone build: - needs: setup runs-on: ubuntu-latest steps: @@ -65,5 +43,22 @@ jobs: with: fetch-depth: 0 - - name: build book + # Install Rust + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt, clippy + + # Install mdbook + - name: Install mdbook + run: cargo install mdbook --vers "^0.4.35" + + # Install mdbook-keeper + - name: Install mdbook-keeper + run: cargo install mdbook-keeper --version "^0.4.0" + + # Build book + - name: Build book run: mdbook build diff --git a/documentation/src/lib.rs b/documentation/src/lib.rs index e69de29b..8b137891 100644 --- a/documentation/src/lib.rs +++ b/documentation/src/lib.rs @@ -0,0 +1 @@ + diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index b12624a2..a47820f5 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -6,7 +6,7 @@ The only notable differences are in the control you have over this `Environment` ## Environment The `Environment` owns a `revm` instance for processing EVM bytecode. -To make the `Environment` performent and flexible, it runs on its own system thread and receives all communication via `Instruction`s sent to it via a `Sender`. +To make the `Environment` performant and flexible, it runs on its own system thread and receives all communication via `Instruction`s sent to it via a `Sender`. The `Socket` is a struct owned by the `Environment` that manages all inward and outward communication with the `Environment`'s clients, such as the `Instruction` channel. ### Usage From fdb53c9a25a890ea5e9f6affefa46bb0e1d5f561 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 12:18:17 -0700 Subject: [PATCH 11/17] linkcheck, should fail on book build --- .github/workflows/book.yaml | 1 + documentation/src/index.md | 2 +- documentation/src/usage/arbiter_core.md | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index e3ce984c..681c7f72 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -62,3 +62,4 @@ jobs: # Build book - name: Build book run: mdbook build + continue-on-error: false diff --git a/documentation/src/index.md b/documentation/src/index.md index 6569f64c..90c0a6df 100644 --- a/documentation/src/index.md +++ b/documentation/src/index.md @@ -2,7 +2,7 @@ **Arbiter** is a framework for stateful Ethereum smart-contract simulation. The framework features an [`ethers-rs`](https://github.com/gakonst/ethers-rs) middleware built on top of [revm](https://github.com/bluealloy/revm) which allows the end user to interact with a sandboxed `revm` instance as if it were an Ethereum node. This provides a familiar interface for interacting with the Ethereum Virtual Machine (EVM), but with unrivaled speed. -Furthermore, Arbiter provides containment and management for simulations. For a running list of vulnerabilities found with Arbiter, please see the [Vulnerability Corpus](./documentation/src/contributing/vulnerability_corpus.md). +Furthermore, Arbiter provides containment and management for simulations. For a running list of vulnerabilities found with Arbiter, please see the [Vulnerability Corpus](contributing/vulnerability_corpus.md). ## Overview The Arbiter workspace has three crates: diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index a47820f5..9c6352d3 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -106,5 +106,5 @@ async fn main() { let client = RevmMiddleware::new(&env, None); // Deploy a contract - let contract = ArbiterToken::deploy(&client, ("ARB", "Arbiter Token", 18)).send().await.unwrap().await.unwrap(); + let contract = ArbiterToken::deploy(client, ("ARB".to_owned(), "Arbiter Token".to_owned(), 18)).unwrap().send().await.unwrap(); } \ No newline at end of file From 946ec2dd68fdf9ca1d047166f708a040767a64e5 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 12:29:05 -0700 Subject: [PATCH 12/17] i hate workflows --- .github/workflows/book.yaml | 37 +++++++++++-------------------------- book.toml | 2 +- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index 681c7f72..f362e353 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -11,30 +11,6 @@ on: branches: [main] merge_group: -jobs: - lint: - runs-on: ubuntu-latest - name: lint - - steps: - - uses: actions/checkout@v3 - - # Install Rust - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rustfmt, clippy - - # Install mdbook-linkcheck - - name: Install mdbook-linkcheck - run: cargo install mdbook-linkcheck - - # Run linkcheck - - name: Run linkcheck - run: mdbook-linkcheck --standalone - build: runs-on: ubuntu-latest @@ -59,7 +35,16 @@ jobs: - name: Install mdbook-keeper run: cargo install mdbook-keeper --version "^0.4.0" + # Install mdbook-linkcheck + - name: Install mdbook-linkcheck + run: cargo install mdbook-linkcheck + + # Install mdbook-katex + - name: Install mdbook-katex + run: cargo install mdbook-katex + # Build book - name: Build book - run: mdbook build - continue-on-error: false + run: | + set -e + mdbook build diff --git a/book.toml b/book.toml index c165d4b1..1f2861d8 100644 --- a/book.toml +++ b/book.toml @@ -33,5 +33,5 @@ manifest_dir = "./documentation/" externs = ["arbiter_core", "arbiter_bindings", "tokio"] [output.linkcheck] -optional = true +optional = false follow-web-links = true \ No newline at end of file From 213e445b3a2a34f836c7b98661c052b41afa8ae7 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 12:34:39 -0700 Subject: [PATCH 13/17] Update book.yaml --- .github/workflows/book.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index f362e353..0e33b200 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -11,6 +11,7 @@ on: branches: [main] merge_group: +jobs: build: runs-on: ubuntu-latest @@ -44,7 +45,7 @@ on: run: cargo install mdbook-katex # Build book - - name: Build book + - name: build book run: | set -e mdbook build From d0184a67298fe7018278e6b25eb80df8f8a431bf Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 13:18:49 -0700 Subject: [PATCH 14/17] reworking --- .github/workflows/book.yaml | 50 +++++++++++--- Cargo.lock | 86 +++++++++++++++++++++---- documentation/Cargo.toml | 9 ++- documentation/build.rs | 8 +++ documentation/src/usage/arbiter_core.md | 11 +++- documentation/tests/skeptic.rs | 1 + 6 files changed, 139 insertions(+), 26 deletions(-) create mode 100644 documentation/build.rs create mode 100644 documentation/tests/skeptic.rs diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index 0e33b200..bd4441cd 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -11,7 +11,6 @@ on: branches: [main] merge_group: -jobs: build: runs-on: ubuntu-latest @@ -26,20 +25,11 @@ jobs: with: toolchain: stable override: true - components: rustfmt, clippy # Install mdbook - name: Install mdbook run: cargo install mdbook --vers "^0.4.35" - # Install mdbook-keeper - - name: Install mdbook-keeper - run: cargo install mdbook-keeper --version "^0.4.0" - - # Install mdbook-linkcheck - - name: Install mdbook-linkcheck - run: cargo install mdbook-linkcheck - # Install mdbook-katex - name: Install mdbook-katex run: cargo install mdbook-katex @@ -49,3 +39,43 @@ jobs: run: | set -e mdbook build + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Install Rust + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdbook-linkcheck + - name: Install mdbook-linkcheck + run: cargo install mdbook-linkcheck + + - name: linkcheck + run: mdbook-linkcheck --standalone + + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Install Rust + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: test + run: cargo test --package documentation \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d55533f9..77de4b6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -273,7 +273,7 @@ dependencies = [ "async-stream", "async-trait", "bytes", - "cargo_metadata", + "cargo_metadata 0.18.1", "chrono", "crossbeam-channel", "ethers", @@ -299,15 +299,6 @@ dependencies = [ "tracing-test", ] -[[package]] -name = "arbiter-documentation" -version = "0.0.0" -dependencies = [ - "arbiter-bindings", - "arbiter-core", - "tokio", -] - [[package]] name = "arbiter-engine" version = "0.1.0" @@ -803,6 +794,12 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +[[package]] +name = "bytecount" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" + [[package]] name = "bytemuck" version = "1.14.0" @@ -892,6 +889,19 @@ dependencies = [ "serde", ] +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.20", + "serde", + "serde_json", +] + [[package]] name = "cargo_metadata" version = "0.18.1" @@ -1398,6 +1408,16 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +[[package]] +name = "documentation" +version = "0.0.0" +dependencies = [ + "arbiter-bindings", + "arbiter-core", + "skeptic", + "tokio", +] + [[package]] name = "dunce" version = "1.0.4" @@ -1533,6 +1553,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + [[package]] name = "eth-keystore" version = "0.5.0" @@ -1698,7 +1727,7 @@ checksum = "918b1a9ba585ea61022647def2f27c29ba19f6d2a4a4c8f68a9ae97fd5769737" dependencies = [ "arrayvec", "bytes", - "cargo_metadata", + "cargo_metadata 0.18.1", "chrono", "const-hex", "elliptic-curve", @@ -4013,6 +4042,17 @@ dependencies = [ "unarray", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -4890,6 +4930,21 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata 0.14.2", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "slab" version = "0.4.9" @@ -5647,6 +5702,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.15" diff --git a/documentation/Cargo.toml b/documentation/Cargo.toml index 296ddafe..c686cdf4 100644 --- a/documentation/Cargo.toml +++ b/documentation/Cargo.toml @@ -1,9 +1,14 @@ [package] -name = "arbiter-documentation" +name = "documentation" version = "0.0.0" edition = "2021" +build = "build.rs" -[dependencies] +[build-dependencies] +skeptic = "0.13.7" + +[dev-dependencies] +skeptic = "0.13.7" arbiter-core = { path = "../arbiter-core" } arbiter-bindings = { path = "../arbiter-bindings" } tokio.workspace = true \ No newline at end of file diff --git a/documentation/build.rs b/documentation/build.rs new file mode 100644 index 00000000..104d80e5 --- /dev/null +++ b/documentation/build.rs @@ -0,0 +1,8 @@ +use skeptic::markdown_files_of_directory; + +extern crate skeptic; + +fn main() { + let markdown_files = markdown_files_of_directory("src/"); + skeptic::generate_doc_tests(&markdown_files); +} diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index 9c6352d3..de4ebd09 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -13,6 +13,7 @@ The `Socket` is a struct owned by the `Environment` that manages all inward and To create an `Environment`, we use a builder pattern that allows you to pre-load an `Environment` with your own database. We can do the following to create a default `Environment`: ```rust +extern crate skeptic; use arbiter_core::environment::builder::EnvironmentBuilder; fn main() { @@ -103,8 +104,12 @@ use arbiter_bindings::bindings::arbiter_token::ArbiterToken; #[tokio::main] async fn main() { let env = EnvironmentBuilder::new().build(); - let client = RevmMiddleware::new(&env, None); + let client = RevmMiddleware::new(&env, None).unwrap(); // Deploy a contract - let contract = ArbiterToken::deploy(client, ("ARB".to_owned(), "Arbiter Token".to_owned(), 18)).unwrap().send().await.unwrap(); -} \ No newline at end of file + let _contract = ArbiterToken::deploy(client, ("ARB".to_owned(), "Arbiter Token".to_owned(), 18)).unwrap().send().await.unwrap(); + + env.stop().unwrap(); +} +``` +why is this broken \ No newline at end of file diff --git a/documentation/tests/skeptic.rs b/documentation/tests/skeptic.rs new file mode 100644 index 00000000..ff46c9c0 --- /dev/null +++ b/documentation/tests/skeptic.rs @@ -0,0 +1 @@ +include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs")); From c15914a532437b54a5d8d961d58d69b63d0d7fdc Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 13:44:29 -0700 Subject: [PATCH 15/17] testing out --- .github/workflows/book.yaml | 1 + .github/workflows/test.yaml | 2 +- documentation/Cargo.toml | 7 ++++--- documentation/src/usage/arbiter_core.md | 10 +++------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index bd4441cd..13c04f3b 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -11,6 +11,7 @@ on: branches: [main] merge_group: +jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f562322b..2d79ae58 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: override: true - name: test - run: cargo test --workspace --all-features + run: cargo test --workspace --all-features --exclude documentation codecov: name: codecov diff --git a/documentation/Cargo.toml b/documentation/Cargo.toml index c686cdf4..f619f258 100644 --- a/documentation/Cargo.toml +++ b/documentation/Cargo.toml @@ -6,9 +6,10 @@ build = "build.rs" [build-dependencies] skeptic = "0.13.7" +tokio.workspace = true [dev-dependencies] skeptic = "0.13.7" -arbiter-core = { path = "../arbiter-core" } -arbiter-bindings = { path = "../arbiter-bindings" } -tokio.workspace = true \ No newline at end of file +arbiter-core.workspace = true +arbiter-bindings.workspace = true + diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index de4ebd09..362e432b 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -13,7 +13,6 @@ The `Socket` is a struct owned by the `Environment` that manages all inward and To create an `Environment`, we use a builder pattern that allows you to pre-load an `Environment` with your own database. We can do the following to create a default `Environment`: ```rust -extern crate skeptic; use arbiter_core::environment::builder::EnvironmentBuilder; fn main() { @@ -24,12 +23,12 @@ Note that the call to `.build()` will start the `Environment`'s thread and begin If you have a database that has been forked from a live network, it has likely been serialized to disk. In which case, you can do something like this: -```rust +```rust, ignore use arbiter_core::environment::builder::EnvironmentBuilder; use arbiter_core::environment::fork::Fork; fn main() { - let path_to_fork = "../example_fork/fork_into_test.json"; + let path_to_fork = "path/to/fork"; let fork = Fork::from_disk(path_to_fork).unwrap(); let env = EnvironmentBuilder::new().db(fork).build(); } @@ -107,9 +106,6 @@ async fn main() { let client = RevmMiddleware::new(&env, None).unwrap(); // Deploy a contract - let _contract = ArbiterToken::deploy(client, ("ARB".to_owned(), "Arbiter Token".to_owned(), 18)).unwrap().send().await.unwrap(); - - env.stop().unwrap(); + let contract = ArbiterToken::deploy(client, ("ARBT".to_owned(), "Arbiter Token".to_owned(), 18u8)).unwrap().send().await.unwrap(); } ``` -why is this broken \ No newline at end of file From 4946df1715024ed80b06c7f2ae5f04232dd8c023 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 13:53:19 -0700 Subject: [PATCH 16/17] make sure this works properly --- .github/workflows/book.yaml | 4 +--- book.toml | 2 +- documentation/src/usage/arbiter_core.md | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml index 13c04f3b..1e9eac30 100644 --- a/.github/workflows/book.yaml +++ b/.github/workflows/book.yaml @@ -37,9 +37,7 @@ jobs: # Build book - name: build book - run: | - set -e - mdbook build + run: mdbook build lint: runs-on: ubuntu-latest diff --git a/book.toml b/book.toml index 1f2861d8..c165d4b1 100644 --- a/book.toml +++ b/book.toml @@ -33,5 +33,5 @@ manifest_dir = "./documentation/" externs = ["arbiter_core", "arbiter_bindings", "tokio"] [output.linkcheck] -optional = false +optional = true follow-web-links = true \ No newline at end of file diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index 362e432b..1997df7a 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -106,6 +106,6 @@ async fn main() { let client = RevmMiddleware::new(&env, None).unwrap(); // Deploy a contract - let contract = ArbiterToken::deploy(client, ("ARBT".to_owned(), "Arbiter Token".to_owned(), 18u8)).unwrap().send().await.unwrap(); + let contract = ArbidterToken::deploy(client, ("ARBT".to_owned(), "Arbiter Token".to_owned(), 18u8)).unwrap().send().await.unwrap(); } ``` From 12498c79882c98d4e5f793a83a95d52c7eb83461 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Wed, 24 Jan 2024 14:01:05 -0700 Subject: [PATCH 17/17] now all pass? --- .github/workflows/test.yaml | 2 +- documentation/src/usage/arbiter_core.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2d79ae58..12237c82 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -38,7 +38,7 @@ jobs: uses: taiki-e/install-action@cargo-llvm-cov - name: codecov - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + run: cargo llvm-cov --all-features --workspace --exclude documentation --lcov --output-path lcov.info - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 diff --git a/documentation/src/usage/arbiter_core.md b/documentation/src/usage/arbiter_core.md index 1997df7a..362e432b 100644 --- a/documentation/src/usage/arbiter_core.md +++ b/documentation/src/usage/arbiter_core.md @@ -106,6 +106,6 @@ async fn main() { let client = RevmMiddleware::new(&env, None).unwrap(); // Deploy a contract - let contract = ArbidterToken::deploy(client, ("ARBT".to_owned(), "Arbiter Token".to_owned(), 18u8)).unwrap().send().await.unwrap(); + let contract = ArbiterToken::deploy(client, ("ARBT".to_owned(), "Arbiter Token".to_owned(), 18u8)).unwrap().send().await.unwrap(); } ```