Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storag
task 4, lines 40-42:
//# run Test::M1::delete_n_ids --args 2048 --gas-budget 100000000000000
mutated: object(0,0)
gas summary: computation_cost: 5000000, computation_cost_burned: 5000000, storage_cost: 980400, storage_rebate: 980400, non_refundable_storage_fee: 0
gas summary: computation_cost: 19000000, computation_cost_burned: 19000000, storage_cost: 980400, storage_rebate: 980400, non_refundable_storage_fee: 0

task 5, lines 43-45:
//# run Test::M1::delete_n_ids --args 2049 --gas-budget 100000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ task 3, lines 60-62:
//# run Test::M1::emit_n_small_events --args 1024 --gas-budget 100000000000000 --summarize
events: 50
mutated: 1
gas summary: computation_cost: 3000000, computation_cost_burned: 3000000, storage_cost: 980400, storage_rebate: 980400, non_refundable_storage_fee: 0
gas summary: computation_cost: 53000000, computation_cost_burned: 53000000, storage_cost: 980400, storage_rebate: 980400, non_refundable_storage_fee: 0

task 4, lines 63-65:
//# run Test::M1::emit_n_small_events --args 1025 --gas-budget 100000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storag
task 4, lines 41-43:
//# run Test::M1::create_n_ids --args 2048 --gas-budget 100000000000000
mutated: object(0,0)
gas summary: computation_cost: 5000000, computation_cost_burned: 5000000, storage_cost: 980400, storage_rebate: 980400, non_refundable_storage_fee: 0
gas summary: computation_cost: 19000000, computation_cost_burned: 19000000, storage_cost: 980400, storage_rebate: 980400, non_refundable_storage_fee: 0

task 5, lines 44-46:
//# run Test::M1::create_n_ids --args 2049 --gas-budget 100000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ task 3, line 31:
//# run a::m::add_n_items --sender A --args 1000 --gas-budget 1000000000000 --summarize
created: 2000
mutated: 1
gas summary: computation_cost: 7000000, computation_cost_burned: 7000000, storage_cost: 2676180400, storage_rebate: 980400, non_refundable_storage_fee: 0
gas summary: computation_cost: 198000000, computation_cost_burned: 198000000, storage_cost: 2676180400, storage_rebate: 980400, non_refundable_storage_fee: 0

task 4, line 33:
//# run a::m::add_n_items --sender A --args 1025 --gas-budget 1000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ task 4, lines 40-42:
//# run Test::M1::transfer_n_ids --args 2048 --gas-budget 100000000000000 --summarize
created: 2048
mutated: 1
gas summary: computation_cost: 4000000, computation_cost_burned: 4000000, storage_cost: 2506913200, storage_rebate: 980400, non_refundable_storage_fee: 0
gas summary: computation_cost: 17000000, computation_cost_burned: 17000000, storage_cost: 2506913200, storage_rebate: 980400, non_refundable_storage_fee: 0

task 5, lines 43-45:
//# run Test::M1::transfer_n_ids --args 2049 --gas-budget 100000000000000
Expand Down
1 change: 1 addition & 0 deletions crates/iota-framework-tests/tests/move_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub(crate) fn tests(path: &Path) -> datatest_stable::Result<()> {
config.config.lint_flag = LintFlag::LEVEL_DEFAULT;

let move_config = config.config.clone();
// TODO: Remove this when we support per-test gas limits.
let mut testing_config = UnitTestingConfig::default_with_bound(Some(3_000_000));
testing_config.filter = std::env::var("FILTER").ok().map(|s| s.to_string());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ module iota::bls12381_tests {
// Sum with random terms
let mut gen = random::new_generator_for_testing();
let mut elements = vector[];
let mut i = 2001;
let mut i = 1201;
while (i > 0) {
let scalar = bls12381::scalar_from_u64(gen.generate_u64());
let element = bls12381::g1_mul(&scalar, &bls12381::g1_generator());
Expand Down
1 change: 1 addition & 0 deletions crates/iota-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@
"enable_poseidon": true,
"enable_vdf": true,
"hardened_otw_check": true,
"native_charging_v2": false,
"no_extraneous_module_bytes": true,
"passkey_auth": true,
"relocate_event_module": false,
Expand Down
105 changes: 93 additions & 12 deletions crates/iota-protocol-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ pub const MAX_PROTOCOL_VERSION: u64 = 5;
//
// Version 1: Original version.
// Version 2: Don't redistribute slashed staking rewards, fix computation of
// SystemEpochInfoEventV1.
// SystemEpochInfoEventV1.
// Version 3: Set the `relocate_event_module` to be true so that the module that
// is associated as the "sending module" for an event is relocated by linkage.
// Add `Clock` based unlock to `Timelock` objects.
// is associated as the "sending module" for an event is relocated by
// linkage.
// Add `Clock` based unlock to `Timelock` objects.
// Version 4: Introduce the `max_type_to_layout_nodes` config that sets the
// maximal nodes which are allowed when converting to a type layout.
// Version 5: Disallow adding new modules in `deps-only` packages. Enable proper
// conversion of certain type argument errors in the execution layer using the
// `convert_type_argument_error` function, which is now used in all cases.
// maximal nodes which are allowed when converting to a type layout.
// Version 5: Disallow adding new modules in `deps-only` packages.
// Add new gas model version to update charging of native functions.
// Enable proper conversion of certain type argument errors in the
// execution layer.

#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct ProtocolVersion(u64);
Expand Down Expand Up @@ -205,6 +207,10 @@ struct FeatureFlags {
#[serde(skip_serializing_if = "is_false")]
disallow_new_modules_in_deps_only_packages: bool,

// Enable v2 native charging for natives.
#[serde(skip_serializing_if = "is_false")]
native_charging_v2: bool,

// Properly convert certain type argument errors in the execution layer.
#[serde(skip_serializing_if = "is_false")]
convert_type_argument_error: bool,
Expand Down Expand Up @@ -1110,6 +1116,10 @@ impl ProtocolConfig {
self.feature_flags
.disallow_new_modules_in_deps_only_packages
}

pub fn native_charging_v2(&self) -> bool {
self.feature_flags.native_charging_v2
}
}

#[cfg(not(msim))]
Expand Down Expand Up @@ -1715,15 +1725,86 @@ impl ProtocolConfig {
5 => {
cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
cfg.feature_flags.convert_type_argument_error = true;
cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
cfg.feature_flags.native_charging_v2 = true;

if chain != Chain::Mainnet && chain != Chain::Testnet {
cfg.feature_flags.uncompressed_g1_group_elements = true;
}

cfg.gas_model_version = Some(2);

cfg.poseidon_bn254_cost_per_block = Some(388);

cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
cfg.ed25519_ed25519_verify_cost_base = Some(1802);

// Manually changed to be "under cost"
cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);

cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
Some(8213);
cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
Some(9484);

cfg.hash_keccak256_cost_base = Some(10);
cfg.hash_blake2b256_cost_base = Some(10);

// group ops
cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
cfg.group_ops_bls12381_decode_gt_cost = Some(3068);

cfg.group_ops_bls12381_scalar_add_cost = Some(10);
cfg.group_ops_bls12381_g1_add_cost = Some(1556);
cfg.group_ops_bls12381_g2_add_cost = Some(3048);
cfg.group_ops_bls12381_gt_add_cost = Some(188);

cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
cfg.group_ops_bls12381_gt_sub_cost = Some(497);

cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
cfg.group_ops_bls12381_gt_mul_cost = Some(27490);

cfg.group_ops_bls12381_scalar_div_cost = Some(91);
cfg.group_ops_bls12381_g1_div_cost = Some(5091);
cfg.group_ops_bls12381_g2_div_cost = Some(9206);
cfg.group_ops_bls12381_gt_div_cost = Some(27804);

cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);

cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);

cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);

cfg.group_ops_bls12381_pairing_cost = Some(26897);

cfg.validator_validate_metadata_cost_base = Some(20000);
}
// Use this template when making changes:
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ feature_flags:
zklogin_max_epoch_upper_bound_delta: 30
relocate_event_module: true
disallow_new_modules_in_deps_only_packages: true
native_charging_v2: true
convert_type_argument_error: true
max_tx_size_bytes: 131072
max_input_objects: 2048
Expand Down Expand Up @@ -88,7 +89,7 @@ obj_access_cost_mutate_per_byte: 40
obj_access_cost_delete_per_byte: 40
obj_access_cost_verify_per_byte: 200
max_type_to_layout_nodes: 512
gas_model_version: 1
gas_model_version: 2
obj_data_cost_refundable: 100
obj_metadata_cost_non_refundable: 50
storage_rebate_rate: 10000
Expand Down Expand Up @@ -136,94 +137,95 @@ tx_context_derive_id_cost_base: 52
types_is_one_time_witness_cost_base: 52
types_is_one_time_witness_type_tag_cost_per_byte: 2
types_is_one_time_witness_type_cost_per_byte: 2
validator_validate_metadata_cost_base: 52
validator_validate_metadata_cost_base: 20000
validator_validate_metadata_data_cost_per_byte: 2
crypto_invalid_arguments_cost: 100
bls12381_bls12381_min_sig_verify_cost_base: 52
bls12381_bls12381_min_sig_verify_cost_base: 44064
bls12381_bls12381_min_sig_verify_msg_cost_per_byte: 2
bls12381_bls12381_min_sig_verify_msg_cost_per_block: 2
bls12381_bls12381_min_pk_verify_cost_base: 52
bls12381_bls12381_min_pk_verify_cost_base: 49282
bls12381_bls12381_min_pk_verify_msg_cost_per_byte: 2
bls12381_bls12381_min_pk_verify_msg_cost_per_block: 2
ecdsa_k1_ecrecover_keccak256_cost_base: 52
ecdsa_k1_ecrecover_keccak256_cost_base: 500
ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: 2
ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: 2
ecdsa_k1_ecrecover_sha256_cost_base: 52
ecdsa_k1_ecrecover_sha256_cost_base: 500
ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: 2
ecdsa_k1_ecrecover_sha256_msg_cost_per_block: 2
ecdsa_k1_decompress_pubkey_cost_base: 52
ecdsa_k1_secp256k1_verify_keccak256_cost_base: 52
ecdsa_k1_secp256k1_verify_keccak256_cost_base: 1470
ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: 2
ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: 2
ecdsa_k1_secp256k1_verify_sha256_cost_base: 52
ecdsa_k1_secp256k1_verify_sha256_cost_base: 1470
ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: 2
ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: 2
ecdsa_r1_ecrecover_keccak256_cost_base: 52
ecdsa_r1_ecrecover_keccak256_cost_base: 1173
ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: 2
ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: 2
ecdsa_r1_ecrecover_sha256_cost_base: 52
ecdsa_r1_ecrecover_sha256_cost_base: 1173
ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: 2
ecdsa_r1_ecrecover_sha256_msg_cost_per_block: 2
ecdsa_r1_secp256r1_verify_keccak256_cost_base: 52
ecdsa_r1_secp256r1_verify_keccak256_cost_base: 4225
ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: 2
ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: 2
ecdsa_r1_secp256r1_verify_sha256_cost_base: 52
ecdsa_r1_secp256r1_verify_sha256_cost_base: 4225
ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: 2
ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: 2
ecvrf_ecvrf_verify_cost_base: 52
ecvrf_ecvrf_verify_cost_base: 4848
ecvrf_ecvrf_verify_alpha_string_cost_per_byte: 2
ecvrf_ecvrf_verify_alpha_string_cost_per_block: 2
ed25519_ed25519_verify_cost_base: 52
ed25519_ed25519_verify_cost_base: 1802
ed25519_ed25519_verify_msg_cost_per_byte: 2
ed25519_ed25519_verify_msg_cost_per_block: 2
groth16_prepare_verifying_key_bls12381_cost_base: 52
groth16_prepare_verifying_key_bn254_cost_base: 52
groth16_verify_groth16_proof_internal_bls12381_cost_base: 52
groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: 2
groth16_verify_groth16_proof_internal_bn254_cost_base: 52
groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: 2
groth16_prepare_verifying_key_bls12381_cost_base: 53838
groth16_prepare_verifying_key_bn254_cost_base: 82010
groth16_verify_groth16_proof_internal_bls12381_cost_base: 72090
groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: 8213
groth16_verify_groth16_proof_internal_bn254_cost_base: 115502
groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: 9484
groth16_verify_groth16_proof_internal_public_input_cost_per_byte: 2
hash_blake2b256_cost_base: 52
hash_blake2b256_cost_base: 10
hash_blake2b256_data_cost_per_byte: 2
hash_blake2b256_data_cost_per_block: 2
hash_keccak256_cost_base: 52
hash_keccak256_cost_base: 10
hash_keccak256_data_cost_per_byte: 2
hash_keccak256_data_cost_per_block: 2
group_ops_bls12381_decode_scalar_cost: 52
group_ops_bls12381_decode_g1_cost: 52
group_ops_bls12381_decode_g2_cost: 52
group_ops_bls12381_decode_gt_cost: 52
group_ops_bls12381_scalar_add_cost: 52
group_ops_bls12381_g1_add_cost: 52
group_ops_bls12381_g2_add_cost: 52
group_ops_bls12381_gt_add_cost: 52
group_ops_bls12381_scalar_sub_cost: 52
group_ops_bls12381_g1_sub_cost: 52
group_ops_bls12381_g2_sub_cost: 52
group_ops_bls12381_gt_sub_cost: 52
group_ops_bls12381_scalar_mul_cost: 52
group_ops_bls12381_g1_mul_cost: 52
group_ops_bls12381_g2_mul_cost: 52
group_ops_bls12381_gt_mul_cost: 52
group_ops_bls12381_scalar_div_cost: 52
group_ops_bls12381_g1_div_cost: 52
group_ops_bls12381_g2_div_cost: 52
group_ops_bls12381_gt_div_cost: 52
group_ops_bls12381_g1_hash_to_base_cost: 52
group_ops_bls12381_g2_hash_to_base_cost: 52
poseidon_bn254_cost_per_block: 388
group_ops_bls12381_decode_scalar_cost: 7
group_ops_bls12381_decode_g1_cost: 2848
group_ops_bls12381_decode_g2_cost: 3770
group_ops_bls12381_decode_gt_cost: 3068
group_ops_bls12381_scalar_add_cost: 10
group_ops_bls12381_g1_add_cost: 1556
group_ops_bls12381_g2_add_cost: 3048
group_ops_bls12381_gt_add_cost: 188
group_ops_bls12381_scalar_sub_cost: 10
group_ops_bls12381_g1_sub_cost: 1550
group_ops_bls12381_g2_sub_cost: 3019
group_ops_bls12381_gt_sub_cost: 497
group_ops_bls12381_scalar_mul_cost: 11
group_ops_bls12381_g1_mul_cost: 4842
group_ops_bls12381_g2_mul_cost: 9108
group_ops_bls12381_gt_mul_cost: 27490
group_ops_bls12381_scalar_div_cost: 91
group_ops_bls12381_g1_div_cost: 5091
group_ops_bls12381_g2_div_cost: 9206
group_ops_bls12381_gt_div_cost: 27804
group_ops_bls12381_g1_hash_to_base_cost: 2962
group_ops_bls12381_g2_hash_to_base_cost: 8688
group_ops_bls12381_g1_hash_to_cost_per_byte: 2
group_ops_bls12381_g2_hash_to_cost_per_byte: 2
group_ops_bls12381_g1_msm_base_cost: 52
group_ops_bls12381_g2_msm_base_cost: 52
group_ops_bls12381_g1_msm_base_cost_per_input: 52
group_ops_bls12381_g2_msm_base_cost_per_input: 52
group_ops_bls12381_g1_msm_base_cost: 62648
group_ops_bls12381_g2_msm_base_cost: 131192
group_ops_bls12381_g1_msm_base_cost_per_input: 1333
group_ops_bls12381_g2_msm_base_cost_per_input: 3216
group_ops_bls12381_msm_max_len: 32
group_ops_bls12381_pairing_cost: 52
group_ops_bls12381_g1_to_uncompressed_g1_cost: 26
group_ops_bls12381_uncompressed_g1_to_g1_cost: 52
group_ops_bls12381_uncompressed_g1_sum_base_cost: 26
group_ops_bls12381_uncompressed_g1_sum_cost_per_term: 13
group_ops_bls12381_uncompressed_g1_sum_max_terms: 2000
group_ops_bls12381_pairing_cost: 26897
group_ops_bls12381_g1_to_uncompressed_g1_cost: 2099
group_ops_bls12381_uncompressed_g1_to_g1_cost: 677
group_ops_bls12381_uncompressed_g1_sum_base_cost: 77
group_ops_bls12381_uncompressed_g1_sum_cost_per_term: 26
group_ops_bls12381_uncompressed_g1_sum_max_terms: 1200
hmac_hmac_sha3_256_cost_base: 52
hmac_hmac_sha3_256_input_cost_per_byte: 2
hmac_hmac_sha3_256_input_cost_per_block: 2
Expand Down
Loading