Skip to content

Commit

Permalink
Merge branch 'develop' into sc/superchain-erc20
Browse files Browse the repository at this point in the history
  • Loading branch information
agusduha committed Aug 8, 2024
2 parents eac9884 + 2f295d0 commit 97e08de
Show file tree
Hide file tree
Showing 38 changed files with 529 additions and 4,092 deletions.
25 changes: 15 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ jobs:
# We do not use the pre-built contracts becuase forge coverage uses different optimizer settings
- run:
name: test and generate coverage
command: pnpm coverage:lcov
command: just coverage-lcov
no_output_timeout: 18m
environment:
FOUNDRY_PROFILE: ci
Expand Down Expand Up @@ -556,7 +556,7 @@ jobs:
working_directory: packages/contracts-bedrock
- run:
name: run tests
command: pnpm test
command: just test
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
Expand Down Expand Up @@ -602,36 +602,36 @@ jobs:
# Semver lock must come second because one of the later steps may modify the cache & force a contracts rebuild.
name: semver lock
command: |
pnpm semver-lock
just semver-lock
git diff --exit-code semver-lock.json || echo "export SEMVER_LOCK_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: check deploy configs
command: pnpm validate-deploy-configs || echo "export DEPLOY_CONFIGS_STATUS=1" >> "$BASH_ENV"
command: just validate-deploy-configs || echo "export DEPLOY_CONFIGS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: lint
command: |
pnpm lint:check || echo "export LINT_STATUS=1" >> "$BASH_ENV"
just lint-check || echo "export LINT_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: gas snapshot
command: |
pnpm gas-snapshot --check || echo "export GAS_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
just gas-snapshot-check || echo "export GAS_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
no_output_timeout: 15m
- run:
name: invariant docs
command: |
pnpm autogen:invariant-docs
just autogen-invariant-docs
git diff --exit-code ./invariant-docs/*.md || echo "export INVARIANT_DOCS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: snapshots
command: |
pnpm snapshots:check || echo "export SNAPSHOTS_STATUS=1" >> "$BASH_ENV"
just snapshots-check || echo "export SNAPSHOTS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: size check
Expand Down Expand Up @@ -697,7 +697,7 @@ jobs:
patterns: contracts-bedrock
- run:
name: validate spacers
command: pnpm validate-spacers
command: just validate-spacers
working_directory: packages/contracts-bedrock

todo-issues:
Expand Down Expand Up @@ -1162,6 +1162,11 @@ jobs:
command: |
nvm install
nvm use && node --version && npm --version
- run:
name: Install Just
command: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/bin
echo 'export PATH="${PATH}:$HOME/bin"' >> $BASH_ENV
- run:
name: Install pnpm
command: |
Expand Down Expand Up @@ -1491,7 +1496,7 @@ jobs:
docker_layer_caching: true
- run:
name: Run Kontrol Tests
command: pnpm test:kontrol
command: just test-kontrol
working_directory: ./packages/contracts-bedrock
- store_artifacts:
path: ./packages/contracts-bedrock/test/kontrol/logs/kontrol-results_latest.tar.gz
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v4

# Workaround to prevent slither-action from trying to install JS deps.
# Without this step, it detects the `package.json`, and since there is no
# lockfile it defaults `npm install` which fails due to the preinstall
# script to enforce pnpm. https://github.com/crytic/slither-action/issues/44#issuecomment-1338183656
- name: Remove package.json
run: rm packages/contracts-bedrock/package.json

- name: Run Slither
uses: crytic/[email protected]
id: slither
Expand Down
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,11 @@ reproducible-prestate: ## Builds reproducible-prestate binary
make -C ./op-program reproducible-prestate
.PHONY: reproducible-prestate

# Checks if prestate outputs are missing
cannon-prestate: op-program/bin/prestate-proof.json
.PHONY: cannon-prestate

op-program/bin/prestate-proof.json:
make generate-cannon-prestates

generate-cannon-prestates: op-program cannon ## Generates prestate using cannon and op-program
cannon-prestate: op-program cannon ## Generates prestate using cannon and op-program
./cannon/bin/cannon load-elf --path op-program/bin/op-program-client.elf --out op-program/bin/prestate.json --meta op-program/bin/meta.json
./cannon/bin/cannon run --proof-at '=0' --stop-at '=1' --input op-program/bin/prestate.json --meta op-program/bin/meta.json --proof-fmt 'op-program/bin/%d.json' --output ""
mv op-program/bin/0.json op-program/bin/prestate-proof.json
.PHONY: generate-cannon-prestates
.PHONY: cannon-prestate

mod-tidy: ## Cleans up unused dependencies in Go modules
# Below GOPRIVATE line allows mod-tidy to be run immediately after
Expand All @@ -167,14 +160,16 @@ nuke: clean devnet-clean ## Completely clean the project directory
git clean -Xdf
.PHONY: nuke

## Prepares for running a local devnet
pre-devnet: submodules cannon-prestate
pre-devnet: submodules ## Prepares for running a local devnet
@if ! [ -x "$(command -v geth)" ]; then \
make install-geth; \
fi
@if ! [ -x "$(command -v eth2-testnet-genesis)" ]; then \
make install-eth2-testnet-genesis; \
fi
@if [ ! -e op-program/bin ]; then \
make cannon-prestate; \
fi
.PHONY: pre-devnet

devnet-up: pre-devnet ## Starts the local devnet
Expand Down
14 changes: 7 additions & 7 deletions op-batcher/batcher/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ func (l *BatchSubmitter) StartBatchSubmitting() error {
l.clearState(l.shutdownCtx)
l.lastStoredBlock = eth.BlockID{}

if l.Config.WaitNodeSync {
err := l.waitNodeSync()
if err != nil {
return fmt.Errorf("error waiting for node sync: %w", err)
}
}

l.wg.Add(1)
go l.loop()

Expand Down Expand Up @@ -289,13 +296,6 @@ const (

func (l *BatchSubmitter) loop() {
defer l.wg.Done()
if l.Config.WaitNodeSync {
err := l.waitNodeSync()
if err != nil {
l.Log.Error("Error waiting for node sync", "err", err)
return
}
}

receiptsCh := make(chan txmgr.TxReceipt[txRef])
queue := txmgr.NewQueue[txRef](l.killCtx, l.Txmgr, l.Config.MaxPendingTransactions)
Expand Down
34 changes: 6 additions & 28 deletions op-e2e/actions/dencun_fork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ func TestDencunL1ForkAfterGenesis(gt *testing.T) {
func TestDencunL1ForkAtGenesis(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
offset := hexutil.Uint64(0)
dp.DeployConfig.L1CancunTimeOffset = &offset
require.Zero(t, *dp.DeployConfig.L1CancunTimeOffset)
sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
_, _, miner, sequencer, _, verifier, _, batcher := setupReorgTestActors(t, dp, sd, log)
Expand Down Expand Up @@ -120,14 +119,13 @@ func verifyEcotoneBlock(gt *testing.T, header *types.Header) {
func TestDencunL2ForkAfterGenesis(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)

cancunOffset := hexutil.Uint64(0)
dp.DeployConfig.L1CancunTimeOffset = &cancunOffset
require.Zero(t, *dp.DeployConfig.L1CancunTimeOffset)
// This test wil fork on the second block
offset := hexutil.Uint64(dp.DeployConfig.L2BlockTime * 2)
dp.DeployConfig.L2GenesisCanyonTimeOffset = &offset
dp.DeployConfig.L2GenesisDeltaTimeOffset = &offset
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &offset
dp.DeployConfig.L2GenesisFjordTimeOffset = nil
dp.DeployConfig.L2GenesisGraniteTimeOffset = nil
// New forks have to be added here, after changing the default deploy config!

sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
Expand Down Expand Up @@ -159,12 +157,7 @@ func TestDencunL2ForkAfterGenesis(gt *testing.T) {
func TestDencunL2ForkAtGenesis(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
offset := hexutil.Uint64(0)
dp.DeployConfig.L2GenesisRegolithTimeOffset = &offset
dp.DeployConfig.L1CancunTimeOffset = &offset
dp.DeployConfig.L2GenesisCanyonTimeOffset = &offset
dp.DeployConfig.L2GenesisDeltaTimeOffset = &offset
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &offset
require.Zero(t, *dp.DeployConfig.L2GenesisEcotoneTimeOffset)

sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
Expand Down Expand Up @@ -202,11 +195,6 @@ func newEngine(t Testing, sd *e2eutils.SetupData, log log.Logger) *L2Engine {
func TestDencunBlobTxRPC(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
offset := hexutil.Uint64(0)
dp.DeployConfig.L2GenesisRegolithTimeOffset = &offset
dp.DeployConfig.L2GenesisCanyonTimeOffset = &offset
dp.DeployConfig.L2GenesisDeltaTimeOffset = &offset
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &offset

sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
Expand All @@ -221,11 +209,6 @@ func TestDencunBlobTxRPC(gt *testing.T) {
func TestDencunBlobTxInTxPool(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
offset := hexutil.Uint64(0)
dp.DeployConfig.L2GenesisRegolithTimeOffset = &offset
dp.DeployConfig.L2GenesisCanyonTimeOffset = &offset
dp.DeployConfig.L2GenesisDeltaTimeOffset = &offset
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &offset

sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
Expand All @@ -239,11 +222,6 @@ func TestDencunBlobTxInTxPool(gt *testing.T) {
func TestDencunBlobTxInclusion(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
offset := hexutil.Uint64(0)
dp.DeployConfig.L2GenesisRegolithTimeOffset = &offset
dp.DeployConfig.L2GenesisCanyonTimeOffset = &offset
dp.DeployConfig.L2GenesisDeltaTimeOffset = &offset
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &offset

sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
Expand Down
10 changes: 4 additions & 6 deletions op-e2e/actions/ecotone_fork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@ func verifyCodeHashMatches(t Testing, client *ethclient.Client, address common.A
func TestEcotoneNetworkUpgradeTransactions(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
genesisBlock := hexutil.Uint64(0)
ecotoneOffset := hexutil.Uint64(4)

log := testlog.Logger(t, log.LevelDebug)

dp.DeployConfig.L1CancunTimeOffset = &genesisBlock // can be removed once Cancun on L1 is the default

require.Zero(t, *dp.DeployConfig.L1CancunTimeOffset)
// Activate all forks at genesis, and schedule Ecotone the block after
dp.DeployConfig.L2GenesisRegolithTimeOffset = &genesisBlock
dp.DeployConfig.L2GenesisCanyonTimeOffset = &genesisBlock
dp.DeployConfig.L2GenesisDeltaTimeOffset = &genesisBlock
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &ecotoneOffset
dp.DeployConfig.L2GenesisFjordTimeOffset = nil
dp.DeployConfig.L2GenesisGraniteTimeOffset = nil
// New forks have to be added here...
require.NoError(t, dp.DeployConfig.Check(log), "must have valid config")

sd := e2eutils.Setup(t, dp, defaultAlloc)
Expand Down
Loading

0 comments on commit 97e08de

Please sign in to comment.