Skip to content

Commit

Permalink
[wip] fix(forge): fmt write chunk (#1717)
Browse files Browse the repository at this point in the history
* keep tack of emitter of logs (#1669)

* [not compiling] keep tack of emitter of logs

by switching from RawLog to Log

* ugly fix

* cargo +nightly fmt

* Add comment

Co-authored-by: Bjerg <[email protected]>

* fix variable name

Co-authored-by: Bjerg <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>

* provide default impls for remaining visitor methods (#1706)

* chore(clippy): make clippy happy (#1707)

* chore: bump ethers

* feat(bind): option to skip Cargo.toml from consistency checks (#1702)

* feat(bind): option to skip Cargo.toml from consistency checks

* chore: cargo fmt

* Update cli/src/cmd/forge/bind.rs

Co-authored-by: Matthias Seitz <[email protected]>

* chore: clippy lints

Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: Georgios Konstantopoulos <[email protected]>

* fix(verify): encode constructor arguments correctly (#1711)

* fix(verify): encode constructor arguments correctly

* chore: rotate api keys

* Update cli/tests/it/verify.rs

Co-authored-by: Georgios Konstantopoulos <[email protected]>

* feat: use rotating api keys in fork unit tests (#1693)

* feat: use rotating api keys in fork unit tests

* fix: use correct path

Co-authored-by: Georgios Konstantopoulos <[email protected]>

* refactor: spawn backendhandler on background thread (#1704)

* fix(watch): only watch dirs that exists (#1710)

* Switch selector database to sig.eth.samczsun.com (#1674)

* feat(utils): use samczsun selector directory

This commit switches the utils crate to use samczsun's new function
selector over 4byte for an improved interface and better stability

* feat(cast): update cli to use new 4byte interface

The util bindings were changed to use samczsun's selector library in the
previous commit; this commit updates the cast cli to properly use the
slightly changed interface.

Also ran cargo fmt which updated some unrelated formatting

* fix: review comments

- undo unrelated cargo fmt changes
- rename fourbyte_* -> decode_* in utils

* fix: remove fourbyte test helper

No longer necessary with sig.eth.samczsun.com

* Add `forge upload-selectors` command (#1676)

* feat: add upload selectors command to forge

This commit adds a new command to forge to upload a contract's abi to
sig.eth.samczsun.com selector database

* fix: review comments

- added default for CoreBuildArgs
- cleaned up code ordering
- moved url to constant

* fix: derive CoreBuildArgs::Default

* test: rotate rinkeby keys

* fix(forge/install): add git status check before commit (#1696)

* fix(forge/install): add git status check before commit

* move logic to git_status_clean function

Co-authored-by: test <[email protected]>

* write chunk

* restore original

* write chunks w/ paren

* semicolon cleanup

* write_semicolon

* feat: add `cast upload-signature` (#1716)

* feat: add `cast upload-signature`

This commit adds a new cast command to upload a raw function signature
to the https://sig.eth.samczsun.com 4byte database.

It also moves some of the original signature upload logic from `forge
upload-selectors` to a helper in foundry_utils

API looks like:
```
❯ cast upload-signature 'function approve(address,uint256)' 'transfer(uint256)' 'event Transfer(uint256,address)'
Duplicated: Function approve(address,uint256): 0x095ea7b3
Duplicated: Function transfer(uint256): 0x12514bba
Duplicated: Event Transfer(uint256,address): 0xabe1dcf9fcb8e5fb309db76bcab112a217aa5754d0f038921282bfe7907aa516
```

* fix: move selectors utils to separate module

* fix: add examples to cli help

* test(cast): add integration test for `cast upload-signature`

* feat(cast): allow uploading contract artifacts

This commit enables the `cast upload-signatures` tool to take contract
artifact files and upload the entire json to sig.eth.samczsun.com

* test: update failing tests (#1714)

* test: fix flaky timestamp test (#1727)

* fix: expressive value_name in clap annotations (#1700)

* value_name in forge test

* test debug help

* remove help and revert debug value_name to TEST FUNCTION

* forge test value_name

* forge value_name

* forge args add value_name

* all cast value_name

* Update cli/src/cmd/cast/run.rs

Co-authored-by: Matthias Seitz <[email protected]>

* cast FourByteDecode merge conflict

Co-authored-by: Matthias Seitz <[email protected]>

* ClapChain value_name (#1731)

* utils & cleanup

* fix(forge/install): git status check (#1732)

* fix(cli): can_update_libs_section test (#1733)

* write_chunk! where possible

* func def fmt

* fix attrs

* tests

* linter

* anvil value_name (#1743)

* docs

* indented & indented_if

* unused import

* cleanup

* ci: add additional ci jobs for forks (#1728)

* ci: add additional ci jobs for forks

* test: fix flaky anvil test

* ci: setup git config

* ci: setup git config

* ci: setup git config global

* chore: fix flaky snapshot test

* fix: enable tokio time feature (#1750)

* chore(deps): replace colored with yansi (#1722)

* feat(config): add allow paths setting (#1751)

* ci: set git config global in cross platform ci (#1754)

* ci: set git config global in cross platform ci

* fix: flaky tests

* fix: use proper types

* fix(cast): improve cast wallet new (#1713)

* fix(cast): improve cast wallet new

* chore: cleanup imports

Co-authored-by: jole <[email protected]>
Co-authored-by: Bjerg <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: Georgios Konstantopoulos <[email protected]>
Co-authored-by: Meet Mangukiya <[email protected]>
Co-authored-by: marktoda <[email protected]>
Co-authored-by: 0xYYY <[email protected]>
Co-authored-by: test <[email protected]>
Co-authored-by: Shawn Harmsen <[email protected]>
  • Loading branch information
10 people authored May 28, 2022
1 parent 4d7d126 commit a242bbb
Show file tree
Hide file tree
Showing 76 changed files with 2,475 additions and 1,263 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jobs:
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
# required for forge commands that use git
- name: setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
Expand Down
98 changes: 83 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,28 @@ jobs:
unit:
name: unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: cargo test
run: cargo test --locked --workspace --all-features --lib --bins -- --skip fork

fork-unit:
name: fork unit tests
runs-on: ubuntu-latest
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand All @@ -29,32 +49,38 @@ jobs:
uses: actions/cache@v3
with:
path: "$HOME/.foundry/cache"
key: rpc-cache-${{ hashFiles('cli/tests/it/integration.rs') }}
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}

- name: cargo test
run: cargo test --locked --workspace --all-features --lib --bins
run: cargo test --locked --workspace --all-features --lib --bins fork

doc:
name: doc tests
integration:
name: integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Rust cache
uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

# required for forge commands that use git
- name: setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: cargo test
run: cargo test --locked --workspace --all-features --doc
run: cargo test --locked --workspace -- --skip fork

integration:
name: integration tests
fork-integration:
name: fork integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -74,16 +100,39 @@ jobs:
uses: actions/cache@v3
with:
path: "$HOME/.foundry/cache"
key: rpc-cache-${{ hashFiles('cli/tests/it/integration.rs') }}
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}

- name: cargo test
run: cargo test --locked --workspace --test '*'
run: cargo test --locked --workspace -- fork

external-integration:
name: external integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: Force use of HTTPS for submodules
run: git config --global url."https://github.com/".insteadOf "[email protected]:"

- name: cargo test
run: cargo test --locked -p foundry-cli --features external-integration-tests -- --skip fork

external-fork-integration:
name: external fork integration tests
runs-on: ubuntu-latest
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand All @@ -101,13 +150,32 @@ jobs:
uses: actions/cache@v3
with:
path: "$HOME/.foundry/cache"
key: rpc-cache-${{ hashFiles('cli/tests/it/integration.rs') }}
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}

- name: Force use of HTTPS for submodules
run: git config --global url."https://github.com/".insteadOf "[email protected]:"

- name: cargo test
run: cargo test --locked --workspace --features external-integration-tests --test '*'
run: cargo test --locked -p foundry-cli --features external-integration-tests fork_integration

doc:
name: doc tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: cargo test
run: cargo test --locked --workspace --all-features --doc

lint:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ Types of tests include:

- **Unit tests**: Functions which have very specific tasks should be unit tested.
- **Integration tests**: For general purpose, far reaching functionality, integration tests should be added.
The best way to add a new integration test is to look at existing ones and follow the style.
The best way to add a new integration test is to look at existing ones and follow the style.

Tests that use forking must contain "fork" in their name.

#### Commits

Expand Down
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ futures = "0.3"
serde_json = "1.0.67"
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0.30"
colored = "2.0.0"
yansi = "0.5.1"

# cli
clap = { version = "3.0.10", features = [
Expand Down
2 changes: 1 addition & 1 deletion anvil/core/src/eth/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde::{de::Error, Deserialize, Deserializer, Serialize};
use std::fmt;

/// Result of a subscription
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
#[serde(untagged)]
pub enum SubscriptionResult {
/// New block header
Expand Down
8 changes: 7 additions & 1 deletion anvil/server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ pub struct ServerConfig {
/// The cors `allow_origin` header
#[cfg_attr(
feature = "clap",
clap(long, help = "Set the CORS allow_origin", default_value = "*", name = "allow-origin")
clap(
long,
help = "Set the CORS allow_origin",
default_value = "*",
name = "allow-origin",
value_name = "ALLOW_ORIGIN"
)
)]
pub allow_origin: HeaderValueWrapper,
/// Whether to enable CORS
Expand Down
Loading

0 comments on commit a242bbb

Please sign in to comment.