-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #609 from ckb-js/rc/v0.107.0
Release v0.107.0
- Loading branch information
Showing
41 changed files
with
1,376 additions
and
3,053 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
], | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"version": "0.103.1" | ||
"version": "0.107.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
{ | ||
"serializeMultisigConfig": { | ||
"exception with config is less than 0": { | ||
"config": { | ||
"r": -1, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": [] | ||
}, | ||
"exception": "For multisig sign, signer should between 0 and 255" | ||
}, | ||
"exception with config is grater than 255": { | ||
"config": { | ||
"r": 256, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": [] | ||
}, | ||
"exception": "For multisig sign, signer should between 0 and 255" | ||
}, | ||
"exception with r shouldn't be greater than n": { | ||
"config": { | ||
"r": 3, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": [] | ||
}, | ||
"exception": "For m of n multisig sign, r shouldn't be greater than m" | ||
}, | ||
"exception with m is greater than n": { | ||
"config": { | ||
"r": 1, | ||
"m": 4, | ||
"n": 3, | ||
"blake160s": [] | ||
}, | ||
"exception": "For m of n multisig sign, m shouldn't be greater than n" | ||
}, | ||
"exception blake160s length not equal with n": { | ||
"config": { | ||
"r": 1, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1"] | ||
}, | ||
"exception": "For m of n multisig sign, signer's length should equal with n" | ||
}, | ||
"test serializeMultisigConfig": { | ||
"config": { | ||
"r": 1, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xb7672fcde903607f6bb150a730085c2a43c422fa", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1"] | ||
}, | ||
"expected": "0x000102037c021957a27000e794f25828270f187c791443e3b7672fcde903607f6bb150a730085c2a43c422fad93b3564ef1b2dcf7bca781f968b3c7d2db85fd1" | ||
} | ||
}, | ||
"hashMultisig": { | ||
"normal": { | ||
"config": { | ||
"r": 0, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"] | ||
}, | ||
"expected": "0xe7db180742a9b5c4f2d9319d74982503fbc88a37" | ||
} | ||
}, | ||
"getMultisigStatus": { | ||
"Unsigned": { | ||
"config": { | ||
"r": 0, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"] | ||
}, | ||
"signatures": [], | ||
"expected": "Unsigned" | ||
}, | ||
"PartiallySigned": { | ||
"config": { | ||
"r": 0, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"] | ||
}, | ||
"signatures": ["0x7c021957a27000e794f25828270f187c791443e3"], | ||
"expected": "PartiallySigned" | ||
}, | ||
"Signed": { | ||
"config": { | ||
"r": 0, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"] | ||
}, | ||
"signatures": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1"], | ||
"expected": "Signed" | ||
}, | ||
"exception with More signature for multisig, all signatures overflow": { | ||
"config": { | ||
"r": 1, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"] | ||
}, | ||
"signatures": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"], | ||
"exception": "More signature for multisig" | ||
}, | ||
"exception with More signature for multisig, m signatures overflow": { | ||
"config": { | ||
"r": 1, | ||
"m": 1, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3", "0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1", "0xb7672fcde903607f6bb150a730085c2a43c422fa"] | ||
}, | ||
"signatures": ["0xd93b3564ef1b2dcf7bca781f968b3c7d2db85fd1"], | ||
"exception": "More signature for multisig" | ||
} | ||
}, | ||
"isMultisigConfig": { | ||
"false with loss field": { | ||
"config": { | ||
"m": "2", | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3"] | ||
}, | ||
"expected": false | ||
}, | ||
"false with unmatch field type": { | ||
"config": { | ||
"r": "a", | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3"] | ||
}, | ||
"expected": false | ||
}, | ||
"success": { | ||
"config": { | ||
"r": 0, | ||
"m": 2, | ||
"n": 3, | ||
"blake160s": ["0x7c021957a27000e794f25828270f187c791443e3"] | ||
}, | ||
"expected": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
const { serializeMultisigConfig, hashMultisig, getMultisigStatus, isMultisigConfig } = require('../../lib/multisig') | ||
const fixtures = require('./fixtures.json') | ||
|
||
describe('test serializeMultisigConfig', () => { | ||
const serializeMultisigConfigTable = Object.entries(fixtures.serializeMultisigConfig).map( | ||
([title, { config, expected, exception }]) => [ | ||
title, | ||
config, | ||
exception, | ||
expected | ||
], | ||
) | ||
test.each(serializeMultisigConfigTable)( | ||
'%s', | ||
(_title, config, exception, expected) => { | ||
if (exception !== undefined) { | ||
expect(() =>serializeMultisigConfig(config)).toThrowError(exception) | ||
} else { | ||
const result = serializeMultisigConfig(config) | ||
expect(result).toEqual(expected) | ||
} | ||
}, | ||
) | ||
}) | ||
describe('test hashMultisig', () => { | ||
const hashMultisigTable = Object.entries(fixtures.hashMultisig).map( | ||
([title, { config, expected, exception }]) => [ | ||
title, | ||
config, | ||
exception, | ||
expected | ||
], | ||
) | ||
|
||
test.each(hashMultisigTable)( | ||
'%s', | ||
(_title, config, exception, expected) => { | ||
if (exception !== undefined) { | ||
expect(() => hashMultisig(config)).toThrowError(exception) | ||
} else { | ||
const result = hashMultisig(config) | ||
expect(result).toEqual(expected) | ||
} | ||
}, | ||
) | ||
}) | ||
describe('test getMultisigStatus', () => { | ||
const table = Object.entries(fixtures.getMultisigStatus).map( | ||
([title, { config, signatures, expected, exception }]) => [ | ||
title, | ||
config, | ||
signatures, | ||
exception, | ||
expected | ||
], | ||
) | ||
|
||
test.each(table)( | ||
'%s', | ||
(_title, config, signatures, exception, expected) => { | ||
if (exception !== undefined) { | ||
expect(() =>getMultisigStatus(config, signatures)).toThrowError(exception) | ||
} else { | ||
const result = getMultisigStatus(config, signatures) | ||
expect(result).toEqual(expected) | ||
} | ||
}, | ||
) | ||
}) | ||
describe('test isMultisigConfig', () => { | ||
const table = Object.entries(fixtures.isMultisigConfig).map( | ||
([title, { config, expected }]) => [ | ||
title, | ||
config, | ||
expected | ||
], | ||
) | ||
|
||
test.each(table)( | ||
'%s', | ||
(_title, config, expected) => { | ||
expect(isMultisigConfig(config)).toEqual(expected) | ||
}, | ||
) | ||
}) |
Oops, something went wrong.