Skip to content

Commit

Permalink
485 remove babylon kathmandu (#2373)
Browse files Browse the repository at this point in the history
* perf: update some examples for ghostnet

remove file change that will conflict

* refactor: remove unused variables from integration tests

* refactor: slight improvement, remove tx rollup contracts

* refactor: remove past protocol check

* refactor: remove tx from mondaynet github workflow

---------

Co-authored-by: Zainen Suzuki <zainensuzuki@Zainens-MacBook-Pro.local>
  • Loading branch information
zainen and Zainen Suzuki committed Mar 8, 2023
1 parent ffab08e commit f3a191e
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 59 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/mondaynet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ jobs:
SSH_KEY: ${{ secrets.MONDAYNET_TORU_SSH_KEY }}
SSH_HOST: ecad-mondaynet-archive

- name: get required TORU contract addresses
id: toru-addresses
run: |
echo '::echo::on'
echo ::set-output name=tx-rollup-hash::$(ssh mondaynet "jq '.[] | select(.name==\"toru_node\") | .value' /srv/tezos/mondaynet_client/tx_rollups | tr -d \\\" ")
echo ::set-output name=tx-rollup-withdraw-contract::$(ssh mondaynet "jq '.[] | select(.name==\"tx_rollup_withdraw_contract\") | .value' /srv/tezos/mondaynet_client/contracts | tr -d \\\" ")
echo ::set-output name=tx-rollup-deposit-contract::$(ssh mondaynet "jq '.[] | select(.name==\"tx_rollup_deposit_contract\") | .value' /srv/tezos/mondaynet_client/contracts | tr -d \\\" ")
echo '::echo::off'
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
Expand All @@ -67,11 +58,8 @@ jobs:
TEZOS_MONDAYNET_TZIP1216CONTRACT_ADDRESS: ${{ steps.originate-contracts-mondaynet.outputs.knownTzip12BigMapOffChainContractAddress }}
TEZOS_MONDAYNET_SAPLINGCONTRACT_ADDRESS: ${{ steps.originate-contracts-mondaynet.outputs.knownSaplingContractAddress }}
TEZOS_MONDAYNET_ON_CHAIN_VIEW_CONTRACT: ${{ steps.originate-contracts-mondaynet.outputs.knownOnChainViewContractAddress }}
TX_ROLLUP_WITHDRAW_CONTRACT: ${{ steps.toru-addresses.outputs.tx-rollup-withdraw-contract }}
TX_ROLLUP_DEPOSIT_CONTRACT: ${{ steps.toru-addresses.outputs.tx-rollup-deposit-contract }}
TX_ROLLUP_TICKETS_OWNER_SECRET: ${{ secrets.TX_ROLLUP_TICKETS_OWNER_SECRET }}
run: npm run test:mondaynet -- --maxWorkers=2
-
-
name: Slack Notification
if: always()
uses: ravsamhq/notify-slack-action@v1
Expand Down
5 changes: 3 additions & 2 deletions example/deploy-docs-live-code-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { saplingLiveCodeContract } from './data/sapling_live_code_contract';
import { contractMap8pairs } from './data/contractMap8pairs';
import { char2Bytes } from '@taquito/utils';
import { fa2Contract } from '../integration-tests/data/fa2_contract';
import BigNumber from 'bignumber.js';


const provider = 'https://ghostnet.ecadinfra.com/';
Expand Down Expand Up @@ -102,8 +103,8 @@ async function checkBalances(users: string | any[]) {
console.log('checking funds of users...');
try {
for (let i = 0; i < users.length; i++) {
const user_balance: any = await tezos.tz.getBalance(users[i]);
if (user_balance < min_balance) {
const user_balance = await tezos.tz.getBalance(users[i]);
if (user_balance < BigNumber(min_balance)) {
low_balance.push(users[i]);
}
console.log(users[i], user_balance);
Expand Down
4 changes: 2 additions & 2 deletions example/example-streamer-log-time-between-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { PollingSubscribeProvider, TezosToolkit } from '@taquito/taquito';
// To run this script, run the following command in the example folder: `npm run example:streamer-block-time`
// This script polls on the head block at an interval of `pollingIntervalMilliseconds`.
// When a new block is seen, the time between the new block and the precedent is logged with the block level
// If a block is missed when polling, 'Missed block: `level`' is logged.
// If a block is missed when polling, 'Missed block: `level`' is logged.

const provider = 'https://ghostnet.ecadinfra.com';
const pollingIntervalMilliseconds = 5000;
let date: Date;
let level: number;

function logLevelAndTime(data: any) {
function logLevelAndTime(data: number) {
const newDate = new Date();
const timeBetweenBlocks = date ? (newDate.getTime() - date.getTime()) : 0;
if (level && data - level > 1) {
Expand Down
6 changes: 3 additions & 3 deletions example/example-streamer.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { PollingSubscribeProvider, TezosToolkit } from '@taquito/taquito';

async function example() {
const provider = 'https://mainnet.api.tez.ie/';
const provider = 'https://ghostnet.ecadinfra.com/';
const tezos = new TezosToolkit(provider)
tezos.setStreamProvider(tezos.getFactory(PollingSubscribeProvider)({ shouldObservableSubscriptionRetry: true, pollingIntervalMilliseconds: 15000 }));
try {

const bakerEndorsementFilter = {
and: [{ source: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'endorsement' }]
and: [{ source: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'endorsement' }]
}

const bakerDelegation = {
and: [{ destination: 'tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m' }, { kind: 'delegation' }]
and: [{ destination: 'tz1bQMn5xYFbX6geRxqvuAiTywsCtNywawxH' }, { kind: 'delegation' }]
}

const sub = tezos.stream.subscribeOperation({
Expand Down
2 changes: 1 addition & 1 deletion example/scan-path-ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ async function example() {
}
}

example();
example();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Protocols, DefaultGlobalConstantsProvider } from '@taquito/taquito';
import { DefaultGlobalConstantsProvider } from '@taquito/taquito';
import { CONFIGS } from './config';
import { voteSampleGlobalConstants } from './data/vote_contract_global_constant_storage';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Protocols } from "@taquito/taquito";
import { CONFIGS } from "./config";

CONFIGS().forEach(({ lib, rpc, setup, createAddress }) => {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/contract-estimation-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DEFAULT_FEE, MANAGER_LAMBDA, TezosToolkit, Protocols, ChainIds } from "@taquito/taquito";
import { DEFAULT_FEE, MANAGER_LAMBDA, TezosToolkit, Protocols } from "@taquito/taquito";
import { Contract } from "@taquito/taquito";
import { CONFIGS } from "./config";
import { originate, originate2, transferImplicit2 } from "./data/lambda";
Expand Down
8 changes: 3 additions & 5 deletions integration-tests/contract-manager-scenario.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CONFIGS } from "./config";
import { managerCode } from "./data/manager_code";
import { MANAGER_LAMBDA, Protocols, protocols } from "@taquito/taquito";
import { MANAGER_LAMBDA } from "@taquito/taquito";

CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract, protocol }) => {
CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract }) => {
const Tezos = lib;

describe(`Test TZ Manager through contract api: ${rpc}`, () => {
Expand Down Expand Up @@ -50,9 +50,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract, protocol }) =>
await contract.methods.do(MANAGER_LAMBDA.transferImplicit("tz1eY5Aqa1kXDFoiebL28emyXFoneAoVg1zh", 50 * 1000000)).send({ amount: 0 })
fail('Should throw during transfer with amount higher than balance')
} catch (ex: any) {
(protocol === Protocols.PtJakart2) ?
expect(ex.message).toContain('contract.balance_too_low') :
expect(ex.message).toContain('tez.subtraction_underflow')
expect(ex.message).toContain('tez.subtraction_underflow')
}
done();
})
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/contract-register-global-constant.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Protocols } from '@taquito/taquito';
import { CONFIGS } from './config';
const crypto = require('crypto');

CONFIGS().forEach(({ lib, rpc, setup }) => {
const Tezos = lib;

describe(`Register global constants using: ${rpc}`, () => {
const randomAnnots = () => crypto.randomBytes(3).toString('hex');
let annots = randomAnnots();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigMapAbstraction, Protocols } from '@taquito/taquito';
import { Protocols } from '@taquito/taquito';
import { CONFIGS } from './config';

// TC-008: Obtained balance of a smart contract using the BALANCE instruction does not change during the execution of the entrypoint's own code.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Protocols, TezosOperationError } from '@taquito/taquito';
import { Protocols } from '@taquito/taquito';
import { CONFIGS } from './config';

// TC-T-001: Testcase to duplicate a ticket using "dup" instruction.
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/contract-security-mutez-overflow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Protocols } from '@taquito/taquito';
import { doesNotMatch } from 'assert';
import { CONFIGS } from './config';

/**
Expand Down Expand Up @@ -42,7 +41,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
const opContract = await op.contract();
const opSend = await opContract.methods.default(0).send();
await opSend.confirmation();

} catch (error: any) {
expect(error.message).toContain('tez.multiplication_overflow');
}
Expand Down
1 change: 0 additions & 1 deletion integration-tests/contract-security-zero-transfer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CONFIGS } from './config';
import { RpcClient } from '@taquito/rpc';
import { Protocols } from '@taquito/taquito';

// TC-007 - A 0tez transaction to an implicit account should fail.
Expand Down
1 change: 0 additions & 1 deletion integration-tests/known-contracts-ProtoALph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export const knownBigMapContractProtoALph = "KT1PEif4yNPaeDnmroV2zK9hshJqE6XHVUq
export const knownTzip12BigMapOffChainContractProtoALph = "KT1R6oieCZSFLf1w15yvjx3X38ZjhkdnyyHP";
export const knownSaplingContractProtoALph = "KT1TGQqMpzhsAMzAaCeDmL3oJRbqphjhFh9S";
export const knownOnChainViewContractAddressProtoALph = "KT1KmbQjCdEAX3NM5YoSZH6QPYK5foghn2Md";
export const txRollupAddressProtoALph = "";
1 change: 0 additions & 1 deletion integration-tests/known-contracts-PtGhostnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export const knownBigMapContractPtGhostnet = "KT1Dig4sQxbZaZjo9X18etvpEWN1eGKxTV
export const knownTzip12BigMapOffChainContractPtGhostnet = "KT1NMtSQq484bDYSFvNrBjfkGtpug2Fm1rrr";
export const knownSaplingContractPtGhostnet = "KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf";
export const knownOnChainViewContractAddressPtGhostnet = "KT1R5spjSabhD9q8cwZfCvssuvUoHmEd6KNv";
export const txRollupAddressPtGhostnet = "txr1Xz6LiZSspZ9bJu2SC5r97B1ikCBAAYKdQ";
1 change: 0 additions & 1 deletion integration-tests/known-contracts-PtLimaPtL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export const knownBigMapContractPtLimaPtL = "KT19WjpKFLhkpnPfvzJCShyVxfiRfKuXx4j
export const knownTzip12BigMapOffChainContractPtLimaPtL = "KT1GnRJVaqvzjeeuhcsCUZmn96ZrN8pJ2GxV";
export const knownSaplingContractPtLimaPtL = "KT1S321F21ZTqjxwC3MgJDE8M8aTX3234ZCY";
export const knownOnChainViewContractAddressPtLimaPtL = "KT1CH64MzwB9E5XkgdR1s7ZamHYsJuTPkDnt";
export const txRollupAddressPtLimaPtL = "txr1WtzBSTQMfLcGNPmMeDBUhNPjX7Vo3E5p3";
1 change: 0 additions & 1 deletion integration-tests/known-contracts-PtMumbaii.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export const knownBigMapContractPtMumbaii = "KT1ToCtqCSAqK85sYmD3f1AUC1h17Ho9J8J
export const knownTzip12BigMapOffChainContractPtMumbaii = "KT1AJwEfLhur9snYyv86GAXdoQZqygED3X3b";
export const knownSaplingContractPtMumbaii = "KT1MU6HasZvDrnDk7TdNVGj9zFVfDDGGrkFD";
export const knownOnChainViewContractAddressPtMumbaii = "KT1Mon6pBMP2M48tRSCAuSTgccsnwwG7PnHw";
export const txRollupAddressPtMumbaii = "txr1YzCiyQKjiNykr3cHoD9AVJqn9wtq81Cuc";
3 changes: 1 addition & 2 deletions integration-tests/ledger-signer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { CONFIGS } from './config';
import { LedgerSigner, LedgerTransport, DerivationType } from '@taquito/ledger-signer';
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
import { ligoSample } from "./data/ligo-simple-contract";
import { OriginateParams, TezosToolkit } from '@taquito/taquito';
import { TezosToolkit } from '@taquito/taquito';
import { localForger } from '@taquito/local-forging';
import { rpcToForge } from './data/contract_origination';
import { MichelsonV1Expression } from '@taquito/rpc';

// PLEASE NOTE MAY NEED TO TEST ONE TEST AT A TIME
// as the ledger will fail if requested multiple times at once
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/polling-subscribe-provider.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CONFIGS, sleep } from "./config";
import { Protocols, PollingSubscribeProvider } from "@taquito/taquito";
import { PollingSubscribeProvider } from "@taquito/taquito";

CONFIGS().forEach(({ lib, rpc, setup }) => {
const Tezos = lib;
Expand Down
1 change: 0 additions & 1 deletion integration-tests/wallet-api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { PollingSubscribeProvider } from "@taquito/taquito";
import { CONFIGS } from "./config";

CONFIGS().forEach(({ lib, rpc, setup }) => {
Expand Down
12 changes: 5 additions & 7 deletions integration-tests/wallet-manager-scenario.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CONFIGS } from "./config";
import { managerCode } from "./data/manager_code";
import { MANAGER_LAMBDA, Protocols } from "@taquito/taquito";
import { MANAGER_LAMBDA } from "@taquito/taquito";

CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract, protocol }) => {
CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract }) => {
const Tezos = lib;

describe(`Test TZ Manager through wallet api: ${rpc}`, () => {
Expand Down Expand Up @@ -37,9 +37,9 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract, protocol }) =>
const removeDelegateOp = await contract.methods.do(MANAGER_LAMBDA.removeDelegate()).send({ amount: 0 })
await removeDelegateOp.confirmation();
expect(removeDelegateOp.status).toBeTruthy

const account = await Tezos.rpc.getDelegate(knownBaker)
expect(account).toEqual(knownBaker)
expect(account).toEqual(knownBaker)
// Transfer from contract (kt1_alice) to contract (kt1 bob)
// Notice that we are instructing the kt1_alice contract to send 1 token to kt1_bob. The transfer value is passed to the
// lambda helper function. The transfer amount in the actual transfer operation is 0. We are not transferring the token
Expand All @@ -53,9 +53,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract, protocol }) =>
await contract.methods.do(MANAGER_LAMBDA.transferImplicit("tz1eY5Aqa1kXDFoiebL28emyXFoneAoVg1zh", 50 * 1000000)).send({ amount: 0 })
fail('Should throw during transfer with amount higher than balance')
} catch (ex: any) {
(protocol === Protocols.PtJakart2) ?
expect(ex.message).toContain('contract.balance_too_low') :
expect(ex.message).toContain('tez.subtraction_underflow')
expect(ex.message).toContain('tez.subtraction_underflow')
}
done();
})
Expand Down
7 changes: 1 addition & 6 deletions integration-tests/wallet-originate-invalid-string.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Protocols } from "@taquito/taquito";
import { CONFIGS } from "./config";

CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
CONFIGS().forEach(({ lib, rpc, setup }) => {
const Tezos = lib;
describe(`Test contract origination with invalid data through wallet api using: ${rpc}`, () => {

Expand All @@ -24,11 +23,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
init: `"Copyright ©"`
}).send()
} catch (ex) {
if (protocol === Protocols.PsFLorena || protocol === Protocols.PtGRANADs) {
expect(ex).toEqual(expect.objectContaining({ message: expect.stringContaining('invalid_syntactic_constant') }))
} else {
expect(ex).toEqual(expect.objectContaining({ message: expect.stringContaining('non_printable_character') }))
}
}
done();
});
Expand Down
3 changes: 1 addition & 2 deletions packages/taquito-sapling/src/taquito-sapling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ export class SaplingToolkit {
if (!input.isSpent && sumSelectedInputs.isLessThan(amountMutez)) {
const txAmount = convertValueToBigNumber(input.value);
sumSelectedInputs = sumSelectedInputs.plus(txAmount);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { isSpent, ...rest } = input;
const { isSpent: _isSpent, ...rest } = input;
inputsToSpend.push(rest);
}
});
Expand Down

0 comments on commit f3a191e

Please sign in to comment.