From ba7c468cd799b6ac49ccadcdede09ede08f85ca9 Mon Sep 17 00:00:00 2001 From: huianyang Date: Mon, 28 Nov 2022 10:35:38 -0800 Subject: [PATCH] test: added code_with_lambda_rec file and test against rpc forger re #2074 --- integration-tests/data/allTestsCases.ts | 26 ++++++++++++++++++- .../data/code_with_lambda_rec.ts | 22 ++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 integration-tests/data/code_with_lambda_rec.ts diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index f343f0d75f..60938a2d9f 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -31,6 +31,7 @@ import { import { codeViewsTopLevel, storageViewsTopLevel } from './contract_views_top_level'; import { MichelsonV1Expression, OpKind } from '@taquito/rpc'; import { emitCode } from './code_with_emit'; +import { lambdaRecCode } from './code_with_lambda_rec'; import { opMappingProto14 } from '../../packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14' function extractOp( @@ -1389,7 +1390,7 @@ export const commonCases: TestCase[] = [ export const limaCases: TestCase[] = [ // In `opMapping` from the file `constants.ts`, the operations and types starting at `ticket` were added in the lima protocol - ...extractOp(154, 154, opMapping).map((op): TestCase => { + ...extractOp(152, 154, opMapping).map((op): TestCase => { return { name: `Origination operation (${op})`, operation: { @@ -1464,4 +1465,27 @@ export const limaCases: TestCase[] = [ ], }, }, + { + name: `Origination of a contract that contains the instructions LAMBDA_REC`, + operation: { + branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL', + contents: [ + { + kind: OpKind.ORIGINATION, + counter: '94141', + source: 'tz2WH1zahKo2KiS1gcHBhNFTURPfW1Vk7qpE', + fee: '603', + gas_limit: '1526', + storage_limit: '377', + balance: '0', + script: { + code: lambdaRecCode, + storage: { + prim: 'Unit', + }, + }, + }, + ], + }, + }, ]; diff --git a/integration-tests/data/code_with_lambda_rec.ts b/integration-tests/data/code_with_lambda_rec.ts new file mode 100644 index 0000000000..0bad4a9f5e --- /dev/null +++ b/integration-tests/data/code_with_lambda_rec.ts @@ -0,0 +1,22 @@ +// https://gitlab.com/tezos/tezos/-/blob/master/src/proto_015_PtLimaPt/lib_protocol/test/regression/contracts/rec_id_unit.tz +export const lambdaRecCode = [ + { prim: 'parameter', args: [ { prim: 'unit' } ] }, + { prim: 'storage', args: [ { prim: 'unit' } ] }, + { + prim: 'code', + args: [ + [ + { prim: 'CAR' }, + { prim: 'LAMBDA_REC', args: [ + { prim: 'unit' }, + { prim: 'unit' }, + [ { prim: 'DIP', args: [ [ { prim: 'DROP' } ] ] } ] + ] }, + { prim: 'SWAP' }, + { prim: 'EXEC' }, + { prim: 'NIL', args: [ { prim: 'operation' } ] }, + { prim: 'PAIR' } + ] + ] + } +]