Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gwyneth base branch #14

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9f6ec98
chore: forge init
Jul 2, 2024
e73fad0
forge install: forge-std
Jul 2, 2024
17bffac
Integrate taiko simplified
Jul 2, 2024
69c8ff7
remove node_modules
Jul 2, 2024
62be7b6
remove submodule
Jul 2, 2024
e19abba
remove empty .gitmodules
Jul 2, 2024
576ddfd
make protocol buildable
Jul 2, 2024
fe73ec9
fix missing file, causing a test issue
Jul 3, 2024
af3743d
Brecht cicd changes
Jul 3, 2024
346959e
add preconf from taiko-mono helder branch
Jul 3, 2024
a66ba4d
move sequencer registry check & forge fmt
Jul 4, 2024
98cf744
first block propose test
Jul 4, 2024
54461ce
remove console logs
Jul 4, 2024
6147bfe
add some proveBlock logic
Jul 4, 2024
2b2a36e
Test proving/verifying logic
Jul 4, 2024
ef000d9
add some tests
Jul 5, 2024
3f31d5c
remove comment
Jul 5, 2024
317107c
Merge pull request #18 from taikoxyz/blockHash_or_metaHash_in_transition
adaki2004 Jul 5, 2024
4d48262
rename var
Jul 5, 2024
9c75561
Merge pull request #17 from taikoxyz/first_simple_tests
Brechtpd Jul 5, 2024
227c9e6
Add deployment manual and script
Jul 8, 2024
67b2f4b
modify comment in MockSgxVerifier
Jul 8, 2024
dffc809
change anvil to reth-based private network
Jul 9, 2024
a090c06
Change config as Kurtosis PR
Jul 9, 2024
2fe94df
typo fix
Jul 10, 2024
5ac4a0b
update readme with local reth image deployment
Jul 10, 2024
c5e2838
Update everything (except core protocol) to lates, because of deps
Jul 11, 2024
19461a0
delete some unused contracts and bring over guardian prover
Jul 12, 2024
6f2b50e
Merge pull request #20 from taikoxyz/brought_over_latest_taiko_mono
adaki2004 Jul 15, 2024
9436b97
Merge pull request #19 from taikoxyz/anvil_shootup
adaki2004 Jul 15, 2024
c35c8e6
Merge pull request #15 from taikoxyz/gwyneth_preconf_mods
adaki2004 Jul 15, 2024
8d6c287
fix deployment issues caused by taiko-mon updates
Jul 15, 2024
81d2882
Adap multi-block proposals to gwyneth
Jul 15, 2024
bf9b9b9
change readme
Jul 15, 2024
5ff912e
Merge pull request #21 from taikoxyz/multiple_l2_blocks_in_one_L1_pro…
adaki2004 Jul 16, 2024
00f713c
initial draft of brecht issue desc.
Jul 17, 2024
3abed62
remuve some unncessary parts
Jul 17, 2024
0e9a241
fix pr comments & resolve build issues
Jul 18, 2024
ca4a6e6
fix or uncomment not relevant tests
Jul 19, 2024
93c26f7
add propose block script
Jul 19, 2024
6ba3443
add makefile and install script
Jul 19, 2024
f9a69a6
add contract deployments to setup
Jul 22, 2024
dfbbb6a
update sample dotenv
Jul 22, 2024
d6079da
Merge pull request #24 from taikoxyz/gwynethV2
Brechtpd Jul 22, 2024
33a509e
add proposeblock make command
Jul 23, 2024
7f58076
add propse CI worklfow
Jul 23, 2024
fa9f982
Integrate and make contracts compiling
Jul 23, 2024
fb8381c
fix ci script
Jul 23, 2024
853e2cd
move sync-only consuem and write to XChain
Jul 24, 2024
784f613
add xtransfer and token example
Jul 25, 2024
aed907b
meeting outcomes
Jul 25, 2024
4f649b3
Merge pull request #28 from taikoxyz/modify_erc20_xchain_version_inhe…
adaki2004 Jul 25, 2024
beb7199
Merge pull request #26 from taikoxyz/incorporate_booster_sample_contr…
adaki2004 Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ concurrency:
name: bench
jobs:
iai:
runs-on:
group: Reth
runs-on: ubuntu-latest
# Only run benchmarks in merge groups and on main
if: github.event_name != 'pull_request'
steps:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ jobs:
prepare:
if: github.repository == 'paradigmxyz/reth'
timeout-minutes: 45
runs-on:
group: Reth
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: mkdir artifacts
Expand Down Expand Up @@ -178,8 +177,7 @@ jobs:
include: [frontier/]
needs: prepare
name: run
runs-on:
group: Reth
runs-on: ubuntu-latest
permissions:
issues: write
steps:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ concurrency:
jobs:
test:
name: test / ${{ matrix.network }}
runs-on:
group: Reth
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
strategy:
Expand Down Expand Up @@ -53,8 +52,7 @@ jobs:
name: sync / 100k blocks
# Only run sync tests in merge groups
if: github.event_name == 'merge_group'
runs-on:
group: Reth
runs-on: ubuntu-latest
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/propose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Propose a block

on:
push:
branches:
- gwyneth
- gwyneth/**
pull_request:
branches:
- gwyneth
- gwyneth/**

jobs:
build-and-test:
runs-on: ubuntu-latest

env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl apt-transport-https software-properties-common

# Install Docker
if ! command -v docker &> /dev/null
then
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
fi

# Start Docker service
sudo systemctl start docker
sudo systemctl enable docker

# Check Docker installation
docker --version

# Install Kurtosis
if ! command -v kurtosis &> /dev/null
then
curl -fsSL https://kurtosis-public.s3.amazonaws.com/cli/cli-installer.sh | bash
fi

# Check Kurtosis installation
kurtosis version

# Install Forge
if ! command -v forge &> /dev/null
then
curl -L https://foundry.paradigm.xyz | bash
source ~/.bashrc
foundryup
fi

# Check Forge installation
forge --version

# Run setup_deps.sh which installs Docker, checks Docker daemon, installs Kurtosis, and extracts RPC port
./scripts/setup_deps.sh

- name: Run Forge Script
run: |
# Read the RPC port from the temporary file
RPC_PORT=$(cat /tmp/kurtosis_rpc_port)

# Run the forge foundry script using the PRIVATE_KEY from GitHub Secrets
FORGE_COMMAND="forge script --rpc-url http://127.0.0.1:$RPC_PORT scripts/L2_txn_simulation/ProposeBlock.s.sol -vvvv --broadcast --private-key $PRIVATE_KEY --legacy"
echo "Running forge foundry script..."
eval $FORGE_COMMAND
echo "Forge script execution completed."
9 changes: 3 additions & 6 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ concurrency:
jobs:
test:
name: test / ${{ matrix.network }} (${{ matrix.partition }}/2)
runs-on:
group: Reth
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
strategy:
Expand All @@ -45,8 +44,7 @@ jobs:

state:
name: Ethereum state tests
runs-on:
group: Reth
runs-on: ubuntu-latest
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand All @@ -70,8 +68,7 @@ jobs:

doc:
name: doc tests (${{ matrix.network }})
runs-on:
group: Reth
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
timeout-minutes: 30
Expand Down
10 changes: 10 additions & 0 deletions packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "gwyneth",
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Taiko Labs",
"license": "MIT"
}
3 changes: 3 additions & 0 deletions packages/protocol/.env_sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
L2_GENESIS_HASH=0xdf90a9c4daa571aa308e967c9a6b4bf21ba8842d95d73d28be112b6fe0618e8c
PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
MAINNET_CONTRACT_OWNER=0x8943545177806ED17B9F23F0a21ee5948eCaa776
34 changes: 34 additions & 0 deletions packages/protocol/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test

on: workflow_dispatch

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
15 changes: 15 additions & 0 deletions packages/protocol/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Compiler files
cache/
out/
node_modules/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env
9 changes: 9 additions & 0 deletions packages/protocol/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# build/Makefile

.PHONY: install

install:
./scripts/setup_deps.sh

propose:
./scripts/propose_block.sh
66 changes: 66 additions & 0 deletions packages/protocol/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
27 changes: 27 additions & 0 deletions packages/protocol/contracts/4844/BlobHashReader.yulp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/

// An implemenatation of IBlobHashReader
object "BlobHashReader" {
code {
datacopy(0, dataoffset("runtime"), datasize("runtime"))
return(0, datasize("runtime"))
}
object "runtime" {
code {
// Match against the keccak of the ABI function signature needed.
switch shr(0xe0,calldataload(0))
// bytes4(keccak("function getFirstBlobHash()"))
// Returns the versioned hash for the first blob in this transaction.
case 0xfd122ecf {
// DATAHASH opcode has hex value 0x49
let hash := verbatim_1i_1o(hex"49", 0)
mstore(0, hash)
return(0, 32)
}
}
}
}
17 changes: 17 additions & 0 deletions packages/protocol/contracts/4844/IBlobHashReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/

pragma solidity ^0.8.20;

/// @title IBlobHashReader
/// @dev Labeled in AddressResolver as "blob_hash_reader"
/// @dev This interface and its corresponding implementation may deprecate once
/// solidity supports the new BLOBHASH opcode natively.
interface IBlobHashReader {
/// @notice Returns the versioned hash for the first blob in this
/// transaction. If there is no blob found, 0x0 is returned.
function getFirstBlobHash() external view returns (bytes32);
}
46 changes: 46 additions & 0 deletions packages/protocol/contracts/4844/Lib4844.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/

pragma solidity ^0.8.20;

/// @title Lib4844
/// @notice A library for handling EIP-4844 blobs
/// `solc contracts/libs/Lib4844.sol --ir > contracts/libs/Lib4844.yul`
library Lib4844 {
address public constant POINT_EVALUATION_PRECOMPILE_ADDRESS = address(0x0A);
uint32 public constant FIELD_ELEMENTS_PERBLOB = 4096;
uint256 public constant BLS_MODULUS =
52_435_875_175_126_190_479_447_740_508_185_965_837_690_552_500_527_637_822_603_658_699_938_581_184_513;

error EVAL_FAILED();
error POINT_X_TOO_LARGE();
error POINT_Y_TOO_LARGE();

/// @notice Evaluates the 4844 point using the precompile.
/// @param blobHash The versioned hash
/// @param x The evaluation point
/// @param y The expected output
/// @param commitment The input kzg point
/// @param pointProof The quotient kzg
function evaluatePoint(
bytes32 blobHash,
uint256 x,
uint256 y,
bytes1[48] memory commitment,
bytes1[48] memory pointProof
)
internal
view
{
if (x >= BLS_MODULUS) revert POINT_X_TOO_LARGE();
if (y >= BLS_MODULUS) revert POINT_Y_TOO_LARGE();

(bool ok,) = POINT_EVALUATION_PRECOMPILE_ADDRESS.staticcall(
abi.encodePacked(blobHash, x, y, commitment, pointProof)
);
if (!ok) revert EVAL_FAILED();
}
}
Loading
Loading