Skip to content

Commit

Permalink
[compiler-v2 framework] check bcs to address error
Browse files Browse the repository at this point in the history
  • Loading branch information
welbon committed Nov 28, 2024
1 parent eef9f62 commit 546aed3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion vm/framework/src/natives/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn native_from_bytes(
None => {
return Err(SafeNativeError::Abort {
abort_code: EFROM_BYTES,
})
});
}
};

Expand All @@ -63,3 +63,21 @@ pub fn make_all(

builder.make_named_natives(natives)
}

#[cfg(test)]
mod tests {
use move_core_types::value::MoveTypeLayout;
use move_vm_types::values::Value;

#[test]
fn test_bcs_from_bcs_to_address() {
assert!(
Value::simple_deserialize(
"00000000000000000000000000000001".as_bytes(),
&MoveTypeLayout::Address
)
.is_some(),
"Failed to convert"
);
}
}

0 comments on commit 546aed3

Please sign in to comment.