Skip to content

Commit 23b5601

Browse files
authored
Use MultiAddress as the default type (#3123)
* Use MultiAddress as the default type * Update tests * Update tests
1 parent 859679c commit 23b5601

File tree

13 files changed

+76
-67
lines changed

13 files changed

+76
-67
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# CHANGELOG
22

3+
## 3.7.x
4+
5+
Upgrade priority: Low. However recoemmended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
6+
7+
- **Breaking change** As indicated in the 3.5.1 release notes, th Address/LookupSource default have now been adjusted for `MultiAddress` by default. This extensible format is mean to cater for all address types, removing a lot of discrepancies between chains.
8+
9+
Changes:
10+
11+
- Apply `MultiAddress` as a default
12+
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
13+
14+
315
## 3.6.1 Jan 24, 2020
416

517
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.

packages/api/src/augment/tx.ts

Lines changed: 35 additions & 35 deletions
Large diffs are not rendered by default.

packages/api/src/promise/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { hexToU8a } from '@polkadot/util';
1212
import { SingleAccountSigner } from '../../test/util';
1313
import { ApiPromise } from '.';
1414

15-
const TRANSFER_SIG = '0x7a10e5ed9a14284eca7bea53f81631981dddda5a3d2dee973b136475947264801465726e4829ae3994d9058df638d959d4e043c7f1924299546790dda1dea20a';
15+
const TRANSFER_SIG = '0x54f39e43f32376a5ab6cdfd4d0ce57802aa9ff85514a7ffa9f2a949078f02beca16af87427c45fe60d54aa847fd241d127ed39e21b101806f6b1f50f7a82500b';
1616

1717
describe('ApiPromise', (): void => {
1818
const registry = new TypeRegistry();

packages/metadata/src/decorate/extrinsics/index.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const registry = new TypeRegistry();
1515
const metadata = new Metadata(registry, metadataStatic);
1616

1717
registry.setMetadata(metadata);
18+
registry.register({ Address: 'IndicesLookupSource', LookupSource: 'IndicesLookupSource' });
1819

1920
const extrinsics = decorateExtrinsics(registry, metadata.asLatest, metadata.version);
2021

packages/types-known/src/spec/node.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,13 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
88
// these are override types for Polkadot
99
const versioned: OverrideVersionedType[] = [
1010
{
11-
minmax: [0, 259],
11+
minmax: [0, 260],
1212
types: {
1313
AccountInfo: 'AccountInfoWithRefCount',
1414
Address: 'LookupSource',
1515
LookupSource: 'IndicesLookupSource'
1616
}
1717
},
18-
{
19-
minmax: [260, 260],
20-
types: {
21-
AccountInfo: 'AccountInfoWithRefCount',
22-
Address: 'MultiAddress',
23-
LookupSource: 'MultiAddress'
24-
}
25-
},
2618
{
2719
minmax: [261, undefined],
2820
types: {

packages/types/src/codec/Enum.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ describe('Enum', (): void => {
389389
expect(test.toHex()).toEqual(
390390
'0x' +
391391
'00' + // index
392-
'ff' + // Address indicating an embedded AccountId
392+
'00' + // MultiAddress indicating an embedded AccountId
393393
'0001020304050607080910111213141516171819202122232425262728293031' // AccountId
394394
);
395395
});

packages/types/src/extrinsic/Extrinsic.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Extrinsic', (): void => {
2020
'0x' +
2121
'5d02' + // length
2222
'84' + // V4, signing bit set
23-
'ff' + // lookup, AccountId of sender follows
23+
'00' + // MultiAddress, AccountId of sender follows
2424
'fcc4910cb536b4333db4bccb40e2cf6427b4766518e754b91e70c97e4a87dbb3' + // sender
2525
'00' + // multisig, type ed25519
2626
'd99ffe3e610ad234e1414bda5831395a6df9098bf80b01561ce89a5065ae89d5' + // sig first 32
@@ -29,7 +29,7 @@ describe('Extrinsic', (): void => {
2929
'1101' + // nonce, compact 68
3030
'0700ac23fc06' + // tip, 0.03 KSM
3131
'0600' + // balances.transfer (on Kusama this was 0400, changed here to match metadata)
32-
'ff' + // lookup, AccountId of recipient follows
32+
'00' + // MultiAddress, AccountId of recipient follows
3333
'495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718' + // recipient
3434
'0bc01eb1fc185f' // value, 104.560 KSM
3535
);
@@ -38,7 +38,7 @@ describe('Extrinsic', (): void => {
3838
expect(extrinsic.nonce.toNumber()).toEqual(68);
3939
expect(extrinsic.tip.toHuman()).toEqual('30.0000 mUnit');
4040
expect(extrinsic.callIndex).toEqual(new Uint8Array([6, 0]));
41-
expect(extrinsic.args[0].toHex()).toEqual('0xff495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
41+
expect(extrinsic.args[0].toHex()).toEqual('0x00495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
4242
expect(extrinsic.args[1].toHuman()).toEqual('104.5609 Unit');
4343
});
4444
});

packages/types/src/extrinsic/SignerPayload.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('SignerPayload', (): void => {
1919
blockNumber: '0x00231d30',
2020
era: '0x0703',
2121
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
22-
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
22+
method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
2323
nonce: '0x00001234',
2424
signedExtensions: ['CheckNonce', 'CheckWeight'],
2525
specVersion: '0x00000006',
@@ -36,7 +36,7 @@ describe('SignerPayload', (): void => {
3636
blockNumber: '0x231d30',
3737
era: registry.createType('ExtrinsicEra', { current: 2301232, period: 200 }),
3838
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
39-
method: registry.createType('Call', '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
39+
method: registry.createType('Call', '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
4040
nonce: 0x1234,
4141
signedExtensions: ['CheckNonce'],
4242
tip: 0x5678,
@@ -48,7 +48,7 @@ describe('SignerPayload', (): void => {
4848
blockNumber: '0x00231d30',
4949
era: '0x0703',
5050
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
51-
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
51+
method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
5252
nonce: '0x00001234',
5353
signedExtensions: ['CheckNonce'],
5454
specVersion: '0x00000000',

packages/types/src/extrinsic/v4/ExtrinsicSignature.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('ExtrinsicSignatureV4', (): void => {
3232

3333
const u8a = new Uint8Array([
3434
// signer as an AccountIndex
35-
0x09,
35+
0x01, 0x08, // 4 << 2
3636
// signature type
3737
0x01,
3838
// signature
@@ -65,7 +65,7 @@ describe('ExtrinsicSignatureV4', (): void => {
6565
).toHex()
6666
).toEqual(
6767
'0x' +
68-
'ff' +
68+
'00' + // MultiAddress
6969
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
7070
'01' +
7171
'4242424242424242424242424242424242424242424242424242424242424242' +
@@ -93,7 +93,7 @@ describe('ExtrinsicSignatureV4', (): void => {
9393
).toEqual(
9494
'0x' +
9595
// Address = AccountId
96-
// 'ff' +
96+
// '00' +
9797
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
9898
// This is a prefix-less signature, anySignture as opposed to Multi above
9999
// '01' +

packages/types/src/generic/Call.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ describe('Call', (): void => {
1919
args: [],
2020
callIndex: [6, 1] // balances.setBalance
2121
}).toU8a()
22-
).toEqual(new Uint8Array([6, 1, 0, 0, 0]));
22+
).toEqual(
23+
new Uint8Array([6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
24+
);
2325
});
2426

2527
it('handles creation from a hex value properly', (): void => {
2628
expect(
2729
new Call(registry, '0x0601').toU8a()
28-
).toEqual(new Uint8Array([6, 1, 0, 0, 0])); // balances.setBalance
30+
).toEqual(
31+
new Uint8Array([6, 1, 1, 110, 7, 17, 0, 0, 0])
32+
); // balances.setBalance
2933
});
3034
});

0 commit comments

Comments
 (0)