Skip to content

Commit

Permalink
fix: added LAMBDA_REC condition padding in primEncoder and primDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-an-yang committed Nov 29, 2022
1 parent ba7c468 commit 7cd65c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/taquito-local-forging/src/michelson/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const primEncoder: Encoder<PrimValue> = (value) => {
let encodedArgs = (value.args || []).map((arg) => valueEncoder(arg)).join('');
const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';

if (value.prim === 'LAMBDA' && argsCount) {
if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) {
encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
}

Expand All @@ -226,7 +226,7 @@ export const primDecoder = (value: Uint8ArrayConsumer, preamble: Uint8Array) =>
prim: opMapping[op],
};

if (opMapping[op] === 'LAMBDA') {
if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
value.consume(4);
}

Expand All @@ -248,7 +248,7 @@ export const primDecoder = (value: Uint8ArrayConsumer, preamble: Uint8Array) =>

const args = new Array(argsCount).fill(0).map(() => valueDecoder(value));

if (opMapping[op] === 'LAMBDA') {
if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
value.consume(4);
}

Expand Down

0 comments on commit 7cd65c7

Please sign in to comment.