From 1a77376decb2974d8286b8a0fa14a59939309cb7 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 4 Apr 2024 13:22:38 -0700 Subject: [PATCH] deprecate stale fee collection implementation --- .../src/components/feature_flags.rs | 4 +- aptos-move/e2e-move-tests/src/tests/mod.rs | 1 - .../src/tests/transaction_fee.rs | 530 ------------------ .../aptos-framework/doc/aptos_governance.md | 2 - .../framework/aptos-framework/doc/block.md | 12 - .../framework/aptos-framework/doc/coin.md | 288 +--------- .../aptos-framework/doc/consensus_config.md | 1 - .../aptos-framework/doc/execution_config.md | 1 - .../aptos-framework/doc/gas_schedule.md | 2 - .../framework/aptos-framework/doc/genesis.md | 2 - .../aptos-framework/doc/reconfiguration.md | 17 - .../doc/reconfiguration_with_dkg.md | 1 - .../framework/aptos-framework/doc/stake.md | 30 +- .../aptos-framework/doc/transaction_fee.md | 402 +------------ .../doc/transaction_validation.md | 31 +- .../framework/aptos-framework/doc/version.md | 1 - .../sources/aptos_governance.spec.move | 2 - .../aptos-framework/sources/block.move | 11 - .../aptos-framework/sources/block.spec.move | 1 - .../aptos-framework/sources/coin.move | 112 +--- .../aptos-framework/sources/coin.spec.move | 40 -- .../configs/consensus_config.spec.move | 1 - .../configs/execution_config.spec.move | 1 - .../sources/configs/gas_schedule.spec.move | 2 - .../sources/configs/version.spec.move | 1 - .../aptos-framework/sources/genesis.spec.move | 2 - .../sources/reconfiguration.move | 15 - .../sources/reconfiguration.spec.move | 1 - .../reconfiguration_with_dkg.spec.move | 1 - .../aptos-framework/sources/stake.move | 80 +-- .../aptos-framework/sources/stake.spec.move | 7 +- .../sources/transaction_fee.move | 288 +--------- .../sources/transaction_fee.spec.move | 147 ----- .../sources/transaction_validation.move | 15 +- .../sources/transaction_validation.spec.move | 17 +- .../framework/move-stdlib/doc/features.md | 29 +- .../move-stdlib/sources/configs/features.move | 10 +- .../sources/configs/features.spec.move | 4 - types/src/on_chain_config/aptos_features.rs | 2 +- 39 files changed, 41 insertions(+), 2073 deletions(-) delete mode 100644 aptos-move/e2e-move-tests/src/tests/transaction_fee.rs diff --git a/aptos-move/aptos-release-builder/src/components/feature_flags.rs b/aptos-move/aptos-release-builder/src/components/feature_flags.rs index 6d1ddce49f14d..128bff3bfecc3 100644 --- a/aptos-move/aptos-release-builder/src/components/feature_flags.rs +++ b/aptos-move/aptos-release-builder/src/components/feature_flags.rs @@ -188,7 +188,7 @@ impl From for AptosFeatureFlag { match f { FeatureFlag::CodeDependencyCheck => AptosFeatureFlag::CODE_DEPENDENCY_CHECK, FeatureFlag::CollectAndDistributeGasFees => { - AptosFeatureFlag::COLLECT_AND_DISTRIBUTE_GAS_FEES + AptosFeatureFlag::_DEPRECATED_COLLECT_AND_DISTRIBUTE_GAS_FEES }, FeatureFlag::TreatFriendAsPrivate => AptosFeatureFlag::TREAT_FRIEND_AS_PRIVATE, FeatureFlag::Sha512AndRipeMd160Natives => { @@ -279,7 +279,7 @@ impl From for FeatureFlag { fn from(f: AptosFeatureFlag) -> Self { match f { AptosFeatureFlag::CODE_DEPENDENCY_CHECK => FeatureFlag::CodeDependencyCheck, - AptosFeatureFlag::COLLECT_AND_DISTRIBUTE_GAS_FEES => { + AptosFeatureFlag::_DEPRECATED_COLLECT_AND_DISTRIBUTE_GAS_FEES => { FeatureFlag::CollectAndDistributeGasFees }, AptosFeatureFlag::TREAT_FRIEND_AS_PRIVATE => FeatureFlag::TreatFriendAsPrivate, diff --git a/aptos-move/e2e-move-tests/src/tests/mod.rs b/aptos-move/e2e-move-tests/src/tests/mod.rs index 6319d85693326..02ae1b07ae900 100644 --- a/aptos-move/e2e-move-tests/src/tests/mod.rs +++ b/aptos-move/e2e-move-tests/src/tests/mod.rs @@ -47,7 +47,6 @@ mod storage_refund; mod string_args; mod token_event_store; mod token_objects; -mod transaction_fee; mod type_too_large; mod vector_numeric_address; mod vm; diff --git a/aptos-move/e2e-move-tests/src/tests/transaction_fee.rs b/aptos-move/e2e-move-tests/src/tests/transaction_fee.rs deleted file mode 100644 index 0e4074d6caa84..0000000000000 --- a/aptos-move/e2e-move-tests/src/tests/transaction_fee.rs +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright © Aptos Foundation -// SPDX-License-Identifier: Apache-2.0 - -use crate::{ - assert_success, get_stake_pool, setup_staking, tests::common, transaction_fee, MoveHarness, -}; -use aptos_cached_packages::aptos_stdlib; -use aptos_language_e2e_tests::{account::Account, executor::FakeExecutor}; -use aptos_types::{ - account_address::AccountAddress, - on_chain_config::FeatureFlag, - transaction::{SignedTransaction, TransactionArgument, TransactionStatus}, -}; -use once_cell::sync::Lazy; -use rand::{ - distributions::Uniform, - rngs::{OsRng, StdRng}, - Rng, SeedableRng, -}; -use std::collections::BTreeMap; - -pub static PROPOSAL_SCRIPTS: Lazy>> = Lazy::new(build_scripts); - -fn build_scripts() -> BTreeMap> { - let package_folder = "transaction_fee.data"; - let package_names = vec![ - "initialize_collection", - "enable_collection", - "disable_collection", - "upgrade_burn_percentage", - "remove_validator", - ]; - common::build_scripts(package_folder, package_names) -} - -// Constants for calculating rewards for validators at the end of each epoch. -const INITIAL_STAKE_AMOUNT: u64 = 25_000_000; -const REWARDS_RATE_DENOMINATOR: u64 = 1_000_000_000; - -// Each epoch takes 1 hour in genesis config for tests. -const NUM_EPOCHS_IN_A_YEAR: u64 = 365 * 24; -const REWARDS_RATE: u64 = (10 * REWARDS_RATE_DENOMINATOR / 100) / NUM_EPOCHS_IN_A_YEAR; - -/// Holds all information about the current state of the chain, including -/// accounts of users, validators, etc. -struct TestUniverse { - harness: MoveHarness, - core_resources: Account, - validators: Vec, - users: Vec, -} - -// Make sure the number of users in this test universe is large enough. -const NUM_USERS: usize = 200; - -impl TestUniverse { - /// Creates a new testing universe with all necessary accounts created. - pub fn new(num_validators: usize) -> Self { - let executor = FakeExecutor::from_head_genesis().set_parallel(); - let mut harness = MoveHarness::new_with_executor(executor); - harness.set_default_gas_unit_price(1); - let core_resources = - harness.new_account_at(AccountAddress::from_hex_literal("0xA550C18").unwrap()); - let validators: Vec = (0..num_validators) - .map(|idx| { - harness.new_account_at( - AccountAddress::from_hex_literal(format!("0xa{}", idx).as_str()).unwrap(), - ) - }) - .collect(); - let users: Vec = (0..NUM_USERS) - .map(|idx| { - harness.new_account_at( - AccountAddress::from_hex_literal(format!("0xb{}", idx).as_str()).unwrap(), - ) - }) - .collect(); - Self { - harness, - core_resources, - validators, - users, - } - } - - /// Initializes validators with the given stake amount. - pub fn set_up_validators(&mut self, stake_amount: u64) { - self.validators.iter().for_each(|validator| { - assert_success!(setup_staking(&mut self.harness, validator, stake_amount)); - }); - self.harness.new_epoch(); - } - - /// Creates a block of p2p transactions in the universe. - pub fn create_block(&mut self, num_txns: usize) -> Vec { - let mut rng = StdRng::from_seed(OsRng.gen()); - let num_users = self.users.len(); - (0..num_txns) - .map(|_| { - // Select random users. - let src_account = &self.users[rng.sample(Uniform::new(0, num_users))]; - let dst_account = &self.users[rng.sample(Uniform::new(0, num_users))]; - - // Create a new p2p transaction. - self.harness.create_transaction_payload( - src_account, - aptos_stdlib::aptos_coin_transfer(*dst_account.address(), 1), - ) - }) - .collect() - } - - /// Injects a governance proposal script into transaction block. - pub fn inject_proposal_into_block( - &mut self, - block: &mut Vec, - proposal_idx: usize, - package_name: &str, - args: Vec, - ) { - let script_code = PROPOSAL_SCRIPTS - .get(package_name) - .expect("proposal script should be built"); - let sender = &self.core_resources; - let txn = self - .harness - .create_script(sender, script_code.clone(), vec![], args); - - debug_assert!(proposal_idx <= block.len()); - block.insert(proposal_idx, txn); - } - - /// Returns the total supply of AptosCoin in the universe. - pub fn read_total_supply(&self) -> u128 { - self.harness.executor.read_coin_supply().unwrap() - } -} - -/// For the given transaction outputs, calculates how much gas the block costs. -/// If there was a reconfiguration during the block execution, the cost is split -/// into before transaction triggering reconfiguration, and the cost of -/// transaction (governance proposal) triggering the reconfiguration. Note that -/// all outputs after reconfiguration should be Retry. -fn calculate_gas_used(outputs: Vec<(TransactionStatus, u64)>) -> (u64, u64) { - let mut found_reconfig = false; - let mut gas_used_for_reconfig = 0; - let mut total_gas_used = 0; - for (status, gas_used) in outputs { - total_gas_used += gas_used; - - if let TransactionStatus::Retry = status { - if !found_reconfig { - found_reconfig = true; - } - debug_assert!(gas_used == 0); - } else if !found_reconfig { - gas_used_for_reconfig = gas_used; - } - } - if !found_reconfig { - gas_used_for_reconfig = 0; - } - ( - total_gas_used - gas_used_for_reconfig, - gas_used_for_reconfig, - ) -} - -/// Tests a standard flow of collecting fees without any edge cases. -fn test_fee_collection_and_distribution_flow(burn_percentage: u8) { - let num_validators = 1; - let mut universe = TestUniverse::new(num_validators); - transaction_fee::initialize_fee_collection_and_distribution( - &mut universe.harness, - burn_percentage, - ); - universe - .harness - .enable_features(vec![FeatureFlag::COLLECT_AND_DISTRIBUTE_GAS_FEES], vec![]); - - let mut stake_amount = INITIAL_STAKE_AMOUNT; - universe.set_up_validators(stake_amount); - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - assert_eq!(rewards_per_epoch, 285); - - // Run a single block and record how much gas it costs. Since fee collection - // is enabled, this amount is stored in aggregatable coin. - let validator_addr = *universe.validators[0].address(); - let txns = universe.create_block(1000); - - let mut total_supply = universe.read_total_supply(); - let outputs = universe - .harness - .run_block_with_metadata(validator_addr, vec![], txns); - let (p2p_gas, proposal_gas) = calculate_gas_used(outputs); - assert_eq!(proposal_gas, 0); - - let burnt_amount = (burn_percentage as u64) * p2p_gas / 100; - let collected_amount = p2p_gas - burnt_amount; - - // Drain aggregatable coin in the next block. - universe - .harness - .new_block_with_metadata(validator_addr, vec![]); - total_supply -= burnt_amount as u128; - - // Check that the right fraction was burnt. - assert_eq!(universe.read_total_supply(), total_supply); - - // On the new epoch, the collected fees are processed and added to the stake - // pool. - universe.harness.new_epoch(); - stake_amount += rewards_per_epoch + collected_amount; - assert_eq!( - get_stake_pool(&universe.harness, &validator_addr).active, - stake_amount - ); -} - -/// Tests if fees collection can be enabled by the governance proposal and how -/// fees are collected on the block boundary. -fn test_initialize_and_enable_fee_collection_and_distribution(burn_percentage: u8) { - let num_validators = 1; - let mut universe = TestUniverse::new(num_validators); - - let mut stake_amount = INITIAL_STAKE_AMOUNT; - universe.set_up_validators(stake_amount); - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - assert_eq!(rewards_per_epoch, 285); - - // Create a block of transactions such that: - // 1. First 10 transactions are p2p. - // 2. A single transaction placing resources on chain. - // 3. Another 10 transactions are p2p. - // 4. A single transaction enabling fees collection. - // 5. Remaining transactions are p2p (should end up being Retry). - let mut txns = universe.create_block(50); - universe.inject_proposal_into_block(&mut txns, 10, "initialize_collection", vec![ - TransactionArgument::U8(burn_percentage), - ]); - universe.inject_proposal_into_block(&mut txns, 21, "enable_collection", vec![]); - - // Simulate block execution. - let mut total_supply = universe.read_total_supply(); - let validator_addr = *universe.validators[0].address(); - let outputs = universe - .harness - .run_block_with_metadata(validator_addr, vec![], txns); - let (gas_used, proposal_gas) = calculate_gas_used(outputs); - - // Reconfiguration triggers distributing rewards. - total_supply -= gas_used as u128; - total_supply += rewards_per_epoch as u128; - stake_amount += rewards_per_epoch; - assert_eq!(universe.read_total_supply(), total_supply); - assert_eq!( - get_stake_pool(&universe.harness, &validator_addr).active, - stake_amount - ); - - // In the previous block, the fee was only collected for the last script - // transaction which enabled the feature. In this block, we drain - // aggregatable coin and try to assign the fee to the validator. Since the - // proposer is not set (when feature flag was enabled), the fee is simply - // burnt and the stake pool should have the same value. - universe - .harness - .new_block_with_metadata(validator_addr, vec![]); - total_supply -= proposal_gas as u128; - assert_eq!(universe.read_total_supply(), total_supply); - assert_eq!( - get_stake_pool(&universe.harness, &validator_addr).active, - stake_amount - ); -} - -/// Tests fee collection can be safely disabled. The corner case here is that by disabling -/// the flag, we cannot distribute fees anymore unless it is done beforehand. -fn test_disable_fee_collection(burn_percentage: u8) { - let num_validators = 1; - let mut universe = TestUniverse::new(num_validators); - transaction_fee::initialize_fee_collection_and_distribution( - &mut universe.harness, - burn_percentage, - ); - universe - .harness - .enable_features(vec![FeatureFlag::COLLECT_AND_DISTRIBUTE_GAS_FEES], vec![]); - - let mut stake_amount = INITIAL_STAKE_AMOUNT; - universe.set_up_validators(stake_amount); - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - assert_eq!(rewards_per_epoch, 285); - - // Create a block of transactions such that: - // 1. First 10 transactions are p2p. - // 2. A single transaction disabling fees collection. - // 3. Remaining transactions are p2p (should end up being Retry). - let mut txns = universe.create_block(100); - universe.inject_proposal_into_block(&mut txns, 10, "disable_collection", vec![]); - let validator_addr = *universe.validators[0].address(); - - // Simulate block execution. - let mut total_supply = universe.read_total_supply(); - let outputs = universe - .harness - .run_block_with_metadata(validator_addr, vec![], txns); - let (p2p_gas, proposal_gas) = calculate_gas_used(outputs); - - // Calculate the fees taht are supposed to be collected before the feature - // is disabled. - let burnt_amount = (burn_percentage as u64) * p2p_gas / 100; - let collected_amount = p2p_gas - burnt_amount; - - // Reconfiguration triggers distribution of both rewards and fees. - stake_amount += rewards_per_epoch + collected_amount; - total_supply += rewards_per_epoch as u128; - total_supply -= burnt_amount as u128; - assert_eq!( - get_stake_pool(&universe.harness, &validator_addr).active, - stake_amount - ); - - // Gas for the proposal should be burnt together with the fraction of the - // fees. - universe - .harness - .new_block_with_metadata(validator_addr, vec![]); - total_supply -= proposal_gas as u128; - assert_eq!(universe.read_total_supply(), total_supply); -} - -/// Tests that the fees collected prior to the upgrade use the right burn -/// percentage for calculations. -fn test_upgrade_burn_percentage(burn_percentage: u8) { - let num_validators = 2; - let mut universe = TestUniverse::new(num_validators); - transaction_fee::initialize_fee_collection_and_distribution( - &mut universe.harness, - burn_percentage, - ); - universe - .harness - .enable_features(vec![FeatureFlag::COLLECT_AND_DISTRIBUTE_GAS_FEES], vec![]); - - let mut stake_amount = INITIAL_STAKE_AMOUNT; - universe.set_up_validators(stake_amount); - - // Upgrade to the opposite value. - let new_burn_percentage = 100 - burn_percentage; - - // Create a block of transactions such that: - // 1. First 10 transactions are p2p. - // 2. A single transaction upgrading the burn percentage. - // 3. Remaining transactions are p2p (should end up being Retry). - let mut txns = universe.create_block(100); - universe.inject_proposal_into_block(&mut txns, 10, "upgrade_burn_percentage", vec![ - TransactionArgument::U8(new_burn_percentage), - ]); - let validator_addr = *universe.validators[0].address(); - - // Simulate block execution. - let mut total_supply = universe.read_total_supply(); - let outputs = universe - .harness - .run_block_with_metadata(validator_addr, vec![], txns); - let (p2p_gas, proposal_gas) = calculate_gas_used(outputs); - - let burnt_amount = (burn_percentage as u64) * p2p_gas / 100; - let collected_amount = p2p_gas - burnt_amount; - - // Compute rewards for this epoch. - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - assert_eq!(rewards_per_epoch, 285); - - // Reconfiguration triggers distribution of rewards and fees. - stake_amount += rewards_per_epoch + collected_amount; - total_supply += rewards_per_epoch as u128; - total_supply -= burnt_amount as u128; - assert_eq!( - get_stake_pool(&universe.harness, &validator_addr).active, - stake_amount - ); - - // Gas for the proposal should be burnt together with fraction of fees. - universe - .harness - .new_block_with_metadata(validator_addr, vec![]); - total_supply -= proposal_gas as u128; - assert_eq!(universe.read_total_supply(), total_supply); - - // Now check that the new burn percentage works correctly. - let txns = universe.create_block(100); - total_supply = universe.read_total_supply(); - let outputs = universe - .harness - .run_block_with_metadata(validator_addr, vec![], txns); - let (gas_used, proposal_gas) = calculate_gas_used(outputs); - assert_eq!(proposal_gas, 0); - - let burnt_amount = (new_burn_percentage as u64) * gas_used / 100; - let collected_amount = gas_used - burnt_amount; - - // Check that the new fraction of fees is burnt. - universe - .harness - .new_block_with_metadata(validator_addr, vec![]); - total_supply -= burnt_amount as u128; - assert_eq!(universe.read_total_supply(), total_supply); - - // Check fees are distributed during the next epoch. Make sure to - // recalculate the rewards as well. - universe.harness.new_epoch(); - - // Compute rewards for this epoch. - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - stake_amount += rewards_per_epoch + collected_amount; - assert_eq!( - get_stake_pool(&universe.harness, &validator_addr).active, - stake_amount - ); -} - -/// Tests that if validator running the block is removed, it still receives -/// previously collected fees. -fn test_leaving_validator_is_rewarded(burn_percentage: u8) { - let num_validators = 2; - let mut universe = TestUniverse::new(num_validators); - transaction_fee::initialize_fee_collection_and_distribution( - &mut universe.harness, - burn_percentage, - ); - universe - .harness - .enable_features(vec![FeatureFlag::COLLECT_AND_DISTRIBUTE_GAS_FEES], vec![]); - - let mut stake_amount = INITIAL_STAKE_AMOUNT; - universe.set_up_validators(stake_amount); - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - assert_eq!(rewards_per_epoch, 285); - - // Create a block of transactions such that: - // 1. First 10 transactions are p2p. - // 2. A single transaction removing the validator. - // 3. Remaining transactions are p2p (should end up being Retry). - let removed_validator_addr = *universe.validators[0].address(); - let mut txns = universe.create_block(20); - universe.inject_proposal_into_block(&mut txns, 10, "remove_validator", vec![ - TransactionArgument::Address(removed_validator_addr), - ]); - - // Simulate block execution and calculate how much gas was used for - // transactions and for the governance proposal. - let mut total_supply = universe.read_total_supply(); - let outputs = universe - .harness - .run_block_with_metadata(removed_validator_addr, vec![], txns); - let (p2p_gas, proposal_gas) = calculate_gas_used(outputs); - - let burnt_amount = (burn_percentage as u64) * p2p_gas / 100; - let collected_amount = p2p_gas - burnt_amount; - - // Reconfiguration triggers distributing rewards and fees. - stake_amount += rewards_per_epoch + collected_amount; - total_supply += rewards_per_epoch as u128; - total_supply -= burnt_amount as u128; - assert_eq!( - get_stake_pool(&universe.harness, &removed_validator_addr).active, - stake_amount - ); - - let remaining_validator_addr = *universe.validators[1].address(); - universe - .harness - .new_block_with_metadata(remaining_validator_addr, vec![]); - total_supply -= proposal_gas as u128; - assert_eq!(universe.read_total_supply(), total_supply); -} - -#[test] -fn test_fee_collection_and_distribution_for_burn_percentages() { - // Test multiple burn percentages including the cases of 0 and 100. - for burn_percentage in [0, 50, 100] { - test_fee_collection_and_distribution_flow(burn_percentage); - test_initialize_and_enable_fee_collection_and_distribution(burn_percentage); - test_disable_fee_collection(burn_percentage); - test_upgrade_burn_percentage(burn_percentage); - test_leaving_validator_is_rewarded(burn_percentage); - } -} - -#[test] -/// Tests that fees for proposals are never leaked to the next block and are -/// always burnt. -fn test_block_single_proposal() { - let num_validators = 1; - let mut universe = TestUniverse::new(num_validators); - transaction_fee::initialize_fee_collection_and_distribution(&mut universe.harness, 100); - - let stake_amount = INITIAL_STAKE_AMOUNT; - universe.set_up_validators(stake_amount); - let rewards_per_epoch = stake_amount * REWARDS_RATE / REWARDS_RATE_DENOMINATOR; - assert_eq!(rewards_per_epoch, 285); - - // Create block with a single transaction: governance proposal to enable - // fee collection. This proposal ends the epoch. - let mut txns = vec![]; - universe.inject_proposal_into_block(&mut txns, 0, "enable_collection", vec![]); - let validator_addr = *universe.validators[0].address(); - - let mut total_supply = universe.read_total_supply(); - let outputs = universe - .harness - .run_block_with_metadata(validator_addr, vec![], txns); - let proposal_gas = outputs[1].1; - - // After reconfiguration rewards will be distributed. Because there are no - // other transactions, there is nothing to drain. However, this still should - // unset the proposer so that the next block burns the proposal fee. - total_supply += rewards_per_epoch as u128; - assert_eq!(universe.read_total_supply(), total_supply); - - // Ensure the fees are not leaked to the next block. This block must burn - // the proposal fee. - universe - .harness - .new_block_with_metadata(validator_addr, vec![]); - total_supply -= proposal_gas as u128; - assert_eq!(universe.read_total_supply(), total_supply); -} diff --git a/aptos-move/framework/aptos-framework/doc/aptos_governance.md b/aptos-move/framework/aptos-framework/doc/aptos_governance.md index 333da08e8e989..fb29b111816f7 100644 --- a/aptos-move/framework/aptos-framework/doc/aptos_governance.md +++ b/aptos-move/framework/aptos-framework/doc/aptos_governance.md @@ -2688,7 +2688,6 @@ Address @aptos_framework must exist ApprovedExecutionHashes and GovernancePropos account: aptos_framework }; include stake::GetReconfigStartTimeRequirement; -include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply; requires chain_status::is_operating(); requires exists<stake::ValidatorFees>(@aptos_framework); requires exists<CoinInfo<AptosCoin>>(@aptos_framework); @@ -2765,7 +2764,6 @@ Address @aptos_framework must exist GovernanceConfig and GovernanceEvents. account: aptos_framework }; include stake::GetReconfigStartTimeRequirement; -include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply; requires chain_status::is_operating(); requires exists<stake::ValidatorFees>(@aptos_framework); requires exists<CoinInfo<AptosCoin>>(@aptos_framework); diff --git a/aptos-move/framework/aptos-framework/doc/block.md b/aptos-move/framework/aptos-framework/doc/block.md index 6e25b59ea1d9c..f8c03b4e15d71 100644 --- a/aptos-move/framework/aptos-framework/doc/block.md +++ b/aptos-move/framework/aptos-framework/doc/block.md @@ -42,7 +42,6 @@ This module defines a struct storing the metadata of the block and new block eve
use 0x1::account;
 use 0x1::error;
 use 0x1::event;
-use 0x1::features;
 use 0x1::option;
 use 0x1::randomness;
 use 0x1::reconfiguration;
@@ -52,7 +51,6 @@ This module defines a struct storing the metadata of the block and new block eve
 use 0x1::system_addresses;
 use 0x1::table_with_length;
 use 0x1::timestamp;
-use 0x1::transaction_fee;
 
@@ -492,15 +490,6 @@ Return epoch interval in seconds. }; emit_new_block_event(vm, &mut block_metadata_ref.new_block_events, new_block_event); - if (features::collect_and_distribute_gas_fees()) { - // Assign the fees collected from the previous block to the previous block proposer. - // If for any reason the fees cannot be assigned, this function burns the collected coins. - transaction_fee::process_collected_fees(); - // Set the proposer of this block as the receiver of the fees, so that the fees for this - // block are assigned to the right account. - transaction_fee::register_proposer_for_fee_collection(proposer); - }; - // Performance scores have to be updated before the epoch transition as the transaction that triggers the // transition is the last block in the previous epoch. stake::update_performance_statistics(proposer_index, failed_proposer_indices); @@ -957,7 +946,6 @@ The number of new events created does not exceed MAX_U64. requires (proposer != @vm_reserved) ==> (timestamp::spec_now_microseconds() < timestamp); requires exists<stake::ValidatorFees>(@aptos_framework); requires exists<CoinInfo<AptosCoin>>(@aptos_framework); - include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply; include staking_config::StakingRewardsConfigRequirement; } diff --git a/aptos-move/framework/aptos-framework/doc/coin.md b/aptos-move/framework/aptos-framework/doc/coin.md index ba2b7fd254cd0..c5cc664c51e88 100644 --- a/aptos-move/framework/aptos-framework/doc/coin.md +++ b/aptos-move/framework/aptos-framework/doc/coin.md @@ -23,11 +23,6 @@ This module provides the foundation for typesafe Coins. - [Constants](#@Constants_0) - [Function `initialize_supply_config`](#0x1_coin_initialize_supply_config) - [Function `allow_supply_upgrades`](#0x1_coin_allow_supply_upgrades) -- [Function `initialize_aggregatable_coin`](#0x1_coin_initialize_aggregatable_coin) -- [Function `is_aggregatable_coin_zero`](#0x1_coin_is_aggregatable_coin_zero) -- [Function `drain_aggregatable_coin`](#0x1_coin_drain_aggregatable_coin) -- [Function `merge_aggregatable_coin`](#0x1_coin_merge_aggregatable_coin) -- [Function `collect_into_aggregatable_coin`](#0x1_coin_collect_into_aggregatable_coin) - [Function `coin_address`](#0x1_coin_coin_address) - [Function `balance`](#0x1_coin_balance) - [Function `is_coin_initialized`](#0x1_coin_is_coin_initialized) @@ -66,11 +61,6 @@ This module provides the foundation for typesafe Coins. - [Struct `AggregatableCoin`](#@Specification_1_AggregatableCoin) - [Function `initialize_supply_config`](#@Specification_1_initialize_supply_config) - [Function `allow_supply_upgrades`](#@Specification_1_allow_supply_upgrades) - - [Function `initialize_aggregatable_coin`](#@Specification_1_initialize_aggregatable_coin) - - [Function `is_aggregatable_coin_zero`](#@Specification_1_is_aggregatable_coin_zero) - - [Function `drain_aggregatable_coin`](#@Specification_1_drain_aggregatable_coin) - - [Function `merge_aggregatable_coin`](#@Specification_1_merge_aggregatable_coin) - - [Function `collect_into_aggregatable_coin`](#@Specification_1_collect_into_aggregatable_coin) - [Function `coin_address`](#@Specification_1_coin_address) - [Function `balance`](#@Specification_1_balance) - [Function `is_coin_initialized`](#@Specification_1_is_coin_initialized) @@ -101,7 +91,6 @@ This module provides the foundation for typesafe Coins.
use 0x1::account;
 use 0x1::aggregator;
-use 0x1::aggregator_factory;
 use 0x1::error;
 use 0x1::event;
 use 0x1::option;
@@ -147,12 +136,11 @@ Main structure representing a coin/token in an account's custody.
 
 ## Struct `AggregatableCoin`
 
-Represents a coin with aggregator as its value. This allows to update
-the coin in every transaction avoiding read-modify-write conflicts. Only
-used for gas fees distribution by Aptos Framework (0x1).
+DEPRECATED
 
 
-
struct AggregatableCoin<CoinType> has store
+
#[deprecated]
+struct AggregatableCoin<CoinType> has store
 
@@ -785,173 +773,6 @@ or disallow upgradability of total supply. - - - - -## Function `initialize_aggregatable_coin` - -Creates a new aggregatable coin with value overflowing on limit. Note that this function can -only be called by Aptos Framework (0x1) account for now because of create_aggregator. - - -
public(friend) fun initialize_aggregatable_coin<CoinType>(aptos_framework: &signer): coin::AggregatableCoin<CoinType>
-
- - - -
-Implementation - - -
public(friend) fun initialize_aggregatable_coin<CoinType>(aptos_framework: &signer): AggregatableCoin<CoinType> {
-    let aggregator = aggregator_factory::create_aggregator(aptos_framework, MAX_U64);
-    AggregatableCoin<CoinType> {
-        value: aggregator,
-    }
-}
-
- - - -
- - - -## Function `is_aggregatable_coin_zero` - -Returns true if the value of aggregatable coin is zero. - - -
public(friend) fun is_aggregatable_coin_zero<CoinType>(coin: &coin::AggregatableCoin<CoinType>): bool
-
- - - -
-Implementation - - -
public(friend) fun is_aggregatable_coin_zero<CoinType>(coin: &AggregatableCoin<CoinType>): bool {
-    let amount = aggregator::read(&coin.value);
-    amount == 0
-}
-
- - - -
- - - -## Function `drain_aggregatable_coin` - -Drains the aggregatable coin, setting it to zero and returning a standard coin. - - -
public(friend) fun drain_aggregatable_coin<CoinType>(coin: &mut coin::AggregatableCoin<CoinType>): coin::Coin<CoinType>
-
- - - -
-Implementation - - -
public(friend) fun drain_aggregatable_coin<CoinType>(coin: &mut AggregatableCoin<CoinType>): Coin<CoinType> {
-    spec {
-        // TODO: The data invariant is not properly assumed from CollectedFeesPerBlock.
-        assume aggregator::spec_get_limit(coin.value) == MAX_U64;
-    };
-    let amount = aggregator::read(&coin.value);
-    assert!(amount <= MAX_U64, error::out_of_range(EAGGREGATABLE_COIN_VALUE_TOO_LARGE));
-    spec {
-        update aggregate_supply<CoinType> = aggregate_supply<CoinType> - amount;
-    };
-    aggregator::sub(&mut coin.value, amount);
-    spec {
-        update supply<CoinType> = supply<CoinType> + amount;
-    };
-    Coin<CoinType> {
-        value: (amount as u64),
-    }
-}
-
- - - -
- - - -## Function `merge_aggregatable_coin` - -Merges coin into aggregatable coin (dst_coin). - - -
public(friend) fun merge_aggregatable_coin<CoinType>(dst_coin: &mut coin::AggregatableCoin<CoinType>, coin: coin::Coin<CoinType>)
-
- - - -
-Implementation - - -
public(friend) fun merge_aggregatable_coin<CoinType>(
-    dst_coin: &mut AggregatableCoin<CoinType>,
-    coin: Coin<CoinType>
-) {
-    spec {
-        update supply<CoinType> = supply<CoinType> - coin.value;
-    };
-    let Coin { value } = coin;
-    let amount = (value as u128);
-    spec {
-        update aggregate_supply<CoinType> = aggregate_supply<CoinType> + amount;
-    };
-    aggregator::add(&mut dst_coin.value, amount);
-}
-
- - - -
- - - -## Function `collect_into_aggregatable_coin` - -Collects a specified amount of coin form an account into aggregatable coin. - - -
public(friend) fun collect_into_aggregatable_coin<CoinType>(account_addr: address, amount: u64, dst_coin: &mut coin::AggregatableCoin<CoinType>)
-
- - - -
-Implementation - - -
public(friend) fun collect_into_aggregatable_coin<CoinType>(
-    account_addr: address,
-    amount: u64,
-    dst_coin: &mut AggregatableCoin<CoinType>,
-) acquires CoinStore {
-    // Skip collecting if amount is zero.
-    if (amount == 0) {
-        return
-    };
-
-    let coin_store = borrow_global_mut<CoinStore<CoinType>>(account_addr);
-    let coin = extract(&mut coin_store.coin, amount);
-    merge_aggregatable_coin(dst_coin, coin);
-}
-
- - -
@@ -2191,7 +2012,8 @@ Destroy a burn capability. ### Struct `AggregatableCoin` -
struct AggregatableCoin<CoinType> has store
+
#[deprecated]
+struct AggregatableCoin<CoinType> has store
 
@@ -2256,106 +2078,6 @@ Can only be updated by @aptos_framework. - - -### Function `initialize_aggregatable_coin` - - -
public(friend) fun initialize_aggregatable_coin<CoinType>(aptos_framework: &signer): coin::AggregatableCoin<CoinType>
-
- - - - -
include system_addresses::AbortsIfNotAptosFramework{account: aptos_framework};
-include aggregator_factory::CreateAggregatorInternalAbortsIf;
-
- - - - - -### Function `is_aggregatable_coin_zero` - - -
public(friend) fun is_aggregatable_coin_zero<CoinType>(coin: &coin::AggregatableCoin<CoinType>): bool
-
- - - - -
aborts_if false;
-ensures result == (aggregator::spec_read(coin.value) == 0);
-
- - - - - -### Function `drain_aggregatable_coin` - - -
public(friend) fun drain_aggregatable_coin<CoinType>(coin: &mut coin::AggregatableCoin<CoinType>): coin::Coin<CoinType>
-
- - - - -
aborts_if aggregator::spec_read(coin.value) > MAX_U64;
-ensures result.value == aggregator::spec_aggregator_get_val(old(coin).value);
-
- - - - - -### Function `merge_aggregatable_coin` - - -
public(friend) fun merge_aggregatable_coin<CoinType>(dst_coin: &mut coin::AggregatableCoin<CoinType>, coin: coin::Coin<CoinType>)
-
- - - - -
let aggr = dst_coin.value;
-let post p_aggr = dst_coin.value;
-aborts_if aggregator::spec_aggregator_get_val(aggr)
-    + coin.value > aggregator::spec_get_limit(aggr);
-aborts_if aggregator::spec_aggregator_get_val(aggr)
-    + coin.value > MAX_U128;
-ensures aggregator::spec_aggregator_get_val(aggr)+ coin.value == aggregator::spec_aggregator_get_val(p_aggr);
-
- - - - - -### Function `collect_into_aggregatable_coin` - - -
public(friend) fun collect_into_aggregatable_coin<CoinType>(account_addr: address, amount: u64, dst_coin: &mut coin::AggregatableCoin<CoinType>)
-
- - - - -
let aggr = dst_coin.value;
-let post p_aggr = dst_coin.value;
-let coin_store = global<CoinStore<CoinType>>(account_addr);
-let post p_coin_store = global<CoinStore<CoinType>>(account_addr);
-aborts_if amount > 0 && !exists<CoinStore<CoinType>>(account_addr);
-aborts_if amount > 0 && coin_store.coin.value < amount;
-aborts_if amount > 0 && aggregator::spec_aggregator_get_val(aggr)
-    + amount > aggregator::spec_get_limit(aggr);
-aborts_if amount > 0 && aggregator::spec_aggregator_get_val(aggr)
-    + amount > MAX_U128;
-ensures aggregator::spec_aggregator_get_val(aggr)+ amount == aggregator::spec_aggregator_get_val(p_aggr);
-ensures coin_store.coin.value - amount == p_coin_store.coin.value;
-
- - - ### Function `coin_address` diff --git a/aptos-move/framework/aptos-framework/doc/consensus_config.md b/aptos-move/framework/aptos-framework/doc/consensus_config.md index c7cf016d6217d..5bbd7f03db991 100644 --- a/aptos-move/framework/aptos-framework/doc/consensus_config.md +++ b/aptos-move/framework/aptos-framework/doc/consensus_config.md @@ -342,7 +342,6 @@ When setting now time must be later than last_reconfiguration_time.
pragma verify_duration_estimate = 600;
-include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
 include staking_config::StakingRewardsConfigRequirement;
 let addr = signer::address_of(account);
 // This enforces high-level requirement 2:
diff --git a/aptos-move/framework/aptos-framework/doc/execution_config.md b/aptos-move/framework/aptos-framework/doc/execution_config.md
index 1d5e757cba621..3a37328b2a473 100644
--- a/aptos-move/framework/aptos-framework/doc/execution_config.md
+++ b/aptos-move/framework/aptos-framework/doc/execution_config.md
@@ -197,7 +197,6 @@ When setting now time must be later than last_reconfiguration_time.
 
 
pragma verify_duration_estimate = 600;
 let addr = signer::address_of(account);
-include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
 requires chain_status::is_genesis();
 requires exists<stake::ValidatorFees>(@aptos_framework);
 requires exists<staking_config::StakingRewardsConfig>(@aptos_framework);
diff --git a/aptos-move/framework/aptos-framework/doc/gas_schedule.md b/aptos-move/framework/aptos-framework/doc/gas_schedule.md
index 395cc2f0fd92d..323079434e561 100644
--- a/aptos-move/framework/aptos-framework/doc/gas_schedule.md
+++ b/aptos-move/framework/aptos-framework/doc/gas_schedule.md
@@ -462,7 +462,6 @@ Only used in reconfigurations to apply the pending stake::ValidatorFees>(@aptos_framework);
 requires exists<CoinInfo<AptosCoin>>(@aptos_framework);
 requires chain_status::is_genesis();
-include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
 include staking_config::StakingRewardsConfigRequirement;
 // This enforces high-level requirement 2:
 include system_addresses::AbortsIfNotAptosFramework{ account: aptos_framework };
@@ -532,7 +531,6 @@ Only used in reconfigurations to apply the pending stake::ValidatorFees>(@aptos_framework);
 requires exists<CoinInfo<AptosCoin>>(@aptos_framework);
 include system_addresses::AbortsIfNotAptosFramework{ account: aptos_framework };
-include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
 include staking_config::StakingRewardsConfigRequirement;
 aborts_if !exists<StorageGasConfig>(@aptos_framework);
 ensures global<StorageGasConfig>(@aptos_framework) == config;
diff --git a/aptos-move/framework/aptos-framework/doc/genesis.md b/aptos-move/framework/aptos-framework/doc/genesis.md
index e8311ec9ab142..f217370b7ec9e 100644
--- a/aptos-move/framework/aptos-framework/doc/genesis.md
+++ b/aptos-move/framework/aptos-framework/doc/genesis.md
@@ -1129,10 +1129,8 @@ The last step of genesis.
     requires chain_status::is_operating();
     requires len(execution_config) > 0;
     requires exists<staking_config::StakingRewardsConfig>(@aptos_framework);
-    requires exists<stake::ValidatorFees>(@aptos_framework);
     requires exists<coin::CoinInfo<AptosCoin>>(@aptos_framework);
     include CompareTimeRequires;
-    include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
 }
 
diff --git a/aptos-move/framework/aptos-framework/doc/reconfiguration.md b/aptos-move/framework/aptos-framework/doc/reconfiguration.md index 8bc6fe963b08b..8cc3493014ac0 100644 --- a/aptos-move/framework/aptos-framework/doc/reconfiguration.md +++ b/aptos-move/framework/aptos-framework/doc/reconfiguration.md @@ -36,14 +36,12 @@ to synchronize configuration changes for the validators. use 0x1::chain_status; use 0x1::error; use 0x1::event; -use 0x1::features; use 0x1::reconfiguration_state; use 0x1::signer; use 0x1::stake; use 0x1::storage_gas; use 0x1::system_addresses; use 0x1::timestamp; -use 0x1::transaction_fee;
@@ -363,20 +361,6 @@ Signal validators to start using new configuration. Must be called from friend c reconfiguration_state::on_reconfig_start(); - // Reconfiguration "forces the block" to end, as mentioned above. Therefore, we must process the collected fees - // explicitly so that staking can distribute them. - // - // This also handles the case when a validator is removed due to the governance proposal. In particular, removing - // the validator causes a reconfiguration. We explicitly process fees, i.e. we drain aggregatable coin and populate - // the fees table, prior to calling `on_new_epoch()`. That call, in turn, distributes transaction fees for all active - // and pending_inactive validators, which include any validator that is to be removed. - if (features::collect_and_distribute_gas_fees()) { - // All transactions after reconfiguration are Retry. Therefore, when the next - // block starts and tries to assign/burn collected fees it will be just 0 and - // nothing will be assigned. - transaction_fee::process_collected_fees(); - }; - // Call stake to compute the new validator set and distribute rewards and transaction fees. stake::on_new_epoch(); storage_gas::on_reconfig(); @@ -684,7 +668,6 @@ Make sure the caller is admin and check the resource DisableReconfiguration. && timestamp::spec_now_microseconds() != global<Configuration>(@aptos_framework).last_reconfiguration_time; include features::spec_periodical_reward_rate_decrease_enabled() ==> staking_config::StakingRewardsConfigEnabledRequirement; include success ==> aptos_coin::ExistsAptosCoin; -include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply; aborts_if false; ensures success ==> global<Configuration>(@aptos_framework).epoch == old(global<Configuration>(@aptos_framework).epoch) + 1; ensures success ==> global<Configuration>(@aptos_framework).last_reconfiguration_time == timestamp::spec_now_microseconds(); diff --git a/aptos-move/framework/aptos-framework/doc/reconfiguration_with_dkg.md b/aptos-move/framework/aptos-framework/doc/reconfiguration_with_dkg.md index 926cebbbedc70..0d4a5e520a9ee 100644 --- a/aptos-move/framework/aptos-framework/doc/reconfiguration_with_dkg.md +++ b/aptos-move/framework/aptos-framework/doc/reconfiguration_with_dkg.md @@ -200,7 +200,6 @@ Abort if no DKG is in progress. requires exists<CoinInfo<AptosCoin>>(@aptos_framework); include staking_config::StakingRewardsConfigRequirement; requires exists<stake::ValidatorFees>(@aptos_framework); - include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply; requires exists<features::Features>(@std); include config_buffer::OnNewEpochRequirement<version::Version>; include config_buffer::OnNewEpochRequirement<gas_schedule::GasScheduleV2>; diff --git a/aptos-move/framework/aptos-framework/doc/stake.md b/aptos-move/framework/aptos-framework/doc/stake.md index 9771f7d823785..5b3a83099dabe 100644 --- a/aptos-move/framework/aptos-framework/doc/stake.md +++ b/aptos-move/framework/aptos-framework/doc/stake.md @@ -3134,7 +3134,7 @@ power. Implementation -
public(friend) fun on_new_epoch() acquires StakePool, AptosCoinCapabilities, ValidatorConfig, ValidatorPerformance, ValidatorSet, ValidatorFees {
+
public(friend) fun on_new_epoch() acquires StakePool, AptosCoinCapabilities, ValidatorConfig, ValidatorPerformance, ValidatorSet {
     let validator_set = borrow_global_mut<ValidatorSet>(@aptos_framework);
     let config = staking_config::get();
     let validator_perf = borrow_global_mut<ValidatorPerformance>(@aptos_framework);
@@ -3295,7 +3295,7 @@ Return the ValidatorConsensusInfo of each current validator, sorted
 Implementation
 
 
-
public fun next_validator_consensus_infos(): vector<ValidatorConsensusInfo> acquires ValidatorSet, ValidatorPerformance, StakePool, ValidatorFees, ValidatorConfig {
+
public fun next_validator_consensus_infos(): vector<ValidatorConsensusInfo> acquires ValidatorSet, ValidatorPerformance, StakePool, ValidatorConfig {
     // Init.
     let cur_validator_set = borrow_global<ValidatorSet>(@aptos_framework);
     let staking_config = staking_config::get();
@@ -3351,14 +3351,6 @@ Return the ValidatorConsensusInfo of each current validator, sorted
         };
 
         let cur_fee = 0;
-        if (features::collect_and_distribute_gas_fees()) {
-            let fees_table = &borrow_global<ValidatorFees>(@aptos_framework).fees_table;
-            if (table::contains(fees_table, candidate.addr)) {
-                let fee_coin = table::borrow(fees_table, candidate.addr);
-                cur_fee = coin::value(fee_coin);
-            }
-        };
-
         let lockup_expired = get_reconfig_start_time_secs() >= stake_pool.locked_until_secs;
         spec {
             assume cur_active + cur_pending_active + cur_reward + cur_fee <= MAX_U64;
@@ -3547,7 +3539,7 @@ This function shouldn't abort.
     validator_perf: &ValidatorPerformance,
     pool_address: address,
     staking_config: &StakingConfig,
-) acquires StakePool, AptosCoinCapabilities, ValidatorConfig, ValidatorFees {
+) acquires StakePool, AptosCoinCapabilities, ValidatorConfig {
     let stake_pool = borrow_global_mut<StakePool>(pool_address);
     let validator_config = borrow_global<ValidatorConfig>(pool_address);
     let cur_validator_perf = vector::borrow(&validator_perf.validators, validator_config.validator_index);
@@ -3580,15 +3572,6 @@ This function shouldn't abort.
     // Pending active stake can now be active.
     coin::merge(&mut stake_pool.active, coin::extract_all(&mut stake_pool.pending_active));
 
-    // Additionally, distribute transaction fees.
-    if (features::collect_and_distribute_gas_fees()) {
-        let fees_table = &mut borrow_global_mut<ValidatorFees>(@aptos_framework).fees_table;
-        if (table::contains(fees_table, pool_address)) {
-            let coin = table::remove(fees_table, pool_address);
-            coin::merge(&mut stake_pool.active, coin);
-        };
-    };
-
     // Pending inactive stake is only fully unlocked and moved into inactive if the current lockup cycle has expired
     let current_lockup_expiration = stake_pool.locked_until_secs;
     if (get_reconfig_start_time_secs() >= current_lockup_expiration) {
@@ -5260,12 +5243,7 @@ Returns validator's next epoch voting power, including pending_active, active, a
 let post post_fees_table = global<ValidatorFees>(@aptos_framework).fees_table;
 let post post_inactive_value = post_stake_pool.inactive.value;
 ensures post_stake_pool.pending_active.value == 0;
-ensures if (features::spec_is_enabled(features::COLLECT_AND_DISTRIBUTE_GAS_FEES) && table::spec_contains(fees_table, pool_address)) {
-    !table::spec_contains(post_fees_table, pool_address) &&
-    post_active_value == stake_pool.active.value + rewards_amount_1 + stake_pool.pending_active.value + table::spec_get(fees_table, pool_address).value
-} else {
-    post_active_value == stake_pool.active.value + rewards_amount_1 + stake_pool.pending_active.value
-};
+ensures post_active_value == stake_pool.active.value + rewards_amount_1 + stake_pool.pending_active.value;
 ensures if (spec_get_reconfig_start_time_secs() >= stake_pool.locked_until_secs) {
     post_pending_inactive_value == 0 &&
     post_inactive_value == stake_pool.inactive.value + stake_pool.pending_inactive.value + rewards_amount_2
diff --git a/aptos-move/framework/aptos-framework/doc/transaction_fee.md b/aptos-move/framework/aptos-framework/doc/transaction_fee.md
index 8138d13a5c697..7a38704391930 100644
--- a/aptos-move/framework/aptos-framework/doc/transaction_fee.md
+++ b/aptos-move/framework/aptos-framework/doc/transaction_fee.md
@@ -12,14 +12,9 @@ This module provides an interface to burn or collect and redistribute transactio
 -  [Struct `FeeStatement`](#0x1_transaction_fee_FeeStatement)
 -  [Constants](#@Constants_0)
 -  [Function `initialize_fee_collection_and_distribution`](#0x1_transaction_fee_initialize_fee_collection_and_distribution)
--  [Function `is_fees_collection_enabled`](#0x1_transaction_fee_is_fees_collection_enabled)
 -  [Function `upgrade_burn_percentage`](#0x1_transaction_fee_upgrade_burn_percentage)
--  [Function `register_proposer_for_fee_collection`](#0x1_transaction_fee_register_proposer_for_fee_collection)
--  [Function `burn_coin_fraction`](#0x1_transaction_fee_burn_coin_fraction)
--  [Function `process_collected_fees`](#0x1_transaction_fee_process_collected_fees)
 -  [Function `burn_fee`](#0x1_transaction_fee_burn_fee)
 -  [Function `mint_and_refund`](#0x1_transaction_fee_mint_and_refund)
--  [Function `collect_fee`](#0x1_transaction_fee_collect_fee)
 -  [Function `store_aptos_coin_burn_cap`](#0x1_transaction_fee_store_aptos_coin_burn_cap)
 -  [Function `store_aptos_coin_mint_cap`](#0x1_transaction_fee_store_aptos_coin_mint_cap)
 -  [Function `initialize_storage_refund`](#0x1_transaction_fee_initialize_storage_refund)
@@ -29,13 +24,8 @@ This module provides an interface to burn or collect and redistribute transactio
     -  [Module-level Specification](#module-level-spec)
     -  [Resource `CollectedFeesPerBlock`](#@Specification_1_CollectedFeesPerBlock)
     -  [Function `initialize_fee_collection_and_distribution`](#@Specification_1_initialize_fee_collection_and_distribution)
-    -  [Function `upgrade_burn_percentage`](#@Specification_1_upgrade_burn_percentage)
-    -  [Function `register_proposer_for_fee_collection`](#@Specification_1_register_proposer_for_fee_collection)
-    -  [Function `burn_coin_fraction`](#@Specification_1_burn_coin_fraction)
-    -  [Function `process_collected_fees`](#@Specification_1_process_collected_fees)
     -  [Function `burn_fee`](#@Specification_1_burn_fee)
     -  [Function `mint_and_refund`](#@Specification_1_mint_and_refund)
-    -  [Function `collect_fee`](#@Specification_1_collect_fee)
     -  [Function `store_aptos_coin_burn_cap`](#@Specification_1_store_aptos_coin_burn_cap)
     -  [Function `store_aptos_coin_mint_cap`](#@Specification_1_store_aptos_coin_mint_cap)
     -  [Function `initialize_storage_refund`](#@Specification_1_initialize_storage_refund)
@@ -47,7 +37,6 @@ This module provides an interface to burn or collect and redistribute transactio
 use 0x1::error;
 use 0x1::event;
 use 0x1::option;
-use 0x1::stake;
 use 0x1::system_addresses;
 
@@ -282,40 +271,7 @@ distribution. Should be called by on-chain governance. ); assert!(burn_percentage <= 100, error::out_of_range(EINVALID_BURN_PERCENTAGE)); - // Make sure stakng module is aware of transaction fees collection. - stake::initialize_validator_fees(aptos_framework); - - // Initially, no fees are collected and the block proposer is not set. - let collected_fees = CollectedFeesPerBlock { - amount: coin::initialize_aggregatable_coin(aptos_framework), - proposer: option::none(), - burn_percentage, - }; - move_to(aptos_framework, collected_fees); -} -
- - - - - - - -## Function `is_fees_collection_enabled` - - - -
fun is_fees_collection_enabled(): bool
-
- - - -
-Implementation - - -
fun is_fees_collection_enabled(): bool {
-    exists<CollectedFeesPerBlock>(@aptos_framework)
+    abort error::not_implemented(ENO_LONGER_SUPPORTED)
 }
 
@@ -342,156 +298,11 @@ Sets the burn percentage for collected fees to a new value. Should be called by
public fun upgrade_burn_percentage(
     aptos_framework: &signer,
     new_burn_percentage: u8
-) acquires AptosCoinCapabilities, CollectedFeesPerBlock {
+) {
     system_addresses::assert_aptos_framework(aptos_framework);
     assert!(new_burn_percentage <= 100, error::out_of_range(EINVALID_BURN_PERCENTAGE));
 
-    // Prior to upgrading the burn percentage, make sure to process collected
-    // fees. Otherwise we would use the new (incorrect) burn_percentage when
-    // processing fees later!
-    process_collected_fees();
-
-    if (is_fees_collection_enabled()) {
-        // Upgrade has no effect unless fees are being collected.
-        let burn_percentage = &mut borrow_global_mut<CollectedFeesPerBlock>(@aptos_framework).burn_percentage;
-        *burn_percentage = new_burn_percentage
-    }
-}
-
- - - -
- - - -## Function `register_proposer_for_fee_collection` - -Registers the proposer of the block for gas fees collection. This function -can only be called at the beginning of the block. - - -
public(friend) fun register_proposer_for_fee_collection(proposer_addr: address)
-
- - - -
-Implementation - - -
public(friend) fun register_proposer_for_fee_collection(proposer_addr: address) acquires CollectedFeesPerBlock {
-    if (is_fees_collection_enabled()) {
-        let collected_fees = borrow_global_mut<CollectedFeesPerBlock>(@aptos_framework);
-        let _ = option::swap_or_fill(&mut collected_fees.proposer, proposer_addr);
-    }
-}
-
- - - -
- - - -## Function `burn_coin_fraction` - -Burns a specified fraction of the coin. - - -
fun burn_coin_fraction(coin: &mut coin::Coin<aptos_coin::AptosCoin>, burn_percentage: u8)
-
- - - -
-Implementation - - -
fun burn_coin_fraction(coin: &mut Coin<AptosCoin>, burn_percentage: u8) acquires AptosCoinCapabilities {
-    assert!(burn_percentage <= 100, error::out_of_range(EINVALID_BURN_PERCENTAGE));
-
-    let collected_amount = coin::value(coin);
-    spec {
-        // We assume that `burn_percentage * collected_amount` does not overflow.
-        assume burn_percentage * collected_amount <= MAX_U64;
-    };
-    let amount_to_burn = (burn_percentage as u64) * collected_amount / 100;
-    if (amount_to_burn > 0) {
-        let coin_to_burn = coin::extract(coin, amount_to_burn);
-        coin::burn(
-            coin_to_burn,
-            &borrow_global<AptosCoinCapabilities>(@aptos_framework).burn_cap,
-        );
-    }
-}
-
- - - -
- - - -## Function `process_collected_fees` - -Calculates the fee which should be distributed to the block proposer at the -end of an epoch, and records it in the system. This function can only be called -at the beginning of the block or during reconfiguration. - - -
public(friend) fun process_collected_fees()
-
- - - -
-Implementation - - -
public(friend) fun process_collected_fees() acquires AptosCoinCapabilities, CollectedFeesPerBlock {
-    if (!is_fees_collection_enabled()) {
-        return
-    };
-    let collected_fees = borrow_global_mut<CollectedFeesPerBlock>(@aptos_framework);
-
-    // If there are no collected fees, only unset the proposer. See the rationale for
-    // setting proposer to option::none() below.
-    if (coin::is_aggregatable_coin_zero(&collected_fees.amount)) {
-        if (option::is_some(&collected_fees.proposer)) {
-            let _ = option::extract(&mut collected_fees.proposer);
-        };
-        return
-    };
-
-    // Otherwise get the collected fee, and check if it can distributed later.
-    let coin = coin::drain_aggregatable_coin(&mut collected_fees.amount);
-    if (option::is_some(&collected_fees.proposer)) {
-        // Extract the address of proposer here and reset it to option::none(). This
-        // is particularly useful to avoid any undesired side-effects where coins are
-        // collected but never distributed or distributed to the wrong account.
-        // With this design, processing collected fees enforces that all fees will be burnt
-        // unless the proposer is specified in the block prologue. When we have a governance
-        // proposal that triggers reconfiguration, we distribute pending fees and burn the
-        // fee for the proposal. Otherwise, that fee would be leaked to the next block.
-        let proposer = option::extract(&mut collected_fees.proposer);
-
-        // Since the block can be produced by the VM itself, we have to make sure we catch
-        // this case.
-        if (proposer == @vm_reserved) {
-            burn_coin_fraction(&mut coin, 100);
-            coin::destroy_zero(coin);
-            return
-        };
-
-        burn_coin_fraction(&mut coin, collected_fees.burn_percentage);
-        stake::add_transaction_fee(proposer, coin);
-        return
-    };
-
-    // If checks did not pass, simply burn all collected coins and return none.
-    burn_coin_fraction(&mut coin, 100);
-    coin::destroy_zero(coin)
+    abort error::not_implemented(ENO_LONGER_SUPPORTED)
 }
 
@@ -553,37 +364,6 @@ Mint refund in epilogue. -
- - - -## Function `collect_fee` - -Collect transaction fees in epilogue. - - -
public(friend) fun collect_fee(account: address, fee: u64)
-
- - - -
-Implementation - - -
public(friend) fun collect_fee(account: address, fee: u64) acquires CollectedFeesPerBlock {
-    let collected_fees = borrow_global_mut<CollectedFeesPerBlock>(@aptos_framework);
-
-    // Here, we are always optimistic and always collect fees. If the proposer is not set,
-    // or we cannot redistribute fees later for some reason (e.g. account cannot receive AptoCoin)
-    // we burn them all at once. This way we avoid having a check for every transaction epilogue.
-    let collected_amount = &mut collected_fees.amount;
-    coin::collect_into_aggregatable_coin<AptosCoin>(account, fee, collected_amount);
-}
-
- - -
@@ -835,151 +615,6 @@ Only called during genesis. - - -### Function `upgrade_burn_percentage` - - -
public fun upgrade_burn_percentage(aptos_framework: &signer, new_burn_percentage: u8)
-
- - - - -
aborts_if new_burn_percentage > 100;
-let aptos_addr = signer::address_of(aptos_framework);
-aborts_if !system_addresses::is_aptos_framework_address(aptos_addr);
-// This enforces high-level requirement 5 and high-level requirement 6:
-include ProcessCollectedFeesRequiresAndEnsures;
-ensures exists<CollectedFeesPerBlock>(@aptos_framework) ==>
-    global<CollectedFeesPerBlock>(@aptos_framework).burn_percentage == new_burn_percentage;
-
- - - - - -### Function `register_proposer_for_fee_collection` - - -
public(friend) fun register_proposer_for_fee_collection(proposer_addr: address)
-
- - - - -
aborts_if false;
-// This enforces high-level requirement 6:
-ensures is_fees_collection_enabled() ==>
-    option::spec_borrow(global<CollectedFeesPerBlock>(@aptos_framework).proposer) == proposer_addr;
-
- - - - - -### Function `burn_coin_fraction` - - -
fun burn_coin_fraction(coin: &mut coin::Coin<aptos_coin::AptosCoin>, burn_percentage: u8)
-
- - - - -
requires burn_percentage <= 100;
-requires exists<AptosCoinCapabilities>(@aptos_framework);
-requires exists<CoinInfo<AptosCoin>>(@aptos_framework);
-let amount_to_burn = (burn_percentage * coin::value(coin)) / 100;
-include amount_to_burn > 0 ==> coin::CoinSubAbortsIf<AptosCoin> { amount: amount_to_burn };
-ensures coin.value == old(coin).value - amount_to_burn;
-
- - - - - - - -
fun collectedFeesAggregator(): AggregatableCoin<AptosCoin> {
-   global<CollectedFeesPerBlock>(@aptos_framework).amount
-}
-
- - - - - - - -
schema RequiresCollectedFeesPerValueLeqBlockAptosSupply {
-    let maybe_supply = coin::get_coin_supply_opt<AptosCoin>();
-    requires
-        (is_fees_collection_enabled() && option::is_some(maybe_supply)) ==>
-            (aggregator::spec_aggregator_get_val(global<CollectedFeesPerBlock>(@aptos_framework).amount.value) <=
-                optional_aggregator::optional_aggregator_value(
-                    option::spec_borrow(coin::get_coin_supply_opt<AptosCoin>())
-                ));
-}
-
- - - - - - - -
schema ProcessCollectedFeesRequiresAndEnsures {
-    requires exists<AptosCoinCapabilities>(@aptos_framework);
-    requires exists<stake::ValidatorFees>(@aptos_framework);
-    requires exists<CoinInfo<AptosCoin>>(@aptos_framework);
-    include RequiresCollectedFeesPerValueLeqBlockAptosSupply;
-    aborts_if false;
-    let collected_fees = global<CollectedFeesPerBlock>(@aptos_framework);
-    let post post_collected_fees = global<CollectedFeesPerBlock>(@aptos_framework);
-    let pre_amount = aggregator::spec_aggregator_get_val(collected_fees.amount.value);
-    let post post_amount = aggregator::spec_aggregator_get_val(post_collected_fees.amount.value);
-    let fees_table = global<stake::ValidatorFees>(@aptos_framework).fees_table;
-    let post post_fees_table = global<stake::ValidatorFees>(@aptos_framework).fees_table;
-    let proposer = option::spec_borrow(collected_fees.proposer);
-    let fee_to_add = pre_amount - pre_amount * collected_fees.burn_percentage / 100;
-    ensures is_fees_collection_enabled() ==> option::spec_is_none(post_collected_fees.proposer) && post_amount == 0;
-    ensures is_fees_collection_enabled() && aggregator::spec_read(collected_fees.amount.value) > 0 &&
-        option::spec_is_some(collected_fees.proposer) ==>
-        if (proposer != @vm_reserved) {
-            if (table::spec_contains(fees_table, proposer)) {
-                table::spec_get(post_fees_table, proposer).value == table::spec_get(
-                    fees_table,
-                    proposer
-                ).value + fee_to_add
-            } else {
-                table::spec_get(post_fees_table, proposer).value == fee_to_add
-            }
-        } else {
-            option::spec_is_none(post_collected_fees.proposer) && post_amount == 0
-        };
-}
-
- - - - - -### Function `process_collected_fees` - - -
public(friend) fun process_collected_fees()
-
- - - - -
// This enforces high-level requirement 6:
-include ProcessCollectedFeesRequiresAndEnsures;
-
- - - ### Function `burn_fee` @@ -1047,37 +682,6 @@ Only called during genesis. - - -### Function `collect_fee` - - -
public(friend) fun collect_fee(account: address, fee: u64)
-
- - - - -
let collected_fees = global<CollectedFeesPerBlock>(@aptos_framework).amount;
-let aggr = collected_fees.value;
-let coin_store = global<coin::CoinStore<AptosCoin>>(account);
-aborts_if !exists<CollectedFeesPerBlock>(@aptos_framework);
-aborts_if fee > 0 && !exists<coin::CoinStore<AptosCoin>>(account);
-aborts_if fee > 0 && coin_store.coin.value < fee;
-aborts_if fee > 0 && aggregator::spec_aggregator_get_val(aggr)
-    + fee > aggregator::spec_get_limit(aggr);
-aborts_if fee > 0 && aggregator::spec_aggregator_get_val(aggr)
-    + fee > MAX_U128;
-let post post_coin_store = global<coin::CoinStore<AptosCoin>>(account);
-let post post_collected_fees = global<CollectedFeesPerBlock>(@aptos_framework).amount;
-ensures post_coin_store.coin.value == coin_store.coin.value - fee;
-ensures aggregator::spec_aggregator_get_val(post_collected_fees.value) == aggregator::spec_aggregator_get_val(
-    aggr
-) + fee;
-
- - - ### Function `store_aptos_coin_burn_cap` diff --git a/aptos-move/framework/aptos-framework/doc/transaction_validation.md b/aptos-move/framework/aptos-framework/doc/transaction_validation.md index 66e6f1746abb0..35655aedfbff2 100644 --- a/aptos-move/framework/aptos-framework/doc/transaction_validation.md +++ b/aptos-move/framework/aptos-framework/doc/transaction_validation.md @@ -606,20 +606,7 @@ Called by the Adapter error::out_of_range(PROLOGUE_ECANT_PAY_GAS_DEPOSIT), ); - let amount_to_burn = if (features::collect_and_distribute_gas_fees()) { - // TODO(gas): We might want to distinguish the refundable part of the charge and burn it or track - // it separately, so that we don't increase the total supply by refunding. - - // If transaction fees are redistributed to validators, collect them here for - // later redistribution. - transaction_fee::collect_fee(gas_payer, transaction_fee_amount); - 0 - } else { - // Otherwise, just burn the fee. - // TODO: this branch should be removed completely when transaction fee collection - // is tested and is fully proven to work well. - transaction_fee_amount - }; + let amount_to_burn = transaction_fee_amount; if (amount_to_burn > storage_fee_refunded) { let burn_amount = amount_to_burn - storage_fee_refunded; @@ -962,19 +949,11 @@ Skip transaction_fee::burn_fee verification. aborts_if pre_balance < transaction_fee_amount; ensures balance == pre_balance - transaction_fee_amount + storage_fee_refunded; ensures account.sequence_number == pre_account.sequence_number + 1; - let collect_fee_enabled = features::spec_is_enabled(features::COLLECT_AND_DISTRIBUTE_GAS_FEES); let collected_fees = global<CollectedFeesPerBlock>(@aptos_framework).amount; let aggr = collected_fees.value; let aggr_val = aggregator::spec_aggregator_get_val(aggr); let aggr_lim = aggregator::spec_get_limit(aggr); - // This enforces high-level requirement 3: - aborts_if collect_fee_enabled && !exists<CollectedFeesPerBlock>(@aptos_framework); - aborts_if collect_fee_enabled && transaction_fee_amount > 0 && aggr_val + transaction_fee_amount > aggr_lim; - let amount_to_burn= if (collect_fee_enabled) { - 0 - } else { - transaction_fee_amount - storage_fee_refunded - }; + let amount_to_burn= transaction_fee_amount - storage_fee_refunded; let apt_addr = type_info::type_of<AptosCoin>().account_address; let maybe_apt_supply = global<CoinInfo<AptosCoin>>(apt_addr).supply; let total_supply_enabled = option::spec_is_some(maybe_apt_supply); @@ -987,11 +966,7 @@ Skip transaction_fee::burn_fee verification. aborts_if amount_to_burn > 0 && !exists<CoinInfo<AptosCoin>>(apt_addr); aborts_if amount_to_burn > 0 && total_supply_enabled && apt_supply_value < amount_to_burn; ensures total_supply_enabled ==> apt_supply_value - amount_to_burn == post_apt_supply_value; - let amount_to_mint = if (collect_fee_enabled) { - storage_fee_refunded - } else { - storage_fee_refunded - transaction_fee_amount - }; + let amount_to_mint = storage_fee_refunded - transaction_fee_amount; let total_supply = coin::supply<AptosCoin>; let post post_total_supply = coin::supply<AptosCoin>; aborts_if amount_to_mint > 0 && !exists<CoinStore<AptosCoin>>(addr); diff --git a/aptos-move/framework/aptos-framework/doc/version.md b/aptos-move/framework/aptos-framework/doc/version.md index 5a9ba0515b795..bc7a65ae6d849 100644 --- a/aptos-move/framework/aptos-framework/doc/version.md +++ b/aptos-move/framework/aptos-framework/doc/version.md @@ -352,7 +352,6 @@ Abort if resource already exists in @aptos_framwork when initializi
pragma verify_duration_estimate = 120;
-include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
 include staking_config::StakingRewardsConfigRequirement;
 requires chain_status::is_genesis();
 requires timestamp::spec_now_microseconds() >= reconfiguration::last_reconfiguration_time();
diff --git a/aptos-move/framework/aptos-framework/sources/aptos_governance.spec.move b/aptos-move/framework/aptos-framework/sources/aptos_governance.spec.move
index a4a8847e09a77..2ba7d4175c777 100644
--- a/aptos-move/framework/aptos-framework/sources/aptos_governance.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/aptos_governance.spec.move
@@ -146,7 +146,6 @@ spec aptos_framework::aptos_governance {
             account: aptos_framework
         };
         include stake::GetReconfigStartTimeRequirement;
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         requires chain_status::is_operating();
         requires exists(@aptos_framework);
         requires exists>(@aptos_framework);
@@ -586,7 +585,6 @@ spec aptos_framework::aptos_governance {
         };
         include stake::GetReconfigStartTimeRequirement;
 
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         requires chain_status::is_operating();
         requires exists(@aptos_framework);
         requires exists>(@aptos_framework);
diff --git a/aptos-move/framework/aptos-framework/sources/block.move b/aptos-move/framework/aptos-framework/sources/block.move
index 4c485a5a7d6a3..d6ecb0827b84b 100644
--- a/aptos-move/framework/aptos-framework/sources/block.move
+++ b/aptos-move/framework/aptos-framework/sources/block.move
@@ -1,7 +1,6 @@
 /// This module defines a struct storing the metadata of the block and new block events.
 module aptos_framework::block {
     use std::error;
-    use std::features;
     use std::vector;
     use std::option;
     use aptos_std::table_with_length::{Self, TableWithLength};
@@ -16,7 +15,6 @@ module aptos_framework::block {
     use aptos_framework::state_storage;
     use aptos_framework::system_addresses;
     use aptos_framework::timestamp;
-    use aptos_framework::transaction_fee;
 
     friend aptos_framework::genesis;
 
@@ -165,15 +163,6 @@ module aptos_framework::block {
         };
         emit_new_block_event(vm, &mut block_metadata_ref.new_block_events, new_block_event);
 
-        if (features::collect_and_distribute_gas_fees()) {
-            // Assign the fees collected from the previous block to the previous block proposer.
-            // If for any reason the fees cannot be assigned, this function burns the collected coins.
-            transaction_fee::process_collected_fees();
-            // Set the proposer of this block as the receiver of the fees, so that the fees for this
-            // block are assigned to the right account.
-            transaction_fee::register_proposer_for_fee_collection(proposer);
-        };
-
         // Performance scores have to be updated before the epoch transition as the transaction that triggers the
         // transition is the last block in the previous epoch.
         stake::update_performance_statistics(proposer_index, failed_proposer_indices);
diff --git a/aptos-move/framework/aptos-framework/sources/block.spec.move b/aptos-move/framework/aptos-framework/sources/block.spec.move
index 2a8d982bd8ed7..ebccd1475938c 100644
--- a/aptos-move/framework/aptos-framework/sources/block.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/block.spec.move
@@ -147,7 +147,6 @@ spec aptos_framework::block {
         requires (proposer != @vm_reserved) ==> (timestamp::spec_now_microseconds() < timestamp);
         requires exists(@aptos_framework);
         requires exists>(@aptos_framework);
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         include staking_config::StakingRewardsConfigRequirement;
     }
 
diff --git a/aptos-move/framework/aptos-framework/sources/coin.move b/aptos-move/framework/aptos-framework/sources/coin.move
index 18259efba865f..6dd87071ba9b5 100644
--- a/aptos-move/framework/aptos-framework/sources/coin.move
+++ b/aptos-move/framework/aptos-framework/sources/coin.move
@@ -7,7 +7,7 @@ module aptos_framework::coin {
 
     use aptos_framework::account;
     use aptos_framework::aggregator_factory;
-    use aptos_framework::aggregator::{Self, Aggregator};
+    use aptos_framework::aggregator::Aggregator;
     use aptos_framework::event::{Self, EventHandle};
     use aptos_framework::optional_aggregator::{Self, OptionalAggregator};
     use aptos_framework::system_addresses;
@@ -76,9 +76,8 @@ module aptos_framework::coin {
         value: u64,
     }
 
-    /// Represents a coin with aggregator as its value. This allows to update
-    /// the coin in every transaction avoiding read-modify-write conflicts. Only
-    /// used for gas fees distribution by Aptos Framework (0x1).
+    #[deprecated]
+    /// DEPRECATED
     struct AggregatableCoin has store {
         /// Amount of aggregatable coin this address has.
         value: Aggregator,
@@ -168,77 +167,6 @@ module aptos_framework::coin {
         *allow_upgrades = allowed;
     }
 
-    //
-    //  Aggregatable coin functions
-    //
-
-    /// Creates a new aggregatable coin with value overflowing on `limit`. Note that this function can
-    /// only be called by Aptos Framework (0x1) account for now because of `create_aggregator`.
-    public(friend) fun initialize_aggregatable_coin(aptos_framework: &signer): AggregatableCoin {
-        let aggregator = aggregator_factory::create_aggregator(aptos_framework, MAX_U64);
-        AggregatableCoin {
-            value: aggregator,
-        }
-    }
-
-    /// Returns true if the value of aggregatable coin is zero.
-    public(friend) fun is_aggregatable_coin_zero(coin: &AggregatableCoin): bool {
-        let amount = aggregator::read(&coin.value);
-        amount == 0
-    }
-
-    /// Drains the aggregatable coin, setting it to zero and returning a standard coin.
-    public(friend) fun drain_aggregatable_coin(coin: &mut AggregatableCoin): Coin {
-        spec {
-            // TODO: The data invariant is not properly assumed from CollectedFeesPerBlock.
-            assume aggregator::spec_get_limit(coin.value) == MAX_U64;
-        };
-        let amount = aggregator::read(&coin.value);
-        assert!(amount <= MAX_U64, error::out_of_range(EAGGREGATABLE_COIN_VALUE_TOO_LARGE));
-        spec {
-            update aggregate_supply = aggregate_supply - amount;
-        };
-        aggregator::sub(&mut coin.value, amount);
-        spec {
-            update supply = supply + amount;
-        };
-        Coin {
-            value: (amount as u64),
-        }
-    }
-
-    /// Merges `coin` into aggregatable coin (`dst_coin`).
-    public(friend) fun merge_aggregatable_coin(
-        dst_coin: &mut AggregatableCoin,
-        coin: Coin
-    ) {
-        spec {
-            update supply = supply - coin.value;
-        };
-        let Coin { value } = coin;
-        let amount = (value as u128);
-        spec {
-            update aggregate_supply = aggregate_supply + amount;
-        };
-        aggregator::add(&mut dst_coin.value, amount);
-    }
-
-    /// Collects a specified amount of coin form an account into aggregatable coin.
-    public(friend) fun collect_into_aggregatable_coin(
-        account_addr: address,
-        amount: u64,
-        dst_coin: &mut AggregatableCoin,
-    ) acquires CoinStore {
-        // Skip collecting if amount is zero.
-        if (amount == 0) {
-            return
-        };
-
-        let coin_store = borrow_global_mut>(account_addr);
-        let coin = extract(&mut coin_store.coin, amount);
-        merge_aggregatable_coin(dst_coin, coin);
-    }
-
     //
     // Getter functions
     //
@@ -1189,38 +1117,4 @@ module aptos_framework::coin {
             mint_cap,
         });
     }
-
-    #[test(framework = @aptos_framework)]
-    public entry fun test_collect_from_and_drain(
-        framework: signer,
-    ) acquires CoinInfo, CoinStore {
-        let framework_addr = signer::address_of(&framework);
-        account::create_account_for_test(framework_addr);
-        let (burn_cap, freeze_cap, mint_cap) = initialize_and_register_fake_money(&framework, 1, true);
-
-        let coins_minted = mint(100, &mint_cap);
-        deposit(framework_addr, coins_minted);
-        assert!(balance(framework_addr) == 100, 0);
-        assert!(*option::borrow(&supply()) == 100, 0);
-
-        let aggregatable_coin = initialize_aggregatable_coin(&framework);
-        collect_into_aggregatable_coin(framework_addr, 10, &mut aggregatable_coin);
-
-        // Check that aggregatable coin has the right amount.
-        let collected_coin = drain_aggregatable_coin(&mut aggregatable_coin);
-        assert!(is_aggregatable_coin_zero(&aggregatable_coin), 0);
-        assert!(value(&collected_coin) == 10, 0);
-
-        // Supply of coins should be unchanged, but the balance on the account should decrease.
-        assert!(balance(framework_addr) == 90, 0);
-        assert!(*option::borrow(&supply()) == 100, 0);
-
-        burn(collected_coin, &burn_cap);
-        destroy_aggregatable_coin_for_test(aggregatable_coin);
-        move_to(&framework, FakeMoneyCapabilities {
-            burn_cap,
-            freeze_cap,
-            mint_cap,
-        });
-    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/coin.spec.move b/aptos-move/framework/aptos-framework/sources/coin.spec.move
index d477dd1f3fec8..ae00fe5ca0db4 100644
--- a/aptos-move/framework/aptos-framework/sources/coin.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/coin.spec.move
@@ -497,44 +497,4 @@ spec aptos_framework::coin {
         aborts_if coin_store.frozen;
         aborts_if balance < amount;
     }
-
-    spec initialize_aggregatable_coin(aptos_framework: &signer): AggregatableCoin {
-        include system_addresses::AbortsIfNotAptosFramework{account: aptos_framework};
-        include aggregator_factory::CreateAggregatorInternalAbortsIf;
-    }
-
-    spec is_aggregatable_coin_zero(coin: &AggregatableCoin): bool {
-        aborts_if false;
-        ensures result == (aggregator::spec_read(coin.value) == 0);
-    }
-
-    spec drain_aggregatable_coin(coin: &mut AggregatableCoin): Coin {
-        aborts_if aggregator::spec_read(coin.value) > MAX_U64;
-        ensures result.value == aggregator::spec_aggregator_get_val(old(coin).value);
-    }
-
-    spec merge_aggregatable_coin(dst_coin: &mut AggregatableCoin, coin: Coin) {
-        let aggr = dst_coin.value;
-        let post p_aggr = dst_coin.value;
-        aborts_if aggregator::spec_aggregator_get_val(aggr)
-            + coin.value > aggregator::spec_get_limit(aggr);
-        aborts_if aggregator::spec_aggregator_get_val(aggr)
-            + coin.value > MAX_U128;
-        ensures aggregator::spec_aggregator_get_val(aggr)+ coin.value == aggregator::spec_aggregator_get_val(p_aggr);
-    }
-
-    spec collect_into_aggregatable_coin(account_addr: address, amount: u64, dst_coin: &mut AggregatableCoin) {
-        let aggr = dst_coin.value;
-        let post p_aggr = dst_coin.value;
-        let coin_store = global>(account_addr);
-        let post p_coin_store = global>(account_addr);
-        aborts_if amount > 0 && !exists>(account_addr);
-        aborts_if amount > 0 && coin_store.coin.value < amount;
-        aborts_if amount > 0 && aggregator::spec_aggregator_get_val(aggr)
-            + amount > aggregator::spec_get_limit(aggr);
-        aborts_if amount > 0 && aggregator::spec_aggregator_get_val(aggr)
-            + amount > MAX_U128;
-        ensures aggregator::spec_aggregator_get_val(aggr)+ amount == aggregator::spec_aggregator_get_val(p_aggr);
-        ensures coin_store.coin.value - amount == p_coin_store.coin.value;
-    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/configs/consensus_config.spec.move b/aptos-move/framework/aptos-framework/sources/configs/consensus_config.spec.move
index d1952e56c5470..e6f1937180325 100644
--- a/aptos-move/framework/aptos-framework/sources/configs/consensus_config.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/configs/consensus_config.spec.move
@@ -55,7 +55,6 @@ spec aptos_framework::consensus_config {
 
         // TODO: set because of timeout (property proved)
         pragma verify_duration_estimate = 600;
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         include staking_config::StakingRewardsConfigRequirement;
         let addr = signer::address_of(account);
         /// [high-level-req-2]
diff --git a/aptos-move/framework/aptos-framework/sources/configs/execution_config.spec.move b/aptos-move/framework/aptos-framework/sources/configs/execution_config.spec.move
index 44531b0796f07..5344b58aef4d4 100644
--- a/aptos-move/framework/aptos-framework/sources/configs/execution_config.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/configs/execution_config.spec.move
@@ -19,7 +19,6 @@ spec aptos_framework::execution_config {
         // TODO: set because of timeout (property proved)
         pragma verify_duration_estimate = 600;
         let addr = signer::address_of(account);
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         requires chain_status::is_genesis();
         requires exists(@aptos_framework);
         requires exists(@aptos_framework);
diff --git a/aptos-move/framework/aptos-framework/sources/configs/gas_schedule.spec.move b/aptos-move/framework/aptos-framework/sources/configs/gas_schedule.spec.move
index 2f1b596b3bd73..3db0ee232b38f 100644
--- a/aptos-move/framework/aptos-framework/sources/configs/gas_schedule.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/configs/gas_schedule.spec.move
@@ -61,7 +61,6 @@ spec aptos_framework::gas_schedule {
         requires exists(@aptos_framework);
         requires exists>(@aptos_framework);
         requires chain_status::is_genesis();
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         include staking_config::StakingRewardsConfigRequirement;
 
         /// [high-level-req-2]
@@ -88,7 +87,6 @@ spec aptos_framework::gas_schedule {
         requires exists(@aptos_framework);
         requires exists>(@aptos_framework);
         include system_addresses::AbortsIfNotAptosFramework{ account: aptos_framework };
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         include staking_config::StakingRewardsConfigRequirement;
         aborts_if !exists(@aptos_framework);
         ensures global(@aptos_framework) == config;
diff --git a/aptos-move/framework/aptos-framework/sources/configs/version.spec.move b/aptos-move/framework/aptos-framework/sources/configs/version.spec.move
index e5975d0f04bc7..511571b4ff7ef 100644
--- a/aptos-move/framework/aptos-framework/sources/configs/version.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/configs/version.spec.move
@@ -35,7 +35,6 @@ spec aptos_framework::version {
 
         // TODO: set because of timeout (property proved)
         pragma verify_duration_estimate = 120;
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         include staking_config::StakingRewardsConfigRequirement;
         requires chain_status::is_genesis();
         requires timestamp::spec_now_microseconds() >= reconfiguration::last_reconfiguration_time();
diff --git a/aptos-move/framework/aptos-framework/sources/genesis.spec.move b/aptos-move/framework/aptos-framework/sources/genesis.spec.move
index 439d72c81b43c..8378b5b4cfafe 100644
--- a/aptos-move/framework/aptos-framework/sources/genesis.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/genesis.spec.move
@@ -157,10 +157,8 @@ spec aptos_framework::genesis {
         requires chain_status::is_operating();
         requires len(execution_config) > 0;
         requires exists(@aptos_framework);
-        requires exists(@aptos_framework);
         requires exists>(@aptos_framework);
         include CompareTimeRequires;
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
     }
 
     spec schema CompareTimeRequires {
diff --git a/aptos-move/framework/aptos-framework/sources/reconfiguration.move b/aptos-move/framework/aptos-framework/sources/reconfiguration.move
index 86f96c05ca097..07046f8c4bc80 100644
--- a/aptos-move/framework/aptos-framework/sources/reconfiguration.move
+++ b/aptos-move/framework/aptos-framework/sources/reconfiguration.move
@@ -13,7 +13,6 @@ module aptos_framework::reconfiguration {
     use aptos_framework::chain_status;
     use aptos_framework::reconfiguration_state;
     use aptos_framework::storage_gas;
-    use aptos_framework::transaction_fee;
 
     friend aptos_framework::aptos_governance;
     friend aptos_framework::block;
@@ -122,20 +121,6 @@ module aptos_framework::reconfiguration {
 
         reconfiguration_state::on_reconfig_start();
 
-        // Reconfiguration "forces the block" to end, as mentioned above. Therefore, we must process the collected fees
-        // explicitly so that staking can distribute them.
-        //
-        // This also handles the case when a validator is removed due to the governance proposal. In particular, removing
-        // the validator causes a reconfiguration. We explicitly process fees, i.e. we drain aggregatable coin and populate
-        // the fees table, prior to calling `on_new_epoch()`. That call, in turn, distributes transaction fees for all active
-        // and pending_inactive validators, which include any validator that is to be removed.
-        if (features::collect_and_distribute_gas_fees()) {
-            // All transactions after reconfiguration are Retry. Therefore, when the next
-            // block starts and tries to assign/burn collected fees it will be just 0 and
-            // nothing will be assigned.
-            transaction_fee::process_collected_fees();
-        };
-
         // Call stake to compute the new validator set and distribute rewards and transaction fees.
         stake::on_new_epoch();
         storage_gas::on_reconfig();
diff --git a/aptos-move/framework/aptos-framework/sources/reconfiguration.spec.move b/aptos-move/framework/aptos-framework/sources/reconfiguration.spec.move
index 4bea1460fdb54..3e75894234e39 100644
--- a/aptos-move/framework/aptos-framework/sources/reconfiguration.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/reconfiguration.spec.move
@@ -139,7 +139,6 @@ spec aptos_framework::reconfiguration {
             && timestamp::spec_now_microseconds() != global(@aptos_framework).last_reconfiguration_time;
         include features::spec_periodical_reward_rate_decrease_enabled() ==> staking_config::StakingRewardsConfigEnabledRequirement;
         include success ==> aptos_coin::ExistsAptosCoin;
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         aborts_if false;
         // The ensure conditions of the reconfigure function are not fully written, because there is a new cycle in it,
         // but its existing ensure conditions satisfy hp.
diff --git a/aptos-move/framework/aptos-framework/sources/reconfiguration_with_dkg.spec.move b/aptos-move/framework/aptos-framework/sources/reconfiguration_with_dkg.spec.move
index e86a2cd233c56..9f0f8e2b52967 100644
--- a/aptos-move/framework/aptos-framework/sources/reconfiguration_with_dkg.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/reconfiguration_with_dkg.spec.move
@@ -46,7 +46,6 @@ spec aptos_framework::reconfiguration_with_dkg {
         requires exists>(@aptos_framework);
         include staking_config::StakingRewardsConfigRequirement;
         requires exists(@aptos_framework);
-        include transaction_fee::RequiresCollectedFeesPerValueLeqBlockAptosSupply;
         requires exists(@std);
         include config_buffer::OnNewEpochRequirement;
         include config_buffer::OnNewEpochRequirement;
diff --git a/aptos-move/framework/aptos-framework/sources/stake.move b/aptos-move/framework/aptos-framework/sources/stake.move
index cbac435b748b1..fa56cc70fe220 100644
--- a/aptos-move/framework/aptos-framework/sources/stake.move
+++ b/aptos-move/framework/aptos-framework/sources/stake.move
@@ -1064,7 +1064,7 @@ module aptos_framework::stake {
     /// pending inactive validators so they no longer can vote.
     /// 4. The validator's voting power in the validator set is updated to be the corresponding staking pool's voting
     /// power.
-    public(friend) fun on_new_epoch() acquires StakePool, AptosCoinCapabilities, ValidatorConfig, ValidatorPerformance, ValidatorSet, ValidatorFees {
+    public(friend) fun on_new_epoch() acquires StakePool, AptosCoinCapabilities, ValidatorConfig, ValidatorPerformance, ValidatorSet {
         let validator_set = borrow_global_mut(@aptos_framework);
         let config = staking_config::get();
         let validator_perf = borrow_global_mut(@aptos_framework);
@@ -1186,7 +1186,7 @@ module aptos_framework::stake {
     }
 
 
-    public fun next_validator_consensus_infos(): vector acquires ValidatorSet, ValidatorPerformance, StakePool, ValidatorFees, ValidatorConfig {
+    public fun next_validator_consensus_infos(): vector acquires ValidatorSet, ValidatorPerformance, StakePool, ValidatorConfig {
         // Init.
         let cur_validator_set = borrow_global(@aptos_framework);
         let staking_config = staking_config::get();
@@ -1242,14 +1242,6 @@ module aptos_framework::stake {
             };
 
             let cur_fee = 0;
-            if (features::collect_and_distribute_gas_fees()) {
-                let fees_table = &borrow_global(@aptos_framework).fees_table;
-                if (table::contains(fees_table, candidate.addr)) {
-                    let fee_coin = table::borrow(fees_table, candidate.addr);
-                    cur_fee = coin::value(fee_coin);
-                }
-            };
-
             let lockup_expired = get_reconfig_start_time_secs() >= stake_pool.locked_until_secs;
             spec {
                 assume cur_active + cur_pending_active + cur_reward + cur_fee <= MAX_U64;
@@ -1378,7 +1370,7 @@ module aptos_framework::stake {
         validator_perf: &ValidatorPerformance,
         pool_address: address,
         staking_config: &StakingConfig,
-    ) acquires StakePool, AptosCoinCapabilities, ValidatorConfig, ValidatorFees {
+    ) acquires StakePool, AptosCoinCapabilities, ValidatorConfig {
         let stake_pool = borrow_global_mut(pool_address);
         let validator_config = borrow_global(pool_address);
         let cur_validator_perf = vector::borrow(&validator_perf.validators, validator_config.validator_index);
@@ -1411,15 +1403,6 @@ module aptos_framework::stake {
         // Pending active stake can now be active.
         coin::merge(&mut stake_pool.active, coin::extract_all(&mut stake_pool.pending_active));
 
-        // Additionally, distribute transaction fees.
-        if (features::collect_and_distribute_gas_fees()) {
-            let fees_table = &mut borrow_global_mut(@aptos_framework).fees_table;
-            if (table::contains(fees_table, pool_address)) {
-                let coin = table::remove(fees_table, pool_address);
-                coin::merge(&mut stake_pool.active, coin);
-            };
-        };
-
         // Pending inactive stake is only fully unlocked and moved into inactive if the current lockup cycle has expired
         let current_lockup_expiration = stake_pool.locked_until_secs;
         if (get_reconfig_start_time_secs() >= current_lockup_expiration) {
@@ -3015,61 +2998,4 @@ module aptos_framework::stake {
         let fees_table = &borrow_global(@aptos_framework).fees_table;
         assert!(!table::contains(fees_table, validator_addr), 0);
     }
-
-    #[test_only]
-    const COLLECT_AND_DISTRIBUTE_GAS_FEES: u64 = 6;
-
-    #[test(aptos_framework = @0x1, validator_1 = @0x123, validator_2 = @0x234, validator_3 = @0x345)]
-    fun test_distribute_validator_fees(
-        aptos_framework: &signer,
-        validator_1: &signer,
-        validator_2: &signer,
-        validator_3: &signer,
-    ) acquires AllowedValidators, AptosCoinCapabilities, OwnerCapability, StakePool, ValidatorConfig, ValidatorPerformance, ValidatorSet, ValidatorFees {
-        // Make sure that fees collection and distribution is enabled.
-        features::change_feature_flags_for_testing(aptos_framework, vector[COLLECT_AND_DISTRIBUTE_GAS_FEES], vector[]);
-        assert!(features::collect_and_distribute_gas_fees(), 0);
-
-        // Initialize staking and validator fees table.
-        initialize_for_test(aptos_framework);
-        initialize_validator_fees(aptos_framework);
-
-        let validator_1_address = signer::address_of(validator_1);
-        let validator_2_address = signer::address_of(validator_2);
-        let validator_3_address = signer::address_of(validator_3);
-
-        // Validators join the set and epoch ends.
-        let (_sk_1, pk_1, pop_1) = generate_identity();
-        let (_sk_2, pk_2, pop_2) = generate_identity();
-        let (_sk_3, pk_3, pop_3) = generate_identity();
-        initialize_test_validator(&pk_1, &pop_1, validator_1, 100, true, false);
-        initialize_test_validator(&pk_2, &pop_2, validator_2, 100, true, false);
-        initialize_test_validator(&pk_3, &pop_3, validator_3, 100, true, true);
-
-        // Next, simulate fees collection during three blocks, where proposers are
-        // validators 1, 2, and 1 again.
-        add_transaction_fee(validator_1_address, mint_coins(100));
-        add_transaction_fee(validator_2_address, mint_coins(500));
-        add_transaction_fee(validator_1_address, mint_coins(200));
-
-        // Fess have to be assigned to the right validators, but not
-        // distributed yet.
-        assert!(get_validator_fee(validator_1_address) == 300, 0);
-        assert!(get_validator_fee(validator_2_address) == 500, 0);
-        assert_no_fees_for_validator(validator_3_address);
-        assert_validator_state(validator_1_address, 100, 0, 0, 0, 2);
-        assert_validator_state(validator_2_address, 100, 0, 0, 0, 1);
-        assert_validator_state(validator_3_address, 100, 0, 0, 0, 0);
-
-        end_epoch();
-
-        // Epoch ended. Validators must have recieved their rewards and, most importantly,
-        // their fees.
-        assert_no_fees_for_validator(validator_1_address);
-        assert_no_fees_for_validator(validator_2_address);
-        assert_no_fees_for_validator(validator_3_address);
-        assert_validator_state(validator_1_address, 401, 0, 0, 0, 2);
-        assert_validator_state(validator_2_address, 601, 0, 0, 0, 1);
-        assert_validator_state(validator_3_address, 101, 0, 0, 0, 0);
-    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/stake.spec.move b/aptos-move/framework/aptos-framework/sources/stake.spec.move
index 05806ca2c2bd3..95bb0f1710d9b 100644
--- a/aptos-move/framework/aptos-framework/sources/stake.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/stake.spec.move
@@ -495,12 +495,7 @@ spec aptos_framework::stake {
         let post post_inactive_value = post_stake_pool.inactive.value;
         ensures post_stake_pool.pending_active.value == 0;
         // the amount stored in the stake pool should not changed after the update
-        ensures if (features::spec_is_enabled(features::COLLECT_AND_DISTRIBUTE_GAS_FEES) && table::spec_contains(fees_table, pool_address)) {
-            !table::spec_contains(post_fees_table, pool_address) &&
-            post_active_value == stake_pool.active.value + rewards_amount_1 + stake_pool.pending_active.value + table::spec_get(fees_table, pool_address).value
-        } else {
-            post_active_value == stake_pool.active.value + rewards_amount_1 + stake_pool.pending_active.value
-        };
+        ensures post_active_value == stake_pool.active.value + rewards_amount_1 + stake_pool.pending_active.value;
         // when current lockup cycle has expired, pending inactive should be fully unlocked and moved into inactive
         ensures if (spec_get_reconfig_start_time_secs() >= stake_pool.locked_until_secs) {
             post_pending_inactive_value == 0 &&
diff --git a/aptos-move/framework/aptos-framework/sources/transaction_fee.move b/aptos-move/framework/aptos-framework/sources/transaction_fee.move
index 2e7d34ad09e53..02396020bcdfa 100644
--- a/aptos-move/framework/aptos-framework/sources/transaction_fee.move
+++ b/aptos-move/framework/aptos-framework/sources/transaction_fee.move
@@ -1,8 +1,7 @@
 /// This module provides an interface to burn or collect and redistribute transaction fees.
 module aptos_framework::transaction_fee {
-    use aptos_framework::coin::{Self, AggregatableCoin, BurnCapability, Coin, MintCapability};
+    use aptos_framework::coin::{Self, AggregatableCoin, BurnCapability, MintCapability};
     use aptos_framework::aptos_coin::AptosCoin;
-    use aptos_framework::stake;
     use aptos_framework::system_addresses;
     use std::error;
     use std::option::{Self, Option};
@@ -35,6 +34,7 @@ module aptos_framework::transaction_fee {
 
     /// Stores information about the block proposer and the amount of fees
     /// collected when executing the block.
+    #[deprecated]
     struct CollectedFeesPerBlock has key {
         amount: AggregatableCoin,
         proposer: Option
, @@ -78,122 +78,20 @@ module aptos_framework::transaction_fee { /// distribution. Should be called by on-chain governance. public fun initialize_fee_collection_and_distribution(aptos_framework: &signer, burn_percentage: u8) { system_addresses::assert_aptos_framework(aptos_framework); - assert!( - !exists(@aptos_framework), - error::already_exists(EALREADY_COLLECTING_FEES) - ); assert!(burn_percentage <= 100, error::out_of_range(EINVALID_BURN_PERCENTAGE)); - // Make sure stakng module is aware of transaction fees collection. - stake::initialize_validator_fees(aptos_framework); - - // Initially, no fees are collected and the block proposer is not set. - let collected_fees = CollectedFeesPerBlock { - amount: coin::initialize_aggregatable_coin(aptos_framework), - proposer: option::none(), - burn_percentage, - }; - move_to(aptos_framework, collected_fees); - } - - fun is_fees_collection_enabled(): bool { - exists(@aptos_framework) + abort error::not_implemented(ENO_LONGER_SUPPORTED) } /// Sets the burn percentage for collected fees to a new value. Should be called by on-chain governance. public fun upgrade_burn_percentage( aptos_framework: &signer, new_burn_percentage: u8 - ) acquires AptosCoinCapabilities, CollectedFeesPerBlock { + ) { system_addresses::assert_aptos_framework(aptos_framework); assert!(new_burn_percentage <= 100, error::out_of_range(EINVALID_BURN_PERCENTAGE)); - // Prior to upgrading the burn percentage, make sure to process collected - // fees. Otherwise we would use the new (incorrect) burn_percentage when - // processing fees later! - process_collected_fees(); - - if (is_fees_collection_enabled()) { - // Upgrade has no effect unless fees are being collected. - let burn_percentage = &mut borrow_global_mut(@aptos_framework).burn_percentage; - *burn_percentage = new_burn_percentage - } - } - - /// Registers the proposer of the block for gas fees collection. This function - /// can only be called at the beginning of the block. - public(friend) fun register_proposer_for_fee_collection(proposer_addr: address) acquires CollectedFeesPerBlock { - if (is_fees_collection_enabled()) { - let collected_fees = borrow_global_mut(@aptos_framework); - let _ = option::swap_or_fill(&mut collected_fees.proposer, proposer_addr); - } - } - - /// Burns a specified fraction of the coin. - fun burn_coin_fraction(coin: &mut Coin, burn_percentage: u8) acquires AptosCoinCapabilities { - assert!(burn_percentage <= 100, error::out_of_range(EINVALID_BURN_PERCENTAGE)); - - let collected_amount = coin::value(coin); - spec { - // We assume that `burn_percentage * collected_amount` does not overflow. - assume burn_percentage * collected_amount <= MAX_U64; - }; - let amount_to_burn = (burn_percentage as u64) * collected_amount / 100; - if (amount_to_burn > 0) { - let coin_to_burn = coin::extract(coin, amount_to_burn); - coin::burn( - coin_to_burn, - &borrow_global(@aptos_framework).burn_cap, - ); - } - } - - /// Calculates the fee which should be distributed to the block proposer at the - /// end of an epoch, and records it in the system. This function can only be called - /// at the beginning of the block or during reconfiguration. - public(friend) fun process_collected_fees() acquires AptosCoinCapabilities, CollectedFeesPerBlock { - if (!is_fees_collection_enabled()) { - return - }; - let collected_fees = borrow_global_mut(@aptos_framework); - - // If there are no collected fees, only unset the proposer. See the rationale for - // setting proposer to option::none() below. - if (coin::is_aggregatable_coin_zero(&collected_fees.amount)) { - if (option::is_some(&collected_fees.proposer)) { - let _ = option::extract(&mut collected_fees.proposer); - }; - return - }; - - // Otherwise get the collected fee, and check if it can distributed later. - let coin = coin::drain_aggregatable_coin(&mut collected_fees.amount); - if (option::is_some(&collected_fees.proposer)) { - // Extract the address of proposer here and reset it to option::none(). This - // is particularly useful to avoid any undesired side-effects where coins are - // collected but never distributed or distributed to the wrong account. - // With this design, processing collected fees enforces that all fees will be burnt - // unless the proposer is specified in the block prologue. When we have a governance - // proposal that triggers reconfiguration, we distribute pending fees and burn the - // fee for the proposal. Otherwise, that fee would be leaked to the next block. - let proposer = option::extract(&mut collected_fees.proposer); - - // Since the block can be produced by the VM itself, we have to make sure we catch - // this case. - if (proposer == @vm_reserved) { - burn_coin_fraction(&mut coin, 100); - coin::destroy_zero(coin); - return - }; - - burn_coin_fraction(&mut coin, collected_fees.burn_percentage); - stake::add_transaction_fee(proposer, coin); - return - }; - - // If checks did not pass, simply burn all collected coins and return none. - burn_coin_fraction(&mut coin, 100); - coin::destroy_zero(coin) + abort error::not_implemented(ENO_LONGER_SUPPORTED) } /// Burn transaction fees in epilogue. @@ -212,17 +110,6 @@ module aptos_framework::transaction_fee { coin::force_deposit(account, refund_coin); } - /// Collect transaction fees in epilogue. - public(friend) fun collect_fee(account: address, fee: u64) acquires CollectedFeesPerBlock { - let collected_fees = borrow_global_mut(@aptos_framework); - - // Here, we are always optimistic and always collect fees. If the proposer is not set, - // or we cannot redistribute fees later for some reason (e.g. account cannot receive AptoCoin) - // we burn them all at once. This way we avoid having a check for every transaction epilogue. - let collected_amount = &mut collected_fees.amount; - coin::collect_into_aggregatable_coin(account, fee, collected_amount); - } - /// Only called during genesis. public(friend) fun store_aptos_coin_burn_cap(aptos_framework: &signer, burn_cap: BurnCapability) { system_addresses::assert_aptos_framework(aptos_framework); @@ -247,169 +134,4 @@ module aptos_framework::transaction_fee { #[test_only] use aptos_framework::aggregator_factory; - - #[test(aptos_framework = @aptos_framework)] - fun test_initialize_fee_collection_and_distribution(aptos_framework: signer) acquires CollectedFeesPerBlock { - aggregator_factory::initialize_aggregator_factory_for_test(&aptos_framework); - initialize_fee_collection_and_distribution(&aptos_framework, 25); - - // Check struct has been published. - assert!(exists(@aptos_framework), 0); - - // Check that initial balance is 0 and there is no proposer set. - let collected_fees = borrow_global(@aptos_framework); - assert!(coin::is_aggregatable_coin_zero(&collected_fees.amount), 0); - assert!(option::is_none(&collected_fees.proposer), 0); - assert!(collected_fees.burn_percentage == 25, 0); - } - - #[test(aptos_framework = @aptos_framework)] - fun test_burn_fraction_calculation(aptos_framework: signer) acquires AptosCoinCapabilities { - use aptos_framework::aptos_coin; - let (burn_cap, mint_cap) = aptos_coin::initialize_for_test(&aptos_framework); - store_aptos_coin_burn_cap(&aptos_framework, burn_cap); - - let c1 = coin::mint(100, &mint_cap); - assert!(*option::borrow(&coin::supply()) == 100, 0); - - // Burning 25%. - burn_coin_fraction(&mut c1, 25); - assert!(coin::value(&c1) == 75, 0); - assert!(*option::borrow(&coin::supply()) == 75, 0); - - // Burning 0%. - burn_coin_fraction(&mut c1, 0); - assert!(coin::value(&c1) == 75, 0); - assert!(*option::borrow(&coin::supply()) == 75, 0); - - // Burning remaining 100%. - burn_coin_fraction(&mut c1, 100); - assert!(coin::value(&c1) == 0, 0); - assert!(*option::borrow(&coin::supply()) == 0, 0); - - coin::destroy_zero(c1); - let c2 = coin::mint(10, &mint_cap); - assert!(*option::borrow(&coin::supply()) == 10, 0); - - burn_coin_fraction(&mut c2, 5); - assert!(coin::value(&c2) == 10, 0); - assert!(*option::borrow(&coin::supply()) == 10, 0); - - burn_coin_fraction(&mut c2, 100); - coin::destroy_zero(c2); - coin::destroy_burn_cap(burn_cap); - coin::destroy_mint_cap(mint_cap); - } - - #[test(aptos_framework = @aptos_framework, alice = @0xa11ce, bob = @0xb0b, carol = @0xca101)] - fun test_fees_distribution( - aptos_framework: signer, - alice: signer, - bob: signer, - carol: signer, - ) acquires AptosCoinCapabilities, CollectedFeesPerBlock { - use std::signer; - use aptos_framework::aptos_account; - use aptos_framework::aptos_coin; - - // Initialization. - let (burn_cap, mint_cap) = aptos_coin::initialize_for_test(&aptos_framework); - store_aptos_coin_burn_cap(&aptos_framework, burn_cap); - initialize_fee_collection_and_distribution(&aptos_framework, 10); - - // Create dummy accounts. - let alice_addr = signer::address_of(&alice); - let bob_addr = signer::address_of(&bob); - let carol_addr = signer::address_of(&carol); - aptos_account::create_account(alice_addr); - aptos_account::create_account(bob_addr); - aptos_account::create_account(carol_addr); - coin::deposit(alice_addr, coin::mint(10000, &mint_cap)); - coin::deposit(bob_addr, coin::mint(10000, &mint_cap)); - coin::deposit(carol_addr, coin::mint(10000, &mint_cap)); - assert!(*option::borrow(&coin::supply()) == 30000, 0); - - // Block 1 starts. - process_collected_fees(); - register_proposer_for_fee_collection(alice_addr); - - // Check that there was no fees distribution in the first block. - let collected_fees = borrow_global(@aptos_framework); - assert!(coin::is_aggregatable_coin_zero(&collected_fees.amount), 0); - assert!(*option::borrow(&collected_fees.proposer) == alice_addr, 0); - assert!(*option::borrow(&coin::supply()) == 30000, 0); - - // Simulate transaction fee collection - here we simply collect some fees from Bob. - collect_fee(bob_addr, 100); - collect_fee(bob_addr, 500); - collect_fee(bob_addr, 400); - - // Now Bob must have 1000 less in his account. Alice and Carol have the same amounts. - assert!(coin::balance(alice_addr) == 10000, 0); - assert!(coin::balance(bob_addr) == 9000, 0); - assert!(coin::balance(carol_addr) == 10000, 0); - - // Block 2 starts. - process_collected_fees(); - register_proposer_for_fee_collection(bob_addr); - - // Collected fees from Bob must have been assigned to Alice. - assert!(stake::get_validator_fee(alice_addr) == 900, 0); - assert!(coin::balance(alice_addr) == 10000, 0); - assert!(coin::balance(bob_addr) == 9000, 0); - assert!(coin::balance(carol_addr) == 10000, 0); - - // Also, aggregator coin is drained and total supply is slightly changed (10% of 1000 is burnt). - let collected_fees = borrow_global(@aptos_framework); - assert!(coin::is_aggregatable_coin_zero(&collected_fees.amount), 0); - assert!(*option::borrow(&collected_fees.proposer) == bob_addr, 0); - assert!(*option::borrow(&coin::supply()) == 29900, 0); - - // Simulate transaction fee collection one more time. - collect_fee(bob_addr, 5000); - collect_fee(bob_addr, 4000); - - assert!(coin::balance(alice_addr) == 10000, 0); - assert!(coin::balance(bob_addr) == 0, 0); - assert!(coin::balance(carol_addr) == 10000, 0); - - // Block 3 starts. - process_collected_fees(); - register_proposer_for_fee_collection(carol_addr); - - // Collected fees should have been assigned to Bob because he was the peoposer. - assert!(stake::get_validator_fee(alice_addr) == 900, 0); - assert!(coin::balance(alice_addr) == 10000, 0); - assert!(stake::get_validator_fee(bob_addr) == 8100, 0); - assert!(coin::balance(bob_addr) == 0, 0); - assert!(coin::balance(carol_addr) == 10000, 0); - - // Again, aggregator coin is drained and total supply is changed by 10% of 9000. - let collected_fees = borrow_global(@aptos_framework); - assert!(coin::is_aggregatable_coin_zero(&collected_fees.amount), 0); - assert!(*option::borrow(&collected_fees.proposer) == carol_addr, 0); - assert!(*option::borrow(&coin::supply()) == 29000, 0); - - // Simulate transaction fee collection one last time. - collect_fee(alice_addr, 1000); - collect_fee(alice_addr, 1000); - - // Block 4 starts. - process_collected_fees(); - register_proposer_for_fee_collection(alice_addr); - - // Check that 2000 was collected from Alice. - assert!(coin::balance(alice_addr) == 8000, 0); - assert!(coin::balance(bob_addr) == 0, 0); - - // Carol must have some fees assigned now. - let collected_fees = borrow_global(@aptos_framework); - assert!(stake::get_validator_fee(carol_addr) == 1800, 0); - assert!(coin::is_aggregatable_coin_zero(&collected_fees.amount), 0); - assert!(*option::borrow(&collected_fees.proposer) == alice_addr, 0); - assert!(*option::borrow(&coin::supply()) == 28800, 0); - - coin::destroy_burn_cap(burn_cap); - coin::destroy_mint_cap(mint_cap); - } } diff --git a/aptos-move/framework/aptos-framework/sources/transaction_fee.spec.move b/aptos-move/framework/aptos-framework/sources/transaction_fee.spec.move index 6adc9fcbec513..7cf44aff2a975 100644 --- a/aptos-move/framework/aptos-framework/sources/transaction_fee.spec.move +++ b/aptos-move/framework/aptos-framework/sources/transaction_fee.spec.move @@ -65,131 +65,6 @@ spec aptos_framework::transaction_fee { } spec initialize_fee_collection_and_distribution(aptos_framework: &signer, burn_percentage: u8) { - use std::signer; - use aptos_framework::stake::ValidatorFees; - use aptos_framework::aggregator_factory; - use aptos_framework::system_addresses; - - // property 2: The initialization function may only be called once. - /// [high-level-req-2] - aborts_if exists(@aptos_framework); - aborts_if burn_percentage > 100; - - let aptos_addr = signer::address_of(aptos_framework); - // property 3: Only the admin address is authorized to call the initialization function. - /// [high-level-req-3] - aborts_if !system_addresses::is_aptos_framework_address(aptos_addr); - aborts_if exists(aptos_addr); - - include system_addresses::AbortsIfNotAptosFramework { account: aptos_framework }; - include aggregator_factory::CreateAggregatorInternalAbortsIf; - aborts_if exists(aptos_addr); - - ensures exists(aptos_addr); - ensures exists(aptos_addr); - } - - spec upgrade_burn_percentage(aptos_framework: &signer, new_burn_percentage: u8) { - use std::signer; - - // Percentage validation - aborts_if new_burn_percentage > 100; - // Signer validation - let aptos_addr = signer::address_of(aptos_framework); - aborts_if !system_addresses::is_aptos_framework_address(aptos_addr); - - // property 5: Prior to upgrading the burn percentage, it must process all the fees collected up to that point. - // property 6: Ensure the presence of the resource. - // Requirements and ensures conditions of `process_collected_fees` - /// [high-level-req-5] - /// [high-level-req-6.3] - include ProcessCollectedFeesRequiresAndEnsures; - - // The effect of upgrading the burn percentage - ensures exists(@aptos_framework) ==> - global(@aptos_framework).burn_percentage == new_burn_percentage; - } - - spec register_proposer_for_fee_collection(proposer_addr: address) { - aborts_if false; - // property 6: Ensure the presence of the resource. - /// [high-level-req-6.1] - ensures is_fees_collection_enabled() ==> - option::spec_borrow(global(@aptos_framework).proposer) == proposer_addr; - } - - spec burn_coin_fraction(coin: &mut Coin, burn_percentage: u8) { - use aptos_framework::coin::CoinInfo; - use aptos_framework::aptos_coin::AptosCoin; - - requires burn_percentage <= 100; - requires exists(@aptos_framework); - requires exists>(@aptos_framework); - - let amount_to_burn = (burn_percentage * coin::value(coin)) / 100; - // include (amount_to_burn > 0) ==> coin::AbortsIfNotExistCoinInfo; - include amount_to_burn > 0 ==> coin::CoinSubAbortsIf { amount: amount_to_burn }; - ensures coin.value == old(coin).value - amount_to_burn; - } - - spec fun collectedFeesAggregator(): AggregatableCoin { - global(@aptos_framework).amount - } - - spec schema RequiresCollectedFeesPerValueLeqBlockAptosSupply { - use aptos_framework::optional_aggregator; - use aptos_framework::aggregator; - let maybe_supply = coin::get_coin_supply_opt(); - // property 6: Ensure the presence of the resource. - requires - (is_fees_collection_enabled() && option::is_some(maybe_supply)) ==> - (aggregator::spec_aggregator_get_val(global(@aptos_framework).amount.value) <= - optional_aggregator::optional_aggregator_value( - option::spec_borrow(coin::get_coin_supply_opt()) - )); - } - - spec schema ProcessCollectedFeesRequiresAndEnsures { - use aptos_framework::coin::CoinInfo; - use aptos_framework::aptos_coin::AptosCoin; - use aptos_framework::aggregator; - use aptos_std::table; - - requires exists(@aptos_framework); - requires exists(@aptos_framework); - requires exists>(@aptos_framework); - include RequiresCollectedFeesPerValueLeqBlockAptosSupply; - - aborts_if false; - - let collected_fees = global(@aptos_framework); - let post post_collected_fees = global(@aptos_framework); - let pre_amount = aggregator::spec_aggregator_get_val(collected_fees.amount.value); - let post post_amount = aggregator::spec_aggregator_get_val(post_collected_fees.amount.value); - let fees_table = global(@aptos_framework).fees_table; - let post post_fees_table = global(@aptos_framework).fees_table; - let proposer = option::spec_borrow(collected_fees.proposer); - let fee_to_add = pre_amount - pre_amount * collected_fees.burn_percentage / 100; - ensures is_fees_collection_enabled() ==> option::spec_is_none(post_collected_fees.proposer) && post_amount == 0; - ensures is_fees_collection_enabled() && aggregator::spec_read(collected_fees.amount.value) > 0 && - option::spec_is_some(collected_fees.proposer) ==> - if (proposer != @vm_reserved) { - if (table::spec_contains(fees_table, proposer)) { - table::spec_get(post_fees_table, proposer).value == table::spec_get( - fees_table, - proposer - ).value + fee_to_add - } else { - table::spec_get(post_fees_table, proposer).value == fee_to_add - } - } else { - option::spec_is_none(post_collected_fees.proposer) && post_amount == 0 - }; - } - - spec process_collected_fees() { - /// [high-level-req-6.2] - include ProcessCollectedFeesRequiresAndEnsures; } /// `AptosCoinCapabilities` should be exists. @@ -259,28 +134,6 @@ spec aptos_framework::transaction_fee { ensures post_supply == supply + refund; } - spec collect_fee(account: address, fee: u64) { - use aptos_framework::aggregator; - - let collected_fees = global(@aptos_framework).amount; - let aggr = collected_fees.value; - let coin_store = global>(account); - aborts_if !exists(@aptos_framework); - aborts_if fee > 0 && !exists>(account); - aborts_if fee > 0 && coin_store.coin.value < fee; - aborts_if fee > 0 && aggregator::spec_aggregator_get_val(aggr) - + fee > aggregator::spec_get_limit(aggr); - aborts_if fee > 0 && aggregator::spec_aggregator_get_val(aggr) - + fee > MAX_U128; - - let post post_coin_store = global>(account); - let post post_collected_fees = global(@aptos_framework).amount; - ensures post_coin_store.coin.value == coin_store.coin.value - fee; - ensures aggregator::spec_aggregator_get_val(post_collected_fees.value) == aggregator::spec_aggregator_get_val( - aggr - ) + fee; - } - /// Ensure caller is admin. /// Aborts if `AptosCoinCapabilities` already exists. spec store_aptos_coin_burn_cap(aptos_framework: &signer, burn_cap: BurnCapability) { diff --git a/aptos-move/framework/aptos-framework/sources/transaction_validation.move b/aptos-move/framework/aptos-framework/sources/transaction_validation.move index 1997aafdb7b4f..dd1d86031a650 100644 --- a/aptos-move/framework/aptos-framework/sources/transaction_validation.move +++ b/aptos-move/framework/aptos-framework/sources/transaction_validation.move @@ -279,20 +279,7 @@ module aptos_framework::transaction_validation { error::out_of_range(PROLOGUE_ECANT_PAY_GAS_DEPOSIT), ); - let amount_to_burn = if (features::collect_and_distribute_gas_fees()) { - // TODO(gas): We might want to distinguish the refundable part of the charge and burn it or track - // it separately, so that we don't increase the total supply by refunding. - - // If transaction fees are redistributed to validators, collect them here for - // later redistribution. - transaction_fee::collect_fee(gas_payer, transaction_fee_amount); - 0 - } else { - // Otherwise, just burn the fee. - // TODO: this branch should be removed completely when transaction fee collection - // is tested and is fully proven to work well. - transaction_fee_amount - }; + let amount_to_burn = transaction_fee_amount; if (amount_to_burn > storage_fee_refunded) { let burn_amount = amount_to_burn - storage_fee_refunded; diff --git a/aptos-move/framework/aptos-framework/sources/transaction_validation.spec.move b/aptos-move/framework/aptos-framework/sources/transaction_validation.spec.move index cc5d0ce6f2624..0bbe95287ff59 100644 --- a/aptos-move/framework/aptos-framework/sources/transaction_validation.spec.move +++ b/aptos-move/framework/aptos-framework/sources/transaction_validation.spec.move @@ -285,23 +285,14 @@ spec aptos_framework::transaction_validation { // Check fee collection. - let collect_fee_enabled = features::spec_is_enabled(features::COLLECT_AND_DISTRIBUTE_GAS_FEES); let collected_fees = global(@aptos_framework).amount; let aggr = collected_fees.value; let aggr_val = aggregator::spec_aggregator_get_val(aggr); let aggr_lim = aggregator::spec_get_limit(aggr); - /// [high-level-req-3] - aborts_if collect_fee_enabled && !exists(@aptos_framework); - aborts_if collect_fee_enabled && transaction_fee_amount > 0 && aggr_val + transaction_fee_amount > aggr_lim; - // Check burning. // (Check the total supply aggregator when enabled.) - let amount_to_burn= if (collect_fee_enabled) { - 0 - } else { - transaction_fee_amount - storage_fee_refunded - }; + let amount_to_burn= transaction_fee_amount - storage_fee_refunded; let apt_addr = type_info::type_of().account_address; let maybe_apt_supply = global>(apt_addr).supply; let total_supply_enabled = option::spec_is_some(maybe_apt_supply); @@ -317,11 +308,7 @@ spec aptos_framework::transaction_validation { ensures total_supply_enabled ==> apt_supply_value - amount_to_burn == post_apt_supply_value; // Check minting. - let amount_to_mint = if (collect_fee_enabled) { - storage_fee_refunded - } else { - storage_fee_refunded - transaction_fee_amount - }; + let amount_to_mint = storage_fee_refunded - transaction_fee_amount; let total_supply = coin::supply; let post post_total_supply = coin::supply; diff --git a/aptos-move/framework/move-stdlib/doc/features.md b/aptos-move/framework/move-stdlib/doc/features.md index 1f0eb063083bd..fd5628e7c75c8 100644 --- a/aptos-move/framework/move-stdlib/doc/features.md +++ b/aptos-move/framework/move-stdlib/doc/features.md @@ -318,17 +318,6 @@ Lifetime: transient - - -Whether gas fees are collected and distributed to the block proposers. -Lifetime: transient - - -
const COLLECT_AND_DISTRIBUTE_GAS_FEES: u64 = 6;
-
- - - Whether the operator commission rate change in delegation pool is enabled. @@ -958,6 +947,7 @@ Lifetime: transient ## Function `get_collect_and_distribute_gas_fees_feature` +Deprecated feature
public fun get_collect_and_distribute_gas_fees_feature(): u64
@@ -969,7 +959,7 @@ Lifetime: transient
 Implementation
 
 
-
public fun get_collect_and_distribute_gas_fees_feature(): u64 { COLLECT_AND_DISTRIBUTE_GAS_FEES }
+
public fun get_collect_and_distribute_gas_fees_feature(): u64 { abort error::invalid_argument(EINVALID_FEATURE) }
 
@@ -991,8 +981,8 @@ Lifetime: transient Implementation -
public fun collect_and_distribute_gas_fees(): bool acquires Features {
-    is_enabled(COLLECT_AND_DISTRIBUTE_GAS_FEES)
+
public fun collect_and_distribute_gas_fees(): bool {
+    false
 }
 
@@ -3032,17 +3022,6 @@ Helper to check whether a feature flag is enabled. - - - -
fun spec_collect_and_distribute_gas_fees_enabled(): bool {
-   spec_is_enabled(COLLECT_AND_DISTRIBUTE_GAS_FEES)
-}
-
- - - - diff --git a/aptos-move/framework/move-stdlib/sources/configs/features.move b/aptos-move/framework/move-stdlib/sources/configs/features.move index 8f4e511b915cc..4b5b96360d843 100644 --- a/aptos-move/framework/move-stdlib/sources/configs/features.move +++ b/aptos-move/framework/move-stdlib/sources/configs/features.move @@ -77,12 +77,10 @@ module std::features { is_enabled(VM_BINARY_FORMAT_V6) } - /// Whether gas fees are collected and distributed to the block proposers. - /// Lifetime: transient - const COLLECT_AND_DISTRIBUTE_GAS_FEES: u64 = 6; - public fun get_collect_and_distribute_gas_fees_feature(): u64 { COLLECT_AND_DISTRIBUTE_GAS_FEES } - public fun collect_and_distribute_gas_fees(): bool acquires Features { - is_enabled(COLLECT_AND_DISTRIBUTE_GAS_FEES) + /// Deprecated feature + public fun get_collect_and_distribute_gas_fees_feature(): u64 { abort error::invalid_argument(EINVALID_FEATURE) } + public fun collect_and_distribute_gas_fees(): bool { + false } /// Whether the new `aptos_stdlib::multi_ed25519::public_key_validate_internal_v2()` native is enabled. diff --git a/aptos-move/framework/move-stdlib/sources/configs/features.spec.move b/aptos-move/framework/move-stdlib/sources/configs/features.spec.move index 1246a616d8489..6a5a52763df0d 100644 --- a/aptos-move/framework/move-stdlib/sources/configs/features.spec.move +++ b/aptos-move/framework/move-stdlib/sources/configs/features.spec.move @@ -66,10 +66,6 @@ spec std::features { spec_is_enabled(FEE_PAYER_ENABLED) } - spec fun spec_collect_and_distribute_gas_fees_enabled(): bool { - spec_is_enabled(COLLECT_AND_DISTRIBUTE_GAS_FEES) - } - spec fun spec_module_event_enabled(): bool { spec_is_enabled(MODULE_EVENT) } diff --git a/types/src/on_chain_config/aptos_features.rs b/types/src/on_chain_config/aptos_features.rs index e31a0ab736c0f..68c4e23c77089 100644 --- a/types/src/on_chain_config/aptos_features.rs +++ b/types/src/on_chain_config/aptos_features.rs @@ -17,7 +17,7 @@ pub enum FeatureFlag { SHA_512_AND_RIPEMD_160_NATIVES = 3, APTOS_STD_CHAIN_ID_NATIVES = 4, VM_BINARY_FORMAT_V6 = 5, - COLLECT_AND_DISTRIBUTE_GAS_FEES = 6, + _DEPRECATED_COLLECT_AND_DISTRIBUTE_GAS_FEES = 6, MULTI_ED25519_PK_VALIDATE_V2_NATIVES = 7, BLAKE2B_256_NATIVE = 8, RESOURCE_GROUPS = 9,