Socket
Socket
Sign inDemoInstall

@ethereumjs/common

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereumjs/common - npm Package Compare versions

Comparing version 3.0.0-rc.1 to 3.0.0

28

dist/common.js

@@ -31,3 +31,3 @@ "use strict";

this._hardfork = this.DEFAULT_HARDFORK;
if ((0, util_1.isTruthy)(opts.hardfork)) {
if (opts.hardfork !== undefined) {
this.setHardfork(opts.hardfork);

@@ -145,3 +145,3 @@ }

}
if ((0, util_1.isTruthy)(initializedChains[chain])) {
if (initializedChains[chain] !== undefined) {
return initializedChains[chain];

@@ -234,3 +234,3 @@ }

}
if (td && (0, util_1.isTruthy)(hf.ttd)) {
if (td && (typeof hf.ttd === 'string' || typeof hf.ttd === 'bigint')) {
if (td >= BigInt(hf.ttd)) {

@@ -247,3 +247,3 @@ minTdHF = hf.name;

let msgAdd = `block number: ${blockNumber} (-> ${hardfork}), `;
if ((0, util_1.isTruthy)(minTdHF)) {
if (minTdHF !== undefined) {
if (!this.hardforkGteHardfork(hardfork, minTdHF)) {

@@ -255,3 +255,3 @@ const msg = 'HF determined by block number is lower than the minimum total difficulty HF';

}
if ((0, util_1.isTruthy)(maxTdHF)) {
if (maxTdHF !== undefined) {
if (!this.hardforkGteHardfork(maxTdHF, hardfork)) {

@@ -309,3 +309,3 @@ const msg = 'Maximum HF determined by total difficulty is lower than the block number HF';

}
if ((0, util_1.isTruthy)(eips_1.EIPs[eip].requiredEIPs)) {
if (eips_1.EIPs[eip].requiredEIPs !== undefined) {
for (const elem of eips_1.EIPs[eip].requiredEIPs) {

@@ -357,3 +357,3 @@ if (!(eips.includes(elem) || this.isActivatedEIP(elem))) {

const valueEIP = this.paramByEIP(topic, name, eip);
value = valueEIP !== undefined ? valueEIP : value;
value = typeof valueEIP === 'bigint' ? valueEIP : value;
}

@@ -363,3 +363,3 @@ // Parameter-inlining HF file (e.g. istanbul.json)

else {
if ((0, util_1.isFalsy)(hfChanges[1][topic])) {
if (hfChanges[1][topic] === undefined) {
throw new Error(`Topic ${topic} not defined`);

@@ -443,3 +443,3 @@ }

const hfBlock = this.hardforkBlock(hardfork);
if ((0, util_1.isTruthy)(hfBlock) && blockNumber >= hfBlock) {
if (typeof hfBlock === 'bigint' && hfBlock !== BigInt(0) && blockNumber >= hfBlock) {
return true;

@@ -539,3 +539,3 @@ }

const block = this.hardforkBlock(hardfork);
return (0, util_1.isTruthy)(block) ? block === blockNumber : false;
return typeof block === 'bigint' && block !== BigInt(0) ? block === blockNumber : false;
}

@@ -734,5 +734,3 @@ /**

}
return (0, util_1.isTruthy)(value)
? value
: this._chainParams['consensus']['algorithm'];
return value ?? this._chainParams['consensus']['algorithm'];
}

@@ -764,5 +762,3 @@ /**

}
return (0, util_1.isTruthy)(value)
? value
: this._chainParams['consensus'][this.consensusAlgorithm()];
return value ?? this._chainParams['consensus'][this.consensusAlgorithm()];
}

@@ -769,0 +765,0 @@ /**

{
"name": "@ethereumjs/common",
"version": "3.0.0-rc.1",
"version": "3.0.0",
"description": "Resources common to all Ethereum implementations",

@@ -51,5 +51,5 @@ "keywords": [

"dependencies": {
"@ethereumjs/util": "8.0.0-rc.1",
"@ethereumjs/util": "^8.0.0",
"crc-32": "^1.2.0"
}
}

@@ -1,2 +0,2 @@

import { TypeOutput, intToBuffer, isFalsy, isTruthy, toType } from '@ethereumjs/util'
import { TypeOutput, intToBuffer, toType } from '@ethereumjs/util'
import { buf as crc32Buffer } from 'crc-32'

@@ -181,3 +181,3 @@ import { EventEmitter } from 'events'

if (isTruthy(initializedChains[chain])) {
if (initializedChains[chain] !== undefined) {
return initializedChains[chain] as ChainConfig

@@ -195,3 +195,3 @@ }

this._hardfork = this.DEFAULT_HARDFORK
if (isTruthy(opts.hardfork)) {
if (opts.hardfork !== undefined) {
this.setHardfork(opts.hardfork)

@@ -290,3 +290,3 @@ }

}
if (td && isTruthy(hf.ttd)) {
if (td && (typeof hf.ttd === 'string' || typeof hf.ttd === 'bigint')) {
if (td >= BigInt(hf.ttd)) {

@@ -302,3 +302,3 @@ minTdHF = hf.name

let msgAdd = `block number: ${blockNumber} (-> ${hardfork}), `
if (isTruthy(minTdHF)) {
if (minTdHF !== undefined) {
if (!this.hardforkGteHardfork(hardfork, minTdHF)) {

@@ -310,3 +310,3 @@ const msg = 'HF determined by block number is lower than the minimum total difficulty HF'

}
if (isTruthy(maxTdHF)) {
if (maxTdHF !== undefined) {
if (!this.hardforkGteHardfork(maxTdHF, hardfork)) {

@@ -368,3 +368,3 @@ const msg = 'Maximum HF determined by total difficulty is lower than the block number HF'

}
if (isTruthy(EIPs[eip].requiredEIPs)) {
if (EIPs[eip].requiredEIPs !== undefined) {
for (const elem of EIPs[eip].requiredEIPs) {

@@ -417,7 +417,7 @@ if (!(eips.includes(elem) || this.isActivatedEIP(elem))) {

const valueEIP = this.paramByEIP(topic, name, eip)
value = valueEIP !== undefined ? valueEIP : value
value = typeof valueEIP === 'bigint' ? valueEIP : value
}
// Parameter-inlining HF file (e.g. istanbul.json)
} else {
if (isFalsy(hfChanges[1][topic])) {
if (hfChanges[1][topic] === undefined) {
throw new Error(`Topic ${topic} not defined`)

@@ -505,3 +505,3 @@ }

const hfBlock = this.hardforkBlock(hardfork)
if (isTruthy(hfBlock) && blockNumber >= hfBlock) {
if (typeof hfBlock === 'bigint' && hfBlock !== BigInt(0) && blockNumber >= hfBlock) {
return true

@@ -608,3 +608,3 @@ }

const block = this.hardforkBlock(hardfork)
return isTruthy(block) ? block === blockNumber : false
return typeof block === 'bigint' && block !== BigInt(0) ? block === blockNumber : false
}

@@ -821,5 +821,3 @@

}
return isTruthy(value)
? value
: (this._chainParams['consensus']['algorithm'] as ConsensusAlgorithm)
return value ?? (this._chainParams['consensus']['algorithm'] as ConsensusAlgorithm)
}

@@ -852,5 +850,3 @@

}
return isTruthy(value)
? value
: this._chainParams['consensus'][this.consensusAlgorithm() as ConsensusAlgorithm]!
return value ?? this._chainParams['consensus'][this.consensusAlgorithm() as ConsensusAlgorithm]!
}

@@ -857,0 +853,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc