Skip to content

Commit

Permalink
chore: polkadot v0.9.39
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielMartinezRodriguez committed Oct 20, 2023
1 parent d4da6db commit 6ea2d23
Show file tree
Hide file tree
Showing 16 changed files with 587 additions and 496 deletions.
738 changes: 393 additions & 345 deletions Cargo.lock

Large diffs are not rendered by default.

204 changes: 103 additions & 101 deletions Cargo.toml

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions client/authorship/src/authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ where
) -> Proposer<B, Block, C, A, PR> {
let parent_hash = parent_header.hash();

let id = BlockId::hash(parent_hash);

info!(
"🙌 Starting consensus session on top of parent {:?}",
parent_hash
Expand All @@ -231,7 +229,7 @@ where
let proposer = Proposer::<_, _, _, _, PR> {
spawn_handle: self.spawn_handle.clone(),
client: self.client.clone(),
parent_id: id,
parent_hash,
parent_number: *parent_header.number(),
transaction_pool: self.transaction_pool.clone(),
keystore: self.keystore.clone(),
Expand Down Expand Up @@ -281,7 +279,7 @@ where
pub struct Proposer<B, Block: BlockT, C, A: TransactionPool, PR> {
spawn_handle: Box<dyn SpawnNamed>,
client: Arc<C>,
parent_id: BlockId<Block>,
parent_hash: Block::Hash,
parent_number: <<Block as BlockT>::Header as HeaderT>::Number,
transaction_pool: Arc<A>,
keystore: SyncCryptoStorePtr,
Expand Down Expand Up @@ -385,7 +383,7 @@ where
let propose_with_start = time::Instant::now();
let mut block_builder =
self.client
.new_block_at(&self.parent_id, inherent_digests, PR::ENABLED)?;
.new_block_at(self.parent_hash, inherent_digests, PR::ENABLED)?;

let create_inherents_start = time::Instant::now();
let inherents = block_builder.create_inherents(inherent_data)?;
Expand Down Expand Up @@ -546,7 +544,7 @@ where
let pending_tx = if let Ok(pending_tx) = self
.client
.runtime_api()
.convert_zero_gas_transaction(&self.parent_id, ethereum_transaction.clone(), signed_hash.0.to_vec()) {
.convert_zero_gas_transaction(self.parent_hash, ethereum_transaction.clone(), signed_hash.0.to_vec()) {
pending_tx
}
else {
Expand Down Expand Up @@ -659,7 +657,7 @@ where
.client
.runtime_api()
.is_compatible_fee(
&self.parent_id,
self.parent_hash,
pending_tx.data().clone(),
validator.clone(),
)
Expand Down Expand Up @@ -1059,7 +1057,7 @@ mod tests {
assert_eq!(proposal.block.extrinsics().len(), 1);

let api = client.runtime_api();
api.execute_block(&BlockId::Hash(genesis_hash), proposal.block)
api.execute_block(genesis_hash, proposal.block)
.unwrap();

let state = backend.state_at(genesis_hash).unwrap();
Expand Down
3 changes: 3 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ serde = { workspace = true }

# Substrate
prometheus-endpoint = { package = "substrate-prometheus-endpoint", workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-consensus = { workspace = true }
Expand All @@ -31,6 +32,7 @@ sc-consensus-manual-seal = { workspace = true }
sc-executor = { workspace = true }
sc-finality-grandpa = { workspace = true }
sc-network = { workspace = true }
sc-network-common = { workspace = true }
sc-rpc = { workspace = true }
sc-rpc-api = { workspace = true }
sc-service = { workspace = true }
Expand Down Expand Up @@ -71,6 +73,7 @@ fc-db = { workspace = true }
fc-mapping-sync = { workspace = true }
fc-rpc = { workspace = true }
fc-rpc-core = { workspace = true }
fp-account = { workspace = true }
fp-evm = { workspace = true, features = ["default"] }
fp-rpc = { workspace = true, features = ["default"] }
fc-storage = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions node/src/chain_spec/alphanet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub fn alphanet_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
None,
// Fork id
None,
// Properties
None,
Expand Down
1 change: 1 addition & 0 deletions node/src/chain_spec/betanet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub fn betanet_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
None,
// Fork id
None,
// Properties
None,
Expand Down
1 change: 1 addition & 0 deletions node/src/chain_spec/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn development_config(enable_manual_seal: Option<bool>) -> DevChainSpec {
None,
// Protocol ID
None,
// Fork id
None,
// Properties
None,
Expand Down
1 change: 1 addition & 0 deletions node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
clippy::too_many_arguments,
clippy::large_enum_variant
)]
#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))]

#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
Expand Down
38 changes: 19 additions & 19 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use prometheus_endpoint::Registry;
use sc_client_api::{BlockBackend, StateBackendFor};
use sc_consensus::BasicQueue;
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};
use sc_network_common::sync::warp::WarpSyncParams;
use sc_service::{error::Error as ServiceError, Configuration, PartialComponents, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker};
use sp_api::{ConstructRuntimeApi, TransactionFor};
Expand Down Expand Up @@ -297,24 +298,23 @@ where
&config.chain_spec,
);

let warp_sync: Option<Arc<dyn sc_network::config::WarpSyncProvider<Block>>> =
if sealing.is_some() {
None
} else {
config
.network
.extra_sets
.push(sc_finality_grandpa::grandpa_peers_set_config(
grandpa_protocol_name.clone(),
));
Some(Arc::new(
sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
Vec::default(),
),
))
};
let warp_sync_params = if sealing.is_some() {
None
} else {
config
.network
.extra_sets
.push(sc_finality_grandpa::grandpa_peers_set_config(
grandpa_protocol_name.clone(),
));
let warp_sync: Arc<dyn sc_network::config::WarpSyncProvider<Block>> =
Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
Vec::default(),
));
Some(WarpSyncParams::WithProvider(warp_sync))
};

let (network, system_rpc_tx, tx_handler_controller, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
Expand All @@ -324,7 +324,7 @@ where
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync,
warp_sync_params,
})?;

if config.offchain_worker.enabled {
Expand Down
8 changes: 7 additions & 1 deletion primitives/runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,20 @@ where
>,
) -> (ExitReason, R),
{
// Only check the restrictions of EIP-3607 if the source of the EVM operation is from an external transaction.
// If the source of this EVM operation is from an internal call, like from `eth_call` or `eth_estimateGas` RPC,
// we will skip the checks for the EIP-3607.
//
// EIP-3607: https://eips.ethereum.org/EIPS/eip-3607
// Do not allow transactions for which `tx.sender` has any code deployed.
//
// We extend the principle of this EIP to also prevent `tx.sender` to be the address
// of a precompile. While mainnet Ethereum currently only has stateless precompiles,
// projects using Frontier can have stateful precompiles that can manage funds or
// which calls other contracts that expects this precompile address to be trustworthy.
if !<AccountCodes<T>>::get(source).is_empty() || precompiles.is_precompile(source) {
if is_transactional
&& (!<AccountCodes<T>>::get(source).is_empty() || precompiles.is_precompile(source))
{
return Err(RunnerError {
error: Error::<T>::TransactionMustComeFromEOA,
weight,
Expand Down
2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ std = [
'pallet-transaction-payment/std',
'frame-system-rpc-runtime-api/std',
'pallet-transaction-payment-rpc-runtime-api/std',
"fp-account/std",
"fp-evm/std",
'fp-rpc/std',
'fp-self-contained/std',
Expand Down Expand Up @@ -125,6 +126,7 @@ pallet-session = { workspace = true }
sp-application-crypto = { workspace = true }
sp-staking = { workspace = true }
# Frontier
fp-account = { workspace = true }
fp-evm = { workspace = true }
fp-rpc = { workspace = true }
fp-self-contained = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
#![allow(clippy::new_without_default, clippy::or_fun_call)]
#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))]

// Make the WASM binary available.
#[cfg(feature = "std")]
Expand Down Expand Up @@ -574,6 +575,7 @@ impl pallet_collective::Config<TechCommitteeInstance> for Runtime {
type MaxMembers = CouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type SetMembersOrigin = EnsureRootOrHalfTechCommittee;
}

impl pallet_root_controller::Config for Runtime {
Expand Down
14 changes: 7 additions & 7 deletions stability-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<StabilityOutput<Vec<H160>>> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);
let value = api
.get_supported_tokens(&at)
.get_supported_tokens(at)
.map_err(runtime_error_into_rpc_err);
Ok(StabilityOutput {
code: 200,
Expand All @@ -89,9 +89,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<StabilityOutput<Vec<H160>>> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);
let value = api
.get_validator_list(&at)
.get_validator_list(at)
.map_err(runtime_error_into_rpc_err);
Ok(StabilityOutput {
code: 200,
Expand All @@ -105,7 +105,7 @@ where
meta_trx_sponsor: H160,
meta_trx_sponsor_signature: Bytes,
) -> RpcResult<H256> {
let block_hash = BlockId::hash(self.client.info().best_hash);
let block_hash = self.client.info().best_hash;

let slice = &transaction.0[..];
if slice.is_empty() {
Expand All @@ -122,7 +122,7 @@ where
.client
.runtime_api()
.convert_sponsored_transaction(
&block_hash,
block_hash,
transaction.clone(),
meta_trx_sponsor,
meta_trx_sponsor_signature.to_vec(),
Expand All @@ -132,7 +132,7 @@ where
let transaction_hash = transaction.hash();

self.pool
.submit_one(&block_hash, TransactionSource::Local, extrinsic)
.submit_one(&BlockId::Hash(block_hash), TransactionSource::Local, extrinsic)
.map_ok(move |_| transaction_hash)
.map_err(|e| {
error::Error::Custom(format!("Unable to submit transaction: {:?}", e).into())
Expand Down
4 changes: 2 additions & 2 deletions test-utils/stability-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
beefy-primitives = { workspace = true, package = "sp-beefy" }
beefy-merkle-tree = { workspace = true }
pallet-beefy-mmr = { workspace = true }
sp-application-crypto = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-consensus-babe = { workspace = true }
Expand Down Expand Up @@ -70,7 +70,7 @@ default = [
]
std = [
"beefy-primitives/std",
"beefy-merkle-tree/std",
"pallet-beefy-mmr/std",
"sp-application-crypto/std",
"sp-consensus-aura/std",
"sp-consensus-babe/std",
Expand Down
Loading

0 comments on commit 6ea2d23

Please sign in to comment.