Skip to content

Commit e317090

Browse files
committed
Automatically wrap comments
1 parent 69247c9 commit e317090

Some content is hidden

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

78 files changed

+511
-337
lines changed

crates/edr/src/config.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ pub use super::NodeArgs;
1414
mod number;
1515
pub use number::{u256_number, u64_number, Number};
1616

17-
/// struct representing the deserialized conifguration file, eg hardhat.config.json
17+
/// struct representing the deserialized conifguration file, eg
18+
/// hardhat.config.json
1819
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
1920
#[serde(default)]
2021
pub struct ConfigFile {
@@ -143,8 +144,8 @@ mod tests {
143144
assert_eq!(config_file, deserialized);
144145
}
145146

146-
/// test that specifying a non-default value for one field still allows the other fields to
147-
/// take their default values.
147+
/// test that specifying a non-default value for one field still allows the
148+
/// other fields to take their default values.
148149
#[test]
149150
fn test_config_file_mixed_defaults() {
150151
let original = "chain_id = 999";

crates/edr/src/config/number.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ where
5858
}
5959
}
6060

61-
/// deserialize a [`Number`] but always as a [`Number::U64`], panicking if the value overflows.
61+
/// deserialize a [`Number`] but always as a [`Number::U64`], panicking if the
62+
/// value overflows.
6263
pub fn u64_number<'de, D>(deserializer: D) -> Result<Number, D::Error>
6364
where
6465
D: serde::Deserializer<'de>,

crates/edr/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ struct Cli {
2525
#[derive(Subcommand)]
2626
#[allow(clippy::large_enum_variant)]
2727
enum Command {
28-
/// Start the local Ethereum development node to serve JSON-RPC requests over HTTP.
28+
/// Start the local Ethereum development node to serve JSON-RPC requests
29+
/// over HTTP.
2930
Node(NodeArgs),
30-
/// Write default configuration values to edr.toml, overwriting any existing file.
31+
/// Write default configuration values to edr.toml, overwriting any existing
32+
/// file.
3133
InitConfigFile,
3234
}
3335

crates/edr/tests/cli.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ use edr_rpc_server::{HardhatMethodInvocation, MethodInvocation};
2222
async fn node() -> Result<(), Box<dyn std::error::Error>> {
2323
let address = secret_key_to_address(edr_defaults::SECRET_KEYS[0]).unwrap();
2424

25-
// the order of operations is a little weird in this test, because we spawn a separate process
26-
// for the server, and we want to make sure that we end that process gracefully. more
27-
// specifically, once the server is started, we avoid the ? operator until the server has been
28-
// stopped.
25+
// the order of operations is a little weird in this test, because we spawn a
26+
// separate process for the server, and we want to make sure that we end
27+
// that process gracefully. more specifically, once the server is started,
28+
// we avoid the ? operator until the server has been stopped.
2929

30-
// hold method invocations separately from requests so that we can easily iterate over them in
31-
// order to check for corresponding log entries in the server output:
30+
// hold method invocations separately from requests so that we can easily
31+
// iterate over them in order to check for corresponding log entries in the
32+
// server output:
3233
let method_invocations = [
3334
MethodInvocation::Eth(EthMethodInvocation::Accounts()),
3435
MethodInvocation::Eth(EthMethodInvocation::BlockNumber()),
@@ -93,7 +94,8 @@ async fn node() -> Result<(), Box<dyn std::error::Error>> {
9394
MethodInvocation::Hardhat(HardhatMethodInvocation::StopImpersonatingAccount(address)),
9495
];
9596

96-
// prepare request body before even spawning the server because serialization could fail:
97+
// prepare request body before even spawning the server because serialization
98+
// could fail:
9799
let request_body: String = serde_json::to_string(
98100
&method_invocations
99101
.iter()
@@ -121,12 +123,12 @@ async fn node() -> Result<(), Box<dyn std::error::Error>> {
121123
.stdout(Stdio::piped())
122124
.spawn()?;
123125

124-
// (required for CI runs on MacOS) sleep a moment to make sure the server comes up before we
125-
// start sending requests:
126+
// (required for CI runs on MacOS) sleep a moment to make sure the server comes
127+
// up before we start sending requests:
126128
std::thread::sleep(std::time::Duration::from_secs(1));
127129

128-
// query the server, but don't check the Result yet, because returning early would prevent us
129-
// from gracefully terminating the server:
130+
// query the server, but don't check the Result yet, because returning early
131+
// would prevent us from gracefully terminating the server:
130132
let send_result = reqwest::Client::new()
131133
.post("http://127.0.0.1:8549/")
132134
.header(reqwest::header::CONTENT_TYPE, "application/json")
@@ -143,7 +145,8 @@ async fn node() -> Result<(), Box<dyn std::error::Error>> {
143145
// validate query Result:
144146
send_result?.text().await?;
145147

146-
// assert that the standard output of the server process contains the expected log entries:
148+
// assert that the standard output of the server process contains the expected
149+
// log entries:
147150
Assert::new(output.clone()).stdout(contains("Listening on 127.0.0.1:8549"));
148151
for (i, default_secret_key) in edr_defaults::SECRET_KEYS.to_vec().iter().enumerate() {
149152
Assert::new(output.clone())

crates/edr_defaults/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ pub const SECRET_KEYS: [&str; 20] = [
2323
"df57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
2424
];
2525

26-
/// The default cache directory. Cache dirs for specific subsystems such as the RPC Client are
27-
/// subdirectories of this directory.
26+
/// The default cache directory. Cache dirs for specific subsystems such as the
27+
/// RPC Client are subdirectories of this directory.
2828
pub const CACHE_DIR: &str = "./edr-cache";
2929

30-
/// Maximum concurrent requests to a remote blockchain node to avoid getting rate limited.
30+
/// Maximum concurrent requests to a remote blockchain node to avoid getting
31+
/// rate limited.
3132
pub const MAX_CONCURRENT_REQUESTS: usize = 5;

crates/edr_eth/src/access_list.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Part of this code was adapted from ethers-rs and is distributed under their licenss:
1+
// Part of this code was adapted from ethers-rs and is distributed under their
2+
// licenss:
23
// - https://github.com/gakonst/ethers-rs/blob/cba6f071aedafb766e82e4c2f469ed5e4638337d/LICENSE-APACHE
34
// - https://github.com/gakonst/ethers-rs/blob/cba6f071aedafb766e82e4c2f469ed5e4638337d/LICENSE-MIT
45
// For the original context see: https://github.com/gakonst/ethers-rs/blob/3d9c3290d42b77c510e5b5d0b6f7a2f72913bfff/ethers-core/src/types/transaction/eip2930.rs

crates/edr_eth/src/account.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Part of this code was adapted from foundry and is distributed under their licenss:
1+
// Part of this code was adapted from foundry and is distributed under their
2+
// licenss:
23
// - https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/LICENSE-APACHE
34
// - https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/LICENSE-MIT
45
// For the original context see: https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/anvil/core/src/eth/proof.rs

crates/edr_eth/src/block.rs

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Part of this code was adapted from foundry and is distributed under their licenss:
1+
// Part of this code was adapted from foundry and is distributed under their
2+
// licenss:
23
// - https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/LICENSE-APACHE
34
// - https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/LICENSE-MIT
45
// For the original context see: https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/anvil/core/src/eth/block.rs
@@ -54,7 +55,8 @@ pub struct Block {
5455
}
5556

5657
impl Block {
57-
/// Constructs a new block from the provided partial header, transactions, and ommers.
58+
/// Constructs a new block from the provided partial header, transactions,
59+
/// and ommers.
5860
pub fn new(
5961
mut partial_header: PartialHeader,
6062
transactions: Vec<SignedTransaction>,
@@ -138,7 +140,8 @@ pub struct Header {
138140
/// Blob gas was added by EIP-4844 and is ignored in older headers.
139141
#[cfg_attr(feature = "serde", serde(flatten))]
140142
pub blob_gas: Option<BlobGas>,
141-
/// The hash tree root of the parent beacon block for the given execution block (EIP-4788).
143+
/// The hash tree root of the parent beacon block for the given execution
144+
/// block (EIP-4788).
142145
pub parent_beacon_block_root: Option<B256>,
143146
}
144147

@@ -159,16 +162,19 @@ impl From<B64Def> for B64 {
159162
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
160163
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
161164
pub struct BlobGas {
162-
/// The total amount of blob gas consumed by the transactions within the block.
165+
/// The total amount of blob gas consumed by the transactions within the
166+
/// block.
163167
pub gas_used: u64,
164168
/// The running total of blob gas consumed in excess of the target, prior to
165-
/// the block. Blocks with above-target blob gas consumption increase this value,
166-
/// blocks with below-target blob gas consumption decrease it (bounded at 0).
169+
/// the block. Blocks with above-target blob gas consumption increase this
170+
/// value, blocks with below-target blob gas consumption decrease it
171+
/// (bounded at 0).
167172
pub excess_gas: u64,
168173
}
169174

170175
impl Header {
171-
/// Constructs a header from the provided [`PartialHeader`], ommers' root hash, transactions' root hash, and withdrawals' root hash.
176+
/// Constructs a header from the provided [`PartialHeader`], ommers' root
177+
/// hash, transactions' root hash, and withdrawals' root hash.
172178
pub fn new(partial_header: PartialHeader, ommers_hash: B256, transactions_root: B256) -> Self {
173179
Self {
174180
parent_hash: partial_header.parent_hash,
@@ -341,12 +347,14 @@ pub struct PartialHeader {
341347
pub withdrawals_root: Option<B256>,
342348
/// Blob gas was added by EIP-4844 and is ignored in older headers.
343349
pub blob_gas: Option<BlobGas>,
344-
/// The hash tree root of the parent beacon block for the given execution block (EIP-4788).
350+
/// The hash tree root of the parent beacon block for the given execution
351+
/// block (EIP-4788).
345352
pub parent_beacon_block_root: Option<B256>,
346353
}
347354

348355
impl PartialHeader {
349-
/// Constructs a new instance based on the provided [`BlockOptions`] and parent [`Header`] for the given [`SpecId`].
356+
/// Constructs a new instance based on the provided [`BlockOptions`] and
357+
/// parent [`Header`] for the given [`SpecId`].
350358
pub fn new(spec_id: SpecId, options: BlockOptions, parent: Option<&Header>) -> Self {
351359
let timestamp = options.timestamp.unwrap_or_default();
352360
let number = options.number.unwrap_or({
@@ -403,7 +411,8 @@ impl PartialHeader {
403411
}),
404412
blob_gas: if spec_id >= SpecId::CANCUN {
405413
let excess_gas = parent.and_then(|parent| parent.blob_gas.as_ref()).map_or(
406-
// For the first (post-fork) block, both parent.blob_gas_used and parent.excess_blob_gas are evaluated as 0.
414+
// For the first (post-fork) block, both parent.blob_gas_used and
415+
// parent.excess_blob_gas are evaluated as 0.
407416
0,
408417
|BlobGas {
409418
gas_used,

crates/edr_eth/src/block/options.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub struct BlockOptions {
3131
pub base_fee: Option<U256>,
3232
/// The block's withdrawals root
3333
pub withdrawals_root: Option<B256>,
34-
/// The hash tree root of the parent beacon block for the given execution block (EIP-4788).
34+
/// The hash tree root of the parent beacon block for the given execution
35+
/// block (EIP-4788).
3536
pub parent_beacon_block_root: Option<B256>,
3637
}

crates/edr_eth/src/block/reorg.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
use std::time::Duration;
22

3-
/// The default depth of blocks to consider safe from a reorg and thus cacheable.
3+
/// The default depth of blocks to consider safe from a reorg and thus
4+
/// cacheable.
45
const DEFAULT_SAFE_BLOCK_DEPTH: u64 = 128;
56

6-
/// The default delay between blocks. Should be the lowest possible to stay on the safe side.
7+
/// The default delay between blocks. Should be the lowest possible to stay on
8+
/// the safe side.
79
const DEFAULT_SAFE_BLOCK_TIME: Duration = Duration::from_secs(1);
810

9-
/// Test whether a block number is safe from a reorg for a specific chain based on the latest block
10-
/// number.
11+
/// Test whether a block number is safe from a reorg for a specific chain based
12+
/// on the latest block number.
1113
pub fn is_safe_block_number(args: IsSafeBlockNumberArgs) -> bool {
1214
let safe_block_number = largest_safe_block_number((&args).into());
1315
args.block_number <= safe_block_number
@@ -33,8 +35,8 @@ impl<'a> From<&'a IsSafeBlockNumberArgs> for LargestSafeBlockNumberArgs {
3335
}
3436
}
3537

36-
/// The largest block number that is safe from a reorg for a specific chain based on the latest
37-
/// block number.
38+
/// The largest block number that is safe from a reorg for a specific chain
39+
/// based on the latest block number.
3840
pub fn largest_safe_block_number(args: LargestSafeBlockNumberArgs) -> u64 {
3941
args.latest_block_number
4042
.saturating_sub(safe_block_depth(args.chain_id))

crates/edr_eth/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
//! Ethereum types
44
//!
5-
//! Ethereum types as needed by EDR. In particular, they are based on the same primitive types as `revm`.
5+
//! Ethereum types as needed by EDR. In particular, they are based on the same
6+
//! primitive types as `revm`.
67
78
/// Ethereum access list types
89
pub mod access_list;

crates/edr_eth/src/receipt.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Part of this code was adapted from foundry and is distributed under their licenss:
1+
// Part of this code was adapted from foundry and is distributed under their
2+
// licenss:
23
// - https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/LICENSE-APACHE
34
// - https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/LICENSE-MIT
45
// For the original context see: https://github.com/foundry-rs/foundry/blob/01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4/anvil/core/src/eth/receipt.rs
@@ -404,8 +405,8 @@ mod tests {
404405
let deserialized: TypedReceipt<Log> = serde_json::from_str(&serialized).unwrap();
405406
assert_eq!(receipt, deserialized);
406407

407-
// This is necessary to ensure that the deser implementation doesn't expect a &str
408-
// where a String can be passed.
408+
// This is necessary to ensure that the deser implementation doesn't expect a
409+
// &str where a String can be passed.
409410
let serialized = serde_json::to_value(&receipt).unwrap();
410411
let deserialized: TypedReceipt<Log> = serde_json::from_value(serialized).unwrap();
411412

crates/edr_eth/src/receipt/transaction.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ pub struct TransactionReceipt<L> {
1919
pub transaction_index: u64,
2020
/// Address of the sender
2121
pub from: Address,
22-
/// Address of the receiver. `None` when it's a contract creation transaction.
22+
/// Address of the receiver. `None` when it's a contract creation
23+
/// transaction.
2324
pub to: Option<Address>,
24-
/// The contract address created, if the transaction was a contract creation, otherwise `None`.
25+
/// The contract address created, if the transaction was a contract
26+
/// creation, otherwise `None`.
2527
pub contract_address: Option<Address>,
2628
/// Gas used by this transaction alone.
2729
pub gas_used: U256,
28-
/// The actual value per gas deducted from the senders account. Before EIP-1559, this is equal
29-
/// to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas -
30-
/// baseFeePerGas, maxPriorityFeePerGas).
30+
/// The actual value per gas deducted from the senders account. Before
31+
/// EIP-1559, this is equal to the transaction's gas price. After, it is
32+
/// equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas,
33+
/// maxPriorityFeePerGas).
3134
pub effective_gas_price: U256,
3235
}
3336

crates/edr_eth/src/remote.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ pub enum Eip1898BlockSpec {
3232
Hash {
3333
/// the block hash
3434
block_hash: B256,
35-
/// whether the server should additionally raise a JSON-RPC error if the block is not in
36-
/// the canonical chain
35+
/// whether the server should additionally raise a JSON-RPC error if the
36+
/// block is not in the canonical chain
3737
require_canonical: Option<bool>,
3838
},
3939
/// to represent the Object { blockNumber } in EIP-1898

0 commit comments

Comments
 (0)