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

OpenZeppelin unit test fails. Error: invalid literal for int() with base 16: '' #268

Closed
mich-master opened this issue Oct 21, 2021 · 1 comment
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mich-master
Copy link
Contributor

mich-master commented Oct 21, 2021

Impact:
Proxy + Neon EVM <-> OpenZeppelin library compatibility
Safe math operations computation

STR:

  1. Set up Truffle environment for the OpenZeppelin library as described
    Other changes neonlabsorg/neon-evm#219
  2. Run the unit test for "SafeMath" contract
    truffle --network solana test ./test/utils/math/SafeMath.test.js

Actual result:
Error message

Contract: SafeMath
with default revert message
add
reverts on addition overflow:
Wrong kind of exception received
+ expected - actual
-invalid literal for int() with base 16: ''
+revert

Expected result:
Test passed successfully.

Additional info:
OpenZeppelin test: Contract: ERC20FlashMint flashLoan.more than maxFlashLoan

    it ('more than maxFlashLoan', async function () {
      const receiver = await ERC3156FlashBorrowerMock.new(true, true);
      const data = this.token.contract.methods.transfer(other, 10).encodeABI();
      // _mint overflow reverts using a panic code. No reason string.
      await expectRevert.unspecified(this.token.flashLoan(receiver.address, this.token.address, MAX_UINT256, data));
    });

The revert result can be returned through different solidity ways. In any case, the first 4 bytes contain a selector, which identifies the method used to encode the result. Some possible values:

  • 08c379a0 - Error(string)
  • 4e487b71 - Panic(uint256)

We should analyze the selector before parse followed data:
https://github.com/neonlabsorg/proxy-model.py/blob/5cb42d5e7f951338e787f669e96512499b081a89/proxy/plugin/solana_rest_api_tools.py#L363-L371

See also:

@mich-master
Copy link
Contributor Author

The error message "invalid literal for int() with base 16: ''" seems to be from Python.
Probably, the bug is located in Proxy.

@s-medvedev s-medvedev transferred this issue from neonevm/neon-evm Nov 5, 2021
@s-medvedev s-medvedev added good first issue Good for newcomers bug Something isn't working labels Nov 5, 2021
@s-medvedev s-medvedev self-assigned this Nov 12, 2021
s-medvedev added a commit that referenced this issue Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants