Skip to content

Commit

Permalink
[sui-adapter] Remove error traces from native functions (#21185)
Browse files Browse the repository at this point in the history
## Description 

Native functions can have valid reasons to return an `Err` so we
shouldn't be logging an `error` log in such cases. This removes them.

## Test plan 

Make sure existing tests pass.
  • Loading branch information
tzakian authored Feb 12, 2025
1 parent c33d3af commit 9eed82c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion sui-execution/latest/sui-move-natives/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct ConfigReadSettingImplCostParams {
pub config_read_setting_impl_cost_per_byte: Option<InternalGas>,
}

#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn read_setting_impl(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down
12 changes: 6 additions & 6 deletions sui-execution/latest/sui-move-natives/src/dynamic_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct DynamicFieldHashTypeAndKeyCostParams {
* + dynamic_field_hash_type_and_key_value_cost_per_byte * size_of(k) | covers cost of operating on the value `k`
* + dynamic_field_hash_type_and_key_type_tag_cost_per_byte * size_of(type_tag(k)) | covers cost of operating on the type tag of `K`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn hash_type_and_key(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -159,7 +159,7 @@ pub struct DynamicFieldAddChildObjectCostParams {
* + dynamic_field_add_child_object_value_cost_per_byte * size_of(child) | covers cost of operating on the value `child`
* + dynamic_field_add_child_object_struct_tag_cost_per_byte * size_of(struct)tag(Child)) | covers cost of operating on the struct tag of `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn add_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -255,7 +255,7 @@ pub struct DynamicFieldBorrowChildObjectCostParams {
* + dynamic_field_borrow_child_object_child_ref_cost_per_byte * size_of(&Child) | covers cost of fetching and returning `&Child`
* + dynamic_field_borrow_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn borrow_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -331,7 +331,7 @@ pub struct DynamicFieldRemoveChildObjectCostParams {
* + dynamic_field_remove_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_remove_child_object_child_cost_per_byte * size_of(child) | covers cost of fetching and returning value of type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn remove_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -394,7 +394,7 @@ pub struct DynamicFieldHasChildObjectCostParams {
* Implementation of the Move native function `has_child_object(parent: address, id: address): bool`
* gas cost: dynamic_field_has_child_object_cost_base | covers various fixed costs in the oper
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object(
context: &mut NativeContext,
ty_args: Vec<Type>,
Expand Down Expand Up @@ -436,7 +436,7 @@ pub struct DynamicFieldHasChildObjectWithTyCostParams {
* + dynamic_field_has_child_object_with_ty_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte * size_of(Child) | covers cost of fetching and returning value of type tag for `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object_with_ty(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down
12 changes: 6 additions & 6 deletions sui-execution/v0/sui-move-natives/src/dynamic_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct DynamicFieldHashTypeAndKeyCostParams {
* + dynamic_field_hash_type_and_key_value_cost_per_byte * size_of(k) | covers cost of operating on the value `k`
* + dynamic_field_hash_type_and_key_type_tag_cost_per_byte * size_of(type_tag(k)) | covers cost of operating on the type tag of `K`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn hash_type_and_key(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -160,7 +160,7 @@ pub struct DynamicFieldAddChildObjectCostParams {
* + dynamic_field_add_child_object_value_cost_per_byte * size_of(child) | covers cost of operating on the value `child`
* + dynamic_field_add_child_object_struct_tag_cost_per_byte * size_of(struct)tag(Child)) | covers cost of operating on the struct tag of `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn add_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -256,7 +256,7 @@ pub struct DynamicFieldBorrowChildObjectCostParams {
* + dynamic_field_borrow_child_object_child_ref_cost_per_byte * size_of(&Child) | covers cost of fetching and returning `&Child`
* + dynamic_field_borrow_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn borrow_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -332,7 +332,7 @@ pub struct DynamicFieldRemoveChildObjectCostParams {
* + dynamic_field_remove_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_remove_child_object_child_cost_per_byte * size_of(child) | covers cost of fetching and returning value of type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn remove_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -395,7 +395,7 @@ pub struct DynamicFieldHasChildObjectCostParams {
* Implementation of the Move native function `has_child_object(parent: address, id: address): bool`
* gas cost: dynamic_field_has_child_object_cost_base | covers various fixed costs in the oper
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object(
context: &mut NativeContext,
ty_args: Vec<Type>,
Expand Down Expand Up @@ -437,7 +437,7 @@ pub struct DynamicFieldHasChildObjectWithTyCostParams {
* + dynamic_field_has_child_object_with_ty_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte * size_of(Child) | covers cost of fetching and returning value of type tag for `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object_with_ty(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down
12 changes: 6 additions & 6 deletions sui-execution/v1/sui-move-natives/src/dynamic_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct DynamicFieldHashTypeAndKeyCostParams {
* + dynamic_field_hash_type_and_key_value_cost_per_byte * size_of(k) | covers cost of operating on the value `k`
* + dynamic_field_hash_type_and_key_type_tag_cost_per_byte * size_of(type_tag(k)) | covers cost of operating on the type tag of `K`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn hash_type_and_key(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -159,7 +159,7 @@ pub struct DynamicFieldAddChildObjectCostParams {
* + dynamic_field_add_child_object_value_cost_per_byte * size_of(child) | covers cost of operating on the value `child`
* + dynamic_field_add_child_object_struct_tag_cost_per_byte * size_of(struct)tag(Child)) | covers cost of operating on the struct tag of `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn add_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -255,7 +255,7 @@ pub struct DynamicFieldBorrowChildObjectCostParams {
* + dynamic_field_borrow_child_object_child_ref_cost_per_byte * size_of(&Child) | covers cost of fetching and returning `&Child`
* + dynamic_field_borrow_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn borrow_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -331,7 +331,7 @@ pub struct DynamicFieldRemoveChildObjectCostParams {
* + dynamic_field_remove_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_remove_child_object_child_cost_per_byte * size_of(child) | covers cost of fetching and returning value of type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn remove_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -394,7 +394,7 @@ pub struct DynamicFieldHasChildObjectCostParams {
* Implementation of the Move native function `has_child_object(parent: address, id: address): bool`
* gas cost: dynamic_field_has_child_object_cost_base | covers various fixed costs in the oper
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object(
context: &mut NativeContext,
ty_args: Vec<Type>,
Expand Down Expand Up @@ -436,7 +436,7 @@ pub struct DynamicFieldHasChildObjectWithTyCostParams {
* + dynamic_field_has_child_object_with_ty_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte * size_of(Child) | covers cost of fetching and returning value of type tag for `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object_with_ty(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down
12 changes: 6 additions & 6 deletions sui-execution/v2/sui-move-natives/src/dynamic_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct DynamicFieldHashTypeAndKeyCostParams {
* + dynamic_field_hash_type_and_key_value_cost_per_byte * size_of(k) | covers cost of operating on the value `k`
* + dynamic_field_hash_type_and_key_type_tag_cost_per_byte * size_of(type_tag(k)) | covers cost of operating on the type tag of `K`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn hash_type_and_key(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -159,7 +159,7 @@ pub struct DynamicFieldAddChildObjectCostParams {
* + dynamic_field_add_child_object_value_cost_per_byte * size_of(child) | covers cost of operating on the value `child`
* + dynamic_field_add_child_object_struct_tag_cost_per_byte * size_of(struct)tag(Child)) | covers cost of operating on the struct tag of `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn add_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -255,7 +255,7 @@ pub struct DynamicFieldBorrowChildObjectCostParams {
* + dynamic_field_borrow_child_object_child_ref_cost_per_byte * size_of(&Child) | covers cost of fetching and returning `&Child`
* + dynamic_field_borrow_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn borrow_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -331,7 +331,7 @@ pub struct DynamicFieldRemoveChildObjectCostParams {
* + dynamic_field_remove_child_object_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_remove_child_object_child_cost_per_byte * size_of(child) | covers cost of fetching and returning value of type `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn remove_child_object(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down Expand Up @@ -394,7 +394,7 @@ pub struct DynamicFieldHasChildObjectCostParams {
* Implementation of the Move native function `has_child_object(parent: address, id: address): bool`
* gas cost: dynamic_field_has_child_object_cost_base | covers various fixed costs in the oper
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object(
context: &mut NativeContext,
ty_args: Vec<Type>,
Expand Down Expand Up @@ -436,7 +436,7 @@ pub struct DynamicFieldHasChildObjectWithTyCostParams {
* + dynamic_field_has_child_object_with_ty_type_cost_per_byte * size_of(Child) | covers cost of operating on type `Child`
* + dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte * size_of(Child) | covers cost of fetching and returning value of type tag for `Child`
**************************************************************************************************/
#[instrument(level = "trace", skip_all, err)]
#[instrument(level = "trace", skip_all)]
pub fn has_child_object_with_ty(
context: &mut NativeContext,
mut ty_args: Vec<Type>,
Expand Down

0 comments on commit 9eed82c

Please sign in to comment.