Skip to content

Commit

Permalink
bump deps and some linter fixes (#851)
Browse files Browse the repository at this point in the history
* bump deps

* bump some deps

* more bumps

* more bumps

* use a working version
  • Loading branch information
xlc authored Oct 31, 2024
1 parent a656f75 commit 2ced6bc
Show file tree
Hide file tree
Showing 20 changed files with 2,365 additions and 2,232 deletions.
8 changes: 4 additions & 4 deletions executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"build": "yarn wasm && ./package.sh"
},
"dependencies": {
"@polkadot/util": "^13.0.2",
"@polkadot/wasm-util": "^7.3.2"
"@polkadot/util": "^13.2.2",
"@polkadot/wasm-util": "^7.4.1"
},
"devDependencies": {
"@swc/cli": "0.4.0",
"@swc/core": "^1.7.6",
"@swc/cli": "0.5.0",
"@swc/core": "^1.7.40",
"fflate": "^0.8.2"
},
"files": [
Expand Down
49 changes: 30 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
"packages/*",
"executor"
],
"resolutions": {
"@polkadot/api": "14.0.1",
"@polkadot/types": "14.0.1",
"@polkadot/api-base": "14.0.1",
"@polkadot/api-derive": "14.0.1",
"@polkadot/api-augment": "14.0.1",
"@polkadot/rpc-provider": "14.0.1",
"@polkadot/types-codec": "14.0.1",
"@polkadot/types-create": "14.0.1",
"@polkadot/types-known": "14.0.1"
},
"scripts": {
"lint": "tsc --noEmit --project tsconfig.lint.json && eslint . --ext .js,.ts && prettier --check .",
"fix": "eslint . --ext .js,.ts --fix && prettier -w .",
Expand Down Expand Up @@ -44,28 +55,28 @@
"*.{js,ts,css,md}": "prettier --write"
},
"devDependencies": {
"@swc/core": "^1.7.6",
"@types/node": "^20.14.9",
"@swc/core": "^1.7.40",
"@types/node": "^22.8.4",
"@types/prettier": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@vitest/coverage-v8": "^1.4.0",
"@vitest/ui": "^1.4.0",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"@vitest/coverage-v8": "^2.1.4",
"@vitest/ui": "^2.1.4",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"husky": "^8.0.3",
"prettier": "^3.3.2",
"husky": "^9.1.6",
"prettier": "^3.3.3",
"ts-node": "^10.9.2",
"typedoc": "^0.25.12",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.5.3",
"unplugin-swc": "^1.4.4",
"vite-tsconfig-paths": "^4.3.2",
"vitepress": "^1.0.1",
"vitest": "^1.4.0",
"wasm-pack": "^0.13.0"
"typedoc": "^0.26.10",
"typedoc-plugin-markdown": "^4.2.9",
"typescript": "^5.6.3",
"unplugin-swc": "^1.5.1",
"vite-tsconfig-paths": "^5.0.1",
"vitepress": "^1.4.2",
"vitest": "^2.1.4",
"wasm-pack": "^0.13.1"
}
}
34 changes: 17 additions & 17 deletions packages/chopsticks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@
"dependencies": {
"@acala-network/chopsticks-core": "workspace:*",
"@acala-network/chopsticks-db": "workspace:*",
"@pnpm/npm-conf": "^2.2.2",
"@polkadot/api": "^12.3.1",
"@polkadot/api-augment": "^12.3.1",
"@polkadot/rpc-provider": "^12.3.1",
"@polkadot/types": "^12.3.1",
"@polkadot/util": "^13.0.2",
"@polkadot/util-crypto": "^13.0.2",
"axios": "^1.7.4",
"@pnpm/npm-conf": "^2.3.1",
"@polkadot/api": "^14.0.1",
"@polkadot/api-augment": "^14.0.1",
"@polkadot/rpc-provider": "^14.0.1",
"@polkadot/types": "^14.0.1",
"@polkadot/util": "^13.2.2",
"@polkadot/util-crypto": "^13.2.2",
"axios": "^1.7.7",
"comlink": "^4.4.1",
"dotenv": "^16.4.5",
"global-agent": "^3.0.0",
"js-yaml": "^4.1.0",
"jsondiffpatch": "^0.5.0",
"lodash": "^4.17.21",
"ws": "^8.17.1",
"ws": "^8.18.0",
"yargs": "^17.7.2",
"zod": "^3.22.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@swc/cli": "0.4.0",
"@swc/core": "^1.7.6",
"@swc/cli": "0.5.0",
"@swc/core": "^1.7.40",
"@types/global-agent": "^2.1.3",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.9",
"@types/ws": "^8.5.10",
"@types/yargs": "^17.0.32",
"typescript": "^5.5.3"
"@types/lodash": "^4.17.13",
"@types/node": "^22.8.4",
"@types/ws": "^8.5.12",
"@types/yargs": "^17.0.33",
"typescript": "^5.6.3"
},
"files": [
"dist/esm/**",
Expand Down
4 changes: 3 additions & 1 deletion packages/chopsticks/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export const setupContext = async (argv: Config, overrideParent = false) => {

if (blockData) {
const block = await chain.loadBlockFromDB(blockData.number)
block && (await chain.setHead(block))
if (block) {
await chain.setHead(block)
}
logger.info(`Resume from block ${blockData.number}, hash: ${blockData.hash}`)
} else {
throw new Error(`Resume failed. Cannot find block ${argv.resume}`)
Expand Down
13 changes: 6 additions & 7 deletions packages/chopsticks/src/plugins/follow-chain/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ export const cli = (y: Argv) => {
(yargs) => yargs.options(getYargsOptions(schema.shape)),
async (argv) => {
const config = schema.parse(argv)
Array.isArray(config.endpoint)
? config.endpoint
: [config.endpoint || ''].forEach((endpoint) => {
if (/^(https|http):\/\//.test(endpoint)) {
throw Error('http provider is not supported')
}
})
const endpoints = Array.isArray(config.endpoint) ? config.endpoint : [config.endpoint ?? '']
for (const endpoint of endpoints) {
if (/^(https|http):\/\//.test(endpoint)) {
throw Error('http provider is not supported')
}
}

const context = await setupContext(config, true)
const { close, addr } = await createServer(handler(context), config.port, config.host)
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const loadRpcMethodsByScripts = async (path: string) => {
rpcScriptMethods = new Function(scriptContent)()
logger.info(`${Object.keys(rpcScriptMethods).length} extension rpc methods loaded from ${path}`)
} catch (error) {
console.log('Failed to load rpc extension methods')
console.log('Failed to load rpc extension methods', error)
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/schema/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Parsed options', () => {

expect(() =>
configSchema.parse({
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
// eslint-disable-next-line no-loss-of-precision
block: 0xb10f03bbc183da4d26e27528d28f6a73ddaf182fb6400ca363b77d2411ea5b0c,
}),
).toThrowError(/you are using a hex string/)
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Handler = (
const parseRequest = (request: string) => {
try {
return JSON.parse(request)
} catch (e) {
} catch (_e) {
return undefined
}
}
Expand Down
30 changes: 15 additions & 15 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
},
"dependencies": {
"@acala-network/chopsticks-executor": "workspace:*",
"@polkadot/rpc-provider": "^12.3.1",
"@polkadot/types": "^12.3.1",
"@polkadot/types-codec": "^12.3.1",
"@polkadot/types-known": "^12.3.1",
"@polkadot/util": "^13.0.2",
"@polkadot/util-crypto": "^13.0.2",
"@polkadot/rpc-provider": "^14.0.1",
"@polkadot/types": "^14.0.1",
"@polkadot/types-codec": "^14.0.1",
"@polkadot/types-known": "^14.0.1",
"@polkadot/util": "^13.2.2",
"@polkadot/util-crypto": "^13.2.2",
"comlink": "^4.4.1",
"eventemitter3": "^5.0.1",
"lodash": "^4.17.21",
"lru-cache": "^10.2.0",
"pino": "^8.19.0",
"pino-pretty": "^11.0.0",
"lru-cache": "^11.0.1",
"pino": "^9.5.0",
"pino-pretty": "^11.3.0",
"rxjs": "^7.8.1",
"zod": "^3.22.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@swc/cli": "0.4.0",
"@swc/core": "^1.7.6",
"@types/lodash": "^4.17.6",
"typescript": "^5.5.3",
"vitest": "^1.4.0"
"@swc/cli": "0.5.0",
"@swc/core": "^1.7.40",
"@types/lodash": "^4.17.13",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
"files": [
"dist/esm/**",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/blockchain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ export class Blockchain {
#registerBlock(block: Block) {
// if exceed max memory block count, delete the oldest block
if (this.#blocksByNumber.size === this.#maxMemoryBlockCount) {
const { hash, number }: Block = this.#blocksByNumber.values().next().value
// #blocksByNumber can't be empty so the force unwrap is safe
const { hash, number }: Block = this.#blocksByNumber.values().next().value!
this.#blocksByNumber.delete(number)
this.#blocksByHash.delete(hash)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const isUrl = (url: string) => {
try {
new URL(url)
return true
} catch (e) {
} catch (_e) {
return false
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
},
"dependencies": {
"@acala-network/chopsticks-core": "workspace:*",
"@polkadot/util": "^13.0.2",
"@polkadot/util": "^13.2.2",
"idb": "^8.0.0",
"sqlite3": "^5.1.7",
"typeorm": "^0.3.20"
},
"devDependencies": {
"@swc/cli": "0.4.0",
"@swc/core": "^1.7.6",
"typescript": "^5.5.3"
"@swc/cli": "0.5.0",
"@swc/core": "^1.7.40",
"typescript": "^5.6.3"
},
"files": [
"dist/esm/**",
Expand Down
12 changes: 6 additions & 6 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"devDependencies": {
"@acala-network/chopsticks": "workspace:*",
"@acala-network/chopsticks-testing": "workspace:*",
"@polkadot-api/observable-client": "^0.5.3",
"@polkadot-api/substrate-client": "^0.2.1",
"@polkadot-api/ws-provider": "^0.2.0",
"@polkadot/api": "^12.3.1",
"@polkadot-api/observable-client": "^0.5.14",
"@polkadot-api/substrate-client": "^0.2.2",
"@polkadot-api/ws-provider": "^0.3.2",
"@polkadot/api": "^14.0.1",
"rxjs": "^7.8.1",
"typescript": "^5.5.3",
"vitest": "^1.4.0"
"typescript": "^5.6.3",
"vitest": "^2.1.4"
}
}
8 changes: 6 additions & 2 deletions packages/e2e/src/build-block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ describe.runIf(process.env.CI || process.env.RUN_ALL).each([

it('build blocks', { timeout: 300_000, retry: 1 }, async () => {
const { chain, ws, teardown } = await setupPjs()
storage && (await ws.send('dev_setStorage', [storage]))
if (storage) {
await ws.send('dev_setStorage', [storage])
}
const blockNumber = chain.head.number
await ws.send('dev_newBlock', [{ count: 2 }])
expect(chain.head.number).eq(blockNumber + 2)
Expand All @@ -49,7 +51,9 @@ describe.runIf(process.env.CI || process.env.RUN_ALL).each([

it('build block using unsafeBlockHeight', async () => {
const { chain, ws, teardown } = await setupPjs()
storage && (await ws.send('dev_setStorage', [storage]))
if (storage) {
await ws.send('dev_setStorage', [storage])
}
const blockNumber = chain.head.number
const unsafeBlockHeight = blockNumber + 100

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/src/genesis-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe.each([
it('build blocks', async () => {
expect(await dev.newBlock()).toBeTruthy()
const block = await chain.getBlockAt(1)
expect(block).toBeTruthy
expect(block).toBeTruthy()
expect(block?.number).toBe(1)
await check(api.rpc.system.name()).toMatchSnapshot()
})
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ const { check, checkHex, checkSystemEvents } = withExpect(expect)
export { defer, check, checkHex, checkSystemEvents }

export const observe = <T>(observable$: Observable<T>) => {
const next: Mock<[T], void> = vi.fn()
const error: Mock<any, void> = vi.fn()
const complete: Mock<[], void> = vi.fn()
const next: Mock<(t: T) => void> = vi.fn()
const error = vi.fn()
const complete: Mock<() => void> = vi.fn()

const getEmissions = () => next.mock.calls.map((v) => v[0])

Expand Down
10 changes: 5 additions & 5 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"dependencies": {
"@acala-network/chopsticks-utils": "workspace:*",
"@polkadot/api": "^12.3.1",
"@polkadot/types": "^12.3.1"
"@polkadot/api": "^14.0.1",
"@polkadot/types": "^14.0.1"
},
"devDependencies": {
"@swc/cli": "0.4.0",
"@swc/core": "^1.7.6",
"typescript": "^5.5.3"
"@swc/cli": "0.5.0",
"@swc/core": "^1.7.40",
"typescript": "^5.6.3"
},
"files": [
"dist/esm/**",
Expand Down
16 changes: 8 additions & 8 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"dependencies": {
"@acala-network/chopsticks": "workspace:*",
"@acala-network/chopsticks-core": "workspace:*",
"@polkadot/api": "^12.3.1",
"@polkadot/api-base": "^12.3.1",
"@polkadot/keyring": "^13.0.2",
"@polkadot/types": "^12.3.1",
"@polkadot/util": "^13.0.2"
"@polkadot/api": "^14.0.1",
"@polkadot/api-base": "^14.0.1",
"@polkadot/keyring": "^13.2.2",
"@polkadot/types": "^14.0.1",
"@polkadot/util": "^13.2.2"
},
"devDependencies": {
"@swc/cli": "0.4.0",
"@swc/core": "^1.7.6",
"typescript": "^5.5.3"
"@swc/cli": "0.5.0",
"@swc/core": "^1.7.40",
"typescript": "^5.6.3"
},
"files": [
"dist/esm/**",
Expand Down
Loading

0 comments on commit 2ced6bc

Please sign in to comment.