8000 [Governance] Disrupting the chain through the actions of a solitary malicious CN node by hyunsooda · Pull Request #1942 · 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.

[Governance] Disrupting the chain through the actions of a solitary malicious CN node #1942

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions governance/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var GovernanceItems = map[int]check{
params.UseGiniCoeff: {boolT, checkUint64andBool, nil},
params.Kip82Ratio: {stringT, checkKip82Ratio, nil},
AE82 params.DeferredTxFee: {boolT, checkUint64andBool, nil},
params.MinimumStake: {stringT, checkRewardMinimumStake, nil},
params.MinimumStake: {stringT, checkBigInt, nil},
params.StakeUpdateInterval: {uint64T, checkUint64andBool, nil},
params.ProposerRefreshInterval: {uint64T, checkUint64andBool, nil},
params.Epoch: {uint64T, checkUint64andBool, nil},
Expand Down Expand Up @@ -245,18 +245,6 @@ func checkCommitteeSize(k string, v interface{}) bool {
return true
}

func checkRewardMinimumStake(k string, v interface{}) bool {
if !checkBigInt(k, v) {
return false
}
if v, ok := new(big.Int).SetString(v.(string), 10); ok {
if v.Cmp(common.Big0) < 0 {
return false
}
}
return true
}

func checkUint64andBool(k string, v interface{}) bool {
// for Uint64 and Bool, no more check is needed
if reflect.TypeOf(v) == uint64T || reflect.TypeOf(v) == boolT {
Expand All @@ -273,11 +261,10 @@ func checkProposerPolicy(k string, v interface{}) bool {
}

func checkBigInt(k string, v interface{}) bool {
x := new(big.Int)
if _, ok := x.SetString(v.(string), 10); ok {
return true
if v, ok := new(big.Int).SetString(v.(string), 10); !ok || v.Cmp(common.Big0) < 0 {
return false
}
return false
return true
}

func checkAddress(k string, v interface{}) bool {
Expand Down
0