contracts: Fix some minor bugs around instantiation (#8879)

* Fix output of wrongly outputted error

The "Tombstoned a contract that is below the subsistence threshold: {:?}" was
triggered when too few balance was provided. It was a false alarm.

* Fix return of wrong code_len

* Split up `NotCallable` into more fine grained errors

* Fix typos in docs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* RentNotPayed -> RentNotPaid

* Fix typo: payed -> paid

It is OK to change the in-storage field name because:

1. The SCALE encoding is not based on names only on position.
2. The struct is not public (only to the crate).

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Alexander Theißen
2021-05-26 00:29:55 +02:00
committed by GitHub
parent a28a517c53
commit c92d4a2638
8 changed files with 67 additions and 40 deletions
+4 -4
View File
@@ -97,11 +97,11 @@ pub struct RawAliveContractInfo<CodeHash, Balance, BlockNumber> {
pub code_hash: CodeHash,
/// Pay rent at most up to this value.
pub rent_allowance: Balance,
/// The amount of rent that was payed by the contract over its whole lifetime.
/// The amount of rent that was paid by the contract over its whole lifetime.
///
/// A restored contract starts with a value of zero just like a new contract.
pub rent_payed: Balance,
/// Last block rent has been payed.
pub rent_paid: Balance,
/// Last block rent has been paid.
pub deduct_block: BlockNumber,
/// Last block child storage has been written.
pub last_write: Option<BlockNumber>,
@@ -243,7 +243,7 @@ where
// charge rent for it during instantiation.
<frame_system::Pallet<T>>::block_number().saturating_sub(1u32.into()),
rent_allowance: <BalanceOf<T>>::max_value(),
rent_payed: <BalanceOf<T>>::zero(),
rent_paid: <BalanceOf<T>>::zero(),
pair_count: 0,
last_write: None,
_reserved: None,