fedimint / fedimint

Federated E-Cash Mint
https://fedimint.org/
MIT License
568 stars 219 forks source link

Dkg panic when trying to dkg with your own self #1428

Closed dpc closed 1 year ago

dpc commented 1 year ago

I start one fedimintd, configure federation of size 2, click submit, past the connection string I get as the connection string of the peer, push submit and fedimintd crashes:

thread 'tokio-runtime-worker' panicked at 'assertion failed: `(left == right)`
  left: `G1Projective { x: 0x113ff8542c7dc3e660b0d8b755b43af7b6a974e7b83b8d66b24c595ac24cd20ee1d59855915078acc88dbacbed139aac, y: 0x048a22a2246bbcbab66e4bb36750771a63c9a84069aff50faa026b2ee4cbf9a21a96cdcb064a2e71589d3040e5724ee3, z: 0x01a5b3aac38dad0e654f16a22c98ac9ab2ba8339b29149b4b0e9c5dec195dff3bc5ad01c7e777e26d5193ae73a164567 }`,
 right: `G1Projective { x: 0x0ef4ed41d368a6a2c3e3facf927f2cdd23ecc1e1b4c4c19350221895a90e1505614a97313f80a2353f1f570298fe9ab9, y: 0x0c01ce83bcfd0c58072132869d0a4a80e0f29f97a4bfc08dd7bf432546850ff99369f71579d58b09cbf3c10370ba4ee3, z: 0x1953d7c7a36caf6e2cd8ce5acd1ee806416c334dc78107b93390fc656361101825d359dce45285d8cd9eda62db02722d }`: bad commit from 1', /home/dpc/lab/fedimint.git/main/fedimint-api/src/config.rs:534:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Looking at the code we should probably remove all these asserts and replace them with ensure. Panics bad, Results good.

dpc commented 1 year ago

Another one (truncated hex string in the connection string)

thread 'tokio-runtime-worker' panicked at 'Could not add peer certificate: BadDer', fedimint-server/src/net/connect.rs:86:18
stack backtrace:                                                                                                                                                                                                                                             
   0: rust_begin_unwind                                                                                                                                                                                                                                      
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5                                                                                                                                                           
   1: core::panicking::panic_fmt                                                                                                                                                                                                                             
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14                                                                                                                                                          
   2: core::result::unwrap_failed                                                                                             
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/result.rs:1791:5                     
   3: core::result::Result<T,E>::expect                                                                                                                                                                                                                      
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/result.rs:1070:23                       
   4: fedimint_server::net::connect::TlsTcpConnector::new                                                                                                                                                                                                    
             at ./fedimint-server/src/net/connect.rs:84:13                                                                    
   5: {async_fn#0}<fedimint_server::multiplexed::ModuleMultiplexed<u16, fedimint_api::config::DkgPeerMsg>>                                                                                                                                                   
             at ./fedimint-server/src/config.rs:895:21                                                                                                                                                                                                       
   6: poll<fedimint_server::config::connect::{async_fn_env#0}<fedimint_server::multiplexed::ModuleMultiplexed<u16, fedimint_api::config::DkgPeerMsg>>>
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
   7: {async_fn#0}                                                                                                                                                                                                                                           
             at ./fedimintd/src/distributedgen.rs:83:5                                                                                                                                                                                                       
   8: poll<fedimintd::distributedgen::run_dkg::{async_fn_env#0}>                                                                                                                                                                                             
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
   9: {async_block#0}                                                                                                         
             at ./fedimintd/src/ui.rs:187:13                                                                                                                                                                                                                 
  10: poll<fedimintd::ui::post_guardians::{async_fn#0}::{closure#0}::{async_block_env#0}>                             
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19