Skip to content

Commit

Permalink
test: added code_with_lambda_rec file and test against rpc forger
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-an-yang committed Nov 28, 2022
1 parent 442aae2 commit ba7c468
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
26 changes: 25 additions & 1 deletion integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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',
},
},
},
],
},
},
];
22 changes: 22 additions & 0 deletions integration-tests/data/code_with_lambda_rec.ts
Original file line number Diff line number Diff line change
@@ -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' }
]
]
}
]

0 comments on commit ba7c468

Please sign in to comment.