Skip to content

Commit 08bfffd

Browse files
committed
run nargo fmt
1 parent 5e785a2 commit 08bfffd

File tree

120 files changed

+13616
-2241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+13616
-2241
lines changed

ethereum/circuits/get_account/src/main.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use dep::ethereum::account::{get_account, AccountWithinBlock};
1+
use dep::ethereum::account::{AccountWithinBlock, get_account};
22
use dep::ethereum::misc::types::Address;
33

44
fn main(chain_id: pub Field, block_no: pub u64, address: pub Address) -> pub AccountWithinBlock {

ethereum/circuits/get_header/src/main.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use dep::ethereum::header::{get_header, BlockHeaderPartial};
1+
use dep::ethereum::header::{BlockHeaderPartial, get_header};
22

33
fn main(chain_id: pub Field, block_no: pub u64) -> pub BlockHeaderPartial {
44
get_header(chain_id, block_no)

ethereum/circuits/get_log/src/main.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn main(
77
chain_id: pub Field,
88
block_number: pub u64,
99
tx_idx: pub Field,
10-
log_idx: pub u32
10+
log_idx: pub u32,
1111
) -> pub LogWithinBlock<MAX_LOG_DATA_LEN> {
1212
get_log::<MAX_LOG_DATA_LEN, MAX_LOGS_COUNT>(chain_id, block_number, tx_idx, log_idx)
1313
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
use dep::ethereum::{account_with_storage::{get_account_with_storage, StorageWithinBlock}, misc::types::{Address, Bytes32}};
1+
use dep::ethereum::{
2+
account_with_storage::{get_account_with_storage, StorageWithinBlock},
3+
misc::types::{Address, Bytes32},
4+
};
25

36
fn main(
47
chain_id: pub Field,
58
block_number: pub u64,
69
address: pub Address,
7-
storage_key: pub Bytes32
10+
storage_key: pub Bytes32,
811
) -> pub StorageWithinBlock<1> {
912
get_account_with_storage(chain_id, block_number, address, storage_key)
1013
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
use dep::ethereum::{account_with_storage::{get_account_with_storage, StorageWithinBlock}, misc::types::{Address, Bytes32}};
1+
use dep::ethereum::{
2+
account_with_storage::{get_account_with_storage, StorageWithinBlock},
3+
misc::types::{Address, Bytes32},
4+
};
25

36
#[recursive]
47
fn main(
58
chain_id: pub Field,
69
block_number: pub u64,
710
address: pub Address,
8-
storage_key: pub Bytes32
11+
storage_key: pub Bytes32,
912
) -> pub StorageWithinBlock<1> {
1013
get_account_with_storage(chain_id, block_number, address, storage_key)
1114
}

ethereum/circuits/get_transaction/src/main.nr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ global MAX_DATA_LEN_M = 1000;
55
fn main(
66
chain_id: pub Field,
77
block_number: pub u64,
8-
tx_idx: pub Field
8+
tx_idx: pub Field,
99
) -> pub TransactionWithinBlock<MAX_DATA_LEN_M> {
10-
let transaction_within_block: TransactionWithinBlock<MAX_DATA_LEN_M> = get_transaction(chain_id, block_number, tx_idx);
10+
let transaction_within_block: TransactionWithinBlock<MAX_DATA_LEN_M> =
11+
get_transaction(chain_id, block_number, tx_idx);
1112
transaction_within_block
1213
}

ethereum/circuits/lib/src/account_int_test.nr

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use crate::account::get_account;
22
use crate::chain::ETHEREUM_MAINNET_ID;
33
use crate::fixtures::mainnet::{
4-
paris::{
5-
usdc_circle::{
6-
header::{number, state_root, block_header_partial, block_header_rlp}, account::{account, address},
7-
state_proof::proof_input_serialized as state_proof_input_serialized
8-
}
9-
},
104
london::vitalik_balance::{
11-
account::{account as account_from_different_header, address as address_from_different_header},
12-
header::state_root as state_root_from_different_header,
13-
state_proof::proof_input_serialized as state_proof_input_from_different_header_serialized
14-
}
5+
account::{
6+
account as account_from_different_header, address as address_from_different_header,
7+
},
8+
header::state_root as state_root_from_different_header,
9+
state_proof::proof_input_serialized as state_proof_input_from_different_header_serialized,
10+
},
11+
paris::usdc_circle::{
12+
account::{account, address},
13+
header::{block_header_partial, block_header_rlp, number, state_root},
14+
state_proof::proof_input_serialized as state_proof_input_serialized,
15+
},
1516
};
1617
use dep::std::test::OracleMock;
1718

@@ -33,7 +34,9 @@ fn test_get_account_success() {
3334
#[test(should_fail)]
3435
fn test_get_account_wrong_state_root() {
3536
let _ = OracleMock::mock("get_header").returns((block_header_partial, block_header_rlp));
36-
let _ = OracleMock::mock("get_account").returns((account_from_different_header, state_proof_input_from_different_header_serialized));
37+
let _ = OracleMock::mock("get_account").returns((
38+
account_from_different_header, state_proof_input_from_different_header_serialized,
39+
));
3740

3841
let _ = get_account(ETHEREUM_MAINNET_ID, number, address_from_different_header);
3942
}

ethereum/circuits/lib/src/account_with_storage.nr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ pub fn get_account_with_storage(
106106
address: Address,
107107
storage_key: Bytes32,
108108
) -> StorageWithinBlock<1> {
109-
let BlockHeaderPartial { number: _, hash, state_root, transactions_root: _, receipts_root: _ } =
110-
get_header(chain_id, block_number);
109+
let BlockHeaderPartial { number: _, hash, state_root, transactions_root: _, receipts_root: _ }
110+
= get_header(chain_id, block_number);
111111
let StateAndStorageProofInput { account, state_proof_input, storage_proof_input } =
112112
get_proof_unconstrained(chain_id, block_number, address, storage_key);
113113

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
1-
use crate::misc::types::Bytes32;
2-
use crate::chain::ETHEREUM_MAINNET_ID;
31
use crate::account_with_storage::get_account_with_storage;
2+
use crate::chain::ETHEREUM_MAINNET_ID;
43
use 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;
2424
use dep::std::test::OracleMock;
2525

2626
#[test]
2727
fn 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")]
4447
fn 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")]
5764
fn 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")]
7081
fn 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
}
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
use crate::account_with_storage_recursive::{get_account_with_storage_recursive, RecursiveProof};
21
use crate::account_with_storage::StorageWithinBlock;
3-
use crate::fixtures::mainnet::paris::usdc_circle::{header::{number, hash}, account::{address, account}, storage::{keys, values}};
2+
use crate::account_with_storage_recursive::{get_account_with_storage_recursive, RecursiveProof};
43
use crate::chain::ETHEREUM_MAINNET_ID;
5-
use crate::misc::types::{Bytes32, Address};
6-
use dep::std::test::OracleMock;
4+
use crate::fixtures::mainnet::paris::usdc_circle::{
5+
account::{account, address},
6+
header::{hash, number},
7+
storage::{keys, values},
8+
};
9+
use crate::misc::types::{Address, Bytes32};
710
use dep::std::mem::zeroed;
11+
use dep::std::test::OracleMock;
812

913
#[test]
1014
fn success() {
1115
let result = StorageWithinBlock { block_hash: hash, account, values };
1216
// This is not a correct proof but it passes because nargo does not verify it. Nargo thinks that it's bb's job, but doesn't call bb.
1317
let recursive_proof: RecursiveProof = std::mem::zeroed();
1418

15-
let _ = OracleMock::mock("get_storage_recursive").returns((result.serialize(), recursive_proof));
19+
let _ =
20+
OracleMock::mock("get_storage_recursive").returns((result.serialize(), recursive_proof));
1621

1722
let _ = get_account_with_storage_recursive(ETHEREUM_MAINNET_ID, number, address, keys[0]);
1823
}

0 commit comments

Comments
 (0)