Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

kip162: enable gasTip and add tip to total reward #2187

Merged
merged 9 commits into from
May 24, 2024

Conversation

yoomee1313
Copy link
Contributor

Proposed changes

  • This PR implements kip-162, activating tip mechanism. The tips are distributed to reward beneficiaries if it's deferredtxfee.

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

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@yoomee1313 yoomee1313 self-assigned this May 23, 2024
blockchain/types/transaction.go Show resolved Hide resolved
reward/reward_distributor.go Outdated Show resolved Hide resolved
reward/reward_distributor.go Outdated Show resolved Hide resolved
@yoomee1313 yoomee1313 marked this pull request as ready for review May 23, 2024 09:18
Co-authored-by: Yunjong Jeong (ollie) <[email protected]>
reward/reward_distributor.go Show resolved Hide resolved
reward/supply_manager.go Outdated Show resolved Hide resolved
@blukat29
Copy link
Contributor

@yoomee1313 Please enable the supply manager test with KIP-162 settings. I've checked it works.

diff --git a/reward/supply_manager_test.go b/reward/supply_manager_test.go
index a4e13db48..32ec05cfe 100644
--- a/reward/supply_manager_test.go
+++ b/reward/supply_manager_test.go
@@ -372,7 +372,7 @@ func (s *SupplyTestSuite) SetupSuite() {
                KoreCompatibleBlock:      big.NewInt(200),
                ShanghaiCompatibleBlock:  big.NewInt(300),
                CancunCompatibleBlock:    big.NewInt(300),
-               // KaiaCompatibleBlock:    big.NewInt(300), // TODO: uncomment
+               KaiaCompatibleBlock:      big.NewInt(300),

                Kip103CompatibleBlock: big.NewInt(200),
                Kip103ContractAddress: addrKip103,
@@ -473,7 +473,7 @@ func (s *SupplyTestSuite) testcases() []supplyTestTC {
        var (
                halfFee = big.NewInt(262500000000000) // Magma burn amount (gasPrice=50, baseFee=25 -> effectivePrice=25)
                fullFee = big.NewInt(525000000000000) // Kore burn amount (gasPrice=50, baseFee=25 -> effectivePrice=25)
-               // withTip = big.NewInt(283500000000000) // Kaia burn amount (gasPrice=27, baseFee=25 -> effectivePrice=27)
+               withTip = big.NewInt(567000000000000) // Kaia burn amount (gasPrice=27, baseFee=25 -> effectivePrice=27)

                // Fund1 has 769254566500000000000, Fund2 has 178056862000000000000 at block 199 but burnt
                // Fund1 get   1280000000000000000, Fund2 get   1920000000000000000 at block 200 minted from reward but burnt
@@ -512,7 +512,7 @@ func (s *SupplyTestSuite) testcases() []supplyTestTC {
        }
        for i := uint64(300); i <= 400; i++ {
                minted[i] = bigAdd(minted[i-1], amount80)
-               burntFee[i] = bigAdd(burntFee[i-1], fullFee) // TODO: withTip with KIP-162
+               burntFee[i] = bigAdd(burntFee[i-1], withTip)
        }

        nums := []uint64{0, 1, 99, 100, 199, 200, 299, 300, 399, 400}

@blukat29 blukat29 merged commit c590459 into klaytn:dev May 24, 2024
11 checks passed
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.

4 participants