-
Notifications
You must be signed in to change notification settings - Fork 18
feat: hermes config generator #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dzmitry-lahoda
merged 12 commits into
informalsystems:main
from
dzmitry-lahoda-forks:dz/36
Mar 19, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
24c9c00
fixing gaia
dzmitry-lahoda 0c676b1
fixing toml generator
dzmitry-lahoda 564c14e
Merge branch 'main' into dz/36
dzmitry-lahoda 9b6e23c
fixing mac
dzmitry-lahoda afaf135
fixed mac again
dzmitry-lahoda 706a634
no config builder for cosmos-sdk now
dzmitry-lahoda ce23c10
Merge branch 'main' into dz/36
dzmitry-lahoda 1f10b0b
fixed part of review comments
dzmitry-lahoda 0c08e2f
fixed non toml part
dzmitry-lahoda 81531ec
fixed test build
dzmitry-lahoda 6395a43
fixed config comment
dzmitry-lahoda ec7e43b
updated doc comments
dzmitry-lahoda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
inputs, | ||
hermes, | ||
... | ||
}: let | ||
std = inputs.nix-std; | ||
in { | ||
flake.nixosModules = { | ||
hermes = import ../../nixosModules/hermes/default.nix {inherit nix-std hermes;}; | ||
}; | ||
dzmitry-lahoda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
lib, | ||
nix-std, | ||
cfg, | ||
}: | ||
with lib; { | ||
options = { | ||
config = import ./config-options.nix {inherit lib;}; | ||
toml = mkOption {type = types.unique {message = "only one toml output";} types.str;}; | ||
}; | ||
config = { | ||
toml = let | ||
# remove `null` from toml render | ||
sanitizedCfg = filterAttrsRecursive (_: v: v != null) cfg.config; | ||
dzmitry-lahoda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in | ||
nix-std.lib.serde.toTOML sanitizedCfg; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,256 @@ | ||
# will be used to generate `[[chains]]` part of [config.toml](https://hermes.informal.systems/documentation/configuration/description.html) | ||
{lib}: | ||
dzmitry-lahoda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with lib; { | ||
# Required | ||
id = mkOption { | ||
type = types.str; | ||
description = '' | ||
Specify the chain ID. | ||
''; | ||
}; | ||
rpc_addr = mkOption { | ||
type = types.str; | ||
description = '' | ||
Specify the RPC address and port where the chain RPC server listens on. | ||
''; | ||
}; | ||
grpc_addr = mkOption { | ||
type = types.str; | ||
description = '' | ||
Specify the GRPC address and port where the chain GRPC server listens on. | ||
''; | ||
}; | ||
|
||
event_source = mkOption { | ||
type = types.submodule { | ||
options = { | ||
mode = mkOption { | ||
type = types.enum ["push" "pull"]; | ||
default = "push"; | ||
description = '' | ||
Specify the mode of the event source. | ||
''; | ||
}; | ||
url = mkOption { | ||
type = types.nullOr types.str; | ||
default = null; | ||
description = '' | ||
Specify the WebSocket address and port where the chain WebSocket server listens on. | ||
''; | ||
}; | ||
batch_delay = mkOption { | ||
type = types.nullOr types.str; | ||
default = null; | ||
description = '' | ||
Specify the delay between batches of events. | ||
''; | ||
}; | ||
interval = mkOption { | ||
type = types.nullOr types.str; | ||
default = null; | ||
|
||
description = '' | ||
Specify the interval between requests for new events. | ||
''; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
account_prefix = mkOption { | ||
type = types.str; | ||
description = '' | ||
Specify the prefix used by the chain. | ||
''; | ||
}; | ||
key_name = mkOption { | ||
type = types.str; | ||
description = '' | ||
Specify the name of the private key to use for signing transactions. Required | ||
<link xlink:href="httpsg://hermes.informal.systems/commands/keys/index.html#adding-keys"> | ||
See the Adding Keys chapter | ||
</link>. | ||
''; | ||
}; | ||
key_store_type = mkOption { | ||
type = types.enum ["Test" "Memory"]; | ||
default = "Test"; | ||
}; | ||
default_gas = mkOption { | ||
type = types.ints.positive; | ||
default = 100000000; | ||
}; | ||
gas_price = mkOption { | ||
type = types.submodule { | ||
options = { | ||
price = mkOption { | ||
type = types.float; | ||
description = '' | ||
Specify the price per gas used of the fee to submit a transaction. | ||
''; | ||
}; | ||
denom = mkOption { | ||
type = types.str; | ||
description = '' | ||
Specify the denomination of the fee to submit a transaction. | ||
''; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
address_type = mkOption { | ||
type = types.submodule { | ||
options = { | ||
derivation = mkOption { | ||
type = types.enum ["cosmos"]; | ||
default = "cosmos"; | ||
description = '' | ||
Specify the derivation type of the address. | ||
''; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
packet_filter = mkOption { | ||
default = { | ||
policy = "allow"; | ||
list = [["*" "*"]]; | ||
}; | ||
type = types.submodule { | ||
options = { | ||
policy = mkOption { | ||
type = types.enum ["allow" "deny"]; | ||
default = "allow"; | ||
description = '' | ||
Specify the policy of the packet filter. | ||
''; | ||
}; | ||
list = mkOption { | ||
type = types.listOf (types.listOf types.str); | ||
default = [["*" "*"]]; | ||
description = '' | ||
Specify the list of packet filters. | ||
''; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
# Optional | ||
rpc_timeout = mkOption { | ||
type = types.str; | ||
default = "10s"; | ||
description = '' | ||
Specify the maximum amount of time (duration) that the RPC requests should | ||
take before timing out. | ||
''; | ||
}; | ||
store_prefix = mkOption { | ||
type = types.str; | ||
default = "ibc"; | ||
description = '' | ||
Specify the store prefix used by the on-chain IBC modules. | ||
''; | ||
}; | ||
max_gas = mkOption { | ||
type = types.ints.positive; | ||
default = 3000000; | ||
description = '' | ||
Specify the maximum amount of gas to be used as the gas limit for a transaction. | ||
''; | ||
}; | ||
gas_multiplier = mkOption { | ||
type = types.float; | ||
default = 0.1; | ||
description = '' | ||
Specify by ratio to increase the gas estimate used to compute the fee, | ||
to account for potential estimation error. | ||
''; | ||
}; | ||
max_msg_num = mkOption { | ||
type = types.ints.positive; | ||
default = 30; | ||
description = '' | ||
Specify how many IBC messages at most to include in a single transaction. | ||
''; | ||
}; | ||
max_tx_size = mkOption { | ||
type = types.ints.positive; | ||
default = 2097152; | ||
description = '' | ||
Specify the maximum size, in bytes, of each transaction that Hermes will submit. | ||
''; | ||
}; | ||
max_block_time = mkOption { | ||
type = types.str; | ||
default = "30s"; | ||
description = '' | ||
Specify the maximum amount of time to wait for a new block to be committed. | ||
''; | ||
}; | ||
clock_drift = mkOption { | ||
type = types.str; | ||
default = "5s"; | ||
description = '' | ||
Specify the maximum amount of time to tolerate a clock drift. | ||
The clock drift parameter defines how much new (untrusted) header's time | ||
can drift into the future. | ||
''; | ||
}; | ||
trusting_period = mkOption { | ||
type = types.str; | ||
default = "14days"; | ||
description = '' | ||
Specify the amount of time to be used as the light client trusting period. | ||
It should be significantly less than the unbonding period | ||
(e.g. unbonding period = 3 weeks, trusting period = 2 weeks). | ||
''; | ||
}; | ||
trusted_node = mkOption { | ||
type = types.bool; | ||
default = false; | ||
}; | ||
ccv_consumer_chain = mkOption { | ||
type = types.bool; | ||
default = false; | ||
}; | ||
|
||
type = mkOption { | ||
type = types.enum ["CosmosSdk"]; | ||
default = "CosmosSdk"; | ||
description = '' | ||
Specify the type of the chain. | ||
''; | ||
}; | ||
|
||
trust_threshold = mkOption { | ||
default = { | ||
numerator = "1"; | ||
denominator = "3"; | ||
}; | ||
type = types.submodule { | ||
options = { | ||
numerator = mkOption { | ||
type = types.str; | ||
default = "1"; | ||
description = '' | ||
Specify the trust threshold for the light client, ie. the maximum fraction of validators | ||
which have changed between two blocks. | ||
Warning: This is an advanced feature! Modify with caution. | ||
''; | ||
}; | ||
denominator = mkOption { | ||
type = types.str; | ||
default = "3"; | ||
description = '' | ||
Specify the trust threshold for the light client, ie. the maximum fraction of validators | ||
which have changed between two blocks. | ||
Warning: This is an advanced feature! Modify with caution. | ||
''; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.