Skip to content

Commit

Permalink
Mondaynet update 0905 (#2564)
Browse files Browse the repository at this point in the history
* test: changes for alpha protocol 1

* test: changes for alpha protocol 2

* test: updated mondaynet-2023-07-17 known contract

* test: updated modanynet changes of protocol constants

* test: updated modanynet changes of protocol constants 2023-07-25

* test: updated mondaynet changes of protocol constants 2023-08-02

* test: updated mondaynet known-contracts

* test: updated mondaynet changes of protocol constsants 2023-08-22

* revert: revert protocol change that belongs to protocol P

* test: updated mondaynet known-contracts 0826

* revert: integration-tests/known-contracts-PtNairobi.ts back

* test: updated mondaynet known-contracts 0826

* test: mondaynet update of week 0828

* test: mondaynet update of week 0905

* revert: add back failing_noop test case

* fix: complete defaultRpc url of ghostnet

* test: added back networktype

* test: updating estimation assertion
  • Loading branch information
hui-an-yang authored Sep 6, 2023
1 parent d103c23 commit 2bc19bc
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 139 deletions.
4 changes: 2 additions & 2 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const defaultConfig = ({
rpc: process.env[`TEZOS_RPC_${networkName}`] || defaultRpc,
pollingIntervalMilliseconds: process.env[`POLLING_INTERVAL_MILLISECONDS`] || undefined,
rpcCacheMilliseconds: process.env[`RPC_CACHE_MILLISECONDS`] || '1000',
knownBaker: process.env[`TEZOS_BAKER`] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
knownBaker: process.env[`TEZOS_BAKER`] || networkName === 'MONDAYNET' ? 'tz1ck3EJwzFpbLVmXVuEn5Ptwzc6Aj14mHSH' : 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
knownContract: process.env[`TEZOS_${networkName}_CONTRACT_ADDRESS`] || knownContracts.contract,
knownBigMapContract: process.env[`TEZOS_${networkName}_BIGMAPCONTRACT_ADDRESS`] || knownContracts.bigMapContract,
knownTzip1216Contract: process.env[`TEZOS_${networkName}_TZIP1216CONTRACT_ADDRESS`] || knownContracts.tzip12BigMapOffChainContract,
Expand Down Expand Up @@ -149,7 +149,7 @@ const ghostnetEphemeral: Config =
defaultConfig({
networkName: 'GHOSTNET',
protocol: Protocols.PtMumbai2,
defaultRpc: 'ecad-ghostnet-rolling:8732',
defaultRpc: 'http://ecad-ghostnet-rolling:8732',
knownContracts: knownContractsPtGhostnet,
signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/ghostnet')
});
Expand Down
119 changes: 70 additions & 49 deletions integration-tests/contract-estimation-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { DEFAULT_FEE, MANAGER_LAMBDA, TezosToolkit } 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';
import { ligoSample } from './data/ligo-simple-contract';
import { managerCode } from './data/manager_code';
import { InvalidAmountError } from '@taquito/core';

CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc, protocol }) => {
const Tezos = lib;
const nairobinet = protocol === Protocols.PtNairobi ? it : it.skip;
const mondaynet = protocol === Protocols.ProtoALpha ? it : it.skip;

describe(`Test estimate scenarios using: ${rpc}`, () => {
let LowAmountTez: TezosToolkit;
Expand Down Expand Up @@ -41,11 +43,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 });
expect(estimate.gasLimit).toEqual(201);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(374);
expect(estimate.suggestedFeeMutez).toEqual(372);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(274);
expect(estimate.totalCost).toEqual(274);
expect(estimate.usingBaseFeeMutez).toEqual(274);
expect(estimate.minimalFeeMutez).toEqual(272);
expect(estimate.totalCost).toEqual(272);
expect(estimate.usingBaseFeeMutez).toEqual(272);
expect(estimate.consumedMilligas).toEqual(100040);
done();
});
Expand All @@ -54,11 +56,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 });
expect(estimate.gasLimit).toEqual(201);
expect(estimate.storageLimit).toEqual(257);
expect(estimate.suggestedFeeMutez).toEqual(374);
expect(estimate.suggestedFeeMutez).toEqual(372);
expect(estimate.burnFeeMutez).toEqual(64250);
expect(estimate.minimalFeeMutez).toEqual(274);
expect(estimate.totalCost).toEqual(64524);
expect(estimate.usingBaseFeeMutez).toEqual(274);
expect(estimate.minimalFeeMutez).toEqual(272);
expect(estimate.totalCost).toEqual(64522);
expect(estimate.usingBaseFeeMutez).toEqual(272);
expect(estimate.consumedMilligas).toEqual(100040);
done();
});
Expand All @@ -71,12 +73,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
});
expect(estimate.gasLimit).toEqual(677);
expect(estimate.storageLimit).toEqual(571);
expect(estimate.suggestedFeeMutez).toEqual(713);
expect(estimate.suggestedFeeMutez).toEqual(711);
expect(estimate.burnFeeMutez).toEqual(142750);
expect(estimate.minimalFeeMutez).toEqual(613);
expect(estimate.totalCost).toEqual(143363);
expect(estimate.usingBaseFeeMutez).toEqual(613);
expect(estimate.consumedMilligas).toEqual(576347);
expect(estimate.minimalFeeMutez).toEqual(611);
expect(estimate.totalCost).toEqual(143361);
expect(estimate.usingBaseFeeMutez).toEqual(611);
expect(estimate.consumedMilligas).toEqual(576230);
done();
});

Expand All @@ -87,26 +89,26 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
});
expect(estimate.gasLimit).toEqual(200);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(369);
expect(estimate.suggestedFeeMutez).toEqual(367);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(269);
expect(estimate.totalCost).toEqual(269);
expect(estimate.usingBaseFeeMutez).toEqual(269);
expect(estimate.minimalFeeMutez).toEqual(267);
expect(estimate.totalCost).toEqual(267);
expect(estimate.usingBaseFeeMutez).toEqual(267);
expect(estimate.consumedMilligas).toEqual(100000);
done();
});

it('Verify .estimate.transfer for internal transfer to allocated implicit', async (done) => {
const tx = contract.methods.do(MANAGER_LAMBDA.transferImplicit(knownBaker, 5)).toTransferParams();
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1457);
expect(estimate.gasLimit).toEqual(1456);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(572);
expect(estimate.suggestedFeeMutez).toEqual(570);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(472);
expect(estimate.totalCost).toEqual(472);
expect(estimate.usingBaseFeeMutez).toEqual(472);
expect(estimate.consumedMilligas).toEqual(1356735);
expect(estimate.minimalFeeMutez).toEqual(470);
expect(estimate.totalCost).toEqual(470);
expect(estimate.usingBaseFeeMutez).toEqual(470);
expect(estimate.consumedMilligas).toEqual(1355917);
done();
});

Expand All @@ -117,42 +119,42 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
50)
).toTransferParams();
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1572);
expect(estimate.gasLimit).toEqual(1571);
expect(estimate.storageLimit).toEqual(514);
expect(estimate.suggestedFeeMutez).toEqual(643);
expect(estimate.suggestedFeeMutez).toEqual(641);
expect(estimate.burnFeeMutez).toEqual(128500);
expect(estimate.minimalFeeMutez).toEqual(543);
expect(estimate.totalCost).toEqual(129043);
expect(estimate.usingBaseFeeMutez).toEqual(543);
expect(estimate.consumedMilligas).toEqual(1471270);
expect(estimate.minimalFeeMutez).toEqual(541);
expect(estimate.totalCost).toEqual(129041);
expect(estimate.usingBaseFeeMutez).toEqual(541);
expect(estimate.consumedMilligas).toEqual(1470446);
done();
});

it('Verify .estimate.transfer for internal origination', async (done) => {
const tx = contract.methods.do(originate()).toTransferParams();
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1868);
expect(estimate.gasLimit).toEqual(1867);
expect(estimate.storageLimit).toEqual(317);
expect(estimate.suggestedFeeMutez).toEqual(619);
expect(estimate.suggestedFeeMutez).toEqual(617);
expect(estimate.burnFeeMutez).toEqual(79250);
expect(estimate.minimalFeeMutez).toEqual(519);
expect(estimate.totalCost).toEqual(79769);
expect(estimate.usingBaseFeeMutez).toEqual(519);
expect(estimate.consumedMilligas).toEqual(1767848);
expect(estimate.minimalFeeMutez).toEqual(517);
expect(estimate.totalCost).toEqual(79767);
expect(estimate.usingBaseFeeMutez).toEqual(517);
expect(estimate.consumedMilligas).toEqual(1766527);
done();
});

it('Verify .estimate.transfer for multiple internal originations', async (done) => {
const tx = contract.methods.do(originate2()).toTransferParams();
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(2394);
expect(estimate.gasLimit).toEqual(2392);
expect(estimate.storageLimit).toEqual(634);
expect(estimate.suggestedFeeMutez).toEqual(737);
expect(estimate.suggestedFeeMutez).toEqual(735);
expect(estimate.burnFeeMutez).toEqual(158500);
expect(estimate.minimalFeeMutez).toEqual(637);
expect(estimate.totalCost).toEqual(159137);
expect(estimate.usingBaseFeeMutez).toEqual(637);
expect(estimate.consumedMilligas).toEqual(2293496);
expect(estimate.minimalFeeMutez).toEqual(635);
expect(estimate.totalCost).toEqual(159135);
expect(estimate.usingBaseFeeMutez).toEqual(635);
expect(estimate.consumedMilligas).toEqual(2291666);
// Do the actual operation
const op2 = await contract.methods.do(originate2()).send();
await op2.confirmation();
Expand Down Expand Up @@ -185,16 +187,16 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) });
expect(estimate.gasLimit).toEqual(201);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(372);
expect(estimate.suggestedFeeMutez).toEqual(370);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(272);
expect(estimate.totalCost).toEqual(272);
expect(estimate.usingBaseFeeMutez).toEqual(272);
expect(estimate.minimalFeeMutez).toEqual(270);
expect(estimate.totalCost).toEqual(270);
expect(estimate.usingBaseFeeMutez).toEqual(270);
expect(estimate.consumedMilligas).toEqual(100040);
done();
});

it('Estimate transfer to regular address with a fixed fee', async (done) => {
nairobinet('Estimate transfer to regular address with a fixed fee', async (done) => {

const params = { fee: 2000, to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) };

Expand All @@ -204,7 +206,17 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
done();
});

it('Estimate transfer to regular address with insufficient balance', async (done) => {
mondaynet('Estimate transfer to regular address with a fixed fee', async (done) => {

const params = { fee: 2000, to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) };

await expect(LowAmountTez.estimate.transfer(params)).rejects.toMatchObject({
id: 'proto.alpha.implicit.empty_implicit_contract',
});
done();
});

nairobinet('Estimate transfer to regular address with insufficient balance', async (done) => {
await expect(
LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt })
).rejects.toMatchObject({
Expand All @@ -213,6 +225,15 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
done();
});

mondaynet('Estimate transfer to regular address with insufficient balance', async (done) => {
await expect(
LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt })
).rejects.toMatchObject({
id: 'proto.alpha.tez.subtraction_underflow',
});
done();
});

it('Estimate transfer to regular address with insufficient balance to pay storage for allocation', async (done) => {
await expect(
LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) })
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/contract-events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CONFIGS } from "./config";
import { mainContractWithDuplicateEvents } from "./main-contract-with-duplicate-events";
import { mainContractWithDuplicateEvents } from "./data/main-contract-with-duplicate-events";

CONFIGS().forEach(({ lib, rpc, setup }) => {
const Tezos = lib;
Expand Down
47 changes: 25 additions & 22 deletions integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,85 +48,88 @@ interface TestCase {
expected?: object;
}

export const commonCases: TestCase[] = [
export const nairobiCases: TestCase[] = [
{
name: 'Delegation',
name: 'Set deposits limit 1000000',
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.DELEGATION,
delegate: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
kind: OpKind.SET_DEPOSITS_LIMIT,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
limit: '1000000',
},
],
},
},
{
name: 'Reveal',
name: 'Unset deposits limit',
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.REVEAL,
kind: OpKind.SET_DEPOSITS_LIMIT,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
public_key: 'edpkvS5QFv7KRGfa3b87gg9DBpxSm3NpSwnjhUjNBQrRUUR66F7C9g',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
storage_limit: '10'
},
],
},
},
];

export const commonCases: TestCase[] = [
{
name: 'Ballot',
name: 'Delegation',
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.BALLOT,
kind: OpKind.DELEGATION,
delegate: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
period: -300,
ballot: 'yay',
proposal: 'PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
},
],
},
},
{
name: 'Set deposits limit 1000000',
name: 'Reveal',
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.SET_DEPOSITS_LIMIT,
kind: OpKind.REVEAL,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
public_key: 'edpkvS5QFv7KRGfa3b87gg9DBpxSm3NpSwnjhUjNBQrRUUR66F7C9g',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
limit: '1000000',
},
],
},
},
{
name: 'Unset deposits limit',
name: 'Ballot',
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.SET_DEPOSITS_LIMIT,
counter: '1',
kind: OpKind.BALLOT,
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10'
period: -300,
ballot: 'yay',
proposal: 'PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb',
},
],
},
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/known-contracts-ProtoALph.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { KnownContracts } from './known-contracts';
export const knownContractsProtoALph: KnownContracts = {
contract: "KT1EqE9uiQoodrX3hymdTsMzv4Ugh9Ba7WQh",
bigMapContract: "KT1AhkcgTg5Yve1akqhp3L2VYe9wuJyr9Cf2",
tzip12BigMapOffChainContract: "KT1L13TdpnvSnH9oax8BVsjsGwYUEAymvsUY",
saplingContract: "KT1REUu1WbovnUHgxP5ywV6Nc8WSTSquoRmw",
onChainViewContractAddress: "KT1NewFz74bCpfQw1qVkxGbN6MncRaVgaymH"
contract: "KT1JWuKFJWDYvBWWiH6GDrMn7KbgbSXnYPZS",
bigMapContract: "KT1FiKJtmUd3AU5Ey3bNGahehudqtFkatprA",
tzip12BigMapOffChainContract: "KT1Mq4TszoSWeXvsqPWSz45W6aVVSDrxizNW",
saplingContract: "KT1ENuhqgJLa7EHvgf2LDvRp8Z9wZ9LNkg5J",
onChainViewContractAddress: "KT1XBxr9fbJV4XFRwLx3EB9kpazGouFFYhP6",
};
Loading

0 comments on commit 2bc19bc

Please sign in to comment.