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

Add challenge exit tests #47

Open
troggy opened this issue Aug 9, 2019 · 31 comments · May be fixed by #83
Open

Add challenge exit tests #47

troggy opened this issue Aug 9, 2019 · 31 comments · May be fixed by #83

Comments

@troggy
Copy link
Member

troggy commented Aug 9, 2019

Bounty

This is a critical functionality and we should be testing it with integration tests.

Scope

  • create a test or multiple tests for:
    • challengeExit with Transfer
    • challengeExit for deposit
    • challengeExit with Spending Condition (simple inclusion as of now)
    • challengeYoungestInput

Deliverables

  • updated integration tests

Gain for the project

peace of mind, automatically catch regressions in challenge code

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 363.0 DAI (363.0 USD @ $1.0/DAI) attached to it as part of the https://github.com/leapdao fund.

@simonweniger
Copy link
Member

Hey @mul1sh , thanks for starting to work on the bounty. LeapDAO is a Decentralized Autonomous Organisation creating the Leap Network, a scalable second layer solution for the Ethereum Blockchain. The holacratic DAO has over 20 active members world-wide developing and maintaining the network. Its mission is to enable scalable Dapps to operate securely on layer-2 of Ethereum as well as widening the scope of possible Dapps in the Ethereum ecosystem.

If you're intrested to join LeapDAO and contribute to the project long term feel free to join our slack and check all available bountys

greetings Simon Weniger
DEV Link at LeapDAO

@mul1sh
Copy link

mul1sh commented Jan 3, 2020

@simonweniger awesome thanks for the invitation 🙂.

Joining slack now too, I've started working on this bounty and will definitely reach out if im stuck.

@mul1sh
Copy link

mul1sh commented Jan 9, 2020

hi @troggy @simonweniger I'm still working on this and I had a few questions.

  • First of all just to be sure, i'm writing tests targeting the challengeExit function in the ExitHandler.sol contract, correct?
  • If this is the case where I can get its implementation, from the solidity code I fairly understand how the function works but an implementation would help me figure out all its working for the test cases.
  • Finally, are there any other docs I can access about the workings of leapdao other than https://docs.leapdao.org/, because I also need clarification about other terms used i.e. color tokens e.t.c

Thanks

@simonweniger
Copy link
Member

@johannbarbie, @troggy can you help ?

@troggy
Copy link
Member Author

troggy commented Jan 9, 2020

i'm writing tests targeting the challengeExit function in the ExitHandler.sol contract, correct?

correct.

where I can get its implementation, from the solidity code I fairly understand how the function works but an implementation would help me figure out all its working for the test cases.

I'm not sure what do you call an "implementation" here? 🤔If you are looking for a usage example, take a look at this script for challengeExit.

Finally, are there any other docs I can access about the workings of leapdao other than https://docs.leapdao.org/, because I also need clarification about other terms used i.e. color tokens e.t.c

@simonweniger can help you with general questions. Otherwise, I would prefer to have a call — it is faster. I'm @kosta on LeapDAO Slack, ping me and we'll schedule a call.

@mul1sh
Copy link

mul1sh commented Jan 12, 2020

@troggy thanks for the awesome feedback 🙂 , I've reached out in slack.

@gitcoinbot
Copy link

@mul1sh Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@mul1sh
Copy link

mul1sh commented Jan 15, 2020

@gitcoinbot yep almost done :)

@simonweniger
Copy link
Member

Hey @mul1sh ,
how is it going ? Do you need any help ?

@mul1sh
Copy link

mul1sh commented Feb 5, 2020

Finally doing 1 last test and then I submit in a few hours :)

@troggy
Copy link
Member Author

troggy commented Feb 7, 2020

@mul1sh Unfortunately, we will have to un-assign you from this bounty.

if you have problems implementing the task — just say so, please and ask for assistance. There is nothing bad about this. We are here to help, but we need your cooperation as well.

/cc @simonweniger

@mul1sh
Copy link

mul1sh commented Feb 7, 2020

Hey @troggy I'm submitting today no more delays promise 🙂. Yes I had a few issues understanding the whole flow, I definitely should have asked for help but I also wanted to learn more about the contracts by breaking it down and putting it back together hence why I have taken this long, but sorry for this I realize this was an oversight on my end.

Nonetheless expect the tests fully working in the next few hours, in fact i'm wrapping them up now.

@troggy
Copy link
Member Author

troggy commented Feb 7, 2020

hence why I have taken this long

from my point of view, there is no problem with task taking too long — that's fine, we are not in a hurry. The problem is in poor communication

@mul1sh
Copy link

mul1sh commented Feb 7, 2020

I agree, I'll be more proactive in communicating my progress and also ask questions frequently in case i'm stuck going forward.

@troggy
Copy link
Member Author

troggy commented Feb 7, 2020

a good first step to improve the situation IMO is to push your work in progress into PR. Takes only a minute, the code doesn't have to be working

@Sprimage
Copy link

I noticed he abandoned this bounty

@Technical-Vairix
Copy link

Technical-Vairix commented Feb 18, 2020

@troggy Hey, how are you? pls ping me when you can talk about the bounty https://gitcoin.co/issue/leapdao/leap-sandbox/47/3832, I have some questions before start to work on this.

@troggy
Copy link
Member Author

troggy commented Feb 18, 2020

@Technical-Vairix post your questions here pls

@gitcoinbot
Copy link

@Sprimage Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@Sprimage
Copy link

Trying to write the challengeExit function, I see the other tests have actions. Is this a requirement for the test? I need to write an action for the challengeExit too no?

@troggy
Copy link
Member Author

troggy commented Feb 28, 2020

I see the other tests have actions

what do you mean by that?

This is an example of "test": https://github.com/leapdao/leap-sandbox/blob/master/tests/1_depositTransferExit.js . This just one of those, other "tests" are no different in structure.

The assignment is to create a new "test" which will use challengeExit function (and other as specified in this bounty). You don't need to implement challengeExit function, it is already implemented and your "test" will need to check this function is working as expected.

@troggy
Copy link
Member Author

troggy commented Feb 28, 2020

Each "test" is basically a script that is being run against a working network (this is handled by leap-sandbox already). All the data you need to interact with network/environment is passed to the "test" in arguments (see any of the "tests" for example). Then you just interact with the network to test desired conditions. For now we can start with "success tests" only — the tests checking the success path for the function. For example, for challengeExit that could be a successful challenge for an attempt to exit utxo which was already spent.

@Sprimage
Copy link

Sprimage commented Mar 2, 2020

Thanks @troggy, I have some more questions. Can you explain what the _proof and _prevProof parameters represent when challenging an exit. In the contracts test here https://github.com/leapdao/leap-contracts/blob/eecdc8ee88c812724177f5a61e182e4f46e4c1a3/test/exitHandler.js#L351 I noticed they were generated from the Tx object and submitNewPeriod function. How can I access these data points on the sandbox environment?

@troggy
Copy link
Member Author

troggy commented Mar 2, 2020

both of these are cryptographic proofs of tx inclusion in a chain. Plasma contracts know nothing about blocks, they only have period roots (period root is basically a root of merkle tree. See here: https://github.com/leapdao/leap-core/blob/master/lib/period.js#L95). So to prove to Plasma contracts the given tx was indeed included in a given period, you need merkle proof like this.

Both _proof and _prevProof are the same structures, just proving inclusion for different txs. Refer to my plasma explanation I gave you in Slack the other day.

to generate proof, you can use getProof helper from leap-core library. Check the implementation if you are curious to know what it does under the hood: https://github.com/leapdao/leap-core/blob/master/lib/helpers.js#L219.

Look for usage examples in leap-sandbox. For instance, here https://github.com/leapdao/leap-sandbox/blob/master/tests/actions/exitUnspent.js#L69

@TheReturnOfJan TheReturnOfJan linked a pull request Mar 5, 2020 that will close this issue
@gitcoinbot
Copy link

@Sprimage Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@Sprimage
Copy link

Yeah I'm here @gitcoinbot still working

@gitcoinbot
Copy link

@Sprimage Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@Sprimage
Copy link

Still working...we discuss in slack channel, thanks

@gitcoinbot
Copy link

@Sprimage Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@Sprimage
Copy link

Yes still here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants