contracts: Reduce the API surface (#8359)

* contracts: Remove types and storage from the public interface

* contracts: Remove current_schedule() getter

* contracts: Improve documentation

* Update README.md

* Fix integration test
This commit is contained in:
Alexander Theißen
2021-03-24 09:09:19 +01:00
committed by GitHub
parent d343683ca9
commit d98a3c7942
14 changed files with 256 additions and 238 deletions
+3 -4
View File
@@ -295,10 +295,9 @@ pub fn testnet_genesis(
phantom: Default::default(),
},
pallet_contracts: ContractsConfig {
current_schedule: pallet_contracts::Schedule {
enable_println, // this should only be enabled on development chains
..Default::default()
},
// println should only be enabled on development chains
current_schedule: pallet_contracts::Schedule::default()
.enable_println(enable_println),
},
pallet_sudo: SudoConfig {
key: root_key,
+4 -7
View File
@@ -656,13 +656,10 @@ fn deploying_wasm_contract_should_work() {
).0.unwrap();
t.execute_with(|| {
// Verify that the contract constructor worked well and code of TRANSFER contract is actually deployed.
assert_eq!(
&pallet_contracts::ContractInfoOf::<Runtime>::get(addr)
.and_then(|c| c.get_alive())
.unwrap()
.code_hash,
&transfer_ch
// Verify that the contract does exist by querying some of its storage items
// It does not matter that the storage item itself does not exist.
assert!(
&pallet_contracts::Pallet::<Runtime>::get_storage(addr, Default::default()).is_ok()
);
});
}
+3 -3
View File
@@ -744,11 +744,11 @@ impl pallet_tips::Config for Runtime {
}
parameter_types! {
pub const TombstoneDeposit: Balance = deposit(
pub TombstoneDeposit: Balance = deposit(
1,
sp_std::mem::size_of::<pallet_contracts::ContractInfo<Runtime>>() as u32
<pallet_contracts::Pallet<Runtime>>::contract_info_size(),
);
pub const DepositPerContract: Balance = TombstoneDeposit::get();
pub DepositPerContract: Balance = TombstoneDeposit::get();
pub const DepositPerStorageByte: Balance = deposit(0, 1);
pub const DepositPerStorageItem: Balance = deposit(1, 0);
pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);