Skip to content

Commit

Permalink
2597 oxford remove get origination proof (#2664)
Browse files Browse the repository at this point in the history
* refactor: updated rpc types to accomdate both attestation and endorement

* fix: fixed annots on option test fail

* revert: unintional attestation file change

* revert: unintional cspell.json changes

* fix: remove getOriginationProof RPC endpoint and ref in smartRollupOriginate op

BREAKING CHANGE: 1. rpc endpoint getOriginationProof removal 2.

* fix: removed commitment property in SmartRollupCement for oxford

re #2597

* test: updated consumedMilligas assertion in contract-estimation-tests.spec.ts
  • Loading branch information
hui-an-yang authored Sep 22, 2023
1 parent 204be7e commit d631b4e
Show file tree
Hide file tree
Showing 28 changed files with 56 additions and 256 deletions.
12 changes: 1 addition & 11 deletions docs/rpc_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -111,16 +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

Expand Down
9 changes: 4 additions & 5 deletions docs/smart_rollups.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Smart Rollups
author: Davis Sawali
author: Davis Sawali
---

# Smart Optimistic Rollups
Expand Down Expand Up @@ -28,8 +28,7 @@ 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)
- `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})`
- `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)

Expand All @@ -43,9 +42,9 @@ The main use case of sending messages, is usually to denote contract calls. Thes
MESSAGE='[{\
"destination" : "${CONTRACT}", \
"parameters" : "\"Hello world\"", \
"entrypoint" : "default"
"entrypoint" : "default"
}]'
```
```

If you read closely, the message includes a `destination`, a `parameter`, and an `entrypoint` property. All components needed to **call an entrypoint** of a contract.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {

it('should be able to batch smart rollup originate with other operations', async (done) => {
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({
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/contract-estimation-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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(1356379);
expect(estimate.consumedMilligas).toEqual(1356465);
done();
});

Expand All @@ -124,7 +124,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(1470914);
expect(estimate.consumedMilligas).toEqual(1471000);
done();
});

Expand All @@ -138,7 +138,7 @@ 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(1767492);
expect(estimate.consumedMilligas).toEqual(1767578);
done();
});

Expand All @@ -152,7 +152,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => {
expect(estimate.minimalFeeMutez).toEqual(637);
expect(estimate.totalCost).toEqual(159137);
expect(estimate.usingBaseFeeMutez).toEqual(637);
expect(estimate.consumedMilligas).toEqual(2293140);
expect(estimate.consumedMilligas).toEqual(2293226);
// Do the actual operation
const op2 = await contract.methods.do(originate2()).send();
await op2.confirmation();
Expand Down
1 change: 0 additions & 1 deletion integration-tests/contract-smart-rollup-originate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
await op.confirmation();

expect(op.status).toEqual('applied');
expect(op.originationProof).toBeDefined();
expect(op.kernel).toEqual('23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a');
done();
});
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,8 +1363,6 @@ export const commonCases: TestCase[] = [
pvm_kind: PvmKind.WASM2,
kernel:
'23212f7573722f62696e2f656e762073680a6578706f7274204b45524e454c3d22303036313733366430313030303030303031323830373630303337663766376630313766363030323766376630313766363030353766376637663766376630313766363030313766303036303031376630313766363030323766376630303630303030303032363130333131373336643631373237343566373236663663366337353730356636333666373236353061373236353631363435663639366537303735373430303030313137333664363137323734356637323666366336633735373035663633366637323635306337373732363937343635356636663735373437303735373430303031313137333664363137323734356637323666366336633735373035663633366637323635306237333734366637323635356637373732363937343635303030323033303530343033303430353036303530333031303030313037313430323033366436353664303230303061366236353732366536353663356637323735366530303036306161343031303432613031303237663431666130303266303130303231303132303030326630313030323130323230303132303032343730343430343165343030343131323431303034316534303034313030313030323161306230623038303032303030343163343030366230623530303130353766343166653030326430303030323130333431666330303266303130303231303232303030326430303030323130343230303032663031303032313035323030313130303432313036323030343230303334363034343032303030343130313661323030313431303136623130303131613035323030353230303234363034343032303030343130373661323030363130303131613062306230623164303130313766343164633031343138343032343139303163313030303231303034313834303232303030313030353431383430323130303330623062333830353030343165343030306231323266366236353732366536353663326636353665373632663732363536323666366637343030343166383030306230323030303130303431666130303062303230303032303034316663303030623032303030303030343166653030306230313031220a',
origination_proof:
'0300020c4a316fa1079bfc23dac5ecc609ab10e26490e378a81e774c51176040bea18030fab8a3adde4b553c4d391e9cd19ee13b17941c1f49c040d621bbfbea964993810764757261626c658108726561646f6e6c79d00b749948da9186d29aed2f9327b46793f18b1e6499c40f0ddbf0bf785e85e2e9',
parameters_ty: {
prim: 'bytes',
},
Expand Down
59 changes: 10 additions & 49 deletions integration-tests/data/metadataViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export const metadataViewsExample1 = {
michelsonStorageView: {
returnType: {
prim: 'bytes',
args: [],
annots: [ '%returnedBytes' ]
args: []
},
code: [
{
Expand All @@ -66,12 +65,7 @@ export const metadataViewsExample1 = {
annots: []
}
],
annotations: [
{
name: '%returnedBytes',
description: 'A bytes constant.'
}
]
annotations: []
}
}
]
Expand All @@ -83,8 +77,7 @@ export const metadataViewsExample1 = {
michelsonStorageView: {
returnType: {
prim: 'bytes',
args: [],
annots: [ '%returnedBytes' ]
args: []
},
code: [
{
Expand All @@ -108,12 +101,7 @@ export const metadataViewsExample1 = {
annots: []
}
],
annotations: [
{
name: '%returnedBytes',
description: 'A bytes constant.'
}
]
annotations: []
}
}
]
Expand All @@ -126,7 +114,6 @@ export const metadataViewsExample1 = {
returnType: {
prim: 'bytes',
args: [],
annots: [ '%returnedBytes' ]
},
code: [
{
Expand All @@ -150,12 +137,7 @@ export const metadataViewsExample1 = {
annots: []
}
],
annotations: [
{
name: '%returnedBytes',
description: 'A bytes constant.'
}
]
annotations: []
}
}
]
Expand All @@ -168,7 +150,6 @@ export const metadataViewsExample1 = {
returnType: {
prim: 'bytes',
args: [],
annots: [ '%returnedBytes' ]
},
code: [
{
Expand All @@ -192,12 +173,7 @@ export const metadataViewsExample1 = {
annots: []
}
],
annotations: [
{
name: '%returnedBytes',
description: 'A bytes constant.'
}
]
annotations: []
}
}
]
Expand All @@ -210,7 +186,6 @@ export const metadataViewsExample1 = {
returnType: {
prim: 'bytes',
args: [],
annots: [ '%returnedBytes' ]
},
code: [
{
Expand All @@ -234,12 +209,7 @@ export const metadataViewsExample1 = {
annots: []
}
],
annotations: [
{
name: '%returnedBytes',
description: 'A bytes constant.'
}
]
annotations: []
}
}
]
Expand Down Expand Up @@ -276,7 +246,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: [] },
Expand All @@ -303,10 +273,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).'
}
]
}
Expand Down Expand Up @@ -602,18 +568,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: []
}
}
]
Expand Down
11 changes: 0 additions & 11 deletions integration-tests/rpc-nodes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,6 @@ CONFIGS().forEach(
expect(pendingOperations2.branch_refused).toBeInstanceOf(Array);
done();
})

it('Verify that rpcClient.getOriginationProof will retrieve the proof needed for smart rollup originate', async (done) => {
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);
done();
})
});
});
}
Expand Down
7 changes: 0 additions & 7 deletions packages/taquito-contracts-library/src/rpc-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
PendingOperationsV1,
PendingOperationsV2,
PendingOperationsQueryArguments,
OriginationProofParams,
RPCSimulateOperationParam,
} from '@taquito/rpc';
import { ContractsLibrary } from './taquito-contracts-library';
Expand Down Expand Up @@ -322,10 +321,4 @@ export class RpcWrapperContractsLibrary implements RpcClientInterface {
): Promise<PendingOperationsV1 | PendingOperationsV2> {
return this.rpc.getPendingOperations(args);
}
async getOriginationProof(
params: OriginationProofParams,
{ block }: RPCOptions = defaultRPCOptions
): Promise<string> {
return this.rpc.getOriginationProof(params, { block });
}
}
1 change: 0 additions & 1 deletion packages/taquito-local-forging/src/schema/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,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,
};

Expand Down
Loading

0 comments on commit d631b4e

Please sign in to comment.