Skip to content

[Bug] RetryBackoffService issues when compiling to WASM #1147

Closed

Description

@ncitron

Component

provider, pubsub, transports

What version of Alloy are you on?

0.2.1

Operating System

macOS (Apple Silicon)

Describe the bug

When building a provider with a retry layer and compiling to wasm32-unknown-none I get trait errors whenever I attempt to use the resulting provider.

Here is an example of the error. When compiling to a non-wasm target it works fine.

error[E0599]: the method `get_chain_id` exists for struct `RootProvider<RetryBackoffService<Http<Client>>>`, but its trait bounds were not satisfied                                                                                                                                                                                                    
   --> execution/src/rpc/http_rpc.rs:179:14                                                                                                                                                                                                                                                                                                             
    |                                                                                                                                                                                                                                                                                                                                                   
177 |           Ok(self                                                                                                                                                                                                                                                                                                                                 
    |  ____________-                                                                                                                                                                                                                                                                                                                                    
178 | |             .provider                                                                                                                                                                                                                                                                                                                           
179 | |             .get_chain_id()                                                                                                                                                                                                                                                                                                                     
    | |             -^^^^^^^^^^^^ method cannot be called on `RootProvider<RetryBackoffService<Http<Client>>>` due to unsatisfied trait bounds                                                                                                                                                                                                          
    | |_____________|                                                                                                                                                                                                                                                                                                                                   
    |                                                                                                                                                                                                                                                                                                                                                   
    |                                                                                                                                                                                                                                                                                                                                                   
   ::: /Users/ncitron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alloy-transport-0.2.1/src/layers/retry.rs:87:1                                                                                                                                                                                                                               
    |                                                                                                                                                                                                                                                                                                                                                   
87  |   pub struct RetryBackoffService<S> {                                                                                                                                                                                                                                                                                                             
    |   --------------------------------- doesn't satisfy `_: Transport`                                                                                                                                                                                                                                                                                
    |                                                                                                                                                                                                                                                                                                                                                   
   ::: /Users/ncitron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alloy-provider-0.2.1/src/provider/root.rs:23:1                                                                                                                                                                                                                               
    |                                                                                                                                                                                                                                                                                                                                                   
23  |   pub struct RootProvider<T, N = Ethereum> {                                                                                                                                                                                                                                                                                                      
    |   ---------------------------------------- doesn't satisfy `_: Provider<RetryBackoffService<Http<Client>>>`                                                                                                                                                                                                                                       
    |                                                                                                                                                                                                                                                                                                                                                   
    = note: the following trait bounds were not satisfied:                                                                                                                                                                                                                                                                                              
            `RetryBackoffService<alloy::transports::alloy_transport_http::Http<Client>>: alloy::transports::Transport`                                                                                                                                                                                                                                  
            which is required by `RootProvider<RetryBackoffService<alloy::transports::alloy_transport_http::Http<Client>>>: Provider<RetryBackoffService<alloy::transports::alloy_transport_http::Http<Client>>>`

Activity

  1. added
    bug
    on Aug 14, 2024
  2. added this to the 1.0 milestone on Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions