mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-03 22:33:06 +00:00
Feedback
This commit is contained in:
parent
b829b44dcf
commit
d0be79e822
@ -18,7 +18,7 @@ pub(crate) enum GlobalMetadata {
|
||||
TransactionTrieRoot = 5,
|
||||
/// A pointer to the root of the receipt trie within the `TrieData` buffer.
|
||||
ReceiptTrieRoot = 6,
|
||||
/// The number of storage tries involved in this transaction. I.e. the number of values in
|
||||
/// The number of storage tries involved in these transactions. I.e. the number of values in
|
||||
/// `StorageTrieAddresses`, `StorageTriePointers` and `StorageTrieCheckpointPointers`.
|
||||
NumStorageTries = 7,
|
||||
|
||||
|
||||
@ -23,20 +23,20 @@ pub(crate) mod state;
|
||||
pub struct GenerationInputs {
|
||||
pub signed_txns: Vec<Vec<u8>>,
|
||||
|
||||
/// A partial version of the state trie prior to this transaction. It should include all nodes
|
||||
/// that will be accessed by this transaction.
|
||||
/// A partial version of the state trie prior to these transactions. It should include all nodes
|
||||
/// that will be accessed by these transactions.
|
||||
pub state_trie: PartialTrie,
|
||||
|
||||
/// A partial version of the transaction trie prior to this transaction. It should include all
|
||||
/// nodes that will be accessed by this transaction.
|
||||
/// A partial version of the transaction trie prior to these transactions. It should include all
|
||||
/// nodes that will be accessed by these transactions.
|
||||
pub transactions_trie: PartialTrie,
|
||||
|
||||
/// A partial version of the receipt trie prior to this transaction. It should include all nodes
|
||||
/// that will be accessed by this transaction.
|
||||
/// A partial version of the receipt trie prior to these transactions. It should include all nodes
|
||||
/// that will be accessed by these transactions.
|
||||
pub receipts_trie: PartialTrie,
|
||||
|
||||
/// A partial version of each storage trie prior to this transaction. It should include all
|
||||
/// storage tries, and nodes therein, that will be accessed by this transaction.
|
||||
/// A partial version of each storage trie prior to these transactions. It should include all
|
||||
/// storage tries, and nodes therein, that will be accessed by these transactions.
|
||||
pub storage_tries: Vec<(Address, PartialTrie)>,
|
||||
|
||||
pub block_metadata: BlockMetadata,
|
||||
|
||||
@ -65,12 +65,13 @@ pub struct TrieRoots {
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct BlockMetadata {
|
||||
pub block_coinbase: Address,
|
||||
pub block_beneficiary: Address,
|
||||
pub block_timestamp: U256,
|
||||
pub block_number: U256,
|
||||
pub block_difficulty: U256,
|
||||
pub block_gaslimit: U256,
|
||||
pub block_chain_id: U256,
|
||||
pub block_base_fee: U256,
|
||||
}
|
||||
|
||||
/// Memory values which are public.
|
||||
@ -88,12 +89,13 @@ pub struct TrieRootsTarget {
|
||||
}
|
||||
|
||||
pub struct BlockMetadataTarget {
|
||||
pub block_coinbase: [Target; 5],
|
||||
pub block_beneficiary: [Target; 5],
|
||||
pub block_timestamp: Target,
|
||||
pub block_number: Target,
|
||||
pub block_difficulty: Target,
|
||||
pub block_gaslimit: Target,
|
||||
pub block_chain_id: Target,
|
||||
pub block_base_fee: Target,
|
||||
}
|
||||
|
||||
pub(crate) struct AllProofChallengesTarget<const D: usize> {
|
||||
|
||||
@ -355,19 +355,21 @@ pub fn add_virtual_trie_roots<F: RichField + Extendable<D>, const D: usize>(
|
||||
pub fn add_virtual_block_metadata<F: RichField + Extendable<D>, const D: usize>(
|
||||
builder: &mut CircuitBuilder<F, D>,
|
||||
) -> BlockMetadataTarget {
|
||||
let block_coinbase = builder.add_virtual_target_arr();
|
||||
let block_beneficiary = builder.add_virtual_target_arr();
|
||||
let block_timestamp = builder.add_virtual_target();
|
||||
let block_number = builder.add_virtual_target();
|
||||
let block_difficulty = builder.add_virtual_target();
|
||||
let block_gaslimit = builder.add_virtual_target();
|
||||
let block_chain_id = builder.add_virtual_target();
|
||||
let block_base_fee = builder.add_virtual_target();
|
||||
BlockMetadataTarget {
|
||||
block_coinbase,
|
||||
block_beneficiary,
|
||||
block_timestamp,
|
||||
block_number,
|
||||
block_difficulty,
|
||||
block_gaslimit,
|
||||
block_chain_id,
|
||||
block_base_fee,
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,8 +526,8 @@ pub fn set_block_metadata_target<F, W, const D: usize>(
|
||||
W: Witness<F>,
|
||||
{
|
||||
witness.set_target_arr(
|
||||
block_metadata_target.block_coinbase,
|
||||
h160_limbs(block_metadata.block_coinbase),
|
||||
block_metadata_target.block_beneficiary,
|
||||
h160_limbs(block_metadata.block_beneficiary),
|
||||
);
|
||||
witness.set_target(
|
||||
block_metadata_target.block_timestamp,
|
||||
@ -547,4 +549,8 @@ pub fn set_block_metadata_target<F, W, const D: usize>(
|
||||
block_metadata_target.block_chain_id,
|
||||
F::from_canonical_u64(block_metadata.block_chain_id.as_u64()),
|
||||
);
|
||||
witness.set_target(
|
||||
block_metadata_target.block_base_fee,
|
||||
F::from_canonical_u64(block_metadata.block_base_fee.as_u64()),
|
||||
);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ pub(crate) fn u256_limbs<F: Field>(u256: U256) -> [F; 8] {
|
||||
u256.0
|
||||
.into_iter()
|
||||
.flat_map(|limb_64| {
|
||||
let lo = (limb_64 & 0xFFFFFFFF) as u32;
|
||||
let lo = limb_64 as u32;
|
||||
let hi = (limb_64 >> 32) as u32;
|
||||
[lo, hi]
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user