-
Notifications
You must be signed in to change notification settings - Fork 789
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
fork-aware-tx-pool: add heavy load tests based on zombienet #7257
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
"charlie".to_owned(), | ||
vec![ | ||
"--force-authoring".into(), | ||
("--pool-limit", "500000").into(), |
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.
dq: Would we want to configure this in the future?
One option would be to add a tiny builder
wrapper around this struct, then we could image some scenarios like:
let small_net: SmallNetworkYap = SmallNetworkYapBuilder::default()
.with_pool_limit(5k)
.with_pool_kbytes(204)
.build(relay_chain, para_chain);
let small_net_2: SmallNetworkYap = SmallNetworkYapBuilder::default()
.with_pool_limit(1k)
.with_pool_kbytes(1k)
.build(relay_chain, para_chain);
Could be a followup, feel free to ignore me :D
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.
Very good point. Down the line we should enable the arg list to be passed according to the substrate-cli. I'll rethink this part a bit. We should consider that there is already a default arg list, and maybe we can use them in a dedicated constructor that would include them, but also provide a constructor version with no args, for custom initialization.
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
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.
So far looks good.
I was thinking about CLI. Maybe we don't need it, after all? Instead, we could use following:
$ cargo test --test stand_alone -- --exact run_single_collator_network
which would just:
- spawn the network,
- print out the location of the executed binaries (this one is important to me, to be absolutely sure that I don't run test on old binaries),
- print out the location of logs file,
- ... or maybe just print zombienet summary - with ports, params, etc...
- wait forever
Then one could use any tooling to just send transcations to this network.
We could start with this and see how it goes. We could do next iteration from here, and not over-complicate it from the beginning. In that way we would use the same config for manual testing, and for pre-defined test suits.
One more idea to control parameters would be using environment variables (not needed in the first step). Provides flexibility, less convenient to use comparing to CLI args, but much easier to implement.
export TXPOOLTESTS_POOL_LIMIT=1000
$ cargo test --test stand_alone -- --exact run_single_collator_network
Still we can have all the integration tests in different test module, reusing the same network configurations as those spawned in stand_alone
mod, for example:
$ cargo test --test integration -- --exact single_collator_network__single_account_1M_txs
stand_alone
tests would be excluded from cargo test
command (as they never terminated on their own).
Any thoughts on this?
|
||
/// Wrapper over a substrate node managed by zombienet. | ||
#[derive(Debug)] | ||
pub struct Node { |
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.
This should be named NodeConfig
(or sth like this). From what I see it is used to provide params of single node.
} | ||
|
||
#[async_trait::async_trait] | ||
impl Network for Limits30Network { |
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.
Methods seem to be copied into other files. Maybe it does not need to be trait? Or those methods could be provided in the trait. For sure copies should be avoided in the final shape.
"-lsub-libp2p=debug".into(), | ||
"--pool-type=fork-aware".into(), | ||
"--state-pruning=1024".into(), | ||
"--rpc-max-subscriptions-per-connection=128000".into(), |
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.
This is also spreaded accross other networks. Maybe we should have common part that can be overwritten with particular settings?
impl Network for YapNetwork { | ||
fn ensure_bins_on_path(&self) -> bool { | ||
// We need polkadot, polkadot-parachain, polkadot-execute-worker, polkadot-prepare-worker, | ||
// (and ttxt? - maybe not for the network, but for the tests, definitely) |
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.
Would not say that ttxt would be needed here. Having purely-zombienet oriented abstractions sounds good. We could check ttxt in TxSpammer
abstraction (which in future could just use lib
for sending).
if !self.ensure_bins_on_path() { | ||
return Err(anyhow!("Error: required bins weren't found on $PATH: polkadot")); | ||
} | ||
network_config.spawn_native().await.map_err(|err| anyhow!(format!("{}", err))) |
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.
Here I have one request:
Would be good to have some way to print the zombienet network params (just like it is done today with toml files). I would also like to see full paths to the binaries.
Enabling logs will be needed in stand_alone
group of test (which just spawns networks and do no more, see my comment for details). For integrations
test this may not be needed.
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.
Printing the binaries path would be very helpful indeed. For cargo tests, we can reference the executable paths somewhere in the base dir of the network (if they aren't already mentioned there) - @pepoviola do you know?
But knowing the network basedir is another aspect with cargo test. We might be able to identify the basedir under tmp
if we name it accordingly to the test in question, and add a timestamp suffix in the end for uniqueness. It would not be entirely perfect, but I find it usable. WDYT?
|
||
// A zombienet network with two relaychain 'polkadot' validators and one parachain | ||
// validator based on yap-westend-live-2022 chain spec. | ||
pub struct Limits30Network { |
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.
One more thought:
We could have exactly the same struct for all the networks, and just have different values for different networks.
(This struct seems to be copied all over the files).
So maybe sth like this:
Network::new_limits_30_network()
Network::new_single_collator()
Network::new_old_pool_small()
...
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.
Exactly! I have some TODOs already in zombienet/mod.rs
after I realized this: https://github.com/iulianbarbu/polkadot-sdk/blob/21fda5fd98504cccfa9c0a087ddc466db8da2880/substrate/client/transaction-pool/tests/zombienet/mod.rs#L37C1-L43C68. I think they refer to the same thing.
|
||
#[async_trait::async_trait] | ||
impl Network for Limits30Network { | ||
fn ensure_bins_on_path(&self) -> bool { |
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.
Hi, sorry to chime in. This is already checked by zombienet-sdk internally (for each cmd to execute and the workers).
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.
Is zombienet-sdk capable of printing full executable paths? (I know, I am a bit paranoid on this 😅)
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.
@pepoviola can you point me to where we're doing these checks in zombienet-sdk?
Hi @iulianbarbu / @michalkucharczyk, I'm working on an small cli to spawn from |
My 3 cents: We actually want to spawn network programatically. So I am not sure that cli will be helpful here. But having some API in zombienet that would accept toml and spawn the network could be potentially helpful. Especially when it comes to customization - instead of playing with CLI args or enviroment variables as I proposed in my previous comment we could just edit toml file. On the other hand, it seems that using zn-sdk is not that difficult. @iulianbarbu what is your opinion? |
Responding to the last messages where @pepoviola chimed in:
+1 to this idea @michalkucharczyk . I personally prefer Rust and zn-sdk for the testsuite, while for manual runs, if we'd be able to import the tomls directly with zn-sdk, and have the option to also use them with a CLI, then we can have the best of both worlds. It would be just a preference for how we'd like to do the manual testing, because we can still run the testsuite locally, by changing things within the rust tests, but if we want just to run the network and then do other stuff against it, we'd have the CLI as well.
yup, thanks @pepoviola for confirming this offline. For reference: https://docs.rs/zombienet-sdk/latest/zombienet_sdk/struct.NetworkConfig.html#method.load_from_toml.
@pepoviola how different would be from the existing zombienet CLI and why do we need another one? |
Description
Builds up towards addressing #5497 by creating some zombienet-sdk code infra that can be used to spin regular networks, as described in the fork aware transaction pool testing setup added here #7100. It will be used for developing tests against such networks, and to also spawn them on demand locally through tooling that will be developed in follow ups.
Integration
Node/runtime developers can run tests based on the zombienet-sdk infra that spins frequently used networks which can be used for analyzing behavior of various node related components, like fork aware transaction pool.
Review Notes
fatxpool
: add heavy load testsuits #5497 .zn-spawner
), which would simplify the startup of networks that are used regularly for testing against fork-aware tx pool (at least), the logs management of such networks, and convenient integration with tools that observe certain behavior during tests, liketx-test-pool
: https://github.com/michalkucharczyk/tx-test-tool/. The end result would look as if some is using zombienet-cli in a specific way (with given DSLs), and parts of these DSL files are also customizable. More and more stuff might end up being customizable, which will make this no different from zombienet-sdk, but having this zn-sdk infra glue code would still be useful because it builds standard ways of writing ZN based tests, and verifying behaviours of the networks.