Skip to content
Snippets Groups Projects
Commit 5fe9ecf1 authored by Éloïs's avatar Éloïs
Browse files

Merge branch 'bca-identities' into 'dev'

[feat] bca: add req Identities

See merge request !1368
parents 8cfc82d2 03f1f2dc
No related branches found
No related tags found
1 merge request!1368[feat] bca: add req Identities
Showing
with 32 additions and 34 deletions
...@@ -450,6 +450,7 @@ impl DbTx { ...@@ -450,6 +450,7 @@ impl DbTx {
} }
} }
#[allow(clippy::upper_case_acronyms)]
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct HeadWS2Pv1ConfStringified { struct HeadWS2Pv1ConfStringified {
......
...@@ -39,7 +39,7 @@ pub(crate) fn write_and_compress_bytes_in_file( ...@@ -39,7 +39,7 @@ pub(crate) fn write_and_compress_bytes_in_file(
) -> Result<(), std::io::Error> { ) -> Result<(), std::io::Error> {
let file = File::create(file_path)?; let file = File::create(file_path)?;
let mut e = ZlibEncoder::new(file, compression); let mut e = ZlibEncoder::new(file, compression);
e.write_all(&datas[..])?; e.write_all(datas)?;
e.finish()?; e.finish()?;
Ok(()) Ok(())
......
...@@ -39,8 +39,7 @@ fn gen_webstart_args(args: &DuniterWebstartArgs, duniter_ts_args: &mut Vec<Strin ...@@ -39,8 +39,7 @@ fn gen_webstart_args(args: &DuniterWebstartArgs, duniter_ts_args: &mut Vec<Strin
} }
pub(crate) fn gen_duniter_ts_args(args: &DuniterArgs, duniter_js_exe: String) -> Vec<String> { pub(crate) fn gen_duniter_ts_args(args: &DuniterArgs, duniter_js_exe: String) -> Vec<String> {
let mut duniter_ts_args = Vec::new(); let mut duniter_ts_args = vec![duniter_js_exe];
duniter_ts_args.push(duniter_js_exe);
if let Some(ref home) = args.home { if let Some(ref home) = args.home {
duniter_ts_args.push("--home".to_owned()); duniter_ts_args.push("--home".to_owned());
duniter_ts_args.push(home.to_str().expect("invalid home path").to_owned()); duniter_ts_args.push(home.to_str().expect("invalid home path").to_owned());
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#![allow(clippy::upper_case_acronyms)]
#![deny( #![deny(
clippy::unwrap_used, clippy::unwrap_used,
missing_debug_implementations, missing_debug_implementations,
......
...@@ -67,7 +67,7 @@ mod tests { ...@@ -67,7 +67,7 @@ mod tests {
fn write_bin_file(file_path: &Path, datas: &[u8]) -> Result<(), std::io::Error> { fn write_bin_file(file_path: &Path, datas: &[u8]) -> Result<(), std::io::Error> {
let mut file = std::fs::File::create(file_path)?; let mut file = std::fs::File::create(file_path)?;
file.write_all(&datas[..])?; file.write_all(datas)?;
Ok(()) Ok(())
} }
......
...@@ -26,5 +26,5 @@ use dubp::crypto::hashs::Hash; ...@@ -26,5 +26,5 @@ use dubp::crypto::hashs::Hash;
use duniter_dbs::{databases::bc_v2::BcV2DbReadable, kv_typed::prelude::*, HashKeyV2}; use duniter_dbs::{databases::bc_v2::BcV2DbReadable, kv_typed::prelude::*, HashKeyV2};
pub fn tx_exist<BcDb: BcV2DbReadable>(bc_db_ro: &BcDb, hash: Hash) -> KvResult<bool> { pub fn tx_exist<BcDb: BcV2DbReadable>(bc_db_ro: &BcDb, hash: Hash) -> KvResult<bool> {
Ok(bc_db_ro.txs_hashs().contains_key(&HashKeyV2(hash))?) bc_db_ro.txs_hashs().contains_key(&HashKeyV2(hash))
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#![allow(clippy::upper_case_acronyms)]
#![deny( #![deny(
clippy::unwrap_used, clippy::unwrap_used,
missing_copy_implementations, missing_copy_implementations,
......
...@@ -76,8 +76,8 @@ impl kv_typed::prelude::FromBytes for BlockDbV1 { ...@@ -76,8 +76,8 @@ impl kv_typed::prelude::FromBytes for BlockDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
...@@ -131,8 +131,7 @@ impl kv_typed::prelude::FromBytes for BlockDbV2 { ...@@ -131,8 +131,7 @@ impl kv_typed::prelude::FromBytes for BlockDbV2 {
type Err = CorruptedBytes; type Err = CorruptedBytes;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(&bytes) bincode::deserialize(&bytes).map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))
.map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))?)
} }
} }
...@@ -145,7 +144,7 @@ impl ToDumpString for BlockDbV2 { ...@@ -145,7 +144,7 @@ impl ToDumpString for BlockDbV2 {
#[cfg(feature = "explorer")] #[cfg(feature = "explorer")]
impl ExplorableValue for BlockDbV2 { impl ExplorableValue for BlockDbV2 {
fn from_explorer_str(source: &str) -> Result<Self, FromExplorerValueErr> { fn from_explorer_str(source: &str) -> Result<Self, FromExplorerValueErr> {
Ok(serde_json::from_str(source).map_err(|e| FromExplorerValueErr(e.into()))?) serde_json::from_str(source).map_err(|e| FromExplorerValueErr(e.into()))
} }
fn to_explorer_json(&self) -> KvResult<serde_json::Value> { fn to_explorer_json(&self) -> KvResult<serde_json::Value> {
serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into())) serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))
......
...@@ -63,8 +63,8 @@ impl kv_typed::prelude::FromBytes for BlockHeadDbV1 { ...@@ -63,8 +63,8 @@ impl kv_typed::prelude::FromBytes for BlockHeadDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -62,7 +62,7 @@ impl kv_typed::prelude::FromBytes for BlockMetaV2 { ...@@ -62,7 +62,7 @@ impl kv_typed::prelude::FromBytes for BlockMetaV2 {
type Err = bincode::Error; type Err = bincode::Error;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(bytes)?) bincode::deserialize(bytes)
} }
} }
...@@ -75,8 +75,8 @@ impl ToDumpString for BlockMetaV2 { ...@@ -75,8 +75,8 @@ impl ToDumpString for BlockMetaV2 {
#[cfg(feature = "explorer")] #[cfg(feature = "explorer")]
impl ExplorableValue for BlockMetaV2 { impl ExplorableValue for BlockMetaV2 {
fn from_explorer_str(json_str: &str) -> std::result::Result<Self, FromExplorerValueErr> { fn from_explorer_str(json_str: &str) -> std::result::Result<Self, FromExplorerValueErr> {
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| FromExplorerValueErr(format!("{}: '{}'", e, json_str).into()))?) .map_err(|e| FromExplorerValueErr(format!("{}: '{}'", e, json_str).into()))
} }
fn to_explorer_json(&self) -> KvResult<serde_json::Value> { fn to_explorer_json(&self) -> KvResult<serde_json::Value> {
serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into())) serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))
......
...@@ -31,8 +31,8 @@ impl kv_typed::prelude::FromBytes for BlockNumberArrayV1 { ...@@ -31,8 +31,8 @@ impl kv_typed::prelude::FromBytes for BlockNumberArrayV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
//println!("json_str='{}'", &json_str); //println!("json_str='{}'", &json_str);
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -34,8 +34,8 @@ impl kv_typed::prelude::FromBytes for CIndexDbV1 { ...@@ -34,8 +34,8 @@ impl kv_typed::prelude::FromBytes for CIndexDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
//println!("json_str='{}'", &json_str); //println!("json_str='{}'", &json_str);
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -103,8 +103,7 @@ impl kv_typed::prelude::FromBytes for DunpHeadDbV1 { ...@@ -103,8 +103,7 @@ impl kv_typed::prelude::FromBytes for DunpHeadDbV1 {
type Err = CorruptedBytes; type Err = CorruptedBytes;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(&bytes) bincode::deserialize(&bytes).map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))
.map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))?)
} }
} }
......
...@@ -31,7 +31,7 @@ impl kv_typed::prelude::FromBytes for IdtyDbV2 { ...@@ -31,7 +31,7 @@ impl kv_typed::prelude::FromBytes for IdtyDbV2 {
type Err = bincode::Error; type Err = bincode::Error;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(bytes)?) bincode::deserialize(bytes)
} }
} }
......
...@@ -31,8 +31,8 @@ impl kv_typed::prelude::FromBytes for IIndexDbV1 { ...@@ -31,8 +31,8 @@ impl kv_typed::prelude::FromBytes for IIndexDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
//println!("json_str='{}'", &json_str); //println!("json_str='{}'", &json_str);
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -33,8 +33,8 @@ impl kv_typed::prelude::FromBytes for KickDbV1 { ...@@ -33,8 +33,8 @@ impl kv_typed::prelude::FromBytes for KickDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -31,8 +31,8 @@ impl kv_typed::prelude::FromBytes for MIndexDbV1 { ...@@ -31,8 +31,8 @@ impl kv_typed::prelude::FromBytes for MIndexDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
//println!("json_str='{}'", &json_str); //println!("json_str='{}'", &json_str);
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -37,8 +37,7 @@ impl kv_typed::prelude::FromBytes for PeerCardDbV1 { ...@@ -37,8 +37,7 @@ impl kv_typed::prelude::FromBytes for PeerCardDbV1 {
type Err = CorruptedBytes; type Err = CorruptedBytes;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(&bytes) bincode::deserialize(&bytes).map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))
.map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))?)
} }
} }
......
...@@ -54,8 +54,8 @@ impl kv_typed::prelude::FromBytes for SIndexDBV1 { ...@@ -54,8 +54,8 @@ impl kv_typed::prelude::FromBytes for SIndexDBV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -30,8 +30,7 @@ impl kv_typed::prelude::FromBytes for PendingTxDbV2 { ...@@ -30,8 +30,7 @@ impl kv_typed::prelude::FromBytes for PendingTxDbV2 {
type Err = CorruptedBytes; type Err = CorruptedBytes;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(&bytes) bincode::deserialize(&bytes).map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))
.map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))?)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment