Sommelier Protocol Team Weekly Update #2
Welcome to the weekly Protocol team update on the Sommelier protocol upgrades! This is the second week of the Informal's audit and the team's delivery of upgrades to the Sommelier Gravity Bridge.
One of the issues informal systems presented after their audit on the gravity bridge is the improvement of the orchestrator’s asynchronous runtime. The orchestrator is a single binary that combines the Eth Signer, Oracle, and Relayer for ease of use by the Validator Operator.
The use of Tokio::time in place of Instant::now for time management
First, the Orchestrator asynchronous runtime execution time was reduced efficiently with the use of tokio::time::*. Previously, the Orchestrator asynchronous runtime used instant::now() to manage time like gRPC to Cosmos.
Instant is a Rust standard library that measures a monotonically nondecreasing clock. However, offloading these low-level details to Future on Tokio runtime increases performance. This is because Futures are optimized to be polled efficiently. Also using Instant::now() leads to non-exact timeouts and loop speed because the checks are always if the elapsed time is greater or lesser than a fixed Duration.
This means that switching from Instant::now() to tokio::time::* can increase general performance as well as task execution time in the Orchestrator runtime.
Multi-threaded support for the Orchestrator
Another improvement that informal’s audit suggests is multi-threaded support for the Orchestrator via the use Tokio runtime instead of actix_rt. The Orchestrator uses actix_rt, a Tokio-based single-threaded async runtime for the Actix ecosystem.
However, multi-threaded support in the Orchestrator will enable multi-threaded performance improvements. For instance, with multi-threaded support concurrent execution of two or more tasks for maximum utilization of CPU will be allowed.
Parallelization at Many Loops
The ability to enable parallelization at many loops is another benefit of multi-threaded programming. Loop-level parallelism involves the extraction of parallel tasks from loops. This helps to speed up the overall execution time of the program.
Parallelization of the Orchestrator will involve Sommelier’s protocol team using rayon and futures::stream. Both rayon and future::stream are data-parallelism libraries that make it easy to convert sequential computations into parallel. These libraries make it easy for sequential iterator to execute in parallel.
To learn more about Sommelier, please visit https://sommelier.finance/
To use Sommelier, try the Pairings App at https://app.sommelier.finance/
To participate in the community, please join the Telegram group https://t.me/getsomm.
To follow the project on Github, please star the project https://github.com/PeggyJV/sommelier.