-
Notifications
You must be signed in to change notification settings - Fork 547
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
cmd(chain/serve): support serving a multi-validator architecture #2473
Comments
Hi @ilgooz I expressed interest on this bounty issue on the discord (cc'd you there in a dedicated thread) a couple of days ago. Just wanted to checkin directly on this thread for visibility. |
Hey John @jsimnz! Happy to see you being interested on this one! This is such an essential and widely requested feature. Can't wait to see your solution! |
By the way, we should also update the config.yml reference. |
Will do! As for the config stuff, should I incorporate the changes from #2470 before the related PR is merged, or should I wait till the final review is ready. |
There is an overload of terms in the config struct and in the requirements for this PR. Originally there is a Should this be addressed in this issue/PR or left as is? |
Hey, I believe they should be independent for now because we need to make a refactoring in the config migration PR. I propose that we just update the Config struct in the multi-validator support PR in the way how it has to be for the feature. We can do the wiring later to benefit from config file migrations, it could be done later once we merge both PRs. |
hey @ilgooz. Work is progressing well, have most of the multi process stuff working for each validator, but there is a design constraint that I'm trying to work through. The issue description talks about the changes to the HOME directories, where each validator has their own home folder under the main home folder. IE: Unfortuently this creates a cricular link that I don't believe any OS supports. IE: At the moment I have the multi home system working without the root One design question here: The current implementation is working using the above design, but wanted to check in and see your thoughts. |
Yep, all sounds good! We don't need a symlink then and if you're directly using chain's binary to do things manually, you need to specifically define the home dir through the home flag. e.g: And |
Sorry not adding anything constructive here but just wanted to check if there is anything that I can use now to support multi-validator architecture? |
Hey, I think @jsimnz is working in this, I should defer to them for updates. John can you please let us know about the status of this feature? |
Happy to open up a PR in the coming days to get the feedback going 👍 |
@jsimnz pinging for visibility: The PR was closed because the |
👍 |
@jsimnz, any updates on it? |
Learn more about the bounty on Ignite's Discord.
Currently,
ignite chain serve
command will only initialize and start a single validator during development. The information about the chain and configuration about the validator is derived from chain's config file (AKAconfig.yml
).We would like to optionally support a multi-validator architecture to simulate a much more realistic scenario by allowing developers to test their blockchain in a multi-validator environment.
To support running multiple validators:
ignite/chainconfig
ignite/services/chain
ignite/cmd
1- the config file
Please check the current version for the underlying struct for the config file from here. We need to introduce some breaking changes to this struct.
The new format of the config file should be like this:
To summarize the changes in the config file:
1-
validator
field is deprecated and converted to an array withvalidators
name.2-
init
field is deprecated but fields inside theinit
field moved to validator info (items insidevalidators
).3- introducing
gentx
field to validator info to make it possible customizing gentxs.4-
host
field is deprecated with all its sub fields, now you need to usevalidators[].app
andvalidators[].config
to configure addresses.Note that, as we're deprecating the
host
top level field, we should examine the contents ofvalidators[].app
andvalidators[].config
to get the all listen addresses (e.g.: rpc, api, grpc, etc.) for each validator.When these addresses aren't set, we should automatically pick a port number (with an incremental order) for each validator.
Note that following should overwrite/merge (which is the current behavior already) their corresponding files/structs:
validators[].app
< renamedvalidators[].config
< renamedvalidators[].client
< renamedvalidators[].gentx
< newgenesis
< exists2- visit
chain serve
cmd andservice/chain
packageWe need to do some changes and refactoring in these two to support initializing and starting multiple validators. Please take a good look of their source code and package API design.
Home dir of the nodes:
We used to create a home dir for the chain by its name e.g.:
~/.mars
.Now, we need to create a separate home dir for each validator. Use the name of the chain as the root and use the account name associated with the validator to create a home dir for each validator. E.g.:
~/.mars/alice
,~/.mars/bob
.By default, chain's binary will use
~/.mars
as the home dir name. For this to still work, we should create symbolic link as~/.mars
and make it point to the first validator's (from thevalidators
array in the config file) home dir.Since we have multiple home dirs, make sure to import/replicate
accounts
(defined in config file) and other similar configuration to all validators (home dirs).Please note that
mars
name is being as a sample here and it represents the name of the underlying chain.--validator
flagCurrently
ignite chain serve
command andservices/chain
package is designed in a way to print logs of a single validator (logs that we collect from node's process). When you're using theignite chain serve
command with--verbose
flag it prints the logs from the validator running under the hood.Since we need to support multiple validators and spin up multiple nodes, we'll be having multiple log sources. It's not ideal to print logs for all the validators. We should only print logs from a single validator. To make it possible, add this new
--validator
flag tochain serve
to allow user to pick which validator's logs to see.Value of the
--validator
flag can be the account names that associated with validators (validators[].name
). E.g.:--validator alice
.If the provided value does not match with any validators,
serve
command should fail with an error explaining the situation.When this flag isn't set, we can default to the first validator appears in the
validators
array.serve
command also prints general information about a validator like which servers (e.g. rpc, api) are started and their addresses. Since there would be multiple validators and addresses, we should print these information for the underlying validator.handle failing nodes
If any of the node fails (process exits),
serve
command should also fail (exit 1) and show the logs from the first failing validator. We should also print the information (name) about which validator has failed.3- changes in the config file template
Keep in mind that when you use
ignite scaffold chain
, we scaffold a chain with a defaultconfig.yml
file. While we're introducing changes to the Config struct, we should also update theconfig.yml
template to match with the new format.To do that check the config.yml template.
Also, update the config file to serve two validators by default(alice and bob).
Let us know
Please review the design choices above and take them as suggestions and nothing as final. Let us know if it can be improved or you have other ideas.
The text was updated successfully, but these errors were encountered: