Skip to content

Commit

Permalink
Merge branch 'main' into cargo-update
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Sep 25, 2023
2 parents 7d5269d + 1b17453 commit ea67e72
Show file tree
Hide file tree
Showing 11 changed files with 360 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ jobs:
experimental: true
- sim: pyspec
include: [shanghai/eip4895]
experimental: true
# Pyspec merge and earlier jobs
- sim: pyspec
include: [merge/]
Expand Down
19 changes: 19 additions & 0 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ members = [
"examples",
"examples/additional-rpc-namespace-in-cli",
"examples/rpc-db",
"examples/manual-p2p",
]
default-members = ["bin/reth"]

Expand Down Expand Up @@ -97,6 +98,9 @@ reth-tasks = { path = "./crates/tasks" }
reth-network = { path = "./crates/net/network" }
reth-network-api = { path = "./crates/net/network-api" }
reth-rpc-types-compat = { path = "./crates/rpc/rpc-types-compat" }
reth-discv4 = { path = "./crates/net/discv4" }
reth-eth-wire = { path = "./crates/net/eth-wire" }
reth-ecies = { path = "./crates/net/ecies" }

# revm
revm = { git = "https://github.com/bluealloy/revm", rev = "516f62cc" }
Expand Down Expand Up @@ -172,4 +176,4 @@ assert_matches = "1.5.0"

proptest = "1.0"
proptest-derive = "0.4"
serial_test = "2"
serial_test = "2"
5 changes: 5 additions & 0 deletions crates/revm/revm-inspectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ serde_json = { workspace = true, optional = true }
# js-tracing-inspector
boa_engine = { workspace = true, optional = true }
boa_gc = { workspace = true, optional = true }
# pin this until https://github.com/boa-dev/boa/issues/3299 is mitigated
icu_collections = "=1.2.0"
icu_provider_macros = "=1.2.0"
tinystr = "=0.7.1"

tokio = { version = "1", features = ["sync"], optional = true }

[features]
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/revm-inspectors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
)]
#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)]
#![warn(missing_docs, unreachable_pub)]
#![deny(unused_must_use, rust_2018_idioms)]
#![doc(test(
no_crate_inject,
Expand Down
27 changes: 24 additions & 3 deletions crates/rpc/rpc-types/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,37 @@ impl<T: Serialize> Serialize for Rich<T> {
/// BlockOverrides is a set of header fields to override.
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase", deny_unknown_fields)]
#[allow(missing_docs)]
pub struct BlockOverrides {
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Overrides the block number.
///
/// For `eth_callMany` this will be the block number of the first simulated block. Each
/// following block increments its block number by 1
// Note: geth uses `number`, erigon uses `blockNumber`
#[serde(default, skip_serializing_if = "Option::is_none", alias = "blockNumber")]
pub number: Option<U256>,
/// Overrides the difficulty of the block.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub difficulty: Option<U256>,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Overrides the timestamp of the block.
// Note: geth uses `time`, erigon uses `timestamp`
#[serde(default, skip_serializing_if = "Option::is_none", alias = "timestamp")]
pub time: Option<U64>,
/// Overrides the gas limit of the block.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gas_limit: Option<U64>,
/// Overrides the coinbase address of the block.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub coinbase: Option<Address>,
/// Overrides the prevrandao of the block.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub random: Option<H256>,
/// Overrides the basefee of the block.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub base_fee: Option<U256>,
/// A dictionary that maps blockNumber to a user-defined hash. It could be queried from the
/// solidity opcode BLOCKHASH.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub block_hash: Option<BTreeMap<u64, H256>>,
}

#[cfg(test)]
Expand Down Expand Up @@ -380,4 +395,10 @@ mod tests {
let deserialized: Block = serde_json::from_str(&serialized).unwrap();
assert_eq!(block, deserialized);
}

#[test]
fn block_overrides() {
let s = r#"{"blockNumber": "0xe39dd0"}"#;
let _overrides = serde_json::from_str::<BlockOverrides>(s).unwrap();
}
}
11 changes: 9 additions & 2 deletions crates/rpc/rpc-types/src/eth/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ pub struct CallRequest {
/// Max Fee per Blob gas for EIP-4844 transactions
pub max_fee_per_blob_gas: Option<U256>,
/// Blob Versioned Hashes for EIP-4844 transactions
#[serde(default)]
pub blob_versioned_hashes: Vec<H256>,
#[serde(skip_serializing_if = "Option::is_none")]
pub blob_versioned_hashes: Option<Vec<H256>>,
/// EIP-2718 type
#[serde(rename = "type")]
pub transaction_type: Option<U8>,
Expand All @@ -129,9 +129,16 @@ impl CallRequest {
/// Returns the configured fee cap, if any.
///
/// The returns `gas_price` (legacy) if set or `max_fee_per_gas` (EIP1559)
#[inline]
pub fn fee_cap(&self) -> Option<U256> {
self.gas_price.or(self.max_fee_per_gas)
}

/// Returns true if the request has a `blobVersionedHashes` field but it is empty.
#[inline]
pub fn has_empty_blob_hashes(&self) -> bool {
self.blob_versioned_hashes.as_ref().map(|blobs| blobs.is_empty()).unwrap_or(false)
}
}

/// Helper type that supports both `data` and `input` fields that map to transaction input data.
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ where
access_list: request.access_list.clone(),
max_priority_fee_per_gas: Some(U256::from(max_fee_per_gas)),
transaction_type: None,
blob_versioned_hashes: Vec::new(),
blob_versioned_hashes: None,
max_fee_per_blob_gas: None,
},
BlockId::Number(BlockNumberOrTag::Pending),
Expand Down
Loading

0 comments on commit ea67e72

Please sign in to comment.