-
Notifications
You must be signed in to change notification settings - Fork 31
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
Unit test cases for progressStakeWithProof #578
Conversation
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.
LGTM 🎊
Please see questions/remarks in-line.
gasLimit: new BN(stakeParams.gasLimit, 16), | ||
nonce: new BN(stakeParams.nonce, 16), | ||
hashLock: stakeParams.hashLock, | ||
messageHash: proofData.gateway.stake.return_value.returned_value.messageHash_, |
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.
That's deep 😳
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.
Yes, any suggestion?
I can store the values in some variable in before each.
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.
That would just move the deepness somewhere else. I don't know how to solve this, I don't know the scope of proof data.
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.
Nice work 🏇 🙌
Few comments inline.
Please add a test for message bus for below scenario.
It should progress outbox if the target message is progressed and source message status is revocation declared
contracts/gateway/EIP20Gateway.sol
Outdated
redeemer_ = message.sender; | ||
redeemerNonce_ = message.nonce; | ||
amount_ = unstakes[_messageHash].amount; | ||
|
||
// delete the unstake data | ||
delete unstakes[_messageHash]; |
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.
General question, we delete stakes/unstakes mapping in progress/progressRevert, but not message mapping. Messages are deleted when new messages are created. why?
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.
After progress and revert you may not be able to do anything with stakes/unstakes mapping else so its deleted. Message state is not deleted because it may be used for merkle proof.
But in fact, I am thinking not to delete the message state.
- Stake
- ConfirmStake
- ProgressMintWithProof. (deletes the mints stuct data, the proof was not generated)
- redeem (deletes the message status)
- ProgressStakeWithProof (Now the proof will not be generated.)
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.
I understand we can't clean message status mapping and it has valid reason.
My point was for message mapping. Messages can be deleted with stake, mint, redeem and unstakes mapping.
If you and @schemar agree on this, seperate ticket can be created for this.
|
||
}); | ||
|
||
it('should fail when storage proof is invalid', async function () { |
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.
I dont think this test is needed. This test is asserting failure of RLP library which is out of scope of this test.
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.
As progressStakeWithProof
is not an ideal unit
test. It has integration with messagebus library and gatewayLib, I am considering all this as one unit. I would prefer to keep this.
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.
LGTM, only @sarvesh-ost 's comments remaining. 🎇
This will be coved in #526 |
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.
Almost ⚡️ 🗿
Some feedbacks and open conversation pending.
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.
LGTM 🌞
This PR includes the unit test for
EIP20Gateway.progressStakeWithProof
.The proof data is added.
fixes: #424