Skip to content
Closed
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
40 changes: 24 additions & 16 deletions packages/networks/src/chains/assethub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineChain } from '../defineChain.js'

const custom = {
assetHubPolkadot: {
units: 1e10,
dot: { Concrete: { parents: 1, interior: 'Here' } },
usdt: { Concrete: { parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 1984 }] } } },
usdtIndex: 1984,
Expand All @@ -22,6 +23,7 @@ const custom = {
},
},
assetHubKusama: {
units: 1e10,
ksm: { Concrete: { parents: 1, interior: 'Here' } },
usdt: { Concrete: { parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 1984 }] } } },
usdtIndex: 1984,
Expand All @@ -41,6 +43,7 @@ const custom = {
},
},
assetHubWestend: {
units: 1e12,
wnd: { Concrete: { parents: 1, interior: 'Here' } },
usdt: { Concrete: { parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 1984 }] } } },
usdtIndex: 1984,
Expand All @@ -55,22 +58,27 @@ const accountList = [

const getInitStorages = (
config: typeof custom.assetHubPolkadot | typeof custom.assetHubKusama | typeof custom.assetHubWestend,
) => ({
System: {
account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: 1000e10 } }],
],
},
Assets: {
account: [
[[config.usdtIndex, defaultAccounts.alice.address], { balance: 1000e6 }], // USDT
],
},
ForeignAssets: {
account: config.eth ? accountList : [],
},
})
) => {
const baseAmount = 1000
const amount = BigInt(baseAmount) * BigInt(config.units)

return {
System: {
account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: amount } }],
],
},
Assets: {
account: [
[[config.usdtIndex, defaultAccounts.alice.address], { balance: 1000e6 }], // USDT
],
},
ForeignAssets: {
account: config.eth ? accountList : [],
},
}
}

export const assetHubPolkadot = defineChain({
name: 'assetHubPolkadot',
Expand Down
15 changes: 14 additions & 1 deletion packages/networks/src/chains/bridgehub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ const custom = {
bridgeHubKusama: {
ksm: { Concrete: { parents: 1, interior: 'Here' } },
},
bridgeHubWestend: {
wnd: { Concrete: { parents: 1, interior: 'Here' } },
},
}

const getInitStorages = (_config: typeof custom.bridgeHubPolkadot | typeof custom.bridgeHubKusama) => ({
const getInitStorages = (
_config: typeof custom.bridgeHubPolkadot | typeof custom.bridgeHubKusama | typeof custom.bridgeHubWestend,
) => ({
System: {
account: [[[defaultAccounts.alice.address], { providers: 1, data: { free: 1000e10 } }]],
},
Expand All @@ -31,3 +36,11 @@ export const bridgeHubKusama = defineChain({
custom: custom.bridgeHubKusama,
initStorages: getInitStorages(custom.bridgeHubKusama),
})

export const bridgeHubWestend = defineChain({
name: 'bridgeHubWestend',
endpoint: 'wss://westend-bridge-hub-rpc.polkadot.io',
paraId: 1002,
custom: custom.bridgeHubWestend,
initStorages: getInitStorages(custom.bridgeHubWestend),
})
25 changes: 16 additions & 9 deletions packages/networks/src/chains/collectives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@ import { defineChain } from '../defineChain.js'

const custom = {
collectivesPolkadot: {
units: 1e10,
dot: { Concrete: { parents: 1, interior: 'Here' } },
},
collectivesWestend: {
units: 1e12,
wnd: { Concrete: { parents: 1, interior: 'Here' } },
},
}

const getInitStorages = (_config: typeof custom.collectivesPolkadot | typeof custom.collectivesWestend) => ({
System: {
account: [
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccounts.alice.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccounts.bob.address], { providers: 1, data: { free: 1000e10 } }],
],
},
})
const getInitStorages = (config: typeof custom.collectivesPolkadot | typeof custom.collectivesWestend) => {
const baseAmount = 1000
const amount = BigInt(baseAmount) * BigInt(config.units)

return {
System: {
account: [
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccounts.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccounts.bob.address], { providers: 1, data: { free: amount } }],
],
},
}
}

export const collectivesPolkadot = defineChain({
name: 'collectivesPolkadot',
Expand Down
37 changes: 29 additions & 8 deletions packages/networks/src/chains/coretime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,34 @@ import { defineChain } from '../defineChain.js'

const custom = {
coretimePolkadot: {
units: 1e10,
dot: { Concrete: { parents: 1, interior: 'Here' } },
},
coretimeKusama: {
units: 1e10,
ksm: { Concrete: { parents: 1, interior: 'Here' } },
},
coretimeWestend: {
units: 1e12,
wnd: { Concrete: { parents: 1, interior: 'Here' } },
},
}

const getInitStorages = (_config: typeof custom.coretimePolkadot | typeof custom.coretimeKusama) => ({
System: {
account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: 1000e10 } }],
],
},
})
const getInitStorages = (
config: typeof custom.coretimePolkadot | typeof custom.coretimeKusama | typeof custom.coretimeWestend,
) => {
const baseAmount = 1000
const amount = BigInt(baseAmount) * BigInt(config.units)

return {
System: {
account: [
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccounts.alice.address], { providers: 1, data: { free: amount } }],
],
},
}
}

export const coretimePolkadot = defineChain({
name: 'coretimePolkadot',
Expand All @@ -34,3 +47,11 @@ export const coretimeKusama = defineChain({
custom: custom.coretimeKusama,
initStorages: getInitStorages(custom.coretimeKusama),
})

export const coretimeWestend = defineChain({
name: 'coretimeWestend',
endpoint: 'wss://westend-coretime-rpc.polkadot.io',
paraId: 1005,
custom: custom.coretimeWestend,
initStorages: getInitStorages(custom.coretimeWestend),
})
49 changes: 35 additions & 14 deletions packages/networks/src/chains/people.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ import { defineChain } from '../defineChain.js'

const custom = {
peoplePolkadot: {
units: 1e10,
dot: { Concrete: { parents: 1, interior: 'Here' } },
},
peopleKusama: {
units: 1e10,
ksm: { Concrete: { parents: 1, interior: 'Here' } },
},
peopleWestend: {
units: 1e12,
wnd: { Concrete: { parents: 1, interior: 'Here' } },
},
}

const aliceRegistrar = {
Expand All @@ -22,20 +28,27 @@ const bobRegistrar = {
fields: 0,
}

const getInitStorages = (_config: typeof custom.peoplePolkadot | typeof custom.peopleKusama) => ({
System: {
account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccounts.bob.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: 1000e10 } }],
[[defaultAccountsSr25519.bob.address], { providers: 1, data: { free: 1000e10 } }],
],
},
// Registrars to be used in E2E tests - required to test `RegistrarOrigin`-locked extrinsics.
Identity: {
Registrars: [aliceRegistrar, bobRegistrar],
},
})
const getInitStorages = (
config: typeof custom.peoplePolkadot | typeof custom.peopleKusama | typeof custom.peopleWestend,
) => {
const baseAmount = 1000
const amount = BigInt(baseAmount) * BigInt(config.units)

return {
System: {
account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccounts.bob.address], { providers: 1, data: { free: amount } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccountsSr25519.bob.address], { providers: 1, data: { free: amount } }],
],
},
// Registrars to be used in E2E tests - required to test `RegistrarOrigin`-locked extrinsics.
Identity: {
Registrars: [aliceRegistrar, bobRegistrar],
},
}
}

export const peoplePolkadot = defineChain({
name: 'peoplePolkadot',
Expand All @@ -52,3 +65,11 @@ export const peopleKusama = defineChain({
custom: custom.peopleKusama,
initStorages: getInitStorages(custom.peopleKusama),
})

export const peopleWestend = defineChain({
name: 'peopleWestend',
endpoint: 'wss://westend-people-rpc.polkadot.io',
paraId: 1004,
custom: custom.peopleWestend,
initStorages: getInitStorages(custom.peopleWestend),
})
46 changes: 27 additions & 19 deletions packages/networks/src/chains/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,61 @@ import { defineChain } from '../defineChain.js'

const custom = {
polkadot: {
units: 1e10,
dot: { Concrete: { parents: 0, interior: 'Here' } },
},
kusama: {
units: 1e10,
ksm: { Concrete: { parents: 0, interior: 'Here' } },
},
westend: {
units: 1e12,
wnd: { Concrete: { parents: 0, interior: 'Here' } },
},
}

const getInitStorages = () => ({
System: {
Account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: 1000 * 1e10 } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: 1000 * 1e10 } }],
],
},
ParasDisputes: {
// these can makes block building super slow
$removePrefix: ['disputes'],
},
Dmp: {
// clear existing dmp to avoid impacting test result
$removePrefix: ['downwardMessageQueues'],
},
})
const getInitStorages = (config: typeof custom.polkadot | typeof custom.kusama | typeof custom.westend) => {
const baseAmount = 1000
const amount = BigInt(baseAmount) * BigInt(config.units)

return {
System: {
Account: [
[[defaultAccounts.alice.address], { providers: 1, data: { free: amount } }],
[[defaultAccountsSr25519.alice.address], { providers: 1, data: { free: amount } }],
],
},
ParasDisputes: {
// these can makes block building super slow
$removePrefix: ['disputes'],
},
Dmp: {
// clear existing dmp to avoid impacting test result
$removePrefix: ['downwardMessageQueues'],
},
}
}

export const polkadot = defineChain({
name: 'polkadot',
endpoint: 'wss://rpc.ibp.network/polkadot',
custom: custom.polkadot,
initStorages: getInitStorages(),
initStorages: getInitStorages(custom.polkadot),
isRelayChain: true,
})

export const kusama = defineChain({
name: 'kusama',
endpoint: 'wss://rpc.ibp.network/kusama',
custom: custom.kusama,
initStorages: getInitStorages(),
initStorages: getInitStorages(custom.kusama),
isRelayChain: true,
})

export const westend = defineChain({
name: 'westend',
endpoint: 'wss://rpc.ibp.network/westend',
custom: custom.westend,
initStorages: getInitStorages(),
initStorages: getInitStorages(custom.westend),
isRelayChain: true,
})
8 changes: 4 additions & 4 deletions packages/shared/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export async function authorizeUpgradeViaCollectives(
await checkEvents(noteEvents, 'preimage').toMatchSnapshot('events after notePreimge')

// try to dispatch a call that has not yet been whitelisted - should result in dispatching error
await scheduleInlineCallWithOrigin(governingChain, whiteListCall.method.toHex(), okOrigin)
await scheduleInlineCallWithOrigin(governingChain, whiteListCall.method.toHex(), okOrigin, 'SysPara')
await governingChain.dev.newBlock()
await checkSystemEvents(governingChain, 'scheduler')
.redact({ hash: false, redactKeys: /task/ })
Expand All @@ -116,7 +116,7 @@ export async function authorizeUpgradeViaCollectives(
refTime: '500000000',
})
await collectivesChain.dev.newBlock()
await checkSystemEvents(collectivesChain, 'polkadotXcm')
await checkSystemEvents(collectivesChain, { method: 'Sent', section: 'polkadotXcm' })
.redact({ hash: false, redactKeys: /messageId/ })
.toMatchSnapshot('collectives events emitted when sending xcm')
await governingChain.dev.newBlock()
Expand All @@ -125,15 +125,15 @@ export async function authorizeUpgradeViaCollectives(
.toMatchSnapshot('governing chain events emitted on receiving xcm from collectives')

// trying to dispatch whitelisted call using bad origin - should result in error
await scheduleInlineCallWithOrigin(governingChain, whiteListCall.method.toHex(), badOrigin)
await scheduleInlineCallWithOrigin(governingChain, whiteListCall.method.toHex(), badOrigin, 'SysPara')
await governingChain.dev.newBlock()
await checkSystemEvents(governingChain, 'scheduler')
.redact({ hash: false, redactKeys: /task/ })
.toMatchSnapshot('events when dispatching whitelisted call with bad origin')
await assertAuthorizedUpgradeUnchanged()

// call is whitelisted, origin is ok - success expected
await scheduleInlineCallWithOrigin(governingChain, whiteListCall.method.toHex(), okOrigin)
await scheduleInlineCallWithOrigin(governingChain, whiteListCall.method.toHex(), okOrigin, 'SysPara')
await governingChain.dev.newBlock()
await checkSystemEvents(governingChain, 'whitelist')
.redact({ hash: false })
Expand Down
Loading