Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Bump alloy 14ed25d #8128

Merged
merged 9 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 118 additions & 92 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,38 @@ foundry-compilers = { version = "0.6.2", default-features = false }
# no default features to avoid c-kzg
revm = { version = "9.0.0", default-features = false }
revm-primitives = { version = "4.0.0", default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "a278649", features = [
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "5e3058a", features = [
"serde",
] }

## ethers
ethers-contract-abigen = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-gcp = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-signer-gcp = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "14ed25d", default-features = false }
alloy-primitives = { version = "0.7.1", features = ["getrandom", "rand"] }
alloy-dyn-abi = "0.7.1"
alloy-json-abi = "0.7.1"
Expand Down Expand Up @@ -247,4 +247,4 @@ soldeer = "0.2.15"
revm = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-interpreter = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-precompile = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-primitives = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-primitives = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
4 changes: 2 additions & 2 deletions crates/anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ mod tests {
let mut data = vec![];
let receipt = TypedReceipt::Legacy(ReceiptWithBloom {
receipt: Receipt {
status: false,
status: false.into(),
cumulative_gas_used: 0x1u128,
logs: vec![Log {
address: Address::from_str("0000000000000000000000000000000000000011").unwrap(),
Expand Down Expand Up @@ -1541,7 +1541,7 @@ mod tests {

let expected = TypedReceipt::Legacy(ReceiptWithBloom {
receipt: Receipt {
status: false,
status: false.into(),
cumulative_gas_used: 0x1u128,
logs: vec![Log {
address: Address::from_str("0000000000000000000000000000000000000011").unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ impl NodeConfig {
};

let block = provider
.get_block(BlockNumberOrTag::Number(fork_block_number).into(), false)
.get_block(BlockNumberOrTag::Number(fork_block_number).into(), false.into())
.await
.expect("Failed to get fork block");

Expand Down Expand Up @@ -1282,7 +1282,7 @@ async fn find_latest_fork_block<P: Provider<T, AnyNetwork>, T: Transport + Clone
// walk back from the head of the chain, but at most 2 blocks, which should be more than enough
// leeway
for _ in 0..2 {
if let Some(block) = provider.get_block(num.into(), false).await? {
if let Some(block) = provider.get_block(num.into(), false.into()).await? {
if block.header.hash.is_some() {
break;
}
Expand Down
13 changes: 10 additions & 3 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ impl EthApi {
let number = self.backend.ensure_block_number(Some(BlockId::Number(block_number))).await?;
if let Some(fork) = self.get_fork() {
if fork.predates_fork_inclusive(number) {
return Ok(fork.uncle_by_block_number_and_index(number, idx.into()).await?);
return Ok(fork.uncle_by_block_number_and_index(number, idx.into()).await?)
}
}
// It's impossible to have uncles outside of fork mode
Expand Down Expand Up @@ -1923,7 +1923,14 @@ impl EthApi {
if let Some(receipt) = self.backend.mined_transaction_receipt(tx.hash) {
if let Some(output) = receipt.out {
// insert revert reason if failure
if !receipt.inner.inner.as_receipt_with_bloom().receipt.status {
if !receipt
.inner
.inner
.as_receipt_with_bloom()
.receipt
.status
.coerce_status()
{
if let Some(reason) =
RevertDecoder::new().maybe_decode(&output, None)
{
Expand Down Expand Up @@ -2514,7 +2521,7 @@ impl EthApi {
if let BlockRequest::Number(number) = block_request {
if let Some(fork) = self.get_fork() {
if fork.predates_fork_inclusive(number) {
return Ok(fork.get_nonce(address, number).await?);
return Ok(fork.get_nonce(address, number).await?)
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ impl ExecutedTransaction {

// successful return see [Return]
let status_code = u8::from(self.exit_reason as u8 <= InstructionResult::SelfDestruct as u8);
let receipt_with_bloom: ReceiptWithBloom =
Receipt { status: status_code == 1, cumulative_gas_used: *cumulative_gas_used, logs }
.into();
let receipt_with_bloom: ReceiptWithBloom = Receipt {
status: (status_code == 1).into(),
cumulative_gas_used: *cumulative_gas_used,
logs,
}
.into();

match &self.transaction.pending_transaction.transaction.transaction {
TypedTransaction::Legacy(_) => TypedReceipt::Legacy(receipt_with_bloom),
Expand Down
8 changes: 5 additions & 3 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ impl ClientFork {
}

let provider = self.provider();
let block =
provider.get_block(block_number, false).await?.ok_or(BlockchainError::BlockNotFound)?;
let block = provider
.get_block(block_number, false.into())
.await?
.ok_or(BlockchainError::BlockNotFound)?;
let block_hash = block.header.hash.ok_or(BlockchainError::BlockNotFound)?;
let timestamp = block.header.timestamp;
let base_fee = block.header.base_fee_per_gas;
Expand Down Expand Up @@ -482,7 +484,7 @@ impl ClientFork {
&self,
block_id: impl Into<BlockId>,
) -> Result<Option<Block>, TransportError> {
if let Some(block) = self.provider().get_block(block_id.into(), true).await? {
if let Some(block) = self.provider().get_block(block_id.into(), true.into()).await? {
let hash = block.header.hash.unwrap();
let block_number = block.header.number.unwrap();
let mut storage = self.storage_write();
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/otterscan/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl EthApi {
node_info!("ots_getTransactionError");

if let Some(receipt) = self.backend.mined_transaction_receipt(hash) {
if !receipt.inner.inner.as_receipt_with_bloom().receipt.status {
if !receipt.inner.inner.as_receipt_with_bloom().receipt.status.coerce_status() {
return Ok(receipt.out.map(|b| b.0.into()).unwrap_or(Bytes::default()))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl TaskManager {
let provider = provider.clone();
let api = api.clone();
async move {
if let Ok(Some(block)) = provider.get_block(hash.into(), false).await {
if let Ok(Some(block)) = provider.get_block(hash.into(), false.into()).await {
let _ = api
.anvil_reset(Some(Forking {
json_rpc_url: None,
Expand Down
7 changes: 5 additions & 2 deletions crates/anvil/tests/it/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn test_can_set_genesis_timestamp() {

assert_eq!(
genesis_timestamp,
provider.get_block(0.into(), false).await.unwrap().unwrap().header.timestamp
provider.get_block(0.into(), false.into()).await.unwrap().unwrap().header.timestamp
);
}

Expand All @@ -71,5 +71,8 @@ async fn test_can_use_default_genesis_timestamp() {
let (_api, handle) = spawn(NodeConfig::test()).await;
let provider = handle.http_provider();

assert_ne!(0u64, provider.get_block(0.into(), false).await.unwrap().unwrap().header.timestamp);
assert_ne!(
0u64,
provider.get_block(0.into(), false.into()).await.unwrap().unwrap().header.timestamp
);
}
37 changes: 21 additions & 16 deletions crates/anvil/tests/it/anvil_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ async fn test_set_next_timestamp() {

api.evm_mine(None).await.unwrap();

let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

assert_eq!(block.header.number.unwrap(), 1);
assert_eq!(block.header.timestamp, next_timestamp.as_secs());

api.evm_mine(None).await.unwrap();

let next = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let next = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();
assert_eq!(next.header.number.unwrap(), 2);

assert!(next.header.timestamp > block.header.timestamp);
Expand All @@ -314,12 +314,12 @@ async fn test_evm_set_time() {

// mine a block
api.evm_mine(None).await.unwrap();
let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

assert!(block.header.timestamp >= timestamp.as_secs());

api.evm_mine(None).await.unwrap();
let next = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let next = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

assert!(next.header.timestamp > block.header.timestamp);
}
Expand All @@ -338,7 +338,7 @@ async fn test_evm_set_time_in_past() {

// mine a block
api.evm_mine(None).await.unwrap();
let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

assert!(block.header.timestamp >= timestamp.as_secs());
assert!(block.header.timestamp < now.as_secs());
Expand All @@ -353,42 +353,44 @@ async fn test_timestamp_interval() {
let interval = 10;

for _ in 0..5 {
let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

// mock timestamp
api.evm_set_block_timestamp_interval(interval).unwrap();
api.evm_mine(None).await.unwrap();

let new_block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let new_block =
provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

assert_eq!(new_block.header.timestamp, block.header.timestamp + interval);
}

let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

let next_timestamp = block.header.timestamp + 50;
api.evm_set_next_block_timestamp(next_timestamp).unwrap();

api.evm_mine(None).await.unwrap();
let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();
assert_eq!(block.header.timestamp, next_timestamp);

api.evm_mine(None).await.unwrap();

let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();
// interval also works after setting the next timestamp manually
assert_eq!(block.header.timestamp, next_timestamp + interval);

assert!(api.evm_remove_block_timestamp_interval().unwrap());

api.evm_mine(None).await.unwrap();
let new_block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let new_block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();

// offset is applied correctly after resetting the interval
assert!(new_block.header.timestamp > block.header.timestamp);

api.evm_mine(None).await.unwrap();
let another_block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let another_block =
provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();
// check interval is disabled
assert!(another_block.header.timestamp - new_block.header.timestamp < interval);
}
Expand Down Expand Up @@ -429,7 +431,8 @@ async fn can_get_node_info() {
let provider = handle.http_provider();

let block_number = provider.get_block_number().await.unwrap();
let block = provider.get_block(BlockId::from(block_number), false).await.unwrap().unwrap();
let block =
provider.get_block(BlockId::from(block_number), false.into()).await.unwrap().unwrap();

let expected_node_info = NodeInfo {
current_block_number: U64::from(0),
Expand Down Expand Up @@ -463,7 +466,8 @@ async fn can_get_metadata() {

let block_number = provider.get_block_number().await.unwrap();
let chain_id = provider.get_chain_id().await.unwrap();
let block = provider.get_block(BlockId::from(block_number), false).await.unwrap().unwrap();
let block =
provider.get_block(BlockId::from(block_number), false.into()).await.unwrap().unwrap();

let expected_metadata = AnvilMetadata {
latest_block_hash: block.header.hash.unwrap(),
Expand All @@ -488,7 +492,8 @@ async fn can_get_metadata_on_fork() {

let block_number = provider.get_block_number().await.unwrap();
let chain_id = provider.get_chain_id().await.unwrap();
let block = provider.get_block(BlockId::from(block_number), false).await.unwrap().unwrap();
let block =
provider.get_block(BlockId::from(block_number), false.into()).await.unwrap().unwrap();

let expected_metadata = AnvilMetadata {
latest_block_hash: block.header.hash.unwrap(),
Expand Down Expand Up @@ -541,7 +546,7 @@ async fn test_get_transaction_receipt() {
let receipt = provider.send_transaction(tx.clone()).await.unwrap().get_receipt().await.unwrap();

// the block should have the new base fee
let block = provider.get_block(BlockId::default(), false).await.unwrap().unwrap();
let block = provider.get_block(BlockId::default(), false.into()).await.unwrap().unwrap();
assert_eq!(block.header.base_fee_per_gas.unwrap(), new_base_fee.to::<u128>());

// mine blocks
Expand Down
Loading
Loading