Skip to content

Commit

Permalink
Fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Sep 29, 2022
1 parent 55e0380 commit 1cf6ed1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/common/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ export class Common extends EventEmitter {
// all hardforks apply, set hfIndex to the last one as thats the candidate
hfIndex = hfs.length - 1
} else if (hfIndex === 0) {
// Cant move back, ideally we should throw??
throw Error('No hardfork qualitifies')
// cannot have a case where a block number is before all applied hardforks
// since the chain has to start with a hardfork
throw Error('Must have at least one hardfork at block 0')
} else {
// The previous hardfork is the candidate here
hfIndex = hfIndex - 1
Expand Down
2 changes: 1 addition & 1 deletion packages/common/tests/hardforks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {

try {
c.getHardforkByBlockNumber(0)
t.fail('should have thrown since no hardfork should quality')
t.fail('should have thrown since no hardfork should qualify')
} catch (e) {
t.pass('throw since no hardfork qualifies')
}
Expand Down

1 comment on commit 1cf6ed1

@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: 1cf6ed1 Previous: 88bd15d Ratio
Block 9422908 9098 ops/sec (±2.82%) 18473 ops/sec (±1.63%) 2.03

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

Please sign in to comment.