diff --git a/json-rpc/tests/integration_test.rs b/json-rpc/tests/integration_test.rs index afb1b076eaab..015f4d416f42 100644 --- a/json-rpc/tests/integration_test.rs +++ b/json-rpc/tests/integration_test.rs @@ -39,35 +39,35 @@ fn create_test_cases() -> Vec { resp.result.unwrap(), json!([ { - "burn_events_key": "04000000000000000000000000000000000000000a550c18", - "cancel_burn_events_key": "06000000000000000000000000000000000000000a550c18", + "burn_events_key": "05000000000000000000000000000000000000000a550c18", + "cancel_burn_events_key": "07000000000000000000000000000000000000000a550c18", "code": "Coin1", - "exchange_rate_update_events_key": "07000000000000000000000000000000000000000a550c18", + "exchange_rate_update_events_key": "08000000000000000000000000000000000000000a550c18", "fractional_part": 100, - "mint_events_key": "03000000000000000000000000000000000000000a550c18", - "preburn_events_key": "05000000000000000000000000000000000000000a550c18", + "mint_events_key": "04000000000000000000000000000000000000000a550c18", + "preburn_events_key": "06000000000000000000000000000000000000000a550c18", "scaling_factor": 1000000, "to_lbr_exchange_rate": 0.5 }, { - "burn_events_key": "09000000000000000000000000000000000000000a550c18", - "cancel_burn_events_key": "0b000000000000000000000000000000000000000a550c18", + "burn_events_key": "0a000000000000000000000000000000000000000a550c18", + "cancel_burn_events_key": "0c000000000000000000000000000000000000000a550c18", "code": "Coin2", - "exchange_rate_update_events_key": "0c000000000000000000000000000000000000000a550c18", + "exchange_rate_update_events_key": "0d000000000000000000000000000000000000000a550c18", "fractional_part": 100, - "mint_events_key": "08000000000000000000000000000000000000000a550c18", - "preburn_events_key": "0a000000000000000000000000000000000000000a550c18", + "mint_events_key": "09000000000000000000000000000000000000000a550c18", + "preburn_events_key": "0b000000000000000000000000000000000000000a550c18", "scaling_factor": 1000000, "to_lbr_exchange_rate": 0.5 }, { - "burn_events_key": "0e000000000000000000000000000000000000000a550c18", - "cancel_burn_events_key": "10000000000000000000000000000000000000000a550c18", + "burn_events_key": "0f000000000000000000000000000000000000000a550c18", + "cancel_burn_events_key": "11000000000000000000000000000000000000000a550c18", "code": "LBR", - "exchange_rate_update_events_key": "11000000000000000000000000000000000000000a550c18", + "exchange_rate_update_events_key": "12000000000000000000000000000000000000000a550c18", "fractional_part": 1000, - "mint_events_key": "0d000000000000000000000000000000000000000a550c18", - "preburn_events_key": "0f000000000000000000000000000000000000000a550c18", + "mint_events_key": "0e000000000000000000000000000000000000000a550c18", + "preburn_events_key": "10000000000000000000000000000000000000000a550c18", "scaling_factor": 1000000, "to_lbr_exchange_rate": 1.0 } diff --git a/language/move-lang/functional-tests/tests/translated_ir_tests/block/block_prologue.move b/language/move-lang/functional-tests/tests/translated_ir_tests/block/block_prologue.move index a9cab66e4774..5eb4252dcec5 100644 --- a/language/move-lang/functional-tests/tests/translated_ir_tests/block/block_prologue.move +++ b/language/move-lang/functional-tests/tests/translated_ir_tests/block/block_prologue.move @@ -4,7 +4,7 @@ //! proposer: vivian //! block-time: 1000000 -// check: EventKey([20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 85, 12, 24]) +// check: EventKey([21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 85, 12, 24]) // check: NewBlockEvent // check: 1000000 diff --git a/language/stdlib/compiled/stdlib/036_LibraAccount.mv b/language/stdlib/compiled/stdlib/036_LibraAccount.mv index ba6ba5bc8935..81a1f2c3f449 100644 Binary files a/language/stdlib/compiled/stdlib/036_LibraAccount.mv and b/language/stdlib/compiled/stdlib/036_LibraAccount.mv differ diff --git a/language/stdlib/compiled/stdlib/037_Genesis.mv b/language/stdlib/compiled/stdlib/037_Genesis.mv index 218f9447340a..6148e926d197 100644 Binary files a/language/stdlib/compiled/stdlib/037_Genesis.mv and b/language/stdlib/compiled/stdlib/037_Genesis.mv differ diff --git a/language/stdlib/modules/Genesis.move b/language/stdlib/modules/Genesis.move index 1b4553c62034..9650326b1d38 100644 --- a/language/stdlib/modules/Genesis.move +++ b/language/stdlib/modules/Genesis.move @@ -71,7 +71,6 @@ module Genesis { lr_account, ); LibraBlock::initialize_block_metadata(lr_account); - LibraAccount::initialize_writeset_manager(lr_account); let lr_rotate_key_cap = LibraAccount::extract_key_rotation_capability(lr_account); LibraAccount::rotate_authentication_key(&lr_rotate_key_cap, lr_auth_key); diff --git a/language/stdlib/modules/LibraAccount.move b/language/stdlib/modules/LibraAccount.move index 767cc57c19f2..c5afd6b72784 100644 --- a/language/stdlib/modules/LibraAccount.move +++ b/language/stdlib/modules/LibraAccount.move @@ -209,14 +209,6 @@ module LibraAccount { limits_cap: AccountLimits::grant_mutation_capability(lr_account), } ); - } - - public fun initialize_writeset_manager( - lr_account: &signer, - ) { - LibraTimestamp::assert_genesis(); - // Operational constraint, not a privilege constraint. - CoreAddresses::assert_libra_root(lr_account); assert( !exists(CoreAddresses::LIBRA_ROOT_ADDRESS()), @@ -230,7 +222,7 @@ module LibraAccount { ); } - spec fun initialize_writeset_manager { + spec fun initialize { include LibraTimestamp::AbortsIfNotGenesis; include CoreAddresses::AbortsIfNotLibraRoot{account: lr_account}; diff --git a/language/stdlib/modules/doc/Genesis.md b/language/stdlib/modules/doc/Genesis.md index dc97ab459c8a..27fd973f1c3f 100644 --- a/language/stdlib/modules/doc/Genesis.md +++ b/language/stdlib/modules/doc/Genesis.md @@ -76,7 +76,6 @@ lr_account, ); LibraBlock::initialize_block_metadata(lr_account); - LibraAccount::initialize_writeset_manager(lr_account); let lr_rotate_key_cap = LibraAccount::extract_key_rotation_capability(lr_account); LibraAccount::rotate_authentication_key(&lr_rotate_key_cap, lr_auth_key); diff --git a/language/stdlib/modules/doc/LibraAccount.md b/language/stdlib/modules/doc/LibraAccount.md index f36acb3a66c6..bb669eb5c0c1 100644 --- a/language/stdlib/modules/doc/LibraAccount.md +++ b/language/stdlib/modules/doc/LibraAccount.md @@ -46,7 +46,6 @@ - [Const `PROLOGUE_EMODULE_NOT_ALLOWED`](#0x1_LibraAccount_PROLOGUE_EMODULE_NOT_ALLOWED) - [Const `PROLOGUE_INVALID_WRITESET_SENDER`](#0x1_LibraAccount_PROLOGUE_INVALID_WRITESET_SENDER) - [Function `initialize`](#0x1_LibraAccount_initialize) -- [Function `initialize_writeset_manager`](#0x1_LibraAccount_initialize_writeset_manager) - [Function `has_published_account_limits`](#0x1_LibraAccount_has_published_account_limits) - [Function `should_track_limits_for_account`](#0x1_LibraAccount_should_track_limits_for_account) - [Function `staple_lbr`](#0x1_LibraAccount_staple_lbr) @@ -93,7 +92,7 @@ - [Function `create_validator_account`](#0x1_LibraAccount_create_validator_account) - [Function `create_validator_operator_account`](#0x1_LibraAccount_create_validator_operator_account) - [Specification](#0x1_LibraAccount_Specification) - - [Function `initialize_writeset_manager`](#0x1_LibraAccount_Specification_initialize_writeset_manager) + - [Function `initialize`](#0x1_LibraAccount_Specification_initialize) - [Function `should_track_limits_for_account`](#0x1_LibraAccount_Specification_should_track_limits_for_account) - [Function `staple_lbr`](#0x1_LibraAccount_Specification_staple_lbr) - [Function `unstaple_lbr`](#0x1_LibraAccount_Specification_unstaple_lbr) @@ -855,34 +854,6 @@ Initialize this module. This is only callable from genesis. limits_cap: AccountLimits::grant_mutation_capability(lr_account), } ); -} - - - - - - - - -## Function `initialize_writeset_manager` - - - -
public fun initialize_writeset_manager(lr_account: &signer)
-
- - - -
-Implementation - - -
public fun initialize_writeset_manager(
-    lr_account: &signer,
-) {
-    LibraTimestamp::assert_genesis();
-    // Operational constraint, not a privilege constraint.
-    CoreAddresses::assert_libra_root(lr_account);
 
     assert(
         !exists<LibraWriteSetManager>(CoreAddresses::LIBRA_ROOT_ADDRESS()),
@@ -2596,12 +2567,12 @@ After genesis, the LibraW
 
 
 
-
+
 
-### Function `initialize_writeset_manager`
+### Function `initialize`
 
 
-
public fun initialize_writeset_manager(lr_account: &signer)
+
public fun initialize(lr_account: &signer, dummy_auth_key_prefix: vector<u8>)
 
@@ -2694,11 +2665,11 @@ pragma verify_duration_estimate = 100;
schema StapleLBRAbortsIf {
     cap: WithdrawCapability;
     amount_lbr: u64;
-    
+    
     let reserve = global<LBR::Reserve>(CoreAddresses::LIBRA_ROOT_ADDRESS());
-    
+    
     let amount_coin1 = FixedPoint32::spec_multiply_u64(amount_lbr, reserve.coin1.ratio) + 1;
-    
+    
     let amount_coin2 = FixedPoint32::spec_multiply_u64(amount_lbr, reserve.coin2.ratio) + 1;
     aborts_if amount_lbr == 0 with Errors::INVALID_ARGUMENT;
     aborts_if reserve.coin1.backing.value + amount_coin1 > MAX_U64 with Errors::LIMIT_EXCEEDED;
@@ -2729,17 +2700,17 @@ pragma verify_duration_estimate = 100;
 
schema StapleLBREnsures {
     cap: WithdrawCapability;
     amount_lbr: u64;
-    
+    
     let reserve = global<LBR::Reserve>(CoreAddresses::LIBRA_ROOT_ADDRESS());
-    
+    
     let amount_coin1 = FixedPoint32::spec_multiply_u64(amount_lbr, reserve.coin1.ratio) + 1;
-    
+    
     let amount_coin2 = FixedPoint32::spec_multiply_u64(amount_lbr, reserve.coin2.ratio) + 1;
-    
+    
     let total_value_coin1 = global<Libra::CurrencyInfo<Coin1>>(CoreAddresses::CURRENCY_INFO_ADDRESS()).total_value;
-    
+    
     let total_value_coin2 = global<Libra::CurrencyInfo<Coin2>>(CoreAddresses::CURRENCY_INFO_ADDRESS()).total_value;
-    
+    
     let total_value_lbr = global<Libra::CurrencyInfo<LBR>>(CoreAddresses::CURRENCY_INFO_ADDRESS()).total_value;
     ensures global<Balance<Coin1>>(cap.account_address).coin.value
         == old(global<Balance<Coin1>>(cap.account_address).coin.value) - amount_coin1;
@@ -2891,9 +2862,9 @@ pragma verify_duration_estimate = 100;
 
schema TieredMintEnsures<Token> {
     designated_dealer_address: address;
     mint_amount: u64;
-    
+    
     let dealer_balance = global<Balance<Token>>(designated_dealer_address).coin.value;
-    
+    
     let currency_info = global<Libra::CurrencyInfo<Token>>(CoreAddresses::CURRENCY_INFO_ADDRESS());
 }
 
@@ -3001,7 +2972,7 @@ Can only withdraw from the balances of cap.account_address [B27].
pragma opaque;
-
+
 let payer = cap.account_address;
 modifies global<Balance<Token>>(payer);
 modifies global<LibraAccount>(payer);
@@ -3023,7 +2994,7 @@ Can only withdraw from the balances of cap.account_address [B27].
     cap: WithdrawCapability;
     payee: address;
     amount: u64;
-    
+    
     let payer = cap.account_address;
     include LibraTimestamp::AbortsIfNotOperating;
     include Libra::AbortsIfNoCurrency<Token>;
@@ -3047,9 +3018,9 @@ Can only withdraw from the balances of cap.account_address [B27].
 
 
 
pragma opaque;
-
+
 let dd_addr = Signer::spec_address_of(dd);
-
+
 let payer = cap.account_address;
 modifies global<LibraAccount>(payer);
 ensures exists<LibraAccount>(payer);
@@ -3084,9 +3055,9 @@ Can only withdraw from the balances of cap.account_address [B27].
 
schema PreburnEnsures<Token> {
     dd_addr: address;
     payer: address;
-    
+    
     let payer_balance = global<Balance<Token>>(payer).coin.value;
-    
+    
     let preburn = global<Libra::Preburn<Token>>(dd_addr);
 }
 
@@ -3123,7 +3094,7 @@ The value of preburn at dd_addr increases by amount;
pragma opaque;
-
+
 let sender_addr = Signer::spec_address_of(sender);
 modifies global<LibraAccount>(sender_addr);
 include ExtractWithdrawCapAbortsIf{sender_addr};
@@ -3161,7 +3132,7 @@ The value of preburn at dd_addr increases by amount;
 
 
 
pragma opaque;
-
+
 let cap_addr = cap.account_address;
 modifies global<LibraAccount>(cap_addr);
 aborts_if !exists_at(cap_addr) with Errors::NOT_PUBLISHED;
@@ -3246,7 +3217,7 @@ Can only rotate the authentication_key of cap.account_address [B26].
 
 
schema ExtractKeyRotationCapabilityAbortsIf {
     account: signer;
-    
+    
     let account_addr = Signer::spec_address_of(account);
     aborts_if !exists_at(account_addr) with Errors::NOT_PUBLISHED;
     aborts_if delegated_key_rotation_capability(account_addr) with Errors::INVALID_STATE;
@@ -3322,7 +3293,7 @@ Can only rotate the authentication_key of cap.account_address [B26].
 Needed to prove invariant
 
 
-
+
 
 
 
let new_account_addr = Signer::address_of(new_account);
@@ -3502,7 +3473,7 @@ Returns true if the LibraAccount at addr holds EnsuresHasKeyRotationCap {
     account: signer;
-    
+    
     let addr = Signer::spec_address_of(account);
     ensures spec_holds_own_key_rotation_cap(addr);
 }
@@ -3559,7 +3530,7 @@ or the key rotation capability for addr itself [B26].
 
 
schema EnsuresWithdrawalCap {
     account: signer;
-    
+    
     let addr = Signer::spec_address_of(account);
     ensures spec_holds_own_withdraw_cap(addr);
 }
diff --git a/types/src/block_metadata.rs b/types/src/block_metadata.rs
index ba9ac55616de..8feb6ee6167a 100644
--- a/types/src/block_metadata.rs
+++ b/types/src/block_metadata.rs
@@ -69,7 +69,7 @@ impl BlockMetadata {
 }
 
 pub fn new_block_event_key() -> EventKey {
-    EventKey::new_from_address(&libra_root_address(), 20)
+    EventKey::new_from_address(&libra_root_address(), 21)
 }
 
 /// The path to the new block event handle under a LibraBlock::BlockMetadata resource.
diff --git a/types/src/on_chain_config/mod.rs b/types/src/on_chain_config/mod.rs
index 9b2d9936f2ac..457a4530613d 100644
--- a/types/src/on_chain_config/mod.rs
+++ b/types/src/on_chain_config/mod.rs
@@ -130,7 +130,7 @@ pub trait OnChainConfig: Send + Sync + DeserializeOwned {
 }
 
 pub fn new_epoch_event_key() -> EventKey {
-    EventKey::new_from_address(&config_address(), 2)
+    EventKey::new_from_address(&config_address(), 3)
 }
 
 pub fn access_path_for_config(address: AccountAddress, config_name: Identifier) -> AccessPath {