-
Notifications
You must be signed in to change notification settings - Fork 244
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
Introduce basic storage proof for the stateless fraud proof #2746
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
115bc30
Move storage struct defination, export storage item/storage key
NingLin-P 41803bc
Add storage proof infra
NingLin-P ef9cd8c
Add all the necessary storage proofs that are required by fraud proof
NingLin-P 9dba588
Ensure the DomainChainAllowlistUpdate storage is always exist for a g…
NingLin-P 2a40d96
Upate storage proof verification error
NingLin-P cdeaeb3
Merge branch 'main' into storage-proof-in-fp
NingLin-P f0b6959
Fix cargo fmt
NingLin-P 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
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
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 |
---|---|---|
|
@@ -21,10 +21,15 @@ | |
|
||
mod default_weights; | ||
|
||
#[cfg(not(feature = "std"))] | ||
extern crate alloc; | ||
|
||
#[cfg(not(feature = "std"))] | ||
use alloc::vec::Vec; | ||
use codec::{Codec, Decode, Encode}; | ||
use frame_support::sp_runtime::traits::Zero; | ||
use frame_support::sp_runtime::SaturatedConversion; | ||
use frame_support::traits::{tokens, Currency, Get}; | ||
use frame_support::traits::{Currency, Get}; | ||
use frame_support::weights::Weight; | ||
use frame_system::pallet_prelude::*; | ||
pub use pallet::*; | ||
|
@@ -45,30 +50,13 @@ struct CollectedFees<Balance: Codec> { | |
tips: Balance, | ||
} | ||
|
||
#[derive(Encode, Decode, TypeInfo)] | ||
struct BlockTransactionByteFee<Balance: Codec> { | ||
// The value of `transaction_byte_fee` for the current block | ||
current: Balance, | ||
// The value of `transaction_byte_fee` for the next block | ||
next: Balance, | ||
} | ||
|
||
impl<Balance: Codec + tokens::Balance> Default for BlockTransactionByteFee<Balance> { | ||
fn default() -> Self { | ||
BlockTransactionByteFee { | ||
current: Balance::max_value(), | ||
next: Balance::max_value(), | ||
} | ||
} | ||
} | ||
|
||
#[frame_support::pallet] | ||
mod pallet { | ||
use super::{BalanceOf, BlockTransactionByteFee, CollectedFees, WeightInfo}; | ||
use super::{BalanceOf, CollectedFees, WeightInfo}; | ||
use frame_support::pallet_prelude::*; | ||
use frame_support::traits::Currency; | ||
use frame_system::pallet_prelude::*; | ||
use subspace_runtime_primitives::FindBlockRewardAddress; | ||
use subspace_runtime_primitives::{BlockTransactionByteFee, FindBlockRewardAddress}; | ||
|
||
#[pallet::config] | ||
pub trait Config: frame_system::Config { | ||
|
@@ -254,6 +242,10 @@ where | |
} | ||
} | ||
|
||
pub fn transaction_byte_fee_storage_key() -> Vec<u8> { | ||
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. Similarly I really don't like that this abstraction is now leaking to the outside. Can you explain why it is needed and why can't it be achieved without making more implemenation details public? |
||
TransactionByteFee::<T>::hashed_key().to_vec() | ||
} | ||
|
||
pub fn calculate_transaction_byte_fee() -> BalanceOf<T> { | ||
let credit_supply = T::CreditSupply::get(); | ||
|
||
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this refactoring necessary? It was an implementation detail of
pallet-transaction-fees
, you shouldn't need to access it from the outside. I also don't understand how it helps you if the rest of APIs that worked with this type remained private.