diff --git a/src/vm_interp.rs b/src/vm_interp.rs index 33ac094..6ba157b 100644 --- a/src/vm_interp.rs +++ b/src/vm_interp.rs @@ -88,6 +88,13 @@ pub unsafe extern "C" fn sol_compat_vm_interp_v1( 1 } +pub fn vec_rtrim_zeros(v: &[u8]) -> Vec { + if let Some(i) = v.iter().rposition(|x| *x != 0) { + return v[..i + 1].into(); + } + return vec![]; +} + // We are actually executing the JIT-compiled program here pub fn execute_vm_interp(syscall_context: SyscallContext) -> Option { let instr_ctx: InstrContext = syscall_context.instr_ctx?.try_into().ok()?; @@ -269,7 +276,8 @@ pub fn execute_vm_interp(syscall_context: SyscallContext) -> Option