Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MockAddress in demo-rollup benches. #738

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions examples/demo-rollup/benches/rng_xfers.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use std::env;
use std::str::FromStr;

use async_trait::async_trait;
use borsh::ser::BorshSerialize;
use celestia::verifier::address::CelestiaAddress;
use const_rollup_config::SEQUENCER_DA_ADDRESS;
use demo_stf::runtime::Runtime;
use sov_bank::{Bank, CallMessage, Coins};
use sov_modules_api::default_context::DefaultContext;
Expand All @@ -13,10 +10,12 @@ use sov_modules_api::transaction::Transaction;
use sov_modules_api::{Address, AddressBech32, EncodeCall, PrivateKey, PublicKey, Spec};
use sov_rollup_interface::da::DaSpec;
use sov_rollup_interface::mocks::{
MockBlob, MockBlock, MockBlockHeader, MockHash, MockValidityCond,
MockAddress, MockBlob, MockBlock, MockBlockHeader, MockHash, MockValidityCond,
};
use sov_rollup_interface::services::da::DaService;

pub(crate) const SEQUENCER_DA_ADDRESS: [u8; 32] = [99; 32];

#[derive(Clone)]
/// A simple DaService for a random number generator.
pub struct RngDaService;
Expand Down Expand Up @@ -95,7 +94,7 @@ pub struct RngDaSpec;
impl DaSpec for RngDaSpec {
type SlotHash = MockHash;
type BlockHeader = MockBlockHeader;
type BlobTransaction = MockBlob<CelestiaAddress>;
type BlobTransaction = MockBlob<MockAddress>;
type InclusionMultiProof = [u8; 32];
type CompletenessProof = ();
type ChainParams = ();
Expand Down Expand Up @@ -149,7 +148,7 @@ impl DaService for RngDaService {
generate_transfers(num_txns, (block.height - 1) * (num_txns as u64))
};

let address = CelestiaAddress::from_str(SEQUENCER_DA_ADDRESS).unwrap();
let address = MockAddress::from(SEQUENCER_DA_ADDRESS);
let blob = MockBlob::new(data, address, [0u8; 32]);

vec![blob]
Expand Down
9 changes: 3 additions & 6 deletions examples/demo-rollup/benches/rollup_bench.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
mod rng_xfers;
use std::env;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;

use anyhow::Context;
use celestia::verifier::address::CelestiaAddress;
use const_rollup_config::SEQUENCER_DA_ADDRESS;
use criterion::{criterion_group, criterion_main, Criterion};
use demo_stf::app::App;
use demo_stf::genesis_config::create_demo_genesis_config;
use risc0_adapter::host::Risc0Verifier;
use rng_xfers::{RngDaService, RngDaSpec};
use rng_xfers::{RngDaService, RngDaSpec, SEQUENCER_DA_ADDRESS};
use sov_db::ledger_db::{LedgerDB, SlotCommit};
use sov_modules_api::default_signature::private_key::DefaultPrivateKey;
use sov_modules_api::PrivateKey;
use sov_rollup_interface::mocks::{MockBlock, MockBlockHeader, MockHash};
use sov_rollup_interface::mocks::{MockAddress, MockBlock, MockBlockHeader, MockHash};
use sov_rollup_interface::services::da::DaService;
use sov_rollup_interface::stf::StateTransitionFunction;
use sov_stf_runner::{from_toml_path, RollupConfig};
Expand Down Expand Up @@ -49,7 +46,7 @@ fn rollup_bench(_bench: &mut Criterion) {

let mut demo = demo_runner.stf;
let sequencer_private_key = DefaultPrivateKey::generate();
let sequencer_da_address = CelestiaAddress::from_str(SEQUENCER_DA_ADDRESS).unwrap();
let sequencer_da_address = MockAddress::from(SEQUENCER_DA_ADDRESS);
let demo_genesis_config = create_demo_genesis_config(
100000000,
sequencer_private_key.default_address(),
Expand Down