-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(bolt-sidecar): add params in err message #660
chore(bolt-sidecar): add params in err message #660
Conversation
Hey @faheelsattar thanks for the contribution! I've taken a look at it and the return type of @estensen I think that the enum |
Map internal errors like |
@@ -185,24 +185,24 @@ impl InclusionRequest { | |||
preconfirmed_gas: u64, | |||
min_inclusion_profit: u64, | |||
max_base_fee: u128, | |||
) -> Result<bool, PricingError> { | |||
) -> Result<(bool, u128, u128), PricingError> { |
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.
Are you able to keep the signature like before? Result<bool, PricingError>
and embed the values in the error 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.
Let us know if you get stuck!
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.
updated
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.
Great work @faheelsattar , i suggested some changes that could help, feel free to let me know what you think.
Also, I think there is already a From impl PricingError
for ValidationError
?
|
||
let tip = tx.effective_tip_per_gas(max_base_fee).unwrap_or_default(); | ||
if tip < min_priority_fee as u128 { | ||
return Ok(false); | ||
return Ok((false, tip, min_priority_fee as u128)); |
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.
return Ok((false, tip, min_priority_fee as u128)); | |
return Ok(false); |
} | ||
// Increment the preconfirmed gas for the next transaction in the bundle | ||
local_preconfirmed_gas = local_preconfirmed_gas.saturating_add(tx.gas_limit()); | ||
} | ||
Ok(true) | ||
Ok((true, 0, 0)) |
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.
Ok((true, 0, 0)) | |
Ok(true) |
@@ -185,24 +185,24 @@ impl InclusionRequest { | |||
preconfirmed_gas: u64, | |||
min_inclusion_profit: u64, | |||
max_base_fee: u128, | |||
) -> Result<bool, PricingError> { | |||
) -> Result<(bool, u128, u128), PricingError> { |
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.
) -> Result<(bool, u128, u128), PricingError> { | |
) -> Result<bool, PricingError> { |
bolt-sidecar/src/state/execution.rs
Outdated
if !req.validate_min_priority_fee( | ||
// Ensure max_priority_fee_per_gas is greater than or equal to the calculated | ||
// min_priority_fee | ||
let (validated, tip, min_priority_fee) = req.validate_min_priority_fee( |
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.
if let Err(err) = req.validate_min_priority_fee(
bolt-sidecar/src/state/execution.rs
Outdated
)?; | ||
if !validated { | ||
return Err(ValidationError::MaxPriorityFeePerGasTooLow(tip, min_priority_fee)); |
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.
)?; | |
if !validated { | |
return Err(ValidationError::MaxPriorityFeePerGasTooLow(tip, min_priority_fee)); | |
) { | |
return Err(err.into()); |
hey guys thanks for leaving the comments. Will try to take care of it today |
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.
LGTM, thank you for your contribution!
next time would you mind rebasing instead of merging |
oops, yeah for sure will definitely keep in mind for next PR's |
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!
Closes #647