Skip to content

Commit 97ddcd7

Browse files
merklefruitthedevbirbestensenmempirate
committed
feat: open-source release
Co-authored-by: thedevbirb <[email protected]> Co-authored-by: estensen <[email protected]> Co-authored-by: mempirate <[email protected]>
0 parents  commit 97ddcd7

File tree

103 files changed

+23906
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+23906
-0
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target/
2+
testground/
3+
.git/
4+
.github/
5+
.gitignore

.env.example

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# --- L1 Node connections ---
2+
MK1_L1_EXECUTION_URL=http://localhost:33809
3+
MK1_L1_EXECUTION_WS_URL=ws://localhost:33810
4+
MK1_L1_CONSENSUS_URL=http://localhost:33819
5+
6+
# --- L2 Node connections ---
7+
MK1_L2_EXECUTION_URL=http://localhost:8544
8+
MK1_L2_EXECUTION_WS_URL=ws://localhost:8546
9+
MK1_L2_ENGINE_URL=http://localhost:8551
10+
MK1_L2_JWT_SECRET=dc49981516e8e72b401a63e6405495a32dafc3939b5d6d83cc319ac0388bca1b
11+
MK1_L2_PRECONF_URL=http://localhost:8082
12+
MK1_L2_PRECONF_WS_URL=ws://localhost:8082
13+
14+
# --- Preconf config ---
15+
MK1_PRECONF_ANCHOR_BLOCK_LAG=4
16+
MK1_PRECONF_ANCHOR_MAX_HEIGHT_BUFFER=6
17+
MK1_PRECONF_MIN_TIP_WEI=0
18+
MK1_PRECONF_HANDOVER_SKIP_SLOTS=1
19+
MK1_PRECONF_HANDOVER_WINDOW_SLOTS=4
20+
MK1_PRECONF_BATCH_SIZE_TARGET_KB=254
21+
MK1_PRECONF_MIN_BATCH_TIP_WEI=1000000
22+
MK1_PRECONF_MAX_BLOCK_SIZE_BYTES=126976
23+
MK1_PRECONF_DA_THROTTLING_FACTOR=12
24+
MK1_PRECONF_MAX_TX_LISTS_PER_CALL=1
25+
MK1_PRECONF_ENABLE_BUILDING_EMPTY_BLOCKS=false
26+
27+
# --- Operator config ---
28+
MK1_OPERATOR_PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
29+
30+
# --- Contract Addresses ---
31+
MK1_TAIKO_INBOX=0x23B4c59C3B67A512563D8650d2C78Ec3861c4648
32+
MK1_PRECONF_WHITELIST=0x2B6db1693ffA1157b805882050194699fD1A4806
33+
MK1_PRECONF_ROUTER=0xF8140B6286DbED6be8448eed7ef81E69E4b5EAd4
34+
MK1_TAIKO_ANCHOR=0x1670100000000000000000000000000000010001
35+
MK1_TAIKO_TOKEN=0x422a3492e218383753d8006c7bfa97815b44373f
36+
MK1_TAIKO_WRAPPER=
37+
38+
# --- Chain config ---
39+
MK1_L2_BLOCK_TIME=2
40+
MK1_L1_BLOCK_TIME=12
41+
42+
# --- Axiom configuration --
43+
MK1_AXIOM_TOKEN=your-axiom-token-here
44+
MK1_AXIOM_DATASET=your-dataset-name
45+
46+
# --- Metrics configuration ---
47+
MK1_METRICS_PORT=9090
48+
MK1_DISABLE_METRICS=false
49+
50+
# --- Logging configuration ---
51+
RUST_LOG=mk1=debug,mk1_driver=debug,mk1_chainio=debug,mk1_clients=debug

.github/.dependabot.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "cargo"
9+
labels:
10+
- "T: security"
11+
schedule:
12+
interval: "weekly"
13+
day: "monday"
14+
time: "07:00"
15+
groups:
16+
major:
17+
patterns:
18+
- "*"
19+
update-types:
20+
- "major"
21+
minor:
22+
patterns:
23+
- "*"
24+
update-types:
25+
- "minor"
26+
patch:
27+
patterns:
28+
- "*"
29+
update-types:
30+
- "patch"

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @thedevbirb @merklefruit @mempirate @estensen

.github/workflows/coverage.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Generate coverage report for PRs
2+
name: Coverage
3+
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
coverage:
16+
name: tarpaulin
17+
if: github.event.pull_request.draft == false
18+
runs-on: ubuntu-latest
19+
container:
20+
image: xd009642/tarpaulin:latest
21+
options: --security-opt seccomp=unconfined
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
26+
steps:
27+
- name: Checkout PR
28+
uses: actions/checkout@v4
29+
30+
# This is required for tarpaulin caches to work
31+
- name: Cache cargo registry and build
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
~/.cargo/registry
36+
~/.cargo/git
37+
target
38+
target/tarpaulin
39+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-cargo-
42+
43+
- name: Install Protoc
44+
uses: arduino/setup-protoc@v3
45+
46+
- name: Generate coverage
47+
run: |
48+
cargo tarpaulin --skip-clean --target-dir target/tarpaulin --all-features --workspace --timeout 120 --exclude-files target/debug/build/*/out/* --fail-under 20 | tee tarpaulin_output.txt
49+
PR_COVERAGE=$(awk '/% coverage/ {print $1}' tarpaulin_output.txt)
50+
PR_COVERAGE_LINES=$(awk -F'[ ,]+' '/lines covered/ {print $3}' tarpaulin_output.txt)
51+
PR_COVERAGE_DETAILED=$(awk '/\|\| Tested\/Total Lines:/, /^\|\| *$/' tarpaulin_output.txt)
52+
echo "Output: $PR_COVERAGE $PR_COVERAGE_LINES"
53+
echo "PR_COVERAGE=$PR_COVERAGE" >> $GITHUB_ENV
54+
echo "PR_COVERAGE_LINES=$PR_COVERAGE_LINES" >> $GITHUB_ENV
55+
echo "PR_COVERAGE_DETAILED<<EOF" >> $GITHUB_ENV
56+
echo "$PR_COVERAGE_DETAILED" >> $GITHUB_ENV
57+
echo "EOF" >> $GITHUB_ENV
58+
59+
- name: Comment PR with coverage
60+
uses: actions/github-script@v7
61+
with:
62+
script: |
63+
const prCoverage = parseFloat(process.env.PR_COVERAGE);
64+
const prCoverageLines = process.env.PR_COVERAGE_LINES;
65+
const prCoverageDetailed = (process.env.PR_COVERAGE_DETAILED || "");
66+
67+
// Per-crate coverage calculation
68+
const crateStats = {};
69+
prCoverageDetailed.split('\n').forEach(line => {
70+
const match = line.match(/^\|\|\s*([^:]+):\s*(\d+)\/(\d+)/);
71+
if (match) {
72+
const filePath = match[1].trim();
73+
const covered = parseInt(match[2], 10);
74+
const total = parseInt(match[3], 10);
75+
const crate = filePath.split('/').slice(0, 2).join('/');
76+
if (!crateStats[crate]) {
77+
crateStats[crate] = { covered: 0, total: 0 };
78+
}
79+
crateStats[crate].covered += covered;
80+
crateStats[crate].total += total;
81+
}
82+
});
83+
84+
let crateTable = '| Crate | Coverage |\n|-------|----------|\n';
85+
for (const [crate, { covered, total }] of Object.entries(crateStats)) {
86+
const percent = total > 0 ? ((covered / total) * 100).toFixed(2) : 'N/A';
87+
crateTable += `| ${crate} | ${percent}% |\n`;
88+
}
89+
90+
const dedent = str => str.replace(/^[ \t]+/gm, '');
91+
92+
const comment = dedent(`## Coverage Report
93+
94+
| Metric | Value |
95+
|--------|-------|
96+
| **Coverage** | ${prCoverage.toFixed(2)}% |
97+
| **Lines Covered** | ${prCoverageLines} |
98+
99+
${prCoverage >= 80 ? '✅' : prCoverage >= 60 ? '⚠️' : '❌'} **Status**: ${prCoverage >= 80 ? 'GOOD' : prCoverage >= 60 ? 'NEEDS IMPROVEMENT' : 'POOR'}
100+
101+
### Per-Crate Coverage
102+
103+
${crateTable}
104+
`);
105+
106+
github.rest.issues.createComment({
107+
issue_number: context.issue.number,
108+
owner: context.repo.owner,
109+
repo: context.repo.repo,
110+
body: comment
111+
});

.github/workflows/lint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- unstable
7+
- main
8+
pull_request:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
fmt:
15+
name: fmt
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 30
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: dtolnay/rust-toolchain@nightly
21+
with:
22+
components: rustfmt
23+
- name: Run fmt
24+
run: cargo +nightly fmt --all --check
25+
26+
clippy:
27+
name: clippy
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 30
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Install Protoc
33+
uses: arduino/setup-protoc@v3
34+
- uses: dtolnay/rust-toolchain@nightly
35+
with:
36+
components: clippy
37+
- uses: Swatinem/rust-cache@v2
38+
with:
39+
cache-on-failure: true
40+
- run: cargo clippy --examples --tests --benches --all-features --locked
41+
env:
42+
RUSTFLAGS: -D warnings

.github/workflows/unit.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Unit tests
2+
3+
on:
4+
push:
5+
branches:
6+
- unstable
7+
- main
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
test:
19+
name: test workspace
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Install Protoc
25+
uses: arduino/setup-protoc@v3
26+
- uses: dtolnay/rust-toolchain@master
27+
# Need to specify @master above to work with toolchain var
28+
with:
29+
toolchain: 1.86.0
30+
- uses: Swatinem/rust-cache@v2
31+
with:
32+
cache-on-failure: true
33+
- uses: taiki-e/install-action@nextest
34+
- name: Run tests
35+
run: cargo nextest run --retries 3 --no-tests=warn

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### macOS ###
2+
.DS_Store
3+
4+
### Rust ###
5+
/target
6+
!.env.example
7+
.env
8+
9+
### Taiko ###
10+
taiko-mono/

.taplo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[formatting]
2+
array_trailing_comma = false
3+
array_auto_collapse = true
4+
array_auto_expand = false

AGENTS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Agent Guidelines for Mk1
2+
3+
## Test, Lint and Formatting Commands
4+
- Run tests: `just test`
5+
- Run single test: `cargo nextest run <test_name>`
6+
- Linting: `just lint`
7+
- Format code: `just fmt`
8+
- Run all CI checks: `just ci` (runs fmt, lint, test)
9+
10+
## Code Style Guidelines
11+
- Use Rust 2024 edition
12+
- Follow rustfmt.toml settings: reordered imports, grouped by crate, use small heuristics
13+
- Missing debug impls and docs should be warned
14+
- Follow Clippy lints defined in Cargo.toml
15+
- Errors use `thiserror` crate
16+
- Tests: Use `#[cfg(test)]` module and functions with `#[test]` or `#[tokio::test]`
17+
- Async: Use tokio for async runtime
18+
- Prefer `#[derive(Debug)]` on structs and enums
19+
- Use trace/debug/info/warn/error logs properly with `tracing` crate
20+
- Error handling: Prefer `?` operator with contextual error info
21+
22+
## Git
23+
- Use Conventional Commits for commits

0 commit comments

Comments
 (0)