-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Can not override block time when using debug_traceCall #3425
Copy link
Copy link
Closed
Description
System information
Geth version: v1.6.1
OS & Version: Linux
Description
- Steps to reproduce the behaviour
Usedebug_traceCallto invoke the Solidity functiongetBlockTimeand retrieve the current timestamp, overriding the contract’s bytecode with deployedBytecode.
Solidity code
pragma solidity ^0.8.10;
contract TestContract {
// return current block time
function getBlockTime() external view returns (uint256) {
return block.timestamp;
}
// return current block number
function getBlockNumber() external view returns (uint256) {
return block.number;
}
}
debug_traceCall request
curl --location '${node_url}' \
--header 'Content-Type: application/json' \
--data '{
"method": "debug_traceCall",
"params": [
{
"data": "0x87ceff09",
"from": "0x0000000000000000000000000000000000000123",
"gas": "0x989680",
"to": "0x0000000000000000000000000000000000000456"
},
{
"blockNumber": "latest"
},
{
"blockOverrides": {
"time": "0x6900f01c"
},
"stateOverrides": {
"0x0000000000000000000000000000000000000456": {
"code": "0x60808060405260043610156011575f80fd5b5f3560e01c90816342cbb15c14604b57506387ceff0914602f575f80fd5b346047575f3660031901126047576020604051428152f35b5f80fd5b346047575f366003190112604757602090438152f3fea2646970667358221220e7829528880307a115d058645cd271cb41b041ae2c7b547548acd9e4d893093964736f6c634300081c0033"
}
},
"tracer": "callTracer",
"tracerConfig": {
"onlyTopCall": false,
"withLog": true
}
}
],
"id": 1,
"jsonrpc": "2.0"
}'
- Expected behaviour
The output response should return override timestamp6900f01clike this:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"from": "0x0000000000000000000000000000000000000123",
"gas": "0x989680",
"gasUsed": "0x52f3",
"to": "0x0000000000000000000000000000000000000456",
"input": "0x87ceff09",
"output": "0x000000000000000000000000000000000000000000000000000000006900f01c",
"value": "0x0",
"type": "CALL"
}
}
You can try to use a geth node it will return response above
- Actual behaviour
Response still return current block timestamp0x6900f78d
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"from": "0x0000000000000000000000000000000000000123",
"gas": "0x989680",
"gasUsed": "0x52f3",
"to": "0x0000000000000000000000000000000000000456",
"input": "0x87ceff09",
"output": "0x000000000000000000000000000000000000000000000000000000006900f78d",
"value": "0x0",
"type": "CALL"
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels