This repository was archived by the owner on Oct 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
This repository was archived by the owner on Oct 16, 2025. It is now read-only.
Cache Status Command Fails on Nitro Devnode #136
Copy link
Copy link
Open
Description
When running cargo stylus cache status --address=$ADDR --endpoint=http://localhost:8547 on the Nitro devnode, we get an alloy decoding failure:
Caused by:
0: buffer overrun while deserializing
1: buffer overrun while deserializing
This was debugged and determined to happen in the cache.rs file when attempting to fetch all the cache manager addresses:
async fn get_cache_manager_address<P>(provider: P) -> Result<Address>
where
P: Provider + Clone + Send + Sync,
{
let arb_wasm_cache = ArbWasmCache::new(CONTRACT_ADDR, provider.clone());
let result = arb_wasm_cache.allCacheManagers().call().await?;
...However, a minimum reproduction of the code, in an isolated binary, indeed passes with the same dependencies and flags. Something is wrong with the alloy decoder in cargo stylus that works fine in isolation.
// Copyright 2023-2024, Offchain Labs, Inc.
// For licensing, see https://github.com/OffchainLabs/cargo-stylus/blob/stylus/licenses/COPYRIGHT.md
use alloy_primitives::{address, Address};
use alloy_provider::{Provider, ProviderBuilder};
use alloy_sol_macro::sol;
use eyre::{bail, Result};
sol! {
#[sol(rpc)]
interface ArbWasmCache {
function allCacheManagers() external view returns (address[] managers);
}
}
pub const CONTRACT_ADDR: Address = address!("0000000000000000000000000000000000000072");
#[tokio::main]
pub async fn main() -> Result<()> {
let endpoint = "http://localhost:8547";
let provider = ProviderBuilder::new()
.with_recommended_fillers()
.on_builtin(&endpoint)
.await?;
let manager_addr = get_cache_manager_address(provider).await?;
println!("Addr: {:?}", manager_addr);
Ok(())
}
async fn get_cache_manager_address<P>(provider: P) -> Result<Address>
where
P: Provider + Clone + Send + Sync,
{
let arb_wasm_cache = ArbWasmCache::new(CONTRACT_ADDR, provider.clone());
let result = arb_wasm_cache.allCacheManagers().call().await?;
if result.managers.is_empty() {
bail!("no cache managers found in ArbWasmCache, perhaps the Stylus cache is not yet enabled on this chain");
}
Ok(*result.managers.last().unwrap())
}Metadata
Metadata
Assignees
Labels
No labels