8000 Stop loading rewardwallet by blukat29 · Pull Request #1819 · 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.

Stop loading rewardwallet #1819

Merged
merged 5 commits into from
May 10, 2023
Merged

Stop loading rewardwallet #1819

merged 5 commits into from
May 10, 2023

Conversation

blukat29
Copy link
Contributor
@blukat29 blukat29 commented Apr 5, 2023

Proposed changes

Klaytn consensus node does not need the wallet (private key) for rewardbase address, yet it tries to load it from accounts.
Klaytn prints an irrelevant log "Error happened while setting the reward wallet" during node startup.

Therefore this PR

  • removes the rewardbase wallet (rewardwallet) from Klaytn codebase.
  • removes unused or unnecessary wrapper functions related to rewardbase and rewardwallet.
  • modifies the log message

In the diagram below, red boxes are the ones removed.

flowchart LR

  flag{{--rewardbase 0xaddr}} -->|cn.Config.Rb| cn.New("cn.New()")
  
  cn.New -->|cn.rb| cn.setRW
  cn.New -->|cn.Config.Rb| CreateConsensusEngine
  CreateConsensusEngine --> istanbulBackend.New
  istanbulBackend.New --> sb.rb

  api.Rb("rpc klay_rewardbase") --> cn.Rb

  subgraph type cn.ProtocolManager
	  pm.Set --> pm.rb{{pm.rewardbase}}
	  pm.Set --> pm.rw{{pm.rewardwallet}}
  end

  subgraph type cn.CN
    cn.setRW("setRewardWallet()") --> cn.RbW("RewardbaseWallet()")
	cn.setRW --> pm.Set("pm.SetRb(), pm.SetRbW()")

    cn.SetRb("SetRewardbase()") --> cn.RbW
    cn.SetRb --> pm.Set

    cn.RbW --> cn.Rb("Rewardbase()")
    cn.Rb <--> cn.rb{{cn.rb}}
  end

  subgraph type istanbul.backend
    sb.rb{{sb.rewardbase}}
	  sb.rb --> ib.Prepare("Prepare()")
    sb.rb --> ib.GetRB("GetRewardBase()")
  end

  classDef red fill:#fcc
  class cn.setRW,cn.RbW,pm.rb,pm.rw,pm.Set,cn.SetRb red
Loading

Types of changes

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

  • 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

Further comments

@blukat29 blukat29 requested a review from aidan-kwon April 5, 2023 07:43
@blukat29 blukat29 changed the title Remove ProtocolManager.rewardwallet Stop loading rewardwallet Apr 5, 2023
@blukat29 blukat29 self-assigned this Apr 5, 2023
@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/CodeQL.yml:CodeQL-Build. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@2dvorak
Copy link
Collaborator
2dvorak commented May 10, 2023

Tested with the following scenarios

  1. Not specifying rewardbase

    -> error while parsing arguments

     Fatal: Option "rewardbase": invalid account address or index "0x0"
    
  2. Specifying 0x000..0 as rewardbase with an account imported in wallet

    -> rewardbase automatically set using wallet account

     INFO[05/10,05:52:30 Z] [41|node/cn/backend.go:585]                     Rewardbase automatically configured       address=0xB7385b1D284a589A123C297c7EE0ad9B1835eC9B
    

    (homi generated docker-compose.yml would automatically import node private key into wallet)

  3. Specifying 0x000..0 as rewardbase without any account in wallet

    -> error while setting rewardbase (this error is newly added in this PR)

     ERROR[05/10,05:53:45 Z] [41|node/cn/backend.go:323]                    Cannot determine the rewardbase address   err="rewardbase must be explicitly specified"
    

    In this case, reward goes to 0x000..0.

     > klay.getBalance("0x0000000000000000000000000000000000000000")
     364800000000000000000
     > klay.getBalance("0x0000000000000000000000000000000000000000")
     374400000000000000000
    

LGTM

@blukat29 blukat29 merged commit 5935602 into klaytn:dev May 10, 2023
@blukat29 blukat29 deleted the remove-rewardwallet branch May 10, 2023 12:24
@JayChoi1736 JayChoi1736 mentioned this pull request Jul 24, 2023
20 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.

3 participants
0