fc_rpc_v2_types/
proof.rs

1// This file is part of Frontier.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19use ethereum_types::{Address, H256, U256, U64};
20use serde::{Deserialize, Serialize};
21
22use crate::bytes::Bytes;
23
24/// The response type of `eth_getProof`.
25///
26/// See [EIP-1186](https://eips.ethereum.org/EIPS/eip-1186) for more details.
27#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct AccountProof {
30	/// The address of the account.
31	pub address: Address,
32	/// Array of rlp-serialized MerkleTree-Nodes, starting with the stateRoot-Node, following the
33	/// path of the SHA3 (address) as key.
34	pub account_proof: Vec<Bytes>,
35	/// The balance of the account.
36	pub balance: U256,
37	/// Code hash of the account.
38	pub code_hash: H256,
39	/// The nonce of the account.
40	pub nonce: U64,
41	/// The hash of storage root.
42	pub storage_hash: H256,
43	/// Array of storage-entries as requested.
44	pub storage_proof: Vec<StorageProof>,
45}
46
47/// Data structure with proof for one single storage-entry
48#[derive(Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)]
49#[serde(rename_all = "camelCase")]
50pub struct StorageProof {
51	/// Storage key.
52	pub key: H256,
53	/// Storage value.
54	pub value: U256,
55	/// Array of rlp-serialized MerkleTree-Nodes, starting with the storageHash-Node, following the
56	/// path of the SHA3 (key) as path.
57	pub proof: Vec<Bytes>,
58}