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

adds kind to RunTx, and SpamTx Plan #30

Merged
merged 14 commits into from
Oct 4, 2024

Conversation

jinmel
Copy link
Contributor

@jinmel jinmel commented Sep 26, 2024

No description provided.

@jinmel jinmel changed the title nit changes adds kind to RunTx, and SpamTx Plan Sep 30, 2024
Copy link
Member

@zeroXbrock zeroXbrock left a comment

Choose a reason for hiding this comment

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

looks good! Just had a few comments

Cargo.toml Outdated Show resolved Hide resolved
sqlite_db/src/lib.rs Outdated Show resolved Hide resolved
src/generator/mod.rs Outdated Show resolved Hide resolved
assert_eq!(spam[0].fuzz.as_ref().unwrap()[0].param, "amountIn");
assert_eq!(
Copy link
Member

Choose a reason for hiding this comment

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

this assertion (or something similar) should still be in here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified the config toml so that we are unit testing a small, easily understandable file. check the testConfig.toml I wrote.

Copy link
Member

Choose a reason for hiding this comment

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

yeah I just mean we should continue to test the fuzz params using that file. This test was just deleted but it doesn't have to be.

println!("contract address: {:?}", receipt.contract_address
.as_ref()
.map(|a| a.encode_hex())
.unwrap_or("".to_string()));
Copy link
Member

Choose a reason for hiding this comment

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

does unwrap_or_default work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

says default trait is not implemented

Copy link
Member

Choose a reason for hiding this comment

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

Default is implemented for String, might just be a syntax issue

src/spammer/tx_actor.rs Outdated Show resolved Hide resolved
Comment on lines 31 to +41
pub fn with_name(name: &str, tx: TransactionRequest) -> Self {
Self {
name: Some(name.to_string()),
kind: None,
tx,
}
}

pub fn set_kind(&mut self, kind: String) {
self.kind = Some(kind);
}
Copy link
Member

@zeroXbrock zeroXbrock Oct 3, 2024

Choose a reason for hiding this comment

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

I think this all should just be swapped out for a new constructor.

impl NamedTxRequest {
  pub fn new(tx: TransactionRequest, name: Option<&str>, kind: Option<&str>) -> Self {...}
}

This is more idiomatic, and we don't have any reason to iteratively build the struct in our code in the first place.

}

impl PendingRunTx {
pub fn new(tx_hash: TxHash, start_timestamp: usize) -> Self {
pub fn new(tx_hash: TxHash, start_timestamp: usize, kind: Option<String>) -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

I'd change this to kind: Option<&str> -- that way the user can call it with Some("kind")

@zeroXbrock zeroXbrock mentioned this pull request Oct 4, 2024
@zeroXbrock zeroXbrock merged commit 1e091e1 into flashbots:main Oct 4, 2024
2 checks passed
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