Skip to content

Commit

Permalink
Merge pull request #10 from paradigmxyz/main
Browse files Browse the repository at this point in the history
[pull] main from paradigmxyz:main
  • Loading branch information
imotai authored May 29, 2024
2 parents e294ce2 + bab8aaa commit be74dbf
Show file tree
Hide file tree
Showing 986 changed files with 54,740 additions and 30,334 deletions.
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = .git,target,./crates/storage/libmdbx-rs/mdbx-sys/libmdbx,Cargo.toml,Cargo.lock
ignore-words-list = crate,ser,ratatui
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.rs]
max_line_length = 100

[*.{yml,yaml}]
indent_size = 2

[*.md]
# double whitespace at end of line
# denotes a line break in Markdown
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

[]
22 changes: 18 additions & 4 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ body:
attributes:
value: |
Thanks for taking the time to fill out this bug report! Please provide as much detail as possible.
If you believe you have found a vulnerability, please provide details [here](mailto:[email protected]) instead.
- type: textarea
id: what-happened
attributes:
label: Describe the bug
description: |
A clear and concise description of what the bug is.
If the bug is in a crate you are using (i.e. you are not running the standard `reth` binary) please mention that as well.
validations:
required: true
Expand All @@ -25,7 +25,7 @@ body:
description: Please provide any steps you think might be relevant to reproduce the bug.
placeholder: |
Steps to reproduce:
1. Start '...'
2. Then '...'
3. Check '...'
Expand All @@ -36,7 +36,14 @@ body:
id: logs
attributes:
label: Node logs
description: If applicable, please provide the node logs leading up to the bug.
description: |
If applicable, please provide the node logs leading up to the bug.
**Please also provide debug logs.** By default, these can be found in:
- `~/.cache/reth/logs` on Linux
- `~/Library/Caches/reth/logs` on macOS
- `%localAppData%/reth/logs` on Windows
render: text
validations:
required: false
Expand Down Expand Up @@ -69,6 +76,13 @@ body:
description: This can be obtained with `reth db version`
validations:
required: true
- type: textarea
id: network
attributes:
label: Which chain / network are you on?
description: This is the argument you pass to `reth --chain`. If you are using `--dev`, type in 'dev' here. If you are not running with `--chain` or `--dev` then it is mainnet.
validations:
required: true
- type: dropdown
id: node-type
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ contact_links:
about: Please ask and answer questions here to keep the issue tracker clean.
- name: Security
url: mailto:[email protected]
about: Please report security vulnerabilities here.
about: Please report security vulnerabilities here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
label: Describe the feature
description: |
Please describe the feature and what it is aiming to solve, if relevant.
If the feature is for a crate, please include a proposed API surface.
validations:
required: true
Expand Down
11 changes: 0 additions & 11 deletions .github/scripts/compare_iai.sh

This file was deleted.

57 changes: 57 additions & 0 deletions .github/scripts/label_pr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Filter function for labels we do not want on PRs automatically.
function shouldIncludeLabel (label) {
const isStatus = label.startsWith('S-');
const isTrackingIssue = label === 'C-tracking-issue';
const isPreventStale = label === 'M-prevent-stale';
const isDifficulty = label.startsWith('D-');

return !isStatus && !isTrackingIssue && !isPreventStale && !isDifficulty;
}

// Get the issue number from an issue link in the forms `<keyword> <issue url>` or `<keyword> #<issue number>`.
function getIssueLink (repoUrl, body) {
const urlPattern = new RegExp(`(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) ${repoUrl}/issues/(?<issue_number>\\d+)`, 'i')
const issuePattern = new RegExp(`(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) \#(?<issue_number>\\d+)`, 'i')

const urlRe = body.match(urlPattern);
const issueRe = body.match(issuePattern);
if (urlRe?.groups?.issue_number) {
return urlRe.groups.issue_number
} else {
return issueRe?.groups?.issue_number
}
}

module.exports = async ({ github, context }) => {
try {
const prNumber = context.payload.pull_request.number;
const prBody = context.payload.pull_request.body;
const repo = context.repo;

const repoUrl = context.payload.repository.html_url;
const issueNumber = getIssueLink(repoUrl, prBody);
if (!issueNumber) {
console.log('No issue reference found in PR description.');
return;
}

const issue = await github.rest.issues.get({
...repo,
issue_number: issueNumber,
});

const issueLabels = issue.data.labels
.map(label => label.name)
.filter(shouldIncludeLabel);
if (issueLabels.length > 0) {
await github.rest.issues.addLabels({
...repo,
issue_number: prNumber,
labels: issueLabels,
});
}
} catch (err) {
console.error('Failed to label PR');
console.error(err);
}
}
9 changes: 4 additions & 5 deletions .github/workflows/assertoor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: services
run: |
export github_sha=${{ github.sha }}
export github_repository=${{ github.repository }}
export github_repository=${{ github.repository }}
cat etc/assertoor/assertoor-template.yaml | envsubst > etc/assertoor/assertoor.yaml
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
elif [ "$task_result" == "failure" ]; then
task_result="${RED}failure${NC}"
fi
echo -e " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title"
done <<< $(echo "$tasks")
}
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
echo "$task_lines"
fi
if [ $failed_tests -gt 0 ]; then
if [ $failed_tests -gt 0 ]; then
final_test_result="failure"
break
fi
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
with:
name: "kurtosis-enclave-dump-${{ github.run_id }}"
path: ./temp/dump

- name: Return test result
shell: bash
run: |
Expand Down Expand Up @@ -227,4 +227,3 @@ jobs:
exit 1 # fail action
fi
55 changes: 31 additions & 24 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

env:
CARGO_TERM_COLOR: always
BASELINE: base
IAI_CALLGRIND_RUNNER: iai-callgrind-runner

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -18,36 +20,41 @@ jobs:
iai:
runs-on:
group: Reth
# Only run benchmarks in merge groups
# Only run benchmarks in merge groups and on main
if: github.event_name != 'pull_request'
steps:
- name: Checkout main sources
uses: actions/checkout@v4
with:
ref: main
path: main
- name: Checkout PR sources
uses: actions/checkout@v4
with:
clean: false
path: pr
- uses: actions/checkout@v4
- name: Install Valgrind
run: sudo apt update && sudo apt install valgrind
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
main -> target
pr -> target
cache-on-failure: true
- name: Generate test vectors
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install iai-callgrind-runner
run: |
cargo run --bin reth --manifest-path main/Cargo.toml -- test-vectors tables
cp -r testdata main
mv testdata pr
- name: Set main baseline
run: cargo bench --package reth-db --bench iai --features test-utils --manifest-path main/Cargo.toml
- name: Compare PR benchmark
shell: 'script -q -e -c "bash {0}"' # required to workaround /dev/tty not being available
run: .github/scripts/compare_iai.sh
working-directory: pr
echo "::group::Install"
version=$(cargo metadata --format-version=1 |\
jq '.packages[] | select(.name == "iai-callgrind").version' |\
tr -d '"'
)
cargo binstall iai-callgrind-runner --version $version --no-confirm --no-symlinks --force
echo "::endgroup::"
echo "::group::Verification"
which iai-callgrind-runner
echo "::endgroup::"
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref || 'main' }}
- name: Generate test vectors
run: cargo run --bin reth -- test-vectors tables
- name: Save baseline
run: cargo bench -p reth-db --bench iai --features test-utils -- --save-baseline=$BASELINE
- name: Checkout PR
uses: actions/checkout@v4
with:
clean: false
- name: Compare PR benchmarks
run: cargo bench -p reth-db --bench iai --features test-utils -- --baseline=$BASELINE
12 changes: 10 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ on:
env:
REPO_NAME: ${{ github.repository_owner }}/reth
IMAGE_NAME: ${{ github.repository_owner }}/reth
OP_IMAGE_NAME: ${{ github.repository_owner }}/op-reth
CARGO_TERM_COLOR: always
DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/reth
OP_DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/op-reth
DOCKER_USERNAME: ${{ github.actor }}

jobs:
Expand All @@ -36,9 +38,15 @@ jobs:
run: |
docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64
docker buildx create --use --name cross-builder
- name: Build and push image, tag as "latest"
- name: Build and push reth image, tag as "latest"
if: ${{ contains(github.event.ref, 'beta') }}
run: make PROFILE=maxperf docker-build-push-latest
- name: Build and push image
- name: Build and push reth image
if: ${{ ! contains(github.event.ref, 'beta') }}
run: make PROFILE=maxperf docker-build-push
- name: Build and push op-reth image, tag as "latest"
if: ${{ contains(github.event.ref, 'beta') }}
run: make IMAGE_NAME=$OP_IMAGE_NAME DOCKER_IMAGE_NAME=$OP_DOCKER_IMAGE_NAME PROFILE=maxperf op-docker-build-push-latest
- name: Build and push op-reth image
if: ${{ ! contains(github.event.ref, 'beta') }}
run: make IMAGE_NAME=$OP_IMAGE_NAME DOCKER_IMAGE_NAME=$OP_DOCKER_IMAGE_NAME PROFILE=maxperf op-docker-build-push
7 changes: 2 additions & 5 deletions .github/workflows/hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ concurrency:

jobs:
prepare:
if: github.repository == 'paradigmxyz/reth'
timeout-minutes: 45
runs-on:
group: Reth
Expand Down Expand Up @@ -115,17 +116,13 @@ jobs:
- eth_getBlockBy
- eth_getBlockTransactionCountBy
- eth_getCode
- eth_getProof
- eth_getStorage
- eth_getTransactionBy
- eth_getTransactionCount
- eth_getTransactionReceipt
- eth_sendRawTransaction
- eth_syncing
# not running eth_getProof tests because we do not support
# eth_getProof yet
# - sim: ethereum/rpc-compat
# include: [eth_getProof/get-account-proof-with-storage, eth_getProof/get-account-proof]
# experimental: true
# debug_ rpc methods
- sim: ethereum/rpc-compat
include: [debug_]
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run tests
- if: matrix.network == 'ethereum'
name: Run tests
run: |
cargo nextest run \
--locked --features "asm-keccak ${{ matrix.network }}" \
--workspace --exclude examples --exclude ef-tests \
-E "kind(test)"
- if: matrix.network == 'optimism'
name: Run tests
run: |
cargo nextest run \
--locked -p reth-node-optimism --features "optimism"
sync:
name: sync / 100k blocks
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Label PRs

on:
pull_request:
types: [opened]

jobs:
label_prs:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Label PRs
uses: actions/github-script@v7
with:
script: |
const label_pr = require('./.github/scripts/label_pr.js')
await label_pr({github, context})
Loading

0 comments on commit be74dbf

Please sign in to comment.