Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix browser undefined #430

Merged
merged 4 commits into from
Oct 10, 2023
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
2 changes: 1 addition & 1 deletion packages/core/src/blockchain/block-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export const buildBlock = async (

const storageDiff = await newBlock.storageDiff()

if (logger.isLevelEnabled('trace')) {
if (logger.level.toLowerCase() === 'trace') {
logger.trace(
Object.entries(storageDiff).map(([key, value]) => [key, truncate(value)]),
'Final block',
Expand Down
27 changes: 14 additions & 13 deletions packages/core/src/blockchain/txpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,21 @@ export class TxPool {
onApplyExtrinsicError: (extrinsic, error) => {
this.event.emit(APPLY_EXTRINSIC_ERROR, [extrinsic, error])
},
onPhaseApplied: logger.isLevelEnabled('trace')
? (phase, resp) => {
switch (phase) {
case 'initialize':
logger.trace(truncate(resp.storageDiff), 'Initialize block')
break
case 'finalize':
logger.trace(truncate(resp.storageDiff), 'Finalize block')
break
default:
logger.trace(truncate(resp.storageDiff), `Apply extrinsic ${phase}`)
onPhaseApplied:
logger.level.toLowerCase() === 'trace'
Copy link
Member

Choose a reason for hiding this comment

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

that's fine for trace, but not for other logging levels. still need to figure out why isLevelEnabled is not supported on browser

? (phase, resp) => {
switch (phase) {
case 'initialize':
logger.trace(truncate(resp.storageDiff), 'Initialize block')
break
case 'finalize':
logger.trace(truncate(resp.storageDiff), 'Finalize block')
break
default:
logger.trace(truncate(resp.storageDiff), `Apply extrinsic ${phase}`)
}
}
}
: undefined,
: undefined,
},
params.unsafeBlockHeight,
)
Expand Down
3 changes: 0 additions & 3 deletions packages/web-test/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ test.describe('index', () => {
await expect(page.locator('#blocks-section')).toHaveText(/4000000/, { timeout: 60_000 })
// wait for new block
await expect(page.locator('#blocks-section')).toHaveText(/4000001/, { timeout: 200_000 })
})

test('dry run extrinsics', async ({ page }) => {
test.setTimeout(5 * 60 * 1000)
await page.getByText(/dry run call/i).click()
await expect(page.getByText('Loading dry run result...')).toBeVisible()
await expect(page.locator('#extrinsic-section')).toHaveText(/outcome/, { timeout: 200_000 })
Expand Down