-
Notifications
You must be signed in to change notification settings - Fork 19
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
Multisig unit tests #249
Multisig unit tests #249
Conversation
…nit-tests' into multisig-unit-tests
# Conflicts: # multisig/tests/multisig_blackbox_test.rs
Coverage SummaryTotals
FilesExpand
|
Contract comparison - from ea7ea9b to 31805a0
|
.to(MULTISIG_ADDRESS) | ||
.typed(multisig_proxy::MultisigProxy) | ||
.distribute_fees_from_child_contracts(dest_address_percentage_pairs) | ||
.run(); |
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.
also check that the dest_addresses has the balances? before and after
.typed(multisig_proxy::MultisigProxy) | ||
.distribute_fees_from_child_contracts(dest_address_percentage_pairs) | ||
.returns(ExpectError(4, "Percentages do not add up to 100%")) | ||
.run(); |
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.
also check that the dest_addresses has the same balances? before and after
4, | ||
"Cannot transfer to smart contract dest_address", | ||
)) | ||
.run(); |
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.
also check that the dest_addresses has the same balances? before and after
.typed(multisig_proxy::MultisigProxy) | ||
.unstake(unstake_amount) | ||
.returns(ExpectError(4, "can't unstake more than amount staked")) | ||
.run(); |
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.
check that the staked amount remains the same
4, | ||
"can't unstake, must keep minimum amount as insurance", | ||
)) | ||
.run(); |
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.
check that the staked amount remains the same
.returns(ReturnsResult) | ||
.run(); | ||
|
||
assert_eq!(remaining_stake_relayer2, BigUint::from(2_000u64)); |
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.
👍
state | ||
.world | ||
.check_account(ESDT_SAFE_ADDRESS) | ||
.esdt_balance(token_id, amount.clone()); |
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.
check also the storages
.from(OWNER_ADDRESS) | ||
.to(MULTISIG_ADDRESS) | ||
.typed(multisig_proxy::MultisigProxy) | ||
.add_unprocessed_refund_tx_to_batch(tx_id) |
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.
check storages
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.
we do not have a view for the pending batches. what should i check instead?
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.
unprocessed_refund_txs(tx_id) has to be cleaned
last_batch_id before and last_batch_id after and should be + 1
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.
forgot to check earlier, but this endpoint calls the add_unprocessed_refund_tx_to_batch from a mock multi-transfer contract which does not set any storage. this endpoint will be tested from multitransfer directly
.to(MULTISIG_ADDRESS) | ||
.typed(multisig_proxy::MultisigProxy) | ||
.withdraw_refund_fees_for_ethereum(TokenIdentifier::from(WEGLD_TOKEN_ID)) | ||
.run(); |
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.
check the balance of the 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.
we are using a mock esdt safe contract, so after multisig calling withdraw_refund_fees_for_ethereum from esdt safe, nothing is happening. maybe i can use a storage mapper to see we actually get here, otherwise the functionality from withdraw_refund_fees_for_ethereum on esdt safe was already unit tested in esdt_safe_blackbox_test.rs
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.
No need then 🙏
.from(OWNER_ADDRESS) | ||
.to(MULTISIG_ADDRESS) | ||
.typed(multisig_proxy::MultisigProxy) | ||
.withdraw_transaction_fees(TokenIdentifier::from(WEGLD_TOKEN_ID)) |
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.
check balances
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.
same here. but great observation, i will check also on esdt_safe_blackbox_test.rs the balances. thanks
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.
then the checks for the balances also on esdt_safe_blackbox_test.rs is enough
|
||
let mut board: MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>> = | ||
MultiValueEncoded::new(); | ||
board.push(ManagedAddress::from(RELAYER1_ADDRESS.eval_to_array())); |
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 think it's easier to use the to_managed_address()
method
RELAYER1_ADDRESS.to_managed_address()
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 the suggestion, indeed easier
de97869
The base branch was changed.
No description provided.