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

Remove KIR/PoC and introduce KCF/KFF from API returns and internal code #1792

Merged
merged 4 commits into from
Feb 27, 2023

Conversation

aidan-kwon
Copy link
Member

Proposed changes

This PR is a part of KGP-6 implementation, however, it causes a change in the API return format.

  1. The change in RewardSpec affects to klay_getRewards API
    Before
{
        "minted": 6400000000000000000,
        "totalFee": 70825700000000000,
        "burntFee": 35412850000000000,
        "proposer": 3217706425000000000,
        "stakers": 0,
        "kgf": 2574165140000000000,
        "kir": 643541285000000000,
        "rewards": {
            "0x179679457f93094a4e7186abcb2089661e92fc22": 3217706425000000000,
            "0x278e6332d69eed782784d21802e3504a64a16456": 2574165140000000000,
            "0x3d803a7375a8ee5996f52a8d6725637a89f5bbf8": 643541285000000000
        }

After

{
        "minted": 6400000000000000000,
        "totalFee": 70825700000000000,
        "burntFee": 35412850000000000,
        "proposer": 3217706425000000000,
        "stakers": 0,
        "kff": 2574165140000000000,
        "kcf": 643541285000000000,
        "rewards": {
            "0x179679457f93094a4e7186abcb2089661e92fc22": 3217706425000000000,
            "0x278e6332d69eed782784d21802e3504a64a16456": 2574165140000000000,
            "0x3d803a7375a8ee5996f52a8d6725637a89f5bbf8": 643541285000000000
        }
  1. The change in StakingInfo struct affects to klay_getStakingInfo API.
    This change also affects to StakingInfo data stored in database, so the unmarshal function of StakingInfo is added to support both legacy data and new data.

Before

{
        "BlockNum": 115171200,
        "CouncilNodeAddrs": [ ... ... ],
        "CouncilStakingAddrs": [ ... ... ],
        "CouncilRewardAddrs": [ ... ... ],
        "KIRAddr": "0x3d803a7375a8ee5996f52a8d6725637a89f5bbf8",
        "PoCAddr": "0x278e6332d69eed782784d21802e3504a64a16456",
        "UseGini": true,
        "Gini": 0.61,
        "CouncilStakingAmounts": [ ... ... ]
    }

After

{
        "blockNum": 115171200,
        "councilNodeAddrs":  [ ... ... ],
        "councilStakingAddrs":  [ ... ... ],
        "councilRewardAddrs":  [ ... ... ],
        "kcfAddr": "0x3d803a7375a8ee5996f52a8d6725637a89f5bbf8",
        "kffAddr": "0x278e6332d69eed782784d21802e3504a64a16456",
        "useGini": true,
        "gini": 0.61,
        "councilStakingAmounts":  [ ... ... ],
    }

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

@aidan-kwon aidan-kwon added this to the v1.10.2 milestone Feb 24, 2023
@aidan-kwon aidan-kwon added the need to merge Need to merge for the next time label Feb 24, 2023
@kjeom
Copy link
Member

kjeom commented Feb 26, 2023

No need to add hard fork logic?

@blukat29
Copy link
Contributor

chaindata/misc produced by this version may break old nodes. Do we need an intermediate period where both names are stored in the database?

0xxlegolas
0xxlegolas previously approved these changes Feb 27, 2023
praveen-kaia
praveen-kaia previously approved these changes Feb 27, 2023
@aidan-kwon aidan-kwon mentioned this pull request Feb 27, 2023
@aidan-kwon aidan-kwon dismissed stale reviews from praveen-kaia and 0xxlegolas via 2ec33b8 February 27, 2023 04:13
@aidan-kwon
Copy link
Member Author

No need to add hard fork logic?

This change affects to only two APIs that is not widely used. So, I just make a change and announce it by publishing an interface KIP.

@aidan-kwon
Copy link
Member Author

chaindata/misc produced by this version may break old nodes. Do we need an intermediate period where both names are stored in the database?

I introduced a JSON marshal method to provide backward compatibility

@aidan-kwon aidan-kwon requested a review from blukat29 February 27, 2023 04:16
@aidan-kwon aidan-kwon requested a review from ian0371 February 27, 2023 05:55
@aidan-kwon
Copy link
Member Author

@ethan-kr @ian0371 @blukat29 PTAL

@blukat29 blukat29 merged commit eb771ac into klaytn:dev Feb 27, 2023
@aidan-kwon aidan-kwon deleted the 230204-apiKgfKir branch February 27, 2023 10:09
@blukat29 blukat29 mentioned this pull request Mar 3, 2023
9 tasks
@aidan-kwon aidan-kwon mentioned this pull request May 9, 2023
@blukat29 blukat29 removed the need to merge Need to merge for the next time label Nov 14, 2023
@ian0371 ian0371 mentioned this pull request May 15, 2024
9 tasks
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.

7 participants