Contracts add code_len to ContractsInfo (#14523)

* add code_len to v12

* fix

* Update frame/contracts/src/wasm/mod.rs

* fix

* fixes

* rm test

* add test back

* fix

* update test

* Fix comments

* fix build

* del

* fix clippy

* fix

* re-rename
This commit is contained in:
PG Herveou
2023-07-14 14:49:47 +02:00
committed by GitHub
parent 70694b903a
commit e8a9559696
5 changed files with 54 additions and 24 deletions
@@ -0,0 +1,33 @@
pub use pallet::*;
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::{
dispatch::{Pays, PostDispatchInfo},
pallet_prelude::DispatchResultWithPostInfo,
weights::Weight,
};
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Dummy function that overcharges the predispatch weight, allowing us to test the correct
/// values of [`ContractResult::gas_consumed`] and [`ContractResult::gas_required`] in
/// tests.
#[pallet::call_index(1)]
#[pallet::weight(Weight::from_parts(10_000_000, 0))]
pub fn overestimate_pre_charge(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
ensure_signed(origin)?;
Ok(PostDispatchInfo {
actual_weight: Some(Weight::from_parts(100, 0)),
pays_fee: Pays::Yes,
})
}
}
}