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

Return penalty to staker if target chain has already progressed #576

Merged
merged 6 commits into from
Feb 5, 2019

Conversation

hobofan
Copy link
Contributor

@hobofan hobofan commented Jan 9, 2019

FIXES #409

Waiting for #578 being merged.

@hobofan hobofan self-assigned this Jan 9, 2019
@hobofan hobofan changed the title [WIP] Return penalty to staker if target chain has already progressed Return penalty to staker if target chain has already progressed Jan 14, 2019
Copy link
Contributor

@0xsarvesh 0xsarvesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the conflicts.

@hobofan
Copy link
Contributor Author

hobofan commented Jan 21, 2019

@sarvesh-ost Done!

Copy link
Contributor

@deepesh-kn deepesh-kn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍
I have added a few inline comments.
We also similar changes in progressRedeemWithProof flow

contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
@hobofan
Copy link
Contributor Author

hobofan commented Jan 24, 2019

@deepesh-kn I incorporated all your feedback, execpt for the one I left a comment for.

Copy link
Contributor

@0xsarvesh 0xsarvesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍 🙌

Some minor comments.

contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
contracts/gateway/EIP20Gateway.sol Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
test/gateway/eip20_gateway/progress_stake_with_proof.js Outdated Show resolved Hide resolved
@hobofan
Copy link
Contributor Author

hobofan commented Jan 28, 2019

@sarvesh-ost I moved the tryReturnPenaltyToStaker after the progressStakeInternal. I had to create some temporary variables for that (since progressStakeInternal deletes the required value of the bounty from storage), but I think it looks overall cleaner now.

@hobofan
Copy link
Contributor Author

hobofan commented Jan 28, 2019

@sarvesh-ost @deepesh-kn Ready for review ;)

Copy link
Contributor

@0xsarvesh 0xsarvesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good for progressStakeWithProof. 🙌
As requested by @deepesh-kn , Similar feature is required for progressRedeemWithProof.
Refer : #409

@hobofan
Copy link
Contributor Author

hobofan commented Jan 30, 2019

Oh wow, completely overlooked that 🙈

@hobofan
Copy link
Contributor Author

hobofan commented Feb 1, 2019

@sarvesh-ost @deepesh-kn I added the version for progressRedeemWithProof now!

Copy link
Contributor

@0xsarvesh 0xsarvesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐼 🚀
Minor typo needs correction and also one question on gas consumption in the unit test. 👍

@@ -546,8 +546,9 @@ contract EIP20CoGateway is GatewayBase {
);

MessageBus.Message storage message = messages[_messageHash];
MessageBus.MessageStatus outboxMessageStatus =
messageBox.outbox[_messageHash];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
messageBox.outbox[_messageHash];
messageBox.outbox[_messageHash];

return;
}

// Penalty charged to staker for revert redeem.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Penalty charged to staker for revert redeem.
// Penalty charged to redeemer for revert redeem.


const expectedFinalFacilitatorETHBalance = initialFacilitatorEthBalance
.add(bountyAmount)
.subn(tx.receipt.gasUsed);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be multiplied with gas price?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gas price is set to 1 in truffle.js, which I think is the reason that it works. But yeah, in theory it would need to be multiplied with the gas price.

Copy link
Contributor

@deepesh-kn deepesh-kn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢

@hobofan hobofan merged commit 95abdb3 into OpenST:develop Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants