diff --git a/crates/sui-adapter-transactional-tests/tests/size_limits/deleted_id_limits_tests.exp b/crates/sui-adapter-transactional-tests/tests/size_limits/deleted_id_limits_tests.exp index 947e802f4cea4..325ce4d40dc3f 100644 --- a/crates/sui-adapter-transactional-tests/tests/size_limits/deleted_id_limits_tests.exp +++ b/crates/sui-adapter-transactional-tests/tests/size_limits/deleted_id_limits_tests.exp @@ -19,14 +19,14 @@ gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 9 task 4, lines 39-41: //# run Test::M1::delete_n_ids --args 2048 --gas-budget 100000000000000 mutated: object(0,0) -gas summary: computation_cost: 19000000, storage_cost: 988000, storage_rebate: 978120, non_refundable_storage_fee: 9880 +gas summary: computation_cost: 28000000, storage_cost: 988000, storage_rebate: 978120, non_refundable_storage_fee: 9880 task 5, lines 42-44: //# run Test::M1::delete_n_ids --args 2049 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } task 6, line 45: //# run Test::M1::delete_n_ids --args 4096 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } diff --git a/crates/sui-adapter-transactional-tests/tests/size_limits/new_id_limits_tests.exp b/crates/sui-adapter-transactional-tests/tests/size_limits/new_id_limits_tests.exp index 666ff568bd40c..ee59ccb8b42fb 100644 --- a/crates/sui-adapter-transactional-tests/tests/size_limits/new_id_limits_tests.exp +++ b/crates/sui-adapter-transactional-tests/tests/size_limits/new_id_limits_tests.exp @@ -19,14 +19,14 @@ gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 9 task 4, lines 40-42: //# run Test::M1::create_n_ids --args 2048 --gas-budget 100000000000000 mutated: object(0,0) -gas summary: computation_cost: 19000000, storage_cost: 988000, storage_rebate: 978120, non_refundable_storage_fee: 9880 +gas summary: computation_cost: 28000000, storage_cost: 988000, storage_rebate: 978120, non_refundable_storage_fee: 9880 task 5, lines 43-45: //# run Test::M1::create_n_ids --args 2049 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } task 6, line 46: //# run Test::M1::create_n_ids --args 4096 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } diff --git a/crates/sui-adapter-transactional-tests/tests/size_limits/object_runtime_limits.exp b/crates/sui-adapter-transactional-tests/tests/size_limits/object_runtime_limits.exp index e632db82a1eba..65e0ee98bc679 100644 --- a/crates/sui-adapter-transactional-tests/tests/size_limits/object_runtime_limits.exp +++ b/crates/sui-adapter-transactional-tests/tests/size_limits/object_runtime_limits.exp @@ -19,7 +19,7 @@ task 3, line 30: //# run a::m::add_n_items --sender A --args 1000 --gas-budget 1000000000000 --summarize created: 2000 mutated: 1 -gas summary: computation_cost: 198000000, storage_cost: 2691388000, storage_rebate: 978120, non_refundable_storage_fee: 9880 +gas summary: computation_cost: 209000000, storage_cost: 2691388000, storage_rebate: 978120, non_refundable_storage_fee: 9880 task 4, line 32: //# run a::m::add_n_items --sender A --args 1025 --gas-budget 1000000000000 diff --git a/crates/sui-adapter-transactional-tests/tests/size_limits/transfered_id_limits_tests.exp b/crates/sui-adapter-transactional-tests/tests/size_limits/transfered_id_limits_tests.exp index 35a37afa35791..8d2c0431d396b 100644 --- a/crates/sui-adapter-transactional-tests/tests/size_limits/transfered_id_limits_tests.exp +++ b/crates/sui-adapter-transactional-tests/tests/size_limits/transfered_id_limits_tests.exp @@ -22,24 +22,24 @@ task 4, lines 39-41: //# run Test::M1::transfer_n_ids --args 2048 --gas-budget 100000000000000 --summarize created: 2048 mutated: 1 -gas summary: computation_cost: 17000000, storage_cost: 2522485600, storage_rebate: 978120, non_refundable_storage_fee: 9880 +gas summary: computation_cost: 33000000, storage_cost: 2522485600, storage_rebate: 978120, non_refundable_storage_fee: 9880 task 5, lines 42-44: //# run Test::M1::transfer_n_ids --args 2049 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } task 6, lines 45-47: //# run Test::M1::transfer_n_ids --args 4096 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } task 7, lines 48-50: //# run Test::M1::transfer_n_ids --args 2049 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } task 8, line 51: //# run Test::M1::transfer_n_ids --args 4096 --gas-budget 100000000000000 -Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 6) at offset 0. Arithmetic error, stack overflow, max value depth, etc. -Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 6, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(6), 0)] }), command: Some(0) } } +Error: Transaction Effects Status: Move Primitive Runtime Error. Location: sui::tx_context::derive_id (function index 8) at offset 0. Arithmetic error, stack overflow, max value depth, etc. +Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(MoveLocationOpt(Some(MoveLocation { module: ModuleId { address: sui, name: Identifier("tx_context") }, function: 8, instruction: 0, function_name: Some("derive_id") }))), source: Some(VMError { major_status: MEMORY_LIMIT_EXCEEDED, sub_status: Some(2), message: Some("Creating more than 2048 IDs is not allowed"), exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("tx_context") }), indices: [], offsets: [(FunctionDefinitionIndex(8), 0)] }), command: Some(0) } } diff --git a/crates/sui-framework/docs/sui/tx_context.md b/crates/sui-framework/docs/sui/tx_context.md index 6d0ee6c248f3f..49ca4fda033ff 100644 --- a/crates/sui-framework/docs/sui/tx_context.md +++ b/crates/sui-framework/docs/sui/tx_context.md @@ -5,16 +5,28 @@ title: Module `sui::tx_context` - [Struct `TxContext`](#sui_tx_context_TxContext) +- [Constants](#@Constants_0) - [Function `sender`](#sui_tx_context_sender) - [Function `digest`](#sui_tx_context_digest) - [Function `epoch`](#sui_tx_context_epoch) - [Function `epoch_timestamp_ms`](#sui_tx_context_epoch_timestamp_ms) +- [Function `sponsor`](#sui_tx_context_sponsor) - [Function `fresh_object_address`](#sui_tx_context_fresh_object_address) +- [Function `increment_ids_created`](#sui_tx_context_increment_ids_created) - [Function `ids_created`](#sui_tx_context_ids_created) - [Function `derive_id`](#sui_tx_context_derive_id) +- [Function `native_sender`](#sui_tx_context_native_sender) +- [Function `native_digest`](#sui_tx_context_native_digest) +- [Function `native_epoch`](#sui_tx_context_native_epoch) +- [Function `native_epoch_timestamp_ms`](#sui_tx_context_native_epoch_timestamp_ms) +- [Function `native_sponsor`](#sui_tx_context_native_sponsor) +- [Function `native_ids_created`](#sui_tx_context_native_ids_created) +- [Function `native_inc_ids_created`](#sui_tx_context_native_inc_ids_created) -
+
use std::option;
+use std::vector;
+
@@ -73,6 +85,29 @@ the VM and passed in to the entrypoint of the transaction as &mut < + + +## Constants + + + + + + +
const EUnsupportedFunction: u64 = 2;
+
+ + + + + + + +
const NATIVE_CONTEXT: bool = false;
+
+ + + ## Function `sender` @@ -91,7 +126,11 @@ transaction
public fun sender(self: &TxContext): address {
-    self.sender
+    if (NATIVE_CONTEXT) {
+        native_sender()
+    } else {
+        self.sender
+    }
 }
 
@@ -117,7 +156,11 @@ Please do not use as a source of randomness.
public fun digest(self: &TxContext): &vector<u8> {
-    &self.tx_hash
+    if (NATIVE_CONTEXT) {
+        native_digest()
+    } else {
+        &self.tx_hash
+    }
 }
 
@@ -142,7 +185,11 @@ Return the current epoch
public fun epoch(self: &TxContext): u64 {
-    self.epoch
+    if (NATIVE_CONTEXT) {
+        native_epoch()
+    } else {
+        self.epoch
+    }
 }
 
@@ -167,7 +214,36 @@ Return the epoch start time as a unix timestamp in milliseconds.
public fun epoch_timestamp_ms(self: &TxContext): u64 {
-    self.epoch_timestamp_ms
+    if (NATIVE_CONTEXT) {
+        native_epoch_timestamp_ms()
+    } else {
+        self.epoch_timestamp_ms
+    }
+}
+
+ + + + + + + +## Function `sponsor` + + + +
public fun sponsor(_self: &sui::tx_context::TxContext): std::option::Option<address>
+
+ + + +
+Implementation + + +
public fun sponsor(_self: &TxContext): Option<address> {
+    assert!(NATIVE_CONTEXT, EUnsupportedFunction);
+    native_sponsor()
 }
 
@@ -194,15 +270,43 @@ In other words, the generated address is a globally unique object ID.
public fun fresh_object_address(ctx: &mut TxContext): address {
-    let ids_created = ctx.ids_created;
-    let id = derive_id(*&ctx.tx_hash, ids_created);
-    ctx.ids_created = ids_created + 1;
+    let ids_created = ctx.ids_created();
+    let id = derive_id(*ctx.digest(), ids_created);
+    ctx.increment_ids_created();
     id
 }
 
+
+ + + +## Function `increment_ids_created` + + + +
fun increment_ids_created(self: &mut sui::tx_context::TxContext)
+
+ + + +
+Implementation + + +
fun increment_ids_created(self: &mut TxContext) {
+    if (NATIVE_CONTEXT) {
+        self.native_inc_ids_created()
+    } else {
+        self.ids_created = self.ids_created + 1
+    }
+}
+
+ + +
@@ -223,7 +327,11 @@ Hidden for now, but may expose later
fun ids_created(self: &TxContext): u64 {
-    self.ids_created
+    if (NATIVE_CONTEXT) {
+        native_ids_created()
+    } else {
+        self.ids_created
+    }
 }
 
@@ -252,4 +360,158 @@ Native function for deriving an ID via hash(tx_hash || ids_created) + + + + +## Function `native_sender` + + + +
fun native_sender(): address
+
+ + + +
+Implementation + + +
native fun native_sender(): address;
+
+ + + +
+ + + +## Function `native_digest` + + + +
fun native_digest(): &vector<u8>
+
+ + + +
+Implementation + + +
native fun native_digest(): &vector<u8>;
+
+ + + +
+ + + +## Function `native_epoch` + + + +
fun native_epoch(): u64
+
+ + + +
+Implementation + + +
native fun native_epoch(): u64;
+
+ + + +
+ + + +## Function `native_epoch_timestamp_ms` + + + +
fun native_epoch_timestamp_ms(): u64
+
+ + + +
+Implementation + + +
native fun native_epoch_timestamp_ms(): u64;
+
+ + + +
+ + + +## Function `native_sponsor` + + + +
fun native_sponsor(): std::option::Option<address>
+
+ + + +
+Implementation + + +
native fun native_sponsor(): Option<address>;
+
+ + + +
+ + + +## Function `native_ids_created` + + + +
fun native_ids_created(): u64
+
+ + + +
+Implementation + + +
native fun native_ids_created(): u64;
+
+ + + +
+ + + +## Function `native_inc_ids_created` + + + +
fun native_inc_ids_created(self: &mut sui::tx_context::TxContext)
+
+ + + +
+Implementation + + +
native fun native_inc_ids_created(self: &mut TxContext);
+
+ + +
diff --git a/crates/sui-framework/packages/sui-framework/sources/tx_context.move b/crates/sui-framework/packages/sui-framework/sources/tx_context.move index 1fdef9ff83a81..f7ed0ba5df03d 100644 --- a/crates/sui-framework/packages/sui-framework/sources/tx_context.move +++ b/crates/sui-framework/packages/sui-framework/sources/tx_context.move @@ -15,6 +15,10 @@ const EBadTxHashLength: u64 = 0; /// Attempt to get the most recent created object ID when none has been created. const ENoIDsCreated: u64 = 1; +const NATIVE_CONTEXT: bool = false; + +const EUnsupportedFunction: u64 = 2; + /// Information about the transaction currently being executed. /// This cannot be constructed by a transaction--it is a privileged object created by /// the VM and passed in to the entrypoint of the transaction as `&mut TxContext`. @@ -35,45 +39,92 @@ public struct TxContext has drop { /// Return the address of the user that signed the current /// transaction public fun sender(self: &TxContext): address { - self.sender + if (NATIVE_CONTEXT) { + native_sender() + } else { + self.sender + } } /// Return the transaction digest (hash of transaction inputs). /// Please do not use as a source of randomness. public fun digest(self: &TxContext): &vector { - &self.tx_hash + if (NATIVE_CONTEXT) { + native_digest() + } else { + &self.tx_hash + } } /// Return the current epoch public fun epoch(self: &TxContext): u64 { - self.epoch + if (NATIVE_CONTEXT) { + native_epoch() + } else { + self.epoch + } } /// Return the epoch start time as a unix timestamp in milliseconds. public fun epoch_timestamp_ms(self: &TxContext): u64 { - self.epoch_timestamp_ms + if (NATIVE_CONTEXT) { + native_epoch_timestamp_ms() + } else { + self.epoch_timestamp_ms + } +} + +public fun sponsor(_self: &TxContext): Option
{ + assert!(NATIVE_CONTEXT, EUnsupportedFunction); + native_sponsor() } /// Create an `address` that has not been used. As it is an object address, it will never /// occur as the address for a user. /// In other words, the generated address is a globally unique object ID. public fun fresh_object_address(ctx: &mut TxContext): address { - let ids_created = ctx.ids_created; - let id = derive_id(*&ctx.tx_hash, ids_created); - ctx.ids_created = ids_created + 1; + let ids_created = ctx.ids_created(); + let id = derive_id(*ctx.digest(), ids_created); + ctx.increment_ids_created(); id } +fun increment_ids_created(self: &mut TxContext) { + if (NATIVE_CONTEXT) { + self.native_inc_ids_created() + } else { + self.ids_created = self.ids_created + 1 + } +} + #[allow(unused_function)] /// Return the number of id's created by the current transaction. /// Hidden for now, but may expose later fun ids_created(self: &TxContext): u64 { - self.ids_created + if (NATIVE_CONTEXT) { + native_ids_created() + } else { + self.ids_created + } } /// Native function for deriving an ID via hash(tx_hash || ids_created) native fun derive_id(tx_hash: vector, ids_created: u64): address; +native fun native_sender(): address; + +native fun native_digest(): &vector; + +native fun native_epoch(): u64; + +native fun native_epoch_timestamp_ms(): u64; + +native fun native_sponsor(): Option
; + +native fun native_ids_created(): u64; + +native fun native_inc_ids_created(self: &mut TxContext); + // ==== test-only functions ==== #[test_only] @@ -86,7 +137,19 @@ public fun new( ids_created: u64, ): TxContext { assert!(tx_hash.length() == TX_HASH_LENGTH, EBadTxHashLength); - TxContext { sender, tx_hash, epoch, epoch_timestamp_ms, ids_created } + if (NATIVE_CONTEXT) { + native_replace(sender, tx_hash, epoch, epoch_timestamp_ms, ids_created); + // return an empty TxContext given all the info is held on the native side (call above) + TxContext { + sender: @0x0, + tx_hash: vector::empty(), + epoch: 0, + epoch_timestamp_ms: 0, + ids_created: 0, + } + } else { + TxContext { sender, tx_hash, epoch, epoch_timestamp_ms, ids_created } + } } #[test_only] @@ -125,17 +188,40 @@ public fun get_ids_created(self: &TxContext): u64 { #[test_only] /// Return the most recent created object ID. public fun last_created_object_id(self: &TxContext): address { - let ids_created = self.ids_created; + let ids_created = self.ids_created(); assert!(ids_created > 0, ENoIDsCreated); - derive_id(*&self.tx_hash, ids_created - 1) + derive_id(*self.digest(), ids_created - 1) } #[test_only] public fun increment_epoch_number(self: &mut TxContext) { - self.epoch = self.epoch + 1 + if (NATIVE_CONTEXT) { + native_inc_epoch() + } else { + self.epoch = self.epoch + 1 + } } #[test_only] public fun increment_epoch_timestamp(self: &mut TxContext, delta_ms: u64) { - self.epoch_timestamp_ms = self.epoch_timestamp_ms + delta_ms + if (NATIVE_CONTEXT) { + native_inc_epoch_timestamp(delta_ms) + } else { + self.epoch_timestamp_ms = self.epoch_timestamp_ms + delta_ms + } } + +#[test_only] +native fun native_inc_epoch(); + +#[test_only] +native fun native_inc_epoch_timestamp(delta_ms: u64); + +#[test_only] +native fun native_replace( + sender: address, + tx_hash: vector, + epoch: u64, + epoch_timestamp_ms: u64, + ids_created: u64, +); diff --git a/crates/sui-framework/packages_compiled/sui-framework b/crates/sui-framework/packages_compiled/sui-framework index e008cceb39c5a..54b12807e6d3a 100644 Binary files a/crates/sui-framework/packages_compiled/sui-framework and b/crates/sui-framework/packages_compiled/sui-framework differ diff --git a/crates/sui-framework/published_api.txt b/crates/sui-framework/published_api.txt index 775880de57e60..595917c6933c6 100644 --- a/crates/sui-framework/published_api.txt +++ b/crates/sui-framework/published_api.txt @@ -1129,15 +1129,42 @@ epoch epoch_timestamp_ms public fun 0x2::tx_context +sponsor + public fun + 0x2::tx_context fresh_object_address public fun 0x2::tx_context +increment_ids_created + fun + 0x2::tx_context ids_created fun 0x2::tx_context derive_id fun 0x2::tx_context +native_sender + fun + 0x2::tx_context +native_digest + fun + 0x2::tx_context +native_epoch + fun + 0x2::tx_context +native_epoch_timestamp_ms + fun + 0x2::tx_context +native_sponsor + fun + 0x2::tx_context +native_ids_created + fun + 0x2::tx_context +native_inc_ids_created + fun + 0x2::tx_context ID public struct 0x2::object diff --git a/crates/sui-open-rpc/spec/openrpc.json b/crates/sui-open-rpc/spec/openrpc.json index ee507825cdd8d..591f269445b5b 100644 --- a/crates/sui-open-rpc/spec/openrpc.json +++ b/crates/sui-open-rpc/spec/openrpc.json @@ -1294,7 +1294,7 @@ "name": "Result", "value": { "minSupportedProtocolVersion": "1", - "maxSupportedProtocolVersion": "72", + "maxSupportedProtocolVersion": "73", "protocolVersion": "6", "featureFlags": { "accept_zklogin_in_multisig": false, diff --git a/crates/sui-protocol-config/src/lib.rs b/crates/sui-protocol-config/src/lib.rs index 89f2d2a106810..09467ce8de0e0 100644 --- a/crates/sui-protocol-config/src/lib.rs +++ b/crates/sui-protocol-config/src/lib.rs @@ -18,7 +18,7 @@ use tracing::{info, warn}; /// The minimum and maximum protocol versions supported by this build. const MIN_PROTOCOL_VERSION: u64 = 1; -const MAX_PROTOCOL_VERSION: u64 = 72; +const MAX_PROTOCOL_VERSION: u64 = 73; // Record history of protocol version allocations here: // @@ -208,6 +208,7 @@ const MAX_PROTOCOL_VERSION: u64 = 72; // Max gas budget moved to 50_000 SUI // Max gas price moved to 50 SUI // Variants as type nodes. +// Version 73: Native TxContext in Move. #[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub struct ProtocolVersion(u64); @@ -3150,6 +3151,7 @@ impl ProtocolConfig { cfg.feature_flags.variant_nodes = true; } + 73 => {} // Use this template when making changes: // // // modify an existing constant. diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_73.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_73.snap new file mode 100644 index 0000000000000..5c37db126aa5c --- /dev/null +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_73.snap @@ -0,0 +1,346 @@ +--- +source: crates/sui-protocol-config/src/lib.rs +expression: "ProtocolConfig::get_for_version(cur, *chain_id)" +--- +version: 73 +feature_flags: + package_upgrades: true + commit_root_state_digest: true + advance_epoch_start_time_in_safe_mode: true + loaded_child_objects_fixed: true + missing_type_is_compatibility_error: true + scoring_decision_with_validity_cutoff: true + consensus_order_end_of_epoch_last: true + disallow_adding_abilities_on_upgrade: true + disable_invariant_violation_check_in_swap_loc: true + advance_to_highest_supported_protocol_version: true + ban_entry_init: true + package_digest_hash_module: true + disallow_change_struct_type_params_on_upgrade: true + no_extraneous_module_bytes: true + narwhal_versioned_metadata: true + zklogin_auth: true + consensus_transaction_ordering: ByGasPrice + simplified_unwrap_then_delete: true + upgraded_multisig_supported: true + txn_base_cost_as_multiplier: true + shared_object_deletion: true + narwhal_new_leader_election_schedule: true + loaded_child_object_format: true + enable_jwk_consensus_updates: true + end_of_epoch_transaction_supported: true + simple_conservation_checks: true + loaded_child_object_format_type: true + receive_objects: true + random_beacon: true + bridge: true + enable_effects_v2: true + narwhal_certificate_v2: true + verify_legacy_zklogin_address: true + recompute_has_public_transfer_in_execution: true + accept_zklogin_in_multisig: true + include_consensus_digest_in_prologue: true + hardened_otw_check: true + allow_receiving_object_id: true + enable_coin_deny_list: true + enable_group_ops_native_functions: true + reject_mutable_random_on_entry_functions: true + per_object_congestion_control_mode: TotalGasBudgetWithCap + consensus_choice: Mysticeti + consensus_network: Tonic + zklogin_max_epoch_upper_bound_delta: 30 + mysticeti_leader_scoring_and_schedule: true + reshare_at_same_initial_version: true + resolve_abort_locations_to_package_id: true + mysticeti_use_committed_subdag_digest: true + record_consensus_determined_version_assignments_in_prologue: true + fresh_vm_on_framework_upgrade: true + prepend_prologue_tx_in_consensus_commit_in_checkpoints: true + mysticeti_num_leaders_per_round: 1 + soft_bundle: true + enable_coin_deny_list_v2: true + rethrow_serialization_type_layout_errors: true + consensus_distributed_vote_scoring_strategy: true + consensus_round_prober: true + validate_identifier_inputs: true + relocate_event_module: true + disallow_new_modules_in_deps_only_packages: true + native_charging_v2: true + convert_type_argument_error: true + variant_nodes: true +max_tx_size_bytes: 131072 +max_input_objects: 2048 +max_size_written_objects: 5000000 +max_size_written_objects_system_tx: 50000000 +max_serialized_tx_effects_size_bytes: 524288 +max_serialized_tx_effects_size_bytes_system_tx: 8388608 +max_gas_payment_objects: 256 +max_modules_in_publish: 64 +max_package_dependencies: 32 +max_arguments: 512 +max_type_arguments: 16 +max_type_argument_depth: 16 +max_pure_argument_size: 16384 +max_programmable_tx_commands: 1024 +move_binary_format_version: 7 +min_move_binary_format_version: 6 +binary_module_handles: 100 +binary_struct_handles: 300 +binary_function_handles: 1500 +binary_function_instantiations: 750 +binary_signatures: 1000 +binary_constant_pool: 4000 +binary_identifiers: 10000 +binary_address_identifiers: 100 +binary_struct_defs: 200 +binary_struct_def_instantiations: 100 +binary_function_defs: 1000 +binary_field_handles: 500 +binary_field_instantiations: 250 +binary_friend_decls: 100 +max_move_object_size: 256000 +max_move_package_size: 102400 +max_publish_or_upgrade_per_ptb: 5 +max_tx_gas: 50000000000000 +max_gas_price: 50000000000 +max_gas_computation_bucket: 5000000 +gas_rounding_step: 1000 +max_loop_depth: 5 +max_generic_instantiation_length: 32 +max_function_parameters: 128 +max_basic_blocks: 1024 +max_value_stack_size: 1024 +max_type_nodes: 256 +max_push_size: 10000 +max_struct_definitions: 200 +max_function_definitions: 1000 +max_fields_in_struct: 32 +max_dependency_depth: 100 +max_num_event_emit: 1024 +max_num_new_move_object_ids: 2048 +max_num_new_move_object_ids_system_tx: 32768 +max_num_deleted_move_object_ids: 2048 +max_num_deleted_move_object_ids_system_tx: 32768 +max_num_transferred_move_object_ids: 2048 +max_num_transferred_move_object_ids_system_tx: 32768 +max_event_emit_size: 256000 +max_event_emit_size_total: 65536000 +max_move_vector_len: 262144 +max_move_identifier_len: 128 +max_move_value_depth: 128 +max_back_edges_per_function: 10000 +max_back_edges_per_module: 10000 +max_verifier_meter_ticks_per_function: 16000000 +max_meter_ticks_per_module: 16000000 +max_meter_ticks_per_package: 16000000 +object_runtime_max_num_cached_objects: 1000 +object_runtime_max_num_cached_objects_system_tx: 16000 +object_runtime_max_num_store_entries: 1000 +object_runtime_max_num_store_entries_system_tx: 16000 +base_tx_cost_fixed: 1000 +package_publish_cost_fixed: 1000 +base_tx_cost_per_byte: 0 +package_publish_cost_per_byte: 80 +obj_access_cost_read_per_byte: 15 +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: 9 +obj_data_cost_refundable: 100 +obj_metadata_cost_non_refundable: 50 +storage_rebate_rate: 9900 +storage_fund_reinvest_rate: 500 +reward_slashing_rate: 10000 +storage_gas_price: 76 +max_transactions_per_checkpoint: 10000 +max_checkpoint_size_bytes: 31457280 +buffer_stake_for_protocol_upgrade_bps: 5000 +address_from_bytes_cost_base: 52 +address_to_u256_cost_base: 52 +address_from_u256_cost_base: 52 +config_read_setting_impl_cost_base: 100 +config_read_setting_impl_cost_per_byte: 40 +dynamic_field_hash_type_and_key_cost_base: 100 +dynamic_field_hash_type_and_key_type_cost_per_byte: 2 +dynamic_field_hash_type_and_key_value_cost_per_byte: 2 +dynamic_field_hash_type_and_key_type_tag_cost_per_byte: 2 +dynamic_field_add_child_object_cost_base: 100 +dynamic_field_add_child_object_type_cost_per_byte: 10 +dynamic_field_add_child_object_value_cost_per_byte: 10 +dynamic_field_add_child_object_struct_tag_cost_per_byte: 10 +dynamic_field_borrow_child_object_cost_base: 100 +dynamic_field_borrow_child_object_child_ref_cost_per_byte: 10 +dynamic_field_borrow_child_object_type_cost_per_byte: 10 +dynamic_field_remove_child_object_cost_base: 100 +dynamic_field_remove_child_object_child_cost_per_byte: 2 +dynamic_field_remove_child_object_type_cost_per_byte: 2 +dynamic_field_has_child_object_cost_base: 100 +dynamic_field_has_child_object_with_ty_cost_base: 100 +dynamic_field_has_child_object_with_ty_type_cost_per_byte: 2 +dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: 2 +event_emit_cost_base: 52 +event_emit_value_size_derivation_cost_per_byte: 2 +event_emit_tag_size_derivation_cost_per_byte: 5 +event_emit_output_cost_per_byte: 10 +object_borrow_uid_cost_base: 52 +object_delete_impl_cost_base: 52 +object_record_new_uid_cost_base: 52 +transfer_transfer_internal_cost_base: 52 +transfer_freeze_object_cost_base: 52 +transfer_share_object_cost_base: 52 +transfer_receive_object_cost_base: 52 +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: 20000 +validator_validate_metadata_data_cost_per_byte: 2 +crypto_invalid_arguments_cost: 100 +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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 4848 +ecvrf_ecvrf_verify_alpha_string_cost_per_byte: 2 +ecvrf_ecvrf_verify_alpha_string_cost_per_block: 2 +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: 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: 10 +hash_blake2b256_data_cost_per_byte: 2 +hash_blake2b256_data_cost_per_block: 2 +hash_keccak256_cost_base: 10 +hash_keccak256_data_cost_per_byte: 2 +hash_keccak256_data_cost_per_block: 2 +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: 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: 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 +check_zklogin_id_cost_base: 200 +check_zklogin_issuer_cost_base: 200 +bcs_per_byte_serialized_cost: 2 +bcs_legacy_min_output_size_cost: 1 +bcs_failure_cost: 52 +hash_sha2_256_base_cost: 52 +hash_sha2_256_per_byte_cost: 2 +hash_sha2_256_legacy_min_input_len_cost: 1 +hash_sha3_256_base_cost: 52 +hash_sha3_256_per_byte_cost: 2 +hash_sha3_256_legacy_min_input_len_cost: 1 +type_name_get_base_cost: 52 +type_name_get_per_byte_cost: 2 +string_check_utf8_base_cost: 52 +string_check_utf8_per_byte_cost: 2 +string_is_char_boundary_base_cost: 52 +string_sub_string_base_cost: 52 +string_sub_string_per_byte_cost: 2 +string_index_of_base_cost: 52 +string_index_of_per_byte_pattern_cost: 2 +string_index_of_per_byte_searched_cost: 2 +vector_empty_base_cost: 52 +vector_length_base_cost: 52 +vector_push_back_base_cost: 52 +vector_push_back_legacy_per_abstract_memory_unit_cost: 2 +vector_borrow_base_cost: 52 +vector_pop_back_base_cost: 52 +vector_destroy_empty_base_cost: 52 +vector_swap_base_cost: 52 +debug_print_base_cost: 52 +debug_print_stack_trace_base_cost: 52 +execution_version: 3 +consensus_bad_nodes_stake_threshold: 20 +max_jwk_votes_per_validator_per_epoch: 240 +max_age_of_jwk_in_epochs: 1 +random_beacon_reduction_allowed_delta: 800 +random_beacon_reduction_lower_bound: 500 +random_beacon_dkg_timeout_round: 3000 +random_beacon_min_round_interval_ms: 500 +random_beacon_dkg_version: 1 +consensus_max_transaction_size_bytes: 262144 +consensus_max_transactions_in_block_bytes: 524288 +consensus_max_num_transactions_in_block: 512 +consensus_voting_rounds: 40 +max_accumulated_txn_cost_per_object_in_narwhal_commit: 40 +max_deferral_rounds_for_congestion_control: 10 +max_txn_cost_overage_per_object_in_commit: 18446744073709551615 +allowed_txn_cost_overage_burst_per_object_in_commit: 185000000 +min_checkpoint_interval_ms: 200 +checkpoint_summary_version_specific_data: 1 +max_soft_bundle_size: 5 +bridge_should_try_to_finalize_committee: true +max_accumulated_txn_cost_per_object_in_mysticeti_commit: 18500000 +max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: 3700000 +gas_budget_based_txn_cost_cap_factor: 400000 +gas_budget_based_txn_cost_absolute_cap_commit_count: 50 +sip_45_consensus_amplification_threshold: 5 + diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_73.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_73.snap new file mode 100644 index 0000000000000..9c880adbc66f4 --- /dev/null +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_73.snap @@ -0,0 +1,349 @@ +--- +source: crates/sui-protocol-config/src/lib.rs +expression: "ProtocolConfig::get_for_version(cur, *chain_id)" +--- +version: 73 +feature_flags: + package_upgrades: true + commit_root_state_digest: true + advance_epoch_start_time_in_safe_mode: true + loaded_child_objects_fixed: true + missing_type_is_compatibility_error: true + scoring_decision_with_validity_cutoff: true + consensus_order_end_of_epoch_last: true + disallow_adding_abilities_on_upgrade: true + disable_invariant_violation_check_in_swap_loc: true + advance_to_highest_supported_protocol_version: true + ban_entry_init: true + package_digest_hash_module: true + disallow_change_struct_type_params_on_upgrade: true + no_extraneous_module_bytes: true + narwhal_versioned_metadata: true + zklogin_auth: true + consensus_transaction_ordering: ByGasPrice + simplified_unwrap_then_delete: true + upgraded_multisig_supported: true + txn_base_cost_as_multiplier: true + shared_object_deletion: true + narwhal_new_leader_election_schedule: true + loaded_child_object_format: true + enable_jwk_consensus_updates: true + end_of_epoch_transaction_supported: true + simple_conservation_checks: true + loaded_child_object_format_type: true + receive_objects: true + random_beacon: true + bridge: true + enable_effects_v2: true + narwhal_certificate_v2: true + verify_legacy_zklogin_address: true + recompute_has_public_transfer_in_execution: true + accept_zklogin_in_multisig: true + include_consensus_digest_in_prologue: true + hardened_otw_check: true + allow_receiving_object_id: true + enable_coin_deny_list: true + enable_group_ops_native_functions: true + reject_mutable_random_on_entry_functions: true + per_object_congestion_control_mode: TotalGasBudgetWithCap + consensus_choice: Mysticeti + consensus_network: Tonic + zklogin_max_epoch_upper_bound_delta: 30 + mysticeti_leader_scoring_and_schedule: true + reshare_at_same_initial_version: true + resolve_abort_locations_to_package_id: true + mysticeti_use_committed_subdag_digest: true + record_consensus_determined_version_assignments_in_prologue: true + fresh_vm_on_framework_upgrade: true + prepend_prologue_tx_in_consensus_commit_in_checkpoints: true + mysticeti_num_leaders_per_round: 1 + soft_bundle: true + enable_coin_deny_list_v2: true + rethrow_serialization_type_layout_errors: true + consensus_distributed_vote_scoring_strategy: true + consensus_round_prober: true + validate_identifier_inputs: true + relocate_event_module: true + uncompressed_g1_group_elements: true + disallow_new_modules_in_deps_only_packages: true + consensus_smart_ancestor_selection: true + consensus_round_prober_probe_accepted_rounds: true + native_charging_v2: true + convert_type_argument_error: true + variant_nodes: true +max_tx_size_bytes: 131072 +max_input_objects: 2048 +max_size_written_objects: 5000000 +max_size_written_objects_system_tx: 50000000 +max_serialized_tx_effects_size_bytes: 524288 +max_serialized_tx_effects_size_bytes_system_tx: 8388608 +max_gas_payment_objects: 256 +max_modules_in_publish: 64 +max_package_dependencies: 32 +max_arguments: 512 +max_type_arguments: 16 +max_type_argument_depth: 16 +max_pure_argument_size: 16384 +max_programmable_tx_commands: 1024 +move_binary_format_version: 7 +min_move_binary_format_version: 6 +binary_module_handles: 100 +binary_struct_handles: 300 +binary_function_handles: 1500 +binary_function_instantiations: 750 +binary_signatures: 1000 +binary_constant_pool: 4000 +binary_identifiers: 10000 +binary_address_identifiers: 100 +binary_struct_defs: 200 +binary_struct_def_instantiations: 100 +binary_function_defs: 1000 +binary_field_handles: 500 +binary_field_instantiations: 250 +binary_friend_decls: 100 +max_move_object_size: 256000 +max_move_package_size: 102400 +max_publish_or_upgrade_per_ptb: 5 +max_tx_gas: 50000000000000 +max_gas_price: 50000000000 +max_gas_computation_bucket: 5000000 +gas_rounding_step: 1000 +max_loop_depth: 5 +max_generic_instantiation_length: 32 +max_function_parameters: 128 +max_basic_blocks: 1024 +max_value_stack_size: 1024 +max_type_nodes: 256 +max_push_size: 10000 +max_struct_definitions: 200 +max_function_definitions: 1000 +max_fields_in_struct: 32 +max_dependency_depth: 100 +max_num_event_emit: 1024 +max_num_new_move_object_ids: 2048 +max_num_new_move_object_ids_system_tx: 32768 +max_num_deleted_move_object_ids: 2048 +max_num_deleted_move_object_ids_system_tx: 32768 +max_num_transferred_move_object_ids: 2048 +max_num_transferred_move_object_ids_system_tx: 32768 +max_event_emit_size: 256000 +max_event_emit_size_total: 65536000 +max_move_vector_len: 262144 +max_move_identifier_len: 128 +max_move_value_depth: 128 +max_back_edges_per_function: 10000 +max_back_edges_per_module: 10000 +max_verifier_meter_ticks_per_function: 16000000 +max_meter_ticks_per_module: 16000000 +max_meter_ticks_per_package: 16000000 +object_runtime_max_num_cached_objects: 1000 +object_runtime_max_num_cached_objects_system_tx: 16000 +object_runtime_max_num_store_entries: 1000 +object_runtime_max_num_store_entries_system_tx: 16000 +base_tx_cost_fixed: 1000 +package_publish_cost_fixed: 1000 +base_tx_cost_per_byte: 0 +package_publish_cost_per_byte: 80 +obj_access_cost_read_per_byte: 15 +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: 9 +obj_data_cost_refundable: 100 +obj_metadata_cost_non_refundable: 50 +storage_rebate_rate: 9900 +storage_fund_reinvest_rate: 500 +reward_slashing_rate: 10000 +storage_gas_price: 76 +max_transactions_per_checkpoint: 10000 +max_checkpoint_size_bytes: 31457280 +buffer_stake_for_protocol_upgrade_bps: 5000 +address_from_bytes_cost_base: 52 +address_to_u256_cost_base: 52 +address_from_u256_cost_base: 52 +config_read_setting_impl_cost_base: 100 +config_read_setting_impl_cost_per_byte: 40 +dynamic_field_hash_type_and_key_cost_base: 100 +dynamic_field_hash_type_and_key_type_cost_per_byte: 2 +dynamic_field_hash_type_and_key_value_cost_per_byte: 2 +dynamic_field_hash_type_and_key_type_tag_cost_per_byte: 2 +dynamic_field_add_child_object_cost_base: 100 +dynamic_field_add_child_object_type_cost_per_byte: 10 +dynamic_field_add_child_object_value_cost_per_byte: 10 +dynamic_field_add_child_object_struct_tag_cost_per_byte: 10 +dynamic_field_borrow_child_object_cost_base: 100 +dynamic_field_borrow_child_object_child_ref_cost_per_byte: 10 +dynamic_field_borrow_child_object_type_cost_per_byte: 10 +dynamic_field_remove_child_object_cost_base: 100 +dynamic_field_remove_child_object_child_cost_per_byte: 2 +dynamic_field_remove_child_object_type_cost_per_byte: 2 +dynamic_field_has_child_object_cost_base: 100 +dynamic_field_has_child_object_with_ty_cost_base: 100 +dynamic_field_has_child_object_with_ty_type_cost_per_byte: 2 +dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: 2 +event_emit_cost_base: 52 +event_emit_value_size_derivation_cost_per_byte: 2 +event_emit_tag_size_derivation_cost_per_byte: 5 +event_emit_output_cost_per_byte: 10 +object_borrow_uid_cost_base: 52 +object_delete_impl_cost_base: 52 +object_record_new_uid_cost_base: 52 +transfer_transfer_internal_cost_base: 52 +transfer_freeze_object_cost_base: 52 +transfer_share_object_cost_base: 52 +transfer_receive_object_cost_base: 52 +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: 20000 +validator_validate_metadata_data_cost_per_byte: 2 +crypto_invalid_arguments_cost: 100 +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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 4848 +ecvrf_ecvrf_verify_alpha_string_cost_per_byte: 2 +ecvrf_ecvrf_verify_alpha_string_cost_per_block: 2 +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: 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: 10 +hash_blake2b256_data_cost_per_byte: 2 +hash_blake2b256_data_cost_per_block: 2 +hash_keccak256_cost_base: 10 +hash_keccak256_data_cost_per_byte: 2 +hash_keccak256_data_cost_per_block: 2 +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: 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: 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 +check_zklogin_id_cost_base: 200 +check_zklogin_issuer_cost_base: 200 +bcs_per_byte_serialized_cost: 2 +bcs_legacy_min_output_size_cost: 1 +bcs_failure_cost: 52 +hash_sha2_256_base_cost: 52 +hash_sha2_256_per_byte_cost: 2 +hash_sha2_256_legacy_min_input_len_cost: 1 +hash_sha3_256_base_cost: 52 +hash_sha3_256_per_byte_cost: 2 +hash_sha3_256_legacy_min_input_len_cost: 1 +type_name_get_base_cost: 52 +type_name_get_per_byte_cost: 2 +string_check_utf8_base_cost: 52 +string_check_utf8_per_byte_cost: 2 +string_is_char_boundary_base_cost: 52 +string_sub_string_base_cost: 52 +string_sub_string_per_byte_cost: 2 +string_index_of_base_cost: 52 +string_index_of_per_byte_pattern_cost: 2 +string_index_of_per_byte_searched_cost: 2 +vector_empty_base_cost: 52 +vector_length_base_cost: 52 +vector_push_back_base_cost: 52 +vector_push_back_legacy_per_abstract_memory_unit_cost: 2 +vector_borrow_base_cost: 52 +vector_pop_back_base_cost: 52 +vector_destroy_empty_base_cost: 52 +vector_swap_base_cost: 52 +debug_print_base_cost: 52 +debug_print_stack_trace_base_cost: 52 +execution_version: 3 +consensus_bad_nodes_stake_threshold: 20 +max_jwk_votes_per_validator_per_epoch: 240 +max_age_of_jwk_in_epochs: 1 +random_beacon_reduction_allowed_delta: 800 +random_beacon_reduction_lower_bound: 500 +random_beacon_dkg_timeout_round: 3000 +random_beacon_min_round_interval_ms: 500 +random_beacon_dkg_version: 1 +consensus_max_transaction_size_bytes: 262144 +consensus_max_transactions_in_block_bytes: 524288 +consensus_max_num_transactions_in_block: 512 +consensus_voting_rounds: 40 +max_accumulated_txn_cost_per_object_in_narwhal_commit: 40 +max_deferral_rounds_for_congestion_control: 10 +max_txn_cost_overage_per_object_in_commit: 18446744073709551615 +allowed_txn_cost_overage_burst_per_object_in_commit: 185000000 +min_checkpoint_interval_ms: 200 +checkpoint_summary_version_specific_data: 1 +max_soft_bundle_size: 5 +bridge_should_try_to_finalize_committee: true +max_accumulated_txn_cost_per_object_in_mysticeti_commit: 18500000 +max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: 3700000 +gas_budget_based_txn_cost_cap_factor: 400000 +gas_budget_based_txn_cost_absolute_cap_commit_count: 50 +sip_45_consensus_amplification_threshold: 5 + diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_73.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_73.snap new file mode 100644 index 0000000000000..1e0daf95fc455 --- /dev/null +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_73.snap @@ -0,0 +1,358 @@ +--- +source: crates/sui-protocol-config/src/lib.rs +expression: "ProtocolConfig::get_for_version(cur, *chain_id)" +--- +version: 73 +feature_flags: + package_upgrades: true + commit_root_state_digest: true + advance_epoch_start_time_in_safe_mode: true + loaded_child_objects_fixed: true + missing_type_is_compatibility_error: true + scoring_decision_with_validity_cutoff: true + consensus_order_end_of_epoch_last: true + disallow_adding_abilities_on_upgrade: true + disable_invariant_violation_check_in_swap_loc: true + advance_to_highest_supported_protocol_version: true + ban_entry_init: true + package_digest_hash_module: true + disallow_change_struct_type_params_on_upgrade: true + no_extraneous_module_bytes: true + narwhal_versioned_metadata: true + zklogin_auth: true + consensus_transaction_ordering: ByGasPrice + simplified_unwrap_then_delete: true + upgraded_multisig_supported: true + txn_base_cost_as_multiplier: true + shared_object_deletion: true + narwhal_new_leader_election_schedule: true + loaded_child_object_format: true + enable_jwk_consensus_updates: true + end_of_epoch_transaction_supported: true + simple_conservation_checks: true + loaded_child_object_format_type: true + receive_objects: true + random_beacon: true + bridge: true + enable_effects_v2: true + narwhal_certificate_v2: true + verify_legacy_zklogin_address: true + recompute_has_public_transfer_in_execution: true + accept_zklogin_in_multisig: true + include_consensus_digest_in_prologue: true + hardened_otw_check: true + allow_receiving_object_id: true + enable_poseidon: true + enable_coin_deny_list: true + enable_group_ops_native_functions: true + enable_group_ops_native_function_msm: true + reject_mutable_random_on_entry_functions: true + per_object_congestion_control_mode: TotalGasBudgetWithCap + consensus_choice: Mysticeti + consensus_network: Tonic + zklogin_max_epoch_upper_bound_delta: 30 + mysticeti_leader_scoring_and_schedule: true + reshare_at_same_initial_version: true + resolve_abort_locations_to_package_id: true + mysticeti_use_committed_subdag_digest: true + enable_vdf: true + record_consensus_determined_version_assignments_in_prologue: true + fresh_vm_on_framework_upgrade: true + prepend_prologue_tx_in_consensus_commit_in_checkpoints: true + mysticeti_num_leaders_per_round: 1 + soft_bundle: true + enable_coin_deny_list_v2: true + passkey_auth: true + authority_capabilities_v2: true + rethrow_serialization_type_layout_errors: true + consensus_distributed_vote_scoring_strategy: true + consensus_round_prober: true + validate_identifier_inputs: true + mysticeti_fastpath: true + relocate_event_module: true + uncompressed_g1_group_elements: true + disallow_new_modules_in_deps_only_packages: true + consensus_smart_ancestor_selection: true + consensus_round_prober_probe_accepted_rounds: true + native_charging_v2: true + convert_type_argument_error: true + variant_nodes: true +max_tx_size_bytes: 131072 +max_input_objects: 2048 +max_size_written_objects: 5000000 +max_size_written_objects_system_tx: 50000000 +max_serialized_tx_effects_size_bytes: 524288 +max_serialized_tx_effects_size_bytes_system_tx: 8388608 +max_gas_payment_objects: 256 +max_modules_in_publish: 64 +max_package_dependencies: 32 +max_arguments: 512 +max_type_arguments: 16 +max_type_argument_depth: 16 +max_pure_argument_size: 16384 +max_programmable_tx_commands: 1024 +move_binary_format_version: 7 +min_move_binary_format_version: 6 +binary_module_handles: 100 +binary_struct_handles: 300 +binary_function_handles: 1500 +binary_function_instantiations: 750 +binary_signatures: 1000 +binary_constant_pool: 4000 +binary_identifiers: 10000 +binary_address_identifiers: 100 +binary_struct_defs: 200 +binary_struct_def_instantiations: 100 +binary_function_defs: 1000 +binary_field_handles: 500 +binary_field_instantiations: 250 +binary_friend_decls: 100 +max_move_object_size: 256000 +max_move_package_size: 102400 +max_publish_or_upgrade_per_ptb: 5 +max_tx_gas: 50000000000000 +max_gas_price: 50000000000 +max_gas_computation_bucket: 5000000 +gas_rounding_step: 1000 +max_loop_depth: 5 +max_generic_instantiation_length: 32 +max_function_parameters: 128 +max_basic_blocks: 1024 +max_value_stack_size: 1024 +max_type_nodes: 256 +max_push_size: 10000 +max_struct_definitions: 200 +max_function_definitions: 1000 +max_fields_in_struct: 32 +max_dependency_depth: 100 +max_num_event_emit: 1024 +max_num_new_move_object_ids: 2048 +max_num_new_move_object_ids_system_tx: 32768 +max_num_deleted_move_object_ids: 2048 +max_num_deleted_move_object_ids_system_tx: 32768 +max_num_transferred_move_object_ids: 2048 +max_num_transferred_move_object_ids_system_tx: 32768 +max_event_emit_size: 256000 +max_event_emit_size_total: 65536000 +max_move_vector_len: 262144 +max_move_identifier_len: 128 +max_move_value_depth: 128 +max_back_edges_per_function: 10000 +max_back_edges_per_module: 10000 +max_verifier_meter_ticks_per_function: 16000000 +max_meter_ticks_per_module: 16000000 +max_meter_ticks_per_package: 16000000 +object_runtime_max_num_cached_objects: 1000 +object_runtime_max_num_cached_objects_system_tx: 16000 +object_runtime_max_num_store_entries: 1000 +object_runtime_max_num_store_entries_system_tx: 16000 +base_tx_cost_fixed: 1000 +package_publish_cost_fixed: 1000 +base_tx_cost_per_byte: 0 +package_publish_cost_per_byte: 80 +obj_access_cost_read_per_byte: 15 +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: 9 +obj_data_cost_refundable: 100 +obj_metadata_cost_non_refundable: 50 +storage_rebate_rate: 9900 +storage_fund_reinvest_rate: 500 +reward_slashing_rate: 10000 +storage_gas_price: 76 +max_transactions_per_checkpoint: 10000 +max_checkpoint_size_bytes: 31457280 +buffer_stake_for_protocol_upgrade_bps: 5000 +address_from_bytes_cost_base: 52 +address_to_u256_cost_base: 52 +address_from_u256_cost_base: 52 +config_read_setting_impl_cost_base: 100 +config_read_setting_impl_cost_per_byte: 40 +dynamic_field_hash_type_and_key_cost_base: 100 +dynamic_field_hash_type_and_key_type_cost_per_byte: 2 +dynamic_field_hash_type_and_key_value_cost_per_byte: 2 +dynamic_field_hash_type_and_key_type_tag_cost_per_byte: 2 +dynamic_field_add_child_object_cost_base: 100 +dynamic_field_add_child_object_type_cost_per_byte: 10 +dynamic_field_add_child_object_value_cost_per_byte: 10 +dynamic_field_add_child_object_struct_tag_cost_per_byte: 10 +dynamic_field_borrow_child_object_cost_base: 100 +dynamic_field_borrow_child_object_child_ref_cost_per_byte: 10 +dynamic_field_borrow_child_object_type_cost_per_byte: 10 +dynamic_field_remove_child_object_cost_base: 100 +dynamic_field_remove_child_object_child_cost_per_byte: 2 +dynamic_field_remove_child_object_type_cost_per_byte: 2 +dynamic_field_has_child_object_cost_base: 100 +dynamic_field_has_child_object_with_ty_cost_base: 100 +dynamic_field_has_child_object_with_ty_type_cost_per_byte: 2 +dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: 2 +event_emit_cost_base: 52 +event_emit_value_size_derivation_cost_per_byte: 2 +event_emit_tag_size_derivation_cost_per_byte: 5 +event_emit_output_cost_per_byte: 10 +object_borrow_uid_cost_base: 52 +object_delete_impl_cost_base: 52 +object_record_new_uid_cost_base: 52 +transfer_transfer_internal_cost_base: 52 +transfer_freeze_object_cost_base: 52 +transfer_share_object_cost_base: 52 +transfer_receive_object_cost_base: 52 +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: 20000 +validator_validate_metadata_data_cost_per_byte: 2 +crypto_invalid_arguments_cost: 100 +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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 4848 +ecvrf_ecvrf_verify_alpha_string_cost_per_byte: 2 +ecvrf_ecvrf_verify_alpha_string_cost_per_block: 2 +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: 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: 10 +hash_blake2b256_data_cost_per_byte: 2 +hash_blake2b256_data_cost_per_block: 2 +hash_keccak256_cost_base: 10 +hash_keccak256_data_cost_per_byte: 2 +hash_keccak256_data_cost_per_block: 2 +poseidon_bn254_cost_base: 260 +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: 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: 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 +check_zklogin_id_cost_base: 200 +check_zklogin_issuer_cost_base: 200 +vdf_verify_vdf_cost: 1500 +vdf_hash_to_input_cost: 100 +bcs_per_byte_serialized_cost: 2 +bcs_legacy_min_output_size_cost: 1 +bcs_failure_cost: 52 +hash_sha2_256_base_cost: 52 +hash_sha2_256_per_byte_cost: 2 +hash_sha2_256_legacy_min_input_len_cost: 1 +hash_sha3_256_base_cost: 52 +hash_sha3_256_per_byte_cost: 2 +hash_sha3_256_legacy_min_input_len_cost: 1 +type_name_get_base_cost: 52 +type_name_get_per_byte_cost: 2 +string_check_utf8_base_cost: 52 +string_check_utf8_per_byte_cost: 2 +string_is_char_boundary_base_cost: 52 +string_sub_string_base_cost: 52 +string_sub_string_per_byte_cost: 2 +string_index_of_base_cost: 52 +string_index_of_per_byte_pattern_cost: 2 +string_index_of_per_byte_searched_cost: 2 +vector_empty_base_cost: 52 +vector_length_base_cost: 52 +vector_push_back_base_cost: 52 +vector_push_back_legacy_per_abstract_memory_unit_cost: 2 +vector_borrow_base_cost: 52 +vector_pop_back_base_cost: 52 +vector_destroy_empty_base_cost: 52 +vector_swap_base_cost: 52 +debug_print_base_cost: 52 +debug_print_stack_trace_base_cost: 52 +execution_version: 3 +consensus_bad_nodes_stake_threshold: 20 +max_jwk_votes_per_validator_per_epoch: 240 +max_age_of_jwk_in_epochs: 1 +random_beacon_reduction_allowed_delta: 800 +random_beacon_reduction_lower_bound: 500 +random_beacon_dkg_timeout_round: 3000 +random_beacon_min_round_interval_ms: 500 +random_beacon_dkg_version: 1 +consensus_max_transaction_size_bytes: 262144 +consensus_max_transactions_in_block_bytes: 524288 +consensus_max_num_transactions_in_block: 512 +consensus_voting_rounds: 40 +max_accumulated_txn_cost_per_object_in_narwhal_commit: 40 +max_deferral_rounds_for_congestion_control: 10 +max_txn_cost_overage_per_object_in_commit: 18446744073709551615 +allowed_txn_cost_overage_burst_per_object_in_commit: 185000000 +min_checkpoint_interval_ms: 200 +checkpoint_summary_version_specific_data: 1 +max_soft_bundle_size: 5 +bridge_should_try_to_finalize_committee: true +max_accumulated_txn_cost_per_object_in_mysticeti_commit: 18500000 +max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: 3700000 +gas_budget_based_txn_cost_cap_factor: 400000 +gas_budget_based_txn_cost_absolute_cap_commit_count: 50 +sip_45_consensus_amplification_threshold: 5 + diff --git a/crates/sui-swarm-config/tests/snapshots/snapshot_tests__genesis_config_snapshot_matches.snap b/crates/sui-swarm-config/tests/snapshots/snapshot_tests__genesis_config_snapshot_matches.snap index 928f7c7125078..2b48eb6a78a59 100644 --- a/crates/sui-swarm-config/tests/snapshots/snapshot_tests__genesis_config_snapshot_matches.snap +++ b/crates/sui-swarm-config/tests/snapshots/snapshot_tests__genesis_config_snapshot_matches.snap @@ -6,7 +6,7 @@ ssfn_config_info: ~ validator_config_info: ~ parameters: chain_start_timestamp_ms: 0 - protocol_version: 72 + protocol_version: 73 allow_insertion_of_extra_objects: true epoch_duration_ms: 86400000 stake_subsidy_start_epoch: 0 diff --git a/crates/sui-swarm-config/tests/snapshots/snapshot_tests__populated_genesis_snapshot_matches-2.snap b/crates/sui-swarm-config/tests/snapshots/snapshot_tests__populated_genesis_snapshot_matches-2.snap index 4b150ff109724..3869b2c0d324c 100644 --- a/crates/sui-swarm-config/tests/snapshots/snapshot_tests__populated_genesis_snapshot_matches-2.snap +++ b/crates/sui-swarm-config/tests/snapshots/snapshot_tests__populated_genesis_snapshot_matches-2.snap @@ -3,7 +3,7 @@ source: crates/sui-swarm-config/tests/snapshot_tests.rs expression: genesis.sui_system_object().into_genesis_version_for_tooling() --- epoch: 0 -protocol_version: 72 +protocol_version: 73 system_state_version: 1 validators: total_stake: 20000000000000000 @@ -240,13 +240,13 @@ validators: next_epoch_worker_address: ~ extra_fields: id: - id: "0xe1736cf478d38b4e97ac9cff325aedd9d71c156d43cf1e49a821a8b20dfe877a" + id: "0x3588c61d279473df8a5655f522fd2be63296ad7ee8126f88ee523f90d40fe6a3" size: 0 voting_power: 10000 - operation_cap_id: "0x92ca0c15c751ed16f4ba61cf7a2561bcdacea7c14ff8734bb187c305bee96176" + operation_cap_id: "0xe60ce0dfa3b59234f901f5c5406e971f13d7a08a2c4c017b4ae135e99d14686c" gas_price: 1000 staking_pool: - id: "0x65826f03944fd73127bd792daed69eddbc1ddc147f8c99da50324c64a90df0e0" + id: "0xac9436a6ba8e9df6fadfcc8240dbfb61420c4befcffe4ba39b5d15f378db555b" activation_epoch: 0 deactivation_epoch: ~ sui_balance: 20000000000000000 @@ -254,14 +254,14 @@ validators: value: 0 pool_token_balance: 20000000000000000 exchange_rates: - id: "0xae8b647a4c501c2b62396ff783139eb9d60594dcdb68f8b53aa6e612fde7ad55" + id: "0x536dc2f77fb525c382c576a9bcce19ba349821fa998c1d7d73ce287ea3d0244d" size: 1 pending_stake: 0 pending_total_sui_withdraw: 0 pending_pool_token_withdraw: 0 extra_fields: id: - id: "0x9074457c10ce082304550f2edb9e55fc0ec12e5b0ade37806debfb378d9a1b9d" + id: "0x4442fb3094d49103a73e1c5bf84a88bfbf4be6ec74bcdd1537a67edfa2dae77e" size: 0 commission_rate: 200 next_epoch_stake: 20000000000000000 @@ -269,27 +269,27 @@ validators: next_epoch_commission_rate: 200 extra_fields: id: - id: "0x3307d52632bb86f142fa40561bb2b46365a5612225a0b0891a63809fcdcb691f" + id: "0x8b5c659ffe4a6a07027d90b3c0ad42516710a0e607b689cfa13bec3f7461bcfe" size: 0 pending_active_validators: contents: - id: "0x60cea2865bd42d6a782798762fa70c2d717be27f8873c1a512882a190629e254" + id: "0xfb1e5bdb021813cd3339d0b0c722a7a74a41e80a81ff3dd9ed12b364c10b4ad1" size: 0 pending_removals: [] staking_pool_mappings: - id: "0xbcdff2f0bca8d3c90783a19a68012d10c6c52c187817395fe91b220957ae65dd" + id: "0xf18357c054fb30cbfca0f8ee21e9649409ecac0bb3b4378e0b6a6dc7b0259d9c" size: 1 inactive_validators: - id: "0xb126b6b0efdfd66f0a14c159a5828b7844065267efb83637e59922dd28a2dec9" + id: "0x9d0b5f9dbff5be6f9a87824511f640f5e47dcdbb8923ae4f2c7f2aa98eff2a28" size: 0 validator_candidates: - id: "0x35e1d26ec23453bfb7007fb2882ced97a1d19a102d2320bfbd136a6e35220688" + id: "0x8b2a9d3b2d0783e8f07631945cd9eae17db1c76dc926a0edfd127209e01c0bb1" size: 0 at_risk_validators: contents: [] extra_fields: id: - id: "0x30f3634e8f7220afff05b96d87ab9020bc62538f5b0910b9c5d5e12646d944ea" + id: "0xff5b2720cec616b5dd82f24557a8ec584c4a039eda7c6ce5fb9aee169ac71c4e" size: 0 storage_fund: total_object_storage_rebates: @@ -306,7 +306,7 @@ parameters: validator_low_stake_grace_period: 7 extra_fields: id: - id: "0x8f0219b14d05d238a48c0f75c3cc9c675acb9b5f6c50e0b7a9b9bbecaaaea232" + id: "0x17e3c34630e3d9a1f73210ff067da0a562be1a5e59a75e769baaf281730bb56f" size: 0 reference_gas_price: 1000 validator_report_records: @@ -320,7 +320,7 @@ stake_subsidy: stake_subsidy_decrease_rate: 1000 extra_fields: id: - id: "0x3e45c6ab50494f16b32675da9b00233b08f0ca281c2f763ed5838518045a13b6" + id: "0xaa6156b921f0b2c6e23a422aa077d5184a89ae370dbb43698ea82a7ff32dbe71" size: 0 safe_mode: false safe_mode_storage_rewards: @@ -332,6 +332,6 @@ safe_mode_non_refundable_storage_fee: 0 epoch_start_timestamp_ms: 10 extra_fields: id: - id: "0xf741efb1558fc976c1b7ba102a1c0ad5b814a15913c08fe18c3abf20f74547a2" + id: "0x74d6298d0aeb0ad20693175eaba1cafa661b9ecc848c42535246c99515937127" size: 0 diff --git a/sui-execution/latest/sui-move-natives/src/lib.rs b/sui-execution/latest/sui-move-natives/src/lib.rs index 193d2f1d51935..ac4d1df09bb1e 100644 --- a/sui-execution/latest/sui-move-natives/src/lib.rs +++ b/sui-execution/latest/sui-move-natives/src/lib.rs @@ -31,7 +31,14 @@ use self::{ transfer::{ TransferFreezeObjectCostParams, TransferInternalCostParams, TransferShareObjectCostParams, }, - tx_context::TxContextDeriveIdCostParams, + tx_context::{ + TxContextDeriveIdCostParams, TxContextNativeDigestCostParams, + TxContextNativeEpochCostParams, TxContextNativeEpochTimestampMsCostParams, + TxContextNativeIdsCreatedCostParams, TxContextNativeIncEpochCostParams, + TxContextNativeIncEpochTimestampCostParams, TxContextNativeIncIdsCreatedCostParams, + TxContextNativeReplaceCostParams, TxContextNativeSenderCostParams, + TxContextNativeSponsorCostParams, + }, types::TypesIsOneTimeWitnessCostParams, validator::ValidatorValidateMetadataBcsCostParams, }; @@ -112,6 +119,17 @@ pub struct NativesCostTable { // TxContext pub tx_context_derive_id_cost_params: TxContextDeriveIdCostParams, + pub tx_context_native_digest_cost_params: TxContextNativeDigestCostParams, + pub tx_context_native_epoch_cost_params: TxContextNativeEpochCostParams, + pub tx_context_native_epoch_timestamp_ms_cost_params: TxContextNativeEpochTimestampMsCostParams, + pub tx_context_native_sender_cost_params: TxContextNativeSenderCostParams, + pub tx_context_native_sponsor_cost_params: TxContextNativeSponsorCostParams, + pub tx_context_native_ids_created_cost_params: TxContextNativeIdsCreatedCostParams, + pub tx_context_native_inc_ids_created_cost_params: TxContextNativeIncIdsCreatedCostParams, + pub tx_context_native_inc_epoch_cost_params: TxContextNativeIncEpochCostParams, + pub tx_context_native_inc_epoch_timestamp_cost_params: + TxContextNativeIncEpochTimestampCostParams, + pub tx_context_native_replace_cost_params: TxContextNativeReplaceCostParams, // Type pub type_is_one_time_witness_cost_params: TypesIsOneTimeWitnessCostParams, @@ -339,6 +357,38 @@ impl NativesCostTable { .tx_context_derive_id_cost_base() .into(), }, + tx_context_native_digest_cost_params: TxContextNativeDigestCostParams { + tx_context_native_digest_cost_base: 10.into(), + }, + tx_context_native_epoch_cost_params: TxContextNativeEpochCostParams { + tx_context_native_epoch_cost_base: 10.into(), + }, + tx_context_native_epoch_timestamp_ms_cost_params: + TxContextNativeEpochTimestampMsCostParams { + tx_context_native_epoch_timestamp_ms_cost_base: 10.into(), + }, + tx_context_native_sender_cost_params: TxContextNativeSenderCostParams { + tx_context_native_sender_cost_base: 10.into(), + }, + tx_context_native_sponsor_cost_params: TxContextNativeSponsorCostParams { + tx_context_native_sponsor_cost_base: 10.into(), + }, + tx_context_native_ids_created_cost_params: TxContextNativeIdsCreatedCostParams { + tx_context_native_ids_created_cost_base: 10.into(), + }, + tx_context_native_inc_ids_created_cost_params: TxContextNativeIncIdsCreatedCostParams { + tx_context_native_inc_ids_created_cost_base: 20.into(), + }, + tx_context_native_inc_epoch_cost_params: TxContextNativeIncEpochCostParams { + tx_context_native_inc_epoch_cost_base: 20.into(), + }, + tx_context_native_inc_epoch_timestamp_cost_params: + TxContextNativeIncEpochTimestampCostParams { + tx_context_native_inc_epoch_timestamp_cost_base: 20.into(), + }, + tx_context_native_replace_cost_params: TxContextNativeReplaceCostParams { + tx_context_native_replace_cost_base: 100.into(), + }, type_is_one_time_witness_cost_params: TypesIsOneTimeWitnessCostParams { types_is_one_time_witness_cost_base: protocol_config .types_is_one_time_witness_cost_base() @@ -1012,6 +1062,56 @@ pub fn all_natives(silent: bool, protocol_config: &ProtocolConfig) -> NativeFunc "derive_id", make_native!(tx_context::derive_id), ), + ( + "tx_context", + "native_sender", + make_native!(tx_context::native_sender), + ), + ( + "tx_context", + "native_digest", + make_native!(tx_context::native_digest), + ), + ( + "tx_context", + "native_epoch", + make_native!(tx_context::native_epoch), + ), + ( + "tx_context", + "native_epoch_timestamp_ms", + make_native!(tx_context::native_epoch_timestamp_ms), + ), + ( + "tx_context", + "native_ids_created", + make_native!(tx_context::native_ids_created), + ), + ( + "tx_context", + "native_inc_ids_created", + make_native!(tx_context::native_inc_ids_created), + ), + ( + "tx_context", + "native_inc_epoch", + make_native!(tx_context::native_inc_epoch), + ), + ( + "tx_context", + "native_inc_epoch_timestamp", + make_native!(tx_context::native_inc_epoch_timestamp), + ), + ( + "tx_context", + "native_sponsor", + make_native!(tx_context::native_sponsor), + ), + ( + "tx_context", + "native_replace", + make_native!(tx_context::native_replace), + ), ( "types", "is_one_time_witness", diff --git a/sui-execution/latest/sui-move-natives/src/tx_context.rs b/sui-execution/latest/sui-move-natives/src/tx_context.rs index 1a208098b409d..d891e221d51d8 100644 --- a/sui-execution/latest/sui-move-natives/src/tx_context.rs +++ b/sui-execution/latest/sui-move-natives/src/tx_context.rs @@ -54,3 +54,183 @@ pub fn derive_id( smallvec![Value::address(address)], )) } + +#[derive(Clone)] +pub struct TxContextNativeSenderCostParams { + pub tx_context_native_sender_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_sender(): address; + **************************************************************************************************/ +pub fn native_sender( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424242)) +} + +#[derive(Clone)] +pub struct TxContextNativeDigestCostParams { + pub tx_context_native_digest_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_digest(): &vector; + **************************************************************************************************/ +pub fn native_digest( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424243)) +} + +#[derive(Clone)] +pub struct TxContextNativeEpochCostParams { + pub tx_context_native_epoch_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_epoch(): u64; + **************************************************************************************************/ +pub fn native_epoch( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424244)) +} + +#[derive(Clone)] +pub struct TxContextNativeEpochTimestampMsCostParams { + pub tx_context_native_epoch_timestamp_ms_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_epoch_timestamp_ms(): u64; + **************************************************************************************************/ +pub fn native_epoch_timestamp_ms( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424245)) +} + +#[derive(Clone)] +pub struct TxContextNativeSponsorCostParams { + pub tx_context_native_sponsor_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_sponsor(): address; + **************************************************************************************************/ +pub fn native_sponsor( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424246)) +} + +#[derive(Clone)] +pub struct TxContextNativeIdsCreatedCostParams { + pub tx_context_native_ids_created_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_ids_created(): u64; + **************************************************************************************************/ +pub fn native_ids_created( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424247)) +} + +#[derive(Clone)] +pub struct TxContextNativeIncIdsCreatedCostParams { + pub tx_context_native_inc_ids_created_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_inc_ids_created(); + **************************************************************************************************/ +pub fn native_inc_ids_created( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424248)) +} + +#[derive(Clone)] +pub struct TxContextNativeIncEpochCostParams { + pub tx_context_native_inc_epoch_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_inc_epoch(); + **************************************************************************************************/ +pub fn native_inc_epoch( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.is_empty()); + + Ok(NativeResult::err(0.into(), 424249)) +} + +#[derive(Clone)] +pub struct TxContextNativeIncEpochTimestampCostParams { + pub tx_context_native_inc_epoch_timestamp_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_inc_epoch_timestamp(); + **************************************************************************************************/ +pub fn native_inc_epoch_timestamp( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.len() == 1); + + Ok(NativeResult::err(0.into(), 424250)) +} + +#[derive(Clone)] +pub struct TxContextNativeReplaceCostParams { + pub tx_context_native_replace_cost_base: InternalGas, +} +/*************************************************************************************************** + * native fun native_replace(); + **************************************************************************************************/ +pub fn native_replace( + _context: &mut NativeContext, + _ty_args: Vec, + _args: VecDeque, +) -> PartialVMResult { + debug_assert!(_ty_args.is_empty()); + debug_assert!(_args.len() == 5); + + Ok(NativeResult::err(0.into(), 424251)) +}