1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#![doc(html_root_url = "https://docs.rs/casper-engine-test-support/2.0.3")]
#![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_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());