Skip to content

Commit

Permalink
[sip5] Implement Treasury and release stdlib v3 (#2465)
Browse files Browse the repository at this point in the history
* [stdlib] Implement Treasury module.

* [stdib] Impl load upgrade package between version and enhancement upgrade test

* [statedb] Implement get token info function for state reader.

* [stdlib] Release stdlib v3

* [stdlib] Deprecated MintKey and Collection.

* [stdlib] Check compat with previous latest stable version.

* [types] Define more on chain resource in rust.
  • Loading branch information
jolestar authored May 7, 2021
1 parent ef917c1 commit 2834636
Show file tree
Hide file tree
Showing 209 changed files with 4,828 additions and 2,221 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion config/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ static MIN_BLOCK_TIME_TARGET: u64 = 5000;
static MAX_BLOCK_TIME_TARGET: u64 = 60000;
static BASE_MAX_UNCLES_PER_BLOCK: u64 = 2;

pub static TOTAL_STC_AMOUNT: Lazy<TokenValue<STCUnit>> =
Lazy::new(|| STCUnit::STC.value_of(318513600));

//for Private funding
static DEFAULT_PRE_MINT_AMOUNT: Lazy<TokenValue<STCUnit>> =
Lazy::new(|| STCUnit::STC.value_of(15925680));
Expand Down Expand Up @@ -784,7 +787,7 @@ pub static TEST_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
reward_delay: 1,
pre_mine_amount: DEFAULT_PRE_MINT_AMOUNT.scaling(),
time_mint_amount: DEFAULT_TIME_LOCKED_AMOUNT.scaling(),
time_mint_period: 3600,
time_mint_period: DEFAULT_TIME_LOCKED_PERIOD,
vm_config: VMConfig {
gas_schedule: TEST_GAS_SCHEDULE.clone(),
},
Expand Down
2 changes: 1 addition & 1 deletion config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod account_vault_config;
mod api_config;
mod api_quota;
mod available_port;
mod genesis_config;
pub mod genesis_config;
mod helper;
mod logger_config;
mod metrics_config;
Expand Down
1 change: 0 additions & 1 deletion executor/src/stdlib_test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
// SPDX-License-Identifier: Apache-2.0

mod block_reward_test;
mod module_upgrade_test;
mod on_chain_config_test;
mod sip_flag_test;
30 changes: 15 additions & 15 deletions executor/src/stdlib_test/on_chain_config_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ fn test_modify_on_chain_consensus_config() -> Result<()> {
let action_type_tag = consensus_config_type_tag();
let strategy = 2u8;

let chain_state = dao_vote_test(
alice,
chain_state,
dao_vote_test(
&alice,
&chain_state,
&net,
vote_script_consensus(&net, strategy),
on_chain_config_type_tag(action_type_tag.clone()),
Expand Down Expand Up @@ -75,9 +75,9 @@ fn test_modify_on_chain_reward_config() -> Result<()> {
let action_type_tag = reward_config_type_tag();
let reward_delay: u64 = 100;

let chain_state = dao_vote_test(
alice,
chain_state,
dao_vote_test(
&alice,
&chain_state,
&net,
vote_reward_scripts(&net, reward_delay),
on_chain_config_type_tag(action_type_tag.clone()),
Expand Down Expand Up @@ -107,9 +107,9 @@ fn test_modify_on_chain_config_txn_timeout() -> Result<()> {
let action_type_tag = transasction_timeout_type_tag();
let duration_seconds: u64 = 3000;

let chain_state = dao_vote_test(
alice.clone(),
chain_state,
dao_vote_test(
&alice,
&chain_state,
&net,
vote_txn_timeout_script(&net, duration_seconds),
on_chain_config_type_tag(action_type_tag.clone()),
Expand Down Expand Up @@ -137,9 +137,9 @@ fn test_modify_on_chain_txn_publish_option() -> Result<()> {
let vote_script =
vote_txn_publish_option_script(&net, script_allowed, module_publishing_allowed);

let chain_state = dao_vote_test(
alice,
chain_state,
dao_vote_test(
&alice,
&chain_state,
&net,
vote_script,
on_chain_config_type_tag(action_type_tag.clone()),
Expand Down Expand Up @@ -236,9 +236,9 @@ fn test_modify_on_chain_vm_config_option() -> Result<()> {
.global_memory_per_byte_write_cost = InternalGasUnits::new(12);
let vote_script = vote_vm_config_script(&net, vm_config);

let chain_state = dao_vote_test(
alice,
chain_state,
dao_vote_test(
&alice,
&chain_state,
&net,
vote_script,
on_chain_config_type_tag(action_type_tag.clone()),
Expand Down
6 changes: 3 additions & 3 deletions executor/src/stdlib_test/sip_flag_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ fn test_sip_flags() -> Result<()> {
bcs_ext::to_bytes(&0u64).unwrap(),
],
);
let chain_state = dao_vote_test(
alice,
chain_state,
dao_vote_test(
&alice,
&chain_state,
&net,
vote_script_function,
dao_action_type_tag,
Expand Down
Loading

0 comments on commit 2834636

Please sign in to comment.