diff --git a/.changeset/blue-ravens-smile.md b/.changeset/blue-ravens-smile.md new file mode 100644 index 0000000000..945f4dc47b --- /dev/null +++ b/.changeset/blue-ravens-smile.md @@ -0,0 +1,5 @@ +--- +"hardhat": patch +--- + +Fixed an issue with `debug_traceTransaction` when large responses were generated diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts index 939ca6b3b7..c48c51cfb7 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts @@ -354,7 +354,13 @@ export class EdrProviderWrapper const responseObject: Response = await this._provider.handleRequest( stringifiedArgs ); - const response = JSON.parse(responseObject.json); + + let response; + if (typeof responseObject.data === "string") { + response = JSON.parse(responseObject.data); + } else { + response = responseObject.data; + } const needsTraces = this._node._vm.evm.events.eventNames().length > 0 || diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts index bf75d7d30a..f80fa55d61 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts @@ -82,7 +82,12 @@ export function getMinimalEthereumJsVm( }) ); - const response = JSON.parse(responseObject.json); + let response; + if (typeof responseObject.data === "string") { + response = JSON.parse(responseObject.data); + } else { + response = responseObject.data; + } return Buffer.from(response.result.slice(2), "hex"); },