Skip to content

Commit

Permalink
revert flat vm fee (MystenLabs#5458)
Browse files Browse the repository at this point in the history
* revert flat vm fee while we make it easier for users
  • Loading branch information
oxade authored Oct 21, 2022
1 parent 77f769c commit f471bed
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 44 deletions.
2 changes: 1 addition & 1 deletion crates/sui-cluster-test/src/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl FaucetClient for LocalFaucetClient {
async fn request_sui_coins(&self, request_address: SuiAddress) -> FaucetResponse {
let receipt = self
.simple_faucet
.send(Uuid::new_v4(), request_address, &[100000; 5])
.send(Uuid::new_v4(), request_address, &[200000; 5])
.await
.unwrap_or_else(|err| panic!("Failed to get gas tokens with error: {}", err));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl TestCaseImpl for CallContractTest {
type_args,
args,
Some(*gas_obj.id()),
5000
20000
];

let data = ctx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl CoinMergeSplitTest {
coin_to_merge: ObjectID,
gas_obj_id: ObjectID,
) -> (SuiCertifiedTransaction, SuiTransactionEffects) {
let params = rpc_params![signer, primary_coin, coin_to_merge, Some(gas_obj_id), 5000];
let params = rpc_params![signer, primary_coin, coin_to_merge, Some(gas_obj_id), 20000];

let data = ctx
.build_transaction_remotely("sui_mergeCoins", params)
Expand All @@ -135,7 +135,7 @@ impl CoinMergeSplitTest {
amounts: Vec<u64>,
gas_obj_id: ObjectID,
) -> (SuiCertifiedTransaction, SuiTransactionEffects) {
let params = rpc_params![signer, primary_coin, amounts, Some(gas_obj_id), 5000];
let params = rpc_params![signer, primary_coin, amounts, Some(gas_obj_id), 20000];

let data = ctx
.build_transaction_remotely("sui_splitCoin", params)
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-config/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,14 @@ fn process_package(
&modules,
package_id,
natives,
&mut gas_status.create_move_gas_status(),
gas_status.create_move_gas_status(),
)?;
adapter::store_package_and_init_modules(
&mut temporary_store,
&vm,
modules,
ctx,
&mut gas_status.create_move_gas_status(),
gas_status.create_move_gas_status(),
)?;

let (
Expand Down Expand Up @@ -574,7 +574,7 @@ pub fn generate_genesis_system_object(
CallArg::Pure(bcs::to_bytes(&stakes).unwrap()),
CallArg::Pure(bcs::to_bytes(&gas_prices).unwrap()),
],
&mut SuiGasStatus::new_unmetered().create_move_gas_status(),
SuiGasStatus::new_unmetered().create_move_gas_status(),
genesis_ctx,
)?;

Expand Down
6 changes: 3 additions & 3 deletions crates/sui-core/src/execution_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fn execute_transaction<S: BackingPackageStore + ParentSync + ChildObjectResolver
&function,
type_arguments,
arguments,
&mut gas_status.create_move_gas_status(),
gas_status.create_move_gas_status(),
tx_ctx,
)
}
Expand All @@ -195,7 +195,7 @@ fn execute_transaction<S: BackingPackageStore + ParentSync + ChildObjectResolver
native_functions.clone(),
modules,
tx_ctx,
&mut gas_status.create_move_gas_status(),
gas_status.create_move_gas_status(),
)
}
SingleTransactionKind::Pay(Pay {
Expand Down Expand Up @@ -238,7 +238,7 @@ fn execute_transaction<S: BackingPackageStore + ParentSync + ChildObjectResolver
CallArg::Pure(bcs::to_bytes(&computation_charge).unwrap()),
CallArg::Pure(bcs::to_bytes(&storage_rebate).unwrap()),
],
&mut gas_status.create_move_gas_status(),
gas_status.create_move_gas_status(),
tx_ctx,
)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-cost-tables/src/bytecode_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use move_binary_format::{
};

/// VM flat fee
pub const VM_FLAT_FEE: Gas = Gas::new(2_000);
pub const VM_FLAT_FEE: Gas = Gas::new(8_000);

/// The size in bytes for a non-string or address constant on the stack
pub const CONST_SIZE: AbstractMemorySize = AbstractMemorySize::new(16);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ expression: common_costs_estimate
---
{
"MergeCoin": {
"computation_cost": 7239,
"computation_cost": 5239,
"storage_cost": 7731,
"storage_rebate": 0
},
"Publish": {
"computation_cost": 7228,
"computation_cost": 5228,
"storage_cost": 7666,
"storage_rebate": 0
},
"SharedCounterAssertValue": {
"computation_cost": 2683,
"computation_cost": 683,
"storage_cost": 833,
"storage_rebate": 0
},
"SharedCounterCreate": {
"computation_cost": 2562,
"computation_cost": 562,
"storage_cost": 802,
"storage_rebate": 0
},
"SharedCounterIncrement": {
"computation_cost": 2683,
"computation_cost": 683,
"storage_cost": 833,
"storage_rebate": 0
},
"SplitCoin": {
"computation_cost": 7217,
"computation_cost": 5217,
"storage_cost": 7699,
"storage_rebate": 0
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ expression: common_costs_actual
---
{
"MergeCoin": {
"computation_cost": 2621,
"computation_cost": 634,
"storage_cost": 32,
"storage_rebate": 0
},
"Publish": {
"computation_cost": 2657,
"computation_cost": 691,
"storage_cost": 83,
"storage_rebate": 0
},
"SharedCounterAssertValue": {
"computation_cost": 2197,
"computation_cost": 198,
"storage_cost": 31,
"storage_rebate": 15
},
"SharedCounterCreate": {
"computation_cost": 2088,
"computation_cost": 109,
"storage_cost": 31,
"storage_rebate": 0
},
"SharedCounterIncrement": {
"computation_cost": 2197,
"computation_cost": 198,
"storage_cost": 31,
"storage_rebate": 15
},
"SplitCoin": {
"computation_cost": 2632,
"computation_cost": 762,
"storage_cost": 80,
"storage_rebate": 0
},
Expand Down
14 changes: 6 additions & 8 deletions crates/sui-types/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{
ops::{Add, Deref, Mul},
};
use sui_cost_tables::{
bytecode_tables::{GasStatus, INITIAL_COST_SCHEDULE, VM_FLAT_FEE},
bytecode_tables::{GasStatus, INITIAL_COST_SCHEDULE},
non_execution_tables::{
BASE_TX_COST_FIXED, CONSENSUS_COST, MAXIMUM_TX_GAS, OBJ_ACCESS_COST_MUTATE_PER_BYTE,
OBJ_ACCESS_COST_READ_PER_BYTE, OBJ_DATA_COST_REFUNDABLE, PACKAGE_PUBLISH_COST_PER_BYTE,
Expand Down Expand Up @@ -210,16 +210,14 @@ impl<'a> SuiGasStatus<'a> {
!self.charge
}

pub fn create_move_gas_status(&mut self) -> GasStatus<'a> {
if self.charge {
GasStatus::new(&INITIAL_COST_SCHEDULE, VM_FLAT_FEE)
} else {
GasStatus::new_unmetered()
}
pub fn create_move_gas_status(&mut self) -> &mut GasStatus<'a> {
&mut self.gas_status
}

pub fn charge_vm_gas(&mut self) -> Result<(), ExecutionError> {
self.deduct_computation_cost(&VM_FLAT_FEE.to_unit())
// Disable flat fee for now
// self.deduct_computation_cost(&VM_FLAT_FEE.to_unit())
Ok(())
}

pub fn charge_min_tx_gas(&mut self) -> Result<(), ExecutionError> {
Expand Down
20 changes: 10 additions & 10 deletions crates/sui/src/unit_tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ async fn test_move_call_args_linter_command() -> Result<(), anyhow::Error> {
package_path,
build_config,
gas: Some(gas_obj_id),
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await?;
Expand Down Expand Up @@ -402,7 +402,7 @@ async fn test_move_call_args_linter_command() -> Result<(), anyhow::Error> {
type_args: vec![],
args,
gas: None,
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await?;
Expand Down Expand Up @@ -442,7 +442,7 @@ async fn test_move_call_args_linter_command() -> Result<(), anyhow::Error> {
type_args: vec![],
args: args.to_vec(),
gas: Some(gas),
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await;
Expand All @@ -466,7 +466,7 @@ async fn test_move_call_args_linter_command() -> Result<(), anyhow::Error> {
type_args: vec![],
args: args.to_vec(),
gas: Some(gas),
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await;
Expand All @@ -491,7 +491,7 @@ async fn test_move_call_args_linter_command() -> Result<(), anyhow::Error> {
type_args: vec![],
args: args.to_vec(),
gas: Some(gas),
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await?;
Expand Down Expand Up @@ -523,7 +523,7 @@ async fn test_package_publish_command() -> Result<(), anyhow::Error> {
package_path,
build_config,
gas: Some(gas_obj_id),
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await?;
Expand Down Expand Up @@ -910,7 +910,7 @@ async fn test_merge_coin() -> Result<(), anyhow::Error> {
primary_coin,
coin_to_merge,
gas: Some(gas),
gas_budget: 10_000,
gas_budget: 20_000,
}
.execute(context)
.await?;
Expand Down Expand Up @@ -1015,7 +1015,7 @@ async fn test_split_coin() -> Result<(), anyhow::Error> {
// Test with gas specified
let resp = SuiClientCommands::SplitCoin {
gas: Some(gas),
gas_budget: 10_000,
gas_budget: 20_000,
coin_id: coin,
amounts: Some(vec![1000, 10]),
count: None,
Expand Down Expand Up @@ -1071,7 +1071,7 @@ async fn test_split_coin() -> Result<(), anyhow::Error> {
// Test split coin into equal parts
let resp = SuiClientCommands::SplitCoin {
gas: None,
gas_budget: 10_000,
gas_budget: 20_000,
coin_id: coin,
amounts: None,
count: Some(3),
Expand Down Expand Up @@ -1130,7 +1130,7 @@ async fn test_split_coin() -> Result<(), anyhow::Error> {
// Test with no gas specified
let resp = SuiClientCommands::SplitCoin {
gas: None,
gas_budget: 10_000,
gas_budget: 20_000,
coin_id: coin,
amounts: Some(vec![1000, 10]),
count: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/test-utils/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use sui_types::object::Object;
use sui_types::object::Owner;

/// The maximum gas per transaction.
pub const MAX_GAS: u64 = 50_000;
pub const MAX_GAS: u64 = 100_000;

pub fn random_object_ref() -> ObjectRef {
(
Expand Down
2 changes: 1 addition & 1 deletion nft_mirror/oracle_server/src/airdrop/airdropService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { NFTFetcher, NFTInfo } from '../common/nftFetcher';
import { ValidateError } from 'tsoa';
import { Connection } from '../sdk/gateway';

const DEFAULT_GAS_BUDGET = 10000;
const DEFAULT_GAS_BUDGET = 20000;

interface AirdropClaimInfo {
/**
Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/test/e2e/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const DEFAULT_FULLNODE_URL = 'http://127.0.0.1:9000';

export const DEFAULT_RECIPIENT = '0x36096be6a0314052931babed39f53c0666a6b0df';
export const DEFAULT_RECIPIENT_2 = '0x46096be6a0314052931babed39f53c0666a6b0da';
export const DEFAULT_GAS_BUDGET = 10000;
export const DEFAULT_GAS_BUDGET = 20000;

export const SUI_SYSTEM_STATE_OBJECT_ID =
'0x0000000000000000000000000000000000000005';
Expand Down

0 comments on commit f471bed

Please sign in to comment.