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: trueSDK 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: PrivKeyKeypair 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
impl Config
Sourcepub fn with_defaults(shard: NonZero<Shard>, keypair: PrivKey) -> Self
pub fn with_defaults(shard: NonZero<Shard>, keypair: PrivKey) -> Self
Create a new config with default options
Sourcepub fn load() -> Result<Self, Error>
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.
Sourcepub fn load_from(path: impl AsRef<Path>) -> Result<Self, Error>
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.
Sourcepub fn app_config<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn app_config<T: DeserializeOwned>(&self) -> Result<T, Error>
Deserialize app domain config from the app section.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request