mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Input addresses
This commit is contained in:
parent
c8d591f6da
commit
44c77f5583
@ -46,6 +46,13 @@ pub struct GenerationInputs {
|
|||||||
pub contract_code: HashMap<H256, Vec<u8>>,
|
pub contract_code: HashMap<H256, Vec<u8>>,
|
||||||
|
|
||||||
pub block_metadata: BlockMetadata,
|
pub block_metadata: BlockMetadata,
|
||||||
|
|
||||||
|
/// A list of known addresses in the input state trie (which itself doesn't hold addresses,
|
||||||
|
/// only state keys). This is only useful for debugging, so that we can return addresses in the
|
||||||
|
/// post-state rather than state keys. (See `GenerationOutputs`, and in particular
|
||||||
|
/// `AddressOrStateKey`.) If the caller is not interested in the post-state, this can be left
|
||||||
|
/// empty.
|
||||||
|
pub addresses: Vec<Address>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, Default)]
|
#[derive(Clone, Debug, Deserialize, Serialize, Default)]
|
||||||
|
|||||||
@ -30,6 +30,11 @@ pub struct AccountOutput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_outputs<F: Field>(state: &mut GenerationState<F>) -> GenerationOutputs {
|
pub(crate) fn get_outputs<F: Field>(state: &mut GenerationState<F>) -> GenerationOutputs {
|
||||||
|
// First observe all addresses passed in the by caller.
|
||||||
|
for address in state.inputs.addresses.clone() {
|
||||||
|
state.observe_address(address);
|
||||||
|
}
|
||||||
|
|
||||||
let account_map = read_trie::<AccountTrieRecord>(
|
let account_map = read_trie::<AccountTrieRecord>(
|
||||||
&state.memory,
|
&state.memory,
|
||||||
state.memory.read_global_metadata(StateTrieRoot).as_usize(),
|
state.memory.read_global_metadata(StateTrieRoot).as_usize(),
|
||||||
|
|||||||
@ -101,6 +101,7 @@ fn test_basic_smart_contract() -> anyhow::Result<()> {
|
|||||||
tries: tries_before,
|
tries: tries_before,
|
||||||
contract_code,
|
contract_code,
|
||||||
block_metadata,
|
block_metadata,
|
||||||
|
addresses: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut timing = TimingTree::new("prove", log::Level::Debug);
|
let mut timing = TimingTree::new("prove", log::Level::Debug);
|
||||||
|
|||||||
@ -48,6 +48,7 @@ fn test_empty_txn_list() -> anyhow::Result<()> {
|
|||||||
},
|
},
|
||||||
contract_code: HashMap::new(),
|
contract_code: HashMap::new(),
|
||||||
block_metadata,
|
block_metadata,
|
||||||
|
addresses: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut timing = TimingTree::new("prove", log::Level::Debug);
|
let mut timing = TimingTree::new("prove", log::Level::Debug);
|
||||||
|
|||||||
@ -75,6 +75,7 @@ fn test_simple_transfer() -> anyhow::Result<()> {
|
|||||||
tries: tries_before,
|
tries: tries_before,
|
||||||
contract_code: HashMap::new(),
|
contract_code: HashMap::new(),
|
||||||
block_metadata,
|
block_metadata,
|
||||||
|
addresses: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut timing = TimingTree::new("prove", log::Level::Debug);
|
let mut timing = TimingTree::new("prove", log::Level::Debug);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user