From ab211c0ab91cca13b2941c23378d4933013ae148 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 19 Dec 2023 16:24:57 -0800 Subject: [PATCH 01/11] removed references to originationProof --- docs/rpc_package.md | 13 +-------- docs/smart_rollups.md | 1 - ...tract-batch-smart-rollup-originate.spec.ts | 2 -- .../contract-smart-rollup-originate.spec.ts | 1 - integration-tests/data/allTestsCases.ts | 2 -- integration-tests/rpc-nodes.spec.ts | 10 ------- .../src/rpc-wrapper.ts | 12 +++----- .../src/schema/operation.ts | 1 - .../test/taquito-local-forging.spec.ts | 5 ---- .../taquito-rpc/src/rpc-client-interface.ts | 3 -- .../src/rpc-client-modules/rpc-cache.ts | 28 +------------------ packages/taquito-rpc/src/taquito-rpc.ts | 22 --------------- packages/taquito-rpc/src/types.ts | 6 ---- .../taquito-rpc/test/data/rpc-responses.ts | 3 -- packages/taquito-rpc/test/taquito-rpc.spec.ts | 4 --- .../taquito/src/batch/rpc-batch-provider.ts | 4 +-- packages/taquito/src/contract/prepare.ts | 6 ++-- .../src/contract/rpc-contract-provider.ts | 12 ++++---- .../smart-rollup-originate-operation.ts | 4 --- packages/taquito/src/operations/types.ts | 7 +---- .../taquito/src/prepare/prepare-provider.ts | 6 ---- .../test/batch/rpc-batch-provider.spec.ts | 6 ---- packages/taquito/test/contract/helper.ts | 2 -- .../contract/rpc-contract-provider.spec.ts | 17 ----------- .../estimate/rpc-estimate-provider.spec.ts | 3 -- .../test/prepare/prepare-provider.spec.ts | 6 ---- 26 files changed, 16 insertions(+), 170 deletions(-) diff --git a/docs/rpc_package.md b/docs/rpc_package.md index ef7fca632d..9feb50747c 100644 --- a/docs/rpc_package.md +++ b/docs/rpc_package.md @@ -96,7 +96,7 @@ const packedData = await client.packData({ data: { string: 'test' }, type: { pri console.log('-- Packed data:', packedData); ``` -You can simulate the `PACK` instruction from Michelson with the `packData` method. +You can simulate the `PACK` instruction from Michelson with the `packData` method. This function will execute Tzip4 views normally referred to as 'Lambda Views'. You can learn more about Tzip4 [here](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints) ```js @@ -111,17 +111,6 @@ const view = await client.runView({ }); ``` -You can obtain the `Origination Proof` for the `smart_rollup_originate` batch operation (not needed for the `smart_rollup_originate` alone) - -This function will obtain the proof needed for the `smart_rollup_originate` batch method -```js -const originationProof = await client.getOriginationProof({ - kernel: 'your kernel', - kind: 'PVM kind' -}) -``` - - ## Full documentation You can find the full documentation at the following address: [https://tezostaquito.io/typedoc/classes/\_taquito_rpc.rpcclient.html](https://tezostaquito.io/typedoc/classes/_taquito_rpc.rpcclient.html) diff --git a/docs/smart_rollups.md b/docs/smart_rollups.md index efb75fd3dd..9b24f68e1e 100644 --- a/docs/smart_rollups.md +++ b/docs/smart_rollups.md @@ -29,7 +29,6 @@ await op.confirmation(); - `pvmKind` at this time the only PVM supported is `wasm_2_0_0` - `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) - `parametersType` is a MichelsonV1Expression to define the type. -- **Please note** `originationProof` is needed origination in `batch` which can be obtained with the `rpc.getOriginationProof({kernel, kind: PVMKind})` For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) diff --git a/integration-tests/contract-batch-smart-rollup-originate.spec.ts b/integration-tests/contract-batch-smart-rollup-originate.spec.ts index d758a31c15..11730ae382 100644 --- a/integration-tests/contract-batch-smart-rollup-originate.spec.ts +++ b/integration-tests/contract-batch-smart-rollup-originate.spec.ts @@ -12,14 +12,12 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { it('should be able to batch smart rollup originate with other operations', async () => { const kernel = '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' - const originationProof = await Tezos.rpc.getOriginationProof({ kernel, kind: PvmKind.WASM2 }) const batch = Tezos.contract .batch() .withSmartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel, - originationProof, parametersType: { prim: 'bytes' }, }) .withOrigination({ diff --git a/integration-tests/contract-smart-rollup-originate.spec.ts b/integration-tests/contract-smart-rollup-originate.spec.ts index 77ca16ee1b..fb6b5f1c69 100644 --- a/integration-tests/contract-smart-rollup-originate.spec.ts +++ b/integration-tests/contract-smart-rollup-originate.spec.ts @@ -19,7 +19,6 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { await op.confirmation(); expect(op.status).toEqual('applied'); - expect(op.originationProof).toBeDefined(); expect(op.kernel).toEqual('23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a'); }); }); diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index 7fb8213441..5794242a08 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -1363,8 +1363,6 @@ export const commonCases: TestCase[] = [ pvm_kind: PvmKind.WASM2, kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, diff --git a/integration-tests/rpc-nodes.spec.ts b/integration-tests/rpc-nodes.spec.ts index 5f8a370307..9a7380324c 100644 --- a/integration-tests/rpc-nodes.spec.ts +++ b/integration-tests/rpc-nodes.spec.ts @@ -454,16 +454,6 @@ CONFIGS().forEach( expect(pendingOperations.branch_delayed).toBeInstanceOf(Array); expect(pendingOperations.branch_refused).toBeInstanceOf(Array); }); - - it('Verify that rpcClient.getOriginationProof will retrieve the proof needed for smart rollup originate', async () => { - const proof = await rpcClient.getOriginationProof({ - kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - kind: PvmKind.WASM2 - }) - const hexRegex = RegExp('^[a-fA-F0-9]+$'); - expect(proof).toBeDefined(); - expect(hexRegex.test(proof)).toEqual(true); - }) }); }); } diff --git a/packages/taquito-contracts-library/src/rpc-wrapper.ts b/packages/taquito-contracts-library/src/rpc-wrapper.ts index 7fb5335d13..57e810cc36 100644 --- a/packages/taquito-contracts-library/src/rpc-wrapper.ts +++ b/packages/taquito-contracts-library/src/rpc-wrapper.ts @@ -48,7 +48,6 @@ import { AllTicketBalances, PendingOperations, PendingOperationsQueryArguments, - OriginationProofParams, RPCSimulateOperationParam, } from '@taquito/rpc'; import { ContractsLibrary } from './taquito-contracts-library'; @@ -58,7 +57,10 @@ import { ContractsLibrary } from './taquito-contracts-library'; * */ export class RpcWrapperContractsLibrary implements RpcClientInterface { - constructor(private rpc: RpcClientInterface, private contractslibrary: ContractsLibrary) {} + constructor( + private rpc: RpcClientInterface, + private contractslibrary: ContractsLibrary + ) {} async getContract( address: string, @@ -334,10 +336,4 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface { async getPendingOperations(args: PendingOperationsQueryArguments): Promise { return this.rpc.getPendingOperations(args); } - async getOriginationProof( - params: OriginationProofParams, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - return this.rpc.getOriginationProof(params, { block }); - } } diff --git a/packages/taquito-local-forging/src/schema/operation.ts b/packages/taquito-local-forging/src/schema/operation.ts index c6fdb9667a..6afa832920 100644 --- a/packages/taquito-local-forging/src/schema/operation.ts +++ b/packages/taquito-local-forging/src/schema/operation.ts @@ -148,7 +148,6 @@ export const SmartRollupOriginateSchema = { storage_limit: CODEC.ZARITH, pvm_kind: CODEC.PVM_KIND, kernel: CODEC.PADDED_BYTES, - origination_proof: CODEC.PADDED_BYTES, parameters_ty: CODEC.VALUE, }; diff --git a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts index c87187b634..99057ffa22 100644 --- a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts +++ b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts @@ -287,8 +287,6 @@ describe('Forge and parse operations default protocol', () => { pvm_kind: 'wasm_2_0_0', kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, @@ -299,9 +297,6 @@ describe('Forge and parse operations default protocol', () => { expect(forged).toContain( '0000035323212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' ); - expect(forged).toContain( - '000000770300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); expect(forged).toContain('000000020369'); }); diff --git a/packages/taquito-rpc/src/rpc-client-interface.ts b/packages/taquito-rpc/src/rpc-client-interface.ts index f8e910a99c..8a19841571 100644 --- a/packages/taquito-rpc/src/rpc-client-interface.ts +++ b/packages/taquito-rpc/src/rpc-client-interface.ts @@ -48,7 +48,6 @@ import { AllTicketBalances, PendingOperations, PendingOperationsQueryArguments, - OriginationProofParams, RPCSimulateOperationParam, } from './types'; @@ -133,7 +132,6 @@ export interface RpcClientInterface { ): Promise; getAllTicketBalances(contract: string, options?: RPCOptions): Promise; getPendingOperations(args: PendingOperationsQueryArguments): Promise; - getOriginationProof(params: OriginationProofParams, options?: RPCOptions): Promise; } export enum RPCMethodName { @@ -177,5 +175,4 @@ export enum RPCMethodName { GET_TICKET_BALANCE = 'getTicketBalance', GET_ALL_TICKET_BALANCES = 'getAllTicketBalances', GET_PENDING_OPERATIONS = 'getPendingOperations', - GET_ORIGINATION_PROOF = 'getOriginationProof', } diff --git a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts index dc34aea7b2..05a3f0f69d 100644 --- a/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts +++ b/packages/taquito-rpc/src/rpc-client-modules/rpc-cache.ts @@ -50,7 +50,6 @@ import { AllTicketBalances, PendingOperationsQueryArguments, PendingOperations, - OriginationProofParams, RPCSimulateOperationParam, } from '../types'; import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core'; @@ -74,8 +73,7 @@ type RpcMethodParam = | BigMapKey | BakingRightsQueryArguments | PendingOperationsQueryArguments - | EndorsingRightsQueryArguments - | OriginationProofParams; + | EndorsingRightsQueryArguments; const defaultTtl = 1000; @@ -1272,28 +1270,4 @@ export class RpcClientCache implements RpcClientInterface { return response; } } - - /** - * - * @param params contains the PVM kind and kernel to generate the origination proof from - * @description rpc call to generate the origination proof needed for the smart rollup originate operation - * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes - */ - async getOriginationProof( - params: OriginationProofParams, - { block }: RPCOptions = defaultRPCOptions - ): Promise { - const key = this.formatCacheKey( - this.rpcClient.getRpcUrl(), - RPCMethodName.GET_ORIGINATION_PROOF, - [block, params] - ); - if (this.has(key)) { - return this.get(key); - } else { - const response = this.rpcClient.getOriginationProof(params, { block }); - this.put(key, response); - return response; - } - } } diff --git a/packages/taquito-rpc/src/taquito-rpc.ts b/packages/taquito-rpc/src/taquito-rpc.ts index e8125e2954..d2fdd3673b 100644 --- a/packages/taquito-rpc/src/taquito-rpc.ts +++ b/packages/taquito-rpc/src/taquito-rpc.ts @@ -61,7 +61,6 @@ import { AllTicketBalances, PendingOperationsQueryArguments, PendingOperations, - OriginationProofParams, RPCSimulateOperationParam, } from './types'; import { castToBigNumber } from './utils/utils'; @@ -1226,25 +1225,4 @@ export class RpcClient implements RpcClientInterface { query: args, }); } - - /** - * - * @param params contains the PVM kind and kernel to generate the origination proof from - * @description rpc call to generate the origination proof needed for a smart rollup originate operation - * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes - */ - async getOriginationProof( - params: OriginationProofParams, - { block }: { block: string } = defaultRPCOptions - ): Promise { - return this.httpBackend.createRequest( - { - url: this.createURL( - `/chains/${this.chain}/blocks/${block}/context/smart_rollups/all/origination_proof` - ), - method: 'POST', - }, - params - ); - } } diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index aae08d6227..07314b09fd 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -385,7 +385,6 @@ export interface OperationContentsSmartRollupOriginate { storage_limit: string; pvm_kind: PvmKind; kernel: string; - origination_proof: string; parameters_ty: MichelsonV1Expression; } @@ -2180,11 +2179,6 @@ export enum PvmKind { ARITH = 'arith', } -export interface OriginationProofParams { - kind: PvmKind; - kernel: string; -} - export interface SmartRollupPublishCommitment { compressed_state: string; inbox_level: number; diff --git a/packages/taquito-rpc/test/data/rpc-responses.ts b/packages/taquito-rpc/test/data/rpc-responses.ts index 1d146c990c..e9128d3f22 100644 --- a/packages/taquito-rpc/test/data/rpc-responses.ts +++ b/packages/taquito-rpc/test/data/rpc-responses.ts @@ -4562,8 +4562,6 @@ export const smartRollupOriginateResponse = { pvm_kind: 'wasm_2_0_0', kernel: '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, @@ -4798,7 +4796,6 @@ export const smartRollupCementResponse = { gas_limit: '6986', storage_limit: '0', rollup: 'sr1CCHLfB1jjz4ikB2bm4XGPvTjafVgUzhLB', - commitment: 'src12mERNVEb3N1EVmbUbudctzajiezmd3q6EsgLexkgxNCHK8PNBi', metadata: { balance_updates: [ { diff --git a/packages/taquito-rpc/test/taquito-rpc.spec.ts b/packages/taquito-rpc/test/taquito-rpc.spec.ts index c0b255b44c..dccaff556c 100644 --- a/packages/taquito-rpc/test/taquito-rpc.spec.ts +++ b/packages/taquito-rpc/test/taquito-rpc.spec.ts @@ -3740,9 +3740,6 @@ describe('RpcClient test', () => { expect(content.kernel).toEqual( '23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a' ); - expect(content.origination_proof).toEqual( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); expect(content.parameters_ty).toEqual({ prim: 'bytes' }); const soruResult = content.metadata.operation_result; @@ -3878,7 +3875,6 @@ describe('RpcClient test', () => { expect(content.gas_limit).toEqual('6986'); expect(content.storage_limit).toEqual('0'); expect(content.rollup).toEqual('sr1CCHLfB1jjz4ikB2bm4XGPvTjafVgUzhLB'); - expect(content.commitment).toEqual('src12mERNVEb3N1EVmbUbudctzajiezmd3q6EsgLexkgxNCHK8PNBi'); const soruResult = content.metadata.operation_result; diff --git a/packages/taquito/src/batch/rpc-batch-provider.ts b/packages/taquito/src/batch/rpc-batch-provider.ts index 5902ca5927..1b131d2f6a 100644 --- a/packages/taquito/src/batch/rpc-batch-provider.ts +++ b/packages/taquito/src/batch/rpc-batch-provider.ts @@ -24,7 +24,7 @@ import { TransferTicketParams, IncreasePaidStorageParams, SmartRollupAddMessagesParams, - SmartRollupOriginateParamsWithProof, + SmartRollupOriginateParams, } from '../operations/types'; import { OpKind } from '@taquito/rpc'; import { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param'; @@ -197,7 +197,7 @@ export class OperationBatch extends Provider { * * @param params Smart Rollup Originate operation parameter */ - withSmartRollupOriginate(params: SmartRollupOriginateParamsWithProof) { + withSmartRollupOriginate(params: SmartRollupOriginateParams) { this.operations.push({ kind: OpKind.SMART_ROLLUP_ORIGINATE, ...params }); return this; } diff --git a/packages/taquito/src/contract/prepare.ts b/packages/taquito/src/contract/prepare.ts index 96955e3bb7..28fbbb8cd7 100644 --- a/packages/taquito/src/contract/prepare.ts +++ b/packages/taquito/src/contract/prepare.ts @@ -28,9 +28,9 @@ import { SmartRollupAddMessagesParams, RPCSmartRollupAddMessagesOperation, RPCSmartRollupOriginateOperation, - SmartRollupOriginateParamsWithProof, ActivationParams, RPCActivateOperation, + SmartRollupOriginateParams, } from '../operations/types'; import { DEFAULT_FEE, @@ -324,9 +324,8 @@ export const createSmartRollupOriginateOperation = async ({ storageLimit, pvmKind, kernel, - originationProof, parametersType, -}: SmartRollupOriginateParamsWithProof) => { +}: SmartRollupOriginateParams) => { return { kind: OpKind.SMART_ROLLUP_ORIGINATE, source, @@ -335,7 +334,6 @@ export const createSmartRollupOriginateOperation = async ({ storage_limit: storageLimit, pvm_kind: pvmKind, kernel, - origination_proof: originationProof, parameters_ty: parametersType, } as RPCSmartRollupOriginateOperation; }; diff --git a/packages/taquito/src/contract/rpc-contract-provider.ts b/packages/taquito/src/contract/rpc-contract-provider.ts index 35dfed1195..7b80cd3c41 100644 --- a/packages/taquito/src/contract/rpc-contract-provider.ts +++ b/packages/taquito/src/contract/rpc-contract-provider.ts @@ -73,7 +73,10 @@ import { PrepareProvider } from '../prepare'; import { FailingNoopOperation } from '../operations/failing-noop-operation'; export class RpcContractProvider extends Provider implements ContractProvider, StorageProvider { - constructor(context: Context, private estimator: EstimationProvider) { + constructor( + context: Context, + private estimator: EstimationProvider + ) { super(context); } contractProviderTypeSymbol = Symbol.for('taquito-contract-provider-type-symbol'); @@ -657,13 +660,8 @@ export class RpcContractProvider extends Provider implements ContractProvider, S params, this.estimator.smartRollupOriginate.bind(this.estimator) ); - const originationProof = await this.rpc.getOriginationProof({ - kind: params.pvmKind, - kernel: params.kernel, - }); - const completeParams = { ...params, originationProof }; - const prepared = await this.prepare.smartRollupOriginate({ ...completeParams, ...estimate }); + const prepared = await this.prepare.smartRollupOriginate({ ...params, ...estimate }); const content = prepared.opOb.contents.find( (op) => op.kind === OpKind.SMART_ROLLUP_ORIGINATE ) as OperationContentsSmartRollupOriginate; diff --git a/packages/taquito/src/operations/smart-rollup-originate-operation.ts b/packages/taquito/src/operations/smart-rollup-originate-operation.ts index 54da137a02..e42b34bb88 100644 --- a/packages/taquito/src/operations/smart-rollup-originate-operation.ts +++ b/packages/taquito/src/operations/smart-rollup-originate-operation.ts @@ -74,10 +74,6 @@ export class SmartRollupOriginateOperation return this.params.kernel; } - get originationProof() { - return this.params.origination_proof; - } - get errors() { return this.operationResults?.errors; } diff --git a/packages/taquito/src/operations/types.ts b/packages/taquito/src/operations/types.ts index ddcd3d9245..f6b78fd038 100644 --- a/packages/taquito/src/operations/types.ts +++ b/packages/taquito/src/operations/types.ts @@ -24,7 +24,7 @@ export type ParamsWithKind = | withKind | withKind | withKind - | withKind; + | withKind; export type ParamsWithKindExtended = ParamsWithKind | withKind; @@ -479,10 +479,6 @@ export interface SmartRollupOriginateParams { parametersType: MichelsonV1Expression; } -export interface SmartRollupOriginateParamsWithProof extends SmartRollupOriginateParams { - originationProof: string; -} - export interface RPCSmartRollupOriginateOperation { kind: OpKind.SMART_ROLLUP_ORIGINATE; source: string; @@ -491,7 +487,6 @@ export interface RPCSmartRollupOriginateOperation { storage_limit: number; pvm_kind: PvmKind; kernel: string; - origination_proof: string; parameters_ty: MichelsonV1Expression; } diff --git a/packages/taquito/src/prepare/prepare-provider.ts b/packages/taquito/src/prepare/prepare-provider.ts index b32bc70037..5686f1f8f6 100644 --- a/packages/taquito/src/prepare/prepare-provider.ts +++ b/packages/taquito/src/prepare/prepare-provider.ts @@ -905,18 +905,12 @@ export class PrepareProvider extends Provider implements PreparationProvider { }: SmartRollupOriginateParams): Promise { const { pkh } = await this.getKeys(); - const originationProof = await this.rpc.getOriginationProof({ - kind: rest.pvmKind, - kernel: rest.kernel, - }); - const protocolConstants = await this.context.readProvider.getProtocolConstants('head'); const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants); const op = await createSmartRollupOriginateOperation({ ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS), ...rest, - originationProof, }); const operation = await this.addRevealOperationIfNeeded(op, pkh); diff --git a/packages/taquito/test/batch/rpc-batch-provider.spec.ts b/packages/taquito/test/batch/rpc-batch-provider.spec.ts index e3d8395c4e..fbf67bb7a6 100644 --- a/packages/taquito/test/batch/rpc-batch-provider.spec.ts +++ b/packages/taquito/test/batch/rpc-batch-provider.spec.ts @@ -650,7 +650,6 @@ describe('OperationBatch test', () => { kind: OpKind.SMART_ROLLUP_ORIGINATE, pvmKind: PvmKind.WASM2, kernel: '1234567890', - originationProof: '0987654321', parametersType: { prim: 'bytes' }, }, ]; @@ -668,7 +667,6 @@ describe('OperationBatch test', () => { gas_limit: '1330', storage_limit: '93', kernel: '1234567890', - origination_proof: '0987654321', parameters_ty: { prim: 'bytes' }, pvm_kind: 'wasm_2_0_0', counter: '1', @@ -691,7 +689,6 @@ describe('OperationBatch test', () => { kind: OpKind.SMART_ROLLUP_ORIGINATE, pvmKind: PvmKind.WASM2, kernel: '1234567890', - originationProof: '0987654321', parametersType: { prim: 'bytes' }, gasLimit: 1100, fee: 399, @@ -712,7 +709,6 @@ describe('OperationBatch test', () => { gas_limit: '1100', storage_limit: '95', kernel: '1234567890', - origination_proof: '0987654321', parameters_ty: { prim: 'bytes' }, pvm_kind: 'wasm_2_0_0', counter: '1', @@ -736,7 +732,6 @@ describe('OperationBatch test', () => { kind: OpKind.SMART_ROLLUP_ORIGINATE, pvmKind: PvmKind.WASM2, kernel: '1234567890', - originationProof: '0987654321', parametersType: { prim: 'bytes' }, }, ]; @@ -763,7 +758,6 @@ describe('OperationBatch test', () => { gas_limit: '1330', storage_limit: '93', kernel: '1234567890', - origination_proof: '0987654321', parameters_ty: { prim: 'bytes' }, pvm_kind: 'wasm_2_0_0', counter: '2', diff --git a/packages/taquito/test/contract/helper.ts b/packages/taquito/test/contract/helper.ts index f02f729bcd..20740674da 100644 --- a/packages/taquito/test/contract/helper.ts +++ b/packages/taquito/test/contract/helper.ts @@ -1520,8 +1520,6 @@ export const smartRollupOriginateWithReveal = { pvm_kind: 'wasm_2_0_0', kernel: '0061736d0100000001280760037f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f0060000002610311736d6172745f726f6c6c75705f636f72650a726561645f696e707574000011736d6172745f726f6c6c75705f636f72650c77726974655f6f7574707574000111736d6172745f726f6c6c75705f636f72650b73746f72655f77726974650002030504030405060503010001071402036d656d02000a6b65726e656c5f72756e00060aa401042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b5001057f41fe002d0000210341fc002f0100210220002d0000210420002f0100210520011004210620042003460440200041016a200141016b10011a0520052002460440200041076a200610011a0b0b0b1d01017f41dc0141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101', - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', parameters_ty: { prim: 'bytes', }, diff --git a/packages/taquito/test/contract/rpc-contract-provider.spec.ts b/packages/taquito/test/contract/rpc-contract-provider.spec.ts index 8f852ea0f3..fc176d99f6 100644 --- a/packages/taquito/test/contract/rpc-contract-provider.spec.ts +++ b/packages/taquito/test/contract/rpc-contract-provider.spec.ts @@ -49,7 +49,6 @@ describe('RpcContractProvider test', () => { getSaplingDiffById: jest.Mock; getProtocols: jest.Mock; getCurrentPeriod: jest.Mock; - getOriginationProof: jest.Mock; getConstants: jest.Mock; }; @@ -108,7 +107,6 @@ describe('RpcContractProvider test', () => { getSaplingDiffById: jest.fn(), getProtocols: jest.fn(), getCurrentPeriod: jest.fn(), - getOriginationProof: jest.fn(), getConstants: jest.fn(), }; @@ -1445,9 +1443,6 @@ describe('RpcContractProvider test', () => { it('Should have correct returned values with origination being estimated', async () => { const estimate = new Estimate(1230000, 10000, 100, 100); mockEstimate.smartRollupOriginate.mockResolvedValue(estimate); - mockRpcClient.getOriginationProof.mockResolvedValue( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); const smartRollupOriginate = await rpcContractProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel: @@ -1470,8 +1465,6 @@ describe('RpcContractProvider test', () => { parameters_ty: { prim: 'bytes', }, - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', counter: '2', fee: '433', gas_limit: '1330', @@ -1490,9 +1483,6 @@ describe('RpcContractProvider test', () => { it('Should have correct returned values with origination with reveal with specified values for estimate', async () => { const estimate = new Estimate(1230000, 10000, 100, 100); mockEstimate.smartRollupOriginate.mockResolvedValue(estimate); - mockRpcClient.getOriginationProof.mockResolvedValue( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); const smartRollupOriginate = await rpcContractProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel: @@ -1518,8 +1508,6 @@ describe('RpcContractProvider test', () => { parameters_ty: { prim: 'bytes', }, - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', counter: '2', fee: '9999', gas_limit: '12345', @@ -1542,9 +1530,6 @@ describe('RpcContractProvider test', () => { mockEstimate.smartRollupOriginate.mockResolvedValue(estimate); mockReadProvider.isAccountRevealed.mockResolvedValue(true); - mockRpcClient.getOriginationProof.mockResolvedValue( - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9' - ); const smartRollupOriginate = await rpcContractProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, kernel: @@ -1566,8 +1551,6 @@ describe('RpcContractProvider test', () => { parameters_ty: { prim: 'bytes', }, - origination_proof: - '0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea180467070f4682a44b982768d522ec6380982f446488c0176ed7c13aa1d6c12a03a810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9', counter: '1', fee: '433', gas_limit: '1330', diff --git a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts index 821f0ddd46..e21090e8cf 100644 --- a/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts +++ b/packages/taquito/test/estimate/rpc-estimate-provider.spec.ts @@ -1125,7 +1125,6 @@ describe('RPCEstimateProvider test wallet', () => { getChainId: jest.Mock; getConstants: jest.Mock; getProtocols: jest.Mock; - getOriginationProof: jest.Mock; }; let mockForger: { @@ -1153,7 +1152,6 @@ describe('RPCEstimateProvider test wallet', () => { getChainId: jest.fn(), getConstants: jest.fn(), getProtocols: jest.fn(), - getOriginationProof: jest.fn(), }; mockForger = { @@ -1506,7 +1504,6 @@ describe('RPCEstimateProvider test wallet', () => { smart_rollup_origination_size: new BigNumber(6314), }); mockRpcClient.simulateOperation.mockResolvedValue(smartRollupOriginateWithReveal); - mockRpcClient.getOriginationProof.mockResolvedValue('987654321'); const estimate = await estimateProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, diff --git a/packages/taquito/test/prepare/prepare-provider.spec.ts b/packages/taquito/test/prepare/prepare-provider.spec.ts index d9f03aab4d..0c70aa00bd 100644 --- a/packages/taquito/test/prepare/prepare-provider.spec.ts +++ b/packages/taquito/test/prepare/prepare-provider.spec.ts @@ -33,7 +33,6 @@ describe('PrepareProvider test', () => { getCurrentPeriod: jest.Mock; getConstants: jest.Mock; getManagerKey: jest.Mock; - getOriginationProof: jest.Mock; forgeOperations: jest.Mock; }; @@ -67,7 +66,6 @@ describe('PrepareProvider test', () => { getCurrentPeriod: jest.fn(), getConstants: jest.fn(), getManagerKey: jest.fn(), - getOriginationProof: jest.fn(), forgeOperations: jest.fn(), }; @@ -1039,7 +1037,6 @@ describe('PrepareProvider test', () => { describe('SmartRollupOriginate', () => { it('Should prepare smartRollupOriginate without reveal', async () => { mockReadProvider.isAccountRevealed.mockResolvedValue(true); - mockRpcClient.getOriginationProof.mockResolvedValue('987654321'); const prepared = await prepareProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, @@ -1056,7 +1053,6 @@ describe('PrepareProvider test', () => { kind: 'smart_rollup_originate', pvm_kind: 'wasm_2_0_0', kernel: '123456789', - origination_proof: '987654321', parameters_ty: { prim: 'bytes', }, @@ -1075,7 +1071,6 @@ describe('PrepareProvider test', () => { it('Should prepare smartRollupOriginate with reveal', async () => { mockReadProvider.isAccountRevealed.mockResolvedValue(false); - mockRpcClient.getOriginationProof.mockResolvedValue('987654321'); const prepared = await prepareProvider.smartRollupOriginate({ pvmKind: PvmKind.WASM2, @@ -1101,7 +1096,6 @@ describe('PrepareProvider test', () => { kind: 'smart_rollup_originate', pvm_kind: 'wasm_2_0_0', kernel: '123456789', - origination_proof: '987654321', parameters_ty: { prim: 'bytes', }, From 2ebbb06fb2bab45d4c8aa17fd50a49d65cc1248c Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Wed, 20 Dec 2023 10:57:54 -0800 Subject: [PATCH 02/11] trigger checks --- .../taquito-local-forging/test/taquito-local-forging.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts index 99057ffa22..5581c2322e 100644 --- a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts +++ b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts @@ -41,6 +41,7 @@ describe('Forge and parse operations default protocol', () => { }, ], }; + expect(() => { localForger.forge(operation); }).toThrow(InvalidOperationKindError); @@ -329,6 +330,7 @@ describe('Forge and parse operations default protocol', () => { ); }); + // it('forged bytes smart_rollup_execute_outbox_message should match', async () => { const forged = await localForger.forge({ branch: 'BLxGBu48ybnWvZoaVLyXV4XVnhdeDc9V2NcB9wsegQniza6mxvX', From 9132f7ce8fc0bdf778d727d234769b8ea7ededa7 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Wed, 20 Dec 2023 11:16:35 -0800 Subject: [PATCH 03/11] trigger checks --- .../taquito-local-forging/test/taquito-local-forging.spec.ts | 1 - packages/taquito/src/operations/types.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts index 5581c2322e..6e6b816798 100644 --- a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts +++ b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts @@ -330,7 +330,6 @@ describe('Forge and parse operations default protocol', () => { ); }); - // it('forged bytes smart_rollup_execute_outbox_message should match', async () => { const forged = await localForger.forge({ branch: 'BLxGBu48ybnWvZoaVLyXV4XVnhdeDc9V2NcB9wsegQniza6mxvX', diff --git a/packages/taquito/src/operations/types.ts b/packages/taquito/src/operations/types.ts index f6b78fd038..9aa4ca8f9e 100644 --- a/packages/taquito/src/operations/types.ts +++ b/packages/taquito/src/operations/types.ts @@ -469,6 +469,7 @@ export interface SmartRollupAddMessagesParams { storageLimit?: number; message: string[]; } + export interface SmartRollupOriginateParams { source?: string; fee?: number; From c511cbae7687c80d50151b081f9459f6cb01b3d1 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Wed, 20 Dec 2023 12:22:44 -0800 Subject: [PATCH 04/11] test commit --- packages/taquito-local-forging/src/taquito-local-forging.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taquito-local-forging/src/taquito-local-forging.ts b/packages/taquito-local-forging/src/taquito-local-forging.ts index d59cc71bbd..2a4642e283 100644 --- a/packages/taquito-local-forging/src/taquito-local-forging.ts +++ b/packages/taquito-local-forging/src/taquito-local-forging.ts @@ -33,7 +33,7 @@ export function getCodec(codec: CODEC, _proto: ProtocolsHash) { }, }; } - +// export class LocalForger implements Forger { constructor(public readonly protocolHash = PROTOCOL_CURRENT) {} From 65da50572e4c9a0548cf2fd82959276d74134182 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Thu, 21 Dec 2023 11:34:42 -0800 Subject: [PATCH 05/11] adjusted more tests --- .../contract-estimation-tests.spec.ts | 88 +++++++++---------- integration-tests/data/metadataViews.ts | 62 +++---------- 2 files changed, 56 insertions(+), 94 deletions(-) diff --git a/integration-tests/contract-estimation-tests.spec.ts b/integration-tests/contract-estimation-tests.spec.ts index 125bd0513d..f2652cd7f4 100644 --- a/integration-tests/contract-estimation-tests.spec.ts +++ b/integration-tests/contract-estimation-tests.spec.ts @@ -40,11 +40,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 }); expect(estimate.gasLimit).toEqual(201); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(374); + expect(estimate.suggestedFeeMutez).toEqual(372); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(274); - expect(estimate.totalCost).toEqual(274); - expect(estimate.usingBaseFeeMutez).toEqual(274); + expect(estimate.minimalFeeMutez).toEqual(272); + expect(estimate.totalCost).toEqual(272); + expect(estimate.usingBaseFeeMutez).toEqual(272); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -52,11 +52,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 }); expect(estimate.gasLimit).toEqual(201); expect(estimate.storageLimit).toEqual(257); - expect(estimate.suggestedFeeMutez).toEqual(374); + expect(estimate.suggestedFeeMutez).toEqual(372); expect(estimate.burnFeeMutez).toEqual(64250); - expect(estimate.minimalFeeMutez).toEqual(274); - expect(estimate.totalCost).toEqual(64524); - expect(estimate.usingBaseFeeMutez).toEqual(274); + expect(estimate.minimalFeeMutez).toEqual(272); + expect(estimate.totalCost).toEqual(64522); + expect(estimate.usingBaseFeeMutez).toEqual(272); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -68,12 +68,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(677); expect(estimate.storageLimit).toEqual(571); - expect(estimate.suggestedFeeMutez).toEqual(713); + expect(estimate.suggestedFeeMutez).toEqual(711); expect(estimate.burnFeeMutez).toEqual(142750); - expect(estimate.minimalFeeMutez).toEqual(613); - expect(estimate.totalCost).toEqual(143363); - expect(estimate.usingBaseFeeMutez).toEqual(613); - expect(estimate.consumedMilligas).toEqual(576347); + expect(estimate.minimalFeeMutez).toEqual(611); + expect(estimate.totalCost).toEqual(143361); + expect(estimate.usingBaseFeeMutez).toEqual(611); + expect(estimate.consumedMilligas).toEqual(576402); }); it('Verify .estimate.setDelegate result', async () => { @@ -83,11 +83,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(200); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(369); + expect(estimate.suggestedFeeMutez).toEqual(367); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(269); - expect(estimate.totalCost).toEqual(269); - expect(estimate.usingBaseFeeMutez).toEqual(269); + expect(estimate.minimalFeeMutez).toEqual(267); + expect(estimate.totalCost).toEqual(267); + expect(estimate.usingBaseFeeMutez).toEqual(267); expect(estimate.consumedMilligas).toEqual(100000); }); @@ -96,12 +96,12 @@ 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(572); + expect(estimate.suggestedFeeMutez).toEqual(570); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(472); - expect(estimate.totalCost).toEqual(472); - expect(estimate.usingBaseFeeMutez).toEqual(472); - expect(estimate.consumedMilligas).toEqual(1356735); + expect(estimate.minimalFeeMutez).toEqual(470); + expect(estimate.totalCost).toEqual(470); + expect(estimate.usingBaseFeeMutez).toEqual(470); + expect(estimate.consumedMilligas).toEqual(1356142); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -111,40 +111,40 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { 50) ).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(1572); + expect(estimate.gasLimit).toEqual(1571); expect(estimate.storageLimit).toEqual(514); - expect(estimate.suggestedFeeMutez).toEqual(643); + expect(estimate.suggestedFeeMutez).toEqual(641); expect(estimate.burnFeeMutez).toEqual(128500); - expect(estimate.minimalFeeMutez).toEqual(543); - expect(estimate.totalCost).toEqual(129043); - expect(estimate.usingBaseFeeMutez).toEqual(543); - expect(estimate.consumedMilligas).toEqual(1471270); + expect(estimate.minimalFeeMutez).toEqual(541); + expect(estimate.totalCost).toEqual(129041); + expect(estimate.usingBaseFeeMutez).toEqual(541); + expect(estimate.consumedMilligas).toEqual(1470671); }); it('Verify .estimate.transfer for internal origination', async () => { const tx = contract.methods.do(originate()).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(1868); + expect(estimate.gasLimit).toEqual(1867); expect(estimate.storageLimit).toEqual(317); - expect(estimate.suggestedFeeMutez).toEqual(619); + expect(estimate.suggestedFeeMutez).toEqual(617); expect(estimate.burnFeeMutez).toEqual(79250); - expect(estimate.minimalFeeMutez).toEqual(519); - expect(estimate.totalCost).toEqual(79769); - expect(estimate.usingBaseFeeMutez).toEqual(519); - expect(estimate.consumedMilligas).toEqual(1767848); + expect(estimate.minimalFeeMutez).toEqual(517); + expect(estimate.totalCost).toEqual(79767); + expect(estimate.usingBaseFeeMutez).toEqual(517); + expect(estimate.consumedMilligas).toEqual(1766766); }); it('Verify .estimate.transfer for multiple internal originations', async () => { const tx = contract.methods.do(originate2()).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(2394); + expect(estimate.gasLimit).toEqual(2392); expect(estimate.storageLimit).toEqual(634); - expect(estimate.suggestedFeeMutez).toEqual(737); + expect(estimate.suggestedFeeMutez).toEqual(735); expect(estimate.burnFeeMutez).toEqual(158500); - expect(estimate.minimalFeeMutez).toEqual(637); - expect(estimate.totalCost).toEqual(159137); - expect(estimate.usingBaseFeeMutez).toEqual(637); - expect(estimate.consumedMilligas).toEqual(2293496); + expect(estimate.minimalFeeMutez).toEqual(635); + expect(estimate.totalCost).toEqual(159135); + expect(estimate.usingBaseFeeMutez).toEqual(635); + expect(estimate.consumedMilligas).toEqual(2291919); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); @@ -174,11 +174,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) }); expect(estimate.gasLimit).toEqual(201); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(372); + expect(estimate.suggestedFeeMutez).toEqual(370); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(272); - expect(estimate.totalCost).toEqual(272); - expect(estimate.usingBaseFeeMutez).toEqual(272); + expect(estimate.minimalFeeMutez).toEqual(270); + expect(estimate.totalCost).toEqual(270); + expect(estimate.usingBaseFeeMutez).toEqual(270); expect(estimate.consumedMilligas).toEqual(100040); }); diff --git a/integration-tests/data/metadataViews.ts b/integration-tests/data/metadataViews.ts index c8a9c23e0c..b9a2e9ad77 100644 --- a/integration-tests/data/metadataViews.ts +++ b/integration-tests/data/metadataViews.ts @@ -42,8 +42,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -66,12 +65,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -83,8 +77,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -108,12 +101,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -150,12 +138,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -167,8 +150,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -192,12 +174,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -209,8 +186,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -234,12 +210,7 @@ export const metadataViewsExample1 = { annots: [] } ], - annotations: [ - { - name: '%returnedBytes', - description: 'A bytes constant.' - } - ] + annotations: [] } } ] @@ -276,7 +247,7 @@ export const metadataViewsExample2 = { { michelsonStorageView: { parameter: { prim: 'int', args: [], annots: [ '%the_decisive_argument' ] }, - returnType: { prim: 'int', args: [], annots: [ '%negative_even_number' ] }, + returnType: { prim: 'int', args: [] }, code: [ { prim: 'CAR', args: [], annots: [] }, { prim: 'DUP', args: [], annots: [] }, @@ -303,10 +274,6 @@ export const metadataViewsExample2 = { { name: '%the_decisive_argument', description: 'The integer argument if >0 this will fail.' - }, - { - name: '%negative_even_number', - description: 'The result, if any, is twice the argument (%the_decisive_argument).' } ] } @@ -602,18 +569,13 @@ export const metadataViewsExample2 = { implementations: [ { michelsonStorageView: { - returnType: { prim: 'address', args: [], annots: [ '%ret' ] }, + returnType: { prim: 'address', args: [] }, code: [ { prim: 'DROP', args: [], annots: [] }, { prim: 'SELF', args: [], annots: [] }, { prim: 'ADDRESS', args: [], annots: [] } ], - annotations: [ - { - name: '%ret', - description: 'The address of the (any) contract, re-obtained in Michelson.' - } - ] + annotations: [] } } ] From fa171e133689eca243378939dd2fa4f0dca2789a Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Thu, 21 Dec 2023 13:11:44 -0800 Subject: [PATCH 06/11] removed remaining origination proof artifacts --- integration-tests/data/metadataViews.ts | 5 ++--- .../taquito-local-forging/test/taquito-local-forging.spec.ts | 1 - packages/taquito-rpc/src/types.ts | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/integration-tests/data/metadataViews.ts b/integration-tests/data/metadataViews.ts index b9a2e9ad77..6f084448a8 100644 --- a/integration-tests/data/metadataViews.ts +++ b/integration-tests/data/metadataViews.ts @@ -113,8 +113,7 @@ export const metadataViewsExample1 = { michelsonStorageView: { returnType: { prim: 'bytes', - args: [], - annots: [ '%returnedBytes' ] + args: [] }, code: [ { @@ -289,7 +288,7 @@ export const metadataViewsExample2 = { { michelsonStorageView: { parameter: { prim: 'nat', args: [], annots: [] }, - returnType: { prim: 'nat', args: [], annots: [] }, + returnType: { prim: 'nat', args: [] }, code: [ { prim: 'DUP', args: [], annots: [] }, { prim: 'CDR', args: [], annots: [] }, diff --git a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts index 6e6b816798..99057ffa22 100644 --- a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts +++ b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts @@ -41,7 +41,6 @@ describe('Forge and parse operations default protocol', () => { }, ], }; - expect(() => { localForger.forge(operation); }).toThrow(InvalidOperationKindError); diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index 07314b09fd..6d6c9f8a56 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -860,7 +860,6 @@ export interface OperationContentsAndResultSmartRollupOriginate { storage_limit: string; pvm_kind: PvmKind; kernel: string; - origination_proof: string; parameters_ty: MichelsonV1Expression; metadata: OperationContentsAndResultMetadataSmartRollupOriginate; } @@ -909,7 +908,6 @@ export interface OperationContentsAndResultSmartRollupCement { gas_limit: string; storage_limit: string; rollup: string; - commitment: string; metadata: OperationContentsAndResultMetadataSmartRollupCement; } From d25afb81f1c588d57385e61e0a60c2164f4bd159 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Fri, 22 Dec 2023 13:52:59 -0800 Subject: [PATCH 07/11] updated smart rollup docs --- docs/smart_rollups.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/smart_rollups.md b/docs/smart_rollups.md index 9b24f68e1e..368fe8850b 100644 --- a/docs/smart_rollups.md +++ b/docs/smart_rollups.md @@ -27,10 +27,10 @@ await op.confirmation(); ##### please note - `pvmKind` at this time the only PVM supported is `wasm_2_0_0` -- `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) +- `kernel` is passed as a hexadecimal string examples can be found at [this tezos docs endpoint](https://tezos.gitlab.io/active/smart_rollups.html) - `parametersType` is a MichelsonV1Expression to define the type. -For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/mumbai/smart_rollups.html?highlight=smart%20rollup%20originate#id1) +For more information in regards to Smart Rollup Origination please refer to the this [link](https://tezos.gitlab.io/active/smart_rollups.html#origination) ## `smart_rollup_add_messages` @@ -50,7 +50,7 @@ If you read closely, the message includes a `destination`, a `parameter`, and an These messages can then be claimed back into L1 as a legitimate contract call using the `smart_rollup_execute_outbox_message` operation which we will go over in another section of this doc. -for more information, refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html#sending-an-external-inbox-message) +for more information, refer to [this document](https://tezos.gitlab.io/active/smart_rollups.html#external-messages) ### Example ```typescript @@ -63,4 +63,4 @@ const op = await Tezos.contract.smartRollupAddMessages({ await op.confirmation(); ``` -- `message` property receives an array of encoded outbox messages. For more information on how to encode or what message gets encoded, refer to [this document](https://tezos.gitlab.io/mumbai/smart_rollups.html#sending-an-external-inbox-message) +- `message` property receives an array of encoded outbox messages. For more information on how to encode or what message gets encoded \ No newline at end of file From 0766c54a43cec3bd1f927a0365c7a587a215829e Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Fri, 22 Dec 2023 17:20:09 -0800 Subject: [PATCH 08/11] adjusted estimates --- .../contract-estimation-tests.spec.ts | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/integration-tests/contract-estimation-tests.spec.ts b/integration-tests/contract-estimation-tests.spec.ts index f2652cd7f4..9ed7607147 100644 --- a/integration-tests/contract-estimation-tests.spec.ts +++ b/integration-tests/contract-estimation-tests.spec.ts @@ -40,11 +40,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 }); expect(estimate.gasLimit).toEqual(201); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(372); + expect(estimate.suggestedFeeMutez).toEqual(374); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(272); - expect(estimate.totalCost).toEqual(272); - expect(estimate.usingBaseFeeMutez).toEqual(272); + expect(estimate.minimalFeeMutez).toEqual(274); + expect(estimate.totalCost).toEqual(274); + expect(estimate.usingBaseFeeMutez).toEqual(274); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -52,11 +52,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 }); expect(estimate.gasLimit).toEqual(201); expect(estimate.storageLimit).toEqual(257); - expect(estimate.suggestedFeeMutez).toEqual(372); + expect(estimate.suggestedFeeMutez).toEqual(374); expect(estimate.burnFeeMutez).toEqual(64250); - expect(estimate.minimalFeeMutez).toEqual(272); - expect(estimate.totalCost).toEqual(64522); - expect(estimate.usingBaseFeeMutez).toEqual(272); + expect(estimate.minimalFeeMutez).toEqual(274); + expect(estimate.totalCost).toEqual(64524); + expect(estimate.usingBaseFeeMutez).toEqual(274); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -68,11 +68,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(677); expect(estimate.storageLimit).toEqual(571); - expect(estimate.suggestedFeeMutez).toEqual(711); + expect(estimate.suggestedFeeMutez).toEqual(713); expect(estimate.burnFeeMutez).toEqual(142750); - expect(estimate.minimalFeeMutez).toEqual(611); - expect(estimate.totalCost).toEqual(143361); - expect(estimate.usingBaseFeeMutez).toEqual(611); + expect(estimate.minimalFeeMutez).toEqual(613); + expect(estimate.totalCost).toEqual(143363); + expect(estimate.usingBaseFeeMutez).toEqual(613); expect(estimate.consumedMilligas).toEqual(576402); }); @@ -83,11 +83,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(200); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(367); + expect(estimate.suggestedFeeMutez).toEqual(369); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(267); - expect(estimate.totalCost).toEqual(267); - expect(estimate.usingBaseFeeMutez).toEqual(267); + expect(estimate.minimalFeeMutez).toEqual(269); + expect(estimate.totalCost).toEqual(269); + expect(estimate.usingBaseFeeMutez).toEqual(269); expect(estimate.consumedMilligas).toEqual(100000); }); @@ -96,11 +96,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(570); + expect(estimate.suggestedFeeMutez).toEqual(572); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(470); - expect(estimate.totalCost).toEqual(470); - expect(estimate.usingBaseFeeMutez).toEqual(470); + expect(estimate.minimalFeeMutez).toEqual(472); + expect(estimate.totalCost).toEqual(472); + expect(estimate.usingBaseFeeMutez).toEqual(472); expect(estimate.consumedMilligas).toEqual(1356142); }); @@ -113,11 +113,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1571); expect(estimate.storageLimit).toEqual(514); - expect(estimate.suggestedFeeMutez).toEqual(641); + expect(estimate.suggestedFeeMutez).toEqual(643); expect(estimate.burnFeeMutez).toEqual(128500); - expect(estimate.minimalFeeMutez).toEqual(541); - expect(estimate.totalCost).toEqual(129041); - expect(estimate.usingBaseFeeMutez).toEqual(541); + expect(estimate.minimalFeeMutez).toEqual(543); + expect(estimate.totalCost).toEqual(129043); + expect(estimate.usingBaseFeeMutez).toEqual(543); expect(estimate.consumedMilligas).toEqual(1470671); }); @@ -126,11 +126,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1867); expect(estimate.storageLimit).toEqual(317); - expect(estimate.suggestedFeeMutez).toEqual(617); + expect(estimate.suggestedFeeMutez).toEqual(619); expect(estimate.burnFeeMutez).toEqual(79250); - expect(estimate.minimalFeeMutez).toEqual(517); - expect(estimate.totalCost).toEqual(79767); - expect(estimate.usingBaseFeeMutez).toEqual(517); + expect(estimate.minimalFeeMutez).toEqual(519); + expect(estimate.totalCost).toEqual(79769); + expect(estimate.usingBaseFeeMutez).toEqual(519); expect(estimate.consumedMilligas).toEqual(1766766); }); @@ -139,11 +139,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(2392); expect(estimate.storageLimit).toEqual(634); - expect(estimate.suggestedFeeMutez).toEqual(735); + expect(estimate.suggestedFeeMutez).toEqual(737); expect(estimate.burnFeeMutez).toEqual(158500); - expect(estimate.minimalFeeMutez).toEqual(635); - expect(estimate.totalCost).toEqual(159135); - expect(estimate.usingBaseFeeMutez).toEqual(635); + expect(estimate.minimalFeeMutez).toEqual(637); + expect(estimate.totalCost).toEqual(159137); + expect(estimate.usingBaseFeeMutez).toEqual(637); expect(estimate.consumedMilligas).toEqual(2291919); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); @@ -174,11 +174,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) }); expect(estimate.gasLimit).toEqual(201); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(370); + expect(estimate.suggestedFeeMutez).toEqual(372); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(270); - expect(estimate.totalCost).toEqual(270); - expect(estimate.usingBaseFeeMutez).toEqual(270); + expect(estimate.minimalFeeMutez).toEqual(272); + expect(estimate.totalCost).toEqual(272); + expect(estimate.usingBaseFeeMutez).toEqual(272); expect(estimate.consumedMilligas).toEqual(100040); }); From d8c1942651f52d9452b7dfcb1652b20905bfc219 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 29 Dec 2023 23:40:30 -0800 Subject: [PATCH 09/11] feat: supported smartRollupOriginate with new pvmKind and property whitelist in localForger re #2776 --- cspell.json | 1 + packages/taquito-local-forging/src/codec.ts | 29 ++++++++++ .../taquito-local-forging/src/constants.ts | 1 + packages/taquito-local-forging/src/decoder.ts | 2 + packages/taquito-local-forging/src/encoder.ts | 2 + .../src/schema/operation.ts | 1 + .../src/taquito-local-forging.ts | 4 +- .../taquito-local-forging/test/codec.spec.ts | 55 ++++++++++++++++++- packages/taquito-rpc/src/types.ts | 5 +- 9 files changed, 96 insertions(+), 4 deletions(-) diff --git a/cspell.json b/cspell.json index 01fecb89b3..5d5b5bbd6e 100644 --- a/cspell.json +++ b/cspell.json @@ -77,6 +77,7 @@ "ProxfordY", "PtNairobi", "refetched", + "riscv", "rollups", "Roxane", "SAPLINGCONTRACT", diff --git a/packages/taquito-local-forging/src/codec.ts b/packages/taquito-local-forging/src/codec.ts index 48324ea585..f7ae4f495d 100644 --- a/packages/taquito-local-forging/src/codec.ts +++ b/packages/taquito-local-forging/src/codec.ts @@ -57,6 +57,18 @@ export const pkhDecoder = (val: Uint8ArrayConsumer) => { } }; +export const pkhsDecoder = (val: Uint8ArrayConsumer) => { + if (!boolDecoder(val)) { + return undefined; + } + const pkhs = []; + val.consume(4); + while (val.length() > 0) { + pkhs.push(pkhDecoder(val)); + } + return pkhs; +}; + export const branchEncoder = prefixEncoder(Prefix.B); export const tz1Encoder = prefixEncoder(Prefix.TZ1); @@ -116,6 +128,8 @@ export const pvmKindEncoder = (pvm: string): string => { return '00'; case 'wasm_2_0_0': return '01'; + case 'riscv': + return '02'; default: throw new UnsupportedPvmKindError(pvm); } @@ -128,6 +142,8 @@ export const pvmKindDecoder = (pvm: Uint8ArrayConsumer): string => { return 'arith'; case 0x01: return 'wasm_2_0_0'; + case 0x02: + return 'riscv'; default: throw new DecodePvmKindError(value[0].toString()); } @@ -213,6 +229,19 @@ export const pkhEncoder = (val: string) => { } }; +export const pkhsEncoder = (val?: string[]) => { + if (!val) { + return boolEncoder(false); + } + if (val.length === 0) { + return boolEncoder(true) + pad(0); + } + const pkhs = val.reduce((prev, curr) => { + return prev + pkhEncoder(curr); + }, ''); + return boolEncoder(true) + pad(pkhs.length / 2) + pkhs; +}; + export const publicKeyEncoder = (val: string) => { const pubkeyPrefix = val.substring(0, 4); switch (pubkeyPrefix) { diff --git a/packages/taquito-local-forging/src/constants.ts b/packages/taquito-local-forging/src/constants.ts index 4c1a5f81d5..8def4779ee 100644 --- a/packages/taquito-local-forging/src/constants.ts +++ b/packages/taquito-local-forging/src/constants.ts @@ -16,6 +16,7 @@ export enum CODEC { ZARITH = 'zarith', PUBLIC_KEY = 'public_key', PKH = 'pkh', + PKH_ARR = 'pkhArr', DELEGATE = 'delegate', SCRIPT = 'script', BALLOT_STATEMENT = 'ballotStmt', diff --git a/packages/taquito-local-forging/src/decoder.ts b/packages/taquito-local-forging/src/decoder.ts index 1e68113b80..8b7347c646 100644 --- a/packages/taquito-local-forging/src/decoder.ts +++ b/packages/taquito-local-forging/src/decoder.ts @@ -11,6 +11,7 @@ import { paddedBytesDecoder, parametersDecoder, pkhDecoder, + pkhsDecoder, smartRollupMessageDecoder, proposalDecoder, proposalsDecoder, @@ -63,6 +64,7 @@ export const decoders: { [key: string]: Decoder } = { [CODEC.ZARITH]: zarithDecoder, [CODEC.PUBLIC_KEY]: publicKeyDecoder, [CODEC.PKH]: pkhDecoder, + [CODEC.PKH_ARR]: pkhsDecoder, [CODEC.DELEGATE]: delegateDecoder, [CODEC.INT32]: int32Decoder, [CODEC.SCRIPT]: scriptDecoder, diff --git a/packages/taquito-local-forging/src/encoder.ts b/packages/taquito-local-forging/src/encoder.ts index bd68c587dc..b2458ace9b 100644 --- a/packages/taquito-local-forging/src/encoder.ts +++ b/packages/taquito-local-forging/src/encoder.ts @@ -11,6 +11,7 @@ import { paddedBytesEncoder, parametersEncoder, pkhEncoder, + pkhsEncoder, smartRollupMessageEncoder, proposalEncoder, proposalsEncoder, @@ -61,6 +62,7 @@ export const encoders: { [key: string]: Encoder } = { [CODEC.ZARITH]: zarithEncoder, [CODEC.PUBLIC_KEY]: publicKeyEncoder, [CODEC.PKH]: pkhEncoder, + [CODEC.PKH_ARR]: pkhsEncoder, [CODEC.DELEGATE]: delegateEncoder, [CODEC.SCRIPT]: scriptEncoder, [CODEC.BALLOT_STATEMENT]: ballotEncoder, diff --git a/packages/taquito-local-forging/src/schema/operation.ts b/packages/taquito-local-forging/src/schema/operation.ts index 6afa832920..73be533c74 100644 --- a/packages/taquito-local-forging/src/schema/operation.ts +++ b/packages/taquito-local-forging/src/schema/operation.ts @@ -149,6 +149,7 @@ export const SmartRollupOriginateSchema = { pvm_kind: CODEC.PVM_KIND, kernel: CODEC.PADDED_BYTES, parameters_ty: CODEC.VALUE, + whitelist: CODEC.PKH_ARR, }; export const SmartRollupAddMessagesSchema = { diff --git a/packages/taquito-local-forging/src/taquito-local-forging.ts b/packages/taquito-local-forging/src/taquito-local-forging.ts index 2a4642e283..b819c7515c 100644 --- a/packages/taquito-local-forging/src/taquito-local-forging.ts +++ b/packages/taquito-local-forging/src/taquito-local-forging.ts @@ -22,7 +22,7 @@ export * from './interface'; export { VERSION } from './version'; export { ProtocolsHash } from './protocols'; -const PROTOCOL_CURRENT = ProtocolsHash.PtMumbai2; +const PROTOCOL_CURRENT = ProtocolsHash.ProxfordY; export function getCodec(codec: CODEC, _proto: ProtocolsHash) { return { @@ -60,6 +60,8 @@ export class LocalForger implements Forger { continue; } else if (content.kind === 'set_deposits_limit' && diff[0] === 'limit') { continue; + } else if (content.kind === 'smart_rollup_originate' && diff[0] === 'whitelist') { + continue; } else { throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`); } diff --git a/packages/taquito-local-forging/test/codec.spec.ts b/packages/taquito-local-forging/test/codec.spec.ts index 8694565d57..c065dfd57d 100644 --- a/packages/taquito-local-forging/test/codec.spec.ts +++ b/packages/taquito-local-forging/test/codec.spec.ts @@ -9,7 +9,13 @@ import { paddedBytesDecoder, } from '../src/codec'; import { Uint8ArrayConsumer } from '../src/uint8array-consumer'; -import { pkhEncoder, publicKeyDecoder, publicKeyEncoder } from '../src/codec'; +import { + pkhEncoder, + pkhsEncoder, + pkhsDecoder, + publicKeyDecoder, + publicKeyEncoder, +} from '../src/codec'; import { DecodeBallotValueError, DecodePvmKindError, @@ -76,6 +82,49 @@ describe('Tests for Entrypoint functions and for encode and decoder error messag } }); + test(`Verify pkhsEncoder`, async () => { + const none = pkhsEncoder(); + expect(none).toEqual('00'); + const empty = pkhsEncoder([]); + expect(empty).toEqual('ff00000000'); + const tz = pkhsEncoder([ + 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', + 'tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD', + 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + 'tz4HQ8VeXAyrZMhES1qLMJAc9uAVXjbMpS8u', + ]); + expect(tz).toEqual( + 'ff0000005400c9fc72e8491bd2973e196f04ec6918ad5bcee22d012ffebbf1560632ca767bc960ccdb84669d284c2c026fde46af0356a0476dae4e4600172dc9309b3aa4035c14a7a05c10fc8b402fbcdd48dc8136236bf3c1' + ); + + expect(() => pkhsEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'])).toThrow( + InvalidKeyHashError + ); + try { + pkhsEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5']); + } catch (e) { + expect(e.message).toContain(`Invalid public key hash "tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5"`); + } + }); + + test(`Verify pkhsDecoder`, async () => { + const none = pkhsDecoder(Uint8ArrayConsumer.fromHexString('00')); + expect(none).toEqual(undefined); + const empty = pkhsDecoder(Uint8ArrayConsumer.fromHexString('ff00000000')); + expect(empty).toEqual([]); + const tz = pkhsDecoder( + Uint8ArrayConsumer.fromHexString( + 'ff0000005400c9fc72e8491bd2973e196f04ec6918ad5bcee22d012ffebbf1560632ca767bc960ccdb84669d284c2c026fde46af0356a0476dae4e4600172dc9309b3aa4' + ) + ); + expect(tz).toEqual([ + 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', + 'tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD', + 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', + ]); + // + }); + test(`Verify publicKeyEncoder`, async () => { const edpk = publicKeyEncoder('edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'); expect(edpk).toEqual('005c8244b8de7d57795962c1bfc855d0813f8c61eddf3795f804ccdea3e4c82ae9'); @@ -240,13 +289,15 @@ describe('Tests for Entrypoint functions and for encode and decoder error messag test('Verify that pvmKindEncoder functions correctly and returns UnsupportedPvmKindError on unknown case', () => { expect(pvmKindEncoder('arith')).toEqual('00'); expect(pvmKindEncoder('wasm_2_0_0')).toEqual('01'); + expect(pvmKindEncoder('riscv')).toEqual('02'); expect(() => pvmKindEncoder('foobar')).toThrowError(UnsupportedPvmKindError); }); test('Verify that pvmKindDecoder functions correctly and returns DecodePvmKindError on unknown case', () => { expect(pvmKindDecoder(Uint8ArrayConsumer.fromHexString('00'))).toEqual('arith'); expect(pvmKindDecoder(Uint8ArrayConsumer.fromHexString('01'))).toEqual('wasm_2_0_0'); - expect(() => pvmKindDecoder(Uint8ArrayConsumer.fromHexString('02'))).toThrowError( + expect(pvmKindDecoder(Uint8ArrayConsumer.fromHexString('02'))).toEqual('riscv'); + expect(() => pvmKindDecoder(Uint8ArrayConsumer.fromHexString('03'))).toThrowError( DecodePvmKindError ); }); diff --git a/packages/taquito-rpc/src/types.ts b/packages/taquito-rpc/src/types.ts index c8df5bf3a0..6f1196b9fd 100644 --- a/packages/taquito-rpc/src/types.ts +++ b/packages/taquito-rpc/src/types.ts @@ -334,6 +334,7 @@ export interface OperationContentsSmartRollupOriginate { pvm_kind: PvmKind; kernel: string; parameters_ty: MichelsonV1Expression; + whitelist?: string[]; } export interface OperationContentsSmartRollupAddMessages { @@ -761,6 +762,7 @@ export interface OperationContentsAndResultSmartRollupOriginate { pvm_kind: PvmKind; kernel: string; parameters_ty: MichelsonV1Expression; + whitelist?: string[]; metadata: OperationContentsAndResultMetadataSmartRollupOriginate; } @@ -1207,7 +1209,7 @@ export interface OperationResultSmartRollupOriginate { address?: string; genesis_commitment_hash?: string; consumed_milligas?: string; - size: string; + size?: string; errors?: TezosGenericOperationError[]; } @@ -2080,6 +2082,7 @@ export interface PendingOperationsV2 { export enum PvmKind { WASM2 = 'wasm_2_0_0', ARITH = 'arith', + RISCV = 'riscv', } export interface SmartRollupPublishCommitment { From 40b1ec7db252f3c4ecb84d13c120933a81d0aff9 Mon Sep 17 00:00:00 2001 From: huianyang Date: Wed, 3 Jan 2024 13:28:45 -0800 Subject: [PATCH 10/11] refactor: addressed comments of naming for clarity --- packages/taquito-local-forging/src/codec.ts | 28 ++++++------- packages/taquito-local-forging/src/decoder.ts | 8 ++-- packages/taquito-local-forging/src/encoder.ts | 8 ++-- .../taquito-local-forging/test/codec.spec.ts | 42 ++++++++++--------- 4 files changed, 44 insertions(+), 42 deletions(-) diff --git a/packages/taquito-local-forging/src/codec.ts b/packages/taquito-local-forging/src/codec.ts index f7ae4f495d..7fba0d570b 100644 --- a/packages/taquito-local-forging/src/codec.ts +++ b/packages/taquito-local-forging/src/codec.ts @@ -45,7 +45,7 @@ export const prefixDecoder = (pre: Prefix) => (str: Uint8ArrayConsumer) => { export const tz1Decoder = prefixDecoder(Prefix.TZ1); export const branchDecoder = prefixDecoder(Prefix.B); -export const pkhDecoder = (val: Uint8ArrayConsumer) => { +export const publicKeyHashDecoder = (val: Uint8ArrayConsumer) => { const prefix = val.consume(1); if (prefix[0] === 0x00) { @@ -57,16 +57,16 @@ export const pkhDecoder = (val: Uint8ArrayConsumer) => { } }; -export const pkhsDecoder = (val: Uint8ArrayConsumer) => { +export const publicKeyHashesDecoder = (val: Uint8ArrayConsumer) => { if (!boolDecoder(val)) { return undefined; } - const pkhs = []; + const publicKeyHashes = []; val.consume(4); while (val.length() > 0) { - pkhs.push(pkhDecoder(val)); + publicKeyHashes.push(publicKeyHashDecoder(val)); } - return pkhs; + return publicKeyHashes; }; export const branchEncoder = prefixEncoder(Prefix.B); @@ -151,7 +151,7 @@ export const pvmKindDecoder = (pvm: Uint8ArrayConsumer): string => { export const delegateEncoder = (val: string) => { if (val) { - return boolEncoder(true) + pkhEncoder(val); + return boolEncoder(true) + publicKeyHashEncoder(val); } else { return boolEncoder(false); } @@ -205,11 +205,11 @@ export const boolDecoder = (val: Uint8ArrayConsumer): boolean => { export const delegateDecoder = (val: Uint8ArrayConsumer) => { const hasDelegate = boolDecoder(val); if (hasDelegate) { - return pkhDecoder(val); + return publicKeyHashDecoder(val); } }; -export const pkhEncoder = (val: string) => { +export const publicKeyHashEncoder = (val: string) => { const pubkeyPrefix = val.substring(0, 3); switch (pubkeyPrefix) { case Prefix.TZ1: @@ -229,17 +229,17 @@ export const pkhEncoder = (val: string) => { } }; -export const pkhsEncoder = (val?: string[]) => { +export const publicKeyHashesEncoder = (val?: string[]) => { if (!val) { return boolEncoder(false); } if (val.length === 0) { return boolEncoder(true) + pad(0); } - const pkhs = val.reduce((prev, curr) => { - return prev + pkhEncoder(curr); + const publicKeyHashes = val.reduce((prev, curr) => { + return prev + publicKeyHashEncoder(curr); }, ''); - return boolEncoder(true) + pad(pkhs.length / 2) + pkhs; + return boolEncoder(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes; }; export const publicKeyEncoder = (val: string) => { @@ -267,7 +267,7 @@ export const addressEncoder = (val: string): string => { case Prefix.TZ2: case Prefix.TZ3: case Prefix.TZ4: - return '00' + pkhEncoder(val); + return '00' + publicKeyHashEncoder(val); case Prefix.KT1: return '01' + prefixEncoder(Prefix.KT1)(val) + '00'; default: @@ -333,7 +333,7 @@ export const addressDecoder = (val: Uint8ArrayConsumer) => { const preamble = val.consume(1); switch (preamble[0]) { case 0x00: - return pkhDecoder(val); + return publicKeyHashDecoder(val); case 0x01: { const address = prefixDecoder(Prefix.KT1)(val); val.consume(1); diff --git a/packages/taquito-local-forging/src/decoder.ts b/packages/taquito-local-forging/src/decoder.ts index 8b7347c646..68b1c13788 100644 --- a/packages/taquito-local-forging/src/decoder.ts +++ b/packages/taquito-local-forging/src/decoder.ts @@ -10,8 +10,8 @@ import { int32Decoder, paddedBytesDecoder, parametersDecoder, - pkhDecoder, - pkhsDecoder, + publicKeyHashDecoder, + publicKeyHashesDecoder, smartRollupMessageDecoder, proposalDecoder, proposalsDecoder, @@ -63,8 +63,8 @@ export const decoders: { [key: string]: Decoder } = { [CODEC.BRANCH]: branchDecoder, [CODEC.ZARITH]: zarithDecoder, [CODEC.PUBLIC_KEY]: publicKeyDecoder, - [CODEC.PKH]: pkhDecoder, - [CODEC.PKH_ARR]: pkhsDecoder, + [CODEC.PKH]: publicKeyHashDecoder, + [CODEC.PKH_ARR]: publicKeyHashesDecoder, [CODEC.DELEGATE]: delegateDecoder, [CODEC.INT32]: int32Decoder, [CODEC.SCRIPT]: scriptDecoder, diff --git a/packages/taquito-local-forging/src/encoder.ts b/packages/taquito-local-forging/src/encoder.ts index b2458ace9b..028ffcb503 100644 --- a/packages/taquito-local-forging/src/encoder.ts +++ b/packages/taquito-local-forging/src/encoder.ts @@ -10,8 +10,8 @@ import { int32Encoder, paddedBytesEncoder, parametersEncoder, - pkhEncoder, - pkhsEncoder, + publicKeyHashEncoder, + publicKeyHashesEncoder, smartRollupMessageEncoder, proposalEncoder, proposalsEncoder, @@ -61,8 +61,8 @@ export const encoders: { [key: string]: Encoder } = { [CODEC.BRANCH]: branchEncoder, [CODEC.ZARITH]: zarithEncoder, [CODEC.PUBLIC_KEY]: publicKeyEncoder, - [CODEC.PKH]: pkhEncoder, - [CODEC.PKH_ARR]: pkhsEncoder, + [CODEC.PKH]: publicKeyHashEncoder, + [CODEC.PKH_ARR]: publicKeyHashesEncoder, [CODEC.DELEGATE]: delegateEncoder, [CODEC.SCRIPT]: scriptEncoder, [CODEC.BALLOT_STATEMENT]: ballotEncoder, diff --git a/packages/taquito-local-forging/test/codec.spec.ts b/packages/taquito-local-forging/test/codec.spec.ts index c065dfd57d..2721f7e2ab 100644 --- a/packages/taquito-local-forging/test/codec.spec.ts +++ b/packages/taquito-local-forging/test/codec.spec.ts @@ -10,9 +10,9 @@ import { } from '../src/codec'; import { Uint8ArrayConsumer } from '../src/uint8array-consumer'; import { - pkhEncoder, - pkhsEncoder, - pkhsDecoder, + publicKeyHashEncoder, + publicKeyHashesEncoder, + publicKeyHashesDecoder, publicKeyDecoder, publicKeyEncoder, } from '../src/codec'; @@ -65,29 +65,31 @@ describe('Tests for Entrypoint functions and for encode and decoder error messag ); }); - test(`Verify pkhEncoder`, async () => { - const tz1 = pkhEncoder('tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY'); + test(`Verify publicKeyHashEncoder`, async () => { + const tz1 = publicKeyHashEncoder('tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY'); expect(tz1).toEqual('00c9fc72e8491bd2973e196f04ec6918ad5bcee22d'); - const tz2 = pkhEncoder('tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD'); + const tz2 = publicKeyHashEncoder('tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD'); expect(tz2).toEqual('012ffebbf1560632ca767bc960ccdb84669d284c2c'); - const tz3 = pkhEncoder('tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); + const tz3 = publicKeyHashEncoder('tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); expect(tz3).toEqual('026fde46af0356a0476dae4e4600172dc9309b3aa4'); - const tz4 = pkhEncoder('tz4HQ8VeXAyrZMhES1qLMJAc9uAVXjbMpS8u'); + const tz4 = publicKeyHashEncoder('tz4HQ8VeXAyrZMhES1qLMJAc9uAVXjbMpS8u'); expect(tz4).toEqual('035c14a7a05c10fc8b402fbcdd48dc8136236bf3c1'); - expect(() => pkhEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5')).toThrow(InvalidKeyHashError); + expect(() => publicKeyHashEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5')).toThrow( + InvalidKeyHashError + ); try { - pkhEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); + publicKeyHashEncoder('tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'); } catch (e) { expect(e.message).toContain(`Invalid public key hash "tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5"`); } }); - test(`Verify pkhsEncoder`, async () => { - const none = pkhsEncoder(); + test(`Verify publicKeyHashesEncoder`, async () => { + const none = publicKeyHashesEncoder(); expect(none).toEqual('00'); - const empty = pkhsEncoder([]); + const empty = publicKeyHashesEncoder([]); expect(empty).toEqual('ff00000000'); - const tz = pkhsEncoder([ + const tz = publicKeyHashesEncoder([ 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', 'tz2Ch1abG7FNiibmV26Uzgdsnfni9XGrk5wD', 'tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5', @@ -97,22 +99,22 @@ describe('Tests for Entrypoint functions and for encode and decoder error messag 'ff0000005400c9fc72e8491bd2973e196f04ec6918ad5bcee22d012ffebbf1560632ca767bc960ccdb84669d284c2c026fde46af0356a0476dae4e4600172dc9309b3aa4035c14a7a05c10fc8b402fbcdd48dc8136236bf3c1' ); - expect(() => pkhsEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'])).toThrow( + expect(() => publicKeyHashesEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5'])).toThrow( InvalidKeyHashError ); try { - pkhsEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5']); + publicKeyHashesEncoder(['tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5']); } catch (e) { expect(e.message).toContain(`Invalid public key hash "tz5WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5"`); } }); - test(`Verify pkhsDecoder`, async () => { - const none = pkhsDecoder(Uint8ArrayConsumer.fromHexString('00')); + test(`Verify publicKeyHashesDecoder`, async () => { + const none = publicKeyHashesDecoder(Uint8ArrayConsumer.fromHexString('00')); expect(none).toEqual(undefined); - const empty = pkhsDecoder(Uint8ArrayConsumer.fromHexString('ff00000000')); + const empty = publicKeyHashesDecoder(Uint8ArrayConsumer.fromHexString('ff00000000')); expect(empty).toEqual([]); - const tz = pkhsDecoder( + const tz = publicKeyHashesDecoder( Uint8ArrayConsumer.fromHexString( 'ff0000005400c9fc72e8491bd2973e196f04ec6918ad5bcee22d012ffebbf1560632ca767bc960ccdb84669d284c2c026fde46af0356a0476dae4e4600172dc9309b3aa4' ) From fc646c547877b4270a26862280ca0b356a9158a7 Mon Sep 17 00:00:00 2001 From: huianyang Date: Thu, 4 Jan 2024 16:44:45 -0800 Subject: [PATCH 11/11] test: updated contract-estimation-tests-spec.ts assertions --- integration-tests/contract-estimation-tests.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/integration-tests/contract-estimation-tests.spec.ts b/integration-tests/contract-estimation-tests.spec.ts index 9ed7607147..748243ddae 100644 --- a/integration-tests/contract-estimation-tests.spec.ts +++ b/integration-tests/contract-estimation-tests.spec.ts @@ -101,7 +101,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(472); expect(estimate.totalCost).toEqual(472); expect(estimate.usingBaseFeeMutez).toEqual(472); - expect(estimate.consumedMilligas).toEqual(1356142); + expect(estimate.consumedMilligas).toEqual(1356228); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -118,7 +118,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(543); expect(estimate.totalCost).toEqual(129043); expect(estimate.usingBaseFeeMutez).toEqual(543); - expect(estimate.consumedMilligas).toEqual(1470671); + expect(estimate.consumedMilligas).toEqual(1470757); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -131,20 +131,20 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(519); expect(estimate.totalCost).toEqual(79769); expect(estimate.usingBaseFeeMutez).toEqual(519); - expect(estimate.consumedMilligas).toEqual(1766766); + expect(estimate.consumedMilligas).toEqual(1766852); }); it('Verify .estimate.transfer for multiple internal originations', async () => { const tx = contract.methods.do(originate2()).toTransferParams(); const estimate = await LowAmountTez.estimate.transfer(tx); - expect(estimate.gasLimit).toEqual(2392); + expect(estimate.gasLimit).toEqual(2393); expect(estimate.storageLimit).toEqual(634); expect(estimate.suggestedFeeMutez).toEqual(737); expect(estimate.burnFeeMutez).toEqual(158500); expect(estimate.minimalFeeMutez).toEqual(637); expect(estimate.totalCost).toEqual(159137); expect(estimate.usingBaseFeeMutez).toEqual(637); - expect(estimate.consumedMilligas).toEqual(2291919); + expect(estimate.consumedMilligas).toEqual(2292005); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation();