Skip to content

Commit

Permalink
Bugfix/Live-13301 tezos min reveal gasfees (#7532)
Browse files Browse the repository at this point in the history
fix: tezos min reveal gaslimit
  • Loading branch information
hzheng-ledger authored Aug 8, 2024
1 parent 1690fc9 commit b97b76c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/dry-oranges-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ledgerhq/coin-tezos": patch
"@ledgerhq/live-common": patch
---

fix tezos min reveal gaslimit
1 change: 1 addition & 0 deletions libs/coin-modules/coin-tezos/src/api/index.integ.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe("Tezos Api", () => {
},
fees: {
minGasLimit: 600,
minRevealGasLimit: 300,
minStorageLimit: 0,
minFees: 500,
minEstimatedFees: 500,
Expand Down
1 change: 1 addition & 0 deletions libs/coin-modules/coin-tezos/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type TezosConfig = {
};
fees: {
minGasLimit: number;
minRevealGasLimit: number;
minStorageLimit: number;
minFees: number;
minEstimatedFees: number;
Expand Down
6 changes: 4 additions & 2 deletions libs/coin-modules/coin-tezos/src/logic/craftTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OpKind, type OperationContents } from "@taquito/rpc";
import { DEFAULT_FEE } from "@taquito/taquito";
import { UnsupportedTransactionMode } from "../types/errors";
import { getTezosToolkit } from "./tezosToolkit";
import coinConfig from "../config";

type TransactionFee = {
fees?: string;
Expand Down Expand Up @@ -43,13 +44,14 @@ export async function craftTransaction(

if (publicKey !== undefined) {
const revealFees = await tezosToolkit.estimate.reveal();

const minRevealGasLimit = coinConfig.getCoinConfig().fees.minRevealGasLimit;
const revealGasLimit = Math.max(revealFees?.gasLimit || 0, minRevealGasLimit);
contents.push({
kind: OpKind.REVEAL,
fee: DEFAULT_FEE.REVEAL.toString(),
//TODO: use instead of previous line when this PR will be validated, as the value change (don't forget to update the test too)
// fee: getRevealFee(address).toString(),
gas_limit: (revealFees?.gasLimit || 0).toString(),
gas_limit: revealGasLimit.toString(),
storage_limit: (revealFees?.storageLimit || 0).toString(),
source: publicKey.publicKeyHash,
counter: (counter + 1 + contents.length).toString(),
Expand Down
1 change: 1 addition & 0 deletions libs/coin-modules/coin-tezos/src/test/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const mockConfig = {
},
fees: {
minGasLimit: 0,
minRevealGasLimit: 0,
minStorageLimit: 0,
minFees: 0,
minEstimatedFees: 0,
Expand Down
1 change: 1 addition & 0 deletions libs/ledger-live-common/src/families/tezos/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const tezosConfig: Record<string, ConfigInfo> = {
},
fees: {
minGasLimit: 600,
minRevealGasLimit: 300,
minStorageLimit: 0,
minFees: 500,
minEstimatedFees: 500,
Expand Down

0 comments on commit b97b76c

Please sign in to comment.