Socket
Socket
Sign inDemoInstall

@ethereumjs/tx

Package Overview
Dependencies
44
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.0 to 3.5.0

8

dist.browser/baseTransaction.d.ts

@@ -163,5 +163,11 @@ /// <reference types="bn.js" />

protected _getCommon(common?: Common, chainId?: BNLike): Common;
/**
* Validates that an object with BN values cannot exceed the specified bit limit.
* @param values Object containing string keys and BN values
* @param bits Number of bits to check (64 or 256)
* @param cannotEqual Pass true if the number also cannot equal one less the maximum value
*/
protected _validateCannotExceedMaxInteger(values: {
[key: string]: BN | undefined;
}, bits?: number): void;
}, bits?: number, cannotEqual?: boolean): void;
/**

@@ -168,0 +174,0 @@ * Return a compact error string representation of the object

73

dist.browser/baseTransaction.js

@@ -102,9 +102,7 @@ "use strict";

this.s = sB.length > 0 ? new ethereumjs_util_1.BN(sB) : undefined;
this._validateCannotExceedMaxInteger({
nonce: this.nonce,
gasLimit: this.gasLimit,
value: this.value,
r: this.r,
s: this.s,
});
this._validateCannotExceedMaxInteger({ value: this.value, r: this.r, s: this.s });
// geth limits gasLimit to 2^64-1
this._validateCannotExceedMaxInteger({ gasLimit: this.gasLimit }, 64);
// EIP-2681 limits nonce to 2^64-1 (cannot equal 2^64-1)
this._validateCannotExceedMaxInteger({ nonce: this.nonce }, 64, true);
}

@@ -158,3 +156,3 @@ Object.defineProperty(BaseTransaction.prototype, "transactionType", {

if (this.getBaseFee().gt(this.gasLimit)) {
errors.push("gasLimit is too low. given " + this.gasLimit + ", need at least " + this.getBaseFee());
errors.push("gasLimit is too low. given ".concat(this.gasLimit, ", need at least ").concat(this.getBaseFee()));
}

@@ -314,24 +312,49 @@ if (this.isSigned() && !this.verifySignature()) {

};
BaseTransaction.prototype._validateCannotExceedMaxInteger = function (values, bits) {
/**
* Validates that an object with BN values cannot exceed the specified bit limit.
* @param values Object containing string keys and BN values
* @param bits Number of bits to check (64 or 256)
* @param cannotEqual Pass true if the number also cannot equal one less the maximum value
*/
BaseTransaction.prototype._validateCannotExceedMaxInteger = function (values, bits, cannotEqual) {
var e_1, _a;
if (bits === void 0) { bits = 53; }
if (bits === void 0) { bits = 256; }
if (cannotEqual === void 0) { cannotEqual = false; }
try {
for (var _b = __values(Object.entries(values)), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
if (bits === 53) {
if (value === null || value === void 0 ? void 0 : value.gt(ethereumjs_util_1.MAX_INTEGER)) {
var msg = this._errorMsg(key + " cannot exceed MAX_INTEGER, given " + value);
switch (bits) {
case 64:
if (cannotEqual) {
if (value === null || value === void 0 ? void 0 : value.gte(ethereumjs_util_1.MAX_UINT64)) {
var msg = this._errorMsg("".concat(key, " cannot equal or exceed MAX_UINT64 (2^64-1), given ").concat(value));
throw new Error(msg);
}
}
else {
if (value === null || value === void 0 ? void 0 : value.gt(ethereumjs_util_1.MAX_UINT64)) {
var msg = this._errorMsg("".concat(key, " cannot exceed MAX_UINT64 (2^64-1), given ").concat(value));
throw new Error(msg);
}
}
break;
case 256:
if (cannotEqual) {
if (value === null || value === void 0 ? void 0 : value.gte(ethereumjs_util_1.MAX_INTEGER)) {
var msg = this._errorMsg("".concat(key, " cannot equal or exceed MAX_INTEGER (2^256-1), given ").concat(value));
throw new Error(msg);
}
}
else {
if (value === null || value === void 0 ? void 0 : value.gt(ethereumjs_util_1.MAX_INTEGER)) {
var msg = this._errorMsg("".concat(key, " cannot exceed MAX_INTEGER (2^256-1), given ").concat(value));
throw new Error(msg);
}
}
break;
default: {
var msg = this._errorMsg('unimplemented bits value');
throw new Error(msg);
}
}
else if (bits === 256) {
if (value === null || value === void 0 ? void 0 : value.gte(ethereumjs_util_1.TWO_POW256)) {
var msg = this._errorMsg(key + " must be less than 2^256, given " + value);
throw new Error(msg);
}
}
else {
var msg = this._errorMsg('unimplemented bits value');
throw new Error(msg);
}
}

@@ -373,4 +396,4 @@ }

}
var postfix = "tx type=" + this.type + " hash=" + hash + " nonce=" + this.nonce + " value=" + this.value + " ";
postfix += "signed=" + isSigned + " hf=" + hf;
var postfix = "tx type=".concat(this.type, " hash=").concat(hash, " nonce=").concat(this.nonce, " value=").concat(this.value, " ");
postfix += "signed=".concat(isSigned, " hf=").concat(hf);
return postfix;

@@ -377,0 +400,0 @@ };

@@ -95,3 +95,7 @@ "use strict";

maxPriorityFeePerGas: _this.maxPriorityFeePerGas,
}, 256);
});
if (_this.gasLimit.mul(_this.maxFeePerGas).gt(ethereumjs_util_1.MAX_INTEGER)) {
var msg = _this._errorMsg('gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)');
throw new Error(msg);
}
if (_this.maxFeePerGas.lt(_this.maxPriorityFeePerGas)) {

@@ -174,5 +178,5 @@ var msg = _this._errorMsg('maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)');

if (!serialized.slice(0, 1).equals(TRANSACTION_TYPE_BUFFER)) {
throw new Error("Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: " + TRANSACTION_TYPE + ", received: " + serialized
throw new Error("Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ".concat(TRANSACTION_TYPE, ", received: ").concat(serialized
.slice(0, 1)
.toString('hex'));
.toString('hex')));
}

@@ -210,2 +214,3 @@ var values = ethereumjs_util_1.rlp.decode(serialized.slice(1));

var _a = __read(values, 12), chainId = _a[0], nonce = _a[1], maxPriorityFeePerGas = _a[2], maxFeePerGas = _a[3], gasLimit = _a[4], to = _a[5], value = _a[6], data = _a[7], accessList = _a[8], v = _a[9], r = _a[10], s = _a[11];
(0, ethereumjs_util_1.validateNoLeadingZeroes)({ nonce: nonce, maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas, gasLimit: gasLimit, value: value, v: v, r: r, s: s });
return new FeeMarketEIP1559Transaction({

@@ -415,3 +420,3 @@ chainId: new ethereumjs_util_1.BN(chainId),

var errorStr = this._getSharedErrorPostfix();
errorStr += " maxFeePerGas=" + this.maxFeePerGas + " maxPriorityFeePerGas=" + this.maxPriorityFeePerGas;
errorStr += " maxFeePerGas=".concat(this.maxFeePerGas, " maxPriorityFeePerGas=").concat(this.maxPriorityFeePerGas);
return errorStr;

@@ -426,3 +431,3 @@ };

FeeMarketEIP1559Transaction.prototype._errorMsg = function (msg) {
return msg + " (" + this.errorStr() + ")";
return "".concat(msg, " (").concat(this.errorStr(), ")");
};

@@ -429,0 +434,0 @@ return FeeMarketEIP1559Transaction;

@@ -92,3 +92,9 @@ "use strict";

_this.gasPrice = new ethereumjs_util_1.BN((0, ethereumjs_util_1.toBuffer)(gasPrice === '' ? '0x' : gasPrice));
_this._validateCannotExceedMaxInteger({ gasPrice: _this.gasPrice });
_this._validateCannotExceedMaxInteger({
gasPrice: _this.gasPrice,
});
if (_this.gasPrice.mul(_this.gasLimit).gt(ethereumjs_util_1.MAX_INTEGER)) {
var msg = _this._errorMsg('gasLimit * gasPrice cannot exceed MAX_INTEGER');
throw new Error(msg);
}
if (_this.v && !_this.v.eqn(0) && !_this.v.eqn(1)) {

@@ -167,5 +173,5 @@ var msg = _this._errorMsg('The y-parity of the transaction should either be 0 or 1');

if (!serialized.slice(0, 1).equals(TRANSACTION_TYPE_BUFFER)) {
throw new Error("Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: " + TRANSACTION_TYPE + ", received: " + serialized
throw new Error("Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ".concat(TRANSACTION_TYPE, ", received: ").concat(serialized
.slice(0, 1)
.toString('hex'));
.toString('hex')));
}

@@ -203,2 +209,3 @@ var values = ethereumjs_util_1.rlp.decode(serialized.slice(1));

var _a = __read(values, 11), chainId = _a[0], nonce = _a[1], gasPrice = _a[2], gasLimit = _a[3], to = _a[4], value = _a[5], data = _a[6], accessList = _a[7], v = _a[8], r = _a[9], s = _a[10];
(0, ethereumjs_util_1.validateNoLeadingZeroes)({ nonce: nonce, gasPrice: gasPrice, gasLimit: gasLimit, value: value, v: v, r: r, s: s });
var emptyAccessList = [];

@@ -403,3 +410,3 @@ return new AccessListEIP2930Transaction({

// Keep ? for this.accessList since this otherwise causes Hardhat E2E tests to fail
errorStr += " gasPrice=" + this.gasPrice + " accessListCount=" + ((_b = (_a = this.accessList) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
errorStr += " gasPrice=".concat(this.gasPrice, " accessListCount=").concat((_b = (_a = this.accessList) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
return errorStr;

@@ -414,3 +421,3 @@ };

AccessListEIP2930Transaction.prototype._errorMsg = function (msg) {
return msg + " (" + this.errorStr() + ")";
return "".concat(msg, " (").concat(this.errorStr(), ")");
};

@@ -417,0 +424,0 @@ return AccessListEIP2930Transaction;

@@ -67,2 +67,6 @@ "use strict";

_this.gasPrice = new ethereumjs_util_1.BN((0, ethereumjs_util_1.toBuffer)(txData.gasPrice === '' ? '0x' : txData.gasPrice));
if (_this.gasPrice.mul(_this.gasLimit).gt(ethereumjs_util_1.MAX_INTEGER)) {
var msg = _this._errorMsg('gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)');
throw new Error(msg);
}
_this._validateCannotExceedMaxInteger({ gasPrice: _this.gasPrice });

@@ -142,2 +146,3 @@ if (_this.common.gteHardfork('spuriousDragon')) {

var _a = __read(values, 9), nonce = _a[0], gasPrice = _a[1], gasLimit = _a[2], to = _a[3], value = _a[4], data = _a[5], v = _a[6], r = _a[7], s = _a[8];
(0, ethereumjs_util_1.validateNoLeadingZeroes)({ nonce: nonce, gasPrice: gasPrice, gasLimit: gasLimit, value: value, v: v, r: r, s: s });
return new Transaction({

@@ -355,3 +360,3 @@ nonce: nonce,

if (!isValidEIP155V) {
throw new Error("Incompatible EIP155-based V " + v + " and chain id " + common.chainIdBN() + ". See the Common parameter of the Transaction constructor to set the chain id.");
throw new Error("Incompatible EIP155-based V ".concat(v, " and chain id ").concat(common.chainIdBN(), ". See the Common parameter of the Transaction constructor to set the chain id."));
}

@@ -401,3 +406,3 @@ }

var errorStr = this._getSharedErrorPostfix();
errorStr += " gasPrice=" + this.gasPrice;
errorStr += " gasPrice=".concat(this.gasPrice);
return errorStr;

@@ -412,3 +417,3 @@ };

Transaction.prototype._errorMsg = function (msg) {
return msg + " (" + this.errorStr() + ")";
return "".concat(msg, " (").concat(this.errorStr(), ")");
};

@@ -415,0 +420,0 @@ return Transaction;

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

else {
throw new Error("Tx instantiation with type " + txType + " not supported");
throw new Error("Tx instantiation with type ".concat(txType, " not supported"));
}

@@ -57,3 +57,3 @@ }

default:
throw new Error("TypedTransaction with ID " + data[0] + " unknown");
throw new Error("TypedTransaction with ID ".concat(data[0], " unknown"));
}

@@ -113,3 +113,3 @@ if (EIP === 1559) {

default:
throw new Error("TypedTransaction with ID " + transactionID + " unknown");
throw new Error("TypedTransaction with ID ".concat(transactionID, " unknown"));
}

@@ -116,0 +116,0 @@ };

@@ -163,5 +163,11 @@ /// <reference types="bn.js" />

protected _getCommon(common?: Common, chainId?: BNLike): Common;
/**
* Validates that an object with BN values cannot exceed the specified bit limit.
* @param values Object containing string keys and BN values
* @param bits Number of bits to check (64 or 256)
* @param cannotEqual Pass true if the number also cannot equal one less the maximum value
*/
protected _validateCannotExceedMaxInteger(values: {
[key: string]: BN | undefined;
}, bits?: number): void;
}, bits?: number, cannotEqual?: boolean): void;
/**

@@ -168,0 +174,0 @@ * Return a compact error string representation of the object

@@ -75,9 +75,7 @@ "use strict";

this.s = sB.length > 0 ? new ethereumjs_util_1.BN(sB) : undefined;
this._validateCannotExceedMaxInteger({
nonce: this.nonce,
gasLimit: this.gasLimit,
value: this.value,
r: this.r,
s: this.s,
});
this._validateCannotExceedMaxInteger({ value: this.value, r: this.r, s: this.s });
// geth limits gasLimit to 2^64-1
this._validateCannotExceedMaxInteger({ gasLimit: this.gasLimit }, 64);
// EIP-2681 limits nonce to 2^64-1 (cannot equal 2^64-1)
this._validateCannotExceedMaxInteger({ nonce: this.nonce }, 64, true);
}

@@ -277,20 +275,44 @@ /**

}
_validateCannotExceedMaxInteger(values, bits = 53) {
/**
* Validates that an object with BN values cannot exceed the specified bit limit.
* @param values Object containing string keys and BN values
* @param bits Number of bits to check (64 or 256)
* @param cannotEqual Pass true if the number also cannot equal one less the maximum value
*/
_validateCannotExceedMaxInteger(values, bits = 256, cannotEqual = false) {
for (const [key, value] of Object.entries(values)) {
if (bits === 53) {
if (value === null || value === void 0 ? void 0 : value.gt(ethereumjs_util_1.MAX_INTEGER)) {
const msg = this._errorMsg(`${key} cannot exceed MAX_INTEGER, given ${value}`);
switch (bits) {
case 64:
if (cannotEqual) {
if (value === null || value === void 0 ? void 0 : value.gte(ethereumjs_util_1.MAX_UINT64)) {
const msg = this._errorMsg(`${key} cannot equal or exceed MAX_UINT64 (2^64-1), given ${value}`);
throw new Error(msg);
}
}
else {
if (value === null || value === void 0 ? void 0 : value.gt(ethereumjs_util_1.MAX_UINT64)) {
const msg = this._errorMsg(`${key} cannot exceed MAX_UINT64 (2^64-1), given ${value}`);
throw new Error(msg);
}
}
break;
case 256:
if (cannotEqual) {
if (value === null || value === void 0 ? void 0 : value.gte(ethereumjs_util_1.MAX_INTEGER)) {
const msg = this._errorMsg(`${key} cannot equal or exceed MAX_INTEGER (2^256-1), given ${value}`);
throw new Error(msg);
}
}
else {
if (value === null || value === void 0 ? void 0 : value.gt(ethereumjs_util_1.MAX_INTEGER)) {
const msg = this._errorMsg(`${key} cannot exceed MAX_INTEGER (2^256-1), given ${value}`);
throw new Error(msg);
}
}
break;
default: {
const msg = this._errorMsg('unimplemented bits value');
throw new Error(msg);
}
}
else if (bits === 256) {
if (value === null || value === void 0 ? void 0 : value.gte(ethereumjs_util_1.TWO_POW256)) {
const msg = this._errorMsg(`${key} must be less than 2^256, given ${value}`);
throw new Error(msg);
}
}
else {
const msg = this._errorMsg('unimplemented bits value');
throw new Error(msg);
}
}

@@ -297,0 +319,0 @@ }

@@ -51,3 +51,7 @@ "use strict";

maxPriorityFeePerGas: this.maxPriorityFeePerGas,
}, 256);
});
if (this.gasLimit.mul(this.maxFeePerGas).gt(ethereumjs_util_1.MAX_INTEGER)) {
const msg = this._errorMsg('gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)');
throw new Error(msg);
}
if (this.maxFeePerGas.lt(this.maxPriorityFeePerGas)) {

@@ -148,2 +152,3 @@ const msg = this._errorMsg('maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)');

const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, v, r, s,] = values;
(0, ethereumjs_util_1.validateNoLeadingZeroes)({ nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, value, v, r, s });
return new FeeMarketEIP1559Transaction({

@@ -150,0 +155,0 @@ chainId: new ethereumjs_util_1.BN(chainId),

@@ -48,3 +48,9 @@ "use strict";

this.gasPrice = new ethereumjs_util_1.BN((0, ethereumjs_util_1.toBuffer)(gasPrice === '' ? '0x' : gasPrice));
this._validateCannotExceedMaxInteger({ gasPrice: this.gasPrice });
this._validateCannotExceedMaxInteger({
gasPrice: this.gasPrice,
});
if (this.gasPrice.mul(this.gasLimit).gt(ethereumjs_util_1.MAX_INTEGER)) {
const msg = this._errorMsg('gasLimit * gasPrice cannot exceed MAX_INTEGER');
throw new Error(msg);
}
if (this.v && !this.v.eqn(0) && !this.v.eqn(1)) {

@@ -141,2 +147,3 @@ const msg = this._errorMsg('The y-parity of the transaction should either be 0 or 1');

const [chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s] = values;
(0, ethereumjs_util_1.validateNoLeadingZeroes)({ nonce, gasPrice, gasLimit, value, v, r, s });
const emptyAccessList = [];

@@ -143,0 +150,0 @@ return new AccessListEIP2930Transaction({

@@ -23,2 +23,6 @@ "use strict";

this.gasPrice = new ethereumjs_util_1.BN((0, ethereumjs_util_1.toBuffer)(txData.gasPrice === '' ? '0x' : txData.gasPrice));
if (this.gasPrice.mul(this.gasLimit).gt(ethereumjs_util_1.MAX_INTEGER)) {
const msg = this._errorMsg('gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)');
throw new Error(msg);
}
this._validateCannotExceedMaxInteger({ gasPrice: this.gasPrice });

@@ -93,2 +97,3 @@ if (this.common.gteHardfork('spuriousDragon')) {

const [nonce, gasPrice, gasLimit, to, value, data, v, r, s] = values;
(0, ethereumjs_util_1.validateNoLeadingZeroes)({ nonce, gasPrice, gasLimit, value, v, r, s });
return new Transaction({

@@ -95,0 +100,0 @@ nonce,

{
"name": "@ethereumjs/tx",
"version": "3.4.0",
"version": "3.5.0",
"description": "A simple module for creating, manipulating and signing Ethereum transactions",

@@ -27,4 +27,2 @@ "license": "MPL-2.0",

"docs:build": "typedoc --options typedoc.js",
"format": "ethereumjs-config-format",
"format:fix": "ethereumjs-config-format-fix",
"tsc": "../../config/cli/ts-compile.sh",

@@ -36,11 +34,12 @@ "lint": "../../config/cli/lint.sh",

"test:node": "tape -r ts-node/register ./test/index.ts",
"test:browser": "karma start karma.conf.js"
"test:browser": "karma start karma.conf.js",
"examples": "ts-node ../../scripts/examples-runner.ts -- tx"
},
"dependencies": {
"@ethereumjs/common": "^2.6.0",
"ethereumjs-util": "^7.1.3"
"@ethereumjs/common": "^2.6.1",
"ethereumjs-util": "^7.1.4"
},
"devDependencies": {
"@types/minimist": "^1.2.0",
"@types/node": "^11.13.4",
"@types/node": "^16.11.7",
"@types/tape": "^4.13.2",

@@ -52,3 +51,3 @@ "eslint": "^6.8.0",

"karma-tap": "^4.2.0",
"karma-typescript": "^5.5.1",
"karma-typescript": "^5.5.3",
"minimist": "^1.2.0",

@@ -55,0 +54,0 @@ "node-dir": "^0.1.16",

@@ -7,3 +7,3 @@ import Common, { Chain, Hardfork } from '@ethereumjs/common'

MAX_INTEGER,
TWO_POW256,
MAX_UINT64,
unpadBuffer,

@@ -105,9 +105,9 @@ ecsign,

this._validateCannotExceedMaxInteger({
nonce: this.nonce,
gasLimit: this.gasLimit,
value: this.value,
r: this.r,
s: this.s,
})
this._validateCannotExceedMaxInteger({ value: this.value, r: this.r, s: this.s })
// geth limits gasLimit to 2^64-1
this._validateCannotExceedMaxInteger({ gasLimit: this.gasLimit }, 64)
// EIP-2681 limits nonce to 2^64-1 (cannot equal 2^64-1)
this._validateCannotExceedMaxInteger({ nonce: this.nonce }, 64, true)
}

@@ -382,17 +382,51 @@

protected _validateCannotExceedMaxInteger(values: { [key: string]: BN | undefined }, bits = 53) {
/**
* Validates that an object with BN values cannot exceed the specified bit limit.
* @param values Object containing string keys and BN values
* @param bits Number of bits to check (64 or 256)
* @param cannotEqual Pass true if the number also cannot equal one less the maximum value
*/
protected _validateCannotExceedMaxInteger(
values: { [key: string]: BN | undefined },
bits = 256,
cannotEqual = false
) {
for (const [key, value] of Object.entries(values)) {
if (bits === 53) {
if (value?.gt(MAX_INTEGER)) {
const msg = this._errorMsg(`${key} cannot exceed MAX_INTEGER, given ${value}`)
switch (bits) {
case 64:
if (cannotEqual) {
if (value?.gte(MAX_UINT64)) {
const msg = this._errorMsg(
`${key} cannot equal or exceed MAX_UINT64 (2^64-1), given ${value}`
)
throw new Error(msg)
}
} else {
if (value?.gt(MAX_UINT64)) {
const msg = this._errorMsg(`${key} cannot exceed MAX_UINT64 (2^64-1), given ${value}`)
throw new Error(msg)
}
}
break
case 256:
if (cannotEqual) {
if (value?.gte(MAX_INTEGER)) {
const msg = this._errorMsg(
`${key} cannot equal or exceed MAX_INTEGER (2^256-1), given ${value}`
)
throw new Error(msg)
}
} else {
if (value?.gt(MAX_INTEGER)) {
const msg = this._errorMsg(
`${key} cannot exceed MAX_INTEGER (2^256-1), given ${value}`
)
throw new Error(msg)
}
}
break
default: {
const msg = this._errorMsg('unimplemented bits value')
throw new Error(msg)
}
} else if (bits === 256) {
if (value?.gte(TWO_POW256)) {
const msg = this._errorMsg(`${key} must be less than 2^256, given ${value}`)
throw new Error(msg)
}
} else {
const msg = this._errorMsg('unimplemented bits value')
throw new Error(msg)
}

@@ -399,0 +433,0 @@ }

@@ -7,4 +7,6 @@ import {

keccak256,
MAX_INTEGER,
rlp,
toBuffer,
validateNoLeadingZeroes,
} from 'ethereumjs-util'

@@ -156,2 +158,4 @@ import Common from '@ethereumjs/common'

validateNoLeadingZeroes({ nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, value, v, r, s })
return new FeeMarketEIP1559Transaction(

@@ -207,10 +211,12 @@ {

this._validateCannotExceedMaxInteger(
{
maxFeePerGas: this.maxFeePerGas,
maxPriorityFeePerGas: this.maxPriorityFeePerGas,
},
256
)
this._validateCannotExceedMaxInteger({
maxFeePerGas: this.maxFeePerGas,
maxPriorityFeePerGas: this.maxPriorityFeePerGas,
})
if (this.gasLimit.mul(this.maxFeePerGas).gt(MAX_INTEGER)) {
const msg = this._errorMsg('gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)')
throw new Error(msg)
}
if (this.maxFeePerGas.lt(this.maxPriorityFeePerGas)) {

@@ -217,0 +223,0 @@ const msg = this._errorMsg(

@@ -7,4 +7,6 @@ import {

keccak256,
MAX_INTEGER,
rlp,
toBuffer,
validateNoLeadingZeroes,
} from 'ethereumjs-util'

@@ -143,2 +145,4 @@ import Common from '@ethereumjs/common'

validateNoLeadingZeroes({ nonce, gasPrice, gasLimit, value, v, r, s })
const emptyAccessList: AccessList = []

@@ -193,4 +197,10 @@

this._validateCannotExceedMaxInteger({ gasPrice: this.gasPrice })
this._validateCannotExceedMaxInteger({
gasPrice: this.gasPrice,
})
if (this.gasPrice.mul(this.gasLimit).gt(MAX_INTEGER)) {
const msg = this._errorMsg('gasLimit * gasPrice cannot exceed MAX_INTEGER')
throw new Error(msg)
}
if (this.v && !this.v.eqn(0) && !this.v.eqn(1)) {

@@ -197,0 +207,0 @@ const msg = this._errorMsg('The y-parity of the transaction should either be 0 or 1')

@@ -6,2 +6,3 @@ import {

ecrecover,
MAX_INTEGER,
rlp,

@@ -11,2 +12,3 @@ rlphash,

unpadBuffer,
validateNoLeadingZeroes,
} from 'ethereumjs-util'

@@ -81,2 +83,4 @@ import { TxOptions, TxData, JsonTx, N_DIV_2, TxValuesArray, Capability } from './types'

validateNoLeadingZeroes({ nonce, gasPrice, gasLimit, value, v, r, s })
return new Transaction(

@@ -112,2 +116,6 @@ {

if (this.gasPrice.mul(this.gasLimit).gt(MAX_INTEGER)) {
const msg = this._errorMsg('gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)')
throw new Error(msg)
}
this._validateCannotExceedMaxInteger({ gasPrice: this.gasPrice })

@@ -114,0 +122,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc