8000 chore: update several dependencies to latest by SupernaviX · Pull Request #19 · hyperledger/firefly-cardano · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: update several dependencies to latest #19

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

Merged
merged 2 commits into from
Feb 26, 2025
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
1,192 changes: 644 additions & 548 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion firefly-balius/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
repository = "https://github.com/blockfrost/firefly-cardano"

[dependencies]
balius-sdk = { git = "https://github.com/txpipe/balius.git", rev = "dd56cd0" }
balius-sdk = { git = "https://github.com/txpipe/balius.git", rev = "2a66c8c" }
hex = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
18 changes: 9 additions & 9 deletions firefly-cardanoconnect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ aide = { version = "0.14", features = ["axum", "axum-json", "axum-query"] }
anyhow = "1"
async-trait = "0.1"
axum = { version = "0.8", features = ["macros", "ws"] }
balius-runtime = { git = "https://github.com/txpipe/balius.git", rev = "dd56cd0" }
balius-runtime = { git = "https://github.com/txpipe/balius.git", rev = "2a66c8c" }
blockfrost = { git = "https://github.com/SupernaviX/blockfrost-rust.git", rev = "cfa7a5e", default-features = false, features = ["rustls-tls"] }
blockfrost-openapi = "0.1.69"
clap = { version = "4", features = ["derive"] }
chrono = "0.4"
dashmap = "6"
futures = "0.3"
pallas-addresses = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-codec = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-crypto = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-primitives = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-network = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-traverse = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-network = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
firefly-server = { path = "../firefly-server" }
hex = "0.4"
minicbor = "0.25"
minicbor = "0.26"
num-rational = "0.4"
num-traits = "0.2"
rand = "0.8"
Expand All @@ -39,4 +39,4 @@ tokio = { version = "1", features = ["full"] }
tokio-rusqlite = { version = "0.5" }
tracing = "0.1"
ulid = "1"
utxorpc-spec = "0.12"
utxorpc-spec = "0.15"
59 changes: 50 additions & 9 deletions firefly-cardanoconnect/src/blockchain/blockfrost/ledger.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::collections::{hash_map::Entry, HashMap};
use std::{
collections::{hash_map::Entry, HashMap},
str::FromStr,
};

use anyhow::Result;
use async_trait::async_trait;
Expand All @@ -9,6 +12,7 @@ use num_traits::FromPrimitive as _;
use pallas_traverse::MultiEraTx;
use utxorpc_spec::utxorpc::v1alpha::cardano::{
CostModel, CostModels, ExPrices, ExUnits, PParams, ProtocolVersion, RationalNumber,
VotingThresholds,
};

use crate::blockchain::BaliusLedger;
Expand Down Expand Up @@ -102,10 +106,7 @@ impl BaliusLedger for BlockfrostLedger {
.await
.map_err(|e| LedgerError::Upstream(e.to_string()))?;
Ok(PParams {
coins_per_utxo_byte: raw_params
.coins_per_utxo_size
.map(|v| v.parse().unwrap())
.unwrap_or_default(),
coins_per_utxo_byte: string_to_num(raw_params.coins_per_utxo_size),
max_tx_size: raw_params.max_tx_size as u64,
min_fee_coefficient: raw_params.min_fee_a as u64,
min_fee_constant: raw_params.min_fee_b as u64,
Expand All @@ -123,10 +124,7 @@ impl BaliusLedger for BlockfrostLedger {
major: raw_params.protocol_major_ver as u32,
minor: raw_params.protocol_minor_ver as u32,
}),
max_value_size: raw_params
.max_val_size
.map(|v| v.parse().unwrap())
.unwrap_or_default(),
max_value_size: string_to_num(raw_params.max_val_size),
collateral_percentage: raw_params
.collateral_percent
.map(|v| v as u64)
Expand Down Expand Up @@ -160,6 +158,34 @@ impl BaliusLedger for BlockfrostLedger {
raw_params.max_block_ex_steps,
raw_params.max_block_ex_mem,
),
min_fee_script_ref_cost_per_byte: raw_params
.min_fee_ref_script_cost_per_byte
.map(f64_to_rational),
pool_voting_thresholds: voting_thresholds([
raw_params.pvt_motion_no_confidence,
raw_params.pvt_committee_normal,
raw_params.pvt_committee_no_confidence,
raw_params.pvt_hard_fork_initiation,
raw_params.pvt_p_p_security_group,
]),
drep_voting_thresholds: voting_thresholds([
raw_params.dvt_motion_no_confidence,
raw_params.dvt_committee_normal,
raw_params.dvt_committee_no_confidence,
raw_params.dvt_update_to_constitution,
raw_params.dvt_hard_fork_initiation,
raw_params.dvt_p_p_network_group,
raw_params.dvt_p_p_economic_group,
raw_params.dvt_p_p_technical_group,
raw_params.dvt_p_p_gov_group,
raw_params.dvt_treasury_withdrawal,
]),
min_committee_size: string_to_num(raw_params.committee_min_size),
committee_term_limit: string_to_num(raw_params.committee_max_term_length),
governance_action_validity_period: string_to_num(raw_params.gov_action_lifetime),
governance_action_deposit: string_to_num(raw_params.gov_action_deposit),
drep_deposit: string_to_num(raw_params.drep_deposit),
drep_inactivity_period: string_to_num(raw_params.drep_activity),
})
}
}
Expand Down Expand Up @@ -198,6 +224,10 @@ impl<'a> TxDict<'a> {
}
}

fn string_to_num<T: FromStr + Default>(string: Option<String>) -> T {
string.and_then(|v| v.parse().ok()).unwrap_or_default()
}

fn f64_to_rational(value: f64) -> RationalNumber {
let ratio = Rational32::from_f64(value).unwrap();
RationalNumber {
Expand All @@ -212,3 +242,14 @@ fn ex_units(step: Option<String>, mem: Option<String>) -> Option<ExUnits> {
memory: mem?.parse().ok()?,
})
}

fn voting_thresholds(
thresholds: impl IntoIterator<Item = Option<f64>>,
) -> Option<VotingThresholds> {
Some(VotingThresholds {
thresholds: thresholds
.into_iter()
.map(|t| t.map(f64_to_rational))
.collect::<Option<Vec<_>>>()?,
})
}
50 changes: 49 additions & 1 deletion firefly-cardanoconnect/src/blockchain/n2c/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use pallas_network::{
};
use pallas_primitives::{alonzo, conway, Bytes, NonEmptyKeyValuePairs, PositiveCoin};
use utxorpc_spec::utxorpc::v1alpha::cardano::{
CostModel, CostModels, ExPrices, ExUnits, PParams, ProtocolVersion,
CostModel, CostModels, ExPrices, ExUnits, PParams, ProtocolVersion, VotingThresholds,
};

use crate::{blockchain::BaliusLedger, utils::LazyInit};
Expand Down Expand Up A8C6 @@ -199,6 +199,54 @@ impl BaliusLedger for NodeToClientLedger {
memory: ex.mem as u64,
});
}
if let Some(c) = param.min_fee_ref_script_cost_per_byte {
result.min_fee_script_ref_cost_per_byte = Some(map_rational(c));
}
if let Some(t) = param.pool_voting_thresholds {
result.pool_voting_thresholds = Some(VotingThresholds {
thresholds: vec![
map_rational(t.motion_no_confidence),
map_rational(t.committee_normal),
map_rational(t.committee_no_confidence),
map_rational(t.hard_fork_initiation),
map_rational(t.pp_security_group),
],
});
}
if let Some(t) = param.drep_voting_thresholds {
result.drep_voting_thresholds = Some(VotingThresholds {
thresholds: vec![
map_rational(t.motion_no_confidence),
map_rational(t.committee_normal),
map_rational(t.committee_no_confidence),
map_rational(t.update_to_constitution),
map_rational(t.hard_fork_initiation),
map_rational(t.pp_network_group),
map_rational(t.pp_economic_group),
map_rational(t.pp_technical_group),
map_rational(t.pp_gov_group),
map_rational(t.treasury_withdrawal),
],
});
}
if let Some(s) = param.committee_min_size {
result.min_committee_size = s as u32;
}
if let Some(l) = param.committee_max_term_length {
result.committee_term_limit = l;
}
if let Some(g) = param.gov_action_lifetime {
result.governance_action_validity_period = g;
}
if let Some(g) = param.gov_action_deposit {
result.governance_action_deposit = g.into();
}
if let Some(d) = param.drep_deposit {
result.drep_deposit = d.into();
}
if let Some(d) = param.drep_activity {
result.drep_inactivity_period = d;
}
}
Ok(result)
}
Expand Down
4 changes: 2 additions & 2 deletions firefly-cardanoconnect/src/contracts/u5c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ fn convert_native_script(script: conway::NativeScript) -> cardano::NativeScript
scripts: scripts.into_iter().map(convert_native_script).collect(),
})
}
conway::NativeScript::InvalidBefore(_) => todo!(),
conway::NativeScript::InvalidHereafter(_) => todo!(),
conway::NativeScript::InvalidBefore(t) => InnerNativeScript::InvalidBefore(t),
conway::NativeScript::InvalidHereafter(t) => InnerNativeScript::InvalidHereafter(t),
};
cardano::NativeScript {
native_script: Some(inner),
Expand Down
10 changes: 5 additions & 5 deletions firefly-cardanosigner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ bech32 = "0.11"
clap = { version = "4", features = ["derive"] }
firefly-server = { path = "../firefly-server" }
hex = "0.4"
minicbor = "0.25"
pallas-addresses = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-crypto = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-primitives = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-wallet = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
minicbor = "0.26"
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-wallet = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
rand = "0.8"
schemars = "0.8"
serde = "1"
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate-key/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ anyhow = "1"
bech32 = "0.11"
clap = { version = "4", features = ["derive"] }
hex = "0.4"
minicbor = "0.25"
pallas-crypto = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
pallas-primitives = { git = "https://github.com/SupernaviX/pallas.git", rev = "2e9b8b0" }
minicbor = "0.26"
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "2ddb5b066bbde9d2ed55014b286f47ad370b828e" }
rand = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Loading
Loading
0