Contracts: runtime_call and storage_deposit (#13990)

* 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 commit is contained in:
PG Herveou
2023-04-29 18:07:55 +02:00
committed by GitHub
parent 1eb2e4f390
commit 4df004d0d4
6 changed files with 189 additions and 67 deletions
+11 -2
View File
@@ -1044,7 +1044,15 @@ impl<T: Config> Invokable<T> for CallInput<T> {
debug_message,
*determinism,
);
InternalOutput { gas_meter, storage_deposit: storage_meter.into_deposit(&origin), result }
match storage_meter.try_into_deposit(&origin) {
Ok(storage_deposit) => InternalOutput { gas_meter, storage_deposit, result },
Err(err) => InternalOutput {
gas_meter,
storage_deposit: Default::default(),
result: Err(err.into()),
},
}
}
}
@@ -1105,8 +1113,9 @@ impl<T: Config> Invokable<T> for InstantiateInput<T> {
&salt,
debug_message,
);
storage_deposit = storage_meter
.into_deposit(&origin)
.try_into_deposit(&origin)?
.saturating_add(&StorageDeposit::Charge(extra_deposit));
result
};