Skip to content

Commit

Permalink
Fix empty withdrawals logic pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed May 3, 2023
1 parent fe9c880 commit 0b299fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/blockchain/src/db/manager.ts
Expand Up @@ -115,8 +115,11 @@ export class DBManager {
// If this block had empty withdrawals push an empty array in body
if (header.withdrawalsRoot !== undefined) {
// Do extra validations for withdrawal before assuming empty withdrawals
if (!equalsBytes(header.withdrawalsRoot, KECCAK256_RLP)) {
throw new Error('withdrawals root shoot be equal to hash of null')
if (
!equalsBytes(header.withdrawalsRoot, KECCAK256_RLP) &&
(body.length !== 3 || body[2]?.length === 0)
) {
throw new Error('withdrawals root shoot be equal to hash of null when no withdrawals')

Check warning on line 122 in packages/blockchain/src/db/manager.ts

View check run for this annotation

Codecov / codecov/patch

packages/blockchain/src/db/manager.ts#L118-L122

Added lines #L118 - L122 were not covered by tests
}
if (body.length !== 3) body.push([])

Check warning on line 124 in packages/blockchain/src/db/manager.ts

View check run for this annotation

Codecov / codecov/patch

packages/blockchain/src/db/manager.ts#L124

Added line #L124 was not covered by tests
}
Expand Down

1 comment on commit 0b299fc

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 0b299fc Previous: c9b0a45 Ratio
Block 9422905 7040 ops/sec (±2.93%) 16231 ops/sec (±2.19%) 2.31
Block 9422906 6990 ops/sec (±3.45%) 15484 ops/sec (±4.00%) 2.22
Block 9422907 6839 ops/sec (±2.56%) 16302 ops/sec (±1.39%) 2.38
Block 9422908 6760 ops/sec (±5.73%) 15689 ops/sec (±1.70%) 2.32
Block 9422910 6936 ops/sec (±2.26%) 14940 ops/sec (±5.00%) 2.15

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.