Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2064 lima integration remove jakarta #2084

Merged
merged 4 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node:
node:
- '16.13.1'
- '17.3.x'
steps:
Expand Down Expand Up @@ -44,6 +44,7 @@ jobs:
matrix:
protocol:
- kathmandunet
- limanet
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down Expand Up @@ -78,4 +79,4 @@ jobs:
POLLING_INTERVAL_MILLISECONDS: 100
RPC_CACHE_MILLISECONDS: 0
TEZOS_BAKER: tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb
- run: docker kill my-sandbox
- run: docker kill my-sandbox
5 changes: 4 additions & 1 deletion apps/taquito-test-dapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ A minimal end-to-end testing setup for developing Tezos DApps with Taquito and B
`npm install`
4. Start development server:
`npm run dev`
5. Open http://localhost:3030 in your browser to see a sample application.
5. Open http://localhost:3030 in your browser to see a sample application.
6. Start production server:
`npm run build && npm run preview`
7. Open http://localhost:4173 in your browser to see a preview application.
2 changes: 1 addition & 1 deletion apps/taquito-test-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"svelte-preprocess": "^4.9.8",
"tslib": "^2.3.1",
"typescript": "^4.5.4",
"vite": "^2.9.7",
"vite": "^3.2.0",
"vite-compatible-readable-stream": "^3.6.1"
},
"dependencies": {
Expand Down
23 changes: 23 additions & 0 deletions docs/ballot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Ballot Operation
id: ballot
author: Davis Sawali
---

The `Ballot` operation allows delegates to cast one `Yay`, `Nay`, or `Pass` ballot on a selected proposal. Delegates are only able to cast their votes during the **Exploration period** and the **Promotion period**

## Examples
The `Ballot` operation is currently available in the Contract API, and can be used as such:
```typescript
const op = await Tezos.contract.ballot({
proposal: 'PROPOSAL_HASH',
ballot: 'BALLOT_VOTE_STRING'
});

await op.confirmation();
```
- `proposal` is the proposal hash string that you (a delegate) would like to point your ballot towards. Information on the current proposal can be obtained by calling [this RPC endpoint](https://tezos.gitlab.io/alpha/rpc.html#get-block-id-votes-current-proposal). Alternatively, you could also get the proposal hash by using Taquito's RPC Client method `RpcClient.getCurrentProposal`. For more information on the `RpcClient` refer to [this document](https://tezostaquito.io/docs/rpc_package/)
- `ballot` is your ballot vote (`yay`, `nay`, or `pass`)


For more information in regards to the Amendment (and Voting) Process refer to [this document](https://tezos.gitlab.io/alpha/voting.html)
67 changes: 34 additions & 33 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { importKey, InMemorySigner } from '@taquito/signer';
import { RpcClient, RpcClientCache } from '@taquito/rpc';
import { knownBigMapContractProtoALph, knownContractProtoALph, knownOnChainViewContractAddressProtoALph, knownSaplingContractProtoALph, knownTzip12BigMapOffChainContractProtoALph, txRollupAddressProtoALph } from './known-contracts-ProtoALph';
import { knownContractPtKathman, knownBigMapContractPtKathman, knownTzip12BigMapOffChainContractPtKathman, knownSaplingContractPtKathman, knownOnChainViewContractAddressPtKathman, txRollupAddressPtKathman } from './known-contracts-PtKathman';
import { knownContractPtJakart2, knownBigMapContractPtJakart2, knownTzip12BigMapOffChainContractPtJakart2, knownSaplingContractPtJakart2, knownOnChainViewContractAddressPtJakart2, txRollupAddressPtJakart2 } from './known-contracts-PtJakart2';
import { knownContractPtLimaPtL, knownBigMapContractPtLimaPtL, knownTzip12BigMapOffChainContractPtLimaPtL, knownSaplingContractPtLimaPtL, knownOnChainViewContractAddressPtLimaPtL, txRollupAddressPtLimaPtL } from './known-contracts-PtLimaPtL';

const nodeCrypto = require('crypto');

Expand Down Expand Up @@ -91,32 +91,33 @@ const kathmandunetEphemeral = {
protocol: Protocols.PtKathman,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
keyUrl: 'https://api.tez.ie/keys/kathmandunet',
keyUrl: 'http://key-gen-1.i.tez.ie:3000/kathmandunet',
requestHeaders: { Authorization: 'Bearer taquito-example' },
}
};

const jakartanetEphemeral = {
rpc: process.env['TEZOS_RPC_JAKARTANET'] || 'https://jakartanet-archive.ecadinfra.com',
const limanetEphemeral = {
rpc: process.env['TEZOS_RPC_LIMANET'] || 'https://limanet.ecadinfra.com',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000',
knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
knownContract: process.env['TEZOS_JAKARTANET_CONTRACT_ADDRESS'] || knownContractPtJakart2,
knownBigMapContract: process.env['TEZOS_JAKARTANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtJakart2,
knownTzip1216Contract: process.env['TEZOS_JAKARTANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtJakart2,
knownSaplingContract: process.env['TEZOS_JAKARTANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtJakart2,
txRollupWithdrawContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_JAKARTANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtJakart2,
txRollupAddress: process.env['TEZOS_JAKARTANET_TXROLLUP_ADDRESS'] || txRollupAddressPtJakart2,
protocol: Protocols.PtJakart2,
knownContract: process.env['TEZOS_LIMANET_CONTRACT_ADDRESS'] || knownContractPtLimaPtL,
knownBigMapContract: process.env['TEZOS_LIMANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtLimaPtL,
knownTzip1216Contract: process.env['TEZOS_LIMANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtLimaPtL,
knownSaplingContract: process.env['TEZOS_LIMANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtLimaPtL,
txRollupWithdrawContract: process.env['TEZOS_LIMANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_LIMANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_LIMANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtLimaPtL,
txRollupAddress: process.env['TEZOS_LIMANET_TXROLLUP_ADDRESS'] || txRollupAddressPtLimaPtL,
protocol: Protocols.PtLimaPtL,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
keyUrl: 'https://api.tez.ie/keys/jakartanet',
keyUrl: 'http://key-gen-1.i.tez.ie:3000/limanet',
requestHeaders: { Authorization: 'Bearer taquito-example' },
},
};


const mondaynetEphemeral = {
rpc: process.env['TEZOS_RPC_MONDAYNET'] || 'http://mondaynet.ecadinfra.com:8732',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
Expand Down Expand Up @@ -155,20 +156,20 @@ const kathmandunetSecretKey = {
signerConfig: defaultSecretKey,
};

const jakartanetSecretKey = {
rpc: process.env['TEZOS_RPC_JAKARTANET'] || 'https://jakartanet-archive.ecadinfra.com',
const limanetSecretKey = {
rpc: process.env['TEZOS_RPC_LIMANET'] || 'https://limanet-archive.ecadinfra.com',
pollingIntervalMilliseconds: process.env['POLLING_INTERVAL_MILLISECONDS'] || undefined,
rpcCacheMilliseconds: process.env['RPC_CACHE_MILLISECONDS'] || '1000',
knownBaker: process.env['TEZOS_BAKER'] || 'tz1cjyja1TU6fiyiFav3mFAdnDsCReJ12hPD',
knownContract: process.env['TEZOS_JAKARTANET_CONTRACT_ADDRESS'] || knownContractPtJakart2,
knownBigMapContract: process.env['TEZOS_JAKARTANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtJakart2,
knownTzip1216Contract: process.env['TEZOS_JAKARTANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtJakart2,
knownSaplingContract: process.env['TEZOS_JAKARTANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtJakart2,
txRollupWithdrawContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_JAKARTANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_JAKARTANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtJakart2,
txRollupAddress: process.env['TEZOS_JAKARTANET_TXROLLUP_ADDRESS'] || txRollupAddressPtJakart2,
protocol: Protocols.PtJakart2,
knownContract: process.env['TEZOS_LIMANET_CONTRACT_ADDRESS'] || knownContractPtLimaPtL,
knownBigMapContract: process.env['TEZOS_LIMANET_BIGMAPCONTRACT_ADDRESS'] || knownBigMapContractPtLimaPtL,
knownTzip1216Contract: process.env['TEZOS_LIMANET_TZIP1216CONTRACT_ADDRESS'] || knownTzip12BigMapOffChainContractPtLimaPtL,
knownSaplingContract: process.env['TEZOS_LIMANET_SAPLINGCONTRACT_ADDRESS'] || knownSaplingContractPtLimaPtL,
txRollupWithdrawContract: process.env['TEZOS_LIMANET_TX_ROLLUP_WITHDRAW_CONTRACT'] || '',
txRollupDepositContract: process.env['TEZOS_LIMANET_TX_ROLLUP_DEPOSIT_CONTRACT'] || '',
knownViewContract: process.env['TEZOS_LIMANET_ON_CHAIN_VIEW_CONTRACT'] || knownOnChainViewContractAddressPtLimaPtL,
txRollupAddress: process.env['TEZOS_LIMANET_TXROLLUP_ADDRESS'] || txRollupAddressPtLimaPtL,
protocol: Protocols.PtLimaPtL,
signerConfig: defaultSecretKey
};

Expand All @@ -192,21 +193,21 @@ const mondaynetSecretKey = {
const providers: Config[] = [];

if (process.env['RUN_WITH_SECRET_KEY']) {
providers.push(jakartanetSecretKey, kathmandunetSecretKey);
} else if (process.env['RUN_JAKARTANET_WITH_SECRET_KEY']) {
providers.push(jakartanetSecretKey);
providers.push(limanetSecretKey, kathmandunetSecretKey);
} else if (process.env['RUN_LIMANET_WITH_SECRET_KEY']) {
providers.push(limanetSecretKey);
} else if (process.env['RUN_KATHMANDUNET_WITH_SECRET_KEY']) {
providers.push(kathmandunetSecretKey);
} else if (process.env['RUN_MONDAYNET_WITH_SECRET_KEY']) {
providers.push(mondaynetSecretKey);
} else if (process.env['JAKARTANET']) {
providers.push(jakartanetEphemeral);
} else if (process.env['KATHMANDUNET']) {
providers.push(kathmandunetEphemeral);
} else if (process.env['LIMANET']) {
providers.push(limanetEphemeral);
} else if (process.env['MONDAYNET']) {
providers.push(mondaynetEphemeral);
} else {
providers.push(jakartanetEphemeral, kathmandunetEphemeral);
providers.push(limanetEphemeral, kathmandunetEphemeral);
}

const setupForger = (Tezos: TezosToolkit, forger: ForgerType): void => {
Expand Down Expand Up @@ -250,7 +251,7 @@ const setupSignerWithEphemeralKey = async (
const httpClient = new HttpBackend();

try {
const { id, pkh } = await httpClient.createRequest({
const { id, pkh } = await httpClient.createRequest<{ id: string; pkh: string }>({
url: ephemeralUrl,
method: 'POST',
headers: requestHeaders,
Expand Down Expand Up @@ -352,4 +353,4 @@ export const CONFIGS = () => {
);
return [...prev, ...configs];
}, [] as ConfigWithSetup[]);
};
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Protocols } from "@taquito/taquito";
import { CONFIGS } from "./config";

CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => {
CONFIGS().forEach(({ lib, rpc, setup, createAddress }) => {

const Tezos = lib;
const jakartanet = (protocol === Protocols.PtJakart2) ? test : test.skip;
const kathmandunetAndAlpha = (protocol === Protocols.PtKathman || protocol === Protocols.ProtoALpha) ? test : test.skip;

describe(`Test emptying a revealed implicit account into a new implicit account through contract api using: ${rpc}`, () => {

Expand All @@ -14,58 +12,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => {
done()
})

jakartanet('Verify that a new unrevealed implicit account can be created with the createAddress function and the sender account can be emptied into the created one', async (done) => {

const receiver = await createAddress();
const receiver_pkh = await receiver.signer.publicKeyHash();

// create and fund the account we want to empty
const sender = await createAddress();
const sender_pkh = await sender.signer.publicKeyHash();
const op = await Tezos.contract.transfer({ to: sender_pkh, amount: 1 });
await op.confirmation();

// Sending 1 token from the account we want to empty
// This will do the reveal operation automatically
const op2 = await sender.contract.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.1 });
await op2.confirmation();

const balance = await Tezos.tz.getBalance(sender_pkh);

const estimate = await sender.estimate.transfer({
to: receiver_pkh,
amount: 0.5,
});

// // Emptying the account
const totalFees = estimate.suggestedFeeMutez + estimate.burnFeeMutez;
const maxAmount = balance.minus(totalFees).toNumber();
// // Temporary fix, see https://gitlab.com/tezos/tezos/-/issues/1754
// // we need to increase the gasLimit and fee returned by the estimation
const gasBuffer = 500;
const MINIMAL_FEE_PER_GAS_MUTEZ = 0.1;
const increasedFee = (gasBuffer: number, opSize: number) => {
return (gasBuffer) * MINIMAL_FEE_PER_GAS_MUTEZ + opSize
}

const opTransfer = await sender.contract.transfer({
to: receiver_pkh,
mutez: true,
amount: maxAmount - increasedFee(gasBuffer, Number(estimate.opSize)),
fee: estimate.suggestedFeeMutez + increasedFee(gasBuffer, Number(estimate.opSize)), // baker fees
gasLimit: estimate.gasLimit + gasBuffer,
storageLimit: estimate.storageLimit
});

await opTransfer.confirmation();
const finalBalance = await Tezos.tz.getBalance(sender_pkh);

expect(finalBalance.toString()).toEqual("0")

done();
});

kathmandunetAndAlpha('Verify that a new unrevealed implicit account can be created from the sender account and the sender account can be emptied into the created one.', async (done) => {
it('Verify that a new unrevealed implicit account can be created from the sender account and the sender account can be emptied into the created one.', async (done) => {
const receiver = await createAddress();
const receiver_pkh = await receiver.signer.publicKeyHash();

Expand All @@ -74,7 +21,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => {
const sender_pkh = await sender.signer.publicKeyHash();
const op = await Tezos.contract.transfer({ to: sender_pkh, amount: 1 });
await op.confirmation();

// Sending 1 token from the account we want to empty
// This will do the reveal operation automatically
const op2 = await sender.contract.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.1 });
Expand All @@ -90,14 +37,14 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => {
// // Emptying the account
const totalFees = estimate.suggestedFeeMutez + estimate.burnFeeMutez;
const maxAmount = balance.minus(totalFees).toNumber();

const opTransfer = await sender.contract.transfer({
to: receiver_pkh,
mutez: true,
amount: maxAmount,
fee: estimate.suggestedFeeMutez,
gasLimit: estimate.gasLimit,
storageLimit: estimate.storageLimit
amount: maxAmount,
fee: estimate.suggestedFeeMutez,
gasLimit: estimate.gasLimit,
storageLimit: estimate.storageLimit
});

await opTransfer.confirmation();
Expand All @@ -108,4 +55,4 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup, createAddress }) => {
done();
});
});
})
})
Loading