Skip to content
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

Add a program to submit random transactions #907

Merged
merged 3 commits into from
Dec 26, 2023
Merged

Conversation

jbearer
Copy link
Member

@jbearer jbearer commented Dec 26, 2023

No description provided.

#[clap(short, long, default_value = "1")]
jobs: usize,

/// URL of the query service.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have the clap derive. What does that do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it a (required) positional argument

fn random_transaction(min_size: usize, max_size: usize) -> Transaction {
let mut rng = thread_rng();

let vm = rng.next_u64();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we want to narrow this down to a few VM IDs instead of sampling from the whole range which means we will probably never use the same VM ID twice.

}

fn random_transaction(min_size: usize, max_size: usize) -> Transaction {
let mut rng = thread_rng();
Copy link
Collaborator

@sveitser sveitser Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work with multithreading? It might be nice to allow passing in a seed to make the generated transactions deterministic, but we can also add that later.

edit: first question answered here: https://rust-random.github.io/book/guide-parallel.html

Copy link
Collaborator

@sveitser sveitser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jbearer jbearer merged commit e9127fc into main Dec 26, 2023
9 checks passed
@jbearer jbearer deleted the feat/random-transactions branch December 26, 2023 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants