Companion PR for add events to ContractResult (#2510)

* contracts: adapt to new contracts api

* update lockfile for {"substrate", "polkadot"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
juangirini
2023-05-03 16:13:54 +02:00
committed by GitHub
parent 0004d04477
commit 22c06e1868
3 changed files with 269 additions and 262 deletions
Generated
+257 -257
View File
File diff suppressed because it is too large Load Diff
@@ -7,13 +7,13 @@ use frame_support::{
traits::{ConstBool, ConstU32, Nothing}, traits::{ConstBool, ConstU32, Nothing},
}; };
use pallet_contracts::{ use pallet_contracts::{
weights::SubstrateWeight, Config, DefaultAddressGenerator, Frame, Schedule, weights::SubstrateWeight, Config, DebugInfo, DefaultAddressGenerator, Frame, Schedule,
}; };
pub use parachains_common::AVERAGE_ON_INITIALIZE_RATIO; pub use parachains_common::AVERAGE_ON_INITIALIZE_RATIO;
// Prints debug output of the `contracts` pallet to stdout if the node is // Prints debug output of the `contracts` pallet to stdout if the node is
// started with `-lruntime::contracts=debug`. // started with `-lruntime::contracts=debug`.
pub const CONTRACTS_DEBUG_OUTPUT: bool = true; pub const CONTRACTS_DEBUG_OUTPUT: DebugInfo = DebugInfo::UnsafeDebug;
parameter_types! { parameter_types! {
pub const DepositPerItem: Balance = deposit(1, 0); pub const DepositPerItem: Balance = deposit(1, 0);
@@ -99,6 +99,11 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, Si
pub type Migrations = (pallet_contracts::Migration<Runtime>,); pub type Migrations = (pallet_contracts::Migration<Runtime>,);
type EventRecord = frame_system::EventRecord<
<Runtime as frame_system::Config>::RuntimeEvent,
<Runtime as frame_system::Config>::Hash,
>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
Runtime, Runtime,
@@ -532,7 +537,7 @@ impl_runtime_apis! {
} }
} }
impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash> for Runtime { impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash, EventRecord> for Runtime {
fn call( fn call(
origin: AccountId, origin: AccountId,
dest: AccountId, dest: AccountId,
@@ -540,7 +545,7 @@ impl_runtime_apis! {
gas_limit: Option<Weight>, gas_limit: Option<Weight>,
storage_deposit_limit: Option<Balance>, storage_deposit_limit: Option<Balance>,
input_data: Vec<u8>, input_data: Vec<u8>,
) -> pallet_contracts_primitives::ContractExecResult<Balance> { ) -> pallet_contracts_primitives::ContractExecResult<Balance, EventRecord> {
let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block); let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);
Contracts::bare_call( Contracts::bare_call(
origin, origin,
@@ -550,6 +555,7 @@ impl_runtime_apis! {
storage_deposit_limit, storage_deposit_limit,
input_data, input_data,
contracts::CONTRACTS_DEBUG_OUTPUT, contracts::CONTRACTS_DEBUG_OUTPUT,
pallet_contracts::CollectEvents::UnsafeCollect,
pallet_contracts::Determinism::Enforced, pallet_contracts::Determinism::Enforced,
) )
} }
@@ -562,7 +568,7 @@ impl_runtime_apis! {
code: pallet_contracts_primitives::Code<Hash>, code: pallet_contracts_primitives::Code<Hash>,
data: Vec<u8>, data: Vec<u8>,
salt: Vec<u8>, salt: Vec<u8>,
) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, Balance> { ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, Balance, EventRecord> {
let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block); let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);
Contracts::bare_instantiate( Contracts::bare_instantiate(
origin, origin,
@@ -573,6 +579,7 @@ impl_runtime_apis! {
data, data,
salt, salt,
contracts::CONTRACTS_DEBUG_OUTPUT, contracts::CONTRACTS_DEBUG_OUTPUT,
pallet_contracts::CollectEvents::UnsafeCollect,
) )
} }