Skip to content

Commit

Permalink
Merge branch 'ethereum-optimism:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
F-WRunTime authored Dec 4, 2024
2 parents 0b42802 + e253b19 commit 7a08076
Show file tree
Hide file tree
Showing 602 changed files with 19,168 additions and 11,156 deletions.
468 changes: 242 additions & 226 deletions .circleci/config.yml

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions .github/workflows/close-stale.yml

This file was deleted.

69 changes: 0 additions & 69 deletions .github/workflows/tag-service.yml

This file was deleted.

18 changes: 9 additions & 9 deletions .semgrep/rules/sol-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ rules:
pattern-regex: function\s+\w+\s*\(\s*([^)]*?\b\w+\s+(?!_)(?!memory\b)(?!calldata\b)(?!storage\b)(?!payable\b)\w+\s*(?=,|\)))
paths:
exclude:
- packages/contracts-bedrock/src/universal/interfaces/IOptimismMintableERC721.sol
- packages/contracts-bedrock/src/universal/interfaces/IWETH98.sol
- packages/contracts-bedrock/src/dispute/interfaces/IDelayedWETH.sol
- packages/contracts-bedrock/interfaces/universal/IOptimismMintableERC721.sol
- packages/contracts-bedrock/interfaces/universal/IWETH98.sol
- packages/contracts-bedrock/interfaces/dispute/IDelayedWETH.sol
- op-chain-ops/script/testdata/scripts/ScriptExample.s.sol
- packages/contracts-bedrock/test
- packages/contracts-bedrock/scripts/libraries/Solarray.sol
- packages/contracts-bedrock/scripts/interfaces/IGnosisSafe.sol
- packages/contracts-bedrock/src/universal/interfaces/IWETH.sol
- packages/contracts-bedrock/interfaces/universal/IWETH.sol
- packages/contracts-bedrock/src/universal/WETH98.sol
- packages/contracts-bedrock/src/L2/interfaces/ISuperchainWETH.sol
- packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol
- packages/contracts-bedrock/src/L2/SuperchainWETH.sol
- packages/contracts-bedrock/src/governance/interfaces/IGovernanceToken.sol
- packages/contracts-bedrock/interfaces/governance/IGovernanceToken.sol
- packages/contracts-bedrock/src/governance/GovernanceToken.sol

- id: sol-style-return-arg-fmt
Expand All @@ -105,13 +105,13 @@ rules:
pattern-regex: returns\s*(\w+\s*)?\(\s*([^)]*?\b\w+\s+(?!memory\b)(?!calldata\b)(?!storage\b)(?!payable\b)\w+(?<!_)\s*(?=,|\)))
paths:
exclude:
- packages/contracts-bedrock/src/dispute/interfaces/IDelayedWETH.sol
- packages/contracts-bedrock/interfaces/dispute/IDelayedWETH.sol
- op-chain-ops/script/testdata/scripts/ScriptExample.s.sol
- packages/contracts-bedrock/test/safe-tools
- packages/contracts-bedrock/scripts/libraries/Solarray.sol
- packages/contracts-bedrock/scripts/interfaces/IGnosisSafe.sol
- packages/contracts-bedrock/src/dispute/interfaces/IPermissionedDisputeGame.sol
- packages/contracts-bedrock/src/dispute/interfaces/IFaultDisputeGame.sol
- packages/contracts-bedrock/interfaces/dispute/IPermissionedDisputeGame.sol
- packages/contracts-bedrock/interfaces/dispute/IFaultDisputeGame.sol

- id: sol-style-doc-comment
languages: [solidity]
Expand Down
73 changes: 32 additions & 41 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,54 @@ Interactions within this repository are subject to a [Code of Conduct](https://g

## Development Quick Start

### Software Dependencies

| Dependency | Version | Version Check Command |
| ------------------------------------------------------------- | -------- | ------------------------ |
| [git](https://git-scm.com/) | `^2` | `git --version` |
| [go](https://go.dev/) | `^1.21` | `go version` |
| [node](https://nodejs.org/en/) | `^20` | `node --version` |
| [nvm](https://github.com/nvm-sh/nvm) | `^0.39` | `nvm --version` |
| [just](https://github.com/casey/just) | `^1.34.0`| `just --version` |
| [foundry](https://github.com/foundry-rs/foundry#installation) | `^0.2.0` | `forge --version` |
| [make](https://linux.die.net/man/1/make) | `^3` | `make --version` |
| [jq](https://github.com/jqlang/jq) | `^1.6` | `jq --version` |
| [direnv](https://direnv.net) | `^2` | `direnv --version` |
| [docker](https://docs.docker.com/get-docker/) | `^24` | `docker --version` |
| [docker compose](https://docs.docker.com/compose/install/) | `^2.23` | `docker compose version` |
### Setting Up

### Notes on Specific Dependencies
Clone the repository and open it:

#### `node`
```bash
git clone [email protected]:ethereum-optimism/optimism.git
cd optimism
```

Make sure to use the version of `node` specified within [`.nvmrc`](./.nvmrc).
You can use [`nvm`](https://github.com/nvm-sh/nvm) to manage multiple versions of Node.js on your machine and automatically switch to the correct version when you enter this repository.
### Software Dependencies

#### `foundry`
You will need to install a number of software dependencies to effectively contribute to the
Optimism Monorepo. We use [`mise`](https://mise.jdx.dev/) as a dependency manager for these tools.
Once properly installed, `mise` will provide the correct versions for each tool. `mise` does not
replace any other installations of these binaries and will only serve these binaries when you are
working inside of the `optimism` directory.

`foundry` is updated frequently and occasionally contains breaking changes.
This repository pins a specific version of `foundry` inside of [`versions.json`](./versions.json).
Use the command `just update-foundry` at the root of the monorepo to make sure that your version of `foundry` is the same as the one currently being used in CI.
#### Install `mise`

#### `direnv`
Install `mise` by following the instructions provided on the
[Getting Started page](https://mise.jdx.dev/getting-started.html#_1-install-mise-cli).

[`direnv`](https://direnv.net) is a tool used to load environment variables from [`.envrc`](./.envrc) into your shell so you don't have to manually export variables every time you want to use them.
`direnv` only has access to files that you explicitly allow it to see.
After [installing `direnv`](https://direnv.net/docs/installation.html), you will need to **make sure that [`direnv` is hooked into your shell](https://direnv.net/docs/hook.html)**.
Make sure you've followed [the guide on the `direnv` website](https://direnv.net/docs/hook.html), then **close your terminal and reopen it** so that the changes take effect (or `source` your config file if you know how to do that).
#### Trust the `mise.toml` file

#### `docker compose`
`mise` requires that you explicitly trust the `mise.toml` file which lists the dependencies that
this repository uses. After you've installed `mise` you'll be able to trust the file via:

[Docker Desktop](https://docs.docker.com/get-docker/) should come with `docker compose` installed by default.
You'll have to install the `compose` plugin if you're not using Docker Desktop or you're on linux.
```bash
mise trust mise.toml
```

### Setting Up
#### Install dependencies

Clone the repository and open it:
Use `mise` to install the correct versions for all of the required tools:

```bash
git clone [email protected]:ethereum-optimism/optimism.git
cd optimism
mise install
```

### Building the Monorepo
#### Installing updates

Make sure that you've installed all of the required [Software Dependencies](#software-dependencies) before you continue.
You will need [foundry](https://github.com/foundry-rs/foundry) to build the smart contracts found within this repository.
Refer to the note on [foundry as a dependency](#foundry) for instructions.
`mise` will notify you if any dependencies are outdated. Simply run `mise install` again to install
the latest versions of the dependencies if you receive these notifications.

### Building the Monorepo

Install dependencies and build all packages within the monorepo by running:
You must install all of the required [Software Dependencies](#software-dependencies) to build the
Optimism Monorepo. Once you've done so, run the following command to build:

```bash
make build
Expand All @@ -88,7 +79,7 @@ Use the above command to rebuild the monorepo.

### Running tests

Before running tests: **follow the above instructions to get everything built.**
Before running tests: **follow the above instructions to get everything built**.

#### Running unit tests (solidity)

Expand Down
26 changes: 9 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# provide JUSTFLAGS for just-backed targets
include ./just/flags.mk

COMPOSEFLAGS=-d
ITESTS_L2_HOST=http://localhost:9545
BEDROCK_TAGS_REMOTE?=origin
Expand Down Expand Up @@ -94,7 +97,7 @@ submodules: ## Updates git submodules


op-node: ## Builds op-node binary
make -C ./op-node op-node
just $(JUSTFLAGS) ./op-node/op-node
.PHONY: op-node

generate-mocks-op-node: ## Generates mocks for op-node
Expand All @@ -106,11 +109,11 @@ generate-mocks-op-service: ## Generates mocks for op-service
.PHONY: generate-mocks-op-service

op-batcher: ## Builds op-batcher binary
make -C ./op-batcher op-batcher
just $(JUSTFLAGS) ./op-batcher/op-batcher
.PHONY: op-batcher

op-proposer: ## Builds op-proposer binary
make -C ./op-proposer op-proposer
just $(JUSTFLAGS) ./op-proposer/op-proposer
.PHONY: op-proposer

op-challenger: ## Builds op-challenger binary
Expand Down Expand Up @@ -147,8 +150,8 @@ cannon-prestate: op-program cannon ## Generates prestate using cannon and op-pro
mv op-program/bin/0.json op-program/bin/prestate-proof.json
.PHONY: cannon-prestate

cannon-prestate-mt: op-program cannon ## Generates prestate using cannon and op-program in the multithreaded cannon format
./cannon/bin/cannon load-elf --type multithreaded --path op-program/bin/op-program-client.elf --out op-program/bin/prestate-mt.bin.gz --meta op-program/bin/meta-mt.json
cannon-prestate-mt: op-program cannon ## Generates prestate using cannon and op-program in the multithreaded64 cannon format
./cannon/bin/cannon load-elf --type multithreaded64 --path op-program/bin/op-program-client64.elf --out op-program/bin/prestate-mt.bin.gz --meta op-program/bin/meta-mt.json
./cannon/bin/cannon run --proof-at '=0' --stop-at '=1' --input op-program/bin/prestate-mt.bin.gz --meta op-program/bin/meta-mt.json --proof-fmt 'op-program/bin/%d-mt.json' --output ""
mv op-program/bin/0-mt.json op-program/bin/prestate-proof-mt.json
.PHONY: cannon-prestate-mt
Expand All @@ -173,9 +176,6 @@ nuke: clean devnet-clean ## Completely clean the project directory

## Prepares for running a local devnet
pre-devnet: submodules $(DEVNET_CANNON_PRESTATE_FILES)
@if ! [ -x "$$(command -v geth)" ]; then \
make install-geth; \
fi
@if ! [ -x "$$(command -v eth2-testnet-genesis)" ]; then \
make install-eth2-testnet-genesis; \
fi
Expand Down Expand Up @@ -247,14 +247,6 @@ update-op-geth: ## Updates the Geth version used in the project
./ops/scripts/update-op-geth.py
.PHONY: update-op-geth

install-geth: ## Installs or updates Geth if versions do not match
./ops/scripts/geth-version-checker.sh && \
(echo "Geth versions match, not installing geth..."; true) || \
(echo "Versions do not match, installing geth!"; \
go install -v github.com/ethereum/go-ethereum/cmd/geth@$(shell jq -r .geth < versions.json); \
echo "Installed geth!"; true)
.PHONY: install-geth

install-eth2-testnet-genesis:
go install -v github.com/protolambda/eth2-testnet-genesis@$(shell jq -r .eth2_testnet_genesis < versions.json)
go install -v github.com/protolambda/eth2-testnet-genesis@v$(shell yq '.tools."go:github.com/protolambda/eth2-testnet-genesis"' mise.toml)
.PHONY: install-eth2-testnet-genesis
4 changes: 2 additions & 2 deletions cannon/mipsevm/exec/mips_instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func SignExtendImmediate(insn uint32) Word {

func assertMips64(insn uint32) {
if arch.IsMips32 {
panic(fmt.Sprintf("invalid instruction: %x", insn))
panic(fmt.Sprintf("invalid instruction: 0x%08x", insn))
}
}

Expand Down Expand Up @@ -327,7 +327,7 @@ func ExecuteMipsInstruction(insn uint32, opcode uint32, fun uint32, rs, rt, mem
assertMips64(insn)
return Word(int64(rt) >> (((insn >> 6) & 0x1f) + 32))
default:
panic(fmt.Sprintf("invalid instruction: %x", insn))
panic(fmt.Sprintf("invalid instruction: 0x%08x", insn))
}
} else {
switch opcode {
Expand Down
Loading

0 comments on commit 7a08076

Please sign in to comment.