Skip to content

Commit

Permalink
Test reproducing failure to deserialize blockscout response when cont…
Browse files Browse the repository at this point in the history
…ract is not optimized
  • Loading branch information
ckoopmann committed Dec 28, 2023
1 parent 472118d commit 1e14a91
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/it/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn can_fetch_contract_abi() {

#[tokio::test]
#[serial]
async fn can_fetch_contract_source_code_from_blockscout() {
async fn can_fetch_deposit_contract_source_code_from_blockscout() {
let client = Client::builder()
.with_url("https://eth.blockscout.com")
.unwrap()
Expand All @@ -54,6 +54,28 @@ async fn can_fetch_contract_source_code_from_blockscout() {
assert_eq!(item.abi().unwrap(), serde_json::from_str(DEPOSIT_CONTRACT_ABI).unwrap());
}

#[tokio::test]
#[serial]
async fn can_fetch_other_contract_source_code_from_blockscout() {
let client = Client::builder()
.with_url("https://eth.blockscout.com")
.unwrap()
.with_api_url("https://eth.blockscout.com/api")
.unwrap()
.with_api_key("test")
.build()
.unwrap();
let meta = client
.contract_source_code("0xDef1C0ded9bec7F1a1670819833240f027b25EfF".parse().unwrap())
.await
.unwrap();

assert_eq!(meta.items.len(), 1);
let item = &meta.items[0];
assert!(matches!(item.source_code, SourceCodeMetadata::SourceCode(_)));
assert_eq!(item.source_code.sources().len(), 1);
}

#[tokio::test]
#[serial]
async fn can_fetch_contract_source_code() {
Expand Down

0 comments on commit 1e14a91

Please sign in to comment.