Skip to content

Commit

Permalink
[fastx authority docs] Added docs to the fields in authority state (#299
Browse files Browse the repository at this point in the history
)

* Added docs to the fields in authority state

Co-authored-by: George Danezis <george@danez.is>
  • Loading branch information
gdanezis and George Danezis authored Jan 29, 2022
1 parent 3ee46b8 commit 8d5c75e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions fastpay_core/src/authority/authority_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,48 @@ use typed_store::rocks::{open_cf, DBMap};
use typed_store::traits::Map;

pub struct AuthorityStore {
/// This is a map between the object ID and the latest state of the object, namely the
/// state that is needed to process new orders. If an object is deleted its entry is
/// removed from this map.
objects: DBMap<ObjectID, Object>,

/// This is a map between object references of currently active objects that can be mutated,
/// and the order that they are lock on for use by this specific authority. Where an object
/// lock exists for an object version, but no order has been seen using it the lock is set
/// to None. The safety of consistent broadcast depend on each honest authority never changing
/// the lock once it is set. After a certificate for this object is processed it can be
/// forgotten.
order_lock: DBMap<ObjectRef, Option<TransactionDigest>>,

/// This is a an index of object references to currently existing objects, indexed by the
/// composite key of the FastPayAddress of their owner and the object ID of the object.
/// This composite index allows an efficient iterator to list all objected currently owned
/// by a specific user, and their object reference.
owner_index: DBMap<(FastPayAddress, ObjectID), ObjectRef>,

/// This is map between the transaction digest and signed orders found in the `order_lock`.
/// NOTE: after a lock is deleted the corresponding entry here could be deleted, but right
/// now this is not done. If a certificate is processed (see `certificates`) the signed
/// order can also be deleted from this structure.
signed_orders: DBMap<TransactionDigest, SignedOrder>,

/// This is a map between the tranbsaction digest and the corresponding certificate for all
/// certificates that have been successfully processed by this authority. This set of certificates
/// along with the genesis allows the reconstruction of all other state, and a full sync to this
/// authority.
certificates: DBMap<TransactionDigest, CertifiedOrder>,

/// The map between the object ref of objects processed at all versions and the transaction
/// digest of the certificate that lead to the creation of this version of the object.
parent_sync: DBMap<ObjectRef, TransactionDigest>,

/// A map between the transaction digest of a certificate that was successfully processed
/// (ie in `certificates`) and the effects its execution has on the authority state. This
/// structure is used to ensure we do not double process a certificate, and that we can return
/// the same response for any call after the first (ie. make certificate processing idempotent).
signed_effects: DBMap<TransactionDigest, SignedOrderEffects>,

/// Internal vector of locks to manage concurrent writes to the database
lock_table: Vec<parking_lot::Mutex<()>>,
}

Expand Down

1 comment on commit 8d5c75e

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bench results

�[0m�[0m�[1m�[32m Finished�[0m release [optimized + debuginfo] target(s) in 2.69s
�[0m�[0m�[1m�[32m Running�[0m target/release/bench
[2022-01-29T00:47:01Z INFO bench] Starting benchmark: OrdersAndCerts
[2022-01-29T00:47:01Z INFO bench] Preparing accounts.
[2022-01-29T00:47:01Z INFO bench] Open database on path: "/tmp/DB_4CD32B5B80EC768041A045FE4DA851FE933C49FA"
[2022-01-29T00:47:05Z INFO bench] Preparing transactions.
[2022-01-29T00:47:14Z INFO fastpay::network] Listening to TCP traffic on 127.0.0.1:9555
[2022-01-29T00:47:15Z INFO bench] Number of TCP connections: 2
[2022-01-29T00:47:15Z INFO bench] Set max_in_flight to 500
[2022-01-29T00:47:15Z INFO bench] Sending requests.
[2022-01-29T00:47:15Z INFO fastpay::network] Sending TCP requests to 127.0.0.1:9555
[2022-01-29T00:47:17Z INFO fastpay::network] 127.0.0.1:9555 has processed 5000 packets
[2022-01-29T00:47:18Z INFO fastpay::network] In flight 500 Remaining 35000
[2022-01-29T00:47:18Z INFO fastpay::network] 127.0.0.1:9555 has processed 10000 packets
[2022-01-29T00:47:19Z INFO fastpay::network] 127.0.0.1:9555 has processed 15000 packets
[2022-01-29T00:47:21Z INFO fastpay::network] In flight 500 Remaining 30000
[2022-01-29T00:47:21Z INFO fastpay::network] 127.0.0.1:9555 has processed 20000 packets
[2022-01-29T00:47:22Z INFO fastpay::network] 127.0.0.1:9555 has processed 25000 packets
[2022-01-29T00:47:23Z INFO fastpay::network] In flight 500 Remaining 25000
[2022-01-29T00:47:24Z INFO fastpay::network] In flight 500 Remaining 25000
[2022-01-29T00:47:24Z INFO fastpay::network] 127.0.0.1:9555 has processed 30000 packets
[2022-01-29T00:47:25Z INFO fastpay::network] 127.0.0.1:9555 has processed 35000 packets
[2022-01-29T00:47:26Z INFO fastpay::network] In flight 500 Remaining 20000
[2022-01-29T00:47:26Z INFO fastpay::network] 127.0.0.1:9555 has processed 40000 packets
[2022-01-29T00:47:28Z INFO fastpay::network] 127.0.0.1:9555 has processed 45000 packets
[2022-01-29T00:47:29Z INFO fastpay::network] In flight 500 Remaining 15000
[2022-01-29T00:47:29Z INFO fastpay::network] 127.0.0.1:9555 has processed 50000 packets
[2022-01-29T00:47:31Z INFO fastpay::network] 127.0.0.1:9555 has processed 55000 packets
[2022-01-29T00:47:32Z INFO fastpay::network] In flight 500 Remaining 10000
[2022-01-29T00:47:32Z INFO fastpay::network] 127.0.0.1:9555 has processed 60000 packets
[2022-01-29T00:47:33Z INFO fastpay::network] 127.0.0.1:9555 has processed 65000 packets
[2022-01-29T00:47:33Z INFO fastpay::network] In flight 500 Remaining 5000
[2022-01-29T00:47:33Z INFO fastpay::network] 127.0.0.1:9555 has processed 70000 packets
[2022-01-29T00:47:34Z INFO fastpay::network] 127.0.0.1:9555 has processed 75000 packets
[2022-01-29T00:47:35Z INFO fastpay::network] Done sending TCP requests to 127.0.0.1:9555
[2022-01-29T00:47:35Z INFO fastpay::network] 127.0.0.1:9555 has processed 80000 packets
[2022-01-29T00:47:35Z INFO bench] Received 80000 responses.
[2022-01-29T00:47:35Z WARN bench] Completed benchmark for OrdersAndCerts
Total time: 19853277us, items: 40000, tx/sec: 2014.780733679382

Please sign in to comment.