Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
fix(starknet-rpc-test): don't share reqwest client across test runtim…
Browse files Browse the repository at this point in the history
…es (#1184)
  • Loading branch information
tdelabro authored Oct 12, 2023
1 parent a235719 commit 29a8b11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- fix(starknet-rpc-test): init one request client per runtime
- test: validate Nonce for unsigned user txs
- fix: fixed declare V0 placeholder with the hash of an empty list of felts
- feat(cli): `run` is the by default command when running the `madara` bin
Expand All @@ -21,7 +22,7 @@
- refacto(pallet/starknet): `GenesisLoader` refactored as `GenesisData` + a
`base_path` field
- feat(cli): for `run` param `--dev` now imply `--tmp`, as it is in substrate
- test(starknet-rpx-test): run all tests against a single madara node
- test(starknet-rpc-test): run all tests against a single madara node

## v0.4.0

Expand Down
6 changes: 2 additions & 4 deletions starknet-rpc-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ impl Transaction<'_> {
#[derive(Debug)]
/// A wrapper over the Madara process handle, reqwest client and request counter
pub struct MadaraClient {
client: Client,
rpc_request_count: Cell<usize>,
url: Url,
}

impl Default for MadaraClient {
fn default() -> Self {
let url = Url::parse(NODE_RPC_URL).expect("Invalid JSONRPC Url");
MadaraClient { client: Client::new(), url, rpc_request_count: Default::default() }
MadaraClient { url, rpc_request_count: Default::default() }
}
}

Expand Down Expand Up @@ -132,8 +131,7 @@ impl MadaraClient {

let body = serde_json::to_string(&body).expect("the json body must be serializable");

let response = self
.client
let response = Client::new()
.post("http://localhost:9944")
.header(CONTENT_TYPE, "application/json; charset=utf-8")
.body(body)
Expand Down

0 comments on commit 29a8b11

Please sign in to comment.