Skip to content

Commit

Permalink
chore: handle panics in node.rs and add crate-level documentation (#24
Browse files Browse the repository at this point in the history
)

* chore: update eth api to handle panics

* chore add crate level docs

* chore: adds L2TxResult type due to clippy errors

* chore: update get tx hash

* chore: cargo clippy --fix

* chore: made requested changes

* chore change line spacing based on requested changes

* chore: added printlns to not implemented match cases
  • Loading branch information
dutterbutter authored Aug 4, 2023
1 parent bc55b6e commit bc8c10d
Show file tree
Hide file tree
Showing 3 changed files with 485 additions and 270 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ rebuild-contracts:
rust-build:
cargo build --release

# Build the Rust documentation
rust-doc:
cargo doc --no-deps --open

# Lint checks for Rust code
lint:
cargo fmt --all -- --check
Expand Down
46 changes: 45 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
//! zkSync Era In-Memory Node
//!
//! The `era-test-node` crate provides an in-memory node designed primarily for local testing.
//! It supports forking the state from other networks, making it a valuable tool for integration testing,
//! bootloader and system contract testing, and prototyping.
//!
//! ## Overview
//!
//! - **In-Memory Database**: The node uses an in-memory database for storing state information,
//! and employs simplified hashmaps for tracking blocks and transactions.
//!
//! - **Forking**: In fork mode, the node fetches missing storage data from a remote source if not available locally.
//!
//! - **Remote Server Interaction**: The node can use the remote server (openchain) to resolve the ABI and topics
//! to human-readable names.
//!
//! - **Local Testing**: Designed for local testing, this node is not intended for production use.
//!
//! ## Features
//!
//! - Fork the state of mainnet, testnet, or a custom network.
//! - Replay existing mainnet or testnet transactions.
//! - Use local bootloader and system contracts.
//! - Operate deterministically in non-fork mode.
//! - Start quickly with pre-configured 'rich' accounts.
//! - Resolve names of ABI functions and Events using openchain.
//!
//! ## Limitations
//!
//! - No communication between Layer 1 and Layer 2.
//! - Many APIs are not yet implemented.
//! - No support for accessing historical data.
//! - Only one transaction allowed per Layer 1 batch.
//! - Fixed values returned for zk Gas estimation.
//!
//! ## Usage
//!
//! To start the node, use the command `era_test_node run`. For more advanced functionalities like forking or
//! replaying transactions, refer to the official documentation.
//!
//! ## Contributions
//!
//! Contributions to improve `era-test-node` are welcome. Please refer to the contribution guidelines for more details.

use clap::{Parser, Subcommand};
use configuration_api::ConfigurationApiNamespaceT;
use fork::ForkDetails;
Expand Down Expand Up @@ -234,7 +278,7 @@ async fn main() -> anyhow::Result<()> {
);

if !transactions_to_replay.is_empty() {
node.apply_txs(transactions_to_replay);
let _ = node.apply_txs(transactions_to_replay);
}

println!("\nRich Accounts");
Expand Down
Loading

0 comments on commit bc8c10d

Please sign in to comment.