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

User-friendly Throwing Warning or Error when Account Executing with Insufficient Balance #2551

Open
CharesFang opened this issue May 22, 2022 · 0 comments
Labels

Comments

@CharesFang
Copy link

Description

Just take a case from the wiki doc (I pasted the code at the end); I want to create a contract_count by executing the solidity_create_contract function. However, many users met the same situation as me that we just received nothing but a None object. The Manticore would not throw any warning or error, which is really frustrated. I checked the doc several times and spent nearly half of a day trying to find the main cause. Finally, I got that Manticore would just return a None when the account executed commands with insufficient balance. And the unit of balance is really minor, so we have to give the user_account a really big number.

Suggestion

I just think that the Manticore should throw some kind of warnings/errors when the EVM executed some functions but failed due to the insufficient balances, and then users would know how to handle such situations.

Appendix

My test script is as follows, replace the path variable with your own solc abspath.

import unittest
from manticore.ethereum import ManticoreEVM

path = "YOUR_SOLC_PATH"


class MTestCase(unittest.TestCase):
    def test_deploy_contract(self):
        m = ManticoreEVM()
        user_account = m.create_account(balance=1000)
        # user_account = m.create_account(balance=10**20) # This statement will successfully pass the test.
        source_code = '''
        pragma solidity >=0.4.24 <0.6.0;
        contract Simple {
            function f(uint a) payable public{
                if (a == 65) {
                    revert();
                }
            }
        }
        '''
        # Initiate the contract
        contract_account = m.solidity_create_contract(source_code, owner=user_account, compile_args={'solc': path})

        self.assertIsNotNone(contract_account)


if __name__ == '__main__':
    unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant