Skip to content

Commit

Permalink
zero length bytearray memsize 1 again
Browse files Browse the repository at this point in the history
  • Loading branch information
christianschmitz committed Sep 25, 2022
1 parent 7960338 commit aa9cd3d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions helios.js
Expand Up @@ -4584,7 +4584,12 @@ class UplcByteArray extends UplcValue {
* @type {number}
*/
get memSize() {
return Math.floor((this.#bytes.length - 1)/8) + 1;
let n = this.#bytes.length;
if (n === 0) {
return 1; // this is so annoying: haskell reference implementation says it should be 0, but current (20220925) testnet and mainnet settings say it's 1
} else {
return Math.floor((this.#bytes.length - 1)/8) + 1;
}
}

/**
Expand Down Expand Up @@ -6242,7 +6247,7 @@ class UplcBuiltin extends UplcTerm {
/**
* Plutus-core program class
*/
class UplcProgram {
export class UplcProgram {
#version;
#expr;
#purpose;
Expand Down

0 comments on commit aa9cd3d

Please sign in to comment.