Skip to content

Commit 2507fd8

Browse files
author
Flashbots
committed
initial commit
0 parents  commit 2507fd8

File tree

136 files changed

+36012
-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.

136 files changed

+36012
-0
lines changed

.editorconfig

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.rs]
16+
max_line_length = 100
17+
18+
[*.{yml,yaml}]
19+
indent_size = 2
20+
21+
[*.md]
22+
# double whitespace at end of line
23+
# denotes a line break in Markdown
24+
trim_trailing_whitespace = false
25+
26+
[Makefile]
27+
indent_style = tab
28+
29+
[]

.github/CODEOWNERS

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# These owners will be the default owners for everything in
2+
# the repo. Unless a later match takes precedence,
3+
# they will be requested for review when someone opens a pull request.
4+
* @dvush @ZanCorDX @metachris @jakubhruby7
5+
/crates/ @dvush @ZanCorDX
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Download fake relay"
2+
description: "Download fake relay for integration tests"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Check out code
7+
uses: actions/checkout@v2
8+
9+
- name: Set up Go
10+
uses: actions/setup-go@v2
11+
with:
12+
go-version: 1.22
13+
14+
- name: Clone remote repository
15+
shell: bash
16+
run: |
17+
git clone https://github.com/ZanCorDX/fake-relay.git
18+
19+
- name: Build
20+
shell: bash
21+
run: |
22+
cd fake-relay
23+
go build -v -o mev-boost-fake-relay .
24+
echo "$PWD" >> $GITHUB_PATH

.github/dependabot.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "cargo"
7+
directory: "/"
8+
schedule:
9+
interval: "weekly"
10+
commit-message:
11+
prefix: "chore(deps)"
12+
# ignore:
13+
# # These are peer deps of Cargo and should not be automatically bumped
14+
# - dependency-name: "semver"
15+
# - dependency-name: "crates-io"
16+
# rebase-strategy: "disabled"

.github/pull_request_template.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## 📝 Summary
2+
3+
<!--- A general summary of your changes -->
4+
5+
## 💡 Motivation and Context
6+
7+
<!--- (Optional) Why is this change required? What problem does it solve? Remove this section if not applicable. -->
8+
9+
---
10+
11+
## ✅ I have completed the following steps:
12+
13+
* [ ] Run `make lint`
14+
* [ ] Run `make test`
15+
* [ ] Added tests (if applicable)

.github/workflows/bench.yaml

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Benchmarks
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
bench:
11+
name: Benchmark the code
12+
runs-on: warp-ubuntu-latest-x64-16x
13+
strategy:
14+
matrix:
15+
toolchain:
16+
- stable
17+
env:
18+
PR_NUMBER: ${{ github.event.number }}
19+
BENCH_AGAINST_BASE: 1
20+
steps:
21+
- name: Checkout sources
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # Used to get hash of base branch
25+
26+
# https://github.com/dtolnay/rust-toolchain
27+
- name: Setup rust toolchain
28+
uses: dtolnay/rust-toolchain@stable
29+
with:
30+
toolchain: ${{ matrix.toolchain }}
31+
32+
# https://github.com/swatinem/rust-cache
33+
- name: Run Swatinem/rust-cache@v2
34+
uses: Swatinem/rust-cache@v2
35+
with:
36+
cache-on-failure: true
37+
38+
- name: Set (and display) useful variables
39+
id: vars
40+
run: |
41+
source scripts/ci/env-vars.sh
42+
43+
echo "HEAD_SHA: ${HEAD_SHA}"
44+
echo "HEAD_SHA_SHORT: ${HEAD_SHA_SHORT}"
45+
echo "BASE_SHA: ${BASE_SHA}"
46+
echo "BASE_SHA_SHORT: ${BASE_SHA_SHORT}"
47+
48+
echo "HEAD_SHA=${HEAD_SHA}" >> "$GITHUB_OUTPUT"
49+
echo "HEAD_SHA_SHORT=${HEAD_SHA_SHORT}" >> "$GITHUB_OUTPUT"
50+
echo "BASE_SHA=${BASE_SHA}" >> "$GITHUB_OUTPUT"
51+
echo "BASE_SHA_SHORT=${BASE_SHA_SHORT}" >> "$GITHUB_OUTPUT"
52+
53+
# S3 upload directory, depending if it includes a comparison or not
54+
if [ "$HEAD_SHA" == "$BASE_SHA" ]; then
55+
# No comparison (i.e. running on a branch like main directly)
56+
S3_UPLOAD_DIR="benchmark/${HEAD_SHA_SHORT}"
57+
else
58+
# Comparison (i.e. running on a PR)
59+
S3_UPLOAD_DIR="benchmark/${HEAD_SHA_SHORT}-${BASE_SHA_SHORT}"
60+
fi
61+
echo "S3_UPLOAD_DIR: ${S3_UPLOAD_DIR}"
62+
echo "S3_UPLOAD_DIR=${S3_UPLOAD_DIR}" >> "$GITHUB_OUTPUT"
63+
echo "S3_UPLOAD_DIR=${S3_UPLOAD_DIR}" >> "$GITHUB_ENV"
64+
65+
#
66+
# RUN BENCHMARKS (and upload the report)
67+
#
68+
- run: make bench-in-ci
69+
70+
# Upload as artifact first
71+
- name: Upload report as artifact
72+
uses: actions/[email protected]
73+
with:
74+
name: benchmark-report
75+
path: target/benchmark-in-ci/benchmark-report/
76+
77+
- name: Zip the report and add to folder (for S3 upload)
78+
working-directory: target/benchmark-in-ci
79+
run: |
80+
zip_fn="report.zip"
81+
zip -r $zip_fn benchmark-report
82+
mv $zip_fn benchmark-report/
83+
84+
# Upload S3 (using https://github.com/shallwefootball/upload-s3-action)
85+
- name: Upload report to S3
86+
uses: shallwefootball/s3-upload-action@master
87+
id: S3
88+
with:
89+
aws_key_id: ${{secrets.AWS_KEY_ID}}
90+
aws_secret_access_key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
91+
aws_bucket: flashbots-rbuilder-ci-stats
92+
source_dir: target/benchmark-in-ci/benchmark-report
93+
destination_dir: ${{ steps.vars.outputs.S3_UPLOAD_DIR }}
94+
95+
#
96+
# POST SUMMARY (to PR comment and CI job summary)
97+
#
98+
- name: Add summary to CI job summary
99+
run: |
100+
BENCH_URL="https://flashbots-rbuilder-ci-stats.s3.us-east-2.amazonaws.com/${{steps.S3.outputs.object_key}}/report/index.html"
101+
sed -i "s|__BENCH_URL__|${BENCH_URL}|" target/benchmark-in-ci/benchmark-summary.md
102+
sed -i "s|__BENCH_URL__|${BENCH_URL}|" target/benchmark-in-ci/benchmark-pr-comment.md
103+
cat target/benchmark-in-ci/benchmark-summary.md >> $GITHUB_STEP_SUMMARY
104+
105+
# https://github.com/peter-evans/find-comment
106+
- name: Find previous PR comment
107+
uses: peter-evans/find-comment@v3
108+
if: github.event_name == 'pull_request'
109+
id: fc
110+
with:
111+
issue-number: ${{ github.event.pull_request.number }}
112+
comment-author: 'github-actions[bot]'
113+
body-includes: Benchmark results
114+
115+
# https://github.com/peter-evans/create-or-update-comment
116+
- name: Create or update PR comment
117+
uses: peter-evans/create-or-update-comment@v4
118+
if: github.event_name == 'pull_request'
119+
with:
120+
comment-id: ${{ steps.fc.outputs.comment-id }}
121+
issue-number: ${{ github.event.pull_request.number }}
122+
edit-mode: replace
123+
body-path: target/benchmark-in-ci/benchmark-pr-comment.md

.github/workflows/checks.yaml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Checks
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
merge_group:
7+
push:
8+
branches: [main]
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
RUN_TEST_FAKE_MEV_BOOST_RELAY: 1
13+
14+
jobs:
15+
lint_and_test:
16+
name: Lint and test
17+
runs-on: warp-ubuntu-latest-x64-16x
18+
strategy:
19+
matrix:
20+
toolchain:
21+
- stable
22+
#- beta
23+
#- nightly
24+
steps:
25+
- name: Checkout sources
26+
uses: actions/checkout@v4
27+
28+
- name: Download fake mevboost relay
29+
uses: ./.github/actions/download_fake_relay
30+
31+
# https://github.com/dtolnay/rust-toolchain
32+
- name: Setup rust toolchain
33+
uses: dtolnay/rust-toolchain@stable
34+
with:
35+
toolchain: ${{ matrix.toolchain }}
36+
37+
# https://github.com/swatinem/rust-cache
38+
- name: Run Swatinem/rust-cache@v2
39+
uses: Swatinem/rust-cache@v2
40+
with:
41+
cache-on-failure: true
42+
43+
# https://github.com/Mozilla-Actions/sccache-action
44+
- name: Run sccache-action
45+
uses: mozilla-actions/[email protected]
46+
47+
- name: Set sccache env vars
48+
run: |
49+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
50+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
51+
52+
- name: Install native dependencies
53+
run: sudo apt-get install -y libsqlite3-dev
54+
55+
# lint and test
56+
- run: make lint
57+
- run: make test

0 commit comments

Comments
 (0)