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 2 #2139

Merged
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 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
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
5a68628
fix: address comments to remove kathcases integration tests
hui-an-yang Nov 22, 2022
d67480b
test: address comments add forge and parse operation test suite back …
hui-an-yang Nov 23, 2022
d1efd1e
test: addressing comments updated file name and added simicolons
hui-an-yang Nov 23, 2022
26ae7d8
test: address comments added semicolon
hui-an-yang Nov 24, 2022
bff6e29
fix: configure localforger with lima protocol hash with lima cases
hui-an-yang Nov 25, 2022
460d81f
fix: removed update_consensus_key & drain_delegate from encodersProto…
hui-an-yang Nov 25, 2022
fcbfe2f
Merge branch 'lima' of github.com:ecadlabs/taquito into 2065-local-fo…
hui-an-yang Nov 26, 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
110 changes: 110 additions & 0 deletions integration-tests/contract-deploy-having-ticket.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { CONFIGS } from "./config";
import { ticketCode } from './data/code_with_ticket';
import { ticketCodeProto14 } from './data/code_with_ticket_proto14';
import { Protocols } from "@taquito/taquito";

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();
});

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 contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCode,
init: `(Pair None None)`
});

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

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' } ] }
});

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

done();
});

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

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

done();
});
});
})
67 changes: 0 additions & 67 deletions integration-tests/contract-edo-deploy-having-ticket.spec.ts

This file was deleted.

115 changes: 85 additions & 30 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, 151, 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 @@ -1342,10 +1344,52 @@ export const commonCases: TestCase[] = [
],
},
},
{
name: `Origination of a contract that contains the instructions EMIT`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.ORIGINATION,
counter: '94141',
source: 'tz2WH1zahKo2KiS1gcHBhNFTURPfW1Vk7qpE',
fee: '603',
gas_limit: '1526',
storage_limit: '377',
balance: '0',
script: {
code: emitCode,
storage: {
prim: 'Unit',
},
},
},
],
},
},
{
name: `Increase Paid Storage operation`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.INCREASE_PAID_STORAGE,
counter: '1',
source: 'tz2WH1zahKo2KiS1gcHBhNFTURPfW1Vk7qpE',
fee: '100',
gas_limit: '10000',
storage_limit: '10',
amount: '2',
destination: 'KT1JHqHQdHSgWBKo6H4UfG8dw3JnZSyjGkHA',
},
],
},
},
];

export const kathmanduCases: TestCase[] = [
...extractOp(150, 151, opMapping).map((op): 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 => {
return {
name: `Origination operation (${op})`,
operation: {
Expand All @@ -1369,7 +1413,7 @@ export const kathmanduCases: TestCase[] = [
};
}),
{
name: `Origination of a contract that contains the instructions EMIT`,
name: `Origination of a contract that contains the instructions TICKET`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
Expand All @@ -1382,29 +1426,40 @@ export const kathmanduCases: TestCase[] = [
storage_limit: '377',
balance: '0',
script: {
code: emitCode,
storage: {
prim: 'Unit',
},
code: ticketCode,
storage: ticketStorage,
},
},
],
},
},
{
name: `Increase Paid Storage operation`,
name: `Update Consensus Key operation`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.INCREASE_PAID_STORAGE,
kind: OpKind.UPDATE_CONSENSUS_KEY,
counter: '1',
source: 'tz2WH1zahKo2KiS1gcHBhNFTURPfW1Vk7qpE',
source: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj',
fee: '100',
gas_limit: '10000',
storage_limit: '10',
amount: '2',
destination: 'KT1JHqHQdHSgWBKo6H4UfG8dw3JnZSyjGkHA',
pk: 'edpkti5K5JbdLpp2dCqiTLoLQqs5wqzeVhfHVnNhsSCuoU8zdHYoY7'
},
],
},
},
{
name: `Drain Delegate operation`,
operation: {
branch: 'BMV9bffK5yjWCJgUJBsoTRifb4SsAYbkCVwVkKbJHffJYn7ePBL',
contents: [
{
kind: OpKind.DRAIN_DELEGATE,
consensus_key: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv',
delegate: 'tz1MY8g5UqVmQtpAp7qs1cUwEof1GjZCHgVv',
destination: 'tz1KvJCU5cNdz5RAS3diEtdRvS9wfhRC7Cwj',
},
],
},
Expand Down
Loading