diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90fc6e90f7..21943f26ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - node: + node: - '16.13.1' - '17.3.x' steps: @@ -44,6 +44,7 @@ jobs: matrix: protocol: - kathmandunet + - limanet steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 @@ -78,4 +79,4 @@ jobs: POLLING_INTERVAL_MILLISECONDS: 100 RPC_CACHE_MILLISECONDS: 0 TEZOS_BAKER: tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb - - run: docker kill my-sandbox \ No newline at end of file + - run: docker kill my-sandbox diff --git a/integration-tests/config.ts b/integration-tests/config.ts index 9135cc9368..f361dcef4b 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -6,7 +6,7 @@ import { importKey, InMemorySigner } from '@taquito/signer'; import { RpcClient, RpcClientCache } from '@taquito/rpc'; import { knownBigMapContractProtoALph, knownContractProtoALph, knownOnChainViewContractAddressProtoALph, knownSaplingContractProtoALph, knownTzip12BigMapOffChainContractProtoALph, txRollupAddressProtoALph } from './known-contracts-ProtoALph'; import { knownContractPtKathman, knownBigMapContractPtKathman, knownTzip12BigMapOffChainContractPtKathman, knownSaplingContractPtKathman, knownOnChainViewContractAddressPtKathman, txRollupAddressPtKathman } from './known-contracts-PtKathman'; -import { knownContractPtJakart2, knownBigMapContractPtJakart2, knownTzip12BigMapOffChainContractPtJakart2, knownSaplingContractPtJakart2, knownOnChainViewContractAddressPtJakart2, txRollupAddressPtJakart2 } from './known-contracts-PtJakart2'; +import { knownContractPtLimaPtL, knownBigMapContractPtLimaPtL, knownTzip12BigMapOffChainContractPtLimaPtL, knownSaplingContractPtLimaPtL, knownOnChainViewContractAddressPtLimaPtL, txRollupAddressPtLimaPtL } from './known-contracts-PtLimaPtL'; const nodeCrypto = require('crypto'); @@ -91,32 +91,33 @@ const kathmandunetEphemeral = { protocol: Protocols.PtKathman, signerConfig: { type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY, - keyUrl: 'https://api.tez.ie/keys/kathmandunet', + keyUrl: 'http://key-gen-1.i.tez.ie:3000/kathmandunet', requestHeaders: { Authorization: 'Bearer taquito-example' }, } }; -const jakartanetEphemeral = { - rpc: process.env['TEZOS_RPC_JAKARTANET'] || 'https://jakartanet-archive.ecadinfra.com', +const limanetEphemeral = { + rpc: process.env['TEZOS_RPC_LIMANET'] || 'https://limanet.ecadinfra.com', pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined, rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000', knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', - knownContract: process.env['TEZOS_JAKARTANET_CONTRACT_ADDRESS'] || knownContractPtJakart2, - knownBigMapContract: process.env['TEZOS_JAKARTANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtJakart2, - knownTzip1216Contract: process.env['TEZOS_JAKARTANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtJakart2, - knownSaplingContract: process.env['TEZOS_JAKARTANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtJakart2, - txRollupWithdrawContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '', - txRollupDepositContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '', - knownViewContract: process.env['TEZOS_JAKARTANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtJakart2, - txRollupAddress: process.env['TEZOS_JAKARTANET_TXROLLUP_ADDRESS'] || txRollupAddressPtJakart2, - protocol: Protocols.PtJakart2, + knownContract: process.env['TEZOS_LIMANET_CONTRACT_ADDRESS'] || knownContractPtLimaPtL, + knownBigMapContract: process.env['TEZOS_LIMANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtLimaPtL, + knownTzip1216Contract: process.env['TEZOS_LIMANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtLimaPtL, + knownSaplingContract: process.env['TEZOS_LIMANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtLimaPtL, + txRollupWithdrawContract: process.env['TEZOS_LIMANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '', + txRollupDepositContract: process.env['TEZOS_LIMANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '', + knownViewContract: process.env['TEZOS_LIMANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtLimaPtL, + txRollupAddress: process.env['TEZOS_LIMANET_TXROLLUP_ADDRESS'] || txRollupAddressPtLimaPtL, + protocol: Protocols.PtLimaPtL, signerConfig: { type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY, - keyUrl: 'https://api.tez.ie/keys/jakartanet', + keyUrl: 'http://key-gen-1.i.tez.ie:3000/limanet', requestHeaders: { Authorization: 'Bearer taquito-example' }, }, }; + const mondaynetEphemeral = { rpc: process.env['TEZOS_RPC_MONDAYNET'] || 'http://mondaynet.ecadinfra.com:8732', pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined, @@ -155,20 +156,20 @@ const kathmandunetSecretKey = { signerConfig: defaultSecretKey, }; -const jakartanetSecretKey = { - rpc: process.env['TEZOS_RPC_JAKARTANET'] || 'https://jakartanet-archive.ecadinfra.com', +const limanetSecretKey = { + rpc: process.env['TEZOS_RPC_LIMANET'] || 'https://limanet-archive.ecadinfra.com', pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined, rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000', knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD', - knownContract: process.env['TEZOS_JAKARTANET_CONTRACT_ADDRESS'] || knownContractPtJakart2, - knownBigMapContract: process.env['TEZOS_JAKARTANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtJakart2, - knownTzip1216Contract: process.env['TEZOS_JAKARTANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtJakart2, - knownSaplingContract: process.env['TEZOS_JAKARTANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtJakart2, - txRollupWithdrawContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '', - txRollupDepositContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '', - knownViewContract: process.env['TEZOS_JAKARTANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtJakart2, - txRollupAddress: process.env['TEZOS_JAKARTANET_TXROLLUP_ADDRESS'] || txRollupAddressPtJakart2, - protocol: Protocols.PtJakart2, + knownContract: process.env['TEZOS_LIMANET_CONTRACT_ADDRESS'] || knownContractPtLimaPtL, + knownBigMapContract: process.env['TEZOS_LIMANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtLimaPtL, + knownTzip1216Contract: process.env['TEZOS_LIMANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtLimaPtL, + knownSaplingContract: process.env['TEZOS_LIMANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtLimaPtL, + txRollupWithdrawContract: process.env['TEZOS_LIMANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '', + txRollupDepositContract: process.env['TEZOS_LIMANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '', + knownViewContract: process.env['TEZOS_LIMANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtLimaPtL, + txRollupAddress: process.env['TEZOS_LIMANET_TXROLLUP_ADDRESS'] || txRollupAddressPtLimaPtL, + protocol: Protocols.PtLimaPtL, signerConfig: defaultSecretKey }; @@ -192,21 +193,21 @@ const mondaynetSecretKey = { const providers: Config[] = []; if (process.env['RUN_WITH_SECRET_KEY']) { - providers.push(jakartanetSecretKey, kathmandunetSecretKey); -} else if (process.env['RUN_JAKARTANET_WITH_SECRET_KEY']) { - providers.push(jakartanetSecretKey); + providers.push(limanetSecretKey, kathmandunetSecretKey); +} else if (process.env['RUN_LIMANET_WITH_SECRET_KEY']) { + providers.push(limanetSecretKey); } else if (process.env['RUN_KATHMANDUNET_WITH_SECRET_KEY']) { providers.push(kathmandunetSecretKey); } else if (process.env['RUN_MONDAYNET_WITH_SECRET_KEY']) { providers.push(mondaynetSecretKey); -} else if (process.env['JAKARTANET']) { - providers.push(jakartanetEphemeral); } else if (process.env['KATHMANDUNET']) { providers.push(kathmandunetEphemeral); +} else if (process.env['LIMANET']) { + providers.push(limanetEphemeral); } else if (process.env['MONDAYNET']) { providers.push(mondaynetEphemeral); } else { - providers.push(jakartanetEphemeral, kathmandunetEphemeral); + providers.push(limanetEphemeral, kathmandunetEphemeral); } const setupForger = (Tezos: TezosToolkit, forger: ForgerType): void => { @@ -250,7 +251,7 @@ const setupSignerWithEphemeralKey = async ( const httpClient = new HttpBackend(); try { - const { id, pkh } = await httpClient.createRequest({ + const { id, pkh } = await httpClient.createRequest<{ id: string; pkh: string }>({ url: ephemeralUrl, method: 'POST', headers: requestHeaders, @@ -352,4 +353,4 @@ export const CONFIGS = () => { ); return [...prev, ...configs]; }, [] as ConfigWithSetup[]); -}; \ No newline at end of file +}; diff --git a/integration-tests/contract-empty-implicit-account-into-new-implicit-account.spec.ts b/integration-tests/contract-empty-implicit-account-into-new-implicit-account.spec.ts index 3e81f4fb6d..4e44baa51c 100644 --- a/integration-tests/contract-empty-implicit-account-into-new-implicit-account.spec.ts +++ b/integration-tests/contract-empty-implicit-account-into-new-implicit-account.spec.ts @@ -1,11 +1,9 @@ import { Protocols } from "@taquito/taquito"; import { CONFIGS } from "./config"; -CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => { - +CONFIGS().forEach(({ lib, rpc, setup, createAddress }) => { + const Tezos = lib; - const jakartanet = (protocol === Protocols.PtJakart2) ? test : test.skip; - const kathmandunetAndAlpha = (protocol === Protocols.PtKathman || protocol === Protocols.ProtoALpha) ? test : test.skip; describe(`Test emptying a revealed implicit account into a new implicit account through contract api using: ${rpc}`, () => { @@ -14,58 +12,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => { done() }) - jakartanet('Verify that a new unrevealed implicit account can be created with the createAddress function and the sender account can be emptied into the created one', async (done) => { - - const receiver = await createAddress(); - const receiver_pkh = await receiver.signer.publicKeyHash(); - - // create and fund the account we want to empty - const sender = await createAddress(); - const sender_pkh = await sender.signer.publicKeyHash(); - const op = await Tezos.contract.transfer({ to: sender_pkh, amount: 1 }); - await op.confirmation(); - - // Sending 1 token from the account we want to empty - // This will do the reveal operation automatically - const op2 = await sender.contract.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.1 }); - await op2.confirmation(); - - const balance = await Tezos.tz.getBalance(sender_pkh); - - const estimate = await sender.estimate.transfer({ - to: receiver_pkh, - amount: 0.5, - }); - - // // Emptying the account - const totalFees = estimate.suggestedFeeMutez + estimate.burnFeeMutez; - const maxAmount = balance.minus(totalFees).toNumber(); - // // Temporary fix, see https://gitlab.com/tezos/tezos/-/issues/1754 - // // we need to increase the gasLimit and fee returned by the estimation - const gasBuffer = 500; - const MINIMAL_FEE_PER_GAS_MUTEZ = 0.1; - const increasedFee = (gasBuffer: number, opSize: number) => { - return (gasBuffer) * MINIMAL_FEE_PER_GAS_MUTEZ + opSize - } - - const opTransfer = await sender.contract.transfer({ - to: receiver_pkh, - mutez: true, - amount: maxAmount - increasedFee(gasBuffer, Number(estimate.opSize)), - fee: estimate.suggestedFeeMutez + increasedFee(gasBuffer, Number(estimate.opSize)), // baker fees - gasLimit: estimate.gasLimit + gasBuffer, - storageLimit: estimate.storageLimit - }); - - await opTransfer.confirmation(); - const finalBalance = await Tezos.tz.getBalance(sender_pkh); - - expect(finalBalance.toString()).toEqual("0") - - done(); - }); - - kathmandunetAndAlpha('Verify that a new unrevealed implicit account can be created from the sender account and the sender account can be emptied into the created one.', async (done) => { + it('Verify that a new unrevealed implicit account can be created from the sender account and the sender account can be emptied into the created one.', async (done) => { const receiver = await createAddress(); const receiver_pkh = await receiver.signer.publicKeyHash(); @@ -74,7 +21,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => { const sender_pkh = await sender.signer.publicKeyHash(); const op = await Tezos.contract.transfer({ to: sender_pkh, amount: 1 }); await op.confirmation(); - + // Sending 1 token from the account we want to empty // This will do the reveal operation automatically const op2 = await sender.contract.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.1 }); @@ -90,14 +37,14 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => { // // Emptying the account const totalFees = estimate.suggestedFeeMutez + estimate.burnFeeMutez; const maxAmount = balance.minus(totalFees).toNumber(); - + const opTransfer = await sender.contract.transfer({ to: receiver_pkh, mutez: true, - amount: maxAmount, - fee: estimate.suggestedFeeMutez, - gasLimit: estimate.gasLimit, - storageLimit: estimate.storageLimit + amount: maxAmount, + fee: estimate.suggestedFeeMutez, + gasLimit: estimate.gasLimit, + storageLimit: estimate.storageLimit }); await opTransfer.confirmation(); @@ -108,4 +55,4 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => { done(); }); }); -}) \ No newline at end of file +}) diff --git a/integration-tests/contract-estimation-tests.spec.ts b/integration-tests/contract-estimation-tests.spec.ts index 850d992972..cb8b1f3cef 100644 --- a/integration-tests/contract-estimation-tests.spec.ts +++ b/integration-tests/contract-estimation-tests.spec.ts @@ -7,7 +7,7 @@ import { managerCode } from "./data/manager_code"; CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => { const Tezos = lib; - const jakartanet = (protocol === Protocols.PtJakart2) ? test : test.skip; + const limanet = (protocol === Protocols.PtLimaPtL) ? test : test.skip; const kathmandunet = (protocol === Protocols.PtKathman) ? test : test.skip; describe(`Test estimate scenarios using: ${rpc}`, () => { @@ -38,16 +38,16 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => } }) - jakartanet('Verify .estimate.transfer with allocated destination', async (done) => { + limanet('Verify .estimate.transfer with allocated destination', async (done) => { const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 }); - expect(estimate.gasLimit).toEqual(1551); + expect(estimate.gasLimit).toEqual(1101); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(509); + expect(estimate.suggestedFeeMutez).toEqual(464); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(409); - expect(estimate.totalCost).toEqual(409); - expect(estimate.usingBaseFeeMutez).toEqual(409); - expect(estimate.consumedMilligas).toEqual(1450040); + expect(estimate.minimalFeeMutez).toEqual(364); + expect(estimate.totalCost).toEqual(364); + expect(estimate.usingBaseFeeMutez).toEqual(364); + expect(estimate.consumedMilligas).toEqual(1000040); done(); }) @@ -64,16 +64,16 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }) - jakartanet('Verify .estimate.transfer with unallocated destination', async (done) => { + limanet('Verify .estimate.transfer with unallocated destination', async (done) => { const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 }); - expect(estimate.gasLimit).toEqual(1551); + expect(estimate.gasLimit).toEqual(1101); expect(estimate.storageLimit).toEqual(257); - expect(estimate.suggestedFeeMutez).toEqual(509); + expect(estimate.suggestedFeeMutez).toEqual(464); expect(estimate.burnFeeMutez).toEqual(64250); - expect(estimate.minimalFeeMutez).toEqual(409); - expect(estimate.totalCost).toEqual(64659); - expect(estimate.usingBaseFeeMutez).toEqual(409); - expect(estimate.consumedMilligas).toEqual(1450040); + expect(estimate.minimalFeeMutez).toEqual(364); + expect(estimate.totalCost).toEqual(64614); + expect(estimate.usingBaseFeeMutez).toEqual(364); + expect(estimate.consumedMilligas).toEqual(1000040); done(); }); @@ -90,20 +90,20 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }); - jakartanet('Verify .estimate.originate simple contract', async (done) => { + limanet('Verify .estimate.originate simple contract', async (done) => { const estimate = await LowAmountTez.estimate.originate({ balance: "1", code: ligoSample, storage: 0, }) - expect(estimate.gasLimit).toEqual(1570); + expect(estimate.gasLimit).toEqual(1577); expect(estimate.storageLimit).toEqual(571); - expect(estimate.suggestedFeeMutez).toEqual(802); + expect(estimate.suggestedFeeMutez).toEqual(803); expect(estimate.burnFeeMutez).toEqual(142750); - expect(estimate.minimalFeeMutez).toEqual(702); - expect(estimate.totalCost).toEqual(143452); - expect(estimate.usingBaseFeeMutez).toEqual(702); - expect(estimate.consumedMilligas).toEqual(1469767); + expect(estimate.minimalFeeMutez).toEqual(703); + expect(estimate.totalCost).toEqual(143453); + expect(estimate.usingBaseFeeMutez).toEqual(703); + expect(estimate.consumedMilligas).toEqual(1476347); done(); }); @@ -124,7 +124,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }); - jakartanet('Verify .estimate.setDelegate result', async (done) => { + limanet('Verify .estimate.setDelegate result', async (done) => { const estimate = await LowAmountTez.estimate.setDelegate({ delegate: knownBaker, source: await LowAmountTez.signer.publicKeyHash(), @@ -156,17 +156,17 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }) - jakartanet('Verify .estimate.transfer for internal transfer to allocated implicit', async (done) => { + limanet('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(3702); + expect(estimate.gasLimit).toEqual(3249); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(797); + expect(estimate.suggestedFeeMutez).toEqual(751); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(697); - expect(estimate.totalCost).toEqual(697); - expect(estimate.usingBaseFeeMutez).toEqual(697); - expect(estimate.consumedMilligas).toEqual(3601019); + expect(estimate.minimalFeeMutez).toEqual(651); + expect(estimate.totalCost).toEqual(651); + expect(estimate.usingBaseFeeMutez).toEqual(651); + expect(estimate.consumedMilligas).toEqual(3148528); done(); }) @@ -184,21 +184,21 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }) - jakartanet('Verify .estimate.transfer for multiple internal transfers to unallocated account', async (done) => { + limanet('Verify .estimate.transfer for multiple internal transfers to unallocated account', async (done) => { const tx = contract.methods.do(transferImplicit2( await (await createAddress()).signer.publicKeyHash(), await (await createAddress()).signer.publicKeyHash(), 50) ).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx) - expect(estimate.gasLimit).toEqual(5160); + expect(estimate.gasLimit).toEqual(4257); expect(estimate.storageLimit).toEqual(514); - expect(estimate.suggestedFeeMutez).toEqual(1001); + expect(estimate.suggestedFeeMutez).toEqual(911); expect(estimate.burnFeeMutez).toEqual(128500); - expect(estimate.minimalFeeMutez).toEqual(901); - expect(estimate.totalCost).toEqual(129401); - expect(estimate.usingBaseFeeMutez).toEqual(901); - expect(estimate.consumedMilligas).toEqual(5059195); + expect(estimate.minimalFeeMutez).toEqual(811); + expect(estimate.totalCost).toEqual(129311); + expect(estimate.usingBaseFeeMutez).toEqual(811); + expect(estimate.consumedMilligas).toEqual(4156198); done(); }) @@ -220,17 +220,17 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }) - jakartanet('Verify .estimate.transfer for internal origination', async (done) => { + limanet('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(3659); + expect(estimate.gasLimit).toEqual(3660); expect(estimate.storageLimit).toEqual(317); expect(estimate.suggestedFeeMutez).toEqual(798); expect(estimate.burnFeeMutez).toEqual(79250); expect(estimate.minimalFeeMutez).toEqual(698); expect(estimate.totalCost).toEqual(79948); expect(estimate.usingBaseFeeMutez).toEqual(698); - expect(estimate.consumedMilligas).toEqual(3558788); + expect(estimate.consumedMilligas).toEqual(3559038); done(); }) @@ -248,17 +248,17 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }) - jakartanet('Verify .estimate.transfer for multiple internal originations', async (done) => { + limanet('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(5075); + expect(estimate.gasLimit).toEqual(5078); expect(estimate.storageLimit).toEqual(634); expect(estimate.suggestedFeeMutez).toEqual(1005); expect(estimate.burnFeeMutez).toEqual(158500); expect(estimate.minimalFeeMutez).toEqual(905); expect(estimate.totalCost).toEqual(159405); expect(estimate.usingBaseFeeMutez).toEqual(905); - expect(estimate.consumedMilligas).toEqual(4974733); + expect(estimate.consumedMilligas).toEqual(4977218); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); @@ -296,16 +296,16 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done() }) - jakartanet('Verify .estimate.transfer to regular address', async (done) => { + limanet('Verify .estimate.transfer to regular address', async (done) => { let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) }); - expect(estimate.gasLimit).toEqual(1551); + expect(estimate.gasLimit).toEqual(1101); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(507); + expect(estimate.suggestedFeeMutez).toEqual(462); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(407); - expect(estimate.totalCost).toEqual(407); - expect(estimate.usingBaseFeeMutez).toEqual(407); - expect(estimate.consumedMilligas).toEqual(1450040); + expect(estimate.minimalFeeMutez).toEqual(362); + expect(estimate.totalCost).toEqual(362); + expect(estimate.usingBaseFeeMutez).toEqual(362); + expect(estimate.consumedMilligas).toEqual(1000040); done(); }); @@ -322,24 +322,22 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol, rpc }) => done(); }); - jakartanet('Estimate transfer to regular address with a fixed fee', async (done) => { - + limanet('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.toEqual( - expect.objectContaining({ - message: expect.stringContaining('balance_too_low'), - })); + await expect(LowAmountTez.estimate.transfer(params)).rejects.toMatchObject({ + id: 'proto.015-PtLimaPt.implicit.empty_implicit_contract', + }); done(); }); - jakartanet('Estimate transfer to regular address with insufficient balance', async (done) => { + limanet('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.toEqual( - expect.objectContaining({ - message: expect.stringContaining('balance_too_low'), - })); + ).rejects.toMatchObject({ + id: 'proto.015-PtLimaPt.tez.subtraction_underflow', + }); done(); }); diff --git a/integration-tests/contract-tx-rollup-batch-operation.spec.ts b/integration-tests/contract-tx-rollup-batch-operation.spec.ts index f284d43a7a..6747ee3c6d 100644 --- a/integration-tests/contract-tx-rollup-batch-operation.spec.ts +++ b/integration-tests/contract-tx-rollup-batch-operation.spec.ts @@ -1,16 +1,15 @@ import { CONFIGS } from "./config"; import { OpKind, Protocols } from "@taquito/taquito"; -CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { +CONFIGS().forEach(({ lib, rpc, setup }) => { const Tezos = lib; - const jakartanet = (protocol === Protocols.PtJakart2) ? it : it.skip; describe(`Test tx rollup batch using: ${rpc}`, () => { beforeEach(async (done) => { await setup(true) done() }) - jakartanet('should succeed to submit a tx rollup batch with auto-estimate of the fees', async (done) => { + it('should succeed to submit a tx rollup batch with auto-estimate of the fees', async (done) => { const op = await Tezos.contract.txRollupSubmitBatch({ content: '626c6f62', rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w' @@ -24,8 +23,8 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { done(); }); - - jakartanet('should succeed to submit a tx rollup batch with defined fees', async (done) => { + + it('should succeed to submit a tx rollup batch with defined fees', async (done) => { const op = await Tezos.contract.txRollupSubmitBatch({ content: '626c6f62', rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', @@ -42,7 +41,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { done(); }); - jakartanet('should succeed to include a tx rollup batch operation in a batch', async (done) => { + it('should succeed to include a tx rollup batch operation in a batch', async (done) => { const op = await Tezos.contract.batch([ { kind: OpKind.TRANSACTION, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 }, { kind: OpKind.TX_ROLLUP_SUBMIT_BATCH, content: '626c6f62', rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w', } @@ -53,9 +52,9 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { expect(op.status).toBe('applied'); done(); - }); - - jakartanet('should succeed to include a tx rollup batch operation in a batch using `with` method', async (done) => { + }); + + it('should succeed to include a tx rollup batch operation in a batch using `with` method', async (done) => { const op = await Tezos.contract.batch() .withTransfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 }) .withTxRollupSubmitBatch({ content: '626c6f62', rollup: 'txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w' }) diff --git a/integration-tests/contract-tx-rollup-origination-operation.spec.ts b/integration-tests/contract-tx-rollup-origination-operation.spec.ts index 1d06e99132..876206aac3 100644 --- a/integration-tests/contract-tx-rollup-origination-operation.spec.ts +++ b/integration-tests/contract-tx-rollup-origination-operation.spec.ts @@ -1,8 +1,7 @@ import { CONFIGS } from "./config"; import { OpKind, Protocols } from "@taquito/taquito"; -CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { - const jakartanet = (protocol === Protocols.PtJakart2) ? it : it.skip; +CONFIGS().forEach(({ lib, rpc, setup }) => { const Tezos = lib; describe(`Test tx rollup origination using: ${rpc}`, () => { @@ -10,7 +9,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { await setup(true) done() }) - jakartanet('should succeed to originate a rollup with auto-estimate of the fees', async (done) => { + it('should succeed to originate a rollup with auto-estimate of the fees', async (done) => { const op = await Tezos.contract.txRollupOriginate(); await op.confirmation() expect(op.hash).toBeDefined(); @@ -21,7 +20,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { done(); }); - jakartanet('should succeed to originate a rollup with defined fees', async (done) => { + it('should succeed to originate a rollup with defined fees', async (done) => { const op = await Tezos.contract.txRollupOriginate({ storageLimit: 6000, gasLimit: 2000, @@ -36,7 +35,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { done(); }); - jakartanet('should succeed to include a rollupOrigination operation in a batch', async (done) => { + it('should succeed to include a rollupOrigination operation in a batch', async (done) => { const op = await Tezos.contract.batch([ { kind: OpKind.TRANSACTION, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 }, { kind: OpKind.TX_ROLLUP_ORIGINATION } @@ -49,7 +48,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => { done(); }); - jakartanet('should succeed to include a rollupOrigination operation in a batch using `with` method', async (done) => { + it('should succeed to include a rollupOrigination operation in a batch using `with` method', async (done) => { const op = await Tezos.contract.batch() .withTransfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 }) .withTxRollupOrigination() diff --git a/integration-tests/contract-with-txr1-address.spec.ts b/integration-tests/contract-with-txr1-address.spec.ts index 915b97434a..9aae5be11f 100644 --- a/integration-tests/contract-with-txr1-address.spec.ts +++ b/integration-tests/contract-with-txr1-address.spec.ts @@ -4,9 +4,8 @@ import { contractWithTxr1Address } from "./data/contract-txr1-address"; import { Protocols } from "@taquito/taquito"; -CONFIGS().forEach(({lib, setup, protocol}) => { +CONFIGS().forEach(({ lib, setup }) => { const Tezos = lib; - const jakartanet = Protocols.PtJakart2 === protocol ? test : test.skip beforeEach(async (done) => { await setup(); @@ -15,7 +14,7 @@ CONFIGS().forEach(({lib, setup, protocol}) => { describe('test', () => { type Storage = { addressSet: string[], addressMap: MichelsonMap; } - jakartanet('should pass with tz addresses', async (done) => { + it('should pass with tz addresses', async (done) => { const initialStorage: Storage = { addressSet: [ @@ -79,7 +78,7 @@ CONFIGS().forEach(({lib, setup, protocol}) => { expect(newMapStorage.addressMap.get('txr1bZx7qro4xNsxLhmpXfmzQojHkg8XqrUvL')).toBeUndefined(); done(); }) - jakartanet('should pass with KT1', async (done) => { + it('should pass with KT1', async (done) => { const initialStorage: Storage = { addressSet: [ diff --git a/integration-tests/known-contracts-PtJakart2.ts b/integration-tests/known-contracts-PtJakart2.ts deleted file mode 100644 index 325a4869d7..0000000000 --- a/integration-tests/known-contracts-PtJakart2.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const knownContractPtJakart2 = "KT1SHtH6qWcWWnQ5gZThCD5EnrErKHxyqxca"; -export const knownBigMapContractPtJakart2 = "KT1AbzoXYgGXjCD3Msi3spuqa5r5MP3rkvM9"; -export const knownTzip12BigMapOffChainContractPtJakart2 = "KT1GmRf51jFNMQBFDo2mYKnC8Pjm1d7yDwVj"; -export const knownSaplingContractPtJakart2 = "KT1G2kvdfPoavgR6Fjdd68M2vaPk14qJ8bhC"; -export const knownOnChainViewContractAddressPtJakart2 = "KT1N6MT9xd3SpbwEG16FrwSfMDUkFNFK1eze"; -export const txRollupAddressPtJakart2 = "txr1YTdi9BktRmybwhgkhRK7WPrutEWVGJT7w"; diff --git a/integration-tests/known-contracts-PtKathman.ts b/integration-tests/known-contracts-PtKathman.ts index 4e493710f8..5cfdb119fb 100644 --- a/integration-tests/known-contracts-PtKathman.ts +++ b/integration-tests/known-contracts-PtKathman.ts @@ -1,6 +1,6 @@ -export const knownContractPtKathman = "KT1D4jdLqhtRXNkY2jfSaTJnHSFhsJQuFamG"; -export const knownBigMapContractPtKathman = "KT1K65F9P54MiQ7it2k5wmTCKGNXyDH2wend"; -export const knownTzip12BigMapOffChainContractPtKathman = "KT1H4xzuERAWgJzomFxLvn2tmKttCU43Rp44"; -export const knownSaplingContractPtKathman = "KT1V9vrxyBv3cAWZwucoJYFFTRUt3eYp5EoA"; -export const knownOnChainViewContractAddressPtKathman = "KT1ArzUybP2LMxNVdottnFoy5Z8vPbJ7BDjB"; -export const txRollupAddressPtKathman = "txr1ebHhewaVykePYWRH5g8vZchXdX9ebwYZQ"; +export const knownContractPtKathman = "KT1SrKKwHMrfMibunFSwuYauMkxnCmmw37fb"; +export const knownBigMapContractPtKathman = "KT1TZWawPbU6mCMa1x6hEZcuZ2RtJxqprskk"; +export const knownTzip12BigMapOffChainContractPtKathman = "KT1WePZzvQxLFmb9QfpLK9rgUVcRPHzjQLhN"; +export const knownSaplingContractPtKathman = "KT1Riu8a1dbWRMmFpMzb9PgdJbhHAAHuvDyJ"; +export const knownOnChainViewContractAddressPtKathman = "KT1My3eKdYKW3H27jZ2oVcNCXGNBDBcTuYiR"; +export const txRollupAddressPtKathman = "txr1R5hkRCJjMugm2Z6gmh5J6Q4WJToHu8mBe"; diff --git a/integration-tests/known-contracts-PtLimaPtL.ts b/integration-tests/known-contracts-PtLimaPtL.ts new file mode 100644 index 0000000000..3124d0841b --- /dev/null +++ b/integration-tests/known-contracts-PtLimaPtL.ts @@ -0,0 +1,6 @@ +export const knownContractPtLimaPtL = "KT1EkS7gNaWqPTt4y4QVqJurwMDPFK2g8boy"; +export const knownBigMapContractPtLimaPtL = "KT1TjZW4ujuCNJfsvxdqS333iE6MNTFA6pqm"; +export const knownTzip12BigMapOffChainContractPtLimaPtL = "KT1CpUjwSRt3C7ecyF9f3xvBY4f8G7JFmKjM"; +export const knownSaplingContractPtLimaPtL = "KT1Hv3brnhecSXNhovC5GvxZgmHY8hAd6D2m"; +export const knownOnChainViewContractAddressPtLimaPtL = "KT1Kmzc6zb44AsNs897aGDoU7Qj1TeorY6vr"; +export const txRollupAddressPtLimaPtL = "txr1Xz6LiZSspZ9bJu2SC5r97B1ikCBAAYKdQ"; diff --git a/integration-tests/originate-known-contracts.ts b/integration-tests/originate-known-contracts.ts index 9545af5bb5..ce72a037fa 100644 --- a/integration-tests/originate-known-contracts.ts +++ b/integration-tests/originate-known-contracts.ts @@ -186,4 +186,4 @@ Total XTZ Spent : ${keyInitialBalance.minus(await tezos.tz.getBalance(keyPkh)).d let balance = await tezos.tz.getBalance(pkh); console.log(`${pkh} balance: ${balance}`); } -}) \ No newline at end of file +}) diff --git a/integration-tests/package.json b/integration-tests/package.json index 9672a64d41..e48f1faab8 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -2,8 +2,8 @@ "name": "integration-tests", "scripts": { "test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand", - "test:jakartanet": "JAKARTANET=true jest", - "test:jakartanet-secret-key": "RUN_JAKARTANET_WITH_SECRET_KEY=true jest --runInBand", + "test:limanet": "LIMANET=true jest", + "test:limanet-secret-key": "RUN_LIMANET_WITH_SECRET_KEY=true jest --runInBand", "test:kathmandunet": "KATHMANDUNET=true jest", "test:kathmandunet-secret-key": "RUN_KATHMANDUNET_WITH_SECRET_KEY=true jest --runInBand", "test:originate-known-contracts": "node -r ts-node/register originate-known-contracts.ts", diff --git a/integration-tests/rpc-get-protocol-constants.spec.ts b/integration-tests/rpc-get-protocol-constants.spec.ts index 2ce1354487..4a440d7c42 100644 --- a/integration-tests/rpc-get-protocol-constants.spec.ts +++ b/integration-tests/rpc-get-protocol-constants.spec.ts @@ -4,861 +4,886 @@ import BigNumber from 'bignumber.js'; import { ConstantsResponseCommon, ConstantsResponseProto009, ConstantsResponseProto010, ConstantsResponseProto011, ConstantsResponseProto012, ConstantsResponseProto013, ConstantsResponseProto014 } from "@taquito/rpc"; CONFIGS().forEach(({ lib, protocol, rpc }) => { - const Tezos = lib; - const kathmandunet = (protocol === Protocols.PtKathman) ? test : test.skip; - const jakartanet = (protocol === Protocols.PtJakart2) ? test : test.skip; - const alpha = (protocol === Protocols.ProtoALpha) ? test : test.skip; - - describe('Test fetching constants for all protocols on Mainnet', () => { - - const rpcUrl = 'https://mainnet-archive.api.tez.ie/'; - Tezos.setRpcProvider(rpcUrl) - it('successfully fails at fetching constants for level 0', async (done) => { - try { - await Tezos.rpc.getConstants({ block: "0" }); - expect.assertions(1); - } catch (ex: any) { - expect(ex.message).toMatch('Http error response: (404) '); - } - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto1 constants at level 1', async (done) => { - // Get constants for protocol - const constants = await Tezos.rpc.getConstants({ block: "1" }); - expect(Object.keys(constants)).toHaveLength(24) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,75"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants.origination_burn?.toString()).toEqual("257000"); - expect(constants.block_security_deposit.toString()).toEqual("0"); - expect(constants.endorsement_security_deposit.toString()).toEqual("0"); - expect(constants.block_reward?.toString()).toEqual("0"); - expect(constants.endorsement_reward.toString()).toEqual("0"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto1 constants at level 2', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "2" }); - expect(Object.keys(constants)).toHaveLength(24) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,75"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants.origination_burn?.toString()).toEqual("257000"); - expect(constants.block_security_deposit.toString()).toEqual("0"); - expect(constants.endorsement_security_deposit.toString()).toEqual("0"); - expect(constants.block_reward?.toString()).toEqual("0"); - expect(constants.endorsement_reward.toString()).toEqual("0"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - done(); - }) - - - it('Verify that rpc.getConstants successfully fetches Proto2 constants at level 100000', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "100000" }); - expect(Object.keys(constants)).toHaveLength(24) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,75"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants.origination_burn?.toString()).toEqual("257000"); - expect(constants.block_security_deposit.toString()).toEqual("192000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("24000000"); - expect(constants.block_reward?.toString()).toEqual("16000000"); - expect(constants.endorsement_reward.toString()).toEqual("2000000"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto3 constants at level 300000', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "300000" }); - expect(Object.keys(constants)).toHaveLength(25) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("max_proposals_per_delegate", 20); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,75"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants).toHaveProperty("origination_size", 257); - expect(constants.block_security_deposit.toString()).toEqual("512000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); - expect(constants.block_reward?.toString()).toEqual("16000000"); - expect(constants.endorsement_reward.toString()).toEqual("2000000"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - done(); - }) - - - it('Verify that rpc.getConstants successfully fetches Proto4 constants at level 600000', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "600000" }); - expect(Object.keys(constants)).toHaveLength(26) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("max_proposals_per_delegate", 20); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,75"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("800000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("8000000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants).toHaveProperty("origination_size", 257); - expect(constants.block_security_deposit.toString()).toEqual("512000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); - expect(constants.block_reward?.toString()).toEqual("16000000"); - expect(constants.endorsement_reward.toString()).toEqual("2000000"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - expect(constants.test_chain_duration?.toString()).toEqual("1966080"); - done(); - }) - - - it('Verify that rpc.getConstants successfully fetches Proto5 constants at level 700000', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "700000" }); - expect(Object.keys(constants)).toHaveLength(31) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("max_proposals_per_delegate", 20); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,40"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("800000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("8000000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants).toHaveProperty("origination_size", 257); - expect(constants.block_security_deposit.toString()).toEqual("512000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); - expect(constants.block_reward?.toString()).toEqual("16000000"); - expect(constants.endorsement_reward.toString()).toEqual("2000000"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - expect(constants.test_chain_duration?.toString()).toEqual("1966080"); - expect(constants).toHaveProperty("quorum_min", 2000); - expect(constants).toHaveProperty("quorum_max", 7000); - expect(constants).toHaveProperty("min_proposal_quorum", 500); - expect(constants).toHaveProperty("initial_endorsers", 24); - expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto6 constants at level 900000', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "900000" }); - expect(Object.keys(constants)).toHaveLength(31) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_revelations_per_block", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("max_proposals_per_delegate", 20); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,40"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("1040000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("10400000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants).toHaveProperty("origination_size", 257); - expect(constants.block_security_deposit.toString()).toEqual("512000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); - expect(constants.baking_reward_per_endorsement?.toString()).toEqual("1250000,187500"); - expect(constants.endorsement_reward.toString()).toEqual("1250000,833333"); - expect(constants.cost_per_byte.toString()).toEqual("1000"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - expect(constants.test_chain_duration?.toString()).toEqual("1966080"); - expect(constants).toHaveProperty("quorum_min", 2000); - expect(constants).toHaveProperty("quorum_max", 7000); - expect(constants).toHaveProperty("min_proposal_quorum", 500); - expect(constants).toHaveProperty("initial_endorsers", 24); - expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto7 constants at level 1212416', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "1212416" }); - expect(Object.keys(constants)).toHaveLength(31) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("max_proposals_per_delegate", 20); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 32768); - expect(constants.time_between_blocks.toString()).toEqual("60,40"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("1040000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("10400000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants).toHaveProperty("origination_size", 257); - expect(constants.block_security_deposit.toString()).toEqual("512000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); - expect(constants.baking_reward_per_endorsement?.toString()).toEqual("1250000,187500"); - expect(constants.endorsement_reward.toString()).toEqual("1250000,833333"); - expect(constants.cost_per_byte.toString()).toEqual("250"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - expect(constants.test_chain_duration?.toString()).toEqual("1966080"); - expect(constants).toHaveProperty("quorum_min", 2000); - expect(constants).toHaveProperty("quorum_max", 7000); - expect(constants).toHaveProperty("min_proposal_quorum", 500); - expect(constants).toHaveProperty("initial_endorsers", 24); - expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); - done(); - }) - - - it('Verify that rpc.getConstants successfully fetches Proto8 constants at level 1350000', async (done) => { - const constants = await Tezos.rpc.getConstants({ block: "1350000" }); - expect(Object.keys(constants)).toHaveLength(31) - expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); - expect(constants).toHaveProperty("nonce_length", 32); - expect(constants).toHaveProperty("max_operation_data_length", 16384); - expect(constants).toHaveProperty("max_proposals_per_delegate", 20); - expect(constants).toHaveProperty("preserved_cycles", 5); - expect(constants).toHaveProperty("blocks_per_cycle", 4096); - expect(constants).toHaveProperty("blocks_per_commitment", 32); - expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); - expect(constants).toHaveProperty("blocks_per_voting_period", 20480); - expect(constants.time_between_blocks.toString()).toEqual("60,40"); - expect(constants).toHaveProperty("endorsers_per_block", 32); - expect(constants.hard_gas_limit_per_operation.toString()).toEqual("1040000"); - expect(constants.hard_gas_limit_per_block.toString()).toEqual("10400000"); - expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); - expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); - expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); - expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); - expect(constants).toHaveProperty("origination_size", 257); - expect(constants.block_security_deposit.toString()).toEqual("512000000"); - expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); - expect(constants.baking_reward_per_endorsement?.toString()).toEqual("1250000,187500"); - expect(constants.endorsement_reward.toString()).toEqual("1250000,833333"); - expect(constants.cost_per_byte.toString()).toEqual("250"); - expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); - expect(constants.test_chain_duration?.toString()).toEqual("1228800"); - expect(constants).toHaveProperty("quorum_min", 2000); - expect(constants).toHaveProperty("quorum_max", 7000); - expect(constants).toHaveProperty("min_proposal_quorum", 500); - expect(constants).toHaveProperty("initial_endorsers", 24); - expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto9 constants at level 1480000', async (done) => { - const constants: ConstantsResponseProto009 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "1480000" }); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - preserved_cycles: 5, - blocks_per_cycle: 4096, - blocks_per_commitment: 32, - blocks_per_roll_snapshot: 256, - blocks_per_voting_period: 20480, - time_between_blocks: [new BigNumber(60), new BigNumber(40)], - endorsers_per_block: 32, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(10400000), - proof_of_work_threshold: new BigNumber(70368744177663), - tokens_per_roll: new BigNumber(8000000000), - michelson_maximum_type_size: 1000, - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - block_security_deposit: new BigNumber(512000000), - endorsement_security_deposit: new BigNumber(64000000), - baking_reward_per_endorsement: [new BigNumber(1250000), new BigNumber(187500)], - endorsement_reward: [new BigNumber(1250000), new BigNumber(833333)], - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - test_chain_duration: new BigNumber(0), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - initial_endorsers: 24, - delay_per_missing_endorsement: new BigNumber(8) - }); - done(); - }) - - it('Verify that rpc.getConstants successfully fetches Proto10 constants at level 1589492', async (done) => { - const constants: ConstantsResponseProto010 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "1589492" }); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - preserved_cycles: 5, - blocks_per_cycle: 8192, - blocks_per_commitment: 64, - blocks_per_roll_snapshot: 512, - blocks_per_voting_period: 40960, - time_between_blocks: [new BigNumber(60), new BigNumber(40)], - endorsers_per_block: 256, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(70368744177663), - tokens_per_roll: new BigNumber(8000000000), - michelson_maximum_type_size: 1000, - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - block_security_deposit: new BigNumber(640000000), - endorsement_security_deposit: new BigNumber(2500000), - baking_reward_per_endorsement: [new BigNumber(78125), new BigNumber(11719)], - endorsement_reward: [new BigNumber(78125), new BigNumber(52083)], - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - initial_endorsers: 192, - delay_per_missing_endorsement: new BigNumber(4), - minimal_block_delay: new BigNumber(30), - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 2032928, - liquidity_baking_escape_ema_threshold: 1000000 - }); - done(); - }) - - it('successfully fetches Proto11 constants at level 1932041', async (done) => { - const constants: ConstantsResponseProto011 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "1932041" }); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - max_micheline_node_count: 50000, - max_micheline_bytes_limit: 50000, - max_allowed_global_constants_depth: 10000, - cache_layout: [new BigNumber(100000000)], - michelson_maximum_type_size: 2001, - preserved_cycles: 5, - blocks_per_cycle: 8192, - blocks_per_commitment: 64, - blocks_per_roll_snapshot: 512, - blocks_per_voting_period: 40960, - time_between_blocks: [new BigNumber(60), new BigNumber(40)], - endorsers_per_block: 256, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(70368744177663), - tokens_per_roll: new BigNumber(8000000000), - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - block_security_deposit: new BigNumber(640000000), - endorsement_security_deposit: new BigNumber(2500000), - baking_reward_per_endorsement: [new BigNumber(78125), new BigNumber(11719)], - endorsement_reward: [new BigNumber(78125), new BigNumber(52083)], - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - initial_endorsers: 192, - delay_per_missing_endorsement: new BigNumber(4), - minimal_block_delay: new BigNumber(30), - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 2244609, - liquidity_baking_escape_ema_threshold: 1000000 - }); - done(); - }) - - it('successfully fetches Proto12 constants at level 2354016', async (done) => { - const constants: ConstantsResponseProto012 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "2354016" }); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - max_micheline_node_count: 50000, - max_micheline_bytes_limit: 50000, - max_allowed_global_constants_depth: 10000, - cache_layout: [new BigNumber(100000000), new BigNumber(240000), new BigNumber(2560)], - michelson_maximum_type_size: 2001, - preserved_cycles: 5, - blocks_per_cycle: 8192, - blocks_per_commitment: 64, - blocks_per_voting_period: 40960, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(70368744177663), - tokens_per_roll: new BigNumber(6000000000), - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - minimal_block_delay: new BigNumber(30), - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 3063809, - liquidity_baking_escape_ema_threshold: 666667, - blocks_per_stake_snapshot: 512, - baking_reward_fixed_portion: new BigNumber("10000000"), - baking_reward_bonus_per_slot: new BigNumber(4286), - endorsing_reward_per_slot: new BigNumber(2857), - max_operations_time_to_live: 120, - consensus_committee_size: 7000, - consensus_threshold: 4667, - minimal_participation_ratio: { - numerator: 2, - denominator: 3 - }, - max_slashing_period: 2, - frozen_deposits_percentage: 10, - double_baking_punishment: new BigNumber(640000000), - ratio_of_frozen_deposits_slashed_per_double_endorsement: { - numerator: 1, - denominator: 2 - }, - delay_increment_per_round: new BigNumber(15), - }); - done(); - }) - - it('successfully fetches Proto13 constants at level 2656071', async (done) => { - const constants: ConstantsResponseProto013 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "2656071" }); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - preserved_cycles: 5, - blocks_per_cycle: 8192, - blocks_per_commitment: 64, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(70368744177663), - tokens_per_roll: new BigNumber(6000000000), - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 3063809, - liquidity_baking_toggle_ema_threshold: 1000000000, - max_allowed_global_constants_depth: 10000, - max_micheline_bytes_limit: 50000, - max_micheline_node_count: 50000, - michelson_maximum_type_size: 2001, - blocks_per_stake_snapshot: 512, - baking_reward_fixed_portion: new BigNumber(10000000), - baking_reward_bonus_per_slot: new BigNumber(4286), - endorsing_reward_per_slot: new BigNumber(2857), - max_operations_time_to_live: 120, - consensus_committee_size: 7000, - consensus_threshold: 4667, - minimal_participation_ratio: { - denominator: 3, - numerator: 2, - }, - max_slashing_period: 2, - frozen_deposits_percentage: 10, - double_baking_punishment: new BigNumber(640000000), - ratio_of_frozen_deposits_slashed_per_double_endorsement: { - denominator: 2, - numerator: 1, - }, - minimal_block_delay: new BigNumber(30), - delay_increment_per_round: new BigNumber(15), - cache_layout_size: 3, - cache_sampler_state_cycles: 8, - cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cycles_per_voting_period: 5, - sc_rollup_challenge_window_in_blocks: 20160, - sc_rollup_enable: false, - sc_rollup_max_available_messages: 1000000, - sc_rollup_origination_size: 6314, - tx_rollup_commitment_bond: new BigNumber(10000000000), - tx_rollup_cost_per_byte_ema_factor: 120, - tx_rollup_enable: true, - tx_rollup_finality_period: 40000, - tx_rollup_hard_size_limit_per_inbox: 500000, - tx_rollup_hard_size_limit_per_message: 5000, - tx_rollup_max_commitments_count: 80100, - tx_rollup_max_inboxes_count: 40100, - tx_rollup_max_messages_per_inbox: 1010, - tx_rollup_max_ticket_payload_size: 2048, - tx_rollup_max_withdrawals_per_batch: 15, - tx_rollup_origination_size: 4000, - tx_rollup_rejection_max_proof_size: 30000, - tx_rollup_sunset_level: 3473409, - tx_rollup_withdraw_period: 40000, - }); - done(); - }) - }) - - describe(`Fetch constants for testnet`, () => { - - jakartanet(`successfully fetches all constants for jakartanet using ${rpc}`, async (done) => { - Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto013 & ConstantsResponseCommon = await Tezos.rpc.getConstants(); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - preserved_cycles: 3, - blocks_per_cycle: 4096, - blocks_per_commitment: 32, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(-1), - tokens_per_roll: new BigNumber(6000000000), - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 10000000, - liquidity_baking_toggle_ema_threshold: 1000000000, - max_allowed_global_constants_depth: 10000, - max_micheline_bytes_limit: 50000, - max_micheline_node_count: 50000, - michelson_maximum_type_size: 2001, - blocks_per_stake_snapshot: 256, - baking_reward_fixed_portion: new BigNumber(10000000), - baking_reward_bonus_per_slot: new BigNumber(4286), - endorsing_reward_per_slot: new BigNumber(2857), - max_operations_time_to_live: 120, - consensus_committee_size: 7000, - consensus_threshold: 4667, - minimal_participation_ratio: { - denominator: 3, - numerator: 2, - }, - max_slashing_period: 2, - frozen_deposits_percentage: 10, - double_baking_punishment: new BigNumber(640000000), - ratio_of_frozen_deposits_slashed_per_double_endorsement: { - denominator: 2, - numerator: 1, - }, - minimal_block_delay: new BigNumber(15), - delay_increment_per_round: new BigNumber(7), - cache_layout_size: 3, - cache_sampler_state_cycles: 8, - cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cycles_per_voting_period: 1, - sc_rollup_challenge_window_in_blocks: 20160, - sc_rollup_enable: false, - sc_rollup_max_available_messages: 1000000, - sc_rollup_origination_size: 6314, - tx_rollup_commitment_bond: new BigNumber(10000000000), - tx_rollup_cost_per_byte_ema_factor: 120, - tx_rollup_enable: true, - tx_rollup_finality_period: 40000, - tx_rollup_hard_size_limit_per_inbox: 500000, - tx_rollup_hard_size_limit_per_message: 5000, - tx_rollup_max_commitments_count: 80100, - tx_rollup_max_inboxes_count: 40100, - tx_rollup_max_messages_per_inbox: 1010, - tx_rollup_max_ticket_payload_size: 2048, - tx_rollup_max_withdrawals_per_batch: 15, - tx_rollup_origination_size: 4000, - tx_rollup_rejection_max_proof_size: 30000, - tx_rollup_sunset_level: 3473409, - tx_rollup_withdraw_period: 40000, - }); - - done(); - }) - - kathmandunet(`successfully fetches all constants for kathmandunet using ${rpc}`, async (done) => { - Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto014 & ConstantsResponseCommon = await Tezos.rpc.getConstants(); - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - nonce_revelation_threshold: 256, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - preserved_cycles: 3, - blocks_per_cycle: 4096, - blocks_per_commitment: 32, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(-1), - tokens_per_roll: new BigNumber(6000000000), - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 10000000, - liquidity_baking_toggle_ema_threshold: 1000000000, - max_allowed_global_constants_depth: 10000, - max_micheline_bytes_limit: 50000, - max_micheline_node_count: 50000, - michelson_maximum_type_size: 2001, - blocks_per_stake_snapshot: 256, - baking_reward_fixed_portion: new BigNumber(10000000), - baking_reward_bonus_per_slot: new BigNumber(4286), - endorsing_reward_per_slot: new BigNumber(2857), - max_operations_time_to_live: 120, - consensus_committee_size: 7000, - consensus_threshold: 4667, - minimal_participation_ratio: { - denominator: 3, - numerator: 2, - }, - max_slashing_period: 2, - max_wrapped_proof_binary_size: 30000, - frozen_deposits_percentage: 10, - double_baking_punishment: new BigNumber(640000000), - ratio_of_frozen_deposits_slashed_per_double_endorsement: { - denominator: 2, - numerator: 1, - }, - minimal_block_delay: new BigNumber(15), - dal_parametric: { - availability_threshold: 50, - endorsement_lag: 1, - feature_enable: false, - number_of_shards: 2048, - number_of_slots: 256, - }, - delay_increment_per_round: new BigNumber(15), - cache_layout_size: 3, - cache_sampler_state_cycles: 8, - cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cycles_per_voting_period: 1, - sc_rollup_challenge_window_in_blocks: 20160, - sc_rollup_commitment_period_in_blocks: 30, - sc_rollup_enable: false, - sc_rollup_max_active_outbox_levels: 20160, - sc_rollup_max_available_messages: 1000000, - sc_rollup_max_lookahead_in_blocks: 30000, - sc_rollup_max_outbox_messages_per_level: 100, - sc_rollup_origination_size: 6314, - sc_rollup_stake_amount: new BigNumber("32000000"), - tx_rollup_commitment_bond: new BigNumber(10000000000), - tx_rollup_cost_per_byte_ema_factor: 120, - tx_rollup_enable: true, - tx_rollup_finality_period: 40000, - tx_rollup_hard_size_limit_per_inbox: 500000, - tx_rollup_hard_size_limit_per_message: 5000, - tx_rollup_max_commitments_count: 80100, - tx_rollup_max_inboxes_count: 40100, - tx_rollup_max_messages_per_inbox: 1010, - tx_rollup_max_ticket_payload_size: 2048, - tx_rollup_max_withdrawals_per_batch: 15, - tx_rollup_origination_size: 4000, - tx_rollup_rejection_max_proof_size: 30000, - tx_rollup_sunset_level: 10000000, - tx_rollup_withdraw_period: 40000, - vdf_difficulty: new BigNumber("8000000000"), - }); - - done(); - }) - - alpha(`successfully fetches all constants for mondaynet using ${rpc}`, async (done) => { - Tezos.setRpcProvider(rpc); - const constants: ConstantsResponseProto014 & ConstantsResponseCommon = await Tezos.rpc.getConstants(); - - expect(constants).toEqual({ - proof_of_work_nonce_size: 8, - nonce_length: 32, - nonce_revelation_threshold: 16, - max_anon_ops_per_block: 132, - max_operation_data_length: 32768, - max_proposals_per_delegate: 20, - preserved_cycles: 3, - blocks_per_cycle: 128, - blocks_per_commitment: 16, - hard_gas_limit_per_operation: new BigNumber(1040000), - hard_gas_limit_per_block: new BigNumber(5200000), - proof_of_work_threshold: new BigNumber(-1), - tokens_per_roll: new BigNumber(8000000000), - seed_nonce_revelation_tip: new BigNumber(125000), - origination_size: 257, - cost_per_byte: new BigNumber(250), - hard_storage_limit_per_operation: new BigNumber(60000), - quorum_min: 2000, - quorum_max: 7000, - min_proposal_quorum: 500, - liquidity_baking_subsidy: new BigNumber(2500000), - liquidity_baking_sunset_level: 10000000, - liquidity_baking_toggle_ema_threshold: 100000, - max_allowed_global_constants_depth: 10000, - max_micheline_bytes_limit: 50000, - max_micheline_node_count: 50000, - michelson_maximum_type_size: 2001, - blocks_per_stake_snapshot: 64, - baking_reward_fixed_portion: new BigNumber(10000000), - baking_reward_bonus_per_slot: new BigNumber(4286), - endorsing_reward_per_slot: new BigNumber(2857), - max_operations_time_to_live: 120, - consensus_committee_size: 7000, - consensus_threshold: 4667, - minimal_participation_ratio: { - denominator: 3, - numerator: 2, - }, - max_slashing_period: 2, - frozen_deposits_percentage: 10, - double_baking_punishment: new BigNumber(640000000), - ratio_of_frozen_deposits_slashed_per_double_endorsement: { - denominator: 2, - numerator: 1, - }, - minimal_block_delay: new BigNumber(15), - delay_increment_per_round: new BigNumber(15), - dal_parametric: { - availability_threshold: 50, - endorsement_lag: 1, - feature_enable: false, - number_of_shards: 2048, - number_of_slots: 256, - }, - cache_layout_size: 3, - cache_sampler_state_cycles: 8, - cache_script_size: 100000000, - cache_stake_distribution_cycles: 8, - cycles_per_voting_period: 1, - sc_max_wrapped_proof_binary_size: 30000, - sc_rollup_challenge_window_in_blocks: 20160, - sc_rollup_enable: false, - sc_rollup_max_available_messages: 1000000, - sc_rollup_origination_size: 6314, - sc_rollup_commitment_period_in_blocks: 30, - sc_rollup_max_active_outbox_levels: 20160, - sc_rollup_message_size_limit: 4096, - sc_rollup_max_lookahead_in_blocks: 30000, - sc_rollup_max_outbox_messages_per_level: 100, - sc_rollup_stake_amount: "32000000", - tx_rollup_commitment_bond: new BigNumber(10000000000), - tx_rollup_cost_per_byte_ema_factor: 120, - tx_rollup_enable: true, - tx_rollup_finality_period: 10, - tx_rollup_hard_size_limit_per_inbox: 500000, - tx_rollup_hard_size_limit_per_message: 5000, - tx_rollup_max_commitments_count: 30, - tx_rollup_max_inboxes_count: 15, - tx_rollup_max_messages_per_inbox: 1010, - tx_rollup_max_ticket_payload_size: 2048, - tx_rollup_max_withdrawals_per_batch: 15, - tx_rollup_origination_size: 4000, - tx_rollup_rejection_max_proof_size: 30000, - tx_rollup_sunset_level: 17280, - tx_rollup_withdraw_period: 10, - vdf_difficulty: "50000", - }); - - done(); - }) - }) -}) + const Tezos = lib; + const kathmandunet = (protocol === Protocols.PtKathman) ? test : test.skip; + const limanet = (protocol === Protocols.PtLimaPtL) ? test : test.skip; + const alpha = (protocol === Protocols.ProtoALpha) ? test : test.skip; + + describe('Test fetching constants for all protocols on Mainnet', () => { + + const rpcUrl = 'https://mainnet-archive.api.tez.ie/'; + Tezos.setRpcProvider(rpcUrl); + it('successfully fails at fetching constants for level 0', async (done) => { + try { + await Tezos.rpc.getConstants({ block: "0" }); + expect.assertions(1); + } catch (ex: any) { + expect(ex.message).toMatch('Http error response: (404) '); + } + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto1 constants at level 1', async (done) => { + // Get constants for protocol + const constants = await Tezos.rpc.getConstants({ block: "1" }); + expect(Object.keys(constants)).toHaveLength(24); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,75"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants.origination_burn?.toString()).toEqual("257000"); + expect(constants.block_security_deposit.toString()).toEqual("0"); + expect(constants.endorsement_security_deposit.toString()).toEqual("0"); + expect(constants.block_reward?.toString()).toEqual("0"); + expect(constants.endorsement_reward.toString()).toEqual("0"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto1 constants at level 2', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "2" }); + expect(Object.keys(constants)).toHaveLength(24); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,75"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants.origination_burn?.toString()).toEqual("257000"); + expect(constants.block_security_deposit.toString()).toEqual("0"); + expect(constants.endorsement_security_deposit.toString()).toEqual("0"); + expect(constants.block_reward?.toString()).toEqual("0"); + expect(constants.endorsement_reward.toString()).toEqual("0"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + done(); + }); + + + it('Verify that rpc.getConstants successfully fetches Proto2 constants at level 100000', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "100000" }); + expect(Object.keys(constants)).toHaveLength(24); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,75"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants.origination_burn?.toString()).toEqual("257000"); + expect(constants.block_security_deposit.toString()).toEqual("192000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("24000000"); + expect(constants.block_reward?.toString()).toEqual("16000000"); + expect(constants.endorsement_reward.toString()).toEqual("2000000"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto3 constants at level 300000', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "300000" }); + expect(Object.keys(constants)).toHaveLength(25); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("max_proposals_per_delegate", 20); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,75"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("400000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("4000000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("10000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants).toHaveProperty("origination_size", 257); + expect(constants.block_security_deposit.toString()).toEqual("512000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); + expect(constants.block_reward?.toString()).toEqual("16000000"); + expect(constants.endorsement_reward.toString()).toEqual("2000000"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + done(); + }); + + + it('Verify that rpc.getConstants successfully fetches Proto4 constants at level 600000', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "600000" }); + expect(Object.keys(constants)).toHaveLength(26); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("max_proposals_per_delegate", 20); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,75"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("800000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("8000000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants).toHaveProperty("origination_size", 257); + expect(constants.block_security_deposit.toString()).toEqual("512000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); + expect(constants.block_reward?.toString()).toEqual("16000000"); + expect(constants.endorsement_reward.toString()).toEqual("2000000"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + expect(constants.test_chain_duration?.toString()).toEqual("1966080"); + done(); + }); + + + it('Verify that rpc.getConstants successfully fetches Proto5 constants at level 700000', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "700000" }); + expect(Object.keys(constants)).toHaveLength(31); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("max_proposals_per_delegate", 20); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,40"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("800000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("8000000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants).toHaveProperty("origination_size", 257); + expect(constants.block_security_deposit.toString()).toEqual("512000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); + expect(constants.block_reward?.toString()).toEqual("16000000"); + expect(constants.endorsement_reward.toString()).toEqual("2000000"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + expect(constants.test_chain_duration?.toString()).toEqual("1966080"); + expect(constants).toHaveProperty("quorum_min", 2000); + expect(constants).toHaveProperty("quorum_max", 7000); + expect(constants).toHaveProperty("min_proposal_quorum", 500); + expect(constants).toHaveProperty("initial_endorsers", 24); + expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto6 constants at level 900000', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "900000" }); + expect(Object.keys(constants)).toHaveLength(31); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_revelations_per_block", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("max_proposals_per_delegate", 20); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,40"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("1040000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("10400000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants).toHaveProperty("origination_size", 257); + expect(constants.block_security_deposit.toString()).toEqual("512000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); + expect(constants.baking_reward_per_endorsement?.toString()).toEqual("1250000,187500"); + expect(constants.endorsement_reward.toString()).toEqual("1250000,833333"); + expect(constants.cost_per_byte.toString()).toEqual("1000"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + expect(constants.test_chain_duration?.toString()).toEqual("1966080"); + expect(constants).toHaveProperty("quorum_min", 2000); + expect(constants).toHaveProperty("quorum_max", 7000); + expect(constants).toHaveProperty("min_proposal_quorum", 500); + expect(constants).toHaveProperty("initial_endorsers", 24); + expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto7 constants at level 1212416', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "1212416" }); + expect(Object.keys(constants)).toHaveLength(31); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("max_proposals_per_delegate", 20); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 32768); + expect(constants.time_between_blocks.toString()).toEqual("60,40"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("1040000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("10400000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants).toHaveProperty("origination_size", 257); + expect(constants.block_security_deposit.toString()).toEqual("512000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); + expect(constants.baking_reward_per_endorsement?.toString()).toEqual("1250000,187500"); + expect(constants.endorsement_reward.toString()).toEqual("1250000,833333"); + expect(constants.cost_per_byte.toString()).toEqual("250"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + expect(constants.test_chain_duration?.toString()).toEqual("1966080"); + expect(constants).toHaveProperty("quorum_min", 2000); + expect(constants).toHaveProperty("quorum_max", 7000); + expect(constants).toHaveProperty("min_proposal_quorum", 500); + expect(constants).toHaveProperty("initial_endorsers", 24); + expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); + done(); + }); + + + it('Verify that rpc.getConstants successfully fetches Proto8 constants at level 1350000', async (done) => { + const constants = await Tezos.rpc.getConstants({ block: "1350000" }); + expect(Object.keys(constants)).toHaveLength(31); + expect(constants).toHaveProperty("proof_of_work_nonce_size", 8); + expect(constants).toHaveProperty("nonce_length", 32); + expect(constants).toHaveProperty("max_operation_data_length", 16384); + expect(constants).toHaveProperty("max_proposals_per_delegate", 20); + expect(constants).toHaveProperty("preserved_cycles", 5); + expect(constants).toHaveProperty("blocks_per_cycle", 4096); + expect(constants).toHaveProperty("blocks_per_commitment", 32); + expect(constants).toHaveProperty("blocks_per_roll_snapshot", 256); + expect(constants).toHaveProperty("blocks_per_voting_period", 20480); + expect(constants.time_between_blocks.toString()).toEqual("60,40"); + expect(constants).toHaveProperty("endorsers_per_block", 32); + expect(constants.hard_gas_limit_per_operation.toString()).toEqual("1040000"); + expect(constants.hard_gas_limit_per_block.toString()).toEqual("10400000"); + expect(constants.proof_of_work_threshold.toString()).toEqual("70368744177663"); + expect(constants.tokens_per_roll.toString()).toEqual("8000000000"); + expect(constants).toHaveProperty("michelson_maximum_type_size", 1000); + expect(constants.seed_nonce_revelation_tip.toString()).toEqual("125000"); + expect(constants).toHaveProperty("origination_size", 257); + expect(constants.block_security_deposit.toString()).toEqual("512000000"); + expect(constants.endorsement_security_deposit.toString()).toEqual("64000000"); + expect(constants.baking_reward_per_endorsement?.toString()).toEqual("1250000,187500"); + expect(constants.endorsement_reward.toString()).toEqual("1250000,833333"); + expect(constants.cost_per_byte.toString()).toEqual("250"); + expect(constants.hard_storage_limit_per_operation.toString()).toEqual("60000"); + expect(constants.test_chain_duration?.toString()).toEqual("1228800"); + expect(constants).toHaveProperty("quorum_min", 2000); + expect(constants).toHaveProperty("quorum_max", 7000); + expect(constants).toHaveProperty("min_proposal_quorum", 500); + expect(constants).toHaveProperty("initial_endorsers", 24); + expect(constants.delay_per_missing_endorsement?.toString()).toEqual("8"); + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto9 constants at level 1480000', async (done) => { + const constants: ConstantsResponseProto009 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "1480000" }); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 5, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + blocks_per_roll_snapshot: 256, + blocks_per_voting_period: 20480, + time_between_blocks: [new BigNumber(60), new BigNumber(40)], + endorsers_per_block: 32, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(10400000), + proof_of_work_threshold: new BigNumber(70368744177663), + tokens_per_roll: new BigNumber(8000000000), + michelson_maximum_type_size: 1000, + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + block_security_deposit: new BigNumber(512000000), + endorsement_security_deposit: new BigNumber(64000000), + baking_reward_per_endorsement: [new BigNumber(1250000), new BigNumber(187500)], + endorsement_reward: [new BigNumber(1250000), new BigNumber(833333)], + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + test_chain_duration: new BigNumber(0), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 24, + delay_per_missing_endorsement: new BigNumber(8) + }); + done(); + }); + + it('Verify that rpc.getConstants successfully fetches Proto10 constants at level 1589492', async (done) => { + const constants: ConstantsResponseProto010 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "1589492" }); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 5, + blocks_per_cycle: 8192, + blocks_per_commitment: 64, + blocks_per_roll_snapshot: 512, + blocks_per_voting_period: 40960, + time_between_blocks: [new BigNumber(60), new BigNumber(40)], + endorsers_per_block: 256, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(70368744177663), + tokens_per_roll: new BigNumber(8000000000), + michelson_maximum_type_size: 1000, + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + block_security_deposit: new BigNumber(640000000), + endorsement_security_deposit: new BigNumber(2500000), + baking_reward_per_endorsement: [new BigNumber(78125), new BigNumber(11719)], + endorsement_reward: [new BigNumber(78125), new BigNumber(52083)], + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 192, + delay_per_missing_endorsement: new BigNumber(4), + minimal_block_delay: new BigNumber(30), + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 2032928, + liquidity_baking_escape_ema_threshold: 1000000 + }); + done(); + }); + + it('successfully fetches Proto11 constants at level 1932041', async (done) => { + const constants: ConstantsResponseProto011 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "1932041" }); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout: [new BigNumber(100000000)], + michelson_maximum_type_size: 2001, + preserved_cycles: 5, + blocks_per_cycle: 8192, + blocks_per_commitment: 64, + blocks_per_roll_snapshot: 512, + blocks_per_voting_period: 40960, + time_between_blocks: [new BigNumber(60), new BigNumber(40)], + endorsers_per_block: 256, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(70368744177663), + tokens_per_roll: new BigNumber(8000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + block_security_deposit: new BigNumber(640000000), + endorsement_security_deposit: new BigNumber(2500000), + baking_reward_per_endorsement: [new BigNumber(78125), new BigNumber(11719)], + endorsement_reward: [new BigNumber(78125), new BigNumber(52083)], + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + initial_endorsers: 192, + delay_per_missing_endorsement: new BigNumber(4), + minimal_block_delay: new BigNumber(30), + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 2244609, + liquidity_baking_escape_ema_threshold: 1000000 + }); + done(); + }); + + it('successfully fetches Proto12 constants at level 2354016', async (done) => { + const constants: ConstantsResponseProto012 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "2354016" }); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout: [new BigNumber(100000000), new BigNumber(240000), new BigNumber(2560)], + michelson_maximum_type_size: 2001, + preserved_cycles: 5, + blocks_per_cycle: 8192, + blocks_per_commitment: 64, + blocks_per_voting_period: 40960, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(70368744177663), + tokens_per_roll: new BigNumber(6000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + minimal_block_delay: new BigNumber(30), + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 3063809, + liquidity_baking_escape_ema_threshold: 666667, + blocks_per_stake_snapshot: 512, + baking_reward_fixed_portion: new BigNumber("10000000"), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + max_operations_time_to_live: 120, + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + numerator: 2, + denominator: 3 + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: new BigNumber(640000000), + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + numerator: 1, + denominator: 2 + }, + delay_increment_per_round: new BigNumber(15), + }); + done(); + }); + + it('successfully fetches Proto13 constants at level 2656071', async (done) => { + const constants: ConstantsResponseProto013 & ConstantsResponseCommon = await Tezos.rpc.getConstants({ block: "2656071" }); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 5, + blocks_per_cycle: 8192, + blocks_per_commitment: 64, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(70368744177663), + tokens_per_roll: new BigNumber(6000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 3063809, + liquidity_baking_toggle_ema_threshold: 1000000000, + max_allowed_global_constants_depth: 10000, + max_micheline_bytes_limit: 50000, + max_micheline_node_count: 50000, + michelson_maximum_type_size: 2001, + blocks_per_stake_snapshot: 512, + baking_reward_fixed_portion: new BigNumber(10000000), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + max_operations_time_to_live: 120, + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + denominator: 3, + numerator: 2, + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: new BigNumber(640000000), + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + denominator: 2, + numerator: 1, + }, + minimal_block_delay: new BigNumber(30), + delay_increment_per_round: new BigNumber(15), + cache_layout_size: 3, + cache_sampler_state_cycles: 8, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cycles_per_voting_period: 5, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_enable: false, + sc_rollup_max_available_messages: 1000000, + sc_rollup_origination_size: 6314, + tx_rollup_commitment_bond: new BigNumber(10000000000), + tx_rollup_cost_per_byte_ema_factor: 120, + tx_rollup_enable: true, + tx_rollup_finality_period: 40000, + tx_rollup_hard_size_limit_per_inbox: 500000, + tx_rollup_hard_size_limit_per_message: 5000, + tx_rollup_max_commitments_count: 80100, + tx_rollup_max_inboxes_count: 40100, + tx_rollup_max_messages_per_inbox: 1010, + tx_rollup_max_ticket_payload_size: 2048, + tx_rollup_max_withdrawals_per_batch: 15, + tx_rollup_origination_size: 4000, + tx_rollup_rejection_max_proof_size: 30000, + tx_rollup_sunset_level: 3473409, + tx_rollup_withdraw_period: 40000, + }); + done(); + }); + }); + + describe(`Fetch constants for testnet`, () => { + + limanet(`successfully fetches all constants for limanet using ${rpc}`, async (done) => { + Tezos.setRpcProvider(rpc); + const constants: ConstantsResponseProto013 & ConstantsResponseCommon = await Tezos.rpc.getConstants(); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + max_micheline_node_count: 50000, + max_micheline_bytes_limit: 50000, + max_allowed_global_constants_depth: 10000, + cache_layout_size: 3, + michelson_maximum_type_size: 2001, + sc_max_wrapped_proof_binary_size: 30000, + sc_rollup_message_size_limit: 4096, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + nonce_revelation_threshold: 256, + blocks_per_stake_snapshot: 256, + cycles_per_voting_period: 1, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(-1), + minimal_stake: "6000000000", + vdf_difficulty: new BigNumber(2000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + baking_reward_fixed_portion: new BigNumber(10000000), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_toggle_ema_threshold: 1000000000, + max_operations_time_to_live: 120, + minimal_block_delay: new BigNumber(15), + delay_increment_per_round: new BigNumber(5), + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + numerator: 2, + denominator: 3 + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: new BigNumber(640000000), + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + numerator: 1, + denominator: 2 + }, + testnet_dictator: "tz1Xf8zdT3DbAX9cHw3c3CXh79rc4nK4gCe8", + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cache_sampler_state_cycles: 8, + tx_rollup_enable: true, + tx_rollup_origination_size: 4000, + tx_rollup_hard_size_limit_per_inbox: 500000, + tx_rollup_hard_size_limit_per_message: 5000, + tx_rollup_max_withdrawals_per_batch: 15, + tx_rollup_commitment_bond: new BigNumber(10000000000), + tx_rollup_finality_period: 40000, + tx_rollup_withdraw_period: 40000, + tx_rollup_max_inboxes_count: 40100, + tx_rollup_max_messages_per_inbox: 1010, + tx_rollup_max_commitments_count: 80100, + tx_rollup_cost_per_byte_ema_factor: 120, + tx_rollup_max_ticket_payload_size: 2048, + tx_rollup_rejection_max_proof_size: 30000, + tx_rollup_sunset_level: 10000000, + dal_parametric: { + feature_enable: false, + number_of_slots: 256, + number_of_shards: 2048, + endorsement_lag: 1, + availability_threshold: 50, + slot_size: 1048576, + redundancy_factor: 16, + page_size: 4096 + }, + sc_rollup_enable: false, + sc_rollup_origination_size: 6314, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_max_number_of_messages_per_commitment_period: 300000000, + sc_rollup_stake_amount: new BigNumber(10000000000), + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_max_outbox_messages_per_level: 100, + sc_rollup_number_of_sections_in_dissection: 32, + sc_rollup_timeout_period_in_blocks: 20160, + sc_rollup_max_number_of_cemented_commitments: 5, + zk_rollup_enable: false, + zk_rollup_origination_size: 4000, + zk_rollup_min_pending_to_process: 10 + }); + + done(); + }); + + kathmandunet(`successfully fetches all constants for kathmandunet using ${rpc}`, async (done) => { + Tezos.setRpcProvider(rpc); + const constants: ConstantsResponseProto014 & ConstantsResponseCommon = await Tezos.rpc.getConstants(); + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + nonce_revelation_threshold: 256, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 3, + blocks_per_cycle: 4096, + blocks_per_commitment: 32, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(-1), + tokens_per_roll: new BigNumber(6000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 10000000, + liquidity_baking_toggle_ema_threshold: 1000000000, + max_allowed_global_constants_depth: 10000, + max_micheline_bytes_limit: 50000, + max_micheline_node_count: 50000, + michelson_maximum_type_size: 2001, + blocks_per_stake_snapshot: 256, + baking_reward_fixed_portion: new BigNumber(10000000), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + max_operations_time_to_live: 120, + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + denominator: 3, + numerator: 2, + }, + max_slashing_period: 2, + max_wrapped_proof_binary_size: 30000, + frozen_deposits_percentage: 10, + double_baking_punishment: new BigNumber(640000000), + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + denominator: 2, + numerator: 1, + }, + minimal_block_delay: new BigNumber(15), + dal_parametric: { + availability_threshold: 50, + endorsement_lag: 1, + feature_enable: false, + number_of_shards: 2048, + number_of_slots: 256, + }, + delay_increment_per_round: new BigNumber(15), + cache_layout_size: 3, + cache_sampler_state_cycles: 8, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cycles_per_voting_period: 1, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_enable: false, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_max_available_messages: 1000000, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_outbox_messages_per_level: 100, + sc_rollup_origination_size: 6314, + sc_rollup_stake_amount: new BigNumber("32000000"), + tx_rollup_commitment_bond: new BigNumber(10000000000), + tx_rollup_cost_per_byte_ema_factor: 120, + tx_rollup_enable: true, + tx_rollup_finality_period: 40000, + tx_rollup_hard_size_limit_per_inbox: 500000, + tx_rollup_hard_size_limit_per_message: 5000, + tx_rollup_max_commitments_count: 80100, + tx_rollup_max_inboxes_count: 40100, + tx_rollup_max_messages_per_inbox: 1010, + tx_rollup_max_ticket_payload_size: 2048, + tx_rollup_max_withdrawals_per_batch: 15, + tx_rollup_origination_size: 4000, + tx_rollup_rejection_max_proof_size: 30000, + tx_rollup_sunset_level: 10000000, + tx_rollup_withdraw_period: 40000, + vdf_difficulty: new BigNumber("8000000000"), + }); + + done(); + }); + + alpha(`successfully fetches all constants for mondaynet using ${rpc}`, async (done) => { + Tezos.setRpcProvider(rpc); + const constants: ConstantsResponseProto014 & ConstantsResponseCommon = await Tezos.rpc.getConstants(); + + expect(constants).toEqual({ + proof_of_work_nonce_size: 8, + nonce_length: 32, + nonce_revelation_threshold: 16, + max_anon_ops_per_block: 132, + max_operation_data_length: 32768, + max_proposals_per_delegate: 20, + preserved_cycles: 3, + blocks_per_cycle: 128, + blocks_per_commitment: 16, + hard_gas_limit_per_operation: new BigNumber(1040000), + hard_gas_limit_per_block: new BigNumber(5200000), + proof_of_work_threshold: new BigNumber(-1), + tokens_per_roll: new BigNumber(8000000000), + seed_nonce_revelation_tip: new BigNumber(125000), + origination_size: 257, + cost_per_byte: new BigNumber(250), + hard_storage_limit_per_operation: new BigNumber(60000), + quorum_min: 2000, + quorum_max: 7000, + min_proposal_quorum: 500, + liquidity_baking_subsidy: new BigNumber(2500000), + liquidity_baking_sunset_level: 10000000, + liquidity_baking_toggle_ema_threshold: 100000, + max_allowed_global_constants_depth: 10000, + max_micheline_bytes_limit: 50000, + max_micheline_node_count: 50000, + michelson_maximum_type_size: 2001, + blocks_per_stake_snapshot: 64, + baking_reward_fixed_portion: new BigNumber(10000000), + baking_reward_bonus_per_slot: new BigNumber(4286), + endorsing_reward_per_slot: new BigNumber(2857), + max_operations_time_to_live: 120, + consensus_committee_size: 7000, + consensus_threshold: 4667, + minimal_participation_ratio: { + denominator: 3, + numerator: 2, + }, + max_slashing_period: 2, + frozen_deposits_percentage: 10, + double_baking_punishment: new BigNumber(640000000), + ratio_of_frozen_deposits_slashed_per_double_endorsement: { + denominator: 2, + numerator: 1, + }, + minimal_block_delay: new BigNumber(15), + delay_increment_per_round: new BigNumber(15), + dal_parametric: { + availability_threshold: 50, + endorsement_lag: 1, + feature_enable: false, + number_of_shards: 2048, + number_of_slots: 256, + }, + cache_layout_size: 3, + cache_sampler_state_cycles: 8, + cache_script_size: 100000000, + cache_stake_distribution_cycles: 8, + cycles_per_voting_period: 1, + sc_max_wrapped_proof_binary_size: 30000, + sc_rollup_challenge_window_in_blocks: 20160, + sc_rollup_enable: false, + sc_rollup_max_available_messages: 1000000, + sc_rollup_origination_size: 6314, + sc_rollup_commitment_period_in_blocks: 30, + sc_rollup_max_active_outbox_levels: 20160, + sc_rollup_message_size_limit: 4096, + sc_rollup_max_lookahead_in_blocks: 30000, + sc_rollup_max_outbox_messages_per_level: 100, + sc_rollup_stake_amount: "32000000", + tx_rollup_commitment_bond: new BigNumber(10000000000), + tx_rollup_cost_per_byte_ema_factor: 120, + tx_rollup_enable: true, + tx_rollup_finality_period: 10, + tx_rollup_hard_size_limit_per_inbox: 500000, + tx_rollup_hard_size_limit_per_message: 5000, + tx_rollup_max_commitments_count: 30, + tx_rollup_max_inboxes_count: 15, + tx_rollup_max_messages_per_inbox: 1010, + tx_rollup_max_ticket_payload_size: 2048, + tx_rollup_max_withdrawals_per_batch: 15, + tx_rollup_origination_size: 4000, + tx_rollup_rejection_max_proof_size: 30000, + tx_rollup_sunset_level: 17280, + tx_rollup_withdraw_period: 10, + vdf_difficulty: "50000", + }); + + done(); + }); + }); +}); diff --git a/integration-tests/rpc-nodes.spec.ts b/integration-tests/rpc-nodes.spec.ts index e82a71ee3f..ed968539e5 100644 --- a/integration-tests/rpc-nodes.spec.ts +++ b/integration-tests/rpc-nodes.spec.ts @@ -20,7 +20,7 @@ CONFIGS().forEach( }) => { const Tezos = lib; - const jakartanet = protocol === Protocols.PtJakart2 ? test : test.skip; + const limanet = protocol === Protocols.PtLimaPtL ? test : test.skip; const kathmandunetAndAlpha = protocol === Protocols.PtKathman || protocol === Protocols.ProtoALpha ? test : test.skip; beforeAll(async (done) => { @@ -409,13 +409,13 @@ CONFIGS().forEach( done(); }); - jakartanet('Verify that rpcClient.getTxRollupInbox will access the inbox of a transaction rollup on jakartanet', async (done) => { + it('Verify that rpcClient.getTxRollupInbox will access the inbox of a transaction rollup', async (done) => { const inbox = await rpcClient.getTxRollupInbox(txRollupAddress, '0'); expect(inbox).toBeDefined(); done(); }); - jakartanet('Verify that rpcClient.getTxRollupState will access the state of a rollup on jakartanet', async (done) => { + it('Verify that rpcClient.getTxRollupState will access the state of a rollup', async (done) => { const state = await rpcClient.getTxRollupState(txRollupAddress); expect(state).toBeDefined(); done(); @@ -436,4 +436,4 @@ CONFIGS().forEach( }); }); } -); \ No newline at end of file +); diff --git a/integration-tests/tx-rollup-l2-address.spec.ts b/integration-tests/tx-rollup-l2-address.spec.ts index 70261d9d56..7eaa038aa3 100644 --- a/integration-tests/tx-rollup-l2-address.spec.ts +++ b/integration-tests/tx-rollup-l2-address.spec.ts @@ -4,7 +4,6 @@ import { UnitValue } from '@taquito/michelson-encoder'; CONFIGS().forEach(({lib, setup, protocol}) => { const tezos = lib; - const jakartanet = (protocol === Protocols.PtJakart2) ? test : test.skip; const mondaynet = protocol === Protocols.ProtoALpha ? test : test.skip; describe(`jakarta contract originations and method calls to test the type of tx_rollup_l2_address`, () => { @@ -12,7 +11,7 @@ CONFIGS().forEach(({lib, setup, protocol}) => { await setup(); done(); }) - jakartanet(`Originate a contract with a hex string type tz1 & tz4 in initial storage tz4 & string`, async (done) => { + it(`Originate a contract with a hex string type tz1 & tz4 in initial storage tz4 & string`, async (done) => { const op = await tezos.contract.originate({ code: ` parameter (pair address tx_rollup_l2_address string); @@ -69,7 +68,7 @@ CONFIGS().forEach(({lib, setup, protocol}) => { done(); }) - jakartanet(`jakarta contract with params and storage as tx_rollup_l2_address`, async (done) => { + it(`jakarta contract with params and storage as tx_rollup_l2_address`, async (done) => { const op = await tezos.contract.originate({ code: [{"prim":"parameter","args":[{"prim":"tx_rollup_l2_address"}]},{"prim":"storage","args":[{"prim":"tx_rollup_l2_address"}]},{"prim":"code","args":[[{"prim":"CAR"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"PAIR"}]]}], storage: "tz4QyWfEiv56CVDATV3DT3CDVhPaMKif2Ce8" diff --git a/packages/taquito/src/constants.ts b/packages/taquito/src/constants.ts index ae643072f6..e947d8b5a0 100644 --- a/packages/taquito/src/constants.ts +++ b/packages/taquito/src/constants.ts @@ -33,6 +33,7 @@ export enum Protocols { Psithaca2 = 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', PtJakart2 = 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', PtKathman = 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + PtLimaPtL = 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', } @@ -48,7 +49,8 @@ export const protocols = { '012': [Protocols.PsiThaCa, Protocols.Psithaca2], '013': [Protocols.PtJakart2], '014': [Protocols.PtKathman], - '015': [Protocols.ProtoALpha], + '015': [Protocols.PtLimaPtL], + '016': [Protocols.ProtoALpha] }; export enum ChainIds { @@ -63,4 +65,5 @@ export enum ChainIds { ITHACANET2 = 'NetXnHfVqm9iesp', JAKARTANET2 = 'NetXLH1uAxK7CCh', KATHMANDUNET = 'NetXazhm4yetmff', + LIMANET = 'NetXizpkH94bocH', }