-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Labels
A-clientArea: client cratesArea: client cratesK-enhancementKind: New feature or requestKind: New feature or request
Description
Background
PR #446 fixed the RPC extension hook accumulation issue (#438), but the integration test that verified the fix was removed to avoid a circular dependency between base-client-node and base-metering/base-txpool.
Test to add
The test should verify that multiple RPC-providing extensions are all accessible when installed together:
#[tokio::test(flavor = "multi_thread")]
async fn rpc_hooks_accumulate_across_extensions() -> Result<()> {
let chain_spec = load_chain_spec();
// Install multiple RPC-providing extensions
let mut extensions: Vec<Box<dyn BaseNodeExtension>> = Vec::new();
extensions.push(Box::new(TxPoolExtension::new(TxpoolConfig {
tracing_enabled: false,
tracing_logs_enabled: false,
sequencer_rpc: None,
})));
extensions.push(Box::new(MeteringExtension::new(true, None)));
let node = LocalNode::new(extensions, Arc::clone(&chain_spec)).await?;
let client = HttpClientBuilder::default().build(format!("http://{}", node.http_addr()))?;
// TxPool RPC should be reachable
let status: TransactionStatusResponse = client
.request("base_transactionStatus", rpc_params![TxHash::ZERO])
.await?;
assert_eq!(Status::Unknown, status.status);
// Metering RPC should also be reachable
let meter_result = client
.request::<serde_json::Value, _>("base_meterBlockByNumber", rpc_params!["latest"])
.await;
match meter_result {
Ok(_) => {}
Err(ClientError::Call(err)) => {
assert_ne!(err.code(), ErrorCode::MethodNotFound.code(), "metering RPC missing");
}
Err(err) => panic!("unexpected error from metering RPC: {err}"),
}
Ok(())
}Options for location
- Add to system test framework
- Create a top-level client integration test crate (e.g.,
crates/client/tests) - Add tests within
bin/crates
Related
danyalprout
Metadata
Metadata
Assignees
Labels
A-clientArea: client cratesArea: client cratesK-enhancementKind: New feature or requestKind: New feature or request