Skip to content

chore: rm work type #10474

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

Merged
merged 1 commit into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 2 additions & 26 deletions crates/anvil/core/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
use alloy_primitives::{Bytes, B256, U256};
use alloy_primitives::Bytes;
use alloy_rpc_types::TransactionRequest;
use serde::{Deserialize, Serialize, Serializer};

/// Represents the result of `eth_getWork`.
///
/// This may or may not include the block number.
#[derive(Debug, Default, PartialEq, Eq)]
pub struct Work {
pub pow_hash: B256,
pub seed_hash: B256,
pub target: B256,
pub number: Option<u64>,
}

impl Serialize for Work {
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
if let Some(num) = self.number {
(&self.pow_hash, &self.seed_hash, &self.target, U256::from(num)).serialize(s)
} else {
(&self.pow_hash, &self.seed_hash, &self.target).serialize(s)
}
}
}
use serde::Deserialize;

/// Represents the options used in `anvil_reorg`
#[derive(Debug, Clone, Deserialize)]
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use alloy_rpc_types::{
},
txpool::{TxpoolContent, TxpoolInspect, TxpoolInspectSummary, TxpoolStatus},
AccessList, AccessListResult, BlockId, BlockNumberOrTag as BlockNumber, BlockTransactions,
EIP1186AccountProofResponse, FeeHistory, Filter, FilteredParams, Index, Log,
EIP1186AccountProofResponse, FeeHistory, Filter, FilteredParams, Index, Log, Work,
};
use alloy_serde::WithOtherFields;
use alloy_transport::TransportErrorKind;
Expand All @@ -76,7 +76,7 @@ use anvil_core::{
wallet::{WalletCapabilities, WalletError},
EthRequest,
},
types::{ReorgOptions, TransactionData, Work},
types::{ReorgOptions, TransactionData},
};
use anvil_rpc::{error::RpcError, response::ResponseResult};
use foundry_common::provider::ProviderBuilder;
Expand Down