Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Remove GenerationOutputs (0xPolygonZero#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Dec 5, 2023
1 parent 46b6aa1 commit 47e2430
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 157 deletions.
20 changes: 2 additions & 18 deletions evm/src/generation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use crate::config::StarkConfig;
use crate::cpu::columns::CpuColumnsView;
use crate::cpu::kernel::aggregator::KERNEL;
use crate::cpu::kernel::constants::global_metadata::GlobalMetadata;
use crate::generation::outputs::{get_outputs, GenerationOutputs};
use crate::generation::state::GenerationState;
use crate::memory::segments::Segment;
use crate::proof::{BlockHashes, BlockMetadata, ExtraBlockData, PublicValues, TrieRoots};
Expand All @@ -29,7 +28,6 @@ use crate::witness::memory::{MemoryAddress, MemoryChannel};
use crate::witness::transition::transition;

pub mod mpt;
pub mod outputs;
pub(crate) mod prover_input;
pub(crate) mod rlp;
pub(crate) mod state;
Expand Down Expand Up @@ -61,13 +59,6 @@ pub struct GenerationInputs {
pub block_metadata: BlockMetadata,

pub block_hashes: BlockHashes,

/// 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)]
Expand Down Expand Up @@ -196,11 +187,7 @@ pub fn generate_traces<F: RichField + Extendable<D>, const D: usize>(
inputs: GenerationInputs,
config: &StarkConfig,
timing: &mut TimingTree,
) -> anyhow::Result<(
[Vec<PolynomialValues<F>>; NUM_TABLES],
PublicValues,
GenerationOutputs,
)> {
) -> anyhow::Result<([Vec<PolynomialValues<F>>; NUM_TABLES], PublicValues)> {
let mut state = GenerationState::<F>::new(inputs.clone(), &KERNEL.code)
.map_err(|err| anyhow!("Failed to parse all the initial prover inputs: {:?}", err))?;

Expand All @@ -218,9 +205,6 @@ pub fn generate_traces<F: RichField + Extendable<D>, const D: usize>(
state.traces.get_lengths()
);

let outputs = get_outputs(&mut state)
.map_err(|err| anyhow!("Failed to generate post-state info: {:?}", err))?;

let read_metadata = |field| state.memory.read_global_metadata(field);
let trie_roots_before = TrieRoots {
state_root: H256::from_uint(&read_metadata(StateTrieRootDigestBefore)),
Expand Down Expand Up @@ -257,7 +241,7 @@ pub fn generate_traces<F: RichField + Extendable<D>, const D: usize>(
"convert trace data to tables",
state.traces.into_tables(all_stark, config, timing)
);
Ok((tables, public_values, outputs))
Ok((tables, public_values))
}

fn simulate_cpu<F: RichField + Extendable<D>, const D: usize>(
Expand Down
109 changes: 0 additions & 109 deletions evm/src/generation/outputs.rs

This file was deleted.

21 changes: 2 additions & 19 deletions evm/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use crate::cross_table_lookup::{
GrandProductChallengeSet,
};
use crate::evaluation_frame::StarkEvaluationFrame;
use crate::generation::outputs::GenerationOutputs;
use crate::generation::{generate_traces, GenerationInputs};
use crate::get_challenges::observe_public_values;
use crate::lookup::{lookup_helper_columns, Lookup, LookupCheckVars};
Expand All @@ -45,34 +44,18 @@ pub fn prove<F, C, const D: usize>(
inputs: GenerationInputs,
timing: &mut TimingTree,
) -> Result<AllProof<F, C, D>>
where
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
{
let (proof, _outputs) = prove_with_outputs(all_stark, config, inputs, timing)?;
Ok(proof)
}

/// Generate traces, then create all STARK proofs. Returns information about the post-state,
/// intended for debugging, in addition to the proof.
pub fn prove_with_outputs<F, C, const D: usize>(
all_stark: &AllStark<F, D>,
config: &StarkConfig,
inputs: GenerationInputs,
timing: &mut TimingTree,
) -> Result<(AllProof<F, C, D>, GenerationOutputs)>
where
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
{
timed!(timing, "build kernel", Lazy::force(&KERNEL));
let (traces, public_values, outputs) = timed!(
let (traces, public_values) = timed!(
timing,
"generate all traces",
generate_traces(all_stark, inputs, config, timing)?
);
let proof = prove_with_traces(all_stark, config, traces, public_values, timing)?;
Ok((proof, outputs))
Ok(proof)
}

/// Compute all STARK proofs.
Expand Down
1 change: 0 additions & 1 deletion evm/tests/add11_yml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ fn add11_yml() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down
1 change: 0 additions & 1 deletion evm/tests/basic_smart_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ fn test_basic_smart_contract() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down
1 change: 0 additions & 1 deletion evm/tests/empty_txn_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fn test_empty_txn_list() -> anyhow::Result<()> {
prev_hashes: initial_block_hashes,
cur_hash: H256::default(),
},
addresses: vec![],
};

// Initialize the preprocessed circuits for the zkEVM.
Expand Down
1 change: 0 additions & 1 deletion evm/tests/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ fn test_erc20() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down
3 changes: 0 additions & 3 deletions evm/tests/log_opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ fn test_log_opcodes() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down Expand Up @@ -436,7 +435,6 @@ fn test_log_with_aggreg() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

// Preprocess all circuits.
Expand Down Expand Up @@ -562,7 +560,6 @@ fn test_log_with_aggreg() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove root second", log::Level::Info);
Expand Down
1 change: 0 additions & 1 deletion evm/tests/self_balance_gas_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ fn self_balance_gas_cost() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down
1 change: 0 additions & 1 deletion evm/tests/selfdestruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ fn test_selfdestruct() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down
1 change: 0 additions & 1 deletion evm/tests/simple_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ fn test_simple_transfer() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down
1 change: 0 additions & 1 deletion evm/tests/withdrawals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ fn test_withdrawals() -> anyhow::Result<()> {
prev_hashes: vec![H256::default(); 256],
cur_hash: H256::default(),
},
addresses: vec![],
};

let mut timing = TimingTree::new("prove", log::Level::Debug);
Expand Down

0 comments on commit 47e2430

Please sign in to comment.