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

CLEANUP: remove sov-election module since we don't need it and modify tests using it to use sov-bank #739

Merged
merged 10 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
22 changes: 0 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ members = [
"module-system/module-implementations/module-template",
"module-system/module-implementations/examples/sov-value-setter",
"module-system/module-implementations/examples/sov-vec-setter",
"module-system/module-implementations/examples/sov-election",
"module-system/module-implementations/integration-tests",
]
exclude = [
Expand Down Expand Up @@ -114,4 +113,4 @@ secp256k1 = { version = "0.27.0", default-features = false, features = ["global-
[patch.crates-io]
# See reth: https://github.com/paradigmxyz/reth/blob/main/Cargo.toml#L79
revm = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" }
revm-primitives = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" }
revm-primitives = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" }
1 change: 0 additions & 1 deletion examples/demo-prover/host/benches/prover_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ async fn main() -> Result<(), anyhow::Error> {
sequencer_private_key.default_address(),
sequencer_da_address.as_ref().to_vec(),
&sequencer_private_key,
&sequencer_private_key,
);
println!("Starting from empty storage, initialization chain");
app.stf.init_chain(genesis_config);
Expand Down
1 change: 0 additions & 1 deletion examples/demo-prover/host/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ async fn main() -> Result<(), anyhow::Error> {
sequencer_private_key.default_address(),
sequencer_da_address.as_ref().to_vec(),
&sequencer_private_key,
&sequencer_private_key,
);
info!("Starting from empty storage, initialization chain");
app.stf.init_chain(genesis_config);
Expand Down
1 change: 0 additions & 1 deletion examples/demo-rollup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ pub fn get_genesis_config<A: BasicAddress>(
sequencer_private_key.default_address(),
sequencer_da_address.as_ref().to_vec(),
&sequencer_private_key,
&sequencer_private_key,
)
}
2 changes: 0 additions & 2 deletions examples/demo-stf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ tracing = { workspace = true }
const-rollup-config = { path = "../const-rollup-config" }
sov-rollup-interface = { path = "../../rollup-interface" }
sov-cli = { path = "../../module-system/sov-cli", optional = true }
sov-election = { path = "../../module-system/module-implementations/examples/sov-election" }
sov-sequencer-registry = { path = "../../module-system/module-implementations/sov-sequencer-registry" }
sov-blob-storage = { path = "../../module-system/module-implementations/sov-blob-storage" }
sov-bank = { path = "../../module-system/module-implementations/sov-bank" }
Expand All @@ -56,7 +55,6 @@ native = [
"sov-bank/native",
"sov-cli",
"sov-accounts/native",
"sov-election/native",
"sov-sequencer-registry/native",
"sov-blob-storage/native",
"sov-value-setter/native",
Expand Down
9 changes: 0 additions & 9 deletions examples/demo-stf/src/genesis_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use sov_election::ElectionConfig;
#[cfg(feature = "experimental")]
use sov_evm::{AccountData, EvmConfig, SpecId};
pub use sov_modules_api::default_context::DefaultContext;
Expand All @@ -21,7 +20,6 @@ pub fn create_demo_genesis_config<C: Context>(
sequencer_address: C::Address,
sequencer_da_address: Vec<u8>,
value_setter_admin_private_key: &DefaultPrivateKey,
election_admin_private_key: &DefaultPrivateKey,
) -> GenesisConfig<C> {
let token_config: sov_bank::TokenConfig<C> = sov_bank::TokenConfig {
token_name: DEMO_TOKEN_NAME.to_owned(),
Expand Down Expand Up @@ -53,10 +51,6 @@ pub fn create_demo_genesis_config<C: Context>(
admin: value_setter_admin_private_key.pub_key().to_address(),
};

let election_config = ElectionConfig {
admin: election_admin_private_key.pub_key().to_address(),
};

#[cfg(feature = "experimental")]
let genesis_evm_address = hex::decode("f39Fd6e51aad88F6F4ce6aB8827279cffFb92266")
.unwrap()
Expand All @@ -67,7 +61,6 @@ pub fn create_demo_genesis_config<C: Context>(
bank_config,
sequencer_registry_config,
(),
election_config,
value_setter_config,
sov_accounts::AccountConfig { pub_keys: vec![] },
#[cfg(feature = "experimental")]
Expand All @@ -89,13 +82,11 @@ pub fn create_demo_genesis_config<C: Context>(
pub fn create_demo_config(
initial_sequencer_balance: u64,
value_setter_admin_private_key: &DefaultPrivateKey,
election_admin_private_key: &DefaultPrivateKey,
) -> GenesisConfig<DefaultContext> {
create_demo_genesis_config::<DefaultContext>(
initial_sequencer_balance,
generate_address::<DefaultContext>(DEMO_SEQ_PUB_KEY_STR),
DEMO_SEQUENCER_DA_ADDRESS.to_vec(),
value_setter_admin_private_key,
election_admin_private_key,
)
}
5 changes: 0 additions & 5 deletions examples/demo-stf/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use sov_bank::query::{BankRpcImpl, BankRpcServer};
#[cfg(feature = "native")]
use sov_blob_storage::{BlobStorageRpcImpl, BlobStorageRpcServer};
#[cfg(feature = "native")]
use sov_election::query::{ElectionRpcImpl, ElectionRpcServer};
#[cfg(feature = "native")]
#[cfg(feature = "experimental")]
use sov_evm::query::{EvmRpcImpl, EvmRpcServer};
use sov_modules_api::capabilities::{BlobRefOrOwned, BlobSelector};
Expand All @@ -29,7 +27,6 @@ use sov_value_setter::query::{ValueSetterRpcImpl, ValueSetterRpcServer};
pub mod query {
pub use sov_accounts::query as accounts;
pub use sov_bank::query as bank;
pub use sov_election::query as election;
pub use sov_sequencer_registry::query as sequencer_registry;
pub use sov_value_setter::query as value_setter;
}
Expand Down Expand Up @@ -82,7 +79,6 @@ pub struct Runtime<C: Context> {
pub sequencer_registry: sov_sequencer_registry::SequencerRegistry<C>,
#[cfg_attr(feature = "native", cli_skip)]
pub blob_storage: sov_blob_storage::BlobStorage<C>,
pub election: sov_election::Election<C>,
pub value_setter: sov_value_setter::ValueSetter<C>,
pub accounts: sov_accounts::Accounts<C>,
}
Expand All @@ -100,7 +96,6 @@ pub struct Runtime<C: Context> {
pub sequencer_registry: sov_sequencer_registry::SequencerRegistry<C>,
#[cfg_attr(feature = "native", cli_skip)]
pub blob_storage: sov_blob_storage::BlobStorage<C>,
pub election: sov_election::Election<C>,
pub value_setter: sov_value_setter::ValueSetter<C>,
pub accounts: sov_accounts::Accounts<C>,
#[cfg_attr(feature = "native", cli_skip)]
Expand Down
56 changes: 28 additions & 28 deletions examples/demo-stf/src/tests/da_simulation.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::rc::Rc;

use sov_data_generators::election_data::{
BadNonceElectionCallMessages, BadSerializationElectionCallMessages, BadSigElectionCallMessages,
ElectionCallMessages, InvalidElectionCallMessages,
use sov_data_generators::bank_data::{
BadSerializationBankCallMessages, BadSignatureBankCallMessages, BankMessageGenerator,
};
use sov_data_generators::value_setter_data::{ValueSetterMessage, ValueSetterMessages};
use sov_data_generators::MessageGenerator;
Expand All @@ -14,43 +13,44 @@ use crate::runtime::Runtime;

type C = DefaultContext;

pub fn simulate_da(
value_setter_admin: DefaultPrivateKey,
election_admin: DefaultPrivateKey,
) -> Vec<RawTx> {
pub fn simulate_da(value_setter_admin: DefaultPrivateKey) -> Vec<RawTx> {
let mut messages = Vec::default();

let election: ElectionCallMessages<C> = ElectionCallMessages::new(election_admin);
messages.extend(election.create_raw_txs::<Runtime<C>>());
let bank_generator = BankMessageGenerator::<C>::default();
let bank_txns = bank_generator.create_raw_txs::<Runtime<C>>();

let value_setter = ValueSetterMessages::new(vec![ValueSetterMessage {
admin: Rc::new(value_setter_admin),
messages: vec![99, 33],
}]);
messages.extend(value_setter.create_raw_txs::<Runtime<C>>());

messages.extend(bank_txns);
messages
}

pub fn simulate_da_with_revert_msg(election_admin: DefaultPrivateKey) -> Vec<RawTx> {
let election = InvalidElectionCallMessages::new(election_admin);
election.create_raw_txs::<Runtime<C>>()
}

pub fn simulate_da_with_bad_sig(election_admin: DefaultPrivateKey) -> Vec<RawTx> {
let election = BadSigElectionCallMessages::<DefaultContext>::new(election_admin);
election.create_raw_txs::<Runtime<C>>()
pub fn simulate_da_with_revert_msg() -> Vec<RawTx> {
let mut messages = Vec::default();
let bank_generator = BankMessageGenerator::<C>::create_invalid_transfer();
let bank_txns = bank_generator.create_raw_txs::<Runtime<C>>();
messages.extend(bank_txns);
messages
}

// TODO: Remove once we fix test with bad nonce
// https://github.com/Sovereign-Labs/sovereign-sdk/issues/235
#[allow(unused)]
pub fn simulate_da_with_bad_nonce(election_admin: DefaultPrivateKey) -> Vec<RawTx> {
let election = BadNonceElectionCallMessages::new(election_admin);
election.create_raw_txs::<Runtime<C>>()
pub fn simulate_da_with_bad_sig() -> Vec<RawTx> {
let b = BadSignatureBankCallMessages::new();
b.create_raw_txs::<Runtime<C>>()
}

pub fn simulate_da_with_bad_serialization(election_admin: DefaultPrivateKey) -> Vec<RawTx> {
let election = BadSerializationElectionCallMessages::new(election_admin);
election.create_raw_txs::<Runtime<C>>()
//
// // TODO: Remove once we fix test with bad nonce
// // https://github.com/Sovereign-Labs/sovereign-sdk/issues/235
// #[allow(unused)]
// pub fn simulate_da_with_bad_nonce(election_admin: DefaultPrivateKey) -> Vec<RawTx> {
dubbelosix marked this conversation as resolved.
Show resolved Hide resolved
// let election = BadNonceElectionCallMessages::new(election_admin);
// election.create_raw_txs::<Runtime<C>>()
// }
//

pub fn simulate_da_with_bad_serialization() -> Vec<RawTx> {
let b = BadSerializationBankCallMessages::new();
b.create_raw_txs::<Runtime<C>>()
}
Loading
Loading