themis an efficient and memory safe bft framework in rust
play

Themis: An Efficient and Memory-Safe BFT Framework in Rust SERIAL - PowerPoint PPT Presentation

Institute of Operating Systems and Computer Networks Themis: An Efficient and Memory-Safe BFT Framework in Rust SERIAL Workshop, December 9, 2019 Signe Rsch, Kai Bleeke, Rdiger Kapitza ruesch@ibr.cs.tu-bs.de Technische Universitt


  1. Institute of Operating Systems and Computer Networks Themis: An Efficient and Memory-Safe BFT Framework in Rust SERIAL Workshop, December 9, 2019 Signe Rüsch, Kai Bleeke, Rüdiger Kapitza ruesch@ibr.cs.tu-bs.de Technische Universität Braunschweig, Germany

  2. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Byzantine Fault Tolerance Consensus even with participants showing arbitrarily wrong behaviour E.g. used in permissioned blockchains Tolerate f Byzantine faults with 3 f + 1 nodes 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 2 Institute of Operating Systems and Computer Networks

  3. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Byzantine Fault Tolerance Consensus even with participants showing arbitrarily wrong behaviour E.g. used in permissioned blockchains Tolerate f Byzantine faults with 3 f + 1 nodes BFT protocols have high message complexity Frameworks are highly optimised regarding processing time per message Both on protocol and network layer 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 2 Institute of Operating Systems and Computer Networks

  4. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Byzantine Fault Tolerance Consensus even with participants showing arbitrarily wrong behaviour E.g. used in permissioned blockchains Tolerate f Byzantine faults with 3 f + 1 nodes BFT protocols have high message complexity Frameworks are highly optimised regarding processing time per message Both on protocol and network layer BFT frameworks should be fast , efficient , and resilient ! 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 2 Institute of Operating Systems and Computer Networks

  5. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – C So far, frameworks mostly written in C or Java C: PBFT [Castro et al., OSDI’99] Java: Reptor [Behl et al., Middleware’15] 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 3 Institute of Operating Systems and Computer Networks

  6. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – C So far, frameworks mostly written in C or Java C: PBFT [Castro et al., OSDI’99] Java: Reptor [Behl et al., Middleware’15] Low-level programming languages like C offer high performance Direct access to memory Translation into native instructions 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 3 Institute of Operating Systems and Computer Networks

  7. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – C So far, frameworks mostly written in C or Java C: PBFT [Castro et al., OSDI’99] Java: Reptor [Behl et al., Middleware’15] Low-level programming languages like C offer high performance Direct access to memory Translation into native instructions But error-prone due to memory leaks and undefined behaviour, e.g.: Reading uninitialized memory Dereferencing a NULL pointer, an invalid pointer Out-of-bounds array access 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 3 Institute of Operating Systems and Computer Networks

  8. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – C So far, frameworks mostly written in C or Java C: PBFT [Castro et al., OSDI’99] Java: Reptor [Behl et al., Middleware’15] Low-level programming languages like C offer high performance Direct access to memory Translation into native instructions But error-prone due to memory leaks and undefined behaviour, e.g.: Reading uninitialized memory Dereferencing a NULL pointer, an invalid pointer Out-of-bounds array access Eliminate unsafe, unreliable code! 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 3 Institute of Operating Systems and Computer Networks

  9. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – Java Strong type system offers safety Runtime offers platform independence No manual memory management : Garbage Collector (GC) 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 4 Institute of Operating Systems and Computer Networks

  10. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – Java Strong type system offers safety Runtime offers platform independence No manual memory management : Garbage Collector (GC) Interpreting bytecode less performant JIT and GC add uncertainty to performance Not resource-efficient: JVM’s high memory consumption 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 4 Institute of Operating Systems and Computer Networks

  11. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Programming Languages – Java Strong type system offers safety Runtime offers platform independence No manual memory management : Garbage Collector (GC) Interpreting bytecode less performant JIT and GC add uncertainty to performance Not resource-efficient: JVM’s high memory consumption Tradeoff : performance vs. safety! How can we combine both ? 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 4 Institute of Operating Systems and Computer Networks

  12. Introduction Rust Themis : BFT in Rust Evaluation Conclusion The Rust Programming Language Combines performance and safety Young language: 1.0 release in 2015 Initiated by Mozilla Completely open source Performance : no runtime or garbage collector Reliability : strong type system Safety : memory safety enforced at compile time 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 5 Institute of Operating Systems and Computer Networks

  13. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Ownership: Safe Memory // heap allocate let x = Box::new(1000); Every value has an owner // move into y, Values are dropped when owner // x no longer accessible let y = x; goes out of scope println!("{}", x); Values are moved to a new owner //error[E0382]: // use of moved value: ` x ` 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 6 Institute of Operating Systems and Computer Networks

  14. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Borrowing and Lifetimes: Safe References Borrow value to get shared and mutable references let mut x = 1000; Either single mutable reference //mutable reference let c = & mut x; or multiple shared references let d = &x; References have lifetimes //error[E0502]: cannot borrow ` x ` // as immutable because it is No reference to invalid memory // also borrowed as mutable Enforced at compile time by the borrow checker 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 7 Institute of Operating Systems and Computer Networks

  15. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Borrowing and Lifetimes: Safe References Borrow value to get shared and mutable references let mut x = 1000; Either single mutable reference //mutable reference let c = & mut x; or multiple shared references let d = &x; References have lifetimes //error[E0502]: cannot borrow ` x ` // as immutable because it is No reference to invalid memory // also borrowed as mutable Enforced at compile time by the borrow checker Rust eliminates a whole class of errors that potentially lead to Byzantine behaviour! 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 7 Institute of Operating Systems and Computer Networks

  16. Application Module Protocol Module Client Communication Library Module Introduction Rust Themis : BFT in Rust Evaluation Conclusion T hemis Framework Requirements for efficient BFT frameworks: Concurrency Multiple small requests Asynchronous execution Event-driven, non-blocking I/O Often realized with Java NIO Rust: Async/Await , Futures , Tokio libraries Recently stabilized language features! 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 8 Institute of Operating Systems and Computer Networks

  17. Introduction Rust Themis : BFT in Rust Evaluation Conclusion T hemis Framework Requirements for efficient BFT frameworks: Application Module Concurrency Protocol Module Multiple small requests Client Asynchronous execution Communication Library Module Event-driven, non-blocking I/O Often realized with Java NIO Themis has three modules: Rust: Async/Await , Futures , Communication Tokio libraries Protocol Application Recently stabilized language features! 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 8 Institute of Operating Systems and Computer Networks

  18. Introduction Rust Themis : BFT in Rust Evaluation Conclusion Communication Module Handles connection management Spawn tasks: Listener for new connections Application Module Sender and receiver for each connection Protocol Module Communication between tasks with Client Communication asynchronous channels Library Module Messages are verified and batched before entering protocol stage 2019-12-09 Signe Rüsch Themis : An Efficient and Memory-Safe BFT Framework in Rust Page 9 Institute of Operating Systems and Computer Networks

Recommend


More recommend