Skip to content

Commit

Permalink
tests: cover latest block for test_getStorageAt
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-melnychuk committed Sep 28, 2024
1 parent 7f90eda commit 50c72c4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,15 @@ async fn test_getStorageAt() -> Result<(), Error> {
"0x0341c1bdfd89f69748aa00b5742b03adbffd79b8e80cab5c50d91cd8c2a79be1",
)?;

const EXPECTED: &str = "0x47616d65206f66204c69666520546f6b656e";

let block_id_number =
BlockId::BlockNumber { block_number: BlockNumber::try_new(600612)? };
let ret = ctx
.client
.getStorageAt(contract_address.clone(), key.clone(), block_id_number)
.await?;
assert_eq!(ret.as_ref(), "0x47616d65206f66204c69666520546f6b656e");
assert_eq!(ret.as_ref(), EXPECTED);

let block_id_hash = BlockId::BlockHash {
block_hash: BlockHash(Felt::try_new(
Expand All @@ -270,7 +272,14 @@ async fn test_getStorageAt() -> Result<(), Error> {
.client
.getStorageAt(contract_address.clone(), key.clone(), block_id_hash)
.await?;
assert_eq!(ret.as_ref(), "0x47616d65206f66204c69666520546f6b656e");
assert_eq!(ret.as_ref(), EXPECTED);

let block_id_tag = BlockId::BlockTag(BlockTag::Latest);
let ret = ctx
.client
.getStorageAt(contract_address.clone(), key.clone(), block_id_tag)
.await?;
assert_eq!(ret.as_ref(), EXPECTED);

let block_id_tag = BlockId::BlockTag(BlockTag::Pending);
let ret =
Expand Down

0 comments on commit 50c72c4

Please sign in to comment.