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

Historic buggy implementation of ORIGIN opcode. #42

Closed
andelf opened this issue Nov 4, 2020 · 1 comment
Closed

Historic buggy implementation of ORIGIN opcode. #42

andelf opened this issue Nov 4, 2020 · 1 comment

Comments

@andelf
Copy link
Owner

andelf commented Nov 4, 2020

        case ORIGIN: {
          DataWord originAddress = program.getOriginAddress();

          if (VMConfig.allowMultiSign()) { //allowMultiSign proposal
            originAddress = new DataWord(originAddress.getLast20Bytes());
          }

          if (logger.isDebugEnabled()) {
            hint = ADDRESS_LOG + Hex.toHexString(originAddress.getLast20Bytes());
          }

          program.stackPush(originAddress);
          program.step();
        }

Fails on:

modifier isHuman() {
        address _addr = msg.sender;
        require (_addr == tx.origin, "Human only");

        uint256 _codeLength;
        assembly { _codeLength := extcodesize(_addr) }
        require(_codeLength == 0, "Human only");
        _;
    }
@andelf
Copy link
Owner Author

andelf commented Nov 4, 2020

After fix:

javatron:

"receipt": {
    "energy_fee": 11140,
    "energy_usage": 0,
    "energy_usage_total": 557,
    "net_fee": 0,
    "net_usage": 346,
    "origin_energy_usage": 0,
    "result": "REVERT"
  },

opentron:

free BW usage: 2957/5000 (+346)
fee_limit=1000000000, energy_limit=1739169
E usage: caller=origin=557
E usage: total=557 frozen=0 burnt=557 fee=11140
trigger contract, vm_exit_reason=Revert(Reverted) contract_status=Revert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant