Skip to content

Commit

Permalink
Merge branch 'main' into feature/pallet_treasury_funding
Browse files Browse the repository at this point in the history
  • Loading branch information
asiniscalchi authored Dec 12, 2024
2 parents f213de4 + 58df845 commit 6066574
Show file tree
Hide file tree
Showing 16 changed files with 2,941 additions and 19 deletions.
38 changes: 29 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository = "https://github.com/freeverseio/laos.git"
homepage = "https://www.laosfoundation.io"
authors = ["Freeverse"]
edition = "2021"
version = "0.24.0"
version = "0.24.90"

[workspace]
resolver = "2"
Expand Down Expand Up @@ -122,7 +122,7 @@ pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch
pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-elections-phragmen = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
## pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
Expand Down Expand Up @@ -233,7 +233,7 @@ pallet-asset-metadata-extender = { path = "./pallets/asset-metadata-extender", d
pallet-parachain-staking = { path = "./pallets/parachain-staking", default-features = false }
pallet-evm-precompile-parachain-staking = { path = "./precompiles/parachain-staking", default-features = false }
pallet-precompiles-benchmark = { path = "./pallets/precompiles-benchmark", default-features = false}
pallet-treasury-funding = { path = "./pallets/treasury-funding", default-features = false}
pallet-treasury = { path = "./pallets/treasury", default-features = false }

# Primitives
laos-primitives = { path = "./primitives", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ParachainStaking from "../build/contracts/ParachainStaking.sol/ParachainS

// Runtime specs
export const RUNTIME_SPEC_NAME = "laos";
export const RUNTIME_SPEC_VERSION = 2400;
export const RUNTIME_SPEC_VERSION = 2490;
export const RUNTIME_IMPL_VERSION = 0;

// Nodes endpoints
Expand Down
100 changes: 100 additions & 0 deletions node/src/custom_tx_pool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
use futures::Future;
use sc_transaction_pool_api::{
ImportNotificationStream, PoolFuture, PoolStatus, ReadyTransactions, TransactionFor,
TransactionPool, TransactionSource, TransactionStatusStreamFor, TxHash,
};
use sp_runtime::traits::{Block as BlockT, NumberFor};
use std::{collections::HashMap, pin::Pin, sync::Arc};

pub struct CustomPool<I> {
inner_pool: Arc<I>,
}

impl<I> CustomPool<I> {
pub fn new(inner_pool: Arc<I>) -> Self {
Self { inner_pool }
}
}

impl<I> TransactionPool for CustomPool<I>
where
I: TransactionPool,
{
type Block = I::Block;
type Hash = I::Hash;
type InPoolTransaction = I::InPoolTransaction;
type Error = I::Error;

fn submit_at(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xts: Vec<TransactionFor<Self>>,
) -> PoolFuture<Vec<Result<TxHash<Self>, Self::Error>>, Self::Error> {
self.inner_pool.submit_at(at, source, xts)
}

fn submit_one(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xt: TransactionFor<Self>,
) -> PoolFuture<TxHash<Self>, Self::Error> {
self.inner_pool.submit_one(at, source, xt)
}

fn submit_and_watch(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xt: TransactionFor<Self>,
) -> PoolFuture<Pin<Box<TransactionStatusStreamFor<Self>>>, Self::Error> {
self.inner_pool.submit_and_watch(at, source, xt)
}

fn remove_invalid(&self, _: &[TxHash<Self>]) -> Vec<Arc<Self::InPoolTransaction>> {
// Don't do anything on purpose.
Vec::new()
}

fn status(&self) -> PoolStatus {
self.inner_pool.status()
}

fn import_notification_stream(&self) -> ImportNotificationStream<TxHash<Self>> {
self.inner_pool.import_notification_stream()
}

fn hash_of(&self, xt: &TransactionFor<Self>) -> TxHash<Self> {
self.inner_pool.hash_of(xt)
}

fn on_broadcasted(&self, propagations: HashMap<TxHash<Self>, Vec<String>>) {
self.inner_pool.on_broadcasted(propagations)
}

fn ready_transaction(&self, hash: &TxHash<Self>) -> Option<Arc<Self::InPoolTransaction>> {
self.inner_pool.ready_transaction(hash)
}

fn ready_at(
&self,
at: NumberFor<Self::Block>,
) -> Pin<
Box<
dyn Future<
Output = Box<dyn ReadyTransactions<Item = Arc<Self::InPoolTransaction>> + Send>,
> + Send,
>,
> {
self.inner_pool.ready_at(at)
}

fn ready(&self) -> Box<dyn ReadyTransactions<Item = Arc<Self::InPoolTransaction>> + Send> {
self.inner_pool.ready()
}

fn futures(&self) -> Vec<Self::InPoolTransaction> {
self.inner_pool.futures()
}
}
2 changes: 1 addition & 1 deletion node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod chain_spec;
mod service;
mod cli;
mod command;
mod custom_tx_pool;
mod eth;
mod rpc;

fn main() -> sc_cli::Result<()> {
command::run()
}
7 changes: 6 additions & 1 deletion node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,15 @@ fn start_consensus(
// NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant`
// when starting the network.

// TODO: Remove the custom tx pool when paritytech/polkadot-sdk#4639 is included in a stable
// release. This is a temporary workaround taken from here: https://github.com/frequency-chain/frequency/pull/2196.
let custom_transaction_pool =
std::sync::Arc::new(crate::custom_tx_pool::CustomPool::new(transaction_pool));

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
custom_transaction_pool,
prometheus_registry,
telemetry.clone(),
);
Expand Down
63 changes: 63 additions & 0 deletions pallets/treasury/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[package]
name = "pallet-treasury"
version = "36.0.1"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage = "https://substrate.io"
repository.workspace = true
description = "FRAME pallet to manage treasury (polkadot v1.15.0)"
readme = "README.md"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
parity-scale-codec = { features = [
"derive",
"max-encoded-len",
], workspace = true }
docify = { version = "0.2.8" }
impl-trait-for-tuples = { version = "0.2.2" }
scale-info = { features = ["derive"], workspace = true }
serde = { features = ["derive"], optional = true, workspace = true, default-features = true }
frame-benchmarking = { optional = true, workspace = true }
frame-support.workspace = true
frame-system.workspace = true
pallet-balances.workspace = true
sp-runtime.workspace = true
sp-core = { optional = true, workspace = true }
log = { workspace = true }

[dev-dependencies]
sp-io = { default-features = true, workspace = true }
pallet-utility = { default-features = true, workspace = true }

[features]
default = ["std"]
std = [
"parity-scale-codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-balances/std",
"scale-info/std",
"serde",
"sp-core?/std",
"sp-runtime/std",
]
runtime-benchmarks = [
"dep:sp-core",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"sp-runtime/try-runtime",
]
Loading

0 comments on commit 6066574

Please sign in to comment.