-
Notifications
You must be signed in to change notification settings - Fork 351
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: improve user fee bumps #1576
base: staging
Are you sure you want to change the base?
Conversation
Changes to gas cost
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
ClientMessage::BumpFee(bump_unit, amout, proof_qty) => { | ||
self.clone() | ||
.handle_bump_fee_msg(bump_unit, amout, proof_qty, ws_conn_sink) | ||
.await | ||
} |
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.
I think it would make sense for the unit conversion to happen in the SDK so the batcher can handle just wei. This makes for faster feedback on invalid units (the SDK doesn't need to wait for the batcher to respond to know it was the wrong unit), reduces attack surface for the batcher and makes for fewer things to check.
I'm not 100% sure this covers the batch size and percentual cases OTOH.
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 would also be more flexible for the user programs that could use different strategies for increasing proposed fees.
@@ -396,6 +400,86 @@ pub enum GetNonceResponseMessage { | |||
InvalidRequest(String), | |||
} | |||
|
|||
pub struct BumpFeeMessage { | |||
pub conent: BumpFeeMessageContent, |
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.
Typo:
pub conent: BumpFeeMessageContent, | |
pub content: BumpFeeMessageContent, |
pub fn new(bump_unit: BumpUnit, value: U256, proof_qty: usize) -> Self { | ||
let now = SystemTime::now() | ||
.duration_since(UNIX_EPOCH) | ||
.expect("Time went backwards"); |
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 actually possible (for how computers process time, not in the physical reality), so I don't recommend crashing. Returning an error if it would be incorrect wouldn't be bad tho.
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.
That said, if it went back to before UNIX_EPOCH
the user has a misconfigured machine, or hit 2038 without updating.
Improve user fee bumps
Description
This PR aims to improve the fee bumping process for a user and his proofs.
More details on this PR's issue
Type of change
Please delete options that are not relevant.
Checklist
testnet
, everything else tostaging