3 releases (breaking)

0.3.0 Oct 20, 2023
0.2.0 Sep 14, 2023
0.1.0 May 31, 2023

#24 in #nonce

MIT/Apache

220KB
4.5K SLoC

sov-accounts module

The sov-accounts module is responsible for managing accounts on the rollup.

Account is represented by an Address and a Nonce.

Warning

The accounts module implements TxHooks which must be wired into your state transition function! Be sure that your Runtime implementation for TxHooks delegates to the sov-accounts.

The sov-accounts module offers the following functionality:

  1. When a sender sends their first message, the sov-accounts module will create a new address by deriving it from the sender's public key. The module will then add a mapping between the public key and the address to its state. For all subsequent messages that include the sender's public key, the module will retrieve the sender's address from the mapping and pass it along with the original message to an intended module.

  2. It is possible to update the public key associated with a given address using the CallMessage::UpdatePublicKey(..) message. To do so, the sender must prove that they possess the private key that corresponds to the new public key.

  3. Each processed message increases the account nonce. This serves to protect against double-spending attacks and ensures proper transaction ordering.

  4. It is possible to query the sov-accounts module using the get_account method and get the account corresponding to the given public key.

The sov-accounts module makes the following guarantees:

  1. At some point in time, the sender has provided proof that they possessed the private key corresponding to the public key associated with the address.

  2. The account nonce is increased on every processed message by 1.

Dependencies

~7–22MB
~333K SLoC