Skip to content

Commit

Permalink
Merge branch 'lima' of github.com:ecadlabs/taquito into 2074-local-fo…
Browse files Browse the repository at this point in the history
…rging-support-new-instruction-LAMBDA_REC
  • Loading branch information
hui-an-yang committed Nov 28, 2022
2 parents ecade81 + c93f36f commit 442aae2
Show file tree
Hide file tree
Showing 36 changed files with 3,062 additions and 2,332 deletions.
4 changes: 2 additions & 2 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const kathmandunetEphemeral = {
};

const limanetEphemeral = {
rpc: process.env['TEZOS_RPC_LIMANET'] || 'https://limanet.ecadinfra.com',
rpc: process.env['TEZOS_RPC_LIMANET'] || 'http://ecad-limanet-full:8732',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000',
knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
Expand Down Expand Up @@ -157,7 +157,7 @@ const kathmandunetSecretKey = {
};

const limanetSecretKey = {
rpc: process.env['TEZOS_RPC_LIMANET'] || 'https://limanet-archive.ecadinfra.com',
rpc: process.env['TEZOS_RPC_LIMANET'] || 'http://ecad-limanet-full:8732',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000',
knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
Expand Down
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.

8 changes: 4 additions & 4 deletions integration-tests/contract-estimation-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) =>
expect(estimate.minimalFeeMutez).toEqual(651);
expect(estimate.totalCost).toEqual(651);
expect(estimate.usingBaseFeeMutez).toEqual(651);
expect(estimate.consumedMilligas).toEqual(3148528);
expect(estimate.consumedMilligas).toEqual(3148700);
done();
})

Expand Down Expand Up @@ -198,7 +198,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) =>
expect(estimate.minimalFeeMutez).toEqual(811);
expect(estimate.totalCost).toEqual(129311);
expect(estimate.usingBaseFeeMutez).toEqual(811);
expect(estimate.consumedMilligas).toEqual(4156198);
expect(estimate.consumedMilligas).toEqual(4156370);
done();
})

Expand Down Expand Up @@ -230,7 +230,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) =>
expect(estimate.minimalFeeMutez).toEqual(698);
expect(estimate.totalCost).toEqual(79948);
expect(estimate.usingBaseFeeMutez).toEqual(698);
expect(estimate.consumedMilligas).toEqual(3559038);
expect(estimate.consumedMilligas).toEqual(3559210);
done();
})

Expand Down Expand Up @@ -258,7 +258,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) =>
expect(estimate.minimalFeeMutez).toEqual(905);
expect(estimate.totalCost).toEqual(159405);
expect(estimate.usingBaseFeeMutez).toEqual(905);
expect(estimate.consumedMilligas).toEqual(4977218);
expect(estimate.consumedMilligas).toEqual(4977390);
// Do the actual operation
const op2 = await contract.methods.do(originate2()).send();
await op2.confirmation();
Expand Down
9 changes: 2 additions & 7 deletions integration-tests/contract-execute-on-chain-view.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { codeViewsTopLevel } from "./data/contract_views_top_level";
import { CONFIGS } from "./config";
import BigNumber from 'bignumber.js';
import { Protocols, ViewSimulationError } from "@taquito/taquito";
import { HttpResponseError } from "@taquito/http-utils";
import { ViewSimulationError } from "@taquito/taquito";

CONFIGS().forEach(({ lib, rpc, setup }) => {
const Tezos = lib;
Expand Down Expand Up @@ -75,11 +74,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
await contract.contractViews.test_failwith(3).executeView({ viewCaller: contract.address });
} catch (error: any) {
const protocol = (await Tezos.rpc.getProtocols()).protocol
if(protocol === Protocols.PtJakart2) {
expect(error).toBeInstanceOf(HttpResponseError)
} else {
expect(error).toBeInstanceOf(ViewSimulationError)
}
expect(error).toBeInstanceOf(ViewSimulationError)
}

const viewSuccResult = await contract.contractViews.succ({ 0: 16, 1: contract.address }).executeView({ source, viewCaller: contract.address });
Expand Down
Loading

0 comments on commit 442aae2

Please sign in to comment.