-
Notifications
You must be signed in to change notification settings - Fork 10
chore: upgrade to 1.14.0 #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a05d9e7
chore: upgrade to 1.8.0 (#177)
chungquantin 9b5c9cd
chore(v1.8.0): add missing FungibleAdapter migration
chungquantin d96b93e
chore: upgrade to 1.9.0 (#179)
chungquantin edde558
Merge branch 'main' into developer
chungquantin 389a2b9
chore: upgrade to 1.8.0 (#177)
chungquantin 620a857
chore: upgrade to 1.10.0 (#182)
chungquantin 2170af7
chore: upgrade to 1.11.0 (#189)
chungquantin 8eeadec
chore: upgrade to 1.12.0 (#193)
chungquantin d7a9bea
chore: upgrade to 1.13.0 (#194)
chungquantin 84cf750
chore: upgrade v1.14.0 (#198)
chungquantin 549a4d1
Merge branch 'main' into developer
chungquantin 2b05c1f
fmt
Daanvdplas 096b0bb
fix: add missing extension for pov reclaim
chungquantin 6ca7817
chore: bump dependencies
chungquantin 835cad2
chore: bump dependencies
chungquantin b36e426
fix: missing migration (#222)
al3mart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: upgrade to 1.13.0 (#194)
- Loading branch information
commit d7a9beab5273765f27bd5441c91c7fba207c164f
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ use frame_support::{ | |
| use pallet_contracts::chain_extension::{ | ||
| BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, | ||
| }; | ||
| use pallet_contracts::WeightInfo; | ||
| use pop_primitives::storage_keys::RuntimeStateKeys; | ||
| use sp_core::crypto::UncheckedFrom; | ||
| use sp_runtime::{traits::Dispatchable, DispatchError}; | ||
|
|
@@ -15,8 +16,6 @@ use crate::{AccountId, AllowedApiCalls, RuntimeCall, RuntimeOrigin}; | |
|
|
||
| const LOG_TARGET: &str = "pop-api::extension"; | ||
|
|
||
| type ContractSchedule<T> = <T as pallet_contracts::Config>::Schedule; | ||
|
|
||
| #[derive(Default)] | ||
| pub struct PopApiExtension; | ||
|
|
||
|
|
@@ -124,16 +123,14 @@ where | |
| T: pallet_contracts::Config, | ||
| E: Ext<T = T>, | ||
| { | ||
| let contract_host_weight = ContractSchedule::<T>::get().host_fn_weights; | ||
|
|
||
| // calculate weight for reading bytes of `len` | ||
| // reference: https://github.com/paritytech/polkadot-sdk/blob/117a9433dac88d5ac00c058c9b39c511d47749d2/substrate/frame/contracts/src/wasm/runtime.rs#L267 | ||
| let base_weight: Weight = contract_host_weight.return_per_byte.saturating_mul(len.into()); | ||
| // reference: https://github.com/paritytech/polkadot-sdk/pull/4233/files#:~:text=CopyToContract(len)%20%3D%3E%20T%3A%3AWeightInfo%3A%3Aseal_input(len)%2C | ||
| let base_weight: Weight = T::WeightInfo::seal_return(len); | ||
|
|
||
| // debug_message weight is a good approximation of the additional overhead of going | ||
| // from contract layer to substrate layer. | ||
| // reference: https://github.com/paritytech/ink-examples/blob/b8d2caa52cf4691e0ddd7c919e4462311deb5ad0/psp22-extension/runtime/psp22-extension-example.rs#L236 | ||
| let overhead = contract_host_weight.debug_message; | ||
| // reference: https://github.com/paritytech/polkadot-sdk/pull/4233/files#:~:text=DebugMessage(len)%20%3D%3E%20T%3A%3AWeightInfo%3A%3Aseal_debug_message(len)%2C | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great work updating those references Tin!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you 🙏 |
||
| let overhead = T::WeightInfo::seal_debug_message(len); | ||
|
|
||
| let charged_weight = env.charge_weight(base_weight.saturating_add(overhead))?; | ||
| log::debug!(target: LOG_TARGET, "{} charged weight: {:?}", log_prefix, charged_weight); | ||
|
|
@@ -173,10 +170,7 @@ where | |
| let mut env = env.buf_in_buf_out(); | ||
|
|
||
| // To be conservative, we charge the weight for reading the input bytes of a fixed-size type. | ||
| let base_weight: Weight = ContractSchedule::<T>::get() | ||
| .host_fn_weights | ||
| .return_per_byte | ||
| .saturating_mul(env.in_len().into()); | ||
| let base_weight: Weight = T::WeightInfo::seal_return(env.in_len()); | ||
| let charged_weight = env.charge_weight(base_weight)?; | ||
|
|
||
| log::debug!(target:LOG_TARGET, "{} charged weight: {:?}", LOG_PREFIX, charged_weight); | ||
|
|
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.