iotaledger / stronghold.rs

Stronghold is a secret management engine written in rust.

Home Page:https://wiki.iota.org/stronghold.rs/getting_started

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function `load_client` ambiguous behaviour

vuongDang opened this issue · comments

Bug description

The function load_client from a Stronghold instance creates a new Client instance every time even if there is already another Client with the same path being used.
This can be an issue when using Stronghold with multiple threads. Multiple threads could get different clients with the same path which can result in unpredictable behavior when commiting these clients to the snapshot.

Rust version

Which version of Rust are you running?

  • Rust version: 1.63

Steps To reproduce the bug

Explain how the maintainer can reproduce the bug.

  1. Create 2 threads
  2. Call load_client from the two threads
  3. Modify these clients
  4. Commit the client of each thread
  5. Changes of one thread won't be kept in the Snapshot

Expected behaviour

Changes from both clients should be saved in the snapshot

Actual behaviour

Only the changes of one client is left in the snapshot