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

Rename transaction JSON-RPC namespace #1604

Merged
merged 2 commits into from
Jan 24, 2024
Merged
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
6 changes: 3 additions & 3 deletions lib/src/json_rpc/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ define_methods! {
sudo_unstable_p2pDiscover(multiaddr: Cow<'a, str>) -> (),
sudo_unstable_version() -> Cow<'a, str>,

transaction_unstable_submitAndWatch(transaction: HexString) -> Cow<'a, str>,
transaction_unstable_unwatch(subscription: Cow<'a, str>) -> (),
transactionWatch_unstable_submitAndWatch(transaction: HexString) -> Cow<'a, str>,
transactionWatch_unstable_unwatch(subscription: Cow<'a, str>) -> (),

// These functions are a custom addition in smoldot. As of the writing of this comment, there
// is no plan to standardize them. See <https://github.com/paritytech/smoldot/issues/2245> and
Expand All @@ -521,7 +521,7 @@ define_methods! {

// The functions below are experimental and are defined in the document https://github.com/paritytech/json-rpc-interface-spec/
chainHead_unstable_followEvent(subscription: Cow<'a, str>, result: FollowEvent<'a>) -> (),
transaction_unstable_watchEvent(subscription: Cow<'a, str>, result: TransactionWatchEvent<'a>) -> (),
transactionWatch_unstable_watchEvent(subscription: Cow<'a, str>, result: TransactionWatchEvent<'a>) -> (),

// This function is a custom addition in smoldot. As of the writing of this comment, there is
// no plan to standardize it. See https://github.com/paritytech/smoldot/issues/2245.
Expand Down
12 changes: 6 additions & 6 deletions lib/src/json_rpc/service/client_main_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl ClientMainTask {
| methods::MethodCall::chain_subscribeNewHeads { .. }
| methods::MethodCall::state_subscribeRuntimeVersion { .. }
| methods::MethodCall::state_subscribeStorage { .. }
| methods::MethodCall::transaction_unstable_submitAndWatch { .. }
| methods::MethodCall::transactionWatch_unstable_submitAndWatch { .. }
| methods::MethodCall::sudo_network_unstable_watch { .. }
| methods::MethodCall::chainHead_unstable_follow { .. } => {
// Subscription starting requests.
Expand Down Expand Up @@ -540,7 +540,7 @@ impl ClientMainTask {
methods::MethodCall::author_unwatchExtrinsic { subscription, .. }
| methods::MethodCall::state_unsubscribeRuntimeVersion { subscription, .. }
| methods::MethodCall::state_unsubscribeStorage { subscription, .. }
| methods::MethodCall::transaction_unstable_unwatch { subscription, .. }
| methods::MethodCall::transactionWatch_unstable_unwatch { subscription, .. }
| methods::MethodCall::sudo_network_unstable_unwatch { subscription, .. }
| methods::MethodCall::chainHead_unstable_unfollow {
follow_subscription: subscription,
Expand All @@ -563,9 +563,9 @@ impl ClientMainTask {
methods::MethodCall::state_unsubscribeStorage { .. } => {
methods::Response::state_unsubscribeStorage(true)
}
methods::MethodCall::transaction_unstable_unwatch {
methods::MethodCall::transactionWatch_unstable_unwatch {
..
} => methods::Response::transaction_unstable_unwatch(()),
} => methods::Response::transactionWatch_unstable_unwatch(()),
methods::MethodCall::sudo_network_unstable_unwatch {
..
} => methods::Response::sudo_network_unstable_unwatch(()),
Expand Down Expand Up @@ -1157,8 +1157,8 @@ impl SubscriptionStartProcess {
methods::MethodCall::state_subscribeStorage { .. } => {
methods::Response::state_subscribeStorage(Cow::Borrowed(&self.subscription_id))
}
methods::MethodCall::transaction_unstable_submitAndWatch { .. } => {
methods::Response::transaction_unstable_submitAndWatch(Cow::Borrowed(
methods::MethodCall::transactionWatch_unstable_submitAndWatch { .. } => {
methods::Response::transactionWatch_unstable_submitAndWatch(Cow::Borrowed(
&self.subscription_id,
))
}
Expand Down
10 changes: 5 additions & 5 deletions light-base/src/json_rpc_service/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ impl<TPlat: PlatformRef> Background<TPlat> {
| methods::MethodCall::rpc_methods { .. }
| methods::MethodCall::sudo_unstable_p2pDiscover { .. }
| methods::MethodCall::sudo_unstable_version { .. }
| methods::MethodCall::transaction_unstable_submitAndWatch { .. }
| methods::MethodCall::transaction_unstable_unwatch { .. }
| methods::MethodCall::transactionWatch_unstable_submitAndWatch { .. }
| methods::MethodCall::transactionWatch_unstable_unwatch { .. }
| methods::MethodCall::sudo_network_unstable_watch { .. }
| methods::MethodCall::sudo_network_unstable_unwatch { .. }
| methods::MethodCall::chainHead_unstable_finalizedDatabase { .. } => {}
Expand Down Expand Up @@ -627,8 +627,8 @@ impl<TPlat: PlatformRef> Background<TPlat> {
| methods::MethodCall::rpc_methods { .. }
| methods::MethodCall::sudo_unstable_p2pDiscover { .. }
| methods::MethodCall::sudo_unstable_version { .. }
| methods::MethodCall::transaction_unstable_submitAndWatch { .. }
| methods::MethodCall::transaction_unstable_unwatch { .. }
| methods::MethodCall::transactionWatch_unstable_submitAndWatch { .. }
| methods::MethodCall::transactionWatch_unstable_unwatch { .. }
| methods::MethodCall::sudo_network_unstable_watch { .. }
| methods::MethodCall::sudo_network_unstable_unwatch { .. }
| methods::MethodCall::chainHead_unstable_finalizedDatabase { .. } => {}
Expand All @@ -650,7 +650,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
methods::MethodCall::chainHead_unstable_follow { .. } => {
self.chain_head_follow(request).await;
}
methods::MethodCall::transaction_unstable_submitAndWatch { .. } => {
methods::MethodCall::transactionWatch_unstable_submitAndWatch { .. } => {
self.submit_and_watch_transaction(request).await
}

Expand Down
24 changes: 12 additions & 12 deletions light-base/src/json_rpc_service/background/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
}

/// Handles a call to [`methods::MethodCall::author_submitAndWatchExtrinsic`] (if `is_legacy`
/// is `true`) or to [`methods::MethodCall::transaction_unstable_submitAndWatch`] (if
/// is `true`) or to [`methods::MethodCall::transactionWatch_unstable_submitAndWatch`] (if
/// `is_legacy` is `false`).
pub(super) async fn submit_and_watch_transaction(
self: &Arc<Self>,
Expand All @@ -83,7 +83,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
methods::MethodCall::author_submitAndWatchExtrinsic { transaction } => {
(transaction, true)
}
methods::MethodCall::transaction_unstable_submitAndWatch { transaction } => {
methods::MethodCall::transactionWatch_unstable_submitAndWatch { transaction } => {
(transaction, false)
}
_ => unreachable!(),
Expand Down Expand Up @@ -148,7 +148,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
num_broadcasted_peers += peers.len();
subscription
.send_notification(
methods::ServerToClient::transaction_unstable_watchEvent {
methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Broadcasted {
num_peers: u32::try_from(num_broadcasted_peers)
Expand All @@ -165,7 +165,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
(transactions_service::TransactionStatus::Validated, false) => {
subscription
.send_notification(
methods::ServerToClient::transaction_unstable_watchEvent {
methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Validated {},
},
Expand Down Expand Up @@ -217,7 +217,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
false,
) => {
included_block = Some(block_hash);
subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result:
methods::TransactionWatchEvent::BestChainBlockIncluded {
Expand All @@ -234,7 +234,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
},
false,
) => {
subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::BestChainBlockIncluded {
block: None,
Expand Down Expand Up @@ -282,7 +282,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
transactions_service::DropReason::GapInChain,
),
false,
) => subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
) => subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Dropped {
error: "gap in chain of blocks".into(),
Expand All @@ -294,7 +294,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
transactions_service::DropReason::MaxPendingTransactionsReached,
),
false,
) => subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
) => subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Dropped {
error: "transactions pool full".into(),
Expand All @@ -306,7 +306,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
transactions_service::DropReason::Invalid(error),
),
false,
) => subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
) => subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Invalid {
error: error.to_string().into(),
Expand All @@ -317,7 +317,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
transactions_service::DropReason::ValidateError(error),
),
false,
) => subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
) => subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Error {
error: error.to_string().into(),
Expand All @@ -328,7 +328,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
transactions_service::DropReason::Crashed,
),
false,
) => subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
) => subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Error {
error: "transactions service has crashed".into(),
Expand Down Expand Up @@ -356,7 +356,7 @@ impl<TPlat: PlatformRef> Background<TPlat> {
},
),
false,
) => subscription.send_notification(methods::ServerToClient::transaction_unstable_watchEvent {
) => subscription.send_notification(methods::ServerToClient::transactionWatch_unstable_watchEvent {
subscription: (&subscription_id).into(),
result: methods::TransactionWatchEvent::Finalized {
block: methods::TransactionWatchEventBlock {
Expand Down
1 change: 1 addition & 0 deletions wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changed

- The `transaction_unstable_submitAndWatch` and `transaction_unstable_unwatch` JSON-RPC functions have been renamed to respectively `transactionWatch_unstable_submitAndWatch` and `transactionWatch_unstable_unwatch`, and the corresponding event has been renamed from `transaction_unstable_watchEvent` to `transactionWatch_unstable_watchEvent`, in accordance with the latest changes in the JSON-RPC API specification. ([#1604](https://github.com/smol-dot/smoldot/pull/1604))
- The warp syncing and regular syncing algorithms now run in parallel, meaning that smoldot will now try to perform a warp sync against peers whose finalized block is (or pretends to be) far ahead from the local finalized block, while at the same time continuing to sync normally from other peers. Additionally, smoldot will no longer try to warp sync to peers whose finalized block is too close to the local finalized block, and will instead sync normally. ([#1591](https://github.com/smol-dot/smoldot/pull/1591))
- The `system_health` JSON-RPC function now returns `isSyncing: true` if any of the peers smoldot is connected to is more than 10 blocks ahead of smoldot, and `false` in any other situation including having no peer. ([#1591](https://github.com/smol-dot/smoldot/pull/1591))

Expand Down
Loading