Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jsonrpc] Add debug_traceTransaction endpoint #202

Merged
merged 29 commits into from
Oct 10, 2022

Conversation

DarianShawn
Copy link
Collaborator

@DarianShawn DarianShawn commented Sep 29, 2022

Description

This PR provides a new jsonRPC namespace debug and debug_traceTransaction endpoint.
Provides only basic feature, no configuration, let alone different types of js tracers.
Those features shall be done in other PRs.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

  • Set up a one-node geth private network, and a one-node dogechain private network.
  • Deploy some test contracts to each network, code as below:
  • Call the contract methods in each network.
  • Call debug_traceTransaction of all transactions in each network.
    • Should get the almost same results in each network. Small differences should be in gas prices only.
    • The comparison includes: pc, memory, stack, storage, return value, and formatting.
pragma solidity ^0.8.0;

contract test3 {
    uint x;
    uint y;

    function set(uint _x, uint _y) public {
        x = _x;
        y = _y;
    }

    function getAdd() public view returns(uint) {
        return x + y;
    }
}
pragma solidity ^0.8.0;

contract RevertTest {
    function revert1() public {
       require(1 == 0, "I make a mistake");
    }

    function revert2() public {
        // don't tell anybody the reason
        require(1 == 0);
    }
}
pragma solidity ^0.4.23;

contract Calltest {
    address public b;
    uint256 public n;
 
    function test() public returns (address a){
        a=address(this);
        b=a;
    }

    function increase(uint number) public {
        n += number;
    }
}

contract Compare {
    address public b;
    address public testaddress;

    constructor(address _addressOfCalltest) public {
        testaddress = _addressOfCalltest;
    }

    function withcall() public {
        testaddress.call(bytes4(keccak256("test()")));
        testaddress.call(bytes4(keccak256("increase(uint256)")), 10);
    }

    function withdelegatecall() public {
        testaddress.delegatecall(bytes4(keccak256("test()")));
        testaddress.call(bytes4(keccak256("increase(uint256)")), 100);
    }
}

Additional comments

Associated issues: #50

@DarianShawn DarianShawn added the feature New update to Dogechain label Sep 29, 2022
@DarianShawn DarianShawn added this to the Release 1.1.4 milestone Sep 29, 2022
@DarianShawn DarianShawn self-assigned this Sep 29, 2022
0xcb9ff9
0xcb9ff9 previously approved these changes Oct 8, 2022
Copy link

@0xcb9ff9 0xcb9ff9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@abrahamcruise321 abrahamcruise321 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Job!
Testing INTERNAL_TRANSACTION for explorer.

@DarianShawn DarianShawn dismissed stale reviews from abrahamcruise321 and 0xcb9ff9 via 83ab893 October 10, 2022 06:57
@DarianShawn
Copy link
Collaborator Author

Hi, @abrahamcruise321 .
I've rechecked and fixed some issues in storage formatting and revert returnValue.
Go ahead with the latest update, please.

@DarianShawn DarianShawn force-pushed the feature/debug-rpc-endpoint branch from 83ab893 to 0bd7f87 Compare October 10, 2022 07:25
Copy link
Collaborator

@abrahamcruise321 abrahamcruise321 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@abrahamcruise321 abrahamcruise321 merged commit 9f46df9 into dev Oct 10, 2022
@abrahamcruise321 abrahamcruise321 deleted the feature/debug-rpc-endpoint branch October 10, 2022 09:27
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Dogechain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants