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

refactor: improve user fee bumps #1576

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

uri-99
Copy link
Contributor

@uri-99 uri-99 commented Dec 4, 2024

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.

  • New feature
  • Bug fix
  • Optimization
  • Refactor

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@uri-99 uri-99 linked an issue Dec 4, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Dec 4, 2024

Changes to gas cost

Generated at commit: 5bab645c51c7b24212ce539e18dd6e47a10c16b8, compared to commit: 8b6ef0c71f65d1233d392c2d58f2f1442ba27fab

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
AlignedLayerServiceManager createNewTask +302 ❌ +0.40%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
AlignedLayerServiceManager 5,231,234 (0) createNewTask
receive
56,083 (0)
23,317 (0)
0.00%
0.00%
76,066 (+302)
46,915 (+373)
+0.40%
+0.80%
76,217 (-24)
47,195 (0)
-0.03%
0.00%
77,030 (0)
47,195 (0)
0.00%
0.00%
256 (0)
256 (0)

@uri-99 uri-99 self-assigned this Dec 4, 2024
@PatStiles PatStiles changed the base branch from testnet to staging December 4, 2024 21:03
Comment on lines +474 to +478
ClientMessage::BumpFee(bump_unit, amout, proof_qty) => {
self.clone()
.handle_bump_fee_msg(bump_unit, amout, proof_qty, ws_conn_sink)
.await
}
Copy link
Collaborator

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.

Copy link
Collaborator

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,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo:

Suggested change
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");
Copy link
Collaborator

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.

Copy link
Collaborator

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.

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.

refactor: improve user fee bumps
2 participants