Skip to content

Commit

Permalink
feat: configured integraiton test for quna protocol and run ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-an-yang committed Oct 10, 2024
1 parent 7426b7b commit 58121fc
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 121 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
- testnet: parisnet
testnet_uppercase: PARISNET
rpc_url: https://parisnet.ecadinfra.com
- testnet: quebecbnet
testnet_uppercase: QUEBECBNET
rpc_url: https://quebecbnet.ecadinfra.com/
- testnet: qenanet
testnet_uppercase: QENANET
rpc_url: https://rpc.qenanet.teztnets.com/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -66,4 +66,28 @@ jobs:
run: npm -w integration-tests run test:${{ matrix.testnet }} -- --maxWorkers=4
env:
# Ternary operator workaround
TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }}
TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }}
integration-tests-qena-secret-key:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
include:
- testnet: qenanet
testnet_uppercase: QENANET
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/iron
- run: npm ci
- run: npm run build
- if: ${{ !github.event.pull_request.head.repo.fork }}
name: Tailscale
uses: tailscale/github-action@v1
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
version: 1.32.2
- run: npm -w integration-tests run test:qenanet-secret-key
env:
TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }}
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"Protofire",
"ProxfordY",
"PtNairobi",
"qenanet",
"refetched",
"riscv",
"rollups",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => {

beforeAll(async () => {
await setup(true);
// There is no baker accept staking in quebecbnet and weeklylnet hence tests will fail
// There is no baker accept staking in qenanet and weeklylnet hence tests will fail
// Currently TF is a baker that allows staking on parisnet.
if (rpc.includes('paris')) {
knownBaker = 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc' // TF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ConstantsResponseProto020, ConstantsResponseProto021 } from '@taquito/r
CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
const Tezos = lib;
const parisnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PsParisCZ) ? test : test.skip;
const quebecbnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PsQuebecB) ? test : test.skip;
const qenanet = (networkType == NetworkType.TESTNET && protocol === Protocols.PtQenaB1P) ? test : test.skip;
const weeklynet = (networkType == NetworkType.TESTNET && protocol === Protocols.ProtoALpha) ? test : test.skip;
describe('Test fetching constants for all protocols on Mainnet', () => {
const rpcUrl = 'https://mainnet.ecadinfra.com/';
Expand Down Expand Up @@ -304,7 +304,7 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
});
});

quebecbnet(`should successfully fetch all constants for quebecbnet
qenanet(`should successfully fetch all constants for qenanet
using ${rpc}`, async () => {
Tezos.setRpcProvider(rpc);
const constants: ConstantsResponseProto021 = await Tezos.rpc.getConstants();
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/__tests__/rpc/nodes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CONFIGS().forEach(
}) => {
const Tezos = lib;
const unrestrictedRPCNode = rpc.includes("i.ecadinfra.com") ? test : test.skip;
const quebecbnet = protocol === Protocols.PsQuebecB ? test : test.skip;
const qenanet = protocol === Protocols.PtQenaB1P ? test : test.skip;
let ticketContract: DefaultContractType;

beforeAll(async () => {
Expand Down Expand Up @@ -66,7 +66,7 @@ CONFIGS().forEach(
expect(balance).toBeDefined();
});

quebecbnet(`Verify that rpcClient.getSpendable for knownBaker returns the spendable balance excluding frozen bonds`, async () => {
qenanet(`Verify that rpcClient.getSpendable for knownBaker returns the spendable balance excluding frozen bonds`, async () => {
const balance = await rpcClient.getSpendable(knownBaker);
expect(balance).toBeDefined();
});
Expand All @@ -76,7 +76,7 @@ CONFIGS().forEach(
expect(balance).toBeDefined();
});

quebecbnet(`Verify that rpcClient.getSpendableAndFrozenBonds for knownBaker returns the full balance`, async () => {
qenanet(`Verify that rpcClient.getSpendableAndFrozenBonds for knownBaker returns the full balance`, async () => {
const balance = await rpcClient.getSpendableAndFrozenBonds(knownBaker);
expect(balance).toBeDefined();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => {
beforeAll(async () => {
await setup(true);
try {
// There is no baker accept staking in quebecbnet and weeklylnet hence tests will fail
// There is no baker accept staking in qenanet and weeklylnet hence tests will fail
// Currently TF is a baker that allows staking on parisnet.
if (rpc.includes('paris')) {
knownBaker = 'tz3Q67aMz7gSMiQRcW729sXSfuMtkyAHYfqc' // TF
Expand Down
26 changes: 13 additions & 13 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { KnownContracts } from './known-contracts';
import { knownContractsProtoALph } from './known-contracts-ProtoALph';
import { knownContractsPtGhostnet } from './known-contracts-PtGhostnet';
import { knownContractsPsParisCZ } from './known-contracts-PsParisCZ';
import { knownContractsPsQuebecB } from './known-contracts-PsQuebecB';
import { knownContractsPtQenaB1P } from './known-contracts-PtQenaB1P';

const nodeCrypto = require('crypto');

Expand Down Expand Up @@ -141,17 +141,17 @@ const parisnetEphemeral: Config =
const parisnetSecretKey: Config =
{ ...parisnetEphemeral, ...{ signerConfig: defaultSecretKey } };

const quebecbnetEphemeral: Config =
const qenanetEphemeral: Config =
defaultConfig({
networkName: 'QUEBECBNET',
protocol: Protocols.PsQuebecB,
defaultRpc: 'https://rpc.quebecbnet.teztnets.com/',
knownContracts: knownContractsPsQuebecB,
signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/quebecbnet')
networkName: 'QENANET',
protocol: Protocols.PtQenaB1P,
defaultRpc: 'https://rpc.qenanet.teztnets.com/',
knownContracts: knownContractsPtQenaB1P,
signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/qenanet')
});

const quebecbnetSecretKey: Config =
{ ...quebecbnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://quebecbnet.ecadinfra.com/' } };
const qenanetSecretKey: Config =
{ ...qenanetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://qenanet.ecadinfra.com/' } };

const ghostnetEphemeral: Config =
defaultConfig({
Expand Down Expand Up @@ -185,14 +185,14 @@ if (process.env['RUN_WITH_SECRET_KEY']) {
providers.push(parisnetSecretKey);
} else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) {
providers.push(ghostnetSecretKey);
} else if (process.env['RUN_QUEBECBNET_WITH_SECRET_KEY']) {
providers.push(quebecbnetSecretKey);
} else if (process.env['RUN_QENANET_WITH_SECRET_KEY']) {
providers.push(qenanetSecretKey);
} else if (process.env['RUN_WEEKLYNET_WITH_SECRET_KEY']) {
providers.push(weeklynetSecretKey);
} else if (process.env['PARISNET']) {
providers.push(parisnetEphemeral);
} else if (process.env['QUEBECBNET']) {
providers.push(quebecbnetEphemeral);
} else if (process.env['QENANET']) {
providers.push(qenanetEphemeral);
} else if (process.env['GHOSTNET']) {
providers.push(ghostnetEphemeral);
} else if (process.env['WEEKLYNET']) {
Expand Down
8 changes: 0 additions & 8 deletions integration-tests/known-contracts-PsQuebecB.ts

This file was deleted.

8 changes: 8 additions & 0 deletions integration-tests/known-contracts-PtQenaB1P.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { KnownContracts } from './known-contracts';
export const knownContractsPtQenaB1P: KnownContracts = {
contract: "KT1Dz1b1TLUq4ox7MvHf3XPjggXWe2sQnXWf",
bigMapContract: "KT1WFNfSGy3sJB6Aoy9rVfuipnxsiszaHVWi",
tzip12BigMapOffChainContract: "KT1Hn2M7BArLntv35LMbE6EzAdrSEnij5JCh",
saplingContract: "KT1Wrf8qGFeWBD4q2o16AnYWmQK8kP6Pw471",
onChainViewContractAddress: "KT1GrzvfRi6zZ7jFbirsCT6qfNGfDGWDaCSr",
};
2 changes: 1 addition & 1 deletion integration-tests/originate-known-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { codeViewsTopLevel } from './data/contract_views_top_level';
import { knownBigMapContract } from './data/knownBigMapContract';
import { knownContract } from './data/knownContract';
import * as fs from 'fs/promises';

// before running the test with secret key make sure tz2RqxsYQyFuP9amsmrr25x9bUcBMWXGvjuD is funded
const MUTEZ_UNIT = new BigNumber(1000000);

CONFIGS().forEach(({ lib, setup, protocol }) => {
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand",
"test:parisnet": "PARISNET=true jest",
"test:parisnet-secret-key": "RUN_PARISNET_WITH_SECRET_KEY=true jest --runInBand",
"test:quebecbnet": "QUEBECBNET=true jest",
"test:quebecbnet-secret-key": "RUN_QUEBECBNET_WITH_SECRET_KEY=true jest --runInBand",
"test:qenanet": "QENANET=true jest",
"test:qenanet-secret-key": "RUN_QENANET_WITH_SECRET_KEY=true jest --runInBand",
"test:weeklynet": "WEEKLYNET=true jest",
"test:weeklynet-secret-key": "RUN_WEEKLYNET_WITH_SECRET_KEY=true jest --runInBand",
"test:ghostnet": "GHOSTNET=true jest",
Expand Down
4 changes: 2 additions & 2 deletions packages/taquito-local-forging/src/protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export enum ProtocolsHash {
ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH',
PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ',
PsParisCZ = 'PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi',
PsQuebecB = 'PsQuebecBo3zZmhQT7KdEQ2RRDtncE6gQFRPgwkKEyC1ea995G1',
PtQenaB1P = 'PtQenaB1PqFEfTe2og7bZTaPvMw2CxRyDFEwWNj3GiWp9ba4bJd',
ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK',
}

Expand All @@ -42,7 +42,7 @@ const protoLevel: Record<ProtocolsHash, number> = {
ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19,
PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ: 20,
PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi: 20,
PsQuebecBo3zZmhQT7KdEQ2RRDtncE6gQFRPgwkKEyC1ea995G1: 21,
PtQenaB1PqFEfTe2og7bZTaPvMw2CxRyDFEwWNj3GiWp9ba4bJd: 21,
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 22,
};

Expand Down
Loading

0 comments on commit 58121fc

Please sign in to comment.