Trait sov_modules_api::Spec
source · pub trait Spec {
type Address: AddressTrait + BorshSerialize + BorshDeserialize + Into<AddressBech32> + From<AddressBech32>;
type Storage: Storage + Clone;
type PublicKey: BorshDeserialize + BorshSerialize + Eq + Clone + Debug + PublicKey;
type Hasher: Hasher;
type Signature: BorshDeserialize + BorshSerialize + Eq + Clone + Debug + Signature<PublicKey = Self::PublicKey>;
type Witness: Witness;
}
Expand description
The Spec
trait configures certain key primitives to be used by a by a particular instance of a rollup.
Spec
is almost always implemented on a Context object; since all Modules are generic
over a Context, rollup developers can easily optimize their code for different environments
by simply swapping out the Context (and by extension, the Spec).
For example, a rollup running in a STARK-based zkvm like Risc0 might pick Sha256 or Poseidon as its preferred hasher,
while a rollup running in an elliptic-curve based SNARK such as Placeholder
from the =nil; foundation might
prefer a Pedersen hash. By using a generic Context and Spec, a rollup developer can trivially customize their
code for either (or both!) of these environments without touching their module implementations.
Required Associated Types§
sourcetype Address: AddressTrait + BorshSerialize + BorshDeserialize + Into<AddressBech32> + From<AddressBech32>
type Address: AddressTrait + BorshSerialize + BorshDeserialize + Into<AddressBech32> + From<AddressBech32>
The Address type used on the rollup. Typically calculated as the hash of a public key.
sourcetype Storage: Storage + Clone
type Storage: Storage + Clone
Authenticated state storage used by the rollup. Typically some variant of a merkle-patricia trie.
sourcetype PublicKey: BorshDeserialize + BorshSerialize + Eq + Clone + Debug + PublicKey
type PublicKey: BorshDeserialize + BorshSerialize + Eq + Clone + Debug + PublicKey
The public key used for digital signatures
sourcetype Signature: BorshDeserialize + BorshSerialize + Eq + Clone + Debug + Signature<PublicKey = Self::PublicKey>
type Signature: BorshDeserialize + BorshSerialize + Eq + Clone + Debug + Signature<PublicKey = Self::PublicKey>
The digital signature scheme used by the rollup