コード例 #1
0
    def testBitvector_max1_noop(self):
        from manticore import config

        consts = config.get_group("smt")
        consts.optimize = False
        self.testBitvector_max1()
        consts.optimize = True
コード例 #2
0
    def testBitvector_max(self):
        cs = ConstraintSet()
        a = cs.new_bitvec(32)
        cs.add(a <= 200)
        cs.add(a >= 100)
        self.assertTrue(self.solver.check(cs))
        self.assertEqual(self.solver.minmax(cs, a), (100, 200))
        from manticore import config

        consts = config.get_group("smt")
        consts.optimize = False
        cs = ConstraintSet()
        a = cs.new_bitvec(32)
        cs.add(a <= 200)
        cs.add(a >= 100)
        self.assertTrue(self.solver.check(cs))
        self.assertEqual(self.solver.minmax(cs, a), (100, 200))
        consts.optimize = True
コード例 #3
0
contract ManticoreTest is DharmaDaiImplementationV0{

  function fromUnderlying(
    uint256 underlying, uint256 exchangeRate, bool roundUp
  ) external returns (uint256 amount) {
     amount = _fromUnderlying(underlying, exchangeRate, roundUp);
    }
}

'''

from manticore import config
from manticore.ethereum import ManticoreEVM, ABI
m = ManticoreEVM()
config.get_group("smt").timeout = 3600
config.get_group("evm").oog = "ignore"
controller = m.create_account(balance=1 * 10**18)
contract = m.solidity_create_contract('.',
                                      contract_name='ManticoreTest',
                                      owner=controller,
                                      compile_args={'ignore_compile': True})

underlying = m.make_symbolic_value()
exchangeRate = m.make_symbolic_value()
roundUp = m.make_symbolic_value(8)
#All arguments nonzero
m.constrain(underlying != 0)
m.constrain(exchangeRate != 0)
#roundUp true
m.constrain(roundUp != 0)