1- use crate::misc::types::Bytes32 ;
2- use crate::chain::ETHEREUM_MAINNET_ID ;
31use crate::account_with_storage::get_account_with_storage ;
2+ use crate::chain::ETHEREUM_MAINNET_ID ;
43use crate::fixtures::mainnet:: {
4+ london:: crypto_punks ::{
5+ account ::{account as crypto_punks_account , address as crypto_punks_address },
6+ header ::{
7+ block_header_partial as crypto_punks_block_header_partial ,
8+ block_header_rlp as crypto_punks_block_header_rlp , number as crypto_punks_number ,
9+ },
10+ state_proof:: proof_input_serialized as crypto_punks_state_proof_input_serialized ,
11+ },
512 paris ::{
6- usdc_circle ::{
7- header ::{number , block_header_partial , block_header_rlp }, account ::{account , address },
8- state_proof:: proof_input_serialized as state_proof_input_serialized ,
9- storage_proof:: proofs_serialized , storage ::{values , keys as storage_keys }
10- },
11- usdc_uniswap ::{storage:: keys as usdc_uniswap_storage_keys }
12- },
13- london ::{
14- crypto_punks ::{
15- header ::{
16- block_header_partial as crypto_punks_block_header_partial ,
17- block_header_rlp as crypto_punks_block_header_rlp , number as crypto_punks_number
18- },
19- account ::{address as crypto_punks_address , account as crypto_punks_account },
20- state_proof:: proof_input_serialized as crypto_punks_state_proof_input_serialized
21- }
22- }
13+ usdc_circle ::{
14+ account ::{account , address },
15+ header ::{block_header_partial , block_header_rlp , number },
16+ state_proof:: proof_input_serialized as state_proof_input_serialized ,
17+ storage ::{keys as storage_keys , values },
18+ storage_proof:: proofs_serialized ,
19+ },
20+ usdc_uniswap::storage:: keys as usdc_uniswap_storage_keys ,
21+ },
2322};
23+ use crate::misc::types::Bytes32 ;
2424use dep::std::test::OracleMock ;
2525
2626#[test]
2727fn test_get_account_with_storage_success () {
2828 let _ = OracleMock ::mock ("get_header" ).returns ((block_header_partial , block_header_rlp ));
29- let _ = OracleMock ::mock ("get_proof" ).returns ((account , state_proof_input_serialized , proofs_serialized [0 ]));
29+ let _ = OracleMock ::mock ("get_proof" ).returns ((
30+ account , state_proof_input_serialized , proofs_serialized [0 ],
31+ ));
3032
31- let account_with_storage = get_account_with_storage (ETHEREUM_MAINNET_ID , number , address , storage_keys [0 ]);
33+ let account_with_storage =
34+ get_account_with_storage (ETHEREUM_MAINNET_ID , number , address , storage_keys [0 ]);
3235
3336 assert_eq (block_header_partial .hash , account_with_storage .block_hash );
3437
@@ -42,39 +45,49 @@ fn test_get_account_with_storage_success() {
4245
4346#[test(should_fail_with = "Invalid node hash")]
4447fn test_get_account_with_storage_invalid_state_root () {
45- let _ = OracleMock ::mock ("get_header" ).returns ((crypto_punks_block_header_partial , crypto_punks_block_header_rlp ));
46- let _ = OracleMock ::mock ("get_proof" ).returns ((account , state_proof_input_serialized , proofs_serialized [0 ]));
48+ let _ = OracleMock ::mock ("get_header" ).returns ((
49+ crypto_punks_block_header_partial , crypto_punks_block_header_rlp ,
50+ ));
51+ let _ = OracleMock ::mock ("get_proof" ).returns ((
52+ account , state_proof_input_serialized , proofs_serialized [0 ],
53+ ));
4754
4855 let _ = get_account_with_storage (
4956 ETHEREUM_MAINNET_ID ,
5057 crypto_punks_number ,
5158 address ,
52- storage_keys [0 ]
59+ storage_keys [0 ],
5360 );
5461}
5562
5663#[test(should_fail_with = "Invalid node hash")]
5764fn test_get_account_with_storage_invalid_storage_root () {
58- let _ = OracleMock ::mock ("get_header" ).returns ((crypto_punks_block_header_partial , crypto_punks_block_header_rlp ));
59- let _ = OracleMock ::mock ("get_proof" ).returns ((crypto_punks_account , crypto_punks_state_proof_input_serialized , proofs_serialized [0 ]));
65+ let _ = OracleMock ::mock ("get_header" ).returns ((
66+ crypto_punks_block_header_partial , crypto_punks_block_header_rlp ,
67+ ));
68+ let _ = OracleMock ::mock ("get_proof" ).returns ((
69+ crypto_punks_account , crypto_punks_state_proof_input_serialized , proofs_serialized [0 ],
70+ ));
6071
6172 let _ = get_account_with_storage (
6273 ETHEREUM_MAINNET_ID ,
6374 crypto_punks_number ,
6475 crypto_punks_address ,
65- storage_keys [0 ]
76+ storage_keys [0 ],
6677 );
6778}
6879
6980#[test(should_fail_with = "Storage key does not match the argument")]
7081fn test_get_account_with_storage_storage_key_does_not_match_the_argument () {
7182 let _ = OracleMock ::mock ("get_header" ).returns ((block_header_partial , block_header_rlp ));
72- let _ = OracleMock ::mock ("get_proof" ).returns ((account , state_proof_input_serialized , proofs_serialized [0 ]));
83+ let _ = OracleMock ::mock ("get_proof" ).returns ((
84+ account , state_proof_input_serialized , proofs_serialized [0 ],
85+ ));
7386
7487 let _ = get_account_with_storage (
7588 ETHEREUM_MAINNET_ID ,
7689 number ,
7790 address ,
78- usdc_uniswap_storage_keys [0 ]
91+ usdc_uniswap_storage_keys [0 ],
7992 );
8093}
0 commit comments