Skip to content

Commit

Permalink
chore: Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
storojs72 committed Jun 18, 2024
1 parent c616389 commit a412dee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
19 changes: 14 additions & 5 deletions aptos/light-client/src/epoch_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@ struct EpochChangeOutput {
}

#[cfg(feature = "aptos")]
pub fn setup_assets() -> (Vec<u8>, Vec<u8>) {
pub fn setup_assets() -> (Vec<u8>, Vec<u8>, Vec<u8>) {
use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper;
use aptos_lc_core::crypto::hash::CryptoHash;

const NBR_VALIDATORS: usize = 130;
const AVERAGE_SIGNERS_NBR: usize = 95;

let mut aptos_wrapper = AptosWrapper::new(20000, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap();

let trusted_state = bcs::to_bytes(aptos_wrapper.trusted_state()).unwrap();
let validator_verifier_hash =
match aptos_lc_core::types::trusted_state::TrustedState::from_bytes(&trusted_state).unwrap()
{
aptos_lc_core::types::trusted_state::TrustedState::EpochState {
epoch_state, ..
} => epoch_state.verifier().hash().to_vec(),
_ => panic!("Expected epoch change for current trusted state"),
};
let trusted_state_version = *aptos_wrapper.current_version();

aptos_wrapper.generate_traffic().unwrap();
Expand All @@ -32,7 +41,7 @@ pub fn setup_assets() -> (Vec<u8>, Vec<u8>) {

let epoch_change_proof = bcs::to_bytes(state_proof.epoch_changes()).unwrap();

(trusted_state, epoch_change_proof)
(trusted_state, epoch_change_proof, validator_verifier_hash)
}

pub fn generate_stdin(current_trusted_state: &[u8], epoch_change_proof: &[u8]) -> SphinxStdin {
Expand Down Expand Up @@ -111,7 +120,7 @@ mod test {
fn test_execute_epoch_change() {
use std::time::Instant;

let (trusted_state, epoch_change_proof) = setup_assets();
let (trusted_state, epoch_change_proof, _) = setup_assets();

println!("Starting execution of prove_epoch_change...");
let start = Instant::now();
Expand All @@ -126,7 +135,7 @@ mod test {
use sphinx_sdk::ProverClient;
use std::time::Instant;

let (trusted_state, epoch_change_proof) = setup_assets();
let (trusted_state, epoch_change_proof, validator_verifier_hash) = setup_assets();

let client = ProverClient::new();

Expand Down Expand Up @@ -157,7 +166,7 @@ mod test {

setup_logger();

let (trusted_state, epoch_change_proof) = setup_assets();
let (trusted_state, epoch_change_proof, _) = setup_assets();

let client = ProverClient::new();
let (pk, vk) = client.setup(aptos_programs::EPOCH_CHANGE_PROGRAM);
Expand Down
4 changes: 1 addition & 3 deletions aptos/solidity/contracts-generator/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::path::PathBuf;
use anyhow::Result;
use log::info;
use sphinx_sdk::artifacts::try_install_plonk_bn254_artifacts;
use sphinx_sdk::utils::setup_logger;
use std::path::PathBuf;

fn main() -> Result<()> {

setup_logger();

let artifacts_dir = try_install_plonk_bn254_artifacts();
Expand All @@ -16,7 +15,6 @@ fn main() -> Result<()> {
.filter(|entry| entry.path().extension().and_then(|ext| ext.to_str()) == Some("sol"))
.collect::<Vec<_>>();


// Write each Solidity file to the contracts directory.
let contracts_src_dir =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../contracts/src/plonk");
Expand Down
2 changes: 1 addition & 1 deletion aptos/solidity/fixture-generator/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn main() {
}
"epoch_change" => {
elf = EPOCH_CHANGE_ELF;
let (trusted_state, epoch_change_proof) = aptos_lc::epoch_change::setup_assets();
let (trusted_state, epoch_change_proof, _) = aptos_lc::epoch_change::setup_assets();
stdin = aptos_lc::epoch_change::generate_stdin(&trusted_state, &epoch_change_proof);
}
_ => panic!("Unsupported program. Use: ['inclusion', 'epoch_change']"),
Expand Down

0 comments on commit a412dee

Please sign in to comment.