Giter Site home page Giter Site logo

cll-sim's People

Contributors

caktux avatar jorisbontje avatar mode80 avatar o-jasper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cll-sim's Issues

More convenient & powerful checking.

Having to refer all the way down assert self.contract.storage[index] == is a bit tiresome, and also we dont check all the things that shouldnt change. I propose we want ability to easily:

  • declare what values should be:
    • for consequentive array entries(also change by certain factor/addition)
    • for values that are zero
  • declare that a value has changed by a certain factor or addition.
  • for balances, declare change-by-addition excepting fees
  • track changes
    • declaring things shouldnt (have) change(d)
    • declaring nothing change(d) other than specified
    • exceptions to the above
  • track transactions
    • how many of them
    • any of their attributes, as (non)specific as desired.
  • how it stopped, or the whole 'logic path'

With the latter i mean, now we check simulation.stopped, we could instead have .cll(heard name .hll floating around too?) files scan for comments besides those on stop, and make a list. Then you could check that entire flow.

jorisbontje mentioned testing libraries. (pytest, nosetest or unittest) To be honest i am not familiar about them, or how they fit in.

mktx

Required for examples/hedging.py

Examples cannot work!

For example: when I am trying to ./run.py examples/escrow.py
there are some errors:
sim INFO RUN Test insufficient fee:
sim WARNING Stopped: Insufficient fee
Traceback (most recent call last):
File "./run.py", line 44, in
main(args.script)
File "./run.py", line 38, in main
simulation.run_all()
File "./lib/sim.py", line 218, in run_all
method()
File "examples/escrow.py", line 87, in test_insufficient_fee
self.run(tx, contract)
File "./lib/sim.py", line 244, in run
totalgas = gas.calculate_gas(contract)
File "./lib/sim.py", line 387, in calculate_gas
code_lines = contract.closure.split('\n')
AttributeError: 'Escrow' object has no attribute 'closure'

Looks like I miss some libraries?

subcurrency.cll wont compile

  • python cllcompiler.py subcurrency.cll

Traceback (most recent call last):
File "cllcompiler.py", line 208, in
print ' '.join([str(k) for k in compile(open(sys.argv[1]).read())])
File "cllcompiler.py", line 201, in compile
p = parse_lines(lines)
File "/Users/hhalfordthompson/ethereum/compiler/cllparser.py", line 38, in parse_lines
out.append(parse_lines(child_block))
File "/Users/hhalfordthompson/ethereum/compiler/cllparser.py", line 32, in parse_lines
out = parse_line(main)
File "/Users/hhalfordthompson/ethereum/compiler/cllparser.py", line 217, in parse_line
return [ 'set', shunting_yard(tokens[:eqplace]), shunting_yard(tokens[eqplace+1:]) ]
File "/Users/hhalfordthompson/ethereum/compiler/cllparser.py", line 162, in shunting_yard
typ = toktype(tok)
File "/Users/hhalfordthompson/ethereum/compiler/cllparser.py", line 126, in toktype
else: raise Exception("Invalid token: "+token)
Exception: Invalid token: MYCREATOR

Try this approach to testing

Contracts have 'discrete states modulo parameters' i.e with the lockin-escrow case you have a Idle(balance) state and and a Customer(balance, address, incentive, total, paid) state.

If those are vertexes of graphs, transactions sent to a contract go through one of the edges depending on parameter circumstance, changing parameters as function of the earlier parameters, including those of the attempted edge. I.e. attempted edges are functions. allow(value,address, incentive, total), refund(value), accept(value), send(value) each of those returns a function i.e:

allow(value,address,incentive,total)(Idle(balance)) == 
 Customer(balance+value-fee,address,incentive,total,0)

If we figure out those functions we can try parameters all we want. Contracts need to be robust against anything you throw at it, now we can throw 'noise' at it. The 'noise' could be focussed on edge cases to improve it. Of course you cant only rely on black-box testing entirely.

Note: but dont mind either way if i'll do it later or if someone else does. (just wanted to note it down)

Make `mktx` update balances

Probably you didnt do this because it doesnt simulate fees? I reckon it could do balances could be added.. As for adding fees, kindah against making attempts to simulate.. Not sure, i reckon having the actual ethereum script interpreter behind there might be a better approach?

Fees could be constant, or maybe random. ..Kindah might want an easy way to get the random seed of the cases where the test failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.