My first non-trivial solidity contract!

drcodedrcode Member Posts: 62 ✭✭
edited February 2015 in Solidity
I wrote an Order Statistic Tree implementation, essential for ranking/comparing users and/or products: https://github.com/drcode/ethereum-order-statistic-tree

I would welcome any feedback on my usage of ethereum contracts and solidity... since I am not part of the ethereum team(s) I would greatly appreciate any feedback on conceptual issues regarding the design of this contract from experienced ethereum devs.

Note to solidity & go-ethereum dev teams: After overcoming the initial "alpha software" config hurdles, I was surprised to encounter basically ZERO issues in either the solidity compiler or go-ethereum CLI during the creation of this contract... GOOD WORK!

Comments

  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    Amazing work @drcode , thank you!
  • androloandrolo Jamtland, SwedenMember Posts: 36 ✭✭
    Wow, nice.

    Also, you have the best avatar and name.
  • AronVanAmmersAronVanAmmers Amsterdam, NetherlandsMember Posts: 40 ✭✭
    This works, at least basically, on ethereum-cpp on Windows, build AlethZero-Win32-20150224173108-0.8.2-54-5-f1996c6 on the PoC testnet.

    What I did:
    1. Start a webserver to host these files on http://localhost:12345
    2. Open http://localhost:12345/ost_test.html
    3. Press "Publish contract". I get a message box asking me to confirm the creation. The contract is created successfully.
    4. Press "Run tests". This takes a while and results in a table with results. A couple green, a couple red and most empty.
    Not sure whether this was the completely desired result, but at least the basics seem to work. Great to have a complete and working example of a DApp with a Solidity contract!
  • drcodedrcode Member Posts: 62 ✭✭
    edited February 2015
    Hi, @AronVanAmmers, I've updated the documentation on github to show sample output from pressing the "Run Tests" button. It should appear as follows: http://jsfiddle.net/zwxsqcr0/1/

    I just ran it today and it worked OK for me, but I'm 100% dedicated to go-ethereum, I was planning on staying away from ethereum-cpp for a few more weeks... I can only cope with one piece of alpha ethereum software at a time :-)

    Good to hear you're getting at least SOME positive results, not sure why they're not 100% the same, could be bad javascript triggering undefined behavior in the API, or just bugs in ethereum-cpp. (I'm also a little unclear at how ethereumjs deals with zero confirmation transactions... it's possible the errors you're seeing is because ethereum-cpp does transaction reordering in some way that confuses the test harness...)

    Please follow the following exact steps and let me know if this gives you the same output:
    1. Refresh the browser
    2. Press "Publish contract"
    3. Press "Run Tests"

    If you're still getting red output, I'd appreciate it if you sent it to me at drcode [@] gmail.com so that I can look at what's happening - I'm curious to know where the two ethereum clients diverge... any javascript errors would be helpful as well.
  • ryepdxryepdx Member Posts: 13
    Hey, thanks for sharing this! I'm using your test framework to springboard my own TDD efforts. I'll be sure to check back in here once I've got something together so you can see what I did with your testing concept. :-)
Sign In or Register to comment.