mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 06:47:57 +00:00
Fail docs on warnings (#5923)
* change (ci): docs job optimized; runs every commit; fails on warnings * change (ci): rename jobs; temporary allow failing * change (ci): better warnings filtering * fix (ci): hotfix Docker release * test (ci): run docs job with flags * test (ci): pwd fails * change (ci): pass just //doc dir as an artifact; debug * change (ci): return to the previous structure; undebug * change (ci): typo * rebase on upstream 2 * fix the jobname * Fix some warnings (#7079) * Partial fix for transaction priority (#7034) * Partial fix for priority stuff. * Small fix * Fix tests. * Update frame/transaction-payment/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Better doc Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * What happens if we remove wat? (#7056) * What happens if we remove wat? * Update Cargo.lock * Make SlashingSpans Public (#6961) * Make SlashingSpans Public Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest. * Update frame/staking/src/lib.rs * client/authority-discovery/src/service: Improve docs (#7059) * Decrease poll interval (#7063) * Remove unused code (#7027) Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com> * Disambiguate `BlockNumber` type in `decl_module` (#7061) * Disambiguate `BlockNumber` type in `decl_module` * fix `frame-support-tests` * fix ui tests * fix trait order * Implement `FromStr` for `Ss58AddressFormat` (#7068) * Implement `FromStr` for `Ss58AddressFormat` * Update primitives/core/src/crypto.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Set reserved nodes with offchain worker. (#6996) * add offchain worker api to set reserved nodes. * new offchain api to get node public key. * node public key from converter * refactor set reserved nodes ocw api. * new ndoe authorization pallet * remove unnecessary clone and more. * more * tests for node authorization pallet * remove dependency * fix build * more tests. * refactor * Update primitives/core/src/offchain/testing.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update frame/node-authorization/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update frame/node-authorization/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update frame/node-authorization/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * format code * expose NetworkService * remove NetworkStateInfo in offchain * replace NodePublicKey with PeerId. * set max length of peer id. * clear more * use BTreeSet for set of peers. * decode opaque peer id. * extract NetworkProvider for client offchain. * use OpaquePeerId in node authorization pallet. * fix test * better documentation * fix test * doc * more fix * Update primitives/core/src/offchain/mod.rs Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com> * Update client/offchain/src/api.rs Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com> * derive serialize and deserialize Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com> * Fix some warnings Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> Co-authored-by: Sergei Shulepov <sergei@parity.io> Co-authored-by: Max Inden <mail@max-inden.de> Co-authored-by: s3krit <pugh@s3kr.it> Co-authored-by: Jimmy Chu <jimmy@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: kaichao <kaichaosuna@gmail.com> Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com> * Fix more doc errors * More doc fixes * Remove subdb to make `rustdoc` happy * Make the line length check happy * Fix compilation error * Another try * Allow unused Co-authored-by: Dan Forbes <dan@danforbes.dev> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> Co-authored-by: Sergei Shulepov <sergei@parity.io> Co-authored-by: Max Inden <mail@max-inden.de> Co-authored-by: s3krit <pugh@s3kr.it> Co-authored-by: Jimmy Chu <jimmy@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: kaichao <kaichaosuna@gmail.com> Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -44,8 +44,6 @@ mod utils;
|
||||
mod stats;
|
||||
#[cfg(feature = "with-parity-db")]
|
||||
mod parity_db;
|
||||
#[cfg(feature = "with-subdb")]
|
||||
mod subdb;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -287,12 +285,6 @@ pub enum DatabaseSettingsSrc {
|
||||
path: PathBuf,
|
||||
},
|
||||
|
||||
/// Load a Subdb database from a given path.
|
||||
SubDb {
|
||||
/// Path to the database.
|
||||
path: PathBuf,
|
||||
},
|
||||
|
||||
/// Use a custom already-open database.
|
||||
Custom(Arc<dyn Database<DbHash>>),
|
||||
}
|
||||
@@ -303,7 +295,6 @@ impl DatabaseSettingsSrc {
|
||||
match self {
|
||||
DatabaseSettingsSrc::RocksDb { path, .. } => Some(path.as_path()),
|
||||
DatabaseSettingsSrc::ParityDb { path, .. } => Some(path.as_path()),
|
||||
DatabaseSettingsSrc::SubDb { path, .. } => Some(path.as_path()),
|
||||
DatabaseSettingsSrc::Custom(_) => None,
|
||||
}
|
||||
}
|
||||
@@ -321,7 +312,6 @@ impl std::fmt::Display for DatabaseSettingsSrc {
|
||||
let name = match self {
|
||||
DatabaseSettingsSrc::RocksDb { .. } => "RocksDb",
|
||||
DatabaseSettingsSrc::ParityDb { .. } => "ParityDb",
|
||||
DatabaseSettingsSrc::SubDb { .. } => "SubDb",
|
||||
DatabaseSettingsSrc::Custom(_) => "Custom",
|
||||
};
|
||||
write!(f, "{}", name)
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
/// A `Database` adapter for subdb.
|
||||
|
||||
use sp_database::{self, ColumnId};
|
||||
use parking_lot::RwLock;
|
||||
use blake2_rfc::blake2b::blake2b;
|
||||
use codec::Encode;
|
||||
use subdb::{Database, KeyType};
|
||||
|
||||
/// A database hidden behind an RwLock, so that it implements Send + Sync.
|
||||
///
|
||||
/// Construct by creating a `Database` and then using `.into()`.
|
||||
pub struct DbAdapter<H: KeyType>(RwLock<Database<H>>);
|
||||
|
||||
/// Wrap RocksDb database into a trait object that implements `sp_database::Database`
|
||||
pub fn open<H: KeyType + 'static>(
|
||||
path: &std::path::Path,
|
||||
_num_columns: u32,
|
||||
) -> Result<std::sync::Arc<dyn sp_database::Database<H>>, subdb::Error> {
|
||||
let db = subdb::Options::from_path(path.into()).open()?;
|
||||
Ok(std::sync::Arc::new(DbAdapter(RwLock::new(db))))
|
||||
}
|
||||
|
||||
impl<H: KeyType> sp_database::Database<H> for DbAdapter<H> {
|
||||
fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>> {
|
||||
let mut hash = H::default();
|
||||
(col, key).using_encoded(|d|
|
||||
hash.as_mut().copy_from_slice(blake2b(32, &[], d).as_bytes())
|
||||
);
|
||||
self.0.read().get(&hash)
|
||||
}
|
||||
|
||||
fn with_get(&self, col: ColumnId, key: &[u8], f: &mut dyn FnMut(&[u8])) {
|
||||
let mut hash = H::default();
|
||||
(col, key).using_encoded(|d|
|
||||
hash.as_mut().copy_from_slice(blake2b(32, &[], d).as_bytes())
|
||||
);
|
||||
let _ = self.0.read().get_ref(&hash).map(|d| f(d.as_ref()));
|
||||
}
|
||||
|
||||
fn set(&self, col: ColumnId, key: &[u8], value: &[u8]) {
|
||||
let mut hash = H::default();
|
||||
(col, key).using_encoded(|d|
|
||||
hash.as_mut().copy_from_slice(blake2b(32, &[], d).as_bytes())
|
||||
);
|
||||
self.0.write().insert(&value, &hash);
|
||||
}
|
||||
|
||||
fn remove(&self, col: ColumnId, key: &[u8]) {
|
||||
let mut hash = H::default();
|
||||
(col, key).using_encoded(|d|
|
||||
hash.as_mut().copy_from_slice(blake2b(32, &[], d).as_bytes())
|
||||
);
|
||||
let _ = self.0.write().remove(&hash);
|
||||
}
|
||||
|
||||
fn lookup(&self, hash: &H) -> Option<Vec<u8>> {
|
||||
self.0.read().get(hash)
|
||||
}
|
||||
|
||||
fn with_lookup(&self, hash: &H, f: &mut dyn FnMut(&[u8])) {
|
||||
let _ = self.0.read().get_ref(hash).map(|d| f(d.as_ref()));
|
||||
}
|
||||
|
||||
fn store(&self, hash: &H, preimage: &[u8]) {
|
||||
self.0.write().insert(preimage, hash);
|
||||
}
|
||||
|
||||
fn release(&self, hash: &H) {
|
||||
let _ = self.0.write().remove(hash);
|
||||
}
|
||||
}
|
||||
@@ -212,11 +212,12 @@ pub fn open_database<Block: BlockT>(
|
||||
config: &DatabaseSettings,
|
||||
db_type: DatabaseType,
|
||||
) -> sp_blockchain::Result<Arc<dyn Database<DbHash>>> {
|
||||
let db_open_error = |feat| Err(
|
||||
#[allow(unused)]
|
||||
fn db_open_error(feat: &'static str) -> sp_blockchain::Error {
|
||||
sp_blockchain::Error::Backend(
|
||||
format!("`{}` feature not enabled, database can not be opened", feat),
|
||||
),
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
let db: Arc<dyn Database<DbHash>> = match &config.source {
|
||||
#[cfg(any(feature = "with-kvdb-rocksdb", test))]
|
||||
@@ -257,16 +258,7 @@ pub fn open_database<Block: BlockT>(
|
||||
},
|
||||
#[cfg(not(any(feature = "with-kvdb-rocksdb", test)))]
|
||||
DatabaseSettingsSrc::RocksDb { .. } => {
|
||||
return db_open_error("with-kvdb-rocksdb");
|
||||
},
|
||||
#[cfg(feature = "with-subdb")]
|
||||
DatabaseSettingsSrc::SubDb { path } => {
|
||||
crate::subdb::open(&path, NUM_COLUMNS)
|
||||
.map_err(|e| sp_blockchain::Error::Backend(format!("{:?}", e)))?
|
||||
},
|
||||
#[cfg(not(feature = "with-subdb"))]
|
||||
DatabaseSettingsSrc::SubDb { .. } => {
|
||||
return db_open_error("with-subdb");
|
||||
return Err(db_open_error("with-kvdb-rocksdb"));
|
||||
},
|
||||
#[cfg(feature = "with-parity-db")]
|
||||
DatabaseSettingsSrc::ParityDb { path } => {
|
||||
@@ -275,7 +267,7 @@ pub fn open_database<Block: BlockT>(
|
||||
},
|
||||
#[cfg(not(feature = "with-parity-db"))]
|
||||
DatabaseSettingsSrc::ParityDb { .. } => {
|
||||
return db_open_error("with-parity-db");
|
||||
return Err(db_open_error("with-parity-db"))
|
||||
},
|
||||
DatabaseSettingsSrc::Custom(db) => db.clone(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user