Skip to content

Commit

Permalink
test: updated estimation assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-an-yang committed Dec 3, 2024
1 parent 5a03a68 commit 8e5abdf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
72 changes: 36 additions & 36 deletions integration-tests/__tests__/contract/estimation-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 });
expect(estimate.gasLimit).toEqual(101);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(188);
expect(estimate.suggestedFeeMutez).toEqual(190);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(168);
expect(estimate.totalCost).toEqual(168);
expect(estimate.usingBaseFeeMutez).toEqual(168);
expect(estimate.minimalFeeMutez).toEqual(170);
expect(estimate.totalCost).toEqual(170);
expect(estimate.usingBaseFeeMutez).toEqual(170);
expect(estimate.consumedMilligas).toEqual(100040);
});

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

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

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

Expand All @@ -97,11 +97,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1457);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(396);
expect(estimate.suggestedFeeMutez).toEqual(398);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(376);
expect(estimate.totalCost).toEqual(376);
expect(estimate.usingBaseFeeMutez).toEqual(376);
expect(estimate.minimalFeeMutez).toEqual(378);
expect(estimate.totalCost).toEqual(378);
expect(estimate.usingBaseFeeMutez).toEqual(378);
expect(estimate.consumedMilligas).toEqual(1456228);
});

Expand All @@ -114,11 +114,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1571);
expect(estimate.storageLimit).toEqual(534);
expect(estimate.suggestedFeeMutez).toEqual(467);
expect(estimate.suggestedFeeMutez).toEqual(469);
expect(estimate.burnFeeMutez).toEqual(133500);
expect(estimate.minimalFeeMutez).toEqual(447);
expect(estimate.totalCost).toEqual(133947);
expect(estimate.usingBaseFeeMutez).toEqual(447);
expect(estimate.minimalFeeMutez).toEqual(449);
expect(estimate.totalCost).toEqual(133949);
expect(estimate.usingBaseFeeMutez).toEqual(449);
expect(estimate.consumedMilligas).toEqual(1570757);
});

Expand All @@ -127,11 +127,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(1867);
expect(estimate.storageLimit).toEqual(337);
expect(estimate.suggestedFeeMutez).toEqual(443);
expect(estimate.suggestedFeeMutez).toEqual(445);
expect(estimate.burnFeeMutez).toEqual(84250);
expect(estimate.minimalFeeMutez).toEqual(423);
expect(estimate.totalCost).toEqual(84673);
expect(estimate.usingBaseFeeMutez).toEqual(423);
expect(estimate.minimalFeeMutez).toEqual(425);
expect(estimate.totalCost).toEqual(84675);
expect(estimate.usingBaseFeeMutez).toEqual(425);
expect(estimate.consumedMilligas).toEqual(1866852);
});

Expand All @@ -140,11 +140,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
const estimate = await LowAmountTez.estimate.transfer(tx);
expect(estimate.gasLimit).toEqual(2393);
expect(estimate.storageLimit).toEqual(654);
expect(estimate.suggestedFeeMutez).toEqual(561);
expect(estimate.suggestedFeeMutez).toEqual(563);
expect(estimate.burnFeeMutez).toEqual(163500);
expect(estimate.minimalFeeMutez).toEqual(541);
expect(estimate.totalCost).toEqual(164041);
expect(estimate.usingBaseFeeMutez).toEqual(541);
expect(estimate.minimalFeeMutez).toEqual(543);
expect(estimate.totalCost).toEqual(164043);
expect(estimate.usingBaseFeeMutez).toEqual(543);
expect(estimate.consumedMilligas).toEqual(2392005);
// Do the actual operation
const op2 = await contract.methods.do(originate2()).send();
Expand Down Expand Up @@ -176,11 +176,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + getRevealFee(await LowAmountTez.signer.publicKeyHash())) });
expect(estimate.gasLimit).toEqual(101);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(187);
expect(estimate.suggestedFeeMutez).toEqual(189);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(167);
expect(estimate.totalCost).toEqual(167);
expect(estimate.usingBaseFeeMutez).toEqual(167);
expect(estimate.minimalFeeMutez).toEqual(169);
expect(estimate.totalCost).toEqual(169);
expect(estimate.usingBaseFeeMutez).toEqual(169);
expect(estimate.consumedMilligas).toEqual(100040);
});

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const nairobinetSecretKey: Config =
const ghostnetEphemeral: Config =
defaultConfig({
networkName: 'GHOSTNET',
protocol: Protocols.PtParisBx,
protocol: Protocols.PsParisCZ,
defaultRpc: 'http://ecad-tezos-ghostnet-rolling-1.i.ecadinfra.com/',
knownContracts: knownContractsPtGhostnet,
signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/ghostnet')
Expand All @@ -166,7 +166,7 @@ const weeklynetEphemeral: Config =
defaultConfig({
networkName: 'WEEKLYNET',
protocol: Protocols.ProtoALpha,
defaultRpc: 'https://rpc.weeklynet-2024-09-04.teztnets.com',
defaultRpc: 'https://rpc.weeklynet-2024-11-27.teztnets.com',
knownContracts: knownContractsProtoALph,
signerConfig: defaultEphemeralConfig('http://key-gen-1.i.tez.ie:3010/mondaynet')
});
Expand Down

0 comments on commit 8e5abdf

Please sign in to comment.