#![doc(html_root_url = "https://docs.rs/casper-engine-test-support/2.1.0")]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/CasperLabs/casper-node/master/images/CasperLabs_Logo_Favicon_RGB_50px.png",
html_logo_url = "https://raw.githubusercontent.com/CasperLabs/casper-node/master/images/CasperLabs_Logo_Symbol_RGB.png",
test(attr(forbid(warnings)))
)]
#![warn(missing_docs)]
mod additive_map_diff;
mod deploy_item_builder;
mod execute_request_builder;
mod step_request_builder;
mod upgrade_request_builder;
pub mod utils;
mod wasm_test_builder;
use num_rational::Ratio;
use once_cell::sync::Lazy;
use casper_execution_engine::{
core::engine_state::{
genesis::{ExecConfig, GenesisAccount, GenesisConfig},
run_genesis_request::RunGenesisRequest,
},
shared::{system_config::SystemConfig, wasm_config::WasmConfig},
};
use casper_hashing::Digest;
use casper_types::{account::AccountHash, Motes, ProtocolVersion, PublicKey, SecretKey, U512};
pub use additive_map_diff::AdditiveMapDiff;
pub use deploy_item_builder::DeployItemBuilder;
pub use execute_request_builder::ExecuteRequestBuilder;
pub use step_request_builder::StepRequestBuilder;
pub use upgrade_request_builder::UpgradeRequestBuilder;
pub use wasm_test_builder::{InMemoryWasmTestBuilder, LmdbWasmTestBuilder, WasmTestBuilder};
pub const DEFAULT_VALIDATOR_SLOTS: u32 = 5;
pub const DEFAULT_AUCTION_DELAY: u64 = 3;
pub const DEFAULT_LOCKED_FUNDS_PERIOD_MILLIS: u64 = 90 * 24 * 60 * 60 * 1000;
pub const DEFAULT_UNBONDING_DELAY: u64 = 14;
pub const DEFAULT_ROUND_SEIGNIORAGE_RATE: Ratio<u64> = Ratio::new_raw(6414, 623437335209);
pub const DEFAULT_CHAIN_NAME: &str = "casper-execution-engine-testing";
pub const DEFAULT_GENESIS_TIMESTAMP_MILLIS: u64 = 0;
pub const DEFAULT_MAX_ASSOCIATED_KEYS: u32 = 100;
pub const DEFAULT_MAX_STORED_VALUE_SIZE: u32 = 8 * 1024 * 1024;
pub const DEFAULT_BLOCK_TIME: u64 = 0;
pub const DEFAULT_GAS_PRICE: u64 = 1;
pub const ARG_AMOUNT: &str = "amount";
pub const TIMESTAMP_MILLIS_INCREMENT: u64 = 30_000;
pub static DEFAULT_GENESIS_CONFIG_HASH: Lazy<Digest> = Lazy::new(|| [42; 32].into());
pub static DEFAULT_ACCOUNT_PUBLIC_KEY: Lazy<PublicKey> = Lazy::new(|| {
let secret_key = SecretKey::ed25519_from_bytes([199; SecretKey::ED25519_LENGTH]).unwrap();
PublicKey::from(&secret_key)
});
pub static DEFAULT_ACCOUNT_ADDR: Lazy<AccountHash> =
Lazy::new(|| AccountHash::from(&*DEFAULT_ACCOUNT_PUBLIC_KEY));
pub static DEFAULT_ACCOUNT_KEY: Lazy<AccountHash> =
Lazy::new(|| AccountHash::from(&*DEFAULT_ACCOUNT_PUBLIC_KEY));
pub const DEFAULT_ACCOUNT_INITIAL_BALANCE: u64 = 100_000_000_000_000_000u64;
pub const MINIMUM_ACCOUNT_CREATION_BALANCE: u64 = 7_500_000_000_000_000u64;
pub static DEFAULT_PROPOSER_PUBLIC_KEY: Lazy<PublicKey> = Lazy::new(|| {
let secret_key = SecretKey::ed25519_from_bytes([198; SecretKey::ED25519_LENGTH]).unwrap();
PublicKey::from(&secret_key)
});
pub static DEFAULT_PROPOSER_ADDR: Lazy<AccountHash> =
Lazy::new(|| AccountHash::from(&*DEFAULT_PROPOSER_PUBLIC_KEY));
pub static DEFAULT_ACCOUNTS: Lazy<Vec<GenesisAccount>> = Lazy::new(|| {
let mut ret = Vec::new();
let genesis_account = GenesisAccount::account(
DEFAULT_ACCOUNT_PUBLIC_KEY.clone(),
Motes::new(DEFAULT_ACCOUNT_INITIAL_BALANCE.into()),
None,
);
ret.push(genesis_account);
let proposer_account = GenesisAccount::account(
DEFAULT_PROPOSER_PUBLIC_KEY.clone(),
Motes::new(DEFAULT_ACCOUNT_INITIAL_BALANCE.into()),
None,
);
ret.push(proposer_account);
ret
});
pub static DEFAULT_PROTOCOL_VERSION: Lazy<ProtocolVersion> = Lazy::new(|| ProtocolVersion::V1_0_0);
pub static DEFAULT_PAYMENT: Lazy<U512> = Lazy::new(|| U512::from(1_500_000_000_000u64));
pub static DEFAULT_WASM_CONFIG: Lazy<WasmConfig> = Lazy::new(WasmConfig::default);
pub static DEFAULT_SYSTEM_CONFIG: Lazy<SystemConfig> = Lazy::new(SystemConfig::default);
pub static DEFAULT_EXEC_CONFIG: Lazy<ExecConfig> = Lazy::new(|| {
ExecConfig::new(
DEFAULT_ACCOUNTS.clone(),
*DEFAULT_WASM_CONFIG,
*DEFAULT_SYSTEM_CONFIG,
DEFAULT_VALIDATOR_SLOTS,
DEFAULT_AUCTION_DELAY,
DEFAULT_LOCKED_FUNDS_PERIOD_MILLIS,
DEFAULT_ROUND_SEIGNIORAGE_RATE,
DEFAULT_UNBONDING_DELAY,
DEFAULT_GENESIS_TIMESTAMP_MILLIS,
)
});
pub static DEFAULT_GENESIS_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
GenesisConfig::new(
DEFAULT_CHAIN_NAME.to_string(),
DEFAULT_GENESIS_TIMESTAMP_MILLIS,
*DEFAULT_PROTOCOL_VERSION,
DEFAULT_EXEC_CONFIG.clone(),
)
});
pub static DEFAULT_RUN_GENESIS_REQUEST: Lazy<RunGenesisRequest> = Lazy::new(|| {
RunGenesisRequest::new(
*DEFAULT_GENESIS_CONFIG_HASH,
*DEFAULT_PROTOCOL_VERSION,
DEFAULT_EXEC_CONFIG.clone(),
)
});
pub static SYSTEM_ADDR: Lazy<AccountHash> = Lazy::new(|| PublicKey::System.to_account_hash());