-
Notifications
You must be signed in to change notification settings - Fork 21
Add tape.toml
for configs
#26
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
base: main
Are you sure you want to change the base?
Conversation
Cool , |
Also i feel we dont wanna use cli args because the reason for adding toml is to make things easier to configure wdyt @zfedoran |
add |
Welcome @4rjunc, I hope this is one of many PRs, I'd love to see more in the future. I'm curious, why are we removing the local cluster option? |
I removed the default local cluster option because |
Ah understood, I thought the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few things to update , can u also add a unit test to test the toml parsing works properly
cli/src/config.rs
Outdated
} | ||
|
||
/// validate values in tape.toml | ||
fn validate(&self) -> anyhow::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to check urls are right here, just check for valid url using grep or something
So there is a non-zero chance that we may point tapedrive at all three clusters at the same time, but only one would be considered primary (where tokens are earned). Does this remove the need for the config file? I guess not, but it might be worth thinking about what this file would look like with more than one source. @Nagaprasadvr what are your thoughts? |
For that we can just change the cluster url when we spawn the node in the config file , ig along with this we can have a field primary_cluster to mark which cluster is primary to use |
U mean simultaneously running tape node on multiple clusters ? |
Yeah, exactly this. The premise is that users can write wherever it is cheapest. Assuming they are okay with lower recovery guarantees. |
What is the difference will be in this case between a primary cluster ,(possibly mainnet ) and other clusters like devnet and testnet |
@Nagaprasadvr I have pushed code addressing your comments. lmk if this needs to be changed. If this looks good to go, I will start working on code to pass values from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good
Lots of good stuff in here. @4rjunc if you'd like, I'd love to give you access to the dev channel in discord |
thank you! @zfedoran i haven't joined the discord yet. i will join now. my username: |
6b1229a
to
496b5dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few things to fix
cli/src/main.rs
Outdated
|
||
let context = Context::try_build(&cli)?; | ||
let config = match TapeConfig::load_with_path(&cli.config_path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just do this
let config = TapeConfig::load(&cli.config)?;
Move this inside context so we can get everything from context
This is looking really awesome @4rjunc. One more thing I'd love to see in here is the miner name. The current approach uses the word "default", which is fine, but we might as well put it in the config. @Nagaprasadvr what are your thoughts? (related issue: #36) |
Yeah definitely ig i missed it but it's a good addition |
thank you! you mean to use a custom name instead of "default" in this line right ? |
Let's add miner_name to miner config and hardcode it to "default" |
Hey @4rjunc ig we have changes from previous commits did u rebase this ? |
Yes, exactly this |
> transaction > performance > identity > solana > storage > network > logging feat: add validate + default values for toml.config feat: log_level is enum fix: resolving comments > change the `max_memory_mb` 2gb -> 16 gb > add few comments on what to change fix: remove the `NetworkConfig` feat: add enum for commitment level > add a impl for `CommitmentLevel` fix: fix the keypair loading up from ~ path feat: removed the helper function for tilde, add function used in anchor feat: add abstract StorageConfig feat: add URL validation fix: rename performance -> mining_config > add max_poa_thread > add max_pow_thread feat: better error handling for config::load() - ConfigFileNotFound - InvalidUrl(String) - KeypairNotFound(String) - HomeDirectoryNotFound - FileReadError(std::io::Error) - ParseError(toml::de::Error) - DefaultConfigCreationFailed(String) feat: add `--config` option feat: add error handling for config load > create new config is not found in default path, `--config` is not used > if config file not found in given path -> error will be shown feat: add `--config` option feat: add error handling for config load > create new config is not found in default path, `--config` is not used > if config file not found in given path -> error will be shown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few nits
> rm keypair_path > update keypair_path() helper function
PR for #16
I have pushed code of simple implementation of using
tape.toml
. In the following code change of onlyrpc_url
is used fromtape.toml
config file. Couple of changes I madetoml
crate for handling toml filel
from cli argsrpc_url
fromtape.toml
wont be used. if not it will be used.tape.toml
it is passed through cli contexttape.toml
is created at home dirI tested the above change in
archive
command~/tape.toml
cargo run -p tapedrive-cli --manifest-path ~/Documents/solana/tape/cli/Cargo.toml archive
cargo run -p tapedrive-cli --manifest-path ~/Documents/solana/tape/cli/Cargo.toml archive -ul