Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2065 local forging support new operations for lima #2106

Closed
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
47cf160
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Aug 8, 2022
53bf5c5
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Aug 11, 2022
eddeb1d
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Aug 23, 2022
ac9bd70
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Sep 13, 2022
ca9577d
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Sep 28, 2022
8c1643d
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Oct 4, 2022
d34128b
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Oct 5, 2022
ad53532
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Oct 20, 2022
1d175f5
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Oct 25, 2022
b1414ef
Merge branch 'master' of github.com:ecadlabs/taquito
hui-an-yang Oct 27, 2022
c029847
feat: support new types for new operations UpdateConsensusKey and Dra…
hui-an-yang Oct 31, 2022
33489db
test: update_consensus_key unit test added for limanet
hui-an-yang Nov 4, 2022
029efa1
feat: support new operation UpdateConsensusKey for Lima
hui-an-yang Nov 5, 2022
2992fcf
feat: support new operation updateConsensusKey in local-forger for Lima
hui-an-yang Nov 7, 2022
edd3f63
revert: removed unnecesorry change of updateConsensusKey in rpc-batch…
hui-an-yang Nov 7, 2022
e0126e5
revert: changes of update_consensus_key in RpcContractProvider and RP…
hui-an-yang Nov 8, 2022
984e3a5
feat: support new operation drainDelegate for Lima
hui-an-yang Nov 8, 2022
1c0a203
Merge branch 'lima' of github.com:ecadlabs/taquito into 2065-local-fo…
hui-an-yang Nov 8, 2022
db4db3d
Merge branch 'lima' of github.com:ecadlabs/taquito into 2072-support-…
hui-an-yang Nov 16, 2022
b2f4a98
feat: support new encoding for ticket & ticket depreacted in lima wit…
hui-an-yang Nov 17, 2022
3f0723c
Merge branch 'lima' of github.com:ecadlabs/taquito into 2072-support-…
hui-an-yang Nov 17, 2022
501b4b2
Configure NPM Workspaces (#2088)
danielelisi Nov 17, 2022
2e9ceba
build(deps): bump loader-utils from 1.4.1 to 1.4.2
dependabot[bot] Nov 17, 2022
4070a28
fix: added ASSERT_SOME in ticketCode and fixed 2 integration tests in…
hui-an-yang Nov 17, 2022
d978b87
Merge branch 'lima' of github.com:ecadlabs/taquito into 2065-local-fo…
hui-an-yang Nov 17, 2022
64903a8
fixs merge conflicts
hui-an-yang Nov 17, 2022
6628b93
fix: fixs merge conflicts
hui-an-yang Nov 17, 2022
5b73497
fix: replaced ASSERT_SOME with its expansion in ticketCode
hui-an-yang Nov 18, 2022
dbc38dc
fix: resolving merge conflicts with lima
hui-an-yang Nov 18, 2022
9c71ca0
Merge branch '2072-support-new-encoding-for-ticket-in-lima' of github…
hui-an-yang Nov 18, 2022
f3761d5
test: added local-forgin integration tests for new operations
hui-an-yang Nov 18, 2022
db7ece5
fix: address comments removed duplicate tests and move kathcases to c…
hui-an-yang Nov 19, 2022
7965eb0
Merge pull request #2129 from ecadlabs/dependabot/npm_and_yarn/loader…
roxaneletourneau Nov 21, 2022
cc7dc6d
fix: resolved merge conflicts from master
hui-an-yang Nov 21, 2022
431c646
fix: resolved merge conflicts from master 2
hui-an-yang Nov 21, 2022
82143fd
fix: fixs pr run
hui-an-yang Nov 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 70 additions & 5 deletions integration-tests/contract-edo-deploy-having-ticket.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,81 @@
import { CONFIGS } from "./config";
import { ticketCode, ticketStorage } from './data/code_with_ticket';
import { ticketCodeProto14, ticketStorageProto14 } from './data/code_with_ticket_proto14';
import { Protocols } from "@taquito/taquito";

CONFIGS().forEach(({ lib, rpc, setup }) => {
CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
const Tezos = lib;
const kathmandunet = protocol === Protocols.PtKathman ? test: test.skip;
const limanetAndAlpha = protocol === Protocols.PtLimaPtL || protocol === Protocols.ProtoALpha ? test: test.skip;

describe(`Test origination of a token contract using: ${rpc}`, () => {

beforeEach(async (done) => {
await setup();
done()
})
test('Originates a contract having ticket with init and the wallet api', async (done) => {
kathmandunet('Originates a contract having ticket with init and the wallet api', async (done) => {
Copy link
Collaborator

@roxaneletourneau roxaneletourneau Nov 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this specific test is duplicated from "integration-tests/wallet-edo-deploy-having-ticket.spec.ts". Can it be removed?

const op = await Tezos.wallet.originate({
code: ticketCodeProto14,
init: ticketStorageProto14
}).send();

await op.confirmation();
expect(op.opHash).toBeDefined();

done();
});

kathmandunet('Originates a contract having ticket with init and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCodeProto14,
init: `(Pair None None)`
});

await op.confirmation();
expect(op.hash).toBeDefined();
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY);

done();
});

kathmandunet('Originates a contract having ticket with init in JSON and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCodeProto14,
init: { prim: 'Pair', args: [ { prim: 'None' }, { prim: 'None' } ] }
});

await op.confirmation();
expect(op.hash).toBeDefined();
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY);

done();
});

kathmandunet('Originates a contract having ticket with storage and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCodeProto14,
storage: {
'%x': null,
'%y': null
}
});

await op.confirmation();
expect(op.hash).toBeDefined();
expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY);

done();
});
});

describe(`Test origination of a token contract using: ${rpc}`, () => {

beforeEach(async (done) => {
await setup();
done()
})
limanetAndAlpha('Originates a contract having ticket with init and the wallet api', async (done) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this one that seems to be duplicated in integration-tests/wallet-edo-deploy-having-ticket.spec.ts

const op = await Tezos.wallet.originate({
code: ticketCode,
init: ticketStorage
Expand All @@ -22,7 +87,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
done();
});

test('Originates a contract having ticket with init and the contract api', async (done) => {
limanetAndAlpha('Originates a contract having ticket with init and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCode,
init: `(Pair None None)`
Expand All @@ -35,7 +100,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
done();
});

test('Originates a contract having ticket with init in JSON and the contract api', async (done) => {
limanetAndAlpha('Originates a contract having ticket with init in JSON and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCode,
init: { prim: 'Pair', args: [ { prim: 'None' }, { prim: 'None' } ] }
Expand All @@ -48,7 +113,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
done();
});

test('Originates a contract having ticket with storage and the contract api', async (done) => {
limanetAndAlpha('Originates a contract having ticket with storage and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCode,
storage: {
Expand Down
120 changes: 101 additions & 19 deletions integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import {
example9,
example10,
} from './code_with_sapling';
import { ticketCode, ticketStorage } from './code_with_ticket';
import {
ticketCode,
ticketCode2,
ticketCode3,
ticketCode4,
ticketStorage,
ticketStorage2,
ticketStorage3,
ticketStorage4,
} from './code_with_ticket';
ticketCodeProto14,
ticketCode2Proto14,
ticketCode3Proto14,
ticketCode4Proto14,
ticketStorageProto14,
ticketStorage2Proto14,
ticketStorage3Proto14,
ticketStorage4Proto14,
} from './code_with_ticket_proto14';
import { genericCode, genericStorage } from './generic_contract';
import { tokenBigmapCode, tokenBigmapStorage } from './token_bigmap';
import { noAnnotCode, noAnnotInit } from './token_without_annotation';
Expand All @@ -30,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 { opMappingProto14 } from '../../packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14'

function extractOp(
startIndex: number,
Expand Down Expand Up @@ -804,7 +806,7 @@ export const commonCases: TestCase[] = [
],
},
},
...extractOp(0, 150, opMapping).map((op): TestCase => {
...extractOp(0, 150, opMappingProto14).map((op): TestCase => {
return {
name: `Origination operation (${op})`,
operation: {
Expand Down Expand Up @@ -941,8 +943,8 @@ export const commonCases: TestCase[] = [
storage_limit: '10',
balance: '0',
script: {
code: ticketCode,
storage: ticketStorage,
code: ticketCodeProto14,
storage: ticketStorageProto14,
},
},
],
Expand All @@ -962,8 +964,8 @@ export const commonCases: TestCase[] = [
storage_limit: '10',
balance: '0',
script: {
code: ticketCode2,
storage: ticketStorage2,
code: ticketCode2Proto14,
storage: ticketStorage2Proto14,
},
},
],
Expand All @@ -983,8 +985,8 @@ export const commonCases: TestCase[] = [
storage_limit: '10',
balance: '0',
script: {
code: ticketCode3,
storage: ticketStorage3,
code: ticketCode3Proto14,
storage: ticketStorage3Proto14,
},
},
],
Expand All @@ -1004,8 +1006,8 @@ export const commonCases: TestCase[] = [
storage_limit: '10',
balance: '0',
script: {
code: ticketCode4,
storage: ticketStorage4,
code: ticketCode4Proto14,
storage: ticketStorage4Proto14,
},
},
],
Expand Down Expand Up @@ -1345,7 +1347,7 @@ export const commonCases: TestCase[] = [
];

export const kathmanduCases: TestCase[] = [
...extractOp(150, 151, opMapping).map((op): TestCase => {
...extractOp(150, 151, opMappingProto14).map((op): TestCase => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move the following tests:

  • Origination of a contract that contains the instructions EMIT
  • Increase Paid Storage operation
    into commonCases ? Those operation/instruction are now supported on every protocol we are testing against (Kathmandu, Lima, alpha and upcoming)

return {
name: `Origination operation (${op})`,
operation: {
Expand Down Expand Up @@ -1410,3 +1412,83 @@ export const kathmanduCases: 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 => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test from 152 to 154 to include lambda_rec as well?

return {
name: `Origination operation (${op})`,
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.ORIGINATION,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
balance: '0',
script: {
code: genericCode(op) as MichelsonV1Expression[],
storage: genericStorage,
},
},
],
},
};
}),
{
name: `Origination of a contract that contains the instructions TICKET`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.ORIGINATION,
counter: '94141',
source: 'tz2WH1zahKo2KiS1gcHBhNFTURPfW1Vk7qpE',
fee: '603',
gas_limit: '1526',
storage_limit: '377',
balance: '0',
script: {
code: ticketCode,
storage: ticketStorage,
},
},
],
},
},
{
name: `Update Consensus Key operation`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.UPDATE_CONSENSUS_KEY,
counter: '1',
source: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj',
fee: '100',
gas_limit: '10000',
storage_limit: '10',
pk: 'edpkti5K5JbdLpp2dCqiTLoLQqs5wqzeVhfHVnNhsSCuoU8zdHYoY7'
},
],
},
},
{
name: `Drain Delegate operation`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.DRAIN_DELEGATE,
consensus_key: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv',
delegate: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv',
destination: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj',
},
],
},
},
];
Loading