Skip to content

Commit

Permalink
style( sorry ): editor reset fmt to use default instead of nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwht committed Jan 10, 2025
1 parent 7bb4014 commit e89b670
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 64 deletions.
34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inherits = "release"
lto = true

[workspace.package]
authors = ["R0GUE <go@r0gue.io>"]
authors = [ "R0GUE <go@r0gue.io>" ]
description = "Pop Network makes it easy for smart contract developers to use the Power of Polkadot."
edition = "2021"
homepage = "https://r0gue.io"
Expand All @@ -16,28 +16,28 @@ repository = "https://github.com/r0gue-io/pop-node/"

[workspace]
exclude = [
"extension/contract",
"pop-api",
"tests/contracts",
"extension/contract",
"pop-api",
"tests/contracts",
]
members = [
# TODO: add back in once the 2412 release is fixed.
# "integration-tests",
"node",
"pallets/*",
"primitives",
"runtime/devnet",
"runtime/mainnet",
"runtime/testnet",
# TODO: add back in once the 2412 release is fixed.
# "integration-tests",
"node",
"pallets/*",
"primitives",
"runtime/devnet",
"runtime/mainnet",
"runtime/testnet",
]

resolver = "2"

[workspace.dependencies]
anyhow = { version = "1.0", default-features = false }
clap = { version = "4.5.10", features = ["derive"] }
clap = { version = "4.5.10", features = [ "derive" ] }
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [
"derive",
"derive",
] }
color-print = "0.3.4"
contract-build = "5.0.2"
Expand All @@ -48,18 +48,18 @@ futures = "0.3.30"
hex = "0.4.3"
hex-literal = "0.4.1"
impl-trait-for-tuples = "0.2.2"
jsonrpsee = { version = "0.24.3", features = ["server"] }
jsonrpsee = { version = "0.24.3", features = [ "server" ] }
log = { version = "0.4.22", default-features = false }
rand = "0.8.5"
scale-info = { version = "2.11.1", default-features = false, features = [
"derive",
"derive",
] }
serde = "1.0.209"
serde_json = "1.0.127"
smallvec = "1.11.2"
subxt = "0.38.0"
subxt-signer = "0.38.0"
tokio = { version = "1.36", features = ["macros", "rt-multi-thread", "time"] }
tokio = { version = "1.36", features = [ "macros", "rt-multi-thread", "time" ] }
tracing-subscriber = { version = "0.3.18", default-features = false }

# Build
Expand Down
18 changes: 9 additions & 9 deletions extension/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ mod tests {
assert!(DispatchCallWithFilter::<Nothing>::execute(&mut env).is_err());
assert_eq!(
env.charged(),
read_from_buffer_weight(encoded_call.len() as u32)
+ call.get_dispatch_info().call_weight
read_from_buffer_weight(encoded_call.len() as u32) +
call.get_dispatch_info().call_weight
);
}

Expand Down Expand Up @@ -362,8 +362,8 @@ mod tests {
assert!(DispatchCall::execute(&mut env).is_ok());
assert_eq!(
env.charged(),
read_from_buffer_weight(encoded_call.len() as u32)
+ call.get_dispatch_info().call_weight
read_from_buffer_weight(encoded_call.len() as u32) +
call.get_dispatch_info().call_weight
);
})
}
Expand All @@ -387,9 +387,9 @@ mod tests {
assert_eq!(call.get_dispatch_info().call_weight, migrate_weight + weight_limit);
assert_eq!(
env.charged(),
read_from_buffer_weight(encoded_call.len() as u32)
+ call.get_dispatch_info().call_weight
- extra_weight
read_from_buffer_weight(encoded_call.len() as u32) +
call.get_dispatch_info().call_weight -
extra_weight
);
})
}
Expand Down Expand Up @@ -488,8 +488,8 @@ mod tests {
let expected = "pop".as_bytes().encode();
assert_eq!(
env.charged(),
read_from_buffer_weight(encoded_read.len() as u32)
+ read.weight() + write_to_contract_weight(expected.len() as u32)
read_from_buffer_weight(encoded_read.len() as u32) +
read.weight() + write_to_contract_weight(expected.len() as u32)
);
}

Expand Down
14 changes: 7 additions & 7 deletions extension/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ mod extension {
// Charges weight.
assert_eq!(
env.charged(),
overhead_weight(encoded_call.len() as u32)
+ read_from_buffer_weight(encoded_call.len() as u32)
+ call.get_dispatch_info().call_weight
overhead_weight(encoded_call.len() as u32) +
read_from_buffer_weight(encoded_call.len() as u32) +
call.get_dispatch_info().call_weight
);
});
}
Expand Down Expand Up @@ -187,10 +187,10 @@ mod extension {
// Charges weight.
assert_eq!(
env.charged(),
overhead_weight(encoded_read.len() as u32)
+ read_from_buffer_weight(encoded_read.len() as u32)
+ read.weight()
+ write_to_contract_weight(expected.len() as u32)
overhead_weight(encoded_read.len() as u32) +
read_from_buffer_weight(encoded_read.len() as u32) +
read.weight() +
write_to_contract_weight(expected.len() as u32)
);
// Check if the contract environment buffer is written correctly.
assert_eq!(env.buffer, expected);
Expand Down
20 changes: 8 additions & 12 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ impl RuntimeResolver for PathBuf {

fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Ok(match id {
"dev" | "devnet" | "dev-paseo" => {
Box::new(chain_spec::development_chain_spec(Relay::PaseoLocal))
},
"dev" | "devnet" | "dev-paseo" =>
Box::new(chain_spec::development_chain_spec(Relay::PaseoLocal)),
"test" | "testnet" | "pop-paseo" => Box::new(chain_spec::testnet_chain_spec(Relay::Paseo)),
"pop" | "mainnet" | "pop-polkadot" | "pop-network" => {
Box::new(chain_spec::mainnet_chain_spec(Relay::Polkadot))
},
"pop" | "mainnet" | "pop-polkadot" | "pop-network" =>
Box::new(chain_spec::mainnet_chain_spec(Relay::Polkadot)),
"" | "local" => Box::new(chain_spec::development_chain_spec(Relay::PaseoLocal)),
path => {
let path: PathBuf = path.into();
Expand Down Expand Up @@ -305,7 +303,7 @@ pub fn run() -> Result<()> {
let runner = cli.create_runner(cmd)?;
// Switch on the concrete benchmark sub-command-
match cmd {
BenchmarkCmd::Pallet(cmd) => {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| {
cmd.run_with_spec::<HashingFor<Block>, ReclaimHostFunctions>(Some(
Expand All @@ -316,8 +314,7 @@ pub fn run() -> Result<()> {
Err("Benchmarking wasn't enabled when building the node. You can enable \
it with `--features runtime-benchmarks`."
.into())
}
},
},
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
construct_benchmark_partials!(config, |partials| cmd.run(partials.client))
}),
Expand All @@ -334,9 +331,8 @@ pub fn run() -> Result<()> {
cmd.run(config, partials.client.clone(), db, storage)
})
}),
BenchmarkCmd::Machine(cmd) => {
runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()))
},
BenchmarkCmd::Machine(cmd) =>
runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())),
// NOTE: this allows the Client to leniently implement
// new benchmark commands without requiring a companion MR.
#[allow(unreachable_patterns)]
Expand Down
2 changes: 1 addition & 1 deletion pallets/nfts/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn mint_item<T: Config<I>, I: 'static>(
let item_exists = Item::<T, I>::contains_key(collection, item);
let item_config = ItemConfigOf::<T, I>::get(collection, item);
if item_exists {
return (item, caller, caller_lookup)
return (item, caller, caller_lookup);
} else if let Some(item_config) = item_config {
assert_ok!(Nfts::<T, I>::force_mint(
SystemOrigin::Signed(caller.clone()).into(),
Expand Down
2 changes: 1 addition & 1 deletion pallets/nfts/src/common_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
signer: &T::AccountId,
) -> DispatchResult {
if signature.verify(&**data, signer) {
return Ok(())
return Ok(());
}

// NOTE: for security reasons modern UIs implicitly wrap the data requested to sign into
Expand Down
4 changes: 2 additions & 2 deletions pallets/nfts/src/features/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
// Check if the `origin` is the current owner of the collection.
ensure!(origin == details.owner, Error::<T, I>::NoPermission);
if details.owner == new_owner {
return Ok(())
return Ok(());
}

// Move the deposit to the new owner.
Expand Down Expand Up @@ -211,7 +211,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Collection::<T, I>::try_mutate(collection, |maybe_details| {
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
if details.owner == owner {
return Ok(())
return Ok(());
}

// Move the deposit to the new owner.
Expand Down
4 changes: 2 additions & 2 deletions pallets/nfts/src/impl_nonfungibles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl<T: Config<I>, I: 'static> Mutate<<T as SystemConfig>::AccountId, ItemConfig
Self::do_burn(*collection, *item, |d| {
if let Some(check_owner) = maybe_check_owner {
if &d.owner != check_owner {
return Err(Error::<T, I>::NoPermission.into())
return Err(Error::<T, I>::NoPermission.into());
}
}
Ok(())
Expand Down Expand Up @@ -419,7 +419,7 @@ impl<T: Config<I>, I: 'static> Transfer<T::AccountId> for Pallet<T, I> {
Self::has_system_attribute(collection, item, PalletAttributes::TransferDisabled)?;
// Can't lock the item twice
if transfer_disabled {
return Err(Error::<T, I>::ItemLocked.into())
return Err(Error::<T, I>::ItemLocked.into());
}

<Self as Mutate<T::AccountId, ItemConfig>>::set_attribute(
Expand Down
2 changes: 1 addition & 1 deletion pallets/nfts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ pub mod pallet {
if T::Currency::reserve(&details.deposit.account, deposit - old).is_err() {
// NOTE: No alterations made to collection_details in this iteration so
// far, so this is OK to do.
continue
continue;
}
},
_ => continue,
Expand Down
8 changes: 4 additions & 4 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ impl Contains<RuntimeCall> for FilteredCalls {
matches!(
c,
RuntimeCall::Balances(
force_adjust_total_issuance { .. }
| force_set_balance { .. }
| force_transfer { .. }
| force_unreserve { .. }
force_adjust_total_issuance { .. } |
force_set_balance { .. } |
force_transfer { .. } |
force_unreserve { .. }
)
)
}
Expand Down
8 changes: 4 additions & 4 deletions runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ impl Contains<RuntimeCall> for FilteredCalls {
matches!(
c,
RuntimeCall::Balances(
force_adjust_total_issuance { .. }
| force_set_balance { .. }
| force_transfer { .. }
| force_unreserve { .. }
force_adjust_total_issuance { .. } |
force_set_balance { .. } |
force_transfer { .. } |
force_unreserve { .. }
)
)
}
Expand Down
8 changes: 4 additions & 4 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ impl Contains<RuntimeCall> for FilteredCalls {
matches!(
c,
RuntimeCall::Balances(
force_adjust_total_issuance { .. }
| force_set_balance { .. }
| force_transfer { .. }
| force_unreserve { .. }
force_adjust_total_issuance { .. } |
force_set_balance { .. } |
force_transfer { .. } |
force_unreserve { .. }
)
)
}
Expand Down

0 comments on commit e89b670

Please sign in to comment.