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

Remove signature from stake #548

Merged
merged 17 commits into from
Dec 18, 2018

Conversation

0xsarvesh
Copy link
Contributor

This pr fixes #539

The following features are implemented as a part of this PR.

  1. EIP20Gateway.stake is called by Staker without providing staker signature.
  2. MessageBus.declareMessage also modified to not accept the signature.
  3. Style guide fixes in message bus.
  4. Message bus unit test cases fix.

As bounty is transferred from staker/redeemer, the gateway only knows about one actor.
Gateway doesn't care about how staker and facilitator shares hash lock, unlock secret and bounty.

Note: This PR didn't touch unit test cases for ProgressOutboxWithProof as those are covered in #526. Also, one test for ProgressInboxWithProof which tests that transaction is reverted if Merkel proof verification failed should be covered after #526.

Copy link
Contributor

@schemar schemar left a comment

Choose a reason for hiding this comment

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

Good code and nice clean-up 🚁 🚁 🎧

It looks good to me 🎉 But someone else definitely has to take a look at this (@deepesh-kn).
Is it really as easy as just removing the signature? No other side effects from that?

Is it really required to have that much code in the mock message bus, though? That looks dangerous to me ⚠️

contracts/gateway/EIP20CoGateway.sol Show resolved Hide resolved
abi.encodePacked(path)
)
)
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it correct to be hashed twice? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, It's correct.
This was also tested with hackathon mosaic.js

JS version of this available here

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possibly a bug in the JS as well? What's the reason for hashing it twice?

test/lib/messagebus/confirm_message.js Outdated Show resolved Hide resolved
test/lib/messagebus/confirm_revocation.js Outdated Show resolved Hide resolved
test/lib/messagebus/declare_revocation_message.js Outdated Show resolved Hide resolved
test/lib/messagebus/messagebus_utils.js Show resolved Hide resolved
test/lib/messagebus/progress_inbox.js Outdated Show resolved Hide resolved
test/lib/messagebus/progress_inbox_with_proof.js Outdated Show resolved Hide resolved
test/lib/messagebus/progress_outbox.js Outdated Show resolved Hide resolved
test/lib/messagebus/progress_outbox_revocation.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

@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.

Available for review

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 👍
Just a few 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/lib/MessageBus.sol Outdated Show resolved Hide resolved
contracts/lib/MessageBus.sol Outdated Show resolved Hide resolved
test/lib/messagebus/progress_inbox_with_proof.js Outdated Show resolved Hide resolved
test/lib/messagebus/progress_outbox.js Outdated Show resolved Hide resolved
test/lib/messagebus/confirm_revocation.js Outdated Show resolved Hide resolved
test/lib/messagebus/confirm_message.js Outdated Show resolved Hide resolved
test/lib/messagebus/progress_inbox.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

@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.

Available for review again.

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 🏆

@schemar schemar merged commit 3e6c2d7 into OpenST:develop Dec 18, 2018
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.

Staker should be able to initiate stake in the EIP20Gateway without providing signature
4 participants