Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into devnet-0
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed May 22, 2024
2 parents b8ea4a6 + f45ca74 commit d1b5e4a
Show file tree
Hide file tree
Showing 110 changed files with 2,150 additions and 1,505 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/lint-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint GitHub Actions workflows
on:
pull_request:
merge_group:
push:
branches: [main]

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: SHELLCHECK_OPTS="-S error" ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
26 changes: 22 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ members = [
"examples/custom-inspector/",
"examples/exex/*",
"examples/db-access",
"examples/bsc-p2p",
"testing/ef-tests/",
"testing/testing-utils",
]
Expand Down Expand Up @@ -292,7 +293,7 @@ alloy-primitives = "0.7.2"
alloy-dyn-abi = "0.7.2"
alloy-sol-types = "0.7.2"
alloy-rlp = "0.3.4"
alloy-trie = "0.4.0"
alloy-trie = "0.4"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9b" }
alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9b" }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9b" }
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -472,5 +472,5 @@ cfg-check:
pr:
make cfg-check && \
make lint && \
make docs && \
make update-book-cli && \
make test
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Reth is performant, feature-complete, [Cancun-ready](https://paradigmxyz.github.

We actively recommend professional node operators to switch to Reth in production for performance and cost reasons in use cases where high performance with great margins is required such as RPC, MEV, Indexing, Simulations, and P2P activities.

While we are aware of parties running Reth staking nodes in production, we do *not* encourage usage in production staking environments by non-professionals until our audits are done, and the 1.0 version of Reth is released, but we are available to support without warranty or liability.
While we are aware of parties running Reth staking nodes in production, we do *not* encourage usage in production staking environments by non-professionals until our audits are done, and the 1.0 version of Reth is released, but we are available to support without warranty or liability.

More historical context below:
* We are releasing 1.0 "production-ready" stable Reth once our Reth & Revm audits are done. ETA ~May 2024.
Expand Down Expand Up @@ -155,5 +155,9 @@ None of this would have been possible without them, so big shoutout to the teams
- [Erigon](https://github.com/ledgerwatch/erigon) (fka Turbo-Geth): Erigon pioneered the ["Staged Sync" architecture](https://erigon.substack.com/p/erigon-stage-sync-and-control-flows) that Reth is using, as well as [introduced MDBX](https://github.com/ledgerwatch/erigon/wiki/Choice-of-storage-engine) as the database of choice. We thank Erigon for pushing the state of the art research on the performance limits of Ethereum nodes.
- [Akula](https://github.com/akula-bft/akula/): Reth uses forks of the Apache versions of Akula's [MDBX Bindings](https://github.com/paradigmxyz/reth/pull/132), [FastRLP](https://github.com/paradigmxyz/reth/pull/63) and [ECIES](https://github.com/paradigmxyz/reth/pull/80) . Given that these packages were already released under the Apache License, and they implement standardized solutions, we decided not to reimplement them to iterate faster. We thank the Akula team for their contributions to the Rust Ethereum ecosystem and for publishing these packages.

## Warning

The `NippyJar` and `Compact` encoding formats and their implementations are designed for storing and retrieving data internally. They are not hardened to safely read potentially malicious data.

[book]: https://paradigmxyz.github.io/reth/
[tg-url]: https://t.me/paradigm_reth
2 changes: 1 addition & 1 deletion bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl Command {

consensus.validate_header_with_total_difficulty(block, U256::MAX)?;
consensus.validate_header(block)?;
consensus.validate_block(block)?;
consensus.validate_block_pre_execution(block)?;

let senders = block.senders().expect("sender recovery failed");
let block_with_senders =
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/debug_cmd/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl Command {
)),
PruneModes::none(),
);
executor.execute_one((&sealed_block.clone().unseal(), td).into())?;
executor.execute_and_verify_one((&sealed_block.clone().unseal(), td).into())?;
let BatchBlockExecutionOutput { bundle, receipts, requests: _, first_block } =
executor.finalize();
BundleStateWithReceipts::new(bundle, receipts, first_block).write_to_storage(
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub async fn build_import_pipeline<DB, C>(
consensus: &Arc<C>,
file_client: Arc<FileClient>,
static_file_producer: StaticFileProducer<DB>,
should_exec: bool,
disable_exec: bool,
) -> eyre::Result<(Pipeline<DB>, impl Stream<Item = NodeEvent>)>
where
DB: Database + Clone + Unpin + 'static,
Expand Down Expand Up @@ -273,7 +273,7 @@ where
PruneModes::default(),
)
.builder()
.disable_all_if(&StageId::STATE_REQUIRED, || should_exec),
.disable_all_if(&StageId::STATE_REQUIRED, || disable_exec),
)
.build(provider_factory, static_file_producer);

Expand Down
60 changes: 4 additions & 56 deletions bin/reth/src/commands/import_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use reth_downloaders::file_client::{

use reth_node_core::init::init_genesis;

use reth_primitives::{hex, stage::StageId, PruneModes, TxHash};
use reth_primitives::{op_mainnet::is_dup_tx, stage::StageId, PruneModes};
use reth_provider::{ProviderFactory, StageCheckpointReader, StaticFileProviderFactory};
use reth_static_file::StaticFileProducer;
use std::{path::PathBuf, sync::Arc};
Expand Down Expand Up @@ -124,8 +124,8 @@ impl ImportOpCommand {
total_decoded_txns += file_client.total_transactions();

for (block_number, body) in file_client.bodies_iter_mut() {
body.transactions.retain(|tx| {
if is_duplicate(tx.hash, *block_number) {
body.transactions.retain(|_| {
if is_dup_tx(block_number) {
total_filtered_out_dup_txns += 1;
return false
}
Expand All @@ -143,7 +143,7 @@ impl ImportOpCommand {
provider_factory.static_file_provider(),
PruneModes::default(),
),
false,
true,
)
.await?;

Expand Down Expand Up @@ -197,55 +197,3 @@ impl ImportOpCommand {
Ok(())
}
}

/// A transaction that has been replayed in chain below Bedrock.
#[derive(Debug)]
pub struct ReplayedTx {
tx_hash: TxHash,
original_block: u64,
}

impl ReplayedTx {
/// Returns a new instance.
pub const fn new(tx_hash: TxHash, original_block: u64) -> Self {
Self { tx_hash, original_block }
}
}

/// Transaction 0x9ed8..9cb9, first seen in block 985.
pub const TX_BLOCK_985: ReplayedTx = ReplayedTx::new(
TxHash::new(hex!("9ed8f713b2cc6439657db52dcd2fdb9cc944915428f3c6e2a7703e242b259cb9")),
985,
);

/// Transaction 0x86f8..76e5, first seen in block 123 322.
pub const TX_BLOCK_123_322: ReplayedTx = ReplayedTx::new(
TxHash::new(hex!("c033250c5a45f9d104fc28640071a776d146d48403cf5e95ed0015c712e26cb6")),
123_322,
);

/// Transaction 0x86f8..76e5, first seen in block 1 133 328.
pub const TX_BLOCK_1_133_328: ReplayedTx = ReplayedTx::new(
TxHash::new(hex!("86f8c77cfa2b439e9b4e92a10f6c17b99fce1220edf4001e4158b57f41c576e5")),
1_133_328,
);

/// Transaction 0x3cc2..cd4e, first seen in block 1 244 152.
pub const TX_BLOCK_1_244_152: ReplayedTx = ReplayedTx::new(
TxHash::new(hex!("3cc27e7cc8b7a9380b2b2f6c224ea5ef06ade62a6af564a9dd0bcca92131cd4e")),
1_244_152,
);

/// List of original occurrences of all duplicate transactions below Bedrock.
pub const TX_DUP_ORIGINALS: [ReplayedTx; 4] =
[TX_BLOCK_985, TX_BLOCK_123_322, TX_BLOCK_1_133_328, TX_BLOCK_1_244_152];

/// Returns `true` if transaction is the second or third appearance of the transaction.
pub fn is_duplicate(tx_hash: TxHash, block_number: u64) -> bool {
for ReplayedTx { tx_hash: dup_tx_hash, original_block } in TX_DUP_ORIGINALS {
if tx_hash == dup_tx_hash && block_number != original_block {
return true
}
}
false
}
1 change: 1 addition & 0 deletions book/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- [`reth init`](./cli/reth/init.md)
- [`reth init-state`](./cli/reth/init-state.md)
- [`reth import`](./cli/reth/import.md)
- [`reth import-receipts`](./cli/reth/import-receipts.md)
- [`reth dump-genesis`](./cli/reth/dump-genesis.md)
- [`reth db`](./cli/reth/db.md)
- [`reth db stats`](./cli/reth/db/stats.md)
Expand Down
1 change: 1 addition & 0 deletions book/cli/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [`reth init`](./reth/init.md)
- [`reth init-state`](./reth/init-state.md)
- [`reth import`](./reth/import.md)
- [`reth import-receipts`](./reth/import-receipts.md)
- [`reth dump-genesis`](./reth/dump-genesis.md)
- [`reth db`](./reth/db.md)
- [`reth db stats`](./reth/db/stats.md)
Expand Down
34 changes: 25 additions & 9 deletions book/cli/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"""


def write_file(file_path, content):
content = "\n".join([line.rstrip() for line in content.split("\n")])
with open(file_path, "w") as f:
f.write(content)


def main():
args = parse_args(sys.argv[1:])
for cmd in args.commands:
Expand Down Expand Up @@ -65,13 +71,11 @@ def main():

root_summary += cmd_summary(root_path, cmd, obj, args.root_indentation)
root_summary += "\n"
with open(path.join(args.out_dir, "SUMMARY.md"), "w") as f:
f.write(summary)
write_file(path.join(args.out_dir, "SUMMARY.md"), summary)

# Generate README.md.
if args.readme:
with open(path.join(args.out_dir, "README.md"), "w") as f:
f.write(README)
write_file(path.join(args.out_dir, "README.md"), README)

if args.root_summary:
update_root_summary(args.root_dir, root_summary)
Expand Down Expand Up @@ -162,8 +166,7 @@ def rec(cmd: list[str], obj: object):
for arg in cmd:
out_path = path.join(out_path, arg)
makedirs(path.dirname(out_path), exist_ok=True)
with open(f"{out_path}.md", "w") as f:
f.write(out)
write_file(f"{out_path}.md", out)

for k, v in obj.items():
if k == HELP_KEY:
Expand Down Expand Up @@ -250,14 +253,27 @@ def command_name(cmd: str):
"""Returns the name of a command."""
return cmd.split("/")[-1]


def preprocess_help(s: str):
"""Preprocesses the help output of a command."""
# Remove the user-specific paths.
s = re.sub(r"default: /.*/reth", "default: <CACHE_DIR>", s)
s = re.sub(
r"default: /.*/reth",
"default: <CACHE_DIR>",
s,
)
# Remove the commit SHA and target architecture triple
s = re.sub(r"default: reth/.*-[0-9A-Fa-f]{6,10}/\w+-\w*-\w+", "default: reth/<VERSION>-<SHA>/<ARCH>", s)
s = re.sub(
r"default: reth/.*-[0-9A-Fa-f]{6,10}/\w+-\w*-\w+",
"default: reth/<VERSION>-<SHA>/<ARCH>",
s,
)
# Remove the OS
s = re.sub(r"default: reth/.*/\w+", "default: reth/<VERSION>/<OS>", s)
s = re.sub(
r"default: reth/.*/\w+",
"default: reth/<VERSION>/<OS>",
s,
)

return s

Expand Down
Loading

0 comments on commit d1b5e4a

Please sign in to comment.