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

Merge master into dev #3168

Merged
merged 9 commits into from
May 24, 2024
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# 0.116.0 (2024-05-24)

### CKB Node & Light Client

- [[email protected]](https://github.com/nervosnetwork/ckb/releases/tag/v0.116.1) was released on May. 11st, 2024. This version of CKB node is now bundled and preconfigured in Neuron.
- [CKB Light [email protected]](https://github.com/nervosnetwork/ckb-light-client/releases/tag/v0.3.7) was released on Apr. 13th, 2024. This version of CKB Light Client is now bundled and preconfigured in Neuron

### Assumed valid target

Block before `0x6dd077b407d019a0bce0cbad8c34e69a524ae4b2599b9feda2c7491f3559d32c`(at height `13,007,704`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/3157)

---

[![[email protected]](https://github.com/Magickbase/neuron-public-issues/assets/7271329/ec10aa01-47fe-47a3-9636-3d4e86fc6c9b)](https://youtu.be/QXv8by2C8zU)

YouTube: https://youtu.be/QXv8by2C8zU

---

## New features

- 3134: Support 'replace-by-fee' nervos dao transactions and sudt transactions.(@devchenyan)
- 3144: Reduce size of light client log in debug information and reveal start-block-number in log.(@yanguoyu)
- 3064: Support locking window by pin code.(@yanguoyu)
- 3131: Add detailed result for nervos dao transaction.(@devchenyan)

## Bug fixes

- 3121: Locate the first transaction on Explorer directly when users want to set the start-block-number for light client.(@yanguoyu)
- 3101: Show migration instruction properly.(@devchenyan)
- 3062: Migrate legacy ACP to active ACP account(@yanguoyu)
- 3141: Fix some issues about light client synchronizaiton.(@yanguoyu)
- 3120: Remove all sync data when start-block-number is set less than before.(@yanguoyu)

**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.114.3...v0.116.0

# 0.114.3 (2024-04-16)

### CKB Node & Light Client
Expand Down
16 changes: 16 additions & 0 deletions compatible.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@
"0.3",
"0.2"
]
},
"0.116": {
"full": [
"0.116",
"0.115",
"0.114",
"0.113",
"0.112",
"0.111",
"0.110",
"0.109"
],
"light": [
"0.3",
"0.2"
]
}
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages": ["packages/*"],
"version": "0.114.3",
"version": "0.116.0",
"npmClient": "yarn",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "neuron",
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"version": "0.114.3",
"version": "0.116.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neuron-ui",
"version": "0.114.3",
"version": "0.116.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
31 changes: 22 additions & 9 deletions packages/neuron-ui/src/components/AmendSend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,41 @@ const AmendSend = () => {
return ''
}

const inputsCapacity = useMemo(() => {
if (transaction) {
return transaction.inputs.reduce((total, cur) => {
return total + BigInt(cur.capacity || '0')
}, BigInt(0))
}
return undefined
}, [transaction])

const items: {
address: string
amount: string
capacity: string
isLastOutput: boolean
output: State.DetailedOutput
}[] = useMemo(() => {
if (transaction && transaction.outputs.length) {
if (transaction && transaction.outputs.length && inputsCapacity) {
const lastOutputAddress = getLastOutputAddress(transaction.outputs)
return transaction.outputs.map(output => {
const address = scriptToAddress(output.lock, { isMainnet })
const capacity =
transaction.outputs.length === 1 && address === lastOutputAddress
? (inputsCapacity - fee).toString()
: output.capacity
return {
capacity: output.capacity,
capacity,
address,
output,
amount: shannonToCKBFormatter(output.capacity || '0'),
amount: shannonToCKBFormatter(capacity || '0'),
isLastOutput: address === lastOutputAddress,
}
})
}
return []
}, [transaction?.outputs])
}, [transaction?.outputs, inputsCapacity, fee])

const outputsCapacity = useMemo(() => {
const outputList = items.length === 1 ? items : items.filter(item => !item.isLastOutput)
Expand All @@ -129,15 +142,15 @@ const AmendSend = () => {
const totalAmount = shannonToCKBFormatter(outputsCapacity.toString())

const lastOutputsCapacity = useMemo(() => {
if (transaction) {
const inputsCapacity = transaction.inputs.reduce((total, cur) => {
return total + BigInt(cur.capacity || '0')
}, BigInt(0))
if (inputsCapacity) {
if (items.length === 1) {
return BigInt(items[0].capacity || '0')
}

return inputsCapacity - outputsCapacity - fee
}
return undefined
}, [transaction, fee, outputsCapacity])
}, [inputsCapacity, fee, outputsCapacity, items])

useEffect(() => {
if (transaction && lastOutputsCapacity !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-wallet/.env
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ DAO_CODE_HASH=0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e
MULTISIG_CODE_HASH=0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8

# CKB NODE OPTIONS
CKB_NODE_ASSUME_VALID_TARGET='0x9443ad8da9172d484367bc5467988cba7a0c46028398309edfdda7d2d79be897'
CKB_NODE_DATA_SIZE=53
CKB_NODE_ASSUME_VALID_TARGET='0x6dd077b407d019a0bce0cbad8c34e69a524ae4b2599b9feda2c7491f3559d32c'
CKB_NODE_DATA_SIZE=54
4 changes: 2 additions & 2 deletions packages/neuron-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"homepage": "https://www.nervos.org/",
"version": "0.114.3",
"version": "0.116.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -97,7 +97,7 @@
"electron-builder": "24.9.1",
"electron-devtools-installer": "3.2.0",
"jest-when": "3.6.0",
"neuron-ui": "0.114.3",
"neuron-ui": "0.116.0",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions packages/neuron-wallet/src/controllers/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export default class WalletsController {
const keystoreObject = Keystore.fromJson(keystore)
const masterPrivateKey = keystoreObject.extendedPrivateKey(password)
const masterKeychain = new Keychain(
Buffer.from(masterPrivateKey.privateKey, 'hex'),
Buffer.from(masterPrivateKey.chainCode, 'hex')
Buffer.from(bytes.bytify(masterPrivateKey.privateKey)),
Buffer.from(bytes.bytify(masterPrivateKey.chainCode))
)
const accountKeychain = masterKeychain.derivePath(AccountExtendedPublicKey.ckbAccountPath)
const accountExtendedPublicKey = new AccountExtendedPublicKey(
Expand Down
5 changes: 4 additions & 1 deletion packages/neuron-wallet/src/services/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class SettingsService extends Store {

private generateEncryptString(str: string) {
if (safeStorage.isEncryptionAvailable()) {
return safeStorage.encryptString(str).toString('utf-8')
return safeStorage.encryptString(str).toString('hex')
}
const hash = crypto.createHash('sha256')
hash.update(str)
Expand All @@ -108,6 +108,9 @@ export default class SettingsService extends Store {
}

verifyLockWindowPassword(password: string) {
if (safeStorage.isEncryptionAvailable()) {
return safeStorage.decryptString(Buffer.from(this.lockWindowInfo.encryptedPassword!, 'hex')) === password
}
const encryptedPassword = this.generateEncryptString(password)
return SettingsService.getInstance().lockWindowInfo.encryptedPassword === encryptedPassword
}
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-wallet/src/services/sign-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ec as EC } from 'elliptic'
import { AddressNotFound } from '../exceptions'
import HardwareWalletService from './hardware'
import AddressParser from '../models/address-parser'
import { bytes } from '@ckb-lumos/codec'

export default class SignMessage {
static GENERATE_COUNT = 100
Expand Down Expand Up @@ -91,8 +92,8 @@ export default class SignMessage {
private static getPrivateKey(wallet: Wallet, path: string, password: string): string {
const masterPrivateKey = wallet.loadKeystore().extendedPrivateKey(password)
const masterKeychain = new Keychain(
Buffer.from(masterPrivateKey.privateKey, 'hex'),
Buffer.from(masterPrivateKey.chainCode, 'hex')
Buffer.from(bytes.bytify(masterPrivateKey.privateKey)),
Buffer.from(bytes.bytify(masterPrivateKey.chainCode))
)

return `0x${masterKeychain.derivePath(path).privateKey.toString('hex')}`
Expand Down
Loading