-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e tests: RPC read test cases #236
Conversation
crates/tests/src/rpc/read.rs
Outdated
|
||
static MADARA: Lazy<OnceCell<Arc<Mutex<MadaraCmd>>>> = Lazy::new(OnceCell::new); | ||
|
||
async fn setup_madara() -> Arc<Mutex<MadaraCmd>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be a fixture. do we need Arc or Mutex? does a #[once] fixture autmatically handle it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
crates/tests/src/rpc/read.rs
Outdated
"0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8", | ||
), | ||
l1_gas_price: ResourcePrice { | ||
price_in_fri: Felt::from_hex_unchecked("0x0"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make Felt::from_hex_unchecked
a macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
f62fd2e
to
0fc8e04
Compare
crates/tests/src/rpc/read.rs
Outdated
async fn test_get_block_txn_with_tx_works() { | ||
let madara = get_shared_state().await; | ||
let json_client = JsonRpcClient::new(HttpTransport::new(madara.rpc_url.clone())); | ||
let block = { json_client.get_block_with_txs(BlockId::Number(2)).await.unwrap() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt here, for braces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
crates/tests/src/rpc/read.rs
Outdated
madara.wait_for_ready().await; | ||
madara.wait_for_sync_to(19).await; | ||
|
||
// The lock is released when guard goes out of scope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont understand this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, removed
a980685
to
ed2091a
Compare
ed2091a
to
141791a
Compare
crates/tests/src/rpc/read.rs
Outdated
"id": 1 | ||
}' | ||
|
||
Note: The test is ignored as of now because madara doesn't support historical data retrieval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support historical data retrieval. We dont support it trough our bonsai trie. But all RPC endpoints are supported on latest (v0.7.1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, my bad what I meant was the calls with starknet version <0.13.0, this returns an error.
if block.info.protocol_version() < &FALLBACK_TO_SEQUENCER_WHEN_VERSION_BELOW {
return Err(StarknetRpcApiError::UnsupportedTxnVersion);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the comment
crates/tests/src/rpc/read.rs
Outdated
"id": 1 | ||
}' | ||
|
||
Note: The test is ignored as of now because madara doesn't support historical data retrieval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
crates/tests/src/rpc/read.rs
Outdated
"id": 1 | ||
}' | ||
|
||
Note: The test is ignored as of now because madara doesn't support historical data retrieval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
crates/tests/src/rpc/read.rs
Outdated
assert_eq!(block, expected_block); | ||
} | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather comment doc using ///
since we are doing it this way all over the codebase:
/// Sends a request to fetch the latest block with transactions.
///
/// Example curl command:
///
/// ```bash
/// curl --location 'https://free-rpc.nethermind.io/sepolia-juno/' \
/// --header 'Content-Type: application/json' \
/// --data '{
/// "jsonrpc": "2.0",
/// "method": "starknet_getBlockWithTxs",
/// "params": {
/// "block_id": "latest"
/// },
/// "id": 1
/// }'
/// ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I would avoid referencing https://free-rpc.nethermind.io/sepolia-juno/
and replace it with a madara public rpc (we have this one here https://rpc.kasar.io/deoxys)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually it is on mainnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so lets rely on nethermind for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation updated
PR includes tests for the all rpc read calls, in all cases we will be syncing a few blocks from the sepolia testnet and will make read calls and verify the information present in madara is right or not and whether the rpc calls are working fine or not.
For source of truth, I am using juno's data.
Pull Request type
What is the current behavior?
Resolves: #
What is the new behavior?
Does this introduce a breaking change?
NoProgress