In aiken, crates/uplc/src/machine.rs, truncating division is however used, thus giving a wrong result for this edge case.
I suggest checking for zero-length bytestrings, and returning 0 explicitly in that edge case. (similar to the if-else expression for Constant::Integer)
According to https://github.com/input-output-hk/plutus/blob/master/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/ExMemory.hs, lines 217-221, a zero-length bytestring should have ex_mem size of 0. It also states that truncating division should be avoided because ex_mem would be 1 in that case (truncates from -1/8 to 0, then adds 1).
In aiken, crates/uplc/src/machine.rs, truncating division is however used, thus giving a wrong result for this edge case.
I suggest checking for zero-length bytestrings, and returning 0 explicitly in that edge case. (similar to the if-else expression for
Constant::Integer
)