alloy icon indicating copy to clipboard operation
alloy copied to clipboard

[Bug] RetryBackoffService issues when compiling to WASM

Open ncitron opened this issue 6 months ago • 0 comments

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>>>`

ncitron avatar Aug 14 '24 19:08 ncitron