This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
5 changed files
with
54 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters