Skip to content

Commit

Permalink
Cargo fmt pass
Browse files Browse the repository at this point in the history
  • Loading branch information
sydhds committed Oct 9, 2024
1 parent 9fd2ee4 commit ddbef5e
Showing 1 changed file with 245 additions and 51 deletions.
296 changes: 245 additions & 51 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,76 +248,270 @@ impl GasCosts {
impl Default for GasCosts {
fn default() -> Self {
let mut abi_costs = HashMap::new();
// Note: use try_insert to notify devs for duplicated abi/gas_costs
// Note: use try_insert to notify devs for duplicated abi/gas_costs
// this will panic in unit tests
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_address_from_public_key"), 147);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_validate_address"), 4);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_append_data"), 162);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_append_data_for"), 200);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_create_sc"), 160);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_delete_data"), 78);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_delete_data_for"), 120);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_generate_event"), 36);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_balance"), 4);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_balance_for"), 41);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_call_coins"), 9);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_call_stack"), 56);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_address_from_public_key"),
147,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_validate_address"),
4,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_append_data"),
162,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_append_data_for"),
200,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_create_sc"),
160,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_delete_data"),
78,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_delete_data_for"),
120,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_generate_event"),
36,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_balance"),
4,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_balance_for"),
41,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_call_coins"),
9,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_call_stack"),
56,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_data"), 85);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_data_for"), 139);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_data_for"),
139,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_keys"), 26);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_keys_for"), 48);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_op_data"), 71);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_op_keys"), 138);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_op_keys_prefix"), 138);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_owned_addresses"), 52);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_remaining_gas"), 7);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_keys_for"),
48,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_op_data"),
71,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_op_keys"),
138,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_op_keys_prefix"),
138,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_owned_addresses"),
52,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_remaining_gas"),
7,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_time"), 4);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_has_data"), 69);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_has_data_for"), 115);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_has_op_key"), 78);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_has_data_for"),
115,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_has_op_key"),
78,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_hash"), 83);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_hash_sha256"), 83);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_keccak256_hash"), 83);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_hash_sha256"),
83,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_keccak256_hash"),
83,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_print"), 35);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_send_message"), 316);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_origin_operation_id"), 200);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_set_bytecode"), 74);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_set_bytecode_for"), 129);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_set_data"), 158);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_set_data_for"), 165);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_signature_verify"), 98);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_evm_signature_verify"), 264);
GasCosts::try_insert(&mut abi_costs,
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_send_message"),
316,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_origin_operation_id"),
200,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_set_bytecode"),
74,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_set_bytecode_for"),
129,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_set_data"),
158,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_set_data_for"),
165,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_signature_verify"),
98,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_evm_signature_verify"),
264,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_evm_get_address_from_pubkey"),
11,
);
GasCosts::try_insert(&mut abi_costs,
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_evm_get_pubkey_from_signature"),
11,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_is_address_eoa"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_transfer_coins"), 62);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_transfer_coins_for"), 102);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_unsafe_random"), 11);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_is_address_eoa"),
11,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_transfer_coins"),
62,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_transfer_coins_for"),
102,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_unsafe_random"),
11,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_call"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_local_call"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_local_execution"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_bytecode"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_bytecode_for"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_caller_has_write_access"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_function_exists"), 11);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_local_call"),
11,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_local_execution"),
11,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_bytecode"),
11,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_bytecode_for"),
11,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_caller_has_write_access"),
11,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_function_exists"),
11,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_seed"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_abort"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_date_now"), 11);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_console_log"), 36); // same cost as for generate_event
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_console_info"), 36);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_console_debug"), 36);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_console_warn"), 36);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_console_error"), 36);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_console_log"),
36,
); // same cost as for generate_event
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_console_info"),
36,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_console_debug"),
36,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_console_warn"),
36,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_console_error"),
36,
);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_trace"), 36);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_chain_id"), 9);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_current_period"), 157);
GasCosts::try_insert(&mut abi_costs, String::from("assembly_script_get_current_thread"), 154);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_current_period"),
157,
);
GasCosts::try_insert(
&mut abi_costs,
String::from("assembly_script_get_current_thread"),
154,
);
Self {
abi_costs,
operator_cost: 1,
Expand Down

0 comments on commit ddbef5e

Please sign in to comment.