-
Notifications
You must be signed in to change notification settings - Fork 63
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
ife stop eating wrong side bond #585
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b053443
fix: return piggyback bond when piggyback wrong side
boolafish 23045a1
test: add unit test covering fix of IFE piggyback bond
boolafish 5dbe305
fix: e2e tests (py + truffle) for IFE bond change
boolafish 15dffd9
docs: add explanation on why not need to filter challenged in/output
boolafish 58c957e
docs: better comment sentence
boolafish b0fcf65
feat: add changelog instruction to bumping version
boolafish bbcec61
chore: bumping version to 1.0.3
boolafish d9bc0a1
fix: update CHANGELOG.md wording
boolafish 5758669
refactor: for loop with in/outputs length instead of MAX_IN/OUTPUT_SIZE
boolafish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -386,6 +386,7 @@ contract('PaymentProcessInFlightExit', ([_, ifeBondOwner, inputOwner1, inputOwne | |
await this.exitGame.setInFlightExitOutputPiggybacked(DUMMY_EXIT_ID, 2); | ||
|
||
this.inputOwner3PreBalance = new BN(await web3.eth.getBalance(inputOwner3)); | ||
this.outputOwner3PreBalance = new BN(await web3.eth.getBalance(outputOwner3)); | ||
}); | ||
|
||
it('should withdraw ETH from vault for the piggybacked input', async () => { | ||
|
@@ -464,6 +465,14 @@ contract('PaymentProcessInFlightExit', ([_, ifeBondOwner, inputOwner1, inputOwne | |
expect(postBalance).to.be.bignumber.equal(expectedBalance); | ||
}); | ||
|
||
it('should return piggyback bond to the output owner', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there testing that a challenged invalid piggyback doesn't return the bond? Also are both canonicity-cases covered in here? |
||
await this.exitGame.processExit(DUMMY_EXIT_ID, VAULT_ID.ERC20, erc20); | ||
const postBalance = new BN(await web3.eth.getBalance(outputOwner3)); | ||
const expectedBalance = this.outputOwner3PreBalance.add(this.piggybackBondSize); | ||
|
||
expect(postBalance).to.be.bignumber.equal(expectedBalance); | ||
}); | ||
|
||
it('should only flag piggybacked inputs with the same token as spent', async () => { | ||
await this.exitGame.processExit(DUMMY_EXIT_ID, VAULT_ID.ETH, ETH); | ||
// piggybacked input | ||
|
@@ -508,6 +517,7 @@ contract('PaymentProcessInFlightExit', ([_, ifeBondOwner, inputOwner1, inputOwne | |
await this.exitGame.setInFlightExitOutputPiggybacked(DUMMY_EXIT_ID, 0); | ||
await this.exitGame.setInFlightExitOutputPiggybacked(DUMMY_EXIT_ID, 2); | ||
|
||
this.inputOwner3PreBalance = new BN(await web3.eth.getBalance(inputOwner3)); | ||
this.outputOwner3PreBalance = new BN(await web3.eth.getBalance(outputOwner3)); | ||
}); | ||
|
||
|
@@ -587,6 +597,14 @@ contract('PaymentProcessInFlightExit', ([_, ifeBondOwner, inputOwner1, inputOwne | |
expect(postBalance).to.be.bignumber.equal(expectedBalance); | ||
}); | ||
|
||
it('should return piggyback bond to the input owner', async () => { | ||
await this.exitGame.processExit(DUMMY_EXIT_ID, VAULT_ID.ERC20, erc20); | ||
const postBalance = new BN(await web3.eth.getBalance(inputOwner3)); | ||
const expectedBalance = this.inputOwner3PreBalance.add(this.piggybackBondSize); | ||
|
||
expect(postBalance).to.be.bignumber.equal(expectedBalance); | ||
}); | ||
|
||
it('should flag ALL inputs with the same token as spent', async () => { | ||
await this.exitGame.processExit(DUMMY_EXIT_ID, VAULT_ID.ETH, ETH); | ||
// same token, both piggybacked and non-piggybacked cases | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be up to the wording (and possibly require a clarifying comment), but I'm assuming here that invalid and challenged piggybacks won't return the bond, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. I just double checked the challenge piggyback code. So if it challenged, it would return the bond immediately and delete the piggyback flag. So this implementation is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I definitely have the wrong impression in my mind when making the code change....I thought challenge piggyback would end up changing the piggyback bond owner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, maybe consider leaving a comment about challenged piggybacks - that this is taken care of b/c
isInputPiggybacked
returnsfalse
.