chore: alloy 0.14 (#15635)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Yash Atreya
2025-04-11 11:58:57 +05:30
committed by GitHub
parent 2563e93d95
commit 58fe204ff2
126 changed files with 968 additions and 868 deletions

View File

@@ -68,7 +68,7 @@ pub fn maybe_generate_tests(
// get random instance of type
let mut raw = vec![0u8; 1024];
rand::thread_rng().fill_bytes(&mut raw);
rand::rng().fill_bytes(&mut raw);
let mut unstructured = arbitrary::Unstructured::new(&raw[..]);
let val: Result<super::#type_ident, _> = arbitrary::Arbitrary::arbitrary(&mut unstructured);
if val.is_err() {

View File

@@ -84,7 +84,7 @@ mod tests {
address: address!("0xdac17f958d2ee523a2206206994597c13d831ec7"),
nonce: 1,
}
.into_signed(alloy_primitives::PrimitiveSignature::new(
.into_signed(alloy_primitives::Signature::new(
b256!("0x1fd474b1f9404c0c5df43b7620119ffbc3a1c3f942c73b6e14e9f55255ed9b1d").into(),
b256!("0x29aca24813279a901ec13b5f7bb53385fa1fc627b946592221417ff74a49600d").into(),
false,

View File

@@ -1,7 +1,7 @@
//! Compact implementation for [`Signature`]
use crate::Compact;
use alloy_primitives::{PrimitiveSignature as Signature, U256};
use alloy_primitives::{Signature, U256};
impl Compact for Signature {
fn to_compact<B>(&self, buf: &mut B) -> usize

View File

@@ -3,7 +3,7 @@ use alloy_consensus::{
transaction::RlpEcdsaEncodableTx, EthereumTxEnvelope, Signed, Transaction, TxEip1559,
TxEip2930, TxEip7702, TxLegacy, TxType,
};
use alloy_primitives::PrimitiveSignature;
use alloy_primitives::Signature;
use bytes::{Buf, BufMut};
/// A trait for extracting transaction without type and signature and serializing it using
@@ -42,7 +42,7 @@ pub(super) trait FromTxCompact {
fn from_tx_compact(
buf: &[u8],
tx_type: Self::TxType,
signature: PrimitiveSignature,
signature: Signature,
) -> (Self, &[u8])
where
Self: Sized;
@@ -66,7 +66,7 @@ impl<Eip4844: Compact + Transaction> FromTxCompact for EthereumTxEnvelope<Eip484
fn from_tx_compact(
buf: &[u8],
tx_type: TxType,
signature: PrimitiveSignature,
signature: Signature,
) -> (Self, &[u8]) {
match tx_type {
TxType::Legacy => {
@@ -99,14 +99,14 @@ impl<Eip4844: Compact + Transaction> FromTxCompact for EthereumTxEnvelope<Eip484
}
pub(super) trait Envelope: FromTxCompact<TxType: Compact> {
fn signature(&self) -> &PrimitiveSignature;
fn signature(&self) -> &Signature;
fn tx_type(&self) -> Self::TxType;
}
impl<Eip4844: Compact + Transaction + RlpEcdsaEncodableTx> Envelope
for EthereumTxEnvelope<Eip4844>
{
fn signature(&self) -> &PrimitiveSignature {
fn signature(&self) -> &Signature {
Self::signature(self)
}
@@ -184,7 +184,7 @@ impl<T: Envelope + ToTxCompact + Transaction + Send + Sync> CompactEnvelope for
let tx_bits = (flags & 0b110) >> 1;
let zstd_bit = flags >> 3;
let (signature, buf) = PrimitiveSignature::from_compact(buf, sig_bit);
let (signature, buf) = Signature::from_compact(buf, sig_bit);
let (tx_type, buf) = T::TxType::from_compact(buf, tx_bits);
let (transaction, buf) = if zstd_bit != 0 {

View File

@@ -12,7 +12,7 @@ use crate::{
use alloy_consensus::{
constants::EIP7702_TX_TYPE_ID, Signed, TxEip1559, TxEip2930, TxEip7702, TxLegacy,
};
use alloy_primitives::{Address, Bytes, PrimitiveSignature, Sealed, TxKind, B256, U256};
use alloy_primitives::{Address, Bytes, Signature, Sealed, TxKind, B256, U256};
use bytes::BufMut;
use op_alloy_consensus::{OpTxEnvelope, OpTxType, OpTypedTransaction, TxDeposit as AlloyTxDeposit};
use reth_codecs_derive::add_arbitrary_tests;
@@ -186,7 +186,7 @@ impl FromTxCompact for OpTxEnvelope {
fn from_tx_compact(
buf: &[u8],
tx_type: OpTxType,
signature: PrimitiveSignature,
signature: Signature,
) -> (Self, &[u8]) {
match tx_type {
OpTxType::Legacy => {
@@ -218,11 +218,11 @@ impl FromTxCompact for OpTxEnvelope {
}
}
const DEPOSIT_SIGNATURE: PrimitiveSignature =
PrimitiveSignature::new(U256::ZERO, U256::ZERO, false);
const DEPOSIT_SIGNATURE: Signature =
Signature::new(U256::ZERO, U256::ZERO, false);
impl Envelope for OpTxEnvelope {
fn signature(&self) -> &PrimitiveSignature {
fn signature(&self) -> &Signature {
match self {
Self::Legacy(tx) => tx.signature(),
Self::Eip2930(tx) => tx.signature(),

View File

@@ -67,7 +67,7 @@ impl Compact for BranchNodeCompact {
buf.put_slice(root_hash.as_slice());
}
for hash in &self.hashes {
for hash in self.hashes.iter() {
buf_size += B256::len_bytes();
buf.put_slice(hash.as_slice());
}