-
Notifications
You must be signed in to change notification settings - Fork 33
Nearup rewrite #81
Comments
If we write nearup in rust how are we going to distribute it. The current one-liner for nearup is really cool, but ofc if relies on users having python working out of the box.
|
Yes, I think we could do both crate + a cool script which does it or even we could add it to the distro specific package managers, add support for:
That would be nice as well. |
I don't suggest we maintain a apt and dnf repo, we need self update nearup, with apt/dnf this needs sudo. A binary + a nearup-init.sh sounds good, it's how rustup works (rustup-init.sh/rust-init.bat + rustup binary) |
I agree with a binary+shell script to distribute but I don't think rewrite in rust is necessary
|
Agree with @ailisp on maybe sticking to Python, as well. Happy to go with either solutions, happy to hear other peoples opinions, obviously there's cons and pros :) |
Even though I dream to have nearup, near-shell, and rainbow cli implemented in Rust, I want to make sure we weigh all the pros and cons of a rewrite.
Python is great for happy-path scripting, but handling corner cases (real world is scary) requires all-catching I believe that the maintainability [reliability over time after refactorings] of Rust code is much greater than Python. Also, once you get from PoC to a reliable CLI in Python, the amount of code is the same or even more than in Rust, I believe. Still, we already have the implementation in Python, so we should be careful about re-implementation. |
I agree on that as well, still we have to take into account that we cannot really reuse much of the current code, so personally I believe it would be easier to start from scratch either in python or rust. |
Unfortunately python is not java and it's hard to find all possible exceptions could raise from an lib function :( So in a robust python package, inclined to use only std functions or libraries that has well wrapped and documented type of exceptions.
Ignore handle some error exception is implicit means unwrap in rust :(
So this is possibly true, unless in practice some parts never fail. And write same amount of (well error handled) code in python is faster than write in rust, especially in this use case, rust static check can't help detect errors of integrating things, need edit-recompile-test quite a few times. |
After a brief discussion with @ilblackdragon, we identified that before shooting for any major refactoring on nearup side, we should make sure that neard (nearcore) CLI is good enough to be running without nearup in the first place. After that, we can draw the requirements for nearup and decide on the language and packaging strategy. |
So, can you provide more context on what would be needed to be done in the nearcore CLI side? cc: @ilblackdragon @frol |
Currently the nearup is written in Python without any external packages, so a lot of the logic is cumbersome and implemented in a sub-optimal way. Nearup is in the critical path for our network and a lot of validators are depending on it.
In the current state this is a liability and we should put effort into making it production ready and reliable.
Main proposal was rewriting the whole nearup application in Rust making it strongly typed and compiled, so we can catch issues faster at compile time. As well rust provides all the necessary crates needed to make this happen:
The other option was to use GoLang, but that would introduce another language and ecosystem which is unnecessary, as it can be all done in rust.
The general idea is to rewrite nearup and replace our current deployments of devnet, betanet and testnet with nearup everywhere. This would deprecate a lot of the complicated deployment setup we have and we could just deploy either prebaked nearup images (docker/packer).
Nearup would provide the ability to be configured in a way:
As we plan to support flag to force next protocol version in neard this should be also supported in the nearup configuration.
neard --protocol_version=6` or `neard --next_protocol
cc: @bowenwang1996 @ailisp @damons @frol
The text was updated successfully, but these errors were encountered: