Skip to content
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
60 changes: 37 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cln-rpc = "0.4"
cln-plugin = "0.4"
tonic = "0.11"

vls-core = "^0.14"
vls-persist = "^0.14"
vls-protocol-signer = "^0.14"
vls-protocol = "^0.14"
vls-core = "^1.0.0-rc.1"
vls-persist = "^1.0.0-rc.1"
vls-protocol-signer = "^1.0.0-rc.1"
vls-protocol = "^1.0.0-rc.1"
12 changes: 6 additions & 6 deletions libs/gl-client/src/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl State {
fn insert_channel(
&mut self,
key: &str,
channel_entry: vls_persist::model::ChannelEntry,
channel_entry: lightning_signer::persist::model::ChannelEntry,
) -> Result<(), Error> {
let key = format!("{CHANNEL_PREFIX}/{key}");
self.ensure_not_tombstone(&key)?;
Expand All @@ -232,7 +232,7 @@ impl State {
fn update_channel(
&mut self,
key: &str,
channel_entry: vls_persist::model::ChannelEntry,
channel_entry: lightning_signer::persist::model::ChannelEntry,
) -> Result<(), Error> {
trace!("Updating channel {key}");
let key = format!("{CHANNEL_PREFIX}/{key}");
Expand Down Expand Up @@ -273,7 +273,7 @@ impl State {
.values
.get(&key)
.ok_or_else(|| Error::Internal(format!("missing channel state for key {}", key)))?;
let entry: vls_persist::model::ChannelEntry =
let entry: lightning_signer::persist::model::ChannelEntry =
serde_json::from_value(value.value.clone()).unwrap();
Ok(entry.into())
}
Expand All @@ -299,7 +299,7 @@ impl State {
let key = k.split('/').last().unwrap();
let key = vls_persist::model::NodeChannelId(hex::decode(&key).unwrap());

let value: vls_persist::model::ChannelEntry =
let value: lightning_signer::persist::model::ChannelEntry =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChannelEntry didn't change beyond the namespace, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's my understanding, and I have tried to run against a couple of my nodes too. But since this is a crucial detail to get right, I will create a small loader that we can run over the entire population of nodes to ensure they all load as expected. Be right back :-)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following your question, I went through the entire population of GL nodes and found the following results:

Metric EU US Overall
Entries loaded OK 100.000% 99.998% 99.9997%
Entries failed to load 0.000% 0.0012% 0.0003%
ChannelEntry share of entries 1.02% 2.61% 1.38%
Entries with signatures 1.40% 11.28% 3.65%
Tombstoned entries 0.000% 0.0008% 0.0002%
Signatures verified (own nodes) 100% 100% 100%

Notice that the entries that ended up failing to load and the non-existent ChannelEntry's are all archived nodes, and predate this upgrade. As such I consider this experiment successful :-)

serde_json::from_value(v.value.clone()).unwrap();
(key.channel_id(), value.into())
})
Expand Down Expand Up @@ -757,7 +757,7 @@ impl Persist for MemoryPersister {
let id = vls_persist::model::NodeChannelId::new(node_id, &stub.id0);
let channel_value_satoshis = 0;
let enforcement_state = lightning_signer::policy::validator::EnforcementState::new(0);
let entry = vls_persist::model::ChannelEntry {
let entry = lightning_signer::persist::model::ChannelEntry {
channel_value_satoshis,
channel_setup: None,
id: None,
Expand All @@ -778,7 +778,7 @@ impl Persist for MemoryPersister {
let node_channel_id = vls_persist::model::NodeChannelId::new(node_id, &channel.id0);
let id = hex::encode(node_channel_id.0);
let channel_value_satoshis = channel.setup.channel_value_sat;
let entry = vls_persist::model::ChannelEntry {
let entry = lightning_signer::persist::model::ChannelEntry {
channel_value_satoshis,
channel_setup: Some(channel.setup.clone()),
id: channel.id.clone(),
Expand Down
6 changes: 3 additions & 3 deletions libs/gl-client/src/persist/splice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ impl State {
if !key.starts_with(&key_prefix) || self.is_tombstone(key) {
continue;
}
let channel: vls_persist::model::ChannelEntry =
let channel: lightning_signer::persist::model::ChannelEntry =
serde_json::from_value(entry.value.clone()).map_err(|e| {
anyhow!("failed to decode channel state value for key {key}: {e}")
})?;
Expand Down Expand Up @@ -986,10 +986,10 @@ mod tests {
}
}

fn channel_entry(txid: &str, vout: u32) -> vls_persist::model::ChannelEntry {
fn channel_entry(txid: &str, vout: u32) -> lightning_signer::persist::model::ChannelEntry {
let secret = SecretKey::from_slice(&[1; 32]).unwrap();
let pubkey = PublicKey::from_secret_key(&Secp256k1::signing_only(), &secret);
vls_persist::model::ChannelEntry {
lightning_signer::persist::model::ChannelEntry {
channel_value_satoshis: 1_000_000,
channel_setup: Some(ChannelSetup {
is_outbound: true,
Expand Down
2 changes: 1 addition & 1 deletion libs/gl-client/src/signer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ mod tests {
.await
.unwrap_err()
.to_string(),
*"protocol error: ShortRead"
*"protocol error: short read"
)
}

Expand Down
2 changes: 1 addition & 1 deletion libs/gl-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bitcoin = { version = "0.32", features = ["base64"] }
gl-client = { version = "0.7.0", path = "../gl-client" }
hex = "0.4"
log = "0.4"
lightning-invoice = "0.33"
lightning-invoice = "0.34"
once_cell = "1.21.3"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
6 changes: 1 addition & 5 deletions libs/gl-sdk/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,7 @@ fn try_parse_bolt11(input: &str) -> Option<Result<ParsedInput, Error>> {

let amount_msat = parsed.amount_milli_satoshis();
let expiry = parsed.expiry_time().as_secs();
let timestamp = parsed
.timestamp()
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_secs();
let timestamp = parsed.duration_since_epoch().as_secs();
Comment thread
cdecker marked this conversation as resolved.
Resolved

Some(Ok(ParsedInput::Bolt11 {
invoice: ParsedInvoice {
Expand Down
Loading