From e38dcbdec082f796a535d1ca88d28453a0d80c41 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 2 Jun 2022 11:48:45 +0200 Subject: [PATCH] docs: documentation about block overrides in debug traceCall (#25014) --- docs/_rpc/ns-debug.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/_rpc/ns-debug.md b/docs/_rpc/ns-debug.md index 8f4d1336ad155..fd6a289775794 100644 --- a/docs/_rpc/ns-debug.md +++ b/docs/_rpc/ns-debug.md @@ -612,6 +612,42 @@ debug.traceCall({ }, "latest", {"disableStorage": true, "disableMemory": true}) ``` + +It is possible to supply 'overrides' for both state-data (accounts/storage) and block data (number, timestamp etc). In the example below, +a call which executes `NUMBER` is performed, and the overridden number is placed on the stack: +``` +> debug.traceCall({ + from: eth.accounts[0], + value:"0x1", + gasPrice: "0xffffffff", + gas: "0xffff", + input: "0x43"}, + "latest", + {"blockoverrides": + {"number": "0x50"} + }) +{ + failed: false, + gas: 53018, + returnValue: "", + structLogs: [{ + depth: 1, + gas: 12519, + gasCost: 2, + op: "NUMBER", + pc: 0, + stack: [] + }, { + depth: 1, + gas: 12517, + gasCost: 0, + op: "STOP", + pc: 1, + stack: ["0x50"] + }] +} +``` + Curl example: ``` > curl -H "Content-Type: application/json" -X POST localhost:8545 --data '{"jsonrpc":"2.0","method":"debug_traceCall","params":[null, "pending"],"id":1}'