from to new

This commit is contained in:
sean 2023-02-05 16:55:55 -05:00
parent 94a369b9df
commit 90e25dc6cf
2 changed files with 13 additions and 8 deletions

View File

@ -40,8 +40,7 @@ pub enum Error {
PayloadIdUnavailable, PayloadIdUnavailable,
TransitionConfigurationMismatch, TransitionConfigurationMismatch,
PayloadConversionLogicFlaw, PayloadConversionLogicFlaw,
DeserializeTransaction(ssz_types::Error), SszError(ssz_types::Error),
DeserializeTransactions(ssz_types::Error),
DeserializeWithdrawals(ssz_types::Error), DeserializeWithdrawals(ssz_types::Error),
BuilderApi(builder_client::Error), BuilderApi(builder_client::Error),
IncorrectStateVariant, IncorrectStateVariant,
@ -89,6 +88,12 @@ impl From<rlp::DecoderError> for Error {
} }
} }
impl From<ssz_types::Error> for Error {
fn from(e: ssz_types::Error) -> Self {
Error::SszError(e)
}
}
#[derive(Clone, Copy, Debug, PartialEq, IntoStaticStr)] #[derive(Clone, Copy, Debug, PartialEq, IntoStaticStr)]
#[strum(serialize_all = "snake_case")] #[strum(serialize_all = "snake_case")]
pub enum PayloadStatusV1Status { pub enum PayloadStatusV1Status {

View File

@ -2084,7 +2084,6 @@ fn noop<T: EthSpec>(_: &ExecutionLayer<T>, _: &ExecutionPayload<T>) -> Option<Ex
fn ethers_tx_to_bytes<T: EthSpec>( fn ethers_tx_to_bytes<T: EthSpec>(
transaction: &Transaction, transaction: &Transaction,
) -> Result<SszTransaction<T::MaxBytesPerTransaction>, ApiError> { ) -> Result<SszTransaction<T::MaxBytesPerTransaction>, ApiError> {
let tx_type = transaction let tx_type = transaction
.transaction_type .transaction_type
.ok_or(ApiError::BlobTxConversionError)? .ok_or(ApiError::BlobTxConversionError)?
@ -2103,22 +2102,23 @@ fn ethers_tx_to_bytes<T: EthSpec>(
let gas = std::cmp::min(transaction.gas, Uint256::from(u64::MAX)).as_u64(); let gas = std::cmp::min(transaction.gas, Uint256::from(u64::MAX)).as_u64();
let to = transaction.to; let to = transaction.to;
let value = transaction.value; let value = transaction.value;
let data = VariableList::from(transaction.input.to_vec()); let data = VariableList::new(transaction.input.to_vec())?;
let access_list = VariableList::from( let access_list = VariableList::new(
transaction transaction
.access_list.as_ref() .access_list
.as_ref()
.ok_or(ApiError::BlobTxConversionError)? .ok_or(ApiError::BlobTxConversionError)?
.0 .0
.iter() .iter()
.map(|access_tuple| { .map(|access_tuple| {
Ok(AccessTuple { Ok(AccessTuple {
address: access_tuple.address, address: access_tuple.address,
storage_keys: VariableList::from(access_tuple.storage_keys.clone()), storage_keys: VariableList::new(access_tuple.storage_keys.clone())?,
}) })
}) })
.collect::<Result<Vec<AccessTuple>, ApiError>>()?, .collect::<Result<Vec<AccessTuple>, ApiError>>()?,
); )?;
let max_fee_per_data_gas = transaction let max_fee_per_data_gas = transaction
.other .other
.get("max_fee_per_data_gas") .get("max_fee_per_data_gas")