Skip to content
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

rpc server: listen to ipv6 socket if available and --experimental-rpc-endpoint CLI option #4792

Merged
merged 75 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
12c57c9
rpc: upgrade jsonrpsee v0.23
niklasad1 May 27, 2024
0aadd3d
Merge remote-tracking branch 'origin/master' into na-jsonrpsee-v0.23
niklasad1 Jun 7, 2024
15691d6
cleanup
niklasad1 Jun 7, 2024
f681f0e
make it compile
niklasad1 Jun 7, 2024
bd74645
fix test build
niklasad1 Jun 7, 2024
88a7c00
Merge remote-tracking branch 'origin/master' into na-jsonrpsee-v0.23
niklasad1 Jun 7, 2024
369db7e
jsonrpsee v0.23.1
niklasad1 Jun 10, 2024
fa8cda3
Merge remote-tracking branch 'origin/master' into na-jsonrpsee-v0.23
niklasad1 Jun 10, 2024
a2418a2
remove needless deps
niklasad1 Jun 12, 2024
5f62b6e
rpc: add support for ipv6 addr
niklasad1 Jun 13, 2024
a2e6e07
rpc: add `--rpc-listen-addr`
niklasad1 Jun 14, 2024
489a598
Merge branch 'master' into na-jsonrpsee-v0.23
niklasad1 Jun 18, 2024
f3df0da
fix bad merge
niklasad1 Jun 19, 2024
0b0cabe
add prdoc
niklasad1 Jun 19, 2024
0237951
bridges: add `serde_json` dependency
niklasad1 Jun 19, 2024
0f90c4e
fix prdoc
niklasad1 Jun 19, 2024
3115029
fix prdoc again
niklasad1 Jun 19, 2024
d969257
Merge remote-tracking branch 'origin/master' into na-jsonrpsee-v0.23
niklasad1 Jun 20, 2024
f0bd8b2
Merge remote-tracking branch 'origin/na-jsonrpsee-v0.23' into na-rpc-…
niklasad1 Jun 20, 2024
0477b67
move DenyUnsafe to rpc extension
niklasad1 Jun 21, 2024
1b4c2d3
implement niklas crazy solution
niklasad1 Jun 22, 2024
cc98347
fix nits
niklasad1 Jun 22, 2024
d1ddf14
Merge remote-tracking branch 'origin/master' into na-rpc-support-ipv6…
niklasad1 Aug 12, 2024
66b64c8
Delete prdoc/pr_4730.prdoc
niklasad1 Aug 12, 2024
a3e5f52
fix todos
niklasad1 Aug 12, 2024
0eb3e5f
sc-rpc: fix tests
niklasad1 Aug 12, 2024
11a871f
fix clippy
niklasad1 Aug 12, 2024
c564cdc
cleanup
niklasad1 Aug 13, 2024
b8e575c
remove stale tests
niklasad1 Aug 13, 2024
8b8b083
add warnings for rpc cfg
niklasad1 Aug 13, 2024
7e1c30e
fix test build
niklasad1 Aug 13, 2024
9122ba7
remove unused deps
niklasad1 Aug 13, 2024
fdd335e
fix warnings
niklasad1 Aug 13, 2024
5b1f5ff
Merge remote-tracking branch 'origin/master' into na-rpc-support-ipv6…
niklasad1 Aug 13, 2024
3e78406
fix more warnings
niklasad1 Aug 13, 2024
d08985a
rpc handler: inject deny unsafe
niklasad1 Aug 14, 2024
42bc717
update jsonrpsee
niklasad1 Aug 14, 2024
5d0afcd
update jsonrpsee
niklasad1 Aug 14, 2024
245f265
Merge remote-tracking branch 'origin/master' into na-rpc-support-ipv6…
niklasad1 Aug 14, 2024
4ea49af
update jsonrpsee
niklasad1 Aug 14, 2024
d16b0bd
remove used import
niklasad1 Aug 14, 2024
9fc691a
fix more nits
niklasad1 Aug 14, 2024
6073e86
rpc: remove slow logging
niklasad1 Aug 15, 2024
8fb416e
Merge remote-tracking branch 'origin/master' into na-rpc-support-ipv6…
niklasad1 Aug 15, 2024
7c7f8e3
rpc: allow optional ipv6 to fail
niklasad1 Aug 15, 2024
270f178
fix test build
niklasad1 Aug 15, 2024
811dfa4
fix broken tests
niklasad1 Aug 15, 2024
ce6c96f
make rpc server log backward compatible
niklasad1 Aug 15, 2024
738f435
fix some nits
niklasad1 Aug 16, 2024
e68f05f
move all rpc settings options to --rpc-endpoint
niklasad1 Aug 21, 2024
a4e01a0
fix nits
niklasad1 Aug 21, 2024
e1394e2
fix tests
niklasad1 Aug 21, 2024
32be5a2
Update substrate/client/cli/src/commands/run_cmd.rs
niklasad1 Aug 21, 2024
2ecbafd
fix grumbles
niklasad1 Aug 22, 2024
799e3e0
use proper port from the cli
niklasad1 Aug 22, 2024
d2e0844
Update substrate/client/cli/src/commands/run_cmd.rs
niklasad1 Aug 22, 2024
e452047
Merge remote-tracking branch 'origin/master' into na-rpc-support-ipv6…
niklasad1 Aug 22, 2024
2f663ea
Merge remote-tracking branch 'origin/na-rpc-support-ipv6-sockets' int…
niklasad1 Aug 22, 2024
0bb4871
Update substrate/client/cli/src/commands/run_cmd.rs
niklasad1 Aug 22, 2024
9d593c3
Delete cumulus/polkadot-parachain/src/command.rs
niklasad1 Aug 22, 2024
3827211
add prdoc and minor fixes
niklasad1 Aug 22, 2024
a4dec4e
Update prdoc/pr_4792.prdoc
niklasad1 Aug 22, 2024
9ddaf45
Update prdoc/pr_4792.prdoc
niklasad1 Aug 22, 2024
4ede846
fix toml fmt
niklasad1 Aug 22, 2024
a4ec638
Merge remote-tracking branch 'origin/na-rpc-support-ipv6-sockets' int…
niklasad1 Aug 22, 2024
829e9ca
update prdoc
niklasad1 Aug 22, 2024
c7a100e
semver v2
niklasad1 Aug 22, 2024
12e27fc
semver v3
niklasad1 Aug 23, 2024
46671b4
`--rpc-endpoint` -> `--experimental-rpc-endpoint`
niklasad1 Aug 23, 2024
0857baa
Update substrate/client/cli/src/commands/run_cmd.rs
niklasad1 Aug 23, 2024
bb8a039
Merge remote-tracking branch 'origin/master' into na-rpc-support-ipv6…
niklasad1 Aug 27, 2024
ecd1146
separate override
niklasad1 Aug 27, 2024
f490e7b
Update substrate/client/cli/src/commands/run_cmd.rs
niklasad1 Aug 28, 2024
f2d90d0
Merge branch 'master' into na-rpc-support-ipv6-sockets
niklasad1 Aug 28, 2024
304036e
cargo fmt
niklasad1 Aug 28, 2024
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
76 changes: 33 additions & 43 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,8 @@ isahc = { version = "1.2" }
itertools = { version = "0.11" }
jobserver = { version = "0.1.26" }
jsonpath_lib = { version = "0.3" }
jsonrpsee = { version = "0.23.2" }
jsonrpsee-core = { version = "0.23.2" }
jsonrpsee = { version = "0.24.3" }
jsonrpsee-core = { version = "0.24.3" }
k256 = { version = "0.13.3", default-features = false }
kitchensink-runtime = { path = "substrate/bin/node/runtime" }
kvdb = { version = "0.13.0" }
Expand Down
4 changes: 2 additions & 2 deletions cumulus/client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
use std::{
fs,
io::{self, Write},
net::SocketAddr,
path::PathBuf,
sync::Arc,
};

use codec::Encode;
use sc_chain_spec::ChainSpec;
use sc_cli::RpcEndpoint;
use sc_client_api::HeaderBackend;
use sc_service::{
config::{PrometheusConfig, RpcBatchRequestConfig, TelemetryEndpoints},
Expand Down Expand Up @@ -423,7 +423,7 @@ impl sc_cli::CliConfiguration for NormalizedRunCmd {
self.base.rpc_cors(is_dev)
}

fn rpc_addr(&self, default_listen_port: u16) -> sc_cli::Result<Option<SocketAddr>> {
fn rpc_addr(&self, default_listen_port: u16) -> sc_cli::Result<Option<Vec<RpcEndpoint>>> {
self.base.rpc_addr(default_listen_port)
}

Expand Down
6 changes: 3 additions & 3 deletions cumulus/polkadot-parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ use log::info;
use parachains_common::{AssetHubPolkadotAuraId, AuraId};
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, SharedParams, SubstrateCli,
NetworkParams, Result, RpcListenAddr, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_runtime::traits::AccountIdConversion;
#[cfg(feature = "runtime-benchmarks")]
use sp_runtime::traits::HashingFor;
use std::{net::SocketAddr, path::PathBuf};
use std::path::PathBuf;

/// The choice of consensus for the parachain omni-node.
#[derive(PartialEq, Eq, Debug, Default)]
Expand Down Expand Up @@ -652,7 +652,7 @@ impl CliConfiguration<Self> for RelayChainCli {
.or_else(|| self.base_path.clone().map(Into::into)))
}

fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<Vec<RpcListenAddr>>> {
self.base.base.rpc_addr(default_listen_port)
}

Expand Down
14 changes: 4 additions & 10 deletions cumulus/polkadot-parachain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ use crate::{
};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use parachains_common::{AccountId, Balance, Block, Nonce};
use sc_rpc::{
dev::{Dev, DevApiServer},
DenyUnsafe,
};
use sc_rpc::dev::{Dev, DevApiServer};
use std::{marker::PhantomData, sync::Arc};
use substrate_frame_rpc_system::{System, SystemApiServer};
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
Expand All @@ -37,7 +34,6 @@ pub type RpcExtension = jsonrpsee::RpcModule<()>;

pub(crate) trait BuildRpcExtensions<Client, Backend, Pool> {
fn build_rpc_extensions(
deny_unsafe: DenyUnsafe,
client: Arc<Client>,
backend: Arc<Backend>,
pool: Arc<Pool>,
Expand All @@ -56,7 +52,6 @@ where
RuntimeApi: ConstructNodeRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
{
fn build_rpc_extensions(
_deny_unsafe: DenyUnsafe,
_client: Arc<ParachainClient<RuntimeApi>>,
_backend: Arc<ParachainBackend>,
_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
Expand All @@ -79,18 +74,17 @@ where
+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
{
fn build_rpc_extensions(
deny_unsafe: DenyUnsafe,
client: Arc<ParachainClient<RuntimeApi>>,
backend: Arc<ParachainBackend>,
pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
) -> sc_service::error::Result<RpcExtension> {
let build = || -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>> {
let mut module = RpcExtension::new(());

module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(client.clone(), pool).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
module.merge(Dev::new(client, deny_unsafe).into_rpc())?;
module.merge(StateMigration::new(client.clone(), backend).into_rpc())?;
module.merge(Dev::new(client).into_rpc())?;

Ok(module)
};
Expand Down
Loading