Skip to content

Commit

Permalink
fix run block (#603)
Browse files Browse the repository at this point in the history
* fix run block

* fix

* fmt
  • Loading branch information
xlc committed Dec 23, 2023
1 parent 95671b9 commit d09a6ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/chopsticks/src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const getZodType = (option: ZodTypeAny) => {
default:
break
}
if (option._def.innerType) {
return getZodType(option._def.innerType)
if (option._def.innerType ?? option._def.left) {
return getZodType(option._def.innerType ?? option._def.left)
}
return undefined
}
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/src/schema/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ it('get yargs options from zod schema', () => {
"choices": undefined,
"demandOption": false,
"description": "Block hash or block number. Default to latest block",
"type": "number",
"type": "string",
},
"build-block-mode": {
"choices": [
Expand Down Expand Up @@ -84,7 +84,7 @@ it('get yargs options from zod schema', () => {
"choices": undefined,
"demandOption": false,
"description": "Resume from the specified block hash or block number in db. If true, it will resume from the latest block in db. Note this will override the block option",
"type": "number",
"type": "string",
},
"runtime-log-level": {
"choices": undefined,
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { pino } from 'pino'

export const defaultLogger = pino({
export const pinoLogger = pino({
level: (typeof process === 'object' && process.env.LOG_LEVEL) || 'info',
transport: {
target: 'pino-pretty',
},
})

export const defaultLogger = pinoLogger.child({ app: 'chopsticks' })

const innerTruncate =
(level = 0) =>
(val: any) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export type SetupOptions = {
}

export const setup = async (options: SetupOptions) => {
defaultLogger.debug(options, 'Setup options')

let provider: ProviderInterface
if (options.genesis) {
provider = options.genesis
Expand Down

0 comments on commit d09a6ff

Please sign in to comment.