8000 make baseFee even number by kjeom · Pull Request #1537 · klaytn/klaytn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

make baseFee even number #1537

Merged
merged 11 commits into from
Jul 20, 2022
Merged

make baseFee even number #1537

merged 11 commits into from
Jul 20, 2022

Conversation

kjeom
Copy link
@kjeom kjeom commented Jul 19, 2022

Proposed changes

  • Issue
    • txFee1 / 2) + (txFee2 / 2) + … + (txFeeN / 2) != (txFee1 + txFee2 + … + txFeeN) / 2.
    • It is because big.Int division throws away the remainder.
    • the difference is (Count_EvenNumberTxFee / 2).
    • txFee1 / 2) + (txFee2 / 2) + … + (txFeeN / 2) != (txFee1 + txFee2 + … + txFeeN) / 2 - (Count_EvenNumberTxFee / 2).
  • Propose
    • make the baseFee even number by adding 1 to the OddNumberBaseFee.
    • It can be applied to the other divider (3, 4, 5) by adding the offset (divider - remainder).

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Co-authored-by: Jamie <32922423+jimni1222@users.noreply.github.com>
jack and others added 2 commits July 20, 2022 10:39
Co-authored-by: bob.p <106128487+bobpkr@users.noreply.github.com>
Co-authored-by: bob.p <106128487+bobpkr@users.noreply.github.com>
ghost
ghost previously approved these changes Jul 20, 2022
@kjeom kjeom dismissed ghost ’s stale review via d71a7cb July 20, 2022 02:47
@jimni1222 jimni1222 added the need to merge Need to merge for the next time label Jul 20, 2022
@kjeom kjeom self-assigned this Jul 20, 2022
@kjeom kjeom added this to the v1.9.0 (Magma) milestone Jul 20, 2022
Copy link
Contributor
@jimni1222 jimni1222 left a comment

Choose a reason for hiding this comment

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

LGTM Thanks!

Copy link
Member
@aidan-kwon aidan-kwon left a comment

Choose a reason for hiding this comment

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

It looks good, but we need to change the calculation logic in KIP71

@kjeom kjeom merged commit e8cb80e into klaytn:dev Jul 20, 2022
return baseFee
}

func makeEvenByUp(baseFee *big.Int) *big.Int {

Choose a reason for hiding this comment

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

@kjeom hmm.. name is little bit misleading.
Can we use the name 'ceil' and 'floor' instead?

@@ -23,10 +23,27 @@ func VerifyMagmaHeader(config *params.ChainConfig, parentHeader, header *types.H
return nil
}

func makeEvenByDown(baseFee *big.Int) *big.Int {
if baseFee.Bit(0) != 0 {
baseFee.Rsh(baseFee, 1)

Choose a reason for hiding this comment

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

I think it would be better to use baseFee.sub()

kjhman21 pushed a commit to kjhman21/klaytn that referenced this pull request Jul 20, 2022
Refine Implementation of klaytn#1537
@kjhman21 kjhman21 mentioned this pull request Jul 20, 2022
9 tasks
@kjhman21
Copy link

#1543

Refined this code please take a look @kjeom @jimni1222 @bobpkr @aidan-kwon

@kjeom kjeom mentioned this pull request Jul 21, 2022
kjhman21 pushed a commit to kjhman21/klaytn that referenced this pull request Jul 21, 2022
Refine Implementation of klaytn#1537
@blukat29 blukat29 removed the need to merge Need to merge for the next time label Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0