-
Notifications
You must be signed in to change notification settings - Fork 44
/
TODO
37 lines (31 loc) · 1.53 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
- mnemonic and ICAP support
- check ethUtils.hashPersonalMessage
- maybe ICAP check toChecksumAddress + isValidChecksumAddress
describe('message sig', function () {
const r = Buffer.from('99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9', 'hex')
const s = Buffer.from('129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66', 'hex')
it('should return hex strings that the RPC can use', function () {
assert.equal(ethUtils.toRpcSig(27, r, s), '0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca6600')
assert.deepEqual(ethUtils.fromRpcSig('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca6600'), {
v: 27,
r: r,
s: s
})
})
it('should throw on invalid length', function () {
assert.throws(function () {
ethUtils.fromRpcSig('')
})
assert.throws(function () {
ethUtils.fromRpcSig('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca660042')
})
})
it('pad short r and s values', function () {
assert.equal(ethUtils.toRpcSig(27, r.slice(20), s.slice(20)), '0x00000000000000000000000000000000000000004a1579cf389ef88b20a1abe90000000000000000000000000000000000000000326fa689f228040429e3ca6600')
})
it('should throw on invalid v value', function () {
assert.throws(function () {
ethUtils.toRpcSig(1, r, s)
})
})
})