Contracts: runtime_call and storage_deposit#13990
Contracts: runtime_call and storage_deposit#13990paritytech-processbot[bot] merged 21 commits intomasterfrom
Conversation
62fc1e3 to
909cbae
Compare
frame/contracts/src/tests.rs
Outdated
| data.encode(), | ||
| ); | ||
|
|
||
| assert_err_ignore_postinfo!(result, TokenError::FundsUnavailable); |
There was a problem hiding this comment.
would be nice to test that the transaction gas were actually charge to the user, but I am not too sure how this can be done within our test framework
There was a problem hiding this comment.
can't you just check that Alice's balance became lower than it was before the tx?
There was a problem hiding this comment.
Updated the test, so we can validate that the fees are the same whether the transaction fails (because the payment failed) or not.
I don't think we can test Alice's balance because as far as I know, this would be done in the pre/post hook of the transaction_payment pallet that does not exist in the Test config
for reference
substrate/frame/transaction-payment/src/lib.rs
Lines 816 to 842 in ec43399
There was a problem hiding this comment.
You can check the events emitted during execution. We do that in other tests. There is a event for transaction fee payment.
There was a problem hiding this comment.
we would need the transaction_payment pallet for this in test, I don't think we have it 🤔 might have overlooked, will check again
There was a problem hiding this comment.
Ahh yeah. You are right. We didn't set this up in tests. It is fine. We don't really need to test this.
frame/contracts/src/tests.rs
Outdated
| data.encode(), | ||
| ); | ||
|
|
||
| assert_err_ignore_postinfo!(result, TokenError::FundsUnavailable); |
There was a problem hiding this comment.
can't you just check that Alice's balance became lower than it was before the tx?
|
also some PR description would be great to have |
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
|
bot help |
|
Here's a link to docs |
|
bot rebase |
|
Rebased |
| @@ -366,14 +366,14 @@ where | |||
| /// | |||
There was a problem hiding this comment.
docs above this line could be improved a bit to reflect the fact this is now a fallible fn
|
bot merge |
* wip * add comments * fix comment * comments * comments * PR comment * field orders * Update frame/contracts/src/tests.rs * Update frame/contracts/fixtures/call_runtime_and_call.wat Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Apply suggestions from code review Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Apply suggestions from code review Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Update frame/contracts/src/tests.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Validate fees of failed call * Update frame/contracts/src/tests.rs * Update frame/contracts/src/tests.rs * Update frame/contracts/src/tests.rs * bubble up refund error * rename fixture file --------- Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> Co-authored-by: parity-processbot <>
* wip * add comments * fix comment * comments * comments * PR comment * field orders * Update frame/contracts/src/tests.rs * Update frame/contracts/fixtures/call_runtime_and_call.wat Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Apply suggestions from code review Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Apply suggestions from code review Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Update frame/contracts/src/tests.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Validate fees of failed call * Update frame/contracts/src/tests.rs * Update frame/contracts/src/tests.rs * Update frame/contracts/src/tests.rs * bubble up refund error * rename fixture file --------- Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> Co-authored-by: parity-processbot <>
This PR makes the
chargefunction fallible, so that when the the caller is unable to pay for the storage deposit we rollback the whole transaction.