Config

Struct Config 

Source
pub struct Config {
    pub shard: NonZero<Shard>,
    pub keypair: PrivKey,
    pub rpc_url: Option<String>,
    pub storage: Option<StorageConfig>,
    pub proving: Option<Config>,
    pub admin_api: Option<SocketAddr>,
    pub signature_verification: Option<SignatureVerificationConfig>,
    pub app_config: Option<Value>,
}
Expand description

§Domain configuration

By default a domain.yaml file is loaded to configure a domain. The file has the following structure:

# Shard ID number of the shard this domain operates
shard: 123

# Path to a JSON-encoded, base58 string of an ed25519 private-key that is used
# as the domain operator's key.
#
# Path is relative to the domain configuration file.
keypair: ./path/to/key.json

# (optional) URL of the base layer RPC endpoint.
# If omitted/commented, a mock RPC is used.
# rpc_url: https://your-rpc.delta.network:8765

# (optional) Proving configuration
# If omitted, defaults to mock prover for testing
#
# Example 1: Mock prover (for testing/development)
proving:
  global_laws:
    type: mock

# Example 2: SP1 CPU prover (for local testing with real proofs)
# proving:
#   global_laws:
#     type: sp1
#     backend:
#       type: cpu
#     mode: compressed

# Example 3: SP1 Mock prover (for testing with SP1 mock prover)
# proving:
#   global_laws:
#     type: sp1
#     backend:
#       type: mock
#     mode: compressed

# Example 4: SP1 Succinct Network prover (for production)
# proving:
#   global_laws:
#     type: sp1
#     backend:
#       type: succinct
#       private_key: ${SP1_PRIVATE_KEY}
#       rpc_url: https://rpc.succinct.xyz
#       strategy: auction
#     mode: compressed

# Example 5: SP1 CUDA prover (for GPU-accelerated proving)
# proving:
#   global_laws:
#     type: sp1
#     backend:
#       type: cuda
#       backend_url: http://localhost:3000/twirp/
#     mode: plonk

# (optional) App-specific configuration
# app:
#   api_port: 8081
#   feature_flag: true

SDK users can include custom settings under the app key in the same file. Use Config::app_config to deserialize those settings into your own type.

§Dev Note

This is the in-memory, resolved equivalent of ConfigFile. In comparison with ConfigFile, all files/keys/paths are resolved and read into memory.

Fields§

§shard: NonZero<Shard>

the shard this domain operates

§keypair: PrivKey

Keypair that identifies the domain operator and with which it signs transactions

§rpc_url: Option<String>

URL of the base layer RPC to connect to. If none, a mock RPC is used.

§storage: Option<StorageConfig>

Storage configuration

§proving: Option<Config>

Proving configuration (global_laws, etc).

§admin_api: Option<SocketAddr>

Admin API listening address

§signature_verification: Option<SignatureVerificationConfig>

Signature verification config

§app_config: Option<Value>

Extra user configuration under the app key

Implementations§

Source§

impl Config

Source

pub fn with_defaults(shard: NonZero<Shard>, keypair: PrivKey) -> Self

Create a new config with default options

Source

pub fn load() -> Result<Self, Error>

Load Config from a file called domain in the current directory.

Environment variables prefixed with DOMAIN_ can override configuration in the file. The file can be in any allowed format and has to have the contents of ConfigFile.

Source

pub fn load_from(path: impl AsRef<Path>) -> Result<Self, Error>

Load Config from a configuration file at the given path.

Environment variables prefixed with DOMAIN_ can override configuration in the file. The file can be in any allowed format and has to have the contents of ConfigFile.

Source

pub fn app_config<T: DeserializeOwned>(&self) -> Result<T, Error>

Deserialize app domain config from the app section.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more