Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Sep 27, 2024
2 parents 00863f5 + ff6dc1b commit b5a6219
Show file tree
Hide file tree
Showing 20 changed files with 442 additions and 143 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/secrets_scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Leaked Secrets Scan
on:
pull_request:
merge_group:
jobs:
TruffleHog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@7e78ca385fb82c19568c7a4b341c97d57d9aa5e1 # v3.82.2
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --debug --only-verified
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 📖 Foundry-zkSync Book
<img src="src/images/foundry-banner.png" style="border-radius: 20px">

A book on all things foundry-zksync. [Read now](https://96ba0f25.book-3fk.pages.dev/).
<br>

# 📖 Foundry ZKsync Book

A book on all things foundry ZKsync. [Read now](https://foundry-book.zksync.io/).
65 changes: 37 additions & 28 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@
- [Overview](./zksync-specifics/README.md)
- [Execution Overview](./zksync-specifics/execution-overview.md)
- [Compilation Overview](./zksync-specifics/compilation-overview.md)
- [Configuration Overview](./zksync-specifics/configuration-overview.md)
- [Limitations](./zksync-specifics/limitations/README.md)
- [General](./zksync-specifics/limitations/general.md)
- [Compilation](./zksync-specifics/limitations/compilation.md)
- [Broadcast](./zksync-specifics/limitations/broadcast.md)
- [Events](./zksync-specifics/limitations/events.md)
- [Traces](./zksync-specifics/limitations/traces.md)
- [Cheatcodes](./zksync-specifics/limitations/cheatcodes.md)
- [Forge-ZKSync Standard Library](./zksync-specifics/forge-zksync-std.md)
- [Additional Cheatcodes](./zksync-specifics/cheatcodes/README.md)
- [zkVm](./zksync-specifics/cheatcodes/zkvm.md)
- [zkRegisterContract](./zksync-specifics/cheatcodes/zk-register-contract.md)
- [zkVm](./zksync-specifics/cheatcodes/zk-vm.md)
- [zkVmSkip](./zksync-specifics/cheatcodes/zk-vm-skip.md)

# Supported Commands Overview
# Supported Commands
- [Command List](./supported-commands/README.md)

# Forge Overview
Expand All @@ -40,7 +44,8 @@
- [Tests](./forge/tests.md)
- [Writing Tests](./forge/writing-tests.md)
- [Cheatcodes](./forge/cheatcodes.md)
- [Forge Standard Library Overview](./forge/forge-std.md)
- [Forge Standard Library](./forge/forge-std.md)
- [Forge ZKsync Standard Library](./forge/forge-zksync-std.md)
- [Understanding Traces](./forge/traces.md)
- [Fork Testing](./forge/fork-testing.md)
- [Replaying Failures](./forge/replay-testing.md)
Expand All @@ -58,7 +63,7 @@
- [Gas Tracking](./forge/gas-tracking.md)
- [Gas Reports](./forge/gas-reports.md)
- [Gas Snapshots](./forge/gas-snapshots.md)
- [Debugger](./forge/debugger.md)
<!-- - [Debugger](./forge/debugger.md) -->

# Cast Overview

Expand All @@ -72,31 +77,33 @@
# Configuration

- [Configuring with `foundry.toml`](./config/README.md)
- [Continuous Integration](./config/continuous-integration.md)
- [Integrating with VSCode](./config/vscode.md)
- [Shell Autocompletion](./config/shell-autocompletion.md)
- [Static Analyzers](./config/static-analyzers.md)
- [Integrating with Hardhat](./config/hardhat.md)
- [Vyper support](./config/vyper.md)
<!-- - [Continuous Integration](./config/continuous-integration.md) -->
<!-- - [Integrating with VSCode](./config/vscode.md) -->
<!-- - [Shell Autocompletion](./config/shell-autocompletion.md) -->
<!-- - [Static Analyzers](./config/static-analyzers.md) -->
<!-- - [Integrating with Hardhat](./config/hardhat.md) -->
<!-- - [Vyper support](./config/vyper.md) -->


# Tutorials

- [Best Practices](./tutorials/best-practices.md)
<!-- - [Best Practices](./tutorials/best-practices.md) -->
<!-- - [Creating an NFT with Solmate](./tutorials/solmate-nft.md) -->
<!-- - [Docker and Foundry](./tutorials/foundry-docker.md) -->
<!-- - [Testing EIP-712 Signatures](./tutorials/testing-eip712.md) -->
<!-- - [Solidity Scripting](./tutorials/solidity-scripting.md) -->
- [Deterministic deployment using CREATE2](./tutorials/create2-tutorial.md)
- [Solidity Scripting](./tutorials/solidity-scripting.md)
<!-- - [Forking Mainnet with Cast and Era Test Node](./tutorials/forking-mainnet-with-cast-anvil.md) -->
<!-- - [Learning Foundry Videos](./tutorials/learn-foundry.md) -->
<!-- - [Incremental Adoption]() !-->


# Appendix

- [FAQ](./faq.md)
- [Help us improve Foundry](./contributing.md)
<!-- - [FAQ](./faq.md) -->
<!-- - [Help us improve Foundry](./contributing.md) -->
- [References](./reference/README.md)
- [CLI Reference](./reference/cli/README.md) <!-- CLI_REFERENCE START
<!-- - [CLI Reference](./reference/cli/README.md)
- [`forge`](./reference/cli/forge.md)
- [`forge bind`](./reference/cli/forge/bind.md)
- [`forge bind-json`](./reference/cli/forge/bind-json.md)
Expand Down Expand Up @@ -379,19 +386,20 @@
- [cast wallet vanity](./reference/cast/cast-wallet-vanity.md)
- [cast wallet verify](./reference/cast/cast-wallet-verify.md)
- [cast wallet import](./reference/cast/cast-wallet-import.md)
- [cast wallet list](./reference/cast/cast-wallet-list.md)
- [cast wallet list](./reference/cast/cast-wallet-list.md) -->
<!-- - [`anvil` Reference](./reference/anvil/README.md) -->
<!-- - [`chisel` Reference](./reference/chisel/README.md) -->
- [Config Reference](./reference/config/README.md)
- [Overview](./reference/config/overview.md)
- [Project](./reference/config/project.md)
- [Solidity Compiler](./reference/config/solidity-compiler.md)
- [Testing](./reference/config/testing.md)
- [In-line Configuration Testing](./reference/config/inline-test-config.md)
- [Formatter](./reference/config/formatter.md)
- [Documentation Generator](./reference/config/doc-generator.md)
- [Etherscan](./reference/config/etherscan.md)
- [Cheatcodes Reference](./cheatcodes/README.md)
<!-- - [In-line Configuration Testing](./reference/config/inline-test-config.md) -->
<!-- - [Formatter](./reference/config/formatter.md) -->
<!-- - [Documentation Generator](./reference/config/doc-generator.md) -->
<!-- - [Etherscan](./reference/config/etherscan.md) -->
<!-- [Cheatcodes Reference](./cheatcodes/README.md) -->
<!--
- [Environment](./cheatcodes/environment.md)
- [`warp`](./cheatcodes/warp.md)
- [`roll`](./cheatcodes/roll.md)
Expand Down Expand Up @@ -492,9 +500,10 @@
- [RPC](./cheatcodes/rpc.md)
- [Files](./cheatcodes/fs.md)
- [ZKsync](./zksync-specifics/cheatcodes/README.md)
- [zkVm](./zksync-specifics/cheatcodes/zkvm.md)
- [Forge Standard Library Reference](./reference/forge-std/README.md)
- [Std Logs](./reference/forge-std/std-logs.md)
- [zkVm](./zksync-specifics/cheatcodes/zk-vm.md)
-->
<!-- - [Forge Standard Library Reference](./reference/forge-std/README.md) -->
<!-- - [Std Logs](./reference/forge-std/std-logs.md)
- [Std Assertions](./reference/forge-std/std-assertions.md)
- [`fail`](./reference/forge-std/fail.md)
- [`assertTrue`](./reference/forge-std/assertTrue.md)
Expand Down Expand Up @@ -555,7 +564,7 @@
- [Script Utils](./reference/forge-std/script-utils.md)
- [`computeCreateAddress`](./reference/forge-std/compute-create-address.md)
- [`deriveRememberKey`](./reference/forge-std/derive-remember-key.md)
- [Console Logging](./reference/forge-std/console-log.md)
- [DSTest Reference](./reference/ds-test.md)
- [Miscellaneous](./misc/README.md)
- [Struct encoding](./misc/struct-encoding.md)
- [Console Logging](./reference/forge-std/console-log.md) -->
<!-- - [DSTest Reference](./reference/ds-test.md) --> -->
<!-- - [Miscellaneous](./misc/README.md) -->
<!-- - [Struct encoding](./misc/struct-encoding.md) -->
5 changes: 5 additions & 0 deletions src/forge/forge-zksync-std.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Forge ZKsync Standard Library Overview

Forge ZKsync Standard Library is an addition to the [Forge Standard Library](./forge-std.md) that adds further collection of helpful contracts that make writing tests easier, faster, and more user-friendly for the ZKsync ecosystem.

Refer to this [section](../zksync-specifics/forge-zksync-std.md) for more details.
16 changes: 7 additions & 9 deletions src/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Installation

If you face any issues while installing, check out the [FAQ](../faq.md).
<!-- If you face any issues while installing, check out the [FAQ](../faq.md). -->

### Precompiled binaries

Expand All @@ -14,9 +14,7 @@ Foundryup-zksync is the Foundry-ZKsync toolchain installer. You can find more ab
Open your terminal and run the following command from the repository:

```sh
git clone https://github.com/matter-labs/foundry-zksync.git
cd foundry-zksync/foundryup-zksync
./install.sh
curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash
```

This will install Foundryup-zksync, then simply follow the instructions on-screen,
Expand Down Expand Up @@ -76,16 +74,16 @@ cargo install --path ./crates/cast --profile release --force --locked

### Installing for CI in Github Action

The latest binaries for the appropriate architecture can be downloaded from the [release](https://github.com/matter-labs/foundry-zksync/releases/tag/nightly) page:
The latest binaries for the appropriate architecture can be installed directly using the following GitHub Action:

```yaml
steps:
- name: download binaries
run: |
wget -qc https://github.com/matter-labs/foundry-zksync/releases/download/nightly/foundry_nightly_linux_amd64.tar.gz -O - | tar -xz
./forge -V && ./cast -V
- name: Install Foundry-ZKsync
uses: dutterbutter/foundry-zksync-toolchain@v1
```
For further details, visit the [foundry-zksync-toolchain repository](https://github.com/dutterbutter/foundry-zksync-toolchain).
### Using Foundry with Docker
> ℹ️ **Note**
Expand Down
Binary file modified src/images/solidity-scripting/compile-successful.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/reference/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [Project](./project.md)
- [Solidity Compiler](./solidity-compiler.md)
- [Testing](./testing.md)
- [In-line test configuration](./inline-test-config.md)
<!-- - [In-line test configuration](./inline-test-config.md)
- [Formatter](./formatter.md)
- [Documentation Generator](./doc-generator.md)
- [Etherscan](./etherscan.md)
- [Etherscan](./etherscan.md) -->
101 changes: 101 additions & 0 deletions src/reference/config/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,104 @@ The path to the broadcast transaction logs, relative to the root of the project.
- Environment: `FOUNDRY_FORCE` or `DAPP_FORCE`

Whether or not to perform a clean build, discarding the cache.


### ZKsync Settings

Additional zksync settings can be defined on the profile of choice by specifying `profile.<name>.zksync` section.

For example to define the settings on `profile.default`:

```toml
[profile.default]
# ...Normal foundry settings...

[profile.default.zksync]
# ...ZKSync specific settings...
```

##### `compile`

- Type: boolean
- Default: false

Compile contracts for zkEVM.

##### `startup`

- Type: boolean
- Default: true (will only have effect if `compile = true`)

Requires `compile = true` to have an effect.
Enable ZKsync context on startup. This applies to tests, scripts, and any other commands that need to switch immediately to zkEVM on startup.

##### `zksolc`

- Type: string
- Default: <latest-version>

The zksolc version to use for compilation.

##### `solc_path`

- Type: string
- Default: <default-zksolc-solc>

The `solc` path to use during `zksolc` compilation.

##### `bytecode_hash`

- Type: boolean
- Default: "none"

Whether to include the metadata hash for zksolc compiled bytecode.

##### `fallback_oz`

- Type: boolean
- Default: false

Allow compiler to recompile using `optimizer_mode = 'z'` if contracts won't fit in the EraVM bytecode size limitations.

##### `enable_eravm_extensions`

- Type: boolean
- Default: false

Enable EraVM extensions (e.g. system-mode). This allows compilation of ZKsync-specific simulations.

##### `force_evmla`

- Type: boolean
- Default: false

Force compilation via EVMLA instead of Yul codegen pipeline.

##### `avoid_contracts`

- Type: array of strings
- Default: []

List of glob patterns to avoid compiling with zksolc.

##### `optimizer`

- Type: boolean
- Default: true

Enable optimizer on zksolc.

##### `optimizer_mode`

- Type: string
- Default: '3'

The zksolc optimizer mode (0 | 1 | 2 | 3 | s | z).

##### `optimizer_details`

- Type: object
- Default: {}

Allows specifying additional zksolc [Optimizer Details](https://github.com/matter-labs/era-compiler-solidity/blob/main/era-compiler-solidity/src/solc/standard_json/input/settings/optimizer/details.rs#L10).

15 changes: 15 additions & 0 deletions src/reference/config/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ The flag indicating whether to include push bytes values.

The flag indicates whether to display console logs in fuzz tests or not. Note that in order to enable displaying console logs, you'll need to set `show_logs = true` and then use `forge test -vv` or set `verbosity >= 2`.

##### `no_zksync_reserved_addresses`

- Type: boolean
- Default: false

Avoid generating [reserved](../../zksync-specifics/limitations/general.md#reserved-address-range) ZKsync addresses within the fuzzer. This avoids having to use `vm.assume(addr > 65535)` during fuzzing that can ignore too many inputs causing `max_test_rejects` to trigger.


### Invariant

Expand Down Expand Up @@ -473,3 +480,11 @@ The flag indicating whether to include push bytes values. See also [fuzz.include
- Environment: `FOUNDRY_INVARIANT_SHRINK_RUN_LIMIT`

The maximum number of attempts to shrink a failed the sequence. Shrink process is disabled if set to 0.


##### `no_zksync_reserved_addresses`

- Type: boolean
- Default: false

Avoid generating [reserved](../../zksync-specifics/limitations/general.md#reserved-address-range) ZKsync addresses within the invariant test. This avoids having to use `vm.assume(addr > 65535)` during invariant testing that can ignore too many inputs causing `max_test_rejects` to trigger.
2 changes: 1 addition & 1 deletion src/supported-commands/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Foundry-ZKSync supported commands
## Foundry-ZKSync Supported Commands

This is a comprehensive review of all the Foundry commands actually supported in the actual stage of development.

Expand Down
Loading

0 comments on commit b5a6219

Please sign in to comment.