From 60838255fcdf4b9a8df37dfbd05bc83781a14198 Mon Sep 17 00:00:00 2001 From: decanus Date: Sun, 24 Mar 2019 14:44:14 +0100 Subject: [PATCH 1/2] renamed slash validator function --- Sources/BeaconChain/BeaconChain.swift | 2 +- Sources/BeaconChain/StateTransition.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/BeaconChain/BeaconChain.swift b/Sources/BeaconChain/BeaconChain.swift index 305452a..cdb62b9 100644 --- a/Sources/BeaconChain/BeaconChain.swift +++ b/Sources/BeaconChain/BeaconChain.swift @@ -442,7 +442,7 @@ extension BeaconChain { extension BeaconChain { - static func slashValidator(state: inout BeaconState, index: ValidatorIndex) { + static func slash(_ state: inout BeaconState, index validator: ValidatorIndex) { assert(state.slot < state.validatorRegistry[Int(index)].withdrawableEpoch.startSlot()) state.validatorRegistry[Int(index)].exit(state: state) diff --git a/Sources/BeaconChain/StateTransition.swift b/Sources/BeaconChain/StateTransition.swift index 16587eb..dd952df 100644 --- a/Sources/BeaconChain/StateTransition.swift +++ b/Sources/BeaconChain/StateTransition.swift @@ -104,7 +104,7 @@ extension StateTransition { ) ) - BeaconChain.slashValidator(state: &state, index: proposerSlashing.proposerIndex) + BeaconChain.slash(&state, validator: proposerSlashing.proposerIndex) } } @@ -132,7 +132,7 @@ extension StateTransition { assert(slashableIndices.count >= 1) for i in slashableIndices { - BeaconChain.slashValidator(state: &state, index: i) + BeaconChain.slash(&state, validator: i) } } } From 919d17a3011191f2db206dcd2f589eebe9b3880c Mon Sep 17 00:00:00 2001 From: decanus Date: Sun, 24 Mar 2019 14:45:13 +0100 Subject: [PATCH 2/2] fix --- Sources/BeaconChain/BeaconChain.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/BeaconChain/BeaconChain.swift b/Sources/BeaconChain/BeaconChain.swift index cdb62b9..5e1d294 100644 --- a/Sources/BeaconChain/BeaconChain.swift +++ b/Sources/BeaconChain/BeaconChain.swift @@ -442,7 +442,7 @@ extension BeaconChain { extension BeaconChain { - static func slash(_ state: inout BeaconState, index validator: ValidatorIndex) { + static func slash(_ state: inout BeaconState, validator index: ValidatorIndex) { assert(state.slot < state.validatorRegistry[Int(index)].withdrawableEpoch.startSlot()) state.validatorRegistry[Int(index)].exit(state: state)