mirror of
https://github.com/stakwork/sphinx-key.git
synced 2026-02-11 18:55:05 +01:00
sphinx-key: track sequence numbers, bump sphinx-rs
This commit is contained in:
22
Cargo.lock
generated
22
Cargo.lock
generated
@@ -1199,7 +1199,7 @@ checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
||||
[[package]]
|
||||
name = "lss-connector"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
@@ -1571,9 +1571,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rmp-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
"rmp",
|
||||
]
|
||||
|
||||
@@ -1777,7 +1778,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-auther"
|
||||
version = "0.1.12"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.2",
|
||||
@@ -1789,7 +1790,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-crypter"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chacha20poly1305",
|
||||
@@ -1800,7 +1801,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-glyph"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hex",
|
||||
@@ -1851,7 +1852,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-signer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs.git?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bip39",
|
||||
@@ -1862,6 +1863,7 @@ dependencies = [
|
||||
"rand",
|
||||
"serde",
|
||||
"sphinx-glyph",
|
||||
"thiserror",
|
||||
"vls-persist",
|
||||
"vls-protocol",
|
||||
"vls-protocol-signer",
|
||||
@@ -1982,18 +1984,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.43"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42"
|
||||
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.43"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
|
||||
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
20
broker/Cargo.lock
generated
20
broker/Cargo.lock
generated
@@ -1700,7 +1700,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "lss-connector"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"lightning-storage-server",
|
||||
@@ -2694,9 +2694,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rmp-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
"rmp",
|
||||
]
|
||||
|
||||
@@ -3307,7 +3308,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-auther"
|
||||
version = "0.1.12"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.2",
|
||||
@@ -3319,7 +3320,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-glyph"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hex",
|
||||
@@ -3365,7 +3366,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sphinx-signer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=4ab623467e98d381489bf032c3fcd42d1273a375#4ab623467e98d381489bf032c3fcd42d1273a375"
|
||||
source = "git+https://github.com/stakwork/sphinx-rs?rev=253b45a659b1b395e3ff4435f4b7a3e4036da521#253b45a659b1b395e3ff4435f4b7a3e4036da521"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bip39",
|
||||
@@ -3376,6 +3377,7 @@ dependencies = [
|
||||
"rand",
|
||||
"serde",
|
||||
"sphinx-glyph",
|
||||
"thiserror",
|
||||
"vls-persist",
|
||||
"vls-protocol",
|
||||
"vls-protocol-signer",
|
||||
@@ -3507,18 +3509,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.43"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42"
|
||||
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.43"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
|
||||
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -39,8 +39,8 @@ vls-proxy = { git = "https://gitlab.com/lightning-signer/validating-li
|
||||
# vls-protocol-client = { path = "../../vls/vls-protocol-client" }
|
||||
# vls-proxy = { path = "../../vls/vls-proxy" }
|
||||
|
||||
lss-connector = { git = "https://github.com/stakwork/sphinx-rs", rev = "4ab623467e98d381489bf032c3fcd42d1273a375" }
|
||||
sphinx-signer = { git = "https://github.com/stakwork/sphinx-rs", rev = "4ab623467e98d381489bf032c3fcd42d1273a375" }
|
||||
lss-connector = { git = "https://github.com/stakwork/sphinx-rs", rev = "253b45a659b1b395e3ff4435f4b7a3e4036da521" }
|
||||
sphinx-signer = { git = "https://github.com/stakwork/sphinx-rs", rev = "253b45a659b1b395e3ff4435f4b7a3e4036da521" }
|
||||
# lss-connector = { path = "../../sphinx-rs/lss-connector" }
|
||||
# sphinx-signer = { path = "../../sphinx-rs/signer" }
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ serde_json = { version = "1.0.81", default-features = false }
|
||||
serde_urlencoded = "0.7.1"
|
||||
url = "2"
|
||||
|
||||
lss-connector = { git = "https://github.com/stakwork/sphinx-rs.git", default-features = false, rev = "4ab623467e98d381489bf032c3fcd42d1273a375" }
|
||||
lss-connector = { git = "https://github.com/stakwork/sphinx-rs.git", default-features = false, rev = "253b45a659b1b395e3ff4435f4b7a3e4036da521" }
|
||||
# lss-connector = { path = "../../sphinx-rs/lss-connector", default-features = false }
|
||||
sphinx-crypter = { git = "https://github.com/stakwork/sphinx-rs.git", rev = "4ab623467e98d381489bf032c3fcd42d1273a375" }
|
||||
sphinx-crypter = { git = "https://github.com/stakwork/sphinx-rs.git", rev = "253b45a659b1b395e3ff4435f4b7a3e4036da521" }
|
||||
# sphinx-crypter = { path = "../../sphinx-rs/crypter" }
|
||||
sphinx-signer = { git = "https://github.com/stakwork/sphinx-rs.git", optional = true, rev = "4ab623467e98d381489bf032c3fcd42d1273a375" }
|
||||
sphinx-signer = { git = "https://github.com/stakwork/sphinx-rs.git", optional = true, rev = "253b45a659b1b395e3ff4435f4b7a3e4036da521" }
|
||||
# sphinx-signer = { path = "../../sphinx-rs/signer", optional = true }
|
||||
|
||||
anyhow.workspace = true
|
||||
|
||||
@@ -12,6 +12,7 @@ use sphinx_signer::approver::SphinxApprover;
|
||||
use sphinx_signer::lightning_signer::bitcoin::Network;
|
||||
use sphinx_signer::lightning_signer::persist::Persist;
|
||||
use sphinx_signer::persist::{BackupPersister, FsPersister, ThreadMemoPersister};
|
||||
use sphinx_signer::root::VlsHandlerError;
|
||||
use sphinx_signer::sphinx_glyph as glyph;
|
||||
use sphinx_signer::{self, Handler, RootHandler};
|
||||
use std::sync::mpsc;
|
||||
@@ -145,6 +146,7 @@ pub fn make_event_loop(
|
||||
// signing loop
|
||||
log::info!("=> starting the main signing loop...");
|
||||
let flash_db = ctrlr.persister();
|
||||
let mut expected_sequence = None;
|
||||
while let Ok(event) = rx.recv() {
|
||||
match event {
|
||||
Event::Connected => {
|
||||
@@ -170,9 +172,10 @@ pub fn make_event_loop(
|
||||
&root_handler,
|
||||
&lss_signer,
|
||||
msg_bytes,
|
||||
expected_sequence,
|
||||
do_log,
|
||||
) {
|
||||
Ok((vls_b, lss_b)) => {
|
||||
Ok((vls_b, lss_b, sequence)) => {
|
||||
if lss_b.len() == 0 {
|
||||
// no muts, respond directly back!
|
||||
mqtt_pub(&mut mqtt, client_id, topics::VLS_RES, &vls_b);
|
||||
@@ -182,12 +185,20 @@ pub fn make_event_loop(
|
||||
msgs = Some((vls_b, lss_b.clone()));
|
||||
mqtt_pub(&mut mqtt, client_id, topics::LSS_RES, &lss_b);
|
||||
}
|
||||
expected_sequence = Some(sequence + 1);
|
||||
}
|
||||
Err(e) => {
|
||||
let err_msg = GlyphError::new(1, &e.to_string());
|
||||
log::error!("HANDLE FAILED {:?}", e);
|
||||
mqtt_pub(&mut mqtt, client_id, topics::ERROR, &err_msg.to_vec()[..]);
|
||||
}
|
||||
Err(e) => match e {
|
||||
VlsHandlerError::BadSequence(current, expected) => unsafe {
|
||||
log::info!("caught a badsequence error, current: {}, expected: {}", current, expected);
|
||||
log::info!("restarting esp!");
|
||||
esp_idf_sys::esp_restart();
|
||||
},
|
||||
_ => {
|
||||
let err_msg = GlyphError::new(1, &e.to_string());
|
||||
log::error!("HANDLE FAILED {:?}", e);
|
||||
mqtt_pub(&mut mqtt, client_id, topics::ERROR, &err_msg.to_vec()[..]);
|
||||
}
|
||||
},
|
||||
};
|
||||
let state2 = approver.control().get_state();
|
||||
if state1 != state2 {
|
||||
|
||||
Reference in New Issue
Block a user