-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Various minor testnet demo script tweaks #366
Conversation
Looks like I need to install |
multinode-demo/client.sh
Outdated
@@ -9,7 +9,9 @@ LEADER=$1 | |||
COUNT=${2:-1} | |||
|
|||
set -x | |||
rsync -v -e ssh "$LEADER"/{leader.json,mint-demo.json} . | |||
if [[ "$LEADER" != "localhost" ]]; then | |||
rsync -v -e ssh "$LEADER"/{leader.json,mint-demo.json} . |
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.
turns out that using rsync locally works fine too... I've been doing:
mkdir client
cd client
../multinode-demo/client.sh .. 1
works fine
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.
Ah, nice. ./multinode-demo/client.sh . 1
works too (I wanted to run everything from the same directory), will update this
multinode-demo/leader.sh
Outdated
if [[ "$(uname)" = "Linux" ]]; then | ||
( | ||
set -x | ||
sudo sysctl -w net.core.rmem_max=26214400 |
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.
insufficient for WSL, which is also uname Linux, but doesn't have this sysctl... again, I just left it
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.
Really?! I'm not sure how I feel about that just yet, it's surprising though!
multinode-demo/leader.sh
Outdated
sudo sysctl -w net.core.rmem_max=26214400 | ||
if [[ "$(uname)" = "Linux" ]]; then | ||
( | ||
set -x |
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.
why would you limit set -x to this subshell?
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.
Less stdout I guess, but you're right. No point in limiting
src/bin/client-demo.rs
Outdated
@@ -395,6 +395,8 @@ fn converge( | |||
} | |||
|
|||
fn read_leader(path: String) -> ReplicatedData { | |||
let file = File::open(path).expect("file"); | |||
serde_json::from_reader(file).expect("parse") | |||
let file = File::open(path.clone()) |
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.
looks like someone's been reading their rust book... can we get there with a borrow instead?
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.
Yeah, let file = File::open(&path)
works too. I reached for that first ironically, but then I saw https://github.com/solana-labs/solana/blob/master/src/bin/fullnode.rs#L114 and cargo culted in the .clone()
.
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.
understanding borrow is my #1 rust Q right now
@@ -115,14 +115,19 @@ fn main() { | |||
if let Ok(data) = serde_json::from_reader(file) { | |||
repl_data = data; | |||
} else { | |||
warn!("failed to parse leader {}, generating new identity", 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.
I don't like thie behavior, would lobby for predictability. i.e. if the file isn't there or is unparse-able, don't try to mask and do the "right thing", it only confuses a user who's mis-typed instructions to find an identity.
this is especially true in a project that is so verbose about info logging, warnings get lost in the noise, users who are making mistakes on the command line don't realize it, hell: can't realize it...
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.
yep, it bugged me a little too but decided that was out of scope for my first babystep Rust PR. I filed #367 so we can follow up on this sometime
heh, I failed to format once, too. once. |
great branchname |
3c217d8
to
24d8a8d
Compare
Codecov Report
@@ Coverage Diff @@
## master #366 +/- ##
==========================================
+ Coverage 90.75% 90.81% +0.05%
==========================================
Files 36 36
Lines 3484 3484
==========================================
+ Hits 3162 3164 +2
+ Misses 322 320 -2
Continue to review full report at Codecov.
|
multinode-demo/validator.sh
Outdated
@@ -11,7 +11,9 @@ set -x | |||
|
|||
rsync -v -e ssh "$LEADER"/{mint-demo.json,leader.json,genesis.log} . || exit $? | |||
|
|||
sudo sysctl -w net.core.rmem_max=26214400 | |||
if [[ "$(uname)" = "Linux" ]]; then |
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.
since this doesn't fix anything for WSL, it's just more code, recommend removing before merge
also:
no need to surround $(uname) in quotes, you're inside the bash builtin [[, where you're safe from spaces
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.
It removes an unneeded sudo on macOS so it is still a net improvement. I'll remove the quotes, thanks for that tip
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.
consider
[[ test ]] && sudo ...
?
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.
✔️
💔 Unable to automerge due to CI failure |
hmm,
Retrying the build got it green on the second attempt. 🙈 |
* bump rollup-plugin-node-resolve from 4.2.3 to 5.0.0 * Fix NPM warnings * bump rollup-plugin-commonjs from 9.3.4 to 10.0.0
* bump rollup-plugin-node-resolve from 4.2.3 to 5.0.0 * Fix NPM warnings * bump rollup-plugin-commonjs from 9.3.4 to 10.0.0
* bump rollup-plugin-node-resolve from 4.2.3 to 5.0.0 * Fix NPM warnings * bump rollup-plugin-commonjs from 9.3.4 to 10.0.0
sudo
on Linux