Skip to content

Commit

Permalink
update Taquito test configs to support Mumbai runs (#2312)
Browse files Browse the repository at this point in the history
* update Taquito test configs to support Mumbai runs

* updated some integration tests to point to mumbainet

* pdate constant values for mumbainet

* removed accidental change to mondaynet test
  • Loading branch information
dsawali authored and Zainen Suzuki committed Jan 25, 2023
1 parent 750e93f commit 400cffc
Show file tree
Hide file tree
Showing 16 changed files with 267 additions and 112 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
include:
- testnet: limanet
testnet_uppercase: LIMANET
- testnet: mumbainet
testnet_uppercase: MUMBAINET
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
45 changes: 44 additions & 1 deletion integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RpcClient, RpcClientCache } from '@taquito/rpc';
import { knownBigMapContractProtoALph, knownContractProtoALph, knownOnChainViewContractAddressProtoALph, knownSaplingContractProtoALph, knownTzip12BigMapOffChainContractProtoALph, txRollupAddressProtoALph } from './known-contracts-ProtoALph';
import { knownContractPtLimaPtL, knownBigMapContractPtLimaPtL, knownTzip12BigMapOffChainContractPtLimaPtL, knownSaplingContractPtLimaPtL, knownOnChainViewContractAddressPtLimaPtL, txRollupAddressPtLimaPtL } from './known-contracts-PtLimaPtL';
import { knownContractPtGhostnet, knownBigMapContractPtGhostnet, knownTzip12BigMapOffChainContractPtGhostnet, knownSaplingContractPtGhostnet, knownOnChainViewContractAddressPtGhostnet, txRollupAddressPtGhostnet } from './known-contracts-PtGhostnet';
import { knownContractPtMumbaii, knownBigMapContractPtMumbaii, knownTzip12BigMapOffChainContractPtMumbaii, knownSaplingContractPtMumbaii, knownOnChainViewContractAddressPtMumbaii, txRollupAddressPtMumbaii } from './known-contracts-PtMumbaii';

const nodeCrypto = require('crypto');

Expand Down Expand Up @@ -96,6 +97,27 @@ const limanetEphemeral = {
},
};

const mumbainetEphemeral = {
rpc: process.env['TEZOS_RPC_LIMANET'] || 'http://ecad-mumbainet-full.i.tez.ie:8732',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000',
knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
knownContract: process.env['TEZOS_MUMBAINET_CONTRACT_ADDRESS'] || knownContractPtMumbaii,
knownBigMapContract: process.env['TEZOS_MUMBAINET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtMumbaii,
knownTzip1216Contract: process.env['TEZOS_MUMBAINET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtMumbaii,
knownSaplingContract: process.env['TEZOS_MUMBAINET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtMumbaii,
txRollupWithdrawContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_MUMBAINET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtMumbaii,
txRollupAddress: process.env['TEZOS_MUMBAINET_TXROLLUP_ADDRESS'] || txRollupAddressPtMumbaii,
protocol: Protocols.PtMumbaii,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
keyUrl: 'https://api.tez.ie/keys/mumbainet',
requestHeaders: { Authorization: 'Bearer taquito-example' },
},
};

const ghostnetEphemeral = {
rpc: process.env['TEZOS_RPC_GHOSTNET'] || 'ecad-ghostnet-rolling:8732',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
Expand Down Expand Up @@ -155,6 +177,23 @@ const limanetSecretKey = {
signerConfig: defaultSecretKey
};

const mumbainetSecretKey = {
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',
knownContract: process.env['TEZOS_MUMBAINET_CONTRACT_ADDRESS'] || knownContractPtMumbaii,
knownBigMapContract: process.env['TEZOS_MUMBAINET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtMumbaii,
knownTzip1216Contract: process.env['TEZOS_MUMBAINET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtMumbaii,
knownSaplingContract: process.env['TEZOS_MUMBAINET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtMumbaii,
txRollupWithdrawContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_MUMBAINET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_MUMBAINET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtMumbaii,
txRollupAddress: process.env['TEZOS_MUMBAINET_TXROLLUP_ADDRESS'] || txRollupAddressPtMumbaii,
protocol: Protocols.PtMumbaii,
signerConfig: defaultSecretKey
};

const ghostnetSecretKey = {
rpc: process.env['TEZOS_RPC_GHOSTNET'] || 'http://ecad-ghostnet-rolling:8732',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
Expand Down Expand Up @@ -195,18 +234,22 @@ if (process.env['RUN_WITH_SECRET_KEY']) {
providers.push(limanetSecretKey);
} else if (process.env['RUN_LIMANET_WITH_SECRET_KEY']) {
providers.push(limanetSecretKey);
} else if (process.env['RUN_MUMBAINET_WITH_SECRET_KEY']) {
providers.push(mumbainetSecretKey);
} else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) {
providers.push(ghostnetSecretKey);
} else if (process.env['RUN_MONDAYNET_WITH_SECRET_KEY']) {
providers.push(mondaynetSecretKey);
} else if (process.env['LIMANET']) {
providers.push(limanetEphemeral);
} else if (process.env['MUMBAINET']) {
providers.push(mumbainetEphemeral);
} else if (process.env['GHOSTNET']) {
providers.push(ghostnetEphemeral);
} else if (process.env['MONDAYNET']) {
providers.push(mondaynetEphemeral);
} else {
providers.push(limanetEphemeral);
providers.push(limanetEphemeral, mumbainetEphemeral);
}

const setupForger = (Tezos: TezosToolkit, forger: ForgerType): void => {
Expand Down
10 changes: 4 additions & 6 deletions integration-tests/contract-deploy-having-ticket.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { CONFIGS } from "./config";
import { ticketCode } from './data/code_with_ticket';
import { Protocols } from "@taquito/taquito";

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

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

Expand All @@ -13,7 +11,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
done();
});

limanetAndAlpha('Originates a contract having ticket with init and the contract api', async (done) => {
it('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 @@ -26,7 +24,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
done();
});

limanetAndAlpha('Originates a contract having ticket with init in JSON and the contract api', async (done) => {
it('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 @@ -39,7 +37,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
done();
});

limanetAndAlpha('Originates a contract having ticket with storage and the contract api', async (done) => {
it('Originates a contract having ticket with storage and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCode,
storage: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { CONFIGS } from './config';
import { OpKind, Protocols } from '@taquito/taquito';
import { OpKind } from '@taquito/taquito';
import { ligoSample } from './data/ligo-simple-contract';

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

const Tezos = lib;
let simpleContractAddress: string;
Expand Down Expand Up @@ -33,7 +32,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
done();
});

limanetAndAlpha(`should be able to increase the paid storage of a contract successfully: ${rpc}`, async (done) => {
it(`should be able to increase the paid storage of a contract successfully: ${rpc}`, async (done) => {
const paidSpaceBefore = await Tezos.rpc.getStoragePaidSpace(simpleContractAddress);

const op = await Tezos.contract.increasePaidStorage({
Expand All @@ -51,7 +50,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
done();
});

limanetAndAlpha(`should be able to include increasePaidStorage operation in a batch: ${rpc}`, async (done) => {
it(`should be able to include increasePaidStorage operation in a batch: ${rpc}`, async (done) => {
const paidSpaceBefore = await Tezos.rpc.getStoragePaidSpace(simpleContractAddress);

const op = await Tezos.contract
Expand Down Expand Up @@ -81,7 +80,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
done();
});

limanetAndAlpha(`should be able to include increasePaidStorage operation in a batch (different batch syntax): ${rpc}`, async (done) => {
it(`should be able to include increasePaidStorage operation in a batch (different batch syntax): ${rpc}`, async (done) => {
const paidSpaceBefore = await Tezos.rpc.getStoragePaidSpace(simpleContractAddress);

const op = await Tezos.contract.batch([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
import { Protocols } from "@taquito/taquito";
import { CONFIGS } from "./config";
import { recFactApplyStore, recursiveLambda, reduceMap } from "./data/lambda-rec";

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

describe(`Test deploying and interacting with contracts having recursive lambda through the contract api using: ${rpc}`, () => {
describe(`Test deploying and interacting with contracts having recursive lambda through the contract api using: ${rpc}`, () => {

beforeEach(async (done) => {
await setup(true);
done();
})
beforeEach(async (done) => {
await setup(true);
done();
})

limanetAndAlpha('Verify that a contract having the LAMBDA_REC instruction in its code can be deployed', async (done) => {
const deployContract = await Tezos.contract.originate({
code: recFactApplyStore,
storage: { 0: 3 }
});
it('Verify that a contract having the LAMBDA_REC instruction in its code can be deployed', async (done) => {
const deployContract = await Tezos.contract.originate({
code: recFactApplyStore,
storage: { 0: 3 }
});

await deployContract.confirmation();
expect(deployContract.hash).toBeDefined();
expect(deployContract.status).toEqual('applied');
await deployContract.confirmation();
expect(deployContract.hash).toBeDefined();
expect(deployContract.status).toEqual('applied');

done();
});
done();
});

limanetAndAlpha('Verify that a contract entrypoint having a type lambda can be called with a recursive lambda', async (done) => {
const deployContract = await Tezos.contract.originate({
code: reduceMap,
storage: [1]
});
it('Verify that a contract entrypoint having a type lambda can be called with a recursive lambda', async (done) => {
const deployContract = await Tezos.contract.originate({
code: reduceMap,
storage: [1]
});

const contract = await deployContract.contract();
const contract = await deployContract.contract();

const op = await contract.methodsObject.default({
0: { prim: "Lambda_rec", args: recursiveLambda },
1: [1]
}).send();
const op = await contract.methodsObject.default({
0: { prim: "Lambda_rec", args: recursiveLambda },
1: [1]
}).send();

await op.confirmation();
expect(op.hash).toBeDefined();
expect(op.status).toEqual('applied');
await op.confirmation();
expect(op.hash).toBeDefined();
expect(op.status).toEqual('applied');

done();
});
done();
});
});
})
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Protocols } from '@taquito/taquito';
import { CONFIGS } from './config';

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

const Tezos = lib;

Expand All @@ -29,7 +27,7 @@ CONFIGS().forEach(({ lib, rpc, setup, createAddress, protocol }) => {
done();
});

limanetAndAlpha('should be able to inject update_consensus_key operation', async (done) => {
it('should be able to inject update_consensus_key operation', async (done) => {
const op = await Tezos.contract.updateConsensusKey({ pk });
await op.confirmation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@ import { Protocols } from '@taquito/taquito';
import { CONFIGS } from "./config";

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

describe(`Test injecting more than one manager operation in a block: ${rpc}`, () => {
describe(`Test injecting more than one manager operation in a block: ${rpc}`, () => {

beforeEach(async (done) => {
await setup()
done()
})
beforeEach(async (done) => {
await setup();
done();
});

limanet('Verify that doing transfers without awaiting the confirmation after each will fail', async (done) => {
try {
const op1Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 1 });
const op2Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 2 });
limanet('Verify that doing transfers without awaiting the confirmation after each will fail', async (done) => {
try {
const op1Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 1 });
const op2Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 2 });

const [op1, op2] = await Promise.all([op1Promise, op2Promise])
const [op1, op2] = await Promise.all([op1Promise, op2Promise])

await op1.confirmation();
await op2.confirmation();
await op1.confirmation();
await op2.confirmation();

} catch (error: any) {
expect(error.message).toContain('Only one manager operation per manager per block allowed');
}
done();
})
} catch (error: any) {
expect(error.message).toContain('Only one manager operation per manager per block allowed');
}
done();
})

alpha('Verify that doing transfers without awaiting the confirmation after each will fail', async (done) => {
try {
const op1Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 1 });
const op2Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 2 });
alpha('Verify that doing transfers without awaiting the confirmation after each will fail', async (done) => {
try {
const op1Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 1 });
const op2Promise = Tezos.contract.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 2 });

const [op1, op2] = await Promise.all([op1Promise, op2Promise])
const [op1, op2] = await Promise.all([op1Promise, op2Promise])

await op1.confirmation();
await op2.confirmation();
await op1.confirmation();
await op2.confirmation();

} catch (error: any) {
expect(error.message).toContain('mempool already contains a conflicting operation');
}
done();
})
});
} catch (error: any) {
expect(error.message).toContain('mempool already contains a conflicting operation');
}
done();
})
});
})
12 changes: 6 additions & 6 deletions integration-tests/known-contracts-PtLimaPtL.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const knownContractPtLimaPtL = "KT1Q8j4ahiuMu6cTtD42JmUFNtdc6aE1ctUk";
export const knownBigMapContractPtLimaPtL = "KT1STPt3btDjttzsZ7MBmQkkfU3FykeAgYnW";
export const knownTzip12BigMapOffChainContractPtLimaPtL = "KT1Kh3xkT7dvn4ULqhwgxq1p4yz2kGx58o5E";
export const knownSaplingContractPtLimaPtL = "KT1B1WJhcBYY1ZuWZmgbp2CsPFHEffNZVrEj";
export const knownOnChainViewContractAddressPtLimaPtL = "KT1MU2tLa61FVUTa1HzVS6FZjVPBZQBhZabM";
export const txRollupAddressPtLimaPtL = "txr1SNAYyB37mfJwqByczbbRbZj41yYzfDB9F";
export const knownContractPtLimaPtL = "KT1NiiuTpzeh3qvmpg6x1WoUK5GFA9peHqMR";
export const knownBigMapContractPtLimaPtL = "KT19WjpKFLhkpnPfvzJCShyVxfiRfKuXx4js";
export const knownTzip12BigMapOffChainContractPtLimaPtL = "KT1GnRJVaqvzjeeuhcsCUZmn96ZrN8pJ2GxV";
export const knownSaplingContractPtLimaPtL = "KT1S321F21ZTqjxwC3MgJDE8M8aTX3234ZCY";
export const knownOnChainViewContractAddressPtLimaPtL = "KT1CH64MzwB9E5XkgdR1s7ZamHYsJuTPkDnt";
export const txRollupAddressPtLimaPtL = "txr1WtzBSTQMfLcGNPmMeDBUhNPjX7Vo3E5p3";
6 changes: 6 additions & 0 deletions integration-tests/known-contracts-PtMumbaii.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const knownContractPtMumbaii = "KT1Pt75B5Sgf5nz4m7GX1yGCA36pR2Lf6Eit";
export const knownBigMapContractPtMumbaii = "KT1ToCtqCSAqK85sYmD3f1AUC1h17Ho9J8J4";
export const knownTzip12BigMapOffChainContractPtMumbaii = "KT1AJwEfLhur9snYyv86GAXdoQZqygED3X3b";
export const knownSaplingContractPtMumbaii = "KT1MU6HasZvDrnDk7TdNVGj9zFVfDDGGrkFD";
export const knownOnChainViewContractAddressPtMumbaii = "KT1Mon6pBMP2M48tRSCAuSTgccsnwwG7PnHw";
export const txRollupAddressPtMumbaii = "txr1YzCiyQKjiNykr3cHoD9AVJqn9wtq81Cuc";
5 changes: 2 additions & 3 deletions integration-tests/local-forging.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { CONFIGS } from "./config";
import { commonCases, limaCases } from './data/allTestsCases';
import { LocalForger, ProtocolsHash } from '@taquito/local-forging'
import { Protocols, TezosToolkit } from "@taquito/taquito";
import { TezosToolkit } from "@taquito/taquito";

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

describe(`Test local forger: ${rpc}`, () => {

Expand All @@ -25,7 +24,7 @@ CONFIGS().forEach(({ rpc, protocol }) => {
});

limaCases.forEach(({ name, operation, expected }) => {
limanetAndAlpha(`Should give the same result as when forging with the rpc: ${name} (${rpc})`, async done => {
it(`Should give the same result as when forging with the rpc: ${name} (${rpc})`, async done => {
const localForger = new LocalForger(protocol as unknown as ProtocolsHash);
const result = await localForger.forge(operation);
const rpcResult = await Tezos.rpc.forgeOperations(operation);
Expand Down
Loading

0 comments on commit 400cffc

Please sign in to comment.