-
Notifications
You must be signed in to change notification settings - Fork 624
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
refactor: prepare and dump state inside params-estimator
#4706
Conversation
params-estimator
params-estimator
params-estimator
/// Number of additional accounts to add to the state, among which active accounts are selected. | ||
#[clap(long)] | ||
additional_accounts_num: Option<usize>, |
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 feels like this should have a deafult_value
-- we always want to populate genesis with some amount of additional accounts, no?
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.
The problem is that we want to execute it before launching docker, and after that, we need to drop this argument, because we shouldn't populate genesis state twice. Option
seems to be the simplest solution here.
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.
Good question. Let's just use 0
as "don't run genesis populaet", and add that arg to --docker
mode? If we need this elsewhere, we might add an extra flag for this.
I do think that we need a default here, so that run without args does the right thing.
Also added |
Cost table after this change:
|
@Longarithm it seems that action receipt creation has become much more expensive. What caused it to change? |
This is the case since work on new fees started #4455 (comment) ( |
It is more than 1.5 compared to the current cost right? We have |
The current cost taken from |
The only significant difference, got by modified script from here #4729:
Re-run estimation for only Full cost table before the change
|
I don't think it makes sense to investigate cost discrepancy here. We don't compare before/after this PR, we compare this PR with the current costs, which, eg, don't account for IO. As is, I think most of the difference will show up even when we compare master with this PR (#4474). My plan there is to refactor estimator first (so that we can easily run it, and understand deps between the cost), and then holistically look at the diff of the resulting costs. That being said, the output in the table includes actual costs -- they are not multiplied by the safety multiplier, and they are not split into sender/receiver fees. They should be compared with this file, and indeed there's 1.5x difference there. I'll add relative diff to the default output, but only after #4474, so that the diffs are not misleading! |
@@ -96,8 +96,7 @@ steps: | |||
./build.sh | |||
cd .. | |||
RUSTFLAGS='-D warnings' cargo run --release --package neard --bin neard -- --home /tmp/data init --test-seed=alice.near --account-id=test.near --fast | |||
RUSTFLAGS='-D warnings' cargo run --release --package genesis-populate --bin genesis-populate -- --additional-accounts-num=200000 --home /tmp/data | |||
RUSTFLAGS='-D warnings' cargo run --release --package runtime-params-estimator --bin runtime-params-estimator -- --home /tmp/data --accounts-num 20000 --iters 1 --warmup-iters 1 --metric time | |||
RUSTFLAGS='-D warnings' cargo run --release --package runtime-params-estimator --bin runtime-params-estimator -- --home /tmp/data --accounts-num 20000 --additional-accounts-num 200000 --iters 1 --warmup-iters 1 --metric time |
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.
🎉
@@ -30,6 +30,8 @@ near-vm-runner = {path = "../../runtime/near-vm-runner" } | |||
node-runtime = { path = "../../runtime/runtime" } | |||
near-store = { path = "../../core/store" } | |||
near-primitives = { path = "../../core/primitives" } | |||
near-test-contracts = { path = "../../runtime/near-test-contracts" } |
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.
Hm, I am surprised that estimator uses both near-test-contracts
and it's own test-contract. This is unrelated to the PR
@@ -32,15 +32,14 @@ Start container and build estimator with: | |||
host> ./run.sh | |||
docker> cd /host/nearcore | |||
docker> cargo run -j2 --release --package neard --bin neard -- --home /tmp/data init --test-seed=alice.near --account-id=test.near --fast | |||
docker> cargo run -j2 --release --package genesis-populate --bin genesis-populate -- --additional-accounts-num=200000 --home /tmp/data |
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.
Thanks for remebering to update the docs!
@@ -146,6 +170,7 @@ fn main_docker(state_dump_path: &Path) -> anyhow::Result<()> { | |||
|
|||
let mut buf = String::new(); | |||
buf.push_str("set -ex;\n"); | |||
buf.push_str("cd /host/nearcore;\n"); |
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.
👍
|
b59290c
to
3e3a7ac
Compare
Currently we prepare and dump state using the separate
genesis-populate
call:We can move this to the
params-estimator
, so we don't need to call a separate script, which simplifies the workflow.Now the
params-estimator
call should look as follows:Test Plan
cargo check
RuntimeConfig
is the same.