Skip to content
Merged
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
5 changes: 0 additions & 5 deletions helpers/api/extrinsics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AccountInfo } from '@polkadot/types/interfaces'
import { ApiPromise } from '@polkadot/api'
import { SubmittableExtrinsic } from '@polkadot/api-base/types'

export const balance = async (api: ApiPromise, address: string) => {
const account = await api.query.system.account<AccountInfo>(address)
Expand Down Expand Up @@ -358,7 +357,3 @@ export const xTokensTransferMulticurrenciesV3 = (
'Unlimited',
)
}

export const sudo = (api: ApiPromise, call: SubmittableExtrinsic<'promise'>) => {
return api.tx.sudo.sudo(call)
}
7 changes: 2 additions & 5 deletions networks/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export type Vars = {
export default {
polkadot: {
name: 'astar' as const,
endpoint: ['wss://rpc.astar.network', 'wss://astar-rpc.dwellir.com'],
endpoint: ['wss://rpc.astar.network', 'wss://astar-rpc.n.dwellir.com'],
relayToken: '340282366920938463463374607431768211455',
},
kusama: {
name: 'shiden' as const,
endpoint: ['wss://rpc.shiden.astar.network', 'wss://shiden-rpc.dwellir.com'],
endpoint: ['wss://rpc.shiden.astar.network', 'wss://shiden-rpc.n.dwellir.com'],
relayToken: '340282366920938463463374607431768211455',
},
config: ({ alice, relayToken }) => ({
Expand All @@ -26,9 +26,6 @@ export default {
Assets: {
account: [[[relayToken, alice.address], { balance: 10n * 10n ** 12n }]],
},
Sudo: {
key: alice.address,
},
PolkadotXcm: {
// avoid sending xcm version change notifications to makes things faster
$removePrefix: ['versionNotifyTargets', 'versionNotifiers'],
Expand Down
4 changes: 2 additions & 2 deletions networks/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Config } from './types'
export default {
polkadot: {
name: 'polkadot' as const,
endpoint: ['wss://rpc.polkadot.io', 'wss://polkadot-rpc.dwellir.com'],
endpoint: ['wss://rpc.ibp.network/polkadot', 'wss://polkadot-rpc.n.dwellir.com'],
},
kusama: {
name: 'kusama' as const,
endpoint: ['wss://kusama-rpc.polkadot.io', 'wss://kusama-rpc.dwellir.com'],
endpoint: ['wss://rpc.ibp.network/kusama', 'wss://kusama-rpc.n.dwellir.com'],
},
config: ({ alice }) => ({
storages: {
Expand Down
4 changes: 2 additions & 2 deletions networks/statemint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Config } from './types'
export default {
polkadot: {
name: 'statemint' as const,
endpoint: 'wss://polkadot-asset-hub-rpc.polkadot.io',
endpoint: 'wss://asset-hub-polkadot-rpc.n.dwellir.com',
},
kusama: {
name: 'assethub' as const,
endpoint: 'wss://kusama-asset-hub-rpc.polkadot.io',
endpoint: 'wss://asset-hub-kusama-rpc.n.dwellir.com',
},
config: ({ alice }) => ({
storages: {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"update-env": "tsx scripts/update-env.ts"
},
"dependencies": {
"@acala-network/chopsticks": "^1.2.2",
"@acala-network/chopsticks-testing": "^1.2.2",
"@acala-network/chopsticks": "^1.2.3",
"@acala-network/chopsticks-testing": "^1.2.3",
"@polkadot/api": "^16.4.5",
"@swc/core": "^1.13.5",
"axios": "^1.11.0",
Expand Down
8 changes: 8 additions & 0 deletions tests/staking/inflation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ given('astar')('Reward payouts based on inflation (decayed)', async ({ networks:
}

const targetBlockHeight = currentBlock + remainingBlocks

// Set the current block number in storage to be exactly 1 less than target
// This satisfies the runtime's assertion: current_block + 1 == new_block
await astar.dev.setStorage({
system: {
number: targetBlockHeight - 1,
},
})
await astar.dev.newBlock({ count: 1, unsafeBlockHeight: targetBlockHeight })
Comment on lines +50 to 57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that .newBlock doesn't handle this update since it will fail otherwise (except if advancing to the next consecutive block).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, even when using the latest chopstick version. The new assert check in the frame system code is new (1month old) and the issue is happening when using unsafeBlockHeight so maybe it has not been patched yet? I will consider open an issue later to flag it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newBlock doesn't handle it because there's no assertion, or at least there was not

}

Expand Down
11 changes: 10 additions & 1 deletion tests/staking/tier-threshold.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ const calculateNumberOfSlots = (slotsPerTier: u16[]): number => {
given('astar')('Number of slots adjusted based on price', async ({ networks: { astar } }) => {
const advanceNextEra = async () => {
const state = await astar.api.query.dappStaking.activeProtocolState<any>()
await astar.dev.newBlock({ count: 1, unsafeBlockHeight: state.nextEraStart.toNumber() })
const targetBlock = state.nextEraStart.toNumber()

// Set the current block number in storage to be exactly 1 less than target
// This satisfies the runtime's assertion: current_block + 1 == new_block
await astar.dev.setStorage({
system: {
number: targetBlock - 1,
},
})
await astar.dev.newBlock({ count: 1, unsafeBlockHeight: targetBlock })
}

const palletVersion = (await astar.api.query.dappStaking.palletVersion<u16>()).toNumber()
Expand Down
Loading