Skip to content

Commit 57f0423

Browse files
fix: make debug_storageRangeAt return all known keys at transaction index (trufflesuite#3470)
Co-authored-by: MicaiahReid <micaiahreid@gmail.com>
1 parent 533f002 commit 57f0423

File tree

9 files changed

+588
-539
lines changed

9 files changed

+588
-539
lines changed

src/chains/ethereum/ethereum/src/api.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -3135,11 +3135,12 @@ export default class EthereumApi implements Api {
31353135
* console.log(transactionTrace);
31363136
* ```
31373137
*/
3138+
@assertArgLength(1, 2)
31383139
async debug_traceTransaction(
31393140
transactionHash: DATA,
3140-
options?: Ethereum.TraceTransactionOptions
3141+
options: Ethereum.TraceTransactionOptions = {}
31413142
): Promise<Ethereum.TraceTransactionResult<"private">> {
3142-
return this.#blockchain.traceTransaction(transactionHash, options || {});
3143+
return this.#blockchain.traceTransaction(transactionHash, options);
31433144
}
31443145

31453146
// TODO: example doesn't return correct value
@@ -3186,14 +3187,22 @@ export default class EthereumApi implements Api {
31863187
* console.log(storage);
31873188
* ```
31883189
*/
3190+
@assertArgLength(5)
31893191
async debug_storageRangeAt(
31903192
blockHash: DATA,
31913193
transactionIndex: number,
31923194
contractAddress: DATA,
31933195
startKey: DATA,
31943196
maxResult: number
31953197
): Promise<Ethereum.StorageRangeAtResult<"private">> {
3196-
return this.#blockchain.storageRangeAt(
3198+
const blockchain = this.#blockchain;
3199+
if (blockchain.fallback) {
3200+
throw new Error(
3201+
"debug_storageRangeAt is not supported on a forked network. See https://github.com/trufflesuite/ganache/issues/3488 for details."
3202+
);
3203+
}
3204+
3205+
return blockchain.storageRangeAt(
31973206
blockHash,
31983207
Quantity.toNumber(transactionIndex),
31993208
contractAddress,

0 commit comments

Comments
 (0)