Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block committed Jul 28, 2024
1 parent b244f62 commit f67801d
Show file tree
Hide file tree
Showing 6 changed files with 482 additions and 302 deletions.
8 changes: 4 additions & 4 deletions programs/registry/src/protocol_config/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::errors::RegistryError;
use crate::{errors::RegistryError, MINT};
use aligned_sized::aligned_sized;
use anchor_lang::prelude::*;

Expand Down Expand Up @@ -50,14 +50,14 @@ impl Default for ProtocolConfig {
fn default() -> Self {
Self {
genesis_slot: 0,
epoch_reward: 0,
base_reward: 0,
epoch_reward: 1_000_000,
base_reward: 500_000,
min_stake: 0,
slot_length: 10,
registration_phase_length: 100,
active_phase_length: 1000,
report_work_phase_length: 100,
mint: Pubkey::default(),
mint: MINT,
forester_registration_guarded: true,
}
}
Expand Down
51 changes: 31 additions & 20 deletions test-programs/e2e-test/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use light_registry::protocol_config::state::ProtocolConfig;
use light_test_utils::e2e_test_env::{E2ETestEnv, GeneralActionConfig, KeypairActionConfig};
use light_test_utils::indexer::TestIndexer;
use light_test_utils::rpc::ProgramTestRpcConnection;
use light_test_utils::test_env::setup_test_programs_with_accounts_with_protocol_config;
use light_test_utils::test_env::{
set_env_with_delegate_and_forester, setup_test_programs_with_accounts_with_protocol_config,
};

#[tokio::test]
async fn test_10_all() {
Expand All @@ -16,30 +18,39 @@ async fn test_10_all() {
report_work_phase_length: 100,
..ProtocolConfig::default()
};
let (rpc, env_accounts) =
setup_test_programs_with_accounts_with_protocol_config(None, protocol_config, true).await;

let indexer: TestIndexer<ProgramTestRpcConnection> = TestIndexer::init_from_env(
&env_accounts.forester.insecure_clone(),
&env_accounts,
KeypairActionConfig::all_default().inclusion(),
KeypairActionConfig::all_default().non_inclusion(),
)
.await;
// let (rpc, env_accounts) =
// setup_test_programs_with_accounts_with_protocol_config(None, protocol_config, true).await;

let mut env =
E2ETestEnv::<ProgramTestRpcConnection, TestIndexer<ProgramTestRpcConnection>>::new(
rpc,
indexer,
&env_accounts,
KeypairActionConfig::all_default(),
GeneralActionConfig::default(),
// let indexer: TestIndexer<ProgramTestRpcConnection> = TestIndexer::init_from_env(
// &env_accounts.forester.insecure_clone(),
// &env_accounts,
// KeypairActionConfig::all_default().inclusion(),
// KeypairActionConfig::all_default().non_inclusion(),
// )
// .await;
let (mut e2e_env, _delegate_keypair, _env, _tree_accounts, _registered_epoch) =
set_env_with_delegate_and_forester(
None,
Some(KeypairActionConfig::all_default()),
Some(GeneralActionConfig::default()),
10,
None,
)
.await;
env.execute_rounds().await;
println!("stats {:?}", env.stats);

// let mut env =
// E2ETestEnv::<ProgramTestRpcConnection, TestIndexer<ProgramTestRpcConnection>>::new(
// rpc,
// indexer,
// &env_accounts,
// KeypairActionConfig::all_default(),
// GeneralActionConfig::default(),
// 10,
// None,
// )
// .await;
e2e_env.execute_rounds().await;
println!("stats {:?}", e2e_env.stats);
}

// cargo test-sbf -p e2e-test -- --nocapture --ignored --test test_10000_all > output.txt 2>&1
Expand Down
Loading

0 comments on commit f67801d

Please sign in to comment.