Skip to content

Commit

Permalink
fix browser undefined (#430)
Browse files Browse the repository at this point in the history
* fix browser undefined

* fix test

* fix test

* fix
  • Loading branch information
ermalkaleci authored Oct 10, 2023
1 parent 856c16a commit 94a7a87
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
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'
? (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

0 comments on commit 94a7a87

Please sign in to comment.