Skip to content

Commit

Permalink
Merge pull request #88 from defi-wonderland/fix/crosschain-merge-conf…
Browse files Browse the repository at this point in the history
…licts

fix: crosschain merge conflicts
  • Loading branch information
agusduha authored Oct 8, 2024
2 parents 10038c3 + ab1e074 commit a79bf4e
Show file tree
Hide file tree
Showing 216 changed files with 2,511 additions and 2,536 deletions.
76 changes: 62 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ jobs:
condition: <<parameters.notify>>
steps:
- notify-failures-on-develop:
mentions: "@proofs-squad"
mentions: "@proofs-team"

cannon-build-test-vectors:
docker:
Expand Down Expand Up @@ -302,6 +302,28 @@ jobs:
- ".devnet-mt-cannon"
- notify-failures-on-develop

check-kontrol-build:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
resource_class: xlarge
steps:
- checkout
- attach_workspace: { at: "." }
- install-contracts-dependencies
- check-changed:
patterns: contracts-bedrock
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Run Kontrol build
command: just kontrol-summary-full
working_directory: packages/contracts-bedrock
- run:
name: Build Kontrol summary files
command: forge build ./test/kontrol/proofs
working_directory: packages/contracts-bedrock
- notify-failures-on-develop

docker-build:
environment:
DOCKER_BUILDKIT: 1
Expand Down Expand Up @@ -594,6 +616,10 @@ jobs:
description: Timeout for running tests
type: string
default: 15m
test_profile:
description: Profile to use for testing
type: string
default: ci
parallelism: <<parameters.test_parallelism>>
steps:
- checkout
Expand Down Expand Up @@ -641,11 +667,9 @@ jobs:
TEST_FILES=$(echo "$TEST_FILES" | circleci tests split --split-by=timings)
TEST_FILES=$(echo "$TEST_FILES" | sed 's|^test/||')
MATCH_PATH="./test/{$(echo "$TEST_FILES" | paste -sd "," -)}"
export FOUNDRY_INVARIANT_RUNS=<<parameters.test_invariant_runs>>
export FOUNDRY_INVARIANT_DEPTH=<<parameters.test_invariant_depth>>
forge test --deny-warnings --fuzz-runs <<parameters.test_fuzz_runs>> --match-path "$MATCH_PATH"
forge test --match-path "$MATCH_PATH"
environment:
FOUNDRY_PROFILE: ci
FOUNDRY_PROFILE: <<parameters.test_profile>>
working_directory: packages/contracts-bedrock
no_output_timeout: <<parameters.test_timeout>>
- run:
Expand Down Expand Up @@ -697,6 +721,8 @@ jobs:
command: interfaces-check-no-build
- run-contracts-check:
command: size-check
- run-contracts-check:
command: unused-imports-check-no-build

contracts-bedrock-validate-spacers:
docker:
Expand Down Expand Up @@ -868,9 +894,14 @@ jobs:
module:
description: Go Module Name
type: string
uses_artifacts:
description: Uses contract artifacts
type: boolean
default: false
docker:
- image: <<pipeline.parameters.ci_builder_image>>
resource_class: xlarge
circleci_ip_ranges: true
steps:
- checkout
- restore_cache:
Expand All @@ -881,6 +912,10 @@ jobs:
keys:
- golang-build-cache-test-<<parameters.module>>-{{ checksum "go.sum" }}
- golang-build-cache-test-
- when:
condition: <<parameters.uses_artifacts>>
steps:
- attach_workspace: { at: "." }
- run:
name: Install components
command: |
Expand All @@ -892,7 +927,7 @@ jobs:
- run:
name: run tests
command: |
gotestsum --format=testname --junitfile=/tmp/test-results/<<parameters.module>>.xml --jsonfile=/tmp/testlogs/log.json \
ENABLE_ANVIL=true SEPOLIA_RPC_URL="https://ci-sepolia-l1.optimism.io" gotestsum --format=testname --junitfile=/tmp/test-results/<<parameters.module>>.xml --jsonfile=/tmp/testlogs/log.json \
-- -parallel=8 -coverpkg=github.com/ethereum-optimism/optimism/... -coverprofile=coverage.out ./...
working_directory: <<parameters.module>>
- save_cache:
Expand Down Expand Up @@ -1109,7 +1144,7 @@ jobs:
exit 1
fi
- notify-failures-on-develop:
mentions: "@proofs-squad"
mentions: "@proofs-team"

cannon-stf-verify:
docker:
Expand Down Expand Up @@ -1144,6 +1179,9 @@ jobs:
diff_branch:
type: string
default: develop
scan_command:
type: string
default: semgrep ci --timeout=100
environment:
TEMPORARY_BASELINE_REF: << parameters.diff_branch >>
SEMGREP_REPO_URL: << pipeline.project.git_url >>
Expand Down Expand Up @@ -1175,7 +1213,7 @@ jobs:
# --timeout (in seconds) limits the time per rule and file.
# SEMGREP_TIMEOUT is the same, but docs have conflicting defaults (5s in CLI flag, 1800 in some places)
# https://semgrep.dev/docs/troubleshooting/semgrep-app#if-the-job-is-aborted-due-to-taking-too-long
command: semgrep ci --timeout=100
command: << parameters.scan_command >>
# If semgrep hangs, stop the scan after 20m, to prevent a useless 5h job
no_output_timeout: 20m
- notify-failures-on-develop
Expand Down Expand Up @@ -1233,7 +1271,7 @@ jobs:
make verify-sepolia
working_directory: op-program
- notify-failures-on-develop:
mentions: "@proofs-squad"
mentions: "@proofs-team"

op-program-compat:
docker:
Expand Down Expand Up @@ -1354,6 +1392,9 @@ workflows:
- contracts-bedrock-build:
# Build with just core + script contracts.
skip_pattern: test
- check-kontrol-build:
requires:
- contracts-bedrock-build
- contracts-bedrock-tests:
# Test everything except PreimageOracle.t.sol since it's slow.
name: contracts-bedrock-tests
Expand All @@ -1370,9 +1411,7 @@ workflows:
test_parallelism: 1
test_list: git diff origin/develop...HEAD --name-only -- './test/**/*.t.sol' | sed 's|packages/contracts-bedrock/||'
test_timeout: 1h
test_fuzz_runs: 10000
test_invariant_runs: 128
test_invariant_depth: 512
test_profile: ciheavy
- contracts-bedrock-coverage
- contracts-bedrock-checks:
requires:
Expand All @@ -1381,6 +1420,9 @@ workflows:
requires:
- contracts-bedrock-build
- semgrep-scan
- semgrep-scan:
name: semgrep-scan-local
scan_command: semgrep scan --timeout=100 --config=./.semgrep --error .
- go-lint:
requires:
- go-mod-download
Expand Down Expand Up @@ -1416,7 +1458,6 @@ workflows:
parameters:
module:
- op-batcher
- op-chain-ops
- op-node
- op-proposer
- op-challenger
Expand All @@ -1428,6 +1469,13 @@ workflows:
- go-test:
name: semver-natspec-tests
module: packages/contracts-bedrock/scripts/checks/semver-natspec
- go-test:
name: op-chain-ops-tests
module: op-chain-ops
uses_artifacts: true
requires:
- go-mod-download
- contracts-bedrock-build
- go-test-kurtosis:
name: op-chain-ops-integration
module: op-chain-ops
Expand Down Expand Up @@ -1680,7 +1728,7 @@ workflows:
target: test-cannon
parallelism: 8
notify: true
mentions: "@proofs-squad"
mentions: "@proofs-team"
requires:
- contracts-bedrock-build
- cannon-prestate
Expand Down
83 changes: 83 additions & 0 deletions .semgrep/sol-rules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
rules:
- id: sol-safety-deployutils-args
languages: [solidity]
severity: ERROR
message: _args parameter should be wrapped with DeployUtils.encodeConstructor
pattern-regex: DeployUtils\.(create1|create2|create1AndSave|create2AndSave)\s*\(\s*\{[^}]*?_args\s*:\s*(?!\s*DeployUtils\.encodeConstructor\()\s*[^}]*?\}\s*\)

- id: sol-style-input-arg-fmt
languages: [solidity]
severity: ERROR
message: Named inputs to functions must be prepended with an underscore
pattern-regex: function\s+\w+\s*\(\s*([^)]*?\b\w+\s+(?!_)(?!memory\b)(?!calldata\b)(?!storage\b)(?!payable\b)\w+\s*(?=,|\)))
paths:
exclude:
- op-chain-ops/script/testdata/scripts/ScriptExample.s.sol
- 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/src/universal/WETH98.sol
- packages/contracts-bedrock/src/L2/interfaces/ISuperchainWETH.sol
- packages/contracts-bedrock/src/L2/SuperchainWETH.sol
- packages/contracts-bedrock/src/governance/interfaces/IGovernanceToken.sol
- packages/contracts-bedrock/src/governance/GovernanceToken.sol

- id: sol-style-return-arg-fmt
languages: [solidity]
severity: ERROR
message: Named return arguments to functions must be appended with an underscore
pattern-regex: returns\s*(\w+\s*)?\(\s*([^)]*?\b\w+\s+(?!memory\b)(?!calldata\b)(?!storage\b)(?!payable\b)\w+(?<!_)\s*(?=,|\)))
paths:
exclude:
- op-chain-ops/script/testdata/scripts/ScriptExample.s.sol
- 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

- id: sol-style-doc-comment
languages: [solidity]
severity: ERROR
message: Javadoc-style comments are not allowed, use `///` style doc comments instead
pattern-regex: (\/\*\*\n(\s+\*\s.*\n)+\s+\*\/)

- id: sol-expectrevert-no-args
languages: [solidity]
severity: ERROR
message: vm.expectRevert() must specify the revert reason
patterns:
- pattern: vm.expectRevert()

- id: sol-style-malformed-require
languages: [solidity]
severity: ERROR
message: Require statement style is malformed
patterns:
- pattern: require(..., $ERR);
- pattern-not: require($ERR);
- focus-metavariable: $ERR
- pattern-not-regex: \"(\w+:\s[^"]+)\"
- pattern-not-regex: string\.concat\(\"(\w+:\s[^"]+)\"\,[^"]+\)
- pattern-not-regex: \"([a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+)\"
- pattern-not-regex: \"([a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+)\"
paths:
exclude:
- packages/contracts-bedrock/src/libraries/Bytes.sol
- packages/contracts-bedrock/src/legacy/LegacyMintableERC20.sol
- packages/contracts-bedrock/src/cannon/MIPS.sol
- packages/contracts-bedrock/src/cannon/MIPS2.sol
- packages/contracts-bedrock/src/cannon/libraries/MIPSMemory.sol
- packages/contracts-bedrock/src/cannon/libraries/MIPSInstructions.sol

- id: sol-style-malformed-revert
languages: [solidity]
severity: ERROR
message: Revert statement style is malformed
patterns:
- pattern: revert($MSG);
- pattern-not: revert $ERR(...);
- focus-metavariable: $MSG
- pattern-not-regex: \"(\w+:\s[^"]+)\"
paths:
exclude:
- packages/contracts-bedrock/src/cannon/libraries/MIPSInstructions.sol
27 changes: 1 addition & 26 deletions .semgrepignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vendor/
*.min.js

# Common test paths
# TODO: Tests should conform to semgrep too.
test/
tests/

Expand All @@ -17,29 +18,3 @@ tests/

# Semgrep-action log folder
.semgrep_logs/

op-chain-ops/script/testdata
op-chain-ops/script/testdata/scripts/ScriptExample.s.sol

packages/*/node_modules
packages/*/test

# TODO: Define these exclusions inside of the semgrep rules once those rules
# are all defined locally in the repository instead of the semgrep app.

# Contracts: autogenerated solidity library
packages/contracts-bedrock/scripts/libraries/Solarray.sol

# Contracts: vendor interfaces
packages/contracts-bedrock/scripts/interfaces/IGnosisSafe.sol
packages/contracts-bedrock/src/EAS/

# Contracts: deliberate exclusions
packages/contracts-bedrock/src/universal/WETH98.sol
packages/contracts-bedrock/src/universal/interfaces/IWETH.sol
packages/contracts-bedrock/src/L2/SuperchainWETH.sol
packages/contracts-bedrock/src/L2/interfaces/ISuperchainWETH.sol
packages/contracts-bedrock/src/governance/GovernanceToken.sol
packages/contracts-bedrock/src/governance/interfaces/IGovernanceToken.sol
packages/contracts-bedrock/src/dispute/interfaces/IFaultDisputeGame.sol
packages/contracts-bedrock/src/dispute/interfaces/IPermissionedDisputeGame.sol
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ Also, all labels can be seen by visiting the [labels page][labels]

When altering label names or deleting labels there are a few things you must be aware of.

- This may affect the mergify bot's use of labels. See the [mergify config](.github/mergify.yml).
- If the https://github.com/ethereum-optimism/optimism/labels/S-stale label is altered, the [close-stale](.github/workflows/close-stale.yml) workflow should be updated.
- If the https://github.com/ethereum-optimism/optimism/labels/M-dependabot label is altered, the [dependabot config](.github/dependabot.yml) file should be adjusted.
- Saved label filters for project boards will not automatically update. These should be updated if label names change.
Expand Down
8 changes: 4 additions & 4 deletions bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,7 @@ def devnet_deploy(paths):
wait_for_rpc_server('127.0.0.1:9545')

# Print out the addresses being used for easier debugging.
l2_output_oracle = addresses['L2OutputOracleProxy']
dispute_game_factory = addresses['DisputeGameFactoryProxy']
batch_inbox_address = rollup_config['batch_inbox_address']
log.info(f'Using L2OutputOracle {l2_output_oracle}')
log.info(f'Using DisputeGameFactory {dispute_game_factory}')
log.info(f'Using batch inbox {batch_inbox_address}')

# Set up the base docker environment.
Expand All @@ -264,7 +260,11 @@ def devnet_deploy(paths):
# Must be done selectively because op-proposer throws if both are set.
if DEVNET_L2OO:
docker_env['L2OO_ADDRESS'] = l2_output_oracle
l2_output_oracle = addresses['L2OutputOracleProxy']
log.info(f'Using L2OutputOracle {l2_output_oracle}')
else:
dispute_game_factory = addresses['DisputeGameFactoryProxy']
log.info(f'Using DisputeGameFactory {dispute_game_factory}')
docker_env['DGF_ADDRESS'] = dispute_game_factory
docker_env['DG_TYPE'] = '254'
docker_env['PROPOSAL_INTERVAL'] = '12s'
Expand Down
4 changes: 2 additions & 2 deletions cannon/Dockerfile.diff
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ COPY --from=cannon-v2 /usr/local/bin/cannon /usr/local/bin/cannon-v2
# verify the latest singlethreaded VM behavior against cannon-v2
RUN cd cannon && make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2
RUN --mount=type=cache,target=/root/.cache/go-build cd cannon && \
make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2 \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2 \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
2 changes: 1 addition & 1 deletion cannon/cmd/load_elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/ethereum-optimism/optimism/cannon/mipsevm/program"
"github.com/ethereum-optimism/optimism/cannon/mipsevm/singlethreaded"
"github.com/ethereum-optimism/optimism/cannon/mipsevm/versions"
"github.com/ethereum-optimism/optimism/cannon/serialize"
openum "github.com/ethereum-optimism/optimism/op-service/enum"
"github.com/ethereum-optimism/optimism/op-service/ioutil"
"github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/ethereum-optimism/optimism/op-service/serialize"
)

var (
Expand Down
Loading

0 comments on commit a79bf4e

Please sign in to comment.