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

Prevent Broken ledger live for celo users #7622

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
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: 5 additions & 0 deletions .changeset/nasty-boats-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/live-common": patch
---

Upgrade @celo/\* dependencies for compatibility with Celo as Layer 2
12 changes: 1 addition & 11 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,9 @@ function readPackage(pkg, context) {
webpack: "*",
}),
/* @celo/* packages */
addDependencies(/@celo\/(?!base)+/, { "@celo/base": `^${pkg.version}` }),
Copy link
Author

@aaronmgdr aaronmgdr Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer necessary and in fact breaks install as celo deps no longer locked together their versions

addDependencies("@celo/connect", {
"@celo/base": `^${pkg.version}`,
"web3-eth-contract": pkg.peerDependencies?.web3 ?? "*",
"web3": pkg.peerDependencies?.web3 ?? "1.10",
}),
addDependencies("@celo/contractkit", {
"web3-utils": pkg.dependencies?.["web3"],
}),
addDependencies("@celo/utils", {
"fp-ts": "*",
rlp: "*",
}),
/* @cosmjs/* packages */
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo add back

addDependencies("@cosmjs/proto-signing", {
"@cosmjs/crypto": pkg.version,
"@cosmjs/encoding": pkg.version,
Expand Down
1 change: 1 addition & 0 deletions apps/ledger-live-desktop/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const commonConfig = {
__SENTRY_URL__: null,
__PRERELEASE__: "null",
__CHANNEL__: "null",
Buffer: Uint8Array,
Copy link
Author

@aaronmgdr aaronmgdr Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was necessary to fix issue where jsdom doesn't really support Buffer.

@noble/curve relies on Buffer being a subclass of UINT8Array. the implementation in JSDOM does not.

The noble library a dependency of a dependency of contractkit

},
moduleNameMapper,
testPathIgnorePatterns,
Expand Down
1 change: 1 addition & 0 deletions libs/ledger-live-common/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const defaultConfig = {
"ts-jest": {
isolatedModules: true,
},
Buffer: Uint8Array,
},
testEnvironment: "node",
reporters,
Expand Down
10 changes: 5 additions & 5 deletions libs/ledger-live-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
},
"dependencies": {
"@cardano-foundation/ledgerjs-hw-app-cardano": "^7.1.2",
"@celo/connect": "^3.0.1",
"@celo/contractkit": "^3.0.1",
"@celo/utils": "^3.0.1",
"@celo/wallet-base": "^3.0.1",
"@celo/wallet-ledger": "^3.0.1",
"@celo/connect": "^6.0.1",
"@celo/contractkit": "^8.1.1",
"@celo/utils": "^7.0.0",
"@celo/wallet-base": "^6.0.1",
"@celo/wallet-ledger": "^6.0.1",
"@crypto-org-chain/chain-jslib": "1.1.2",
"@dfinity/agent": "^0.21.0",
"@dfinity/candid": "^0.21.0",
Expand Down
100 changes: 0 additions & 100 deletions libs/ledger-live-common/src/families/celo/hw-app-celo.ts

This file was deleted.

7 changes: 4 additions & 3 deletions libs/ledger-live-common/src/families/celo/signOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { buildOptimisticOperation } from "./buildOptimisticOperation";
import type { Transaction, CeloAccount } from "./types";
import { withDevice } from "../../hw/deviceAccess";
import buildTransaction from "./buildTransaction";
import { CeloApp } from "./hw-app-celo";
import Eth from "@ledgerhq/hw-app-eth";

/**
* Sign Transaction with Ledger hardware
Expand All @@ -28,14 +28,14 @@ export const signOperation: AccountBridge<Transaction, CeloAccount>["signOperati
throw new FeeNotLoaded();
}

const celo = new CeloApp(transport);
const celo = new Eth(transport);
const unsignedTransaction = await buildTransaction(account, transaction);
const { chainId, to } = unsignedTransaction;
const rlpEncodedTransaction = rlpEncodedTx(unsignedTransaction);

const tokenInfo = tokenInfoByAddressAndChainId(to!, chainId!);
if (tokenInfo) {
await celo.provideERC20TokenInformation(tokenInfo);
await celo.provideERC20TokenInformation(`0x${tokenInfo.data.toString("hex")}`);
}

o.next({ type: "device-signature-requested" });
Expand All @@ -47,6 +47,7 @@ export const signOperation: AccountBridge<Transaction, CeloAccount>["signOperati

if (cancelled) return;

// TODO: this doesn't seem necessary anymore
const signature = parseSigningResponse(response, chainId!);

o.next({ type: "device-signature-granted" });
Expand Down
Loading
Loading