@ethereumjs/tx
Advanced tools
Comparing version 3.5.0 to 3.5.1
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -182,3 +186,9 @@ if (k2 === undefined) k2 = k; | ||
} | ||
return new ethereumjs_util_1.BN(cost); | ||
cost = new ethereumjs_util_1.BN(cost); | ||
if ((this.to === undefined || this.to === null) && this.common.isActivatedEIP(3860)) { | ||
var dataLength = Math.ceil(this.data.length / 32); | ||
var initCodeCost = new ethereumjs_util_1.BN(this.common.param('gasPrices', 'initCodeWordCost')).imuln(dataLength); | ||
cost.iadd(initCodeCost); | ||
} | ||
return cost; | ||
}; | ||
@@ -185,0 +195,0 @@ /** |
@@ -68,4 +68,5 @@ "use strict"; | ||
if (opts === void 0) { opts = {}; } | ||
var _this = this; | ||
var _a, _b; | ||
var _this = _super.call(this, __assign(__assign({}, txData), { type: TRANSACTION_TYPE })) || this; | ||
_this = _super.call(this, __assign(__assign({}, txData), { type: TRANSACTION_TYPE })) || this; | ||
/** | ||
@@ -113,2 +114,5 @@ * The default HF if the tx type is active on that HF | ||
} | ||
if (_this.common.isActivatedEIP(3860)) { | ||
(0, util_1.checkMaxInitCodeSize)(_this.common, _this.data.length); | ||
} | ||
var freeze = (_b = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _b !== void 0 ? _b : true; | ||
@@ -115,0 +119,0 @@ if (freeze) { |
@@ -68,4 +68,5 @@ "use strict"; | ||
if (opts === void 0) { opts = {}; } | ||
var _this = this; | ||
var _a, _b; | ||
var _this = _super.call(this, __assign(__assign({}, txData), { type: TRANSACTION_TYPE })) || this; | ||
_this = _super.call(this, __assign(__assign({}, txData), { type: TRANSACTION_TYPE })) || this; | ||
/** | ||
@@ -108,2 +109,5 @@ * The default HF if the tx type is active on that HF | ||
} | ||
if (_this.common.isActivatedEIP(3860)) { | ||
(0, util_1.checkMaxInitCodeSize)(_this.common, _this.data.length); | ||
} | ||
var freeze = (_b = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _b !== void 0 ? _b : true; | ||
@@ -110,0 +114,0 @@ if (freeze) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -48,2 +48,3 @@ "use strict"; | ||
var baseTransaction_1 = require("./baseTransaction"); | ||
var util_1 = require("./util"); | ||
var TRANSACTION_TYPE = 0; | ||
@@ -64,4 +65,5 @@ /** | ||
if (opts === void 0) { opts = {}; } | ||
var _this = this; | ||
var _a; | ||
var _this = _super.call(this, __assign(__assign({}, txData), { type: TRANSACTION_TYPE })) || this; | ||
_this = _super.call(this, __assign(__assign({}, txData), { type: TRANSACTION_TYPE })) || this; | ||
_this.common = _this._validateTxV(_this.v, opts.common); | ||
@@ -92,2 +94,5 @@ _this.gasPrice = new ethereumjs_util_1.BN((0, ethereumjs_util_1.toBuffer)(txData.gasPrice === '' ? '0x' : txData.gasPrice)); | ||
} | ||
if (_this.common.isActivatedEIP(3860)) { | ||
(0, util_1.checkMaxInitCodeSize)(_this.common, _this.data.length); | ||
} | ||
var freeze = (_a = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _a !== void 0 ? _a : true; | ||
@@ -94,0 +99,0 @@ if (freeze) { |
import Common from '@ethereumjs/common'; | ||
import { AccessList, AccessListBuffer } from './types'; | ||
export declare function checkMaxInitCodeSize(common: Common, length: number): void; | ||
export declare class AccessLists { | ||
@@ -4,0 +5,0 @@ static getAccessListData(accessList: AccessListBuffer | AccessList): { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AccessLists = void 0; | ||
exports.AccessLists = exports.checkMaxInitCodeSize = void 0; | ||
var ethereumjs_util_1 = require("ethereumjs-util"); | ||
var types_1 = require("./types"); | ||
function checkMaxInitCodeSize(common, length) { | ||
if (length > common.param('vm', 'maxInitCodeSize')) { | ||
throw new Error("the initcode size of this transaction is too large: it is ".concat(length, " while the max is ").concat(common.param('vm', 'maxInitCodeSize'))); | ||
} | ||
} | ||
exports.checkMaxInitCodeSize = checkMaxInitCodeSize; | ||
var AccessLists = /** @class */ (function () { | ||
@@ -7,0 +13,0 @@ function AccessLists() { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -146,3 +150,9 @@ if (k2 === undefined) k2 = k; | ||
} | ||
return new ethereumjs_util_1.BN(cost); | ||
cost = new ethereumjs_util_1.BN(cost); | ||
if ((this.to === undefined || this.to === null) && this.common.isActivatedEIP(3860)) { | ||
const dataLength = Math.ceil(this.data.length / 32); | ||
const initCodeCost = new ethereumjs_util_1.BN(this.common.param('gasPrices', 'initCodeWordCost')).imuln(dataLength); | ||
cost.iadd(initCodeCost); | ||
} | ||
return cost; | ||
} | ||
@@ -149,0 +159,0 @@ /** |
@@ -68,2 +68,5 @@ "use strict"; | ||
} | ||
if (this.common.isActivatedEIP(3860)) { | ||
(0, util_1.checkMaxInitCodeSize)(this.common, this.data.length); | ||
} | ||
const freeze = (_b = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _b !== void 0 ? _b : true; | ||
@@ -70,0 +73,0 @@ if (freeze) { |
@@ -63,2 +63,5 @@ "use strict"; | ||
} | ||
if (this.common.isActivatedEIP(3860)) { | ||
(0, util_1.checkMaxInitCodeSize)(this.common, this.data.length); | ||
} | ||
const freeze = (_b = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _b !== void 0 ? _b : true; | ||
@@ -65,0 +68,0 @@ if (freeze) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const baseTransaction_1 = require("./baseTransaction"); | ||
const util_1 = require("./util"); | ||
const TRANSACTION_TYPE = 0; | ||
@@ -47,2 +48,5 @@ /** | ||
} | ||
if (this.common.isActivatedEIP(3860)) { | ||
(0, util_1.checkMaxInitCodeSize)(this.common, this.data.length); | ||
} | ||
const freeze = (_a = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _a !== void 0 ? _a : true; | ||
@@ -49,0 +53,0 @@ if (freeze) { |
import Common from '@ethereumjs/common'; | ||
import { AccessList, AccessListBuffer } from './types'; | ||
export declare function checkMaxInitCodeSize(common: Common, length: number): void; | ||
export declare class AccessLists { | ||
@@ -4,0 +5,0 @@ static getAccessListData(accessList: AccessListBuffer | AccessList): { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AccessLists = void 0; | ||
exports.AccessLists = exports.checkMaxInitCodeSize = void 0; | ||
const ethereumjs_util_1 = require("ethereumjs-util"); | ||
const types_1 = require("./types"); | ||
function checkMaxInitCodeSize(common, length) { | ||
if (length > common.param('vm', 'maxInitCodeSize')) { | ||
throw new Error(`the initcode size of this transaction is too large: it is ${length} while the max is ${common.param('vm', 'maxInitCodeSize')}`); | ||
} | ||
} | ||
exports.checkMaxInitCodeSize = checkMaxInitCodeSize; | ||
class AccessLists { | ||
@@ -7,0 +13,0 @@ static getAccessListData(accessList) { |
{ | ||
"name": "@ethereumjs/tx", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "A simple module for creating, manipulating and signing Ethereum transactions", | ||
@@ -37,3 +37,3 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@ethereumjs/common": "^2.6.1", | ||
"@ethereumjs/common": "^2.6.3", | ||
"ethereumjs-util": "^7.1.4" | ||
@@ -40,0 +40,0 @@ }, |
@@ -52,2 +52,12 @@ # @ethereumjs/tx | ||
### Standalone EIPs | ||
The following "standalone" EIPs are supported by the library can be manually activated using a respectively initialized `Common` instance, e.g.: | ||
```typescript | ||
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London, eips: [ 3860 ] }) | ||
``` | ||
- [EIP-3860](https://eips.ethereum.org/EIPS/eip-3855): Limit and meter initcode (`experimental`) | ||
## Transaction Types | ||
@@ -54,0 +64,0 @@ |
@@ -190,3 +190,3 @@ import Common, { Chain, Hardfork } from '@ethereumjs/common' | ||
let cost = 0 | ||
let cost: number | BN = 0 | ||
for (let i = 0; i < this.data.length; i++) { | ||
@@ -196,3 +196,12 @@ this.data[i] === 0 ? (cost += txDataZero) : (cost += txDataNonZero) | ||
return new BN(cost) | ||
cost = new BN(cost) | ||
if ((this.to === undefined || this.to === null) && this.common.isActivatedEIP(3860)) { | ||
const dataLength = Math.ceil(this.data.length / 32) | ||
const initCodeCost = new BN(this.common.param('gasPrices', 'initCodeWordCost')).imuln( | ||
dataLength | ||
) | ||
cost.iadd(initCodeCost) | ||
} | ||
return cost | ||
} | ||
@@ -199,0 +208,0 @@ |
@@ -23,3 +23,3 @@ import { | ||
} from './types' | ||
import { AccessLists } from './util' | ||
import { AccessLists, checkMaxInitCodeSize } from './util' | ||
@@ -239,2 +239,6 @@ const TRANSACTION_TYPE = 2 | ||
if (this.common.isActivatedEIP(3860)) { | ||
checkMaxInitCodeSize(this.common, this.data.length) | ||
} | ||
const freeze = opts?.freeze ?? true | ||
@@ -241,0 +245,0 @@ if (freeze) { |
@@ -24,3 +24,3 @@ import { | ||
import { AccessLists } from './util' | ||
import { AccessLists, checkMaxInitCodeSize } from './util' | ||
@@ -216,2 +216,5 @@ const TRANSACTION_TYPE = 1 | ||
if (this.common.isActivatedEIP(3860)) { | ||
checkMaxInitCodeSize(this.common, this.data.length) | ||
} | ||
const freeze = opts?.freeze ?? true | ||
@@ -218,0 +221,0 @@ if (freeze) { |
@@ -16,2 +16,3 @@ import { | ||
import Common from '@ethereumjs/common' | ||
import { checkMaxInitCodeSize } from './util' | ||
@@ -139,2 +140,6 @@ const TRANSACTION_TYPE = 0 | ||
if (this.common.isActivatedEIP(3860)) { | ||
checkMaxInitCodeSize(this.common, this.data.length) | ||
} | ||
const freeze = opts?.freeze ?? true | ||
@@ -141,0 +146,0 @@ if (freeze) { |
@@ -5,2 +5,13 @@ import Common from '@ethereumjs/common' | ||
export function checkMaxInitCodeSize(common: Common, length: number) { | ||
if (length > common.param('vm', 'maxInitCodeSize')) { | ||
throw new Error( | ||
`the initcode size of this transaction is too large: it is ${length} while the max is ${common.param( | ||
'vm', | ||
'maxInitCodeSize' | ||
)}` | ||
) | ||
} | ||
} | ||
export class AccessLists { | ||
@@ -7,0 +18,0 @@ public static getAccessListData(accessList: AccessListBuffer | AccessList) { |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428193
7759
354
Updated@ethereumjs/common@^2.6.3