Skip to content

Commit e8738cb

Browse files
committed
fix(clarity-wasm): standard principal in-memory should end with 0
1 parent 2bfe0a6 commit e8738cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clarity/src/vm/clarity_wasm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,10 @@ fn pass_argument_to_wasm(
16131613
Ok((buffer, offset + written, in_mem_offset + in_mem_written))
16141614
}
16151615
Value::Principal(PrincipalData::Standard(StandardPrincipalData(v, h))) => {
1616-
let bytes: Vec<u8> = std::iter::once(v).chain(h.iter()).copied().collect();
1616+
let mut bytes: Vec<u8> = Vec::with_capacity(22);
1617+
bytes.push(*v);
1618+
bytes.extend(h);
1619+
bytes.push(0);
16171620
let buffer = vec![Val::I32(in_mem_offset), Val::I32(bytes.len() as i32)];
16181621
memory
16191622
.write(&mut store, in_mem_offset as usize, &bytes)

0 commit comments

Comments
 (0)