Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,695 changes: 5,680 additions & 3,015 deletions Cargo.lock

Large diffs are not rendered by default.

263 changes: 129 additions & 134 deletions Cargo.toml

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions client/authorship/src/authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ where
let soft_deadline =
now + time::Duration::from_micros(self.soft_deadline_percent.mul_floor(left_micros));
let mut skipped = 0;
let mut unqueue_invalid = Vec::new();
let mut unqueue_invalid = sc_transaction_pool_api::TxInvalidityReportMap::new();

// START STABILITY ZGT LOGIC
let mut transaction_pushed = false;
Expand Down Expand Up @@ -616,7 +616,7 @@ where
Err(_) => continue,
};

let ethereum_transaction: ethereum::TransactionV2 =
let ethereum_transaction: ethereum::TransactionV3 =
ethereum::EnvelopedDecodable::decode(&pending_raw_tx).unwrap();

let pending_tx = match self.client.runtime_api().convert_zero_gas_transaction(
Expand Down Expand Up @@ -715,7 +715,7 @@ where
};
// END STABILITY ZGT LOGIC

let mut t1 = self.transaction_pool.ready_at(self.parent_number).fuse();
let mut t1 = self.transaction_pool.ready_at(self.parent_hash).fuse();
let mut t2 =
futures_timer::Delay::new(deadline.saturating_duration_since((self.now)()) / 8).fuse();

Expand Down Expand Up @@ -774,7 +774,7 @@ where
.runtime_api()
.is_compatible_fee(
self.parent_hash,
pending_tx.data().clone(),
(**pending_tx.data()).clone(),
validator.clone(),
)
.unwrap();
Expand All @@ -787,7 +787,7 @@ where
continue;
}

let pending_tx_data = pending_tx.data().clone();
let pending_tx_data = (**pending_tx.data()).clone();
let pending_tx_hash = pending_tx.hash().clone();

let block_size =
Expand Down Expand Up @@ -860,7 +860,7 @@ where
target: LOG_TARGET,
"[{:?}] Invalid transaction: {}", pending_tx_hash, e
);
unqueue_invalid.push(pending_tx_hash);
unqueue_invalid.insert(pending_tx_hash, None);
}
}
};
Expand All @@ -872,7 +872,9 @@ where
);
}

self.transaction_pool.remove_invalid(&unqueue_invalid);
self.transaction_pool
.report_invalid(Some(self.parent_hash), unqueue_invalid)
.await;
Ok(end_reason)
}

Expand Down
2 changes: 1 addition & 1 deletion docker/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN cargo install cargo-chef
COPY rust-toolchain.toml ./

# Install the pinned toolchain and wasm target
RUN rustup show && rustup target add wasm32-unknown-unknown
RUN rustup show && rustup target add wasm32-unknown-unknown && rustup target add wasm32v1-none

# ---------------------
# Stage 2: Plan recipe
Expand Down
2 changes: 1 addition & 1 deletion docker/test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN cargo install cargo-expand
COPY rust-toolchain.toml ./

# Install the pinned toolchain and wasm target
RUN rustup show && rustup target add wasm32-unknown-unknown
RUN rustup show && rustup target add wasm32-unknown-unknown && rustup target add wasm32v1-none

# ---------------------
# Stage 2: Plan recipe
Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sc-consensus = { workspace = true }
sc-consensus-aura = { workspace = true }
sc-consensus-manual-seal = { workspace = true }
sc-executor = { workspace = true }
cumulus-primitives-proof-size-hostfunction = { workspace = true, features = ["std"] }
sc-consensus-grandpa = { workspace = true }
sc-network = { workspace = true }
sc-network-common = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub fn base_genesis(
// System
system: Default::default(),
transaction_payment: Default::default(),
native_balances: Default::default(),
session: SessionConfig {
keys: initial_authorities
.iter()
Expand All @@ -116,6 +117,7 @@ pub fn base_genesis(
)
})
.collect::<Vec<_>>(),
non_authority_keys: Default::default(),
},
validator_set: ValidatorSetConfig {
initial_validators: initial_authorities.iter().map(|x| x.0).collect(),
Expand Down
8 changes: 8 additions & 0 deletions node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ pub struct EthConfiguration {
#[arg(long, default_value = "10000")]
pub max_past_logs: u32,

/// Maximum number of blocks to scan per `eth_getLogs` query.
#[arg(long, default_value = "1024")]
pub max_block_range: u32,

/// Maximum fee history cache size.
#[arg(long, default_value = "2048")]
pub fee_history_limit: u64,
Expand Down Expand Up @@ -133,6 +137,10 @@ pub struct EthConfiguration {
#[arg(long, default_value = "300")]
pub ethapi_trace_cache_duration: u64,

/// Size in bytes of the LRU cache for `trace_filter` block traces (default 100MB).
#[arg(long, default_value = "104857600")]
pub ethapi_trace_cache_size: u64,

#[arg(long, value_delimiter = ',', default_value = "none")]
pub ethapi: Vec<EthApi>,
}
Expand Down
28 changes: 11 additions & 17 deletions node/src/rpc/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use sc_client_api::{
use sc_network::service::traits::NetworkService;
use sc_network_sync::SyncingService;
use sc_rpc::SubscriptionTaskExecutor;
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool_api::TransactionPool;
use sp_api::{CallApiAt, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder as BlockBuilderApi;
Expand All @@ -51,13 +50,11 @@ use moonbeam_rpc_trace::{Trace, TraceServer};
use super::TracingConfig;

/// Extra dependencies for Ethereum compatibility.
pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
pub struct EthDeps<B: BlockT, C, P, CT, CIDP> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Graph pool instance.
pub graph: Arc<Pool<A>>,
/// Ethereum transaction converter.
pub converter: Option<CT>,
/// The Node authority flag
Expand All @@ -78,6 +75,8 @@ pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
pub filter_pool: Option<FilterPool>,
/// Maximum number of logs in a query.
pub max_past_logs: u32,
/// Maximum number of blocks scanned per `eth_getLogs` query.
pub max_block_range: u32,
/// Fee history cache.
pub fee_history_cache: FeeHistoryCache,
/// Maximum fee history cache size.
Expand All @@ -92,9 +91,9 @@ pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
}

/// Instantiate Ethereum-compatible RPC extensions.
pub fn create_eth<B, C, BE, P, A, CT, CIDP, EC>(
pub fn create_eth<B, C, BE, P, CT, CIDP, EC>(
mut io: RpcModule<()>,
deps: EthDeps<B, C, P, A, CT, CIDP>,
deps: EthDeps<B, C, P, CT, CIDP>,
subscription_task_executor: SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
Expand All @@ -114,8 +113,7 @@ where
C: HeaderBackend<B> + HeaderMetadata<B, Error = BlockChainError>,
C: BlockchainEvents<B> + AuxStore + UsageProvider<B> + StorageProvider<B, BE> + 'static,
BE: Backend<B> + 'static,
P: TransactionPool<Block = B> + 'static,
A: ChainApi<Block = B> + 'static,
P: TransactionPool<Block = B, Hash = B::Hash> + 'static,
CT: ConvertTransaction<<B as BlockT>::Extrinsic> + Send + Sync + 'static,
CIDP: CreateInherentDataProviders<B, ()> + Send + 'static,
EC: EthConfig<B, C>,
Expand All @@ -125,13 +123,10 @@ where
Debug, DebugApiServer, Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer,
EthPubSub, EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer,
};
#[cfg(feature = "txpool")]
use fc_rpc::{TxPool, TxPoolApiServer};

let EthDeps {
client,
pool,
graph,
converter,
is_authority,
enable_dev_signer,
Expand All @@ -142,6 +137,7 @@ where
block_data_cache,
filter_pool,
max_past_logs,
max_block_range,
fee_history_cache,
fee_history_cache_limit,
execute_gas_limit_multiplier,
Expand All @@ -155,10 +151,9 @@ where
}

io.merge(
Eth::<B, C, P, CT, BE, A, CIDP, EC>::new(
Eth::<B, C, P, CT, BE, CIDP, EC>::new(
client.clone(),
pool.clone(),
graph.clone(),
converter,
sync.clone(),
signers,
Expand All @@ -184,10 +179,11 @@ where
EthFilter::new(
client.clone(),
frontier_backend.clone(),
graph.clone(),
pool.clone(),
filter_pool,
500_usize, // max stored filters
max_past_logs,
max_block_range,
block_data_cache.clone(),
)
.into_rpc(),
Expand Down Expand Up @@ -228,8 +224,6 @@ where
.into_rpc(),
)?;

#[cfg(feature = "txpool")]
io.merge(TxPool::new(client, graph).into_rpc())?;

// Merge the tracing RPCs into the RPC module.
if let Some(tracing_config) = optional_tracing_config {
Expand All @@ -238,7 +232,7 @@ where
}

if let Some(trace_requester) = tracing_config.tracing_requesters.trace {
io.merge(Trace::new(client.clone(), trace_requester, 20).into_rpc())?;
io.merge(Trace::new(client.clone(), trace_requester, tracing_config.trace_filter_max_count, 1024).into_rpc())?;
}
}

Expand Down
20 changes: 7 additions & 13 deletions node/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ use sc_client_api::{
};
use sc_consensus_manual_seal::rpc::EngineCommand;
use sc_rpc::SubscriptionTaskExecutor;
use sc_rpc_api::DenyUnsafe;
use sc_service::TransactionPool;
use sc_transaction_pool::ChainApi;
use sp_api::{CallApiAt, ProvideRuntimeApi};
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sp_core::H256;
Expand All @@ -52,17 +50,15 @@ pub mod tracing;
pub use self::tracing::*;

/// Full client dependencies.
pub struct FullDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
pub struct FullDeps<B: BlockT, C, P, CT, CIDP> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
/// Manual seal command sink
pub command_sink: Option<mpsc::Sender<EngineCommand<Hash>>>,
/// Ethereum-compatibility specific dependencies.
pub eth: EthDeps<B, C, P, A, CT, CIDP>,
pub eth: EthDeps<B, C, P, CT, CIDP>,
}

pub struct TracingConfig {
Expand All @@ -84,8 +80,8 @@ where
}

/// Instantiate all Full RPC extensions.
pub fn create_full<B, C, P, BE, A, CT, CIDP>(
deps: FullDeps<B, C, P, A, CT, CIDP>,
pub fn create_full<B, C, P, BE, CT, CIDP>(
deps: FullDeps<B, C, P, CT, CIDP>,
subscription_task_executor: SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
Expand All @@ -111,8 +107,7 @@ where
C: HeaderBackend<B> + HeaderMetadata<B, Error = BlockChainError> + 'static,
C: BlockchainEvents<B> + AuxStore + UsageProvider<B> + StorageProvider<B, BE>,
BE: Backend<B> + 'static,
P: TransactionPool<Block = B> + 'static,
A: ChainApi<Block = B> + 'static,
P: TransactionPool<Block = B, Hash = B::Hash> + 'static,
CIDP: CreateInherentDataProviders<B, ()> + Send + 'static,
CT: fp_rpc::ConvertTransaction<<B as BlockT>::Extrinsic> + Send + Sync + 'static,
{
Expand All @@ -125,12 +120,11 @@ where
let FullDeps {
client,
pool,
deny_unsafe,
command_sink,
eth,
} = deps;

io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
io.merge(System::new(client.clone(), pool.clone()).into_rpc())?;
io.merge(TransactionPayment::new(client.clone()).into_rpc())?;
io.merge(StabilityRpc::new(client.clone(), pool.clone()).into_rpc())?;

Expand All @@ -143,7 +137,7 @@ where
}

// Ethereum compatibility RPCs
let io = create_eth::<_, _, _, _, _, _, _, DefaultEthConfig<C, BE>>(
let io = create_eth::<_, _, _, _, _, _, DefaultEthConfig<C, BE>>(
io,
eth,
subscription_task_executor,
Expand Down
3 changes: 2 additions & 1 deletion node/src/rpc/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ where
let (trace_filter_task, trace_filter_requester) = CacheTask::create(
Arc::clone(&params.client),
Arc::clone(&params.substrate_backend),
core::time::Duration::from_secs(rpc_config.ethapi_trace_cache_duration),
rpc_config.ethapi_trace_cache_size,
Arc::clone(&permit_pool),
Arc::clone(&params.storage_override),
prometheus,
params.task_manager.spawn_handle(),
);
(Some(trace_filter_task), Some(trace_filter_requester))
} else {
Expand Down
Loading
Loading