Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Common configuration

SignerConfig

The SignerConfig struct is the primary configuration object used to initialize a signer. It’s defined in the go_signer library and specifies how and where cryptographic signing operations are performed.

The configuration supports multiple signer types. To use it, set the desired signer type in the Method field. The remaining configuration parameters will vary depending on the selected method.

The main methods are:

Keystore (local)

Use this method to sign with a local keystore file.

NameTypeExampleDescription
MethodstringlocalMust be local
Pathstring/opt/private_key.kestorefull path to the keystore
PasswordstringxdP6G8gV9PYspassword to unlock the keystore

Example:

[AggSender]
AggsenderPrivateKey = { Method="local", Path="/opt/private_key.kestore", Password="xdP6G8gV9PYs" }

Google Cloud KMS (GCP)

Use this method to sign using the Google Cloud KMS infrastructure.

NameTypeExampleDescription
MethodstringGCPMust be GCP
KeyNamestringprojects/your-prj-name/locations/your_location/keyRings/name_of_your_keyring/cryptoKeys/key-name/cryptoKeyVersions/versionid of the key in Google Cloud

Example:

[AggSender]
AggsenderPrivateKey = { Method="GCP", KeyName="projects/your-prj-name/locations/your_location/keyRings/name_of_your_keyring/cryptoKeys/key-name/cryptoKeyVersions/version"}

Amazon Web Services KMS (AWS)

Use this method to sign using the AWS KMS infrastructure. The key type must be ECC_SECG_P256K1 to ensure compatibility.

NameTypeExampleDescription
MethodstringAWSMust be AWS
KeyNamestringa47c263b-6575-4835-8721-af0bbb97XXXXid of the key in AWS

Example:

[AggSender]
AggsenderPrivateKey = { Method="AWS", KeyName="a47c263b-6575-4835-8721-af0bbb97XXXX"}

Others

Additional signing methods are available. For a complete list and detailed configuration options, please refer to the go_signer library documentation (v0.0.7)

ClientConfig

The ClientConfig structure configures the gRPC client connection. It includes the following fields:

Field NameTypeDescription
URLstringThe URL of the gRPC server
MinConnectTimeouttypes.DurationMinimum time to wait for a connection to be established
RequestTimeouttypes.DurationTimeout for individual requests
UseTLSboolWhether to use TLS for the gRPC connection
Retry*RetryConfigRetry configuration for failed requests

RetryConfig

The RetryConfig structure configures the retry behavior for failed gRPC requests:

Field NameTypeDescription
InitialBackofftypes.DurationInitial delay before retrying a request
MaxBackofftypes.DurationMaximum backoff duration for retries
BackoffMultiplierfloat64Multiplier for the backoff duration
MaxAttemptsintMaximum number of retries for a request
Excluded[]MethodList of methods excluded from retry policies

Example:

[AggSender]
    [AggSender.AgglayerClient]
		URL = "http://localhost:9000"
		MinConnectTimeout = "5s"
		RequestTimeout = "300s" 
		UseTLS = false
		[AggSender.AgglayerClient.Retry]
			InitialBackoff = "1s"
			MaxBackoff = "10s"
			BackoffMultiplier = 2.0
			MaxAttempts = 16

Method

The Method type represents a gRPC method configuration with the following fields:

Field NameTypeDescription
ServiceNamestringThe gRPC service name (including package)
MethodNamestringThe specific gRPC function name (optional)

This type is used to specify methods that should be excluded from retry policies. The ServiceName field is required and should include both the package and service name.

Example:

[AggSender]
    [AggSender.AgglayerClient]
        [AggSender.AgglayerClient.Retry]
            Excluded = [
                { Service = "agglayer.Agglayer", Method = "SubmitCertificate" },
                { Service = "agglayer.Agglayer", Method = "GetStatus" }
            ]

RateLimitConfig

The RateLimitConfig structure configures rate limiting behavior. If either NumRequests or Interval is set to 0, rate limiting is disabled.

Field NameTypeDescription
NumRequestsintMaximum number of requests allowed within the interval
Intervaltypes.DurationTime window for rate limiting

Example:

[AggSender]
    [AggSender.MaxSubmitCertificateRate]
        NumRequests = 20
        Interval = "1h"

When rate limiting is enabled, if the number of requests exceeds NumRequests within the specified Interval, the system will wait until the next interval before allowing more requests. This helps prevent overwhelming the system with too many requests in a short period.

RPCClientConfig

RPCClientConfig configures the JSON-RPC client used to connect to Ethereum nodes. It is used in multiple places, notably [L1NetworkConfig.RPC] (L1 node) and [Common.L2RPC] (L2 node).

FieldTypeDefaultDescription
URLstringβ€”JSON-RPC endpoint URL
Modestring""Client mode: "" or "basic" for standard nodes, "op" for Optimism nodes
HashFromJSONboolfalseWhen true, fetches block hashes via JSON-RPC (eth_getBlockByNumber). When false, computes them locally from the RLP-encoded header (go-ethereum default). Enable this for nodes where RLP hashing does not match the canonical block hash
BatchBlockHeaderRetrievalbooltrueWhen true, uses JSON-RPC batch requests to fetch block headers in bulk (faster). Disable if the node does not support batch calls
RetryModestring"backoff"Retry strategy: "backoff" for exponential backoff, "delays" for fixed delay list, "" for no retries
MaxRetriesint5Maximum number of retry attempts
InitialBackoffduration5sInitial wait time before the first retry (backoff mode)
MaxBackoffduration60sMaximum wait time between retries (backoff mode)
BackoffMultiplierfloat642.0Multiplier applied to the backoff duration on each retry
Delays[]duration[]Explicit list of wait times for each retry attempt (delays mode)

Example:

[L1NetworkConfig.RPC]
URL = "http://localhost:8545"
Mode = "basic"
HashFromJSON = false
BatchBlockHeaderRetrieval = true
RetryMode = "backoff"
MaxRetries = 5
InitialBackoff = "5s"
MaxBackoff = "60s"
BackoffMultiplier = 2.0

[Common.L2RPC]
URL = "http://localhost:8123"
Mode = "basic"
HashFromJSON = true
BatchBlockHeaderRetrieval = true
RetryMode = "delays"
MaxRetries = 6
Delays = ["1s", "2s", "5s", "10s", "30s", "60s"]