Skip to content

Comments

Experimental monorepo v2#2530

Closed
protolambda wants to merge 632 commits intodevelopfrom
experimental-monorepo-v2
Closed

Experimental monorepo v2#2530
protolambda wants to merge 632 commits intodevelopfrom
experimental-monorepo-v2

Conversation

@protolambda
Copy link
Contributor

@protolambda protolambda commented May 2, 2022

This merges https://github.com/ethereum-optimism/optimistic-specs/ into the monorepo, based on top of the work in #2524 (feat/go-workspaces v2) following this script to create all the contents: https://gist.github.com/protolambda/f7ef526d37a756bdb168de17a920c10b

This:

  • preserves the specs git history
  • moves the specs into 3 go modules: ope2e (previously opnode/test), l2os, opnode, all added to the monorepo go workspace
  • moves the contracts into packages/bedrock-contracts
  • moves the integration tests into packages/bedrock-integration-tests
  • moves the ops into bedrock-ops
  • moves the specs into specs
  • moves the meta into meta
  • updates the README.md with new structure description
  • leaves any unmerged specs things in ./protocol, to be refactored/unified with other files. These are primarily configs and CI things.

The idea here is that by merging the git history, we preserve git-blame and can easily merge any future/unmerged specs changes into the monorepo without having to copy-paste the contents.

Over time we should enable more of the specs-repo functionality that is merged into the monorepo by integrating and re-enabling CI, devnet, etc. things.

This is a draft based on discussion with @mslipper

mslipper and others added 30 commits March 19, 2022 19:12
Includes the following:

- A docker-compose setup with Dockerfiles for each service. The reference Geth implementation pulls an image from my personal repo for now. We can switch this out once we get CI running there.
- An exponential backoff library, which is then used to retry connections to the L1/L2 provider on node startup. This prevents the opnode from crashing on startup due to the L1/L2 taking a while to start in Docker.
- A fix for one of the CLI falgs - `--batchsubmitter.key` was specified as a boolean.
- Make tasks to build the docker-compose setup, and clean it up.

Fixes #259
We haven't been running those for a while, and someone did ask me about it. Let's add it back when we actually start doing them again.
This better handles the fork choice update in the rollup node, exposes the fork choice method throughout,
cleans up the L2 Engine API interface, and random aspects of block creation.

The l2.Source is the Ethereum client wrapper for the L2 execution engine. It directly wraps some block accessing methods (like BlockByNumber and BlockByHash). It also wraps raw RPC calls to create a golang interface for the Engine API (newBlock, forkchoiceUpdated, getPayload).

This PR also pulls out the ethclient initialization loop into a standalone function.
This makes the following changes:

1. Flatten the L1 & L2 source into one object that fulfills several interfaces (primarily the BlockReference)
2. Place the L1Range function in the L1 Source (removed from sync package)
3. Provide FindSyncStart with the L2 block to use
- var -> const (+ removing som extra copies)
- Rename BlockPreparer interface to Engine
- Remove out of date comment and update safe block
ref impl: Flatten sources & Cleanup Sync Start
…type, sanity-check receipts, use l2 block height for deposits, update specs
Primarily for easier building and linting.
The misspell linter was trying to correct `strat` to `start`. This
is typically correct, but not in this instance.
This enables the nice test ouput with `go test -v` that lists
each test without polluting the output with logs from passing tests.
Required for go version 1.18
Add opnode makefile, lints, and go1.18
opnode/rollup/derive,specs: fix / harden deposit processing
Rely on intrinisic gas (which can be computed exactly) rather than
using gas estimation.

Adds commented out code to manage the nonce manually. I think that
there was a race between gas estimation and nonce handling which
previously caused problems. If problems continue, it makes sense
to switch over to more manual nonce management.
Splits the workflow into 3 different steps which can run in parallel.
tynes and others added 19 commits April 29, 2022 18:17
* chore: copy L1 and L2 Messengers from Monorepo

* test: Add Messenger test files

Monorepo test cases are copied in as comments from the monorepo ts tests.

* chore: Add OZ upgradable contracts

New remappings were also added in order to avoid excessively

long import statements.

* chore: Importe OZ and OP contracts as node_modules

Necessary because hardhat does not support remappings!?!

y u no?

* refactor: Remove replayMessage()

We no longer need this function as it was only necessary when the CTC
a maximum gas limit per epoch concept. In order to remove the function
I had to copy in the L1xDM interface rather than import from the
node_modules.

* chore: Remove unused files

The ts test file is made redundant by an itest in the itest package.
The sol test file was not being used for anything

* refactor: Remove Address Manager and Resolver

Instead the CTC and SCC are state variables

* refactor: Replace CTC with OptimismPortal

* refactor: Remove SCC

We don't need to replace it with the L2OutputOracle in the L1xDM,
because the verification is now done in the OptimismPortal itself.

* forge install: forge-std

* forge install: ds-test

* refactor: Move boilerplate test code into CommonTest

* test: Add sendMessage and pause tests for L1xDM

* test: L1CrossDomainMessenger sendMessage and pause

* refactor: replace L2ToL1MessagePasser with Withdrawer contract

Also adds a lib with constant values for new bedrock predeploys.

* chore: Make functions external, and reorder for CEI

For whatever reason a bunch of functions on the messengers were public,
when they could have been external. I fixed that, and removed the
slither annotations. Where possible (in the sendMessage functions), I
also reordered the events and calls to respect
Checks-Effects-Interactions. There was no risk previously, but this
removes any question, and quiets slither.

* refactor: Reorganize ts helpers

Move helpers/index into utils.ts, and add other files which are exported in

the new index.ts.

* test: Add mock proof generation script and helpers

* test: Add L1xDM relayMessageSucceeds tests

* test: Add proof generation scripts and helpers

* refactor: Add l2Sender check in L2xDM

* refactor: Copy in the L1 and L2 standard bridge

At this point they are simply verbatim.

* refactor: Bridges - fix import paths

* refactor: Token Bridge - replace messengers with Portal
Also remove the CrossDomainEnabled lib.

refactor: Token Bridge - replace messengers with Portal
Also remove the CrossDomainEnabled lib.

* style: Address/remove some slither disable comments

style: Address/remove some slither disable comments

* refactor: extract l2Sender check into a modifier

* refactor: Support deposits of ETH in L2 Bridge

This copies in the IL2ERC20Bridge interface so that payable can be added.

In the case that the L2 token address matches OVM_ETH, the value of the

call will be forwarded.

* interface: add IWithdrawer.sol

* contracts: add comments to L1 contracts

* contracts: use unchecked

* contracts: fix imports in common test

* test: L1CrossDomainMessenger

* test: L2CrossDomainMessenger

* contracts: fix typo

* tests: bridge tests

* contracts: remove extra message assignment

* contracts: update gas snapshot

* forge install: solmate

* contracts: remove usage of OVM_ETH

All `OVM_ETH` will be migrated to `ETH` with the upgrade
to bedrock. We do not want to allow for the creation of new
`OVM_ETH` by depositing `ETH` into the bridge and have it
create `OVM_ETH` on L2.

* contracts: add in L2StandardERC20

* contracts: add in token factory

The token factory will deploy tokens on L2
that correspond to tokens on L1. This allows for
easy deposits through the bridge.

* contracts: test rlp lib for computing contract addrs

This library lets you compute the contract address
based on the deployment account and nonce.

h/t @t11s

* contracts: test infra for bridge

* contracts: add note to self

* contracts: fix compiler warnings

* contracts: update snapshot

* contracts: add IDepositFeed

* contracts: type cast uint256 to uint64 in messenger

* test: fix merge

* contracts: modify paths to compile with hardhat

* hardhat: update config

* contracts: fix build

* forge tests: first yarn install

* contracts: lint

* contracts: update snapshot

Co-authored-by: Maurelian <maurelian@protonmail.ch>
- Adopts Go workspaces for future compatibility with the Bedrock move into the monorepo
- Moves Go packages to the root of the repo in order to fix import paths
- Rewrites existing Go import paths
- Removes Stackman, since it's not needed anymore
Use `abi.encode` instead of `abi.encodePacked` to ensure
a constant serialization. `abi.encode` will be sure to
pad the value to its size while `abi.encodePacked` will not
when operating on integers. There should not have been a bug here
because it was being called with a `bytes32`, which should
always be 32 bytes when returned from `abi.encodePacked`.
@changeset-bot
Copy link

changeset-bot bot commented May 2, 2022

⚠️ No Changeset found

Latest commit: 7b91481

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mergify
Copy link
Contributor

mergify bot commented May 2, 2022

This PR changes implementation code, but doesn't include a changeset. Did you forget to add one?

@mergify mergify bot requested review from cfromknecht and mslipper May 2, 2022 15:02
@github-actions github-actions bot added 2-reviewers A-cannon Area: cannon A-ops Area: ops labels May 2, 2022
@mergify
Copy link
Contributor

mergify bot commented May 2, 2022

Hey @protolambda! This PR has merge conflicts. Please fix them before continuing review.

@mergify mergify bot added the conflict label May 2, 2022
@mslipper mslipper closed this May 15, 2022
theochap pushed a commit that referenced this pull request Dec 10, 2025
## Overview

Adds some simple metrics for the sequencer state to `kona-node-service`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cannon Area: cannon A-ops Area: ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants