Skip to content

Commit

Permalink
PsParisCZ (#2988)
Browse files Browse the repository at this point in the history
* feat: updated paris new protocol hash PtParisCNYDDgwNyJTAuPTNjmvS6FEWP6nJi4KCqiNPMD1ESjTF

* feat: updated paris new protocol hash PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi

* test: updated to run pspariscz tests

* test: updated estimate assertion

* test: updated PtParisCN

* test: updated estimate and constants assertions
  • Loading branch information
hui-an-yang committed Jun 18, 2024
1 parent 19ff26c commit d44ee8a
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 172 deletions.
82 changes: 41 additions & 41 deletions integration-tests/__tests__/contract/estimation-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ 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(101);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(188);
expect(estimate.suggestedFeeMutez).toEqual(186);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(168);
expect(estimate.totalCost).toEqual(168);
expect(estimate.usingBaseFeeMutez).toEqual(168);
expect(estimate.minimalFeeMutez).toEqual(166);
expect(estimate.totalCost).toEqual(166);
expect(estimate.usingBaseFeeMutez).toEqual(166);
expect(estimate.consumedMilligas).toEqual(100040);
});

it('Verify .estimate.transfer with unallocated destination', async () => {
const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 });
expect(estimate.gasLimit).toEqual(101);
expect(estimate.storageLimit).toEqual(277);
expect(estimate.suggestedFeeMutez).toEqual(188);
expect(estimate.suggestedFeeMutez).toEqual(186);
expect(estimate.burnFeeMutez).toEqual(69250);
expect(estimate.minimalFeeMutez).toEqual(168);
expect(estimate.totalCost).toEqual(69418);
expect(estimate.usingBaseFeeMutez).toEqual(168);
expect(estimate.minimalFeeMutez).toEqual(166);
expect(estimate.totalCost).toEqual(69416);
expect(estimate.usingBaseFeeMutez).toEqual(166);
expect(estimate.consumedMilligas).toEqual(100040);
});

Expand All @@ -69,11 +69,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
});
expect(estimate.gasLimit).toEqual(677);
expect(estimate.storageLimit).toEqual(591);
expect(estimate.suggestedFeeMutez).toEqual(537);
expect(estimate.suggestedFeeMutez).toEqual(535);
expect(estimate.burnFeeMutez).toEqual(147750);
expect(estimate.minimalFeeMutez).toEqual(517);
expect(estimate.totalCost).toEqual(148267);
expect(estimate.usingBaseFeeMutez).toEqual(517);
expect(estimate.minimalFeeMutez).toEqual(515);
expect(estimate.totalCost).toEqual(148265);
expect(estimate.usingBaseFeeMutez).toEqual(515);
expect(estimate.consumedMilligas).toEqual(676402);
});

Expand All @@ -84,25 +84,25 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
});
expect(estimate.gasLimit).toEqual(100);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(183);
expect(estimate.suggestedFeeMutez).toEqual(181);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(163);
expect(estimate.totalCost).toEqual(163);
expect(estimate.usingBaseFeeMutez).toEqual(163);
expect(estimate.minimalFeeMutez).toEqual(161);
expect(estimate.totalCost).toEqual(161);
expect(estimate.usingBaseFeeMutez).toEqual(161);
expect(estimate.consumedMilligas).toEqual(100000);
});

it('Verify .estimate.transfer for internal transfer to allocated implicit', async () => {
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(396);
expect(estimate.suggestedFeeMutez).toEqual(394);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(376);
expect(estimate.totalCost).toEqual(376);
expect(estimate.usingBaseFeeMutez).toEqual(376);
expect(estimate.consumedMilligas).toEqual(1456142);
expect(estimate.minimalFeeMutez).toEqual(374);
expect(estimate.totalCost).toEqual(374);
expect(estimate.usingBaseFeeMutez).toEqual(374);
expect(estimate.consumedMilligas).toEqual(1455970);
});

it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => {
Expand All @@ -114,38 +114,38 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1571);
expect(estimate.storageLimit).toEqual(534);
expect(estimate.suggestedFeeMutez).toEqual(467);
expect(estimate.suggestedFeeMutez).toEqual(465);
expect(estimate.burnFeeMutez).toEqual(133500);
expect(estimate.minimalFeeMutez).toEqual(447);
expect(estimate.totalCost).toEqual(133947);
expect(estimate.usingBaseFeeMutez).toEqual(447);
expect(estimate.consumedMilligas).toEqual(1570671);
expect(estimate.minimalFeeMutez).toEqual(445);
expect(estimate.totalCost).toEqual(133945);
expect(estimate.usingBaseFeeMutez).toEqual(445);
expect(estimate.consumedMilligas).toEqual(1570499);
});

it('Verify .estimate.transfer for internal origination', async () => {
const tx = contract.methods.do(originate()).toTransferParams();
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1867);
expect(estimate.storageLimit).toEqual(337);
expect(estimate.suggestedFeeMutez).toEqual(443);
expect(estimate.suggestedFeeMutez).toEqual(441);
expect(estimate.burnFeeMutez).toEqual(84250);
expect(estimate.minimalFeeMutez).toEqual(423);
expect(estimate.totalCost).toEqual(84673);
expect(estimate.usingBaseFeeMutez).toEqual(423);
expect(estimate.consumedMilligas).toEqual(1866766);
expect(estimate.minimalFeeMutez).toEqual(421);
expect(estimate.totalCost).toEqual(84671);
expect(estimate.usingBaseFeeMutez).toEqual(421);
expect(estimate.consumedMilligas).toEqual(1866594);
});

it('Verify .estimate.transfer for multiple internal originations', async () => {
const tx = contract.methods.do(originate2()).toTransferParams();
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(2392);
expect(estimate.storageLimit).toEqual(654);
expect(estimate.suggestedFeeMutez).toEqual(561);
expect(estimate.suggestedFeeMutez).toEqual(559);
expect(estimate.burnFeeMutez).toEqual(163500);
expect(estimate.minimalFeeMutez).toEqual(541);
expect(estimate.totalCost).toEqual(164041);
expect(estimate.usingBaseFeeMutez).toEqual(541);
expect(estimate.consumedMilligas).toEqual(2391919);
expect(estimate.minimalFeeMutez).toEqual(539);
expect(estimate.totalCost).toEqual(164039);
expect(estimate.usingBaseFeeMutez).toEqual(539);
expect(estimate.consumedMilligas).toEqual(2391747);
// Do the actual operation
const op2 = await contract.methods.do(originate2()).send();
await op2.confirmation();
Expand Down Expand Up @@ -176,11 +176,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + getRevealFee(await LowAmountTez.signer.publicKeyHash())) });
expect(estimate.gasLimit).toEqual(101);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(187);
expect(estimate.suggestedFeeMutez).toEqual(185);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(167);
expect(estimate.totalCost).toEqual(167);
expect(estimate.usingBaseFeeMutez).toEqual(167);
expect(estimate.minimalFeeMutez).toEqual(165);
expect(estimate.totalCost).toEqual(165);
expect(estimate.usingBaseFeeMutez).toEqual(165);
expect(estimate.consumedMilligas).toEqual(100040);
});

Expand Down
14 changes: 5 additions & 9 deletions integration-tests/__tests__/contract/operations/staking.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { CONFIGS } from "../../../config";
import { Protocols } from '@taquito/taquito';
import { ProtoGreaterOrEqual } from '@taquito/michel-codec';

CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => {
CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => {
const Tezos = lib;
const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBx) ? test : test.skip;

describe(`Staking pseudo operations: ${rpc}`, () => {

beforeAll(async () => {
Expand All @@ -19,7 +15,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => {
await delegateOp.confirmation();
});

parisAndAlpha('should throw an error when the destination specified is not the same as source', async () => {
it('should throw an error when the destination specified is not the same as source', async () => {
expect(async () => {
const op = await Tezos.contract.stake({
amount: 0.1,
Expand All @@ -28,7 +24,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => {
}).rejects.toThrow();
});

parisAndAlpha('should be able to stake funds to a designated delegate', async () => {
it('should be able to stake funds to a designated delegate', async () => {
const op = await Tezos.contract.stake({
amount: 0.1
});
Expand All @@ -38,7 +34,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => {
expect(op.status).toEqual('applied');
});

parisAndAlpha('should be able to unstake funds from a designated delegate', async () => {
it('should be able to unstake funds from a designated delegate', async () => {
const op = await Tezos.contract.unstake({
amount: 0.1
});
Expand All @@ -48,7 +44,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => {
expect(op.status).toEqual('applied');
});

parisAndAlpha('should be able to finalize_unstake funds from a designated delegate', async () => {
it('should be able to finalize_unstake funds from a designated delegate', async () => {
const op = await Tezos.contract.finalizeUnstake({});
await op.confirmation();

Expand Down
15 changes: 2 additions & 13 deletions integration-tests/__tests__/local-forging.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import { CONFIGS } from "../config";
import { commonCases, parisCases } from '../data/allTestsCases';
import { commonCases } from '../data/allTestsCases';
import { LocalForger, ProtocolsHash } from '@taquito/local-forging'
import { Protocols, TezosToolkit } from "@taquito/taquito";
import { ProtoGreaterOrEqual } from '@taquito/michel-codec';
import { TezosToolkit } from "@taquito/taquito";

CONFIGS().forEach(({ rpc, protocol }) => {
const Tezos = new TezosToolkit(rpc);
const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBx) ? test : test.skip

describe(`Test local forger: ${rpc}`, () => {
parisCases.forEach(({ name, operation, expected }) => {
parisAndAlpha(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => {
const localForger = new LocalForger(protocol as unknown as ProtocolsHash);
const result = await localForger.forge(operation);
const rpcResult = await Tezos.rpc.forgeOperations(operation);
expect(result).toEqual(rpcResult);
expect(await localForger.parse(rpcResult)).toEqual(expected || operation);
});
});
// all protocols
commonCases.forEach(({ name, operation, expected }) => {
it(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async () => {
Expand Down
53 changes: 26 additions & 27 deletions integration-tests/__tests__/rpc/get-protocol-constants.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ConstantsResponseProto019, ConstantsResponseProto020 } from '@taquito/r

CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
const Tezos = lib;
const parisnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PtParisBx) ? test : test.skip;
const parisnet = (networkType == NetworkType.TESTNET && protocol === Protocols.PsParisCZ) ? 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 @@ -162,15 +162,15 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
const constants: ConstantsResponseProto020 = await Tezos.rpc.getConstants();
expect(constants).toEqual({
adaptive_issuance_activation_vote_enable: true,
adaptive_issuance_force_activation: false,
adaptive_issuance_force_activation: true,
adaptive_issuance_launch_ema_threshold: 0,
adaptive_rewards_params: {
center_dz: {
denominator: "2",
numerator: "1",
},
growth_rate: {
denominator: "25",
denominator: "100",
numerator: "1",
},
issuance_ratio_final_max: {
Expand Down Expand Up @@ -210,40 +210,40 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
michelson_maximum_type_size: 2001,
smart_rollup_max_wrapped_proof_binary_size: 30000,
smart_rollup_max_number_of_messages_per_level: '1000000',
blocks_per_cycle: 12288,
blocks_per_commitment: 96,
blocks_per_cycle: 128,
blocks_per_commitment: 16,
blocks_preservation_cycles: 1,
nonce_revelation_threshold: 768,
nonce_revelation_threshold: 32,
ns_enable: true,
cycles_per_voting_period: 1,
hard_gas_limit_per_operation: new BigNumber(1040000),
hard_gas_limit_per_block: new BigNumber(1733333),
hard_gas_limit_per_block: new BigNumber(5200000),
proof_of_work_threshold: new BigNumber(-1),
minimal_stake: new BigNumber(6000000000),
origination_size: 257,
cost_per_byte: new BigNumber(250),
hard_storage_limit_per_operation: new BigNumber(60000),
percentage_of_frozen_deposits_slashed_per_double_attestation: 5000,
percentage_of_frozen_deposits_slashed_per_double_baking: 500,
percentage_of_frozen_deposits_slashed_per_double_baking: 700,
minimal_frozen_stake: '600000000',
limit_of_delegation_over_baking: 9,
liquidity_baking_subsidy: new BigNumber(5000000),
issuance_weights: {
attesting_reward_weight: 10240,
baking_reward_bonus_weight: 5120,
baking_reward_fixed_portion_weight: 5120,
base_total_issued_per_minute: "80007812",
base_total_issued_per_minute: "85007812",
seed_nonce_revelation_tip_weight: 1,
vdf_revelation_tip_weight: 1,
},
min_proposal_quorum: 500,
edge_of_staking_over_delegation: 2,
global_limit_of_staking_over_baking: 5,
liquidity_baking_toggle_ema_threshold: 1000000000,
max_operations_time_to_live: 360,
minimal_block_delay: new BigNumber(5),
delay_increment_per_round: new BigNumber(2),
delegate_parameters_activation_delay: 5,
liquidity_baking_toggle_ema_threshold: 100000,
max_operations_time_to_live: 120,
minimal_block_delay: new BigNumber(7),
delay_increment_per_round: new BigNumber(7),
delegate_parameters_activation_delay: 3,
direct_ticket_spending_enable: false,
consensus_committee_size: 7000,
consensus_threshold: 4667,
Expand Down Expand Up @@ -271,11 +271,11 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
},
quorum_max: 7000,
quorum_min: 2000,
smart_rollup_arith_pvm_enable: false,
smart_rollup_challenge_window_in_blocks: 241920,
smart_rollup_commitment_period_in_blocks: 180,
smart_rollup_max_lookahead_in_blocks: 518400,
smart_rollup_max_active_outbox_levels: 241920,
smart_rollup_arith_pvm_enable: true,
smart_rollup_challenge_window_in_blocks: 40,
smart_rollup_commitment_period_in_blocks: 20,
smart_rollup_max_lookahead_in_blocks: 30000,
smart_rollup_max_active_outbox_levels: 20160,
smart_rollup_max_outbox_messages_per_level: 100,
smart_rollup_max_number_of_cemented_commitments: 5,
smart_rollup_max_number_of_parallel_games: 32,
Expand All @@ -285,19 +285,18 @@ CONFIGS().forEach(({ lib, protocol, rpc, networkType }) => {
smart_rollup_private_enable: true,
smart_rollup_reveal_activation_level: {
dal_attested_slots_validity_lag: 241920,
dal_page: 8193,
dal_parameters: 8193,
dal_page: 1,
dal_parameters: 1,
metadata: 0,
raw_data: {
Blake2B: 0,
},
},
smart_rollup_riscv_pvm_enable: false,
smart_rollup_stake_amount: '10000000000',
smart_rollup_timeout_period_in_blocks: 120960,
testnet_dictator: 'tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8',
vdf_difficulty: new BigNumber(10000000000),
zk_rollup_enable: false,
smart_rollup_riscv_pvm_enable: true,
smart_rollup_stake_amount: '32000000',
smart_rollup_timeout_period_in_blocks: 500,
vdf_difficulty: new BigNumber(10000000),
zk_rollup_enable: true,
zk_rollup_max_ticket_payload_size: 2048,
zk_rollup_min_pending_to_process: 10,
zk_rollup_origination_size: 4000,
Expand Down
16 changes: 10 additions & 6 deletions integration-tests/__tests__/rpc/nodes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { CONFIGS } from '../../config';
import { DefaultContractType, Protocols } from "@taquito/taquito";
import { DefaultContractType } from "@taquito/taquito";
import { RpcClientCache, RpcClient, RPCRunViewParam, RPCRunScriptViewParam, PendingOperationsV1, PendingOperationsV2, PvmKind } from '@taquito/rpc';
import { encodeExpr } from '@taquito/utils';
import { Schema } from '@taquito/michelson-encoder';
import { tokenBigmapCode, tokenBigmapStorage } from '../../data/token_bigmap';
import { ticketCode, ticketStorage } from '../../data/code_with_ticket';
import { ProtoGreaterOrEqual } from '@taquito/michel-codec';

CONFIGS().forEach(
({
Expand All @@ -21,7 +20,6 @@ CONFIGS().forEach(
}) => {
const Tezos = lib;
const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test;
const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBx) ? test : test.skip;

let ticketContract: DefaultContractType;

Expand Down Expand Up @@ -156,7 +154,7 @@ CONFIGS().forEach(
const allDelegates = await rpcClient.getAllDelegates();
expect(allDelegates).toBeDefined();

const allViableDelegates = await rpcClient.getAllDelegates({active: true, with_minimal_stake: true});
const allViableDelegates = await rpcClient.getAllDelegates({ active: true, with_minimal_stake: true });
expect(allViableDelegates).toBeDefined();

expect(allViableDelegates.length).toBeLessThanOrEqual(allDelegates.length);
Expand Down Expand Up @@ -482,9 +480,15 @@ CONFIGS().forEach(
expect(ticketBalances[0].amount).toBeDefined();
});

parisAndAlpha(`Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for ${rpc}`, async () => {
it(`Verify that rpcClient.getAdaptiveIssuanceLaunchCycle will retrieve launch cycle 6 for ${rpc}`, async () => {
const launchCycle = await rpcClient.getAdaptiveIssuanceLaunchCycle();
expect(launchCycle).toEqual(6);
if (rpc.includes('ghostnet')) {
expect(launchCycle).toEqual(1054);
} else if (rpc.includes('parisnet')) {
expect(launchCycle).toEqual(6);
} else if (rpc.includes('mondaynet') || rpc.includes('weeklynet')) {
expect(launchCycle).toEqual(5);
}
})

it('Verify that rpcClient.getPendingOperations v1 will retrieve the pending operations in mempool with property applied', async () => {
Expand Down
Loading

0 comments on commit d44ee8a

Please sign in to comment.