Giter Club home page Giter Club logo

alloy's Introduction

Alloy

Alloy connects applications to blockchains.

Alloy is a rewrite of ethers-rs from the ground up, with exciting new features, high performance, and excellent docs.

We also have a book on all things Alloy and many examples to help you get started.

Telegram chat

Installation

Alloy consists of a number of crates that provide a range of functionality essential for interfacing with any Ethereum-based blockchain.

The easiest way to get started is to add the alloy crate with the full feature flag from the command-line using Cargo:

cargo add alloy --features full

Alternatively, you can add the following to your Cargo.toml file:

alloy = { version = "0.1", features = ["full"] }

For a more fine-grained control over the features you wish to include, you can add the individual crates to your Cargo.toml file, or use the alloy crate with the features you need.

A comprehensive list of available features can be found on docs.rs or in the alloy crate's Cargo.toml.

Overview

This repository contains the following crates:

Supported Rust Versions (MSRV)

The current MSRV (minimum supported rust version) is 1.76.

Alloy will keep a rolling MSRV policy of at least two versions behind the latest stable release (so if the latest stable release is 1.58, we would support 1.56).

Note that the MSRV is not increased automatically, and only as part of a patch (pre-1.0) or minor (post-1.0) release.

Contributing

Thanks for your help improving the project! We are so happy to have you! We have a contributing guide to help you get involved in the Alloy project.

Pull requests will not be merged unless CI passes, so please ensure that your contribution follows the linting rules and passes clippy.

Note on no_std

Because these crates are primarily network-focused, we do not intend to support no_std for most of them at this time.

The following crates support no_std:

  • alloy-eips
  • alloy-genesis
  • alloy-serde
  • alloy-consensus

If you would like to add no_std support to a crate, please make sure to update scripts/check_no_std.sh as well.

Credits

None of these crates would have been possible without the great work done in:

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in these crates by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

alloy's People

Contributors

0xqd avatar alexfertel avatar clabby avatar danipopes avatar developeruche avatar dothebesttogetthebest avatar ebolon avatar emperororokusaki avatar evalir avatar fgimenez avatar jackg-eth avatar jsvisa avatar klkvr avatar leruaa avatar mattsse avatar moricho avatar nicolaswent avatar nkysg avatar onbjerg avatar prestwich avatar rakita avatar rexcloud avatar rjected avatar robinsdan avatar stackoverflowexcept1on avatar tcoratger avatar teddav avatar yash-atreya avatar yjhmelody avatar zerosnacks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alloy's Issues

[Feature] Initial `Network` abstraction spec

Component

rpc-types

Describe the feature you would like

Blocked by #77

trait Network { 
    const __ASSERT_ZST: () = { assert!(std::mem::size_of::<Self>() == 0); };
    type TransactionResponse: RpcObject;
    type TransactionRequest: RpcObject;
    type Receipt: RpcObject;
    type Header: RpcObject;
}

// Modify existing block types in rpc-types/src/eth/block.rs
enum BlockTransactions<N: Network> {
    Hashes(Vec<B256>),
    Full(Vec<N::TransactionResponse>),
    Uncle,
}

struct BlockFor<N: Network> {
    #[serde(flatten)]
    pub     header: N::Header,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub total_difficulty: Option<U256>,

    pub uncles: Vec<B256>,

    #[serde(skip_serializing_if = "BlockTransactions::is_uncle")]
    pub transactions: BlockTransactions<N>,

    pub size: Option<U256>,

    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub withdrawals: Option<Vec<Withdrawal>>,
}

Additional context

No response

[Bug] JSON-RPC: `RequestPacket` serializes only the request portion, not the entire JSON-RPC request

Component

json-rpc

What version of Alloy are you on?

latest

Operating System

macOS (Apple Silicon)

Describe the bug

When serializing a single RequestPacket, only the request part of the SerializedRequest is serialized, and doesn't the include the id or method. This means that an invalid request is created as no id or method is sent. This leads to the error Error response: ErrorPayload { code: -32600, message: "Invalid json-rpc request", data: None }

The fix I found was to add a new Payload struct that contains the id, method and params and serialize that.

[Feature] Adding EIP-712 Transaction support

Component

consensus, eips, genesis

Describe the feature you would like

Objective

Enhance Alloy to support EIP-712 transactions, enabling account abstraction / deployment for zkSync users that want to make use of alloy for their projects and tooling. In order to do so, alloy would need to support 712-transactions. Example:

pub struct Eip712Transaction {
    pub tx_type: U256,
    pub from: Address,
    pub to: Address,
    pub gas_limit: U256,
    pub gas_per_pubdata_byte_limit: U256,
    pub max_fee_per_gas: U256,
    pub max_priority_fee_per_gas: U256,
    pub paymaster: Address,
    pub nonce: U256,
    pub value: U256,
    pub data: Bytes,
    pub factory_deps: Vec<Bytes>,
    pub paymaster_input: Bytes,
    pub chain_id: U256,
}

Additional context

Resources

There is an initial implementation in zkSync rust-web3-rs sdk of 712-transactions which can be viewed here: 712-tx. It would be great to be able to extend alloy to include this functionality / support.

[Bug] Inconsistent types between revm and `rpc-types` access lists

Component

rpc-types

What version of Alloy are you on?

latest

Operating System

None

Describe the bug

REVM access lists are U256, while we use FixedBytes<32>. We should use the same ones for both. We may have a mild preference for U256 in the JSON rpc request type because the encoding is significantly shorter for common cases

[Feature] Make Provider (RpcClient) Clone

Component

providers

Describe the feature you would like

currently the Provider and RpcClient are not Clone which is a limitation when we want to use a provider in a type that ideally is Cloneable, otherwise we'd need to go back to Arc<Provider>

all of this can be made Clone, we already assume that Transport is Clone for the Provider to work:

pub struct RpcClient<T> {
/// The underlying transport.
pub(crate) transport: T,
/// `true` if the transport is local.
pub(crate) is_local: bool,
/// The next request ID to use.
pub(crate) id: AtomicU64,
}

Additional context

No response

[Feature] feat(`rpc-types`/`eips`): Unify or provide `From` impls for duplicated types, such as `AccessList`

Component

consensus, eips, genesis, rpc

Describe the feature you would like

Right now, there's a few types between rpc-types and eips which could be consolidated, such as the AccessList type, although the types in eips do implement different utilities like arbitrary traits, while the types in rpc-types are only concerned with rpc.

If we don't want to unify them, we can provide From impls between them to avoid having to write conversion functions whenever we use both.

Additional context

No response

[Bug] Signers apply EIP-155 even for EIP-{1559,2718} transactions

Component

signers

What version of Alloy are you on?

No response

Operating System

None

Describe the bug

Signers::sign_transaction and SignerSync::sign_transaction_sync should not apply EIP-155 when the signer's chain_id is None. Indeed, this is the expected behavior according to Signer's docstring, but EIP-155 is applied anyway if the chain ID is found on the transaction instead.

Ref:

if let Some(chain_id) = chain_id.or_else(|| tx.chain_id()) {

EIP-{1559,2718} always embed a chain ID value but they're not compatible with EIP-155. Thus, they get an EIP-155 signature when they shouldn't.

[Bug] Some transactions may fail signing on Ledger

Component

signers

What version of Alloy are you on?

d024781

Operating System

Linux

Describe the bug

During testing for #161 I encountered a legacy transaction that failed signing with: Code 6a80 APDU_CODE_BAD_KEY_HANDLE

It seems that this only happens with specific calldata that might be known to the device.

This is the transaction:

async fn test_sign_tx_legacy() {
// https://github.com/gakonst/ethers-rs/blob/90b87bd85be98caa8bb592b67f3f9acbc8a409cf/ethers-signers/src/ledger/app.rs#L321
let mut tx = alloy_consensus::TxLegacy {
nonce: 5,
gas_price: 400e9 as u128,
gas_limit: 1000000,
to: alloy_consensus::TxKind::Call(address!("2ed7afa17473e17ac59908f088b4371d28585476")),
// TODO: this fails for some reason with 6a80 APDU_CODE_BAD_KEY_HANDLE
// approve uni v2 router 0xff
// input: bytes!("095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
input: bytes!("01020304"),
value: U256::from(100e18 as u128),
chain_id: Some(69420),
};
/*
assert_eq!(tx.encoded_for_signing(), hex!("f87005855d21dba000830f4240942ed7afa17473e17ac59908f088b4371d2858547689056bc75e2d63100000b844095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
*/
test_sign_tx_generic(&mut tx).await;
}

Ported from an ethers-rs test, which also failed with the same error.

[Bug] Incorrect Deserialize for PubSubItem::Notification

Component

json-rpc

What version of Alloy are you on?

v0.1.0 (latest main branch)

Operating System

Linux

Describe the bug

Looking at:

"id" => {
if id.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id = Some(map.next_value()?);
}
"subscription" => {
if subscription.is_some() {
return Err(serde::de::Error::duplicate_field("subscription"));
}
subscription = Some(map.next_value()?);
}
"result" => {
if result.is_some() {
return Err(serde::de::Error::duplicate_field("result"));
}
result = Some(map.next_value()?);
}

It seems PubSubItem try to deserialize an EthNotification from a json that looks like this:

{
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "subscription": "0x..."
  "result": {},
}

Whereas the correct json is like this:

{
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "params": {
    "subscription": "0x..."
    "result": {},
  }
}

Maybe improve tower::Service trait types?

Component

network, json-rpc, rpc, transports

Describe the feature you would like

If I understood everything correctly, the current types are

pub enum ResponsePacket<Payload = Box<RawValue>, ErrData = Box<RawValue>> {
    Single(Response<Payload, ErrData>),
    Batch(Vec<Response<Payload, ErrData>>),
}

The overall tower::Service Error type is

type Error = alloy_transport::TransportError;

In a single call type, if there's a transport error or serialization error, it can return an error for tower::Service. Though, for a single failure in a batch call, the responses can only return RPC errors. If a single RPC call in the batch needs to return a serialization or transport related error, it must fail all of the other calls in the batch.

I tried to fix this issue in the transport I was writing by using transport and serialization errors as RPC errors, which isn't consistent with how provider errors are supposed to be interpreted.

Additional context

No response

[Feature] `AnyNetwork`

Component

providers, rpc-types

Describe the feature you would like

implement the network trait from #80 for an AnyNetwork which contains the standard ethereum JSON-RPC types + an extra_fields: HashMap<String, Value>. If necessary, differentiate AnyTransaction from the transaction types described in #73

Additional context

No response

[Bug] Single-paremeter requests do not serialize correctly to array of items

Component

json-rpc

What version of Alloy are you on?

latest

Operating System

macOS (Apple Silicon)

Describe the bug

When issuing single-parameter json-rpc requests to endpoints like eth_getBalance, it seems they are not serialized correctly to still send an array of params in JSON, failing with the following error: ErrorPayload { code: -32600, message: "Invalid json-rpc request", data: None }

The workaround is to make Params be a Vec<_>, but this should not be necessary.

Should these derive the rlp encodable macro?

pub enum TypedTransactionRequest {

if not how should i serialize my transaction to be be signed. Working on something like thi

       let mut payload = Self::path_to_bytes(&self.derivation);

        // need to figure out how to encode the alloy TypedTransactionRequest into a Vec<u8>
        payload.extend_from_slice(tx.encode().as_slice());

        let mut signature = self.sign_payload(Instruction::Sign, &payload).await?;

Remove catch-all on `TransactionReceipt` and `Block` and use `Rich`

Component

rpc-types

What version of Alloy are you on?

No response

Operating System

None

Describe the bug

#66 was expedited to unblock the providers migration on foundry. However, this introduces a catch-all that we'd rather not have. Once foundry-rs/foundry#6219 is merged we should remove this catch-all field and instead use a wrapper type WithExtraFields<T> that can hold arbitrary values on the map, and the original type too.

[Bug] Pubsub backend reconnect doesn't work

Component

pubsub

What version of Alloy are you on?

v0.1.0 (commit 50e38e8)

Operating System

Linux

Describe the bug

I'm using pubsub to subscribe to neHeads and logs via my Alchemy provider, and a get this error a few times a day:

ERROR WS connection error while receiving a response err=WebSocket protocol error: Connection reset without closing handshake

immediately followed by these logs:

 INFO Reconnecting pubsub service backend.
DEBUG Draining old backend to_handle
DEBUG Reissuing pending requests count=0
DEBUG Re-starting active subscriptions count=2

And that's it, I don't receive notifications anymore after that.

After adding more traces I noticed that new subscriptions are sent to the server, but the responses are not handled, because the reconnect logic doesn't add back in-flight request, and it's needed:

fn handle_item(&mut self, item: PubSubItem) -> TransportResult<()> {
match item {
PubSubItem::Response(resp) => match self.in_flights.handle_response(resp) {
Some((server_id, in_flight)) => self.handle_sub_response(in_flight, server_id),
None => Ok(()),
},
PubSubItem::Notification(notification) => {
self.subs.notify(notification);
Ok(())
}
}
}

Another issue: Looking at PubSubService::reconnect(), I noticed that all server ids are dropped, leading to close the connection between the backend and the frontend.

[Feature] Add Transaction types, implement `sign_transaction`

Component

providers

Describe the feature you would like

builder style Request types (Optional fields) that have a corresponding Transaction type (valid Transaction).

yes, love this plan :)

going from Request -> Transaction is what we called fill in ethers.

This is a little more complex, I think. The TransactionRequest generally allows a from field, which the Transaction that implements RLP should not

So we may want something like:

  • Transaction - complete, no from field, implements RLP, no serde
  • SignedTransaction - complete, no from field, contains Transaction + Signature, no serde
  • TransactionRequest - builder for the JSON request object
  • Provider::fill(&mut TransactionRequest)
    • populates all possible fields from RPC node
    • should ensure that TransactionRequest::try_into_transaction definitely succeeds
  • Signer::sign_transaction(&TransactionRequest) -> Result<SignedTransaction>
    • errors when the request is missing info, or if from is populated with address signer can't sign from
  • TransactionResponse - JSON object returned by eth_getTransactionByXXXX methods
    • should ALWAYS contain a SignedTransaction

Originally posted by @prestwich in #44 (comment)

Additional context

No response

[Bug] `alloy_consensus`: Incorrect legacy signer being recovered

Component

consensus

What version of Alloy are you on?

latest

Operating System

macOS (Apple Silicon)

Describe the bug

Decoding a legacy transaction from its raw RLP seems to not work.

Using https://etherscan.io/tx/0x280cde7cdefe4b188750e76c888f13bd05ce9a4d7767730feefe8a0e50ca6fc4 as an example, we can access the raw RLP in Etherscan: https://etherscan.io/getRawTx?tx=0x280cde7cdefe4b188750e76c888f13bd05ce9a4d7767730feefe8a0e50ca6fc4 . As we can see, the expected signer is 0xa12e1462d0ced572f396f58b6e2d03894cd7c8a4. Although, when running a test to recover the signer using alloy, it gives 0x133e78b108f8ffb7b1e07790d60e2babbcc9b3d8, which is not the expected signer.

Test vector:

    #[test]
    #[cfg(feature = "k256")]
    fn decode_legacy_and_recover_signer() {
        use crate::TxLegacy;
        use alloy_network::Signed;
        use alloy_primitives::address;

        let raw_tx = "f9015482078b8505d21dba0083022ef1947a250d5630b4cf539739df2c5dacb4c659f2488d880c46549a521b13d8b8e47ff36ab50000000000000000000000000000000000000000000066ab5a608bd00a23f2fe000000000000000000000000000000000000000000000000000000000000008000000000000000000000000048c04ed5691981c42154c6167398f95e8f38a7ff00000000000000000000000000000000000000000000000000000000632ceac70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006c6ee5e31d828de241282b9606c8e98ea48526e225a0c9077369501641a92ef7399ff81c21639ed4fd8fc69cb793cfa1dbfab342e10aa0615facb2f1bcf3274a354cfe384a38d0cc008a11c2dd23a69111bc6930ba27a8";

        let tx = <Signed<TxLegacy> as Decodable>::decode(&mut alloy_primitives::hex::decode(raw_tx).unwrap().as_slice()).unwrap();
        let recovered = tx.recover_signer().unwrap();
        let expected = address!("a12e1462d0ceD572f396F58B6E2D03894cD7C8a4");
        assert_eq!(expected, recovered, "Expected same signer");
    }

Test vector obtained from gakonst/ethers-rs#1732 โ€” both issues seem to be very similar.

[Feature]: Use release-plz for automatic releases and semantic versioning

I want to recommend that this repository use release-plz for automatic semantic versioning and releases. When done manually this is error prone and can cause trouble for down stream dependancies. As the rust ethereum ecosystem starts to stabilize i think this is a good idea that preemptively reduces probability of incorrectly incremented semver, and upstream breaking changes. Release please will detect diffs between main and the last release tag, auto detect and increment semantic versioning in a PR and open that PR with a release tag, new semver, and a change log of the commit history. If you like i can open a PR that is an example of configuring this, however, it's important to note that the owner of the project must configure the github secret and if you want to auto publish to crates.io also the api key for crates. I think this is an important step towards more stability for the rust ethereum ecosystem.

[Feature] Add Signer WASM support

Component

providers

Describe the feature you would like

We should be able to support WASM for at least the Signer/SignerSync traits and Ledger signer. For the former, only rand/getrand is blocking

Additional context

No response

[Feature] Subscription broadcast buffer size is fixed

Component

providers, pubsub

Describe the feature you would like

The buffer size for subscriptions is currently a constant.

impl ActiveSubscription {
/// Create a new active subscription.
pub(crate) fn new(request: SerializedRequest) -> (Self, broadcast::Receiver<Box<RawValue>>) {
let local_id = request.params_hash();
let (tx, rx) = broadcast::channel(16);

This should be configurable.

we should add settings for the

pub(crate) struct PubSubService<T> {

so you can call connect(connector, settings)

wdyt @prestwich

Additional context

No response

[Feature] Catch all for extra data in block headers

Component

No response

Describe the feature you would like

Foundry has some special handling for some L2s (e.g. Arbitrum), and we use a catch all/fallback field in the block header to look up extra properties on these L2s. This is both used in the forking backend (here) and in Cast (to show all fields in e.g. cast block)

Additional context

No response

[Feature] Block heartbeat coroutine & pending transaction

Component

providers, rpc-client

Describe the feature you would like

A task that subscribes to block headers, and allows watching blocks for confirmed transactions, and notifying subscribers

Task should

  • contains a subscription to block headers
  • contain a tx_hash_receiver: tokio::sync::mpsc::Receiver<(B256, broadcast::Sender<()>)>
  • contain a tx_senders: HashMap<B256, tokio::sync::broadcast::Sender<()>>
  • retrieve each block as the header notification occurs
  • detect missing block header notifications and retrieve those blocks as well
  • iterate over all txn hashes in the block
  • dispatch a notification to the appropriate channel, if necessary.

maybe feature

  • store txns and rebroadcast them every N seconds?

Pending Transaction

  • contains an RpcClient ref
  • thin wrapper around tokio::sync::broadcast::Receiver
  • on receipt of notification, retrieves the receipt via eth_getTransactionReceipt
  • impl Future { type Output = RpcResult<Receipt>; }

Modify RpcClient

  • hold a tokio::sync::mpsc called tx_hash_sender which communicates tx hashes to watch for to the co-routine

Provider method

  • modify send_transaction and send_raw_transaction to send hashes via the tx_hash_sender AFTER broadcast

Additional context

unreachable!

Component

providers

Describe the feature you would like

in the crate dir, under rpc-client/call.rs for error handling the code currently uses unreachable! when it encounters an incorrect state. won't it be better to use custom errors Instead of using unreachable! or maybe i'm missing something

Additional context

No response

[Feature] Wasm Compatibility for transports

Component

transports

Describe the feature you would like

Remove the + Send from the Transport Service dyn futures, and the Conn::Future: Send bound from impls when #[cfg(target_arch = "wasm32")]

Additional context

Turn WASM CI back on

[Feature] alloy-consensus

Component

new component

Describe the feature you would like

contains primitive txn and receipt types, and transaction traits as described in #73 and #77

add to CI components list

Additional context

No response

[Bug] Block header subscription never yields on stream

Component

network, json-rpc, rpc

What version of Alloy are you on?

https://github.com/alloy-rs/alloy#e104f7df

Operating System

macOS (Apple Silicon)

Describe the bug

Expected behavior: Client subscribes and receives blocks.

Actual behavior: Client never receives blocks.

use alloy_rpc_client::{ClientBuilder, RpcClient, WsConnect};
use alloy_rpc_types::pubsub::{SubscriptionKind};
use alloy_pubsub::PubSubFrontend;

#[derive(Debug)]
struct Listener<PubSubFrontend> {
    rpc_client: RpcClient<PubSubFrontend>,
}

impl Listener<PubSubFrontend>
{
    fn new(rpc_client: RpcClient<PubSubFrontend>) -> Self {
        Self { rpc_client }
    }

    async fn run(&self) -> anyhow::Result<()> {
        println!("Subscribing to new block headers");
        // Prepare the request
        let subscribe_request = self.rpc_client.prepare("eth_subscribe",  [serde_json::to_value(SubscriptionKind::NewHeads)?]);

        // Make the request with a 2 second timeout
        let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), subscribe_request);

        // Unwrap the response
        let subscriber_id =  timeout.await.unwrap().unwrap();
        println!("Subscribed to new block headers with subscriber id: {:?}", subscriber_id);

        let mut block_rx = self.rpc_client.get_watcher(subscriber_id).await;

        println!("Receiving new block heads");

        loop {
            // This should loop forever getting new block heads
            let block_head = block_rx.recv().await.unwrap();
            println!("Got new block head");
        }
    }


}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
        println!("Starting block listener");
        // Get a websocket connector
        let connector = WsConnect { url: "ws://redacted.to_string(), auth: None };
        let client = ClientBuilder::default().pubsub(connector).await.unwrap();
        // Start the block listener
        let listener = Listener::new(client);
        listener.run().await
}

[Bug] Block number bits inconsistent

Component

providers

What version of Alloy are you on?

0.1.0

Operating System

Linux

Describe the bug

The type for block numbers is inconsistent across the API

For example:

  • BlockNumberOrTag::Number(u64) in RPC types
  • Provider::get_block_number gives a U256
  • number in Header in RPC types is Option<U256>
  • The BlockNumber type alias in Alloy primitives is u64

I'm unsure if this is by design or not, but it makes the API a bit cumbersome to work with at times

[Feature] Transaction traits

Component

new component

Describe the feature you would like

Transaction traits that provide common getters/setters for transactions. Should be implemented on primitive tx types as described in #73.

trait Transaction { value, data, etc  }
trait LegacyTransaction: Transaction { fn get/set_gas_price() }
trait TransactionEip1559: Transaction  { fn get/set_max_priority_fee_per_gas() }
trait TransactionEip2930: LegacyTransaction { fn get/set_access_list() }

Additional context

No response

Document usage of tower middleware like retry

Component

providers, pubsub, transports

Describe the feature you would like

We should explain that the transports are tower services and how to layer things like retries/backoff (with a simple example) in either the provider or transport docs (or both).

Additional context

No response

[Bug] TxEnvelope rlp decoding returns unexpected length

Component

consensus, eips, genesis

What version of Alloy are you on?

https://github.com/alloy-rs/alloy#42778ba4

Operating System

macOS (Apple Silicon)

Describe the bug

    let raw_tx = hex::decode("02f86f0102843b9aca0085029e7822d68298f094d9e1459a7a482635700cbc20bbaf52d495ab9c9680841b55ba3ac080a0c199674fcb29f353693dd779c017823b954b3c69dffa3cd6b2a6ff7888798039a028ca912de909e7e6cdef9cdcaf24c54dd8c1032946dfa1d85c206b32a9064fe8").unwrap();
    let res = alloy_consensus::TxEnvelope::decode(&mut raw_tx.as_slice());

Returns alloy_rlp::Error::UnexpectedLength. Seems it's expecting a non-empty buffer here:

if buf.len() != pre_len - h.payload_length {

but it's empty at that point, as expected. Should this be checking for buf.len() != 0 instead?

Remove async from PubSubFrontend::unsubscribe

Component

providers, pubsub

Describe the feature you would like

Remove async from PubSubFrontend::unsubscribe since it's not really async.
It's stopping me from being able to implement a RAII object that unsubscribes on drop.

Additional context

No response

[Feature] Add support for EIP4844 transactions to consensus crate

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.