Skip to content

Commit

Permalink
Fix call cost charging logic for System SCORE
Browse files Browse the repository at this point in the history
  • Loading branch information
mksong76 committed Jul 15, 2021
1 parent d326bc6 commit f51b83f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
1 change: 1 addition & 0 deletions icon/icmodule/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
RevisionMultipleUnstakes = Revision9
RevisionFixEmailValidation = Revision9
RevisionDelegationSlotMaxTo100 = Revision9
RevisionSystemSCORE = Revision9

RevisionFixInvalidUnstake = Revision11

Expand Down
19 changes: 6 additions & 13 deletions icon/systemhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,14 @@ func allowExtraParams(method string) bool {
return yn
}

var methodsNotChargingContractCallStep = map[string]bool{
"setStake": true,
"setDelegation": true,
"registerPRep": true,
"unregisterPRep": true,
"setPRep": true,
"setGovernanceVariables": true,
"claimIScore": true,
"estimateUnstakeLockPeriod": true,
}

func doNotChargeContractCallStep(method string, revision int) bool {
if revision >= icmodule.RevisionICON2 || revision < icmodule.RevisionIISS {
return false
}
yn, _ := methodsNotChargingContractCallStep[method]
return yn
if method == "" && revision < icmodule.RevisionSystemSCORE {
return false
}
return true
}

type CallHandler interface {
Expand Down Expand Up @@ -99,6 +90,8 @@ func (h *SystemCallHandler) ExecuteAsync(cc contract.CallContext) (err error) {
h.log.TSystemf("FRAME[%d] allow extra params", cc.FrameID())
h.AllowExtra()
}
}
if h.revision.Value() < icmodule.RevisionIISS {
defer func() {
if scoreresult.MethodNotFoundError.Equals(err) {
h.log.TSystemf(
Expand Down

0 comments on commit f51b83f

Please sign in to comment.