hardhat 2.21.0-dev.1 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/internal/cli/constants.d.ts.map +1 -1
  2. package/internal/cli/constants.js +1 -1
  3. package/internal/cli/constants.js.map +1 -1
  4. package/internal/cli/project-creation.js +1 -1
  5. package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
  6. package/internal/hardhat-network/provider/provider.js +12 -7
  7. package/internal/hardhat-network/provider/provider.js.map +1 -1
  8. package/package.json +3 -3
  9. package/src/internal/cli/constants.ts +1 -1
  10. package/src/internal/cli/project-creation.ts +1 -1
  11. package/src/internal/hardhat-network/provider/provider.ts +21 -16
  12. package/internal/hardhat-network/provider/BlockchainBase.d.ts +0 -29
  13. package/internal/hardhat-network/provider/BlockchainBase.d.ts.map +0 -1
  14. package/internal/hardhat-network/provider/BlockchainBase.js +0 -144
  15. package/internal/hardhat-network/provider/BlockchainBase.js.map +0 -1
  16. package/internal/hardhat-network/provider/BlockchainData.d.ts +0 -58
  17. package/internal/hardhat-network/provider/BlockchainData.d.ts.map +0 -1
  18. package/internal/hardhat-network/provider/BlockchainData.js +0 -178
  19. package/internal/hardhat-network/provider/BlockchainData.js.map +0 -1
  20. package/internal/hardhat-network/provider/HardhatBlockchain.d.ts +0 -24
  21. package/internal/hardhat-network/provider/HardhatBlockchain.d.ts.map +0 -1
  22. package/internal/hardhat-network/provider/HardhatBlockchain.js +0 -73
  23. package/internal/hardhat-network/provider/HardhatBlockchain.js.map +0 -1
  24. package/internal/hardhat-network/provider/PoolState.d.ts +0 -26
  25. package/internal/hardhat-network/provider/PoolState.d.ts.map +0 -1
  26. package/internal/hardhat-network/provider/PoolState.js +0 -41
  27. package/internal/hardhat-network/provider/PoolState.js.map +0 -1
  28. package/internal/hardhat-network/provider/TransactionQueue.d.ts +0 -32
  29. package/internal/hardhat-network/provider/TransactionQueue.d.ts.map +0 -1
  30. package/internal/hardhat-network/provider/TransactionQueue.js +0 -130
  31. package/internal/hardhat-network/provider/TransactionQueue.js.map +0 -1
  32. package/internal/hardhat-network/provider/TxPool.d.ts +0 -83
  33. package/internal/hardhat-network/provider/TxPool.d.ts.map +0 -1
  34. package/internal/hardhat-network/provider/TxPool.js +0 -470
  35. package/internal/hardhat-network/provider/TxPool.js.map +0 -1
  36. package/internal/hardhat-network/provider/ethereumjs-workarounds.d.ts +0 -2
  37. package/internal/hardhat-network/provider/ethereumjs-workarounds.d.ts.map +0 -1
  38. package/internal/hardhat-network/provider/ethereumjs-workarounds.js +0 -15
  39. package/internal/hardhat-network/provider/ethereumjs-workarounds.js.map +0 -1
  40. package/internal/hardhat-network/provider/filter.d.ts +0 -29
  41. package/internal/hardhat-network/provider/filter.d.ts.map +0 -1
  42. package/internal/hardhat-network/provider/filter.js +0 -97
  43. package/internal/hardhat-network/provider/filter.js.map +0 -1
  44. package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts +0 -33
  45. package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +0 -1
  46. package/internal/hardhat-network/provider/fork/ForkBlockchain.js +0 -272
  47. package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +0 -1
  48. package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts +0 -52
  49. package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts.map +0 -1
  50. package/internal/hardhat-network/provider/fork/ForkStateManager.js +0 -319
  51. package/internal/hardhat-network/provider/fork/ForkStateManager.js.map +0 -1
  52. package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts +0 -4
  53. package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts.map +0 -1
  54. package/internal/hardhat-network/provider/fork/rpcToBlockData.js +0 -32
  55. package/internal/hardhat-network/provider/fork/rpcToBlockData.js.map +0 -1
  56. package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts +0 -10
  57. package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts.map +0 -1
  58. package/internal/hardhat-network/provider/fork/rpcToTxData.js +0 -29
  59. package/internal/hardhat-network/provider/fork/rpcToTxData.js.map +0 -1
  60. package/internal/hardhat-network/provider/modules/base.d.ts +0 -17
  61. package/internal/hardhat-network/provider/modules/base.d.ts.map +0 -1
  62. package/internal/hardhat-network/provider/modules/base.js +0 -127
  63. package/internal/hardhat-network/provider/modules/base.js.map +0 -1
  64. package/internal/hardhat-network/provider/modules/debug.d.ts +0 -12
  65. package/internal/hardhat-network/provider/modules/debug.d.ts.map +0 -1
  66. package/internal/hardhat-network/provider/modules/debug.js +0 -52
  67. package/internal/hardhat-network/provider/modules/debug.js.map +0 -1
  68. package/internal/hardhat-network/provider/modules/eth.d.ts +0 -107
  69. package/internal/hardhat-network/provider/modules/eth.d.ts.map +0 -1
  70. package/internal/hardhat-network/provider/modules/eth.js +0 -1034
  71. package/internal/hardhat-network/provider/modules/eth.js.map +0 -1
  72. package/internal/hardhat-network/provider/modules/evm.d.ts +0 -32
  73. package/internal/hardhat-network/provider/modules/evm.d.ts.map +0 -1
  74. package/internal/hardhat-network/provider/modules/evm.js +0 -180
  75. package/internal/hardhat-network/provider/modules/evm.js.map +0 -1
  76. package/internal/hardhat-network/provider/modules/hardhat.d.ts +0 -54
  77. package/internal/hardhat-network/provider/modules/hardhat.d.ts.map +0 -1
  78. package/internal/hardhat-network/provider/modules/hardhat.js +0 -309
  79. package/internal/hardhat-network/provider/modules/hardhat.js.map +0 -1
  80. package/internal/hardhat-network/provider/modules/net.d.ts +0 -13
  81. package/internal/hardhat-network/provider/modules/net.d.ts.map +0 -1
  82. package/internal/hardhat-network/provider/modules/net.js +0 -47
  83. package/internal/hardhat-network/provider/modules/net.js.map +0 -1
  84. package/internal/hardhat-network/provider/modules/personal.d.ts +0 -9
  85. package/internal/hardhat-network/provider/modules/personal.d.ts.map +0 -1
  86. package/internal/hardhat-network/provider/modules/personal.js +0 -31
  87. package/internal/hardhat-network/provider/modules/personal.js.map +0 -1
  88. package/internal/hardhat-network/provider/modules/web3.d.ts +0 -11
  89. package/internal/hardhat-network/provider/modules/web3.d.ts.map +0 -1
  90. package/internal/hardhat-network/provider/modules/web3.js +0 -38
  91. package/internal/hardhat-network/provider/modules/web3.js.map +0 -1
  92. package/internal/hardhat-network/provider/node.d.ts +0 -197
  93. package/internal/hardhat-network/provider/node.d.ts.map +0 -1
  94. package/internal/hardhat-network/provider/node.js +0 -1866
  95. package/internal/hardhat-network/provider/node.js.map +0 -1
  96. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts +0 -29
  97. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts.map +0 -1
  98. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js +0 -137
  99. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js.map +0 -1
  100. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts +0 -27
  101. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts.map +0 -1
  102. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js +0 -137
  103. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js.map +0 -1
  104. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts +0 -33
  105. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts.map +0 -1
  106. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js +0 -141
  107. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js.map +0 -1
  108. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts +0 -30
  109. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts.map +0 -1
  110. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js +0 -97
  111. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js.map +0 -1
  112. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts +0 -30
  113. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts.map +0 -1
  114. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js +0 -98
  115. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js.map +0 -1
  116. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts +0 -40
  117. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts.map +0 -1
  118. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js +0 -91
  119. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js.map +0 -1
  120. package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.d.ts +0 -32
  121. package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.d.ts.map +0 -1
  122. package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.js +0 -87
  123. package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.js.map +0 -1
  124. package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts +0 -17
  125. package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts.map +0 -1
  126. package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.js +0 -3
  127. package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.js.map +0 -1
  128. package/internal/hardhat-network/provider/utils/makeFakeSignature.d.ts +0 -7
  129. package/internal/hardhat-network/provider/utils/makeFakeSignature.d.ts.map +0 -1
  130. package/internal/hardhat-network/provider/utils/makeFakeSignature.js +0 -31
  131. package/internal/hardhat-network/provider/utils/makeFakeSignature.js.map +0 -1
  132. package/internal/hardhat-network/provider/utils/makeStateTrie.d.ts +0 -4
  133. package/internal/hardhat-network/provider/utils/makeStateTrie.d.ts.map +0 -1
  134. package/internal/hardhat-network/provider/utils/makeStateTrie.js +0 -20
  135. package/internal/hardhat-network/provider/utils/makeStateTrie.js.map +0 -1
  136. package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts +0 -8
  137. package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts.map +0 -1
  138. package/internal/hardhat-network/provider/utils/putGenesisBlock.js +0 -37
  139. package/internal/hardhat-network/provider/utils/putGenesisBlock.js.map +0 -1
  140. package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.d.ts +0 -12
  141. package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.d.ts.map +0 -1
  142. package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.js +0 -62
  143. package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.js.map +0 -1
  144. package/internal/hardhat-network/provider/utils/txMapToArray.d.ts +0 -3
  145. package/internal/hardhat-network/provider/utils/txMapToArray.d.ts.map +0 -1
  146. package/internal/hardhat-network/provider/utils/txMapToArray.js +0 -12
  147. package/internal/hardhat-network/provider/utils/txMapToArray.js.map +0 -1
  148. package/internal/hardhat-network/provider/vm/proxy-vm.d.ts +0 -36
  149. package/internal/hardhat-network/provider/vm/proxy-vm.d.ts.map +0 -1
  150. package/internal/hardhat-network/provider/vm/proxy-vm.js +0 -73
  151. package/internal/hardhat-network/provider/vm/proxy-vm.js.map +0 -1
  152. package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts +0 -46
  153. package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts.map +0 -1
  154. package/internal/hardhat-network/stack-traces/vm-debug-tracer.js +0 -421
  155. package/internal/hardhat-network/stack-traces/vm-debug-tracer.js.map +0 -1
@@ -1,178 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BlockchainData = void 0;
4
- const ethereumjs_block_1 = require("@nomicfoundation/ethereumjs-block");
5
- const ethereumjs_util_1 = require("@nomicfoundation/ethereumjs-util");
6
- const ethereumjs_vm_1 = require("@nomicfoundation/ethereumjs-vm");
7
- const errors_1 = require("../../core/errors");
8
- const filter_1 = require("./filter");
9
- class BlockchainData {
10
- constructor(_common) {
11
- this._common = _common;
12
- this._blocksByNumber = new Map();
13
- this._blocksByHash = new Map();
14
- this._blocksByTransactions = new Map();
15
- this._transactions = new Map();
16
- this._transactionReceipts = new Map();
17
- this._totalDifficulty = new Map();
18
- this._blockReservations = new Array();
19
- }
20
- reserveBlocks(first, count, interval, previousBlockStateRoot, previousBlockTotalDifficulty, previousBlockBaseFeePerGas) {
21
- const reservation = {
22
- first,
23
- last: first + count - 1n,
24
- interval,
25
- previousBlockStateRoot,
26
- previousBlockTotalDifficulty,
27
- previousBlockBaseFeePerGas,
28
- };
29
- this._blockReservations.push(reservation);
30
- }
31
- getBlockByNumber(blockNumber) {
32
- return this._blocksByNumber.get(blockNumber);
33
- }
34
- getBlockByHash(blockHash) {
35
- return this._blocksByHash.get((0, ethereumjs_util_1.bufferToHex)(blockHash));
36
- }
37
- getBlockByTransactionHash(transactionHash) {
38
- return this._blocksByTransactions.get((0, ethereumjs_util_1.bufferToHex)(transactionHash));
39
- }
40
- getTransaction(transactionHash) {
41
- return this._transactions.get((0, ethereumjs_util_1.bufferToHex)(transactionHash));
42
- }
43
- getTransactionReceipt(transactionHash) {
44
- return this._transactionReceipts.get((0, ethereumjs_util_1.bufferToHex)(transactionHash));
45
- }
46
- getTotalDifficulty(blockHash) {
47
- return this._totalDifficulty.get((0, ethereumjs_util_1.bufferToHex)(blockHash));
48
- }
49
- getLogs(filterParams) {
50
- const logs = [];
51
- for (let i = filterParams.fromBlock; i <= filterParams.toBlock; i++) {
52
- const block = this.getBlockByNumber(i);
53
- if (block === undefined ||
54
- !(0, filter_1.bloomFilter)(new ethereumjs_vm_1.Bloom(block.header.logsBloom), filterParams.addresses, filterParams.normalizedTopics)) {
55
- continue;
56
- }
57
- for (const transaction of block.transactions) {
58
- const receipt = this.getTransactionReceipt(transaction.hash());
59
- if (receipt !== undefined) {
60
- logs.push(...(0, filter_1.filterLogs)(receipt.logs, {
61
- fromBlock: filterParams.fromBlock,
62
- toBlock: filterParams.toBlock,
63
- addresses: filterParams.addresses,
64
- normalizedTopics: filterParams.normalizedTopics,
65
- }));
66
- }
67
- }
68
- }
69
- return logs;
70
- }
71
- addBlock(block, totalDifficulty) {
72
- const blockHash = (0, ethereumjs_util_1.bufferToHex)(block.hash());
73
- const blockNumber = block.header.number;
74
- this._blocksByNumber.set(blockNumber, block);
75
- this._blocksByHash.set(blockHash, block);
76
- this._totalDifficulty.set(blockHash, totalDifficulty);
77
- for (const transaction of block.transactions) {
78
- const transactionHash = (0, ethereumjs_util_1.bufferToHex)(transaction.hash());
79
- this._transactions.set(transactionHash, transaction);
80
- this._blocksByTransactions.set(transactionHash, block);
81
- }
82
- }
83
- /**
84
- * WARNING: this method can leave the blockchain in an invalid state where
85
- * there are gaps between blocks. Ideally we should have a method that removes
86
- * the given block and all the following blocks.
87
- */
88
- removeBlock(block) {
89
- const blockHash = (0, ethereumjs_util_1.bufferToHex)(block.hash());
90
- const blockNumber = block.header.number;
91
- this._blocksByNumber.delete(blockNumber);
92
- this._blocksByHash.delete(blockHash);
93
- this._totalDifficulty.delete(blockHash);
94
- for (const transaction of block.transactions) {
95
- const transactionHash = (0, ethereumjs_util_1.bufferToHex)(transaction.hash());
96
- this._transactions.delete(transactionHash);
97
- this._transactionReceipts.delete(transactionHash);
98
- this._blocksByTransactions.delete(transactionHash);
99
- }
100
- }
101
- addTransaction(transaction) {
102
- this._transactions.set((0, ethereumjs_util_1.bufferToHex)(transaction.hash()), transaction);
103
- }
104
- addTransactionReceipt(receipt) {
105
- this._transactionReceipts.set(receipt.transactionHash, receipt);
106
- }
107
- isReservedBlock(blockNumber) {
108
- return this._findBlockReservation(blockNumber) !== -1;
109
- }
110
- _findBlockReservation(blockNumber) {
111
- return this._blockReservations.findIndex((reservation) => reservation.first <= blockNumber && blockNumber <= reservation.last);
112
- }
113
- /**
114
- * WARNING: this method only removes the given reservation and can result in
115
- * gaps in the reservations array. Ideally we should have a method that
116
- * removes the given reservation and all the following reservations.
117
- */
118
- _removeReservation(index) {
119
- (0, errors_1.assertHardhatInvariant)(index in this._blockReservations, `Reservation ${index} does not exist`);
120
- const reservation = this._blockReservations[index];
121
- this._blockReservations.splice(index, 1);
122
- return reservation;
123
- }
124
- /**
125
- * Cancel and return the reservation that has block `blockNumber`
126
- */
127
- cancelReservationWithBlock(blockNumber) {
128
- return this._removeReservation(this._findBlockReservation(blockNumber));
129
- }
130
- fulfillBlockReservation(blockNumber) {
131
- // in addition to adding the given block, the reservation needs to be split
132
- // in two in order to accomodate access to the given block.
133
- const reservationIndex = this._findBlockReservation(blockNumber);
134
- (0, errors_1.assertHardhatInvariant)(reservationIndex !== -1, `No reservation to fill for block number ${blockNumber.toString()}`);
135
- // capture the timestamp before removing the reservation:
136
- const timestamp = this._calculateTimestampForReservedBlock(blockNumber);
137
- // split the block reservation:
138
- const oldReservation = this._removeReservation(reservationIndex);
139
- if (blockNumber !== oldReservation.first) {
140
- this._blockReservations.push({
141
- ...oldReservation,
142
- last: blockNumber - 1n,
143
- });
144
- }
145
- if (blockNumber !== oldReservation.last) {
146
- this._blockReservations.push({
147
- ...oldReservation,
148
- first: blockNumber + 1n,
149
- });
150
- }
151
- this.addBlock(ethereumjs_block_1.Block.fromBlockData({
152
- header: {
153
- number: blockNumber,
154
- stateRoot: oldReservation.previousBlockStateRoot,
155
- baseFeePerGas: oldReservation.previousBlockBaseFeePerGas,
156
- timestamp,
157
- },
158
- }, {
159
- common: this._common,
160
- skipConsensusFormatValidation: true,
161
- }), oldReservation.previousBlockTotalDifficulty);
162
- }
163
- _calculateTimestampForReservedBlock(blockNumber) {
164
- const reservationIndex = this._findBlockReservation(blockNumber);
165
- (0, errors_1.assertHardhatInvariant)(reservationIndex !== -1, `Block ${blockNumber.toString()} does not lie within any of the reservations.`);
166
- const reservation = this._blockReservations[reservationIndex];
167
- const blockNumberBeforeReservation = reservation.first - 1n;
168
- const blockBeforeReservation = this.getBlockByNumber(blockNumberBeforeReservation);
169
- (0, errors_1.assertHardhatInvariant)(blockBeforeReservation !== undefined, `Reservation after block ${blockNumberBeforeReservation.toString()} cannot be created because that block does not exist`);
170
- const previousTimestamp = this.isReservedBlock(blockNumberBeforeReservation)
171
- ? this._calculateTimestampForReservedBlock(blockNumberBeforeReservation)
172
- : blockBeforeReservation.header.timestamp;
173
- return (previousTimestamp +
174
- reservation.interval * (blockNumber - reservation.first + 1n));
175
- }
176
- }
177
- exports.BlockchainData = BlockchainData;
178
- //# sourceMappingURL=BlockchainData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockchainData.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/BlockchainData.ts"],"names":[],"mappings":";;;AAAA,wEAA0D;AAG1D,sEAA+D;AAC/D,kEAAuD;AAEvD,8CAA2D;AAC3D,qCAAmD;AAanD,MAAa,cAAc;IASzB,YAAoB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAR3B,oBAAe,GAAuB,IAAI,GAAG,EAAE,CAAC;QAChD,kBAAa,GAAuB,IAAI,GAAG,EAAE,CAAC;QAC9C,0BAAqB,GAAuB,IAAI,GAAG,EAAE,CAAC;QACtD,kBAAa,GAAkC,IAAI,GAAG,EAAE,CAAC;QACzD,yBAAoB,GAAkC,IAAI,GAAG,EAAE,CAAC;QAChE,qBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAClD,uBAAkB,GAAkB,IAAI,KAAK,EAAE,CAAC;IAElB,CAAC;IAEhC,aAAa,CAClB,KAAa,EACb,KAAa,EACb,QAAgB,EAChB,sBAA8B,EAC9B,4BAAoC,EACpC,0BAA8C;QAE9C,MAAM,WAAW,GAAgB;YAC/B,KAAK;YACL,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,EAAE;YACxB,QAAQ;YACR,sBAAsB;YACtB,4BAA4B;YAC5B,0BAA0B;SAC3B,CAAC;QACF,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;I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omicfoundation/ethereumjs-block";
3
- import { Common } from "@nomicfoundation/ethereumjs-common";
4
- import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
5
- import { BlockchainBase } from "./BlockchainBase";
6
- import { FilterParams } from "./node-types";
7
- import { RpcLogOutput } from "./output";
8
- import { HardhatBlockchainInterface } from "./types/HardhatBlockchainInterface";
9
- export declare class HardhatBlockchain extends BlockchainBase implements HardhatBlockchainInterface {
10
- private _length;
11
- constructor(common: Common);
12
- getLatestBlockNumber(): bigint;
13
- addBlock(block: Block): Promise<Block>;
14
- reserveBlocks(count: bigint, interval: bigint, previousBlockStateRoot: Buffer, previousBlockTotalDifficulty: bigint, previousBlockBaseFeePerGas: bigint | undefined): void;
15
- deleteLaterBlocks(block: Block): void;
16
- getTotalDifficulty(blockHash: Buffer): Promise<bigint>;
17
- getTransaction(transactionHash: Buffer): Promise<TypedTransaction | undefined>;
18
- getBlockByTransactionHash(transactionHash: Buffer): Promise<Block | null>;
19
- getTransactionReceipt(transactionHash: Buffer): Promise<import("./output").RpcReceiptOutput | null>;
20
- getLogs(filterParams: FilterParams): Promise<RpcLogOutput[]>;
21
- private _validateBlock;
22
- protected _delBlock(blockNumber: bigint): void;
23
- }
24
- //# sourceMappingURL=HardhatBlockchain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HardhatBlockchain.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/HardhatBlockchain.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAIhF,qBAAa,iBACX,SAAQ,cACR,YAAW,0BAA0B;IAErC,OAAO,CAAC,OAAO,CAAM;gBAET,MAAM,EAAE,MAAM;IAInB,oBAAoB,IAAI,MAAM;IAIxB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAQ5C,aAAa,CAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,MAAM,EAC9B,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,MAAM,GAAG,SAAS;IAYzC,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAS/B,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQtD,cAAc,CACzB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAI3B,yBAAyB,CACpC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAKX,qBAAqB,CAAC,eAAe,EAAE,MAAM;IAI7C,OAAO,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAIzE,OAAO,CAAC,cAAc;IAqBtB,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAI/C"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HardhatBlockchain = void 0;
4
- const ethereumjs_util_1 = require("@nomicfoundation/ethereumjs-util");
5
- const BlockchainBase_1 = require("./BlockchainBase");
6
- /* eslint-disable @nomicfoundation/hardhat-internal-rules/only-hardhat-error */
7
- class HardhatBlockchain extends BlockchainBase_1.BlockchainBase {
8
- constructor(common) {
9
- super(common);
10
- this._length = 0n;
11
- }
12
- getLatestBlockNumber() {
13
- return BigInt(this._length - 1n);
14
- }
15
- async addBlock(block) {
16
- this._validateBlock(block);
17
- const totalDifficulty = await this._computeTotalDifficulty(block);
18
- this._data.addBlock(block, totalDifficulty);
19
- this._length += 1n;
20
- return block;
21
- }
22
- reserveBlocks(count, interval, previousBlockStateRoot, previousBlockTotalDifficulty, previousBlockBaseFeePerGas) {
23
- super.reserveBlocks(count, interval, previousBlockStateRoot, previousBlockTotalDifficulty, previousBlockBaseFeePerGas);
24
- this._length += count;
25
- }
26
- deleteLaterBlocks(block) {
27
- const actual = this._data.getBlockByHash(block.hash());
28
- if (actual === undefined) {
29
- throw new Error("Invalid block");
30
- }
31
- this._delBlock(actual.header.number + 1n);
32
- }
33
- async getTotalDifficulty(blockHash) {
34
- const totalDifficulty = this._data.getTotalDifficulty(blockHash);
35
- if (totalDifficulty === undefined) {
36
- throw new Error("Block not found");
37
- }
38
- return totalDifficulty;
39
- }
40
- async getTransaction(transactionHash) {
41
- return this.getLocalTransaction(transactionHash);
42
- }
43
- async getBlockByTransactionHash(transactionHash) {
44
- const block = this._data.getBlockByTransactionHash(transactionHash);
45
- return block ?? null;
46
- }
47
- async getTransactionReceipt(transactionHash) {
48
- return this._data.getTransactionReceipt(transactionHash) ?? null;
49
- }
50
- async getLogs(filterParams) {
51
- return this._data.getLogs(filterParams);
52
- }
53
- _validateBlock(block) {
54
- const blockNumber = block.header.number;
55
- const parentHash = block.header.parentHash;
56
- const parent = this._data.getBlockByNumber(BigInt(blockNumber - 1n));
57
- if (BigInt(this._length) !== blockNumber) {
58
- throw new Error(`Invalid block number ${blockNumber}. Expected ${this._length}.`);
59
- }
60
- if ((blockNumber === 0n && !parentHash.equals((0, ethereumjs_util_1.zeros)(32))) ||
61
- (blockNumber > 0 &&
62
- parent !== undefined &&
63
- !parentHash.equals(parent.hash()))) {
64
- throw new Error("Invalid parent hash");
65
- }
66
- }
67
- _delBlock(blockNumber) {
68
- super._delBlock(blockNumber);
69
- this._length = blockNumber;
70
- }
71
- }
72
- exports.HardhatBlockchain = HardhatBlockchain;
73
- //# sourceMappingURL=HardhatBlockchain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HardhatBlockchain.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/HardhatBlockchain.ts"],"names":[],"mappings":";;;AAGA,sEAAyD;AAEzD,qDAAkD;AAKlD,+EAA+E;AAE/E,MAAa,iBACX,SAAQ,+BAAc;IAKtB,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,CAAC;QAHR,YAAO,GAAG,EAAE,CAAC;IAIrB,CAAC;IAEM,oBAAoB;QACzB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,KAAY;QAChC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,aAAa,CAClB,KAAa,EACb,QAAgB,EAChB,sBAA8B,EAC9B,4BAAoC,EACpC,0BAA8C;QAE9C,KAAK,CAAC,aAAa,CACjB,KAAK,EACL,QAAQ,EACR,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,CAC3B,CAAC;QACF,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,iBAAiB,CAAC,KAAY;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACvD,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,C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SACH;QAED,IACE,CAAC,WAAW,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAA,uBAAK,EAAC,EAAE,CAAC,CAAC,CAAC;YACrD,CAAC,WAAW,GAAG,CAAC;gBACd,MAAM,KAAK,SAAS;gBACpB,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EACpC;YACA,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACxC;IACH,CAAC;IAES,SAAS,CAAC,WAAmB;QACrC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;IAC7B,CAAC;CACF;AAtGD,8CAsGC"}
@@ -1,26 +0,0 @@
1
- import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
2
- import { List as ImmutableList, Map as ImmutableMap, Record as ImmutableRecord } from "immutable";
3
- export interface OrderedTransaction {
4
- orderId: number;
5
- data: TypedTransaction;
6
- }
7
- interface ImmutableOrderedTransaction {
8
- orderId: number;
9
- fakeFrom: string | undefined;
10
- data: string;
11
- txType: number;
12
- }
13
- export declare const makeSerializedTransaction: ImmutableRecord.Factory<ImmutableOrderedTransaction>;
14
- export type SerializedTransaction = ImmutableRecord<ImmutableOrderedTransaction>;
15
- export type SenderTransactions = ImmutableList<SerializedTransaction>;
16
- export type AddressToTransactions = ImmutableMap<string, SenderTransactions>;
17
- export type HashToTransaction = ImmutableMap<string, SerializedTransaction>;
18
- export interface PoolState {
19
- pendingTransactions: AddressToTransactions;
20
- queuedTransactions: AddressToTransactions;
21
- hashToTransaction: HashToTransaction;
22
- blockGasLimit: string;
23
- }
24
- export declare const makePoolState: ImmutableRecord.Factory<PoolState>;
25
- export {};
26
- //# sourceMappingURL=PoolState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PoolState.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/PoolState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,IAAI,IAAI,aAAa,EACrB,GAAG,IAAI,YAAY,EACnB,MAAM,IAAI,eAAe,EAC1B,MAAM,WAAW,CAAC;AAInB,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,UAAU,2BAA2B;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,yBAAyB,sDAMlC,CAAC;AAEL,MAAM,MAAM,qBAAqB,GAC/B,eAAe,CAAC,2BAA2B,CAAC,CAAC;AAC/C,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;AACtE,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAC7E,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAE5E,MAAM,WAAW,SAAS;IACxB,mBAAmB,EAAE,qBAAqB,CAAC;IAC3C,kBAAkB,EAAE,qBAAqB,CAAC;IAC1C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,oCAKxB,CAAC"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.makePoolState = exports.makeSerializedTransaction = void 0;
27
- const immutable_1 = require("immutable");
28
- const BigIntUtils = __importStar(require("../../util/bigint"));
29
- exports.makeSerializedTransaction = (0, immutable_1.Record)({
30
- orderId: 0,
31
- fakeFrom: undefined,
32
- data: "",
33
- txType: 0,
34
- });
35
- exports.makePoolState = (0, immutable_1.Record)({
36
- pendingTransactions: (0, immutable_1.Map)(),
37
- queuedTransactions: (0, immutable_1.Map)(),
38
- hashToTransaction: (0, immutable_1.Map)(),
39
- blockGasLimit: BigIntUtils.toHex(9500000),
40
- });
41
- //# sourceMappingURL=PoolState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PoolState.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/PoolState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAImB;AAEnB,+DAAiD;AAcpC,QAAA,yBAAyB,GACpC,IAAA,kBAAe,EAA8B;IAC3C,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,SAAS;IACnB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,CAAC;CACV,CAAC,CAAC;AAeQ,QAAA,aAAa,GAAG,IAAA,kBAAe,EAAY;IACtD,mBAAmB,EAAE,IAAA,eAAY,GAA8B;IAC/D,kBAAkB,EAAE,IAAA,eAAY,GAA8B;IAC9D,iBAAiB,EAAE,IAAA,eAAY,GAAiC;IAChE,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC;CAC1C,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
2
- import { MempoolOrder } from "./node-types";
3
- import { OrderedTransaction } from "./PoolState";
4
- /**
5
- * A queue of transactions in the order that they could be mined in the next
6
- * block.
7
- *
8
- * A transaction being part of this queue doesn't mean that it will be mined in
9
- * the next block, as it may not meet the required criteria to be included or
10
- * may not fit within the block.
11
- *
12
- * If after getting the next transaction in the queue you decided not to mine
13
- * it, the other transactions that belong to that sender MUST be removed from
14
- * the queue by calling the #removeLastSenderTransactions() method.
15
- **/
16
- export declare class TransactionQueue {
17
- private readonly _queuedTransactions;
18
- private readonly _heap;
19
- private _lastTransactionSender?;
20
- /**
21
- * Creates a TransactionQueue.
22
- *
23
- * @param pendingTransactions A map of sender to a list of their transactions,
24
- * sorted by nonce and without nonce gaps.
25
- * @param baseFee The base fee of the next block, if it's going to use EIP-1559
26
- */
27
- constructor(pendingTransactions: Map<string, OrderedTransaction[]>, mempoolOrder: MempoolOrder, baseFee?: bigint);
28
- getNextTransaction(): TypedTransaction | undefined;
29
- removeLastSenderTransactions(): void;
30
- private _moveFirstEnqueuedTransactionToHeap;
31
- }
32
- //# sourceMappingURL=TransactionQueue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransactionQueue.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/TransactionQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAKlE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAmEjD;;;;;;;;;;;IAWI;AACJ,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CACxB;IAEZ,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;IAEjD,OAAO,CAAC,sBAAsB,CAAC,CAAS;IAExC;;;;;;OAMG;gBAED,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,EACtD,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,MAAM;IAkBX,kBAAkB,IAAI,gBAAgB,GAAG,SAAS;IAclD,4BAA4B;IAYnC,OAAO,CAAC,mCAAmC;CAU5C"}
@@ -1,130 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.TransactionQueue = void 0;
30
- const heap_1 = __importDefault(require("mnemonist/heap"));
31
- const errors_1 = require("../../core/providers/errors");
32
- const BigIntUtils = __importStar(require("../../util/bigint"));
33
- function getEffectiveMinerFee(tx, baseFee) {
34
- // This mimics the EIP-1559 normalize_transaction function
35
- const maxFeePerGas = "gasPrice" in tx.data ? tx.data.gasPrice : tx.data.maxFeePerGas;
36
- const maxPriorityFeePerGas = "gasPrice" in tx.data ? tx.data.gasPrice : tx.data.maxPriorityFeePerGas;
37
- if (baseFee === undefined) {
38
- return maxFeePerGas;
39
- }
40
- return BigIntUtils.min(maxPriorityFeePerGas, maxFeePerGas - baseFee);
41
- }
42
- function decreasingOrderEffectiveMinerFeeComparator(left, right, baseFee) {
43
- const leftEffectiveMinerFee = getEffectiveMinerFee(left, baseFee);
44
- const rightEffectiveMinerFee = getEffectiveMinerFee(right, baseFee);
45
- const cmp = BigIntUtils.cmp(rightEffectiveMinerFee, leftEffectiveMinerFee);
46
- if (cmp !== 0) {
47
- return cmp;
48
- }
49
- // If two txs have the same effective miner fee we want to sort them
50
- // in increasing order by orderId.
51
- return left.orderId - right.orderId;
52
- }
53
- function decreasingOrderComparator(left, right) {
54
- return left.orderId - right.orderId;
55
- }
56
- function getOrderedTransactionHeap(mempoolOrder, baseFee) {
57
- switch (mempoolOrder) {
58
- case "priority":
59
- return new heap_1.default((a, b) => decreasingOrderEffectiveMinerFeeComparator(a, b, baseFee));
60
- case "fifo":
61
- return new heap_1.default((a, b) => decreasingOrderComparator(a, b));
62
- default:
63
- // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error
64
- throw new errors_1.InvalidInputError(`Invalid mempool order: ${mempoolOrder}`);
65
- }
66
- }
67
- /**
68
- * A queue of transactions in the order that they could be mined in the next
69
- * block.
70
- *
71
- * A transaction being part of this queue doesn't mean that it will be mined in
72
- * the next block, as it may not meet the required criteria to be included or
73
- * may not fit within the block.
74
- *
75
- * If after getting the next transaction in the queue you decided not to mine
76
- * it, the other transactions that belong to that sender MUST be removed from
77
- * the queue by calling the #removeLastSenderTransactions() method.
78
- **/
79
- class TransactionQueue {
80
- /**
81
- * Creates a TransactionQueue.
82
- *
83
- * @param pendingTransactions A map of sender to a list of their transactions,
84
- * sorted by nonce and without nonce gaps.
85
- * @param baseFee The base fee of the next block, if it's going to use EIP-1559
86
- */
87
- constructor(pendingTransactions, mempoolOrder, baseFee) {
88
- this._queuedTransactions = new Map();
89
- this._heap = getOrderedTransactionHeap(mempoolOrder, baseFee);
90
- for (const [address, txList] of pendingTransactions) {
91
- if (baseFee === undefined && txList.some((tx) => tx.data.type === 2)) {
92
- // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error
93
- throw new errors_1.InternalError("Trying to initialize and sort a mempool with an EIP-1559 tx but no base fee");
94
- }
95
- const [firstTx, ...remainingTxs] = txList;
96
- this._heap.push(firstTx);
97
- this._queuedTransactions.set(address, remainingTxs);
98
- }
99
- }
100
- getNextTransaction() {
101
- if (this._lastTransactionSender !== undefined) {
102
- this._moveFirstEnqueuedTransactionToHeap(this._lastTransactionSender);
103
- }
104
- const nextTx = this._heap.pop();
105
- if (nextTx === undefined) {
106
- return undefined;
107
- }
108
- this._lastTransactionSender = nextTx.data.getSenderAddress().toString();
109
- return nextTx.data;
110
- }
111
- removeLastSenderTransactions() {
112
- if (this._lastTransactionSender === undefined) {
113
- // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error
114
- throw new errors_1.InternalError("TransactionQueue#removeLastSenderTransactions called before TransactionQueue#getNextTransaction");
115
- }
116
- this._queuedTransactions.delete(this._lastTransactionSender);
117
- this._lastTransactionSender = undefined;
118
- }
119
- _moveFirstEnqueuedTransactionToHeap(sender) {
120
- const queue = this._queuedTransactions.get(sender);
121
- if (queue === undefined || queue.length === 0) {
122
- return;
123
- }
124
- const [first, ...rest] = queue;
125
- this._heap.push(first);
126
- this._queuedTransactions.set(sender, rest);
127
- }
128
- }
129
- exports.TransactionQueue = TransactionQueue;
130
- //# sourceMappingURL=TransactionQueue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransactionQueue.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/TransactionQueue.ts"],"names":[],"mappings":";;;;;;;;;;;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AAI,CAAC,mCAAmC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;SACvE;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAChC,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC;QACxE,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAEM,4BAA4B;QACjC,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,EAAE;YAC7C,sFAAsF;YACtF,MAAM,IAAI,sBAAa,CACrB,iGAAiG,CAClG,CAAC;SACH;QAED,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC7D,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAC1C,CAAC;IAEO,mCAAmC,CAAC,MAAc;QACxD,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7C,OAAO;SACR;QAED,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AAxED,4CAwEC"}
@@ -1,83 +0,0 @@
1
- /// <reference types="node" />
2
- import { Common } from "@nomicfoundation/ethereumjs-common";
3
- import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
4
- import { StateManager } from "@nomicfoundation/ethereumjs-statemanager";
5
- import { Address } from "@nomicfoundation/ethereumjs-util";
6
- import { OrderedTransaction, SerializedTransaction } from "./PoolState";
7
- export declare function serializeTransaction(tx: OrderedTransaction): SerializedTransaction;
8
- export declare function deserializeTransaction(tx: SerializedTransaction, common: Common): OrderedTransaction;
9
- export declare class TxPool {
10
- private readonly _stateManager;
11
- private _state;
12
- private _snapshotIdToState;
13
- private _nextSnapshotId;
14
- private _nextOrderId;
15
- private readonly _deserializeTransaction;
16
- constructor(_stateManager: StateManager, blockGasLimit: bigint, common: Common);
17
- addTransaction(tx: TypedTransaction): Promise<void>;
18
- /**
19
- * Remove transaction with the given hash from the mempool. Returns true
20
- * if a transaction was removed, false otherwise.
21
- */
22
- removeTransaction(txHash: Buffer): boolean;
23
- snapshot(): number;
24
- revert(snapshotId: number): void;
25
- getTransactionByHash(hash: Buffer): OrderedTransaction | undefined;
26
- hasPendingTransactions(): boolean;
27
- hasQueuedTransactions(): boolean;
28
- isEmpty(): boolean;
29
- getPendingTransactions(): Map<string, OrderedTransaction[]>;
30
- getQueuedTransactions(): Map<string, OrderedTransaction[]>;
31
- /**
32
- * Returns the next available nonce for an address, taking into account
33
- * its pending transactions.
34
- */
35
- getNextPendingNonce(accountAddress: Address): Promise<bigint>;
36
- getBlockGasLimit(): bigint;
37
- setBlockGasLimit(newLimit: bigint | number): void;
38
- /**
39
- * Updates the pending and queued list of all addresses
40
- */
41
- updatePendingAndQueued(): Promise<void>;
42
- private _getSenderAddress;
43
- private _removeSnapshotsAfter;
44
- private _removeTx;
45
- private _addPendingTransaction;
46
- private _addQueuedTransaction;
47
- private _validateTransaction;
48
- private _knownTransaction;
49
- private _transactionExists;
50
- private _getTransactionsByHash;
51
- private _getPending;
52
- private _getQueued;
53
- private _getPendingForAddress;
54
- private _getQueuedForAddress;
55
- private _setTransactionByHash;
56
- private _setPending;
57
- private _setQueued;
58
- private _setPendingForAddress;
59
- private _setQueuedForAddress;
60
- private _setBlockGasLimit;
61
- private _deleteTransactionByHash;
62
- private _isTxValid;
63
- /**
64
- * Returns the next available nonce for an address, ignoring its
65
- * pending transactions.
66
- */
67
- private _getNextConfirmedNonce;
68
- /**
69
- * Checks if some pending tx with the same nonce as `newTx` exists.
70
- * If it exists, it replaces it with `newTx` and returns true.
71
- * Otherwise returns false.
72
- */
73
- private _replacePendingTx;
74
- /**
75
- * Checks if some queued tx with the same nonce as `newTx` exists.
76
- * If it exists, it replaces it with `newTx` and returns true.
77
- * Otherwise returns false.
78
- */
79
- private _replaceQueuedTx;
80
- private _replaceTx;
81
- private _getMinNewFeePrice;
82
- }
83
- //# sourceMappingURL=TxPool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TxPool.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/TxPool.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAEL,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EACL,OAAO,EAGR,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EAIL,kBAAkB,EAGlB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAQrB,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,kBAAkB,GACrB,qBAAqB,CAYvB;AAED,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,qBAAqB,EACzB,MAAM,EAAE,MAAM,GACb,kBAAkB,CAwCpB;AAED,qBAAa,MAAM;IAWf,OAAO,CAAC,QAAQ,CAAC,aAAa;IAVhC,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,kBAAkB,CAAiD;IAC3E,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,YAAY,CAAK;IAEzB,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAEhB;gBAGL,aAAa,EAAE,YAAY,EAC5C,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM;IAQH,cAAc,CAAC,EAAE,EAAE,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