-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collective reward/penalties are opaque #161
Comments
One source of confusion comes from the fact that diff --git a/casper/contracts/simple_casper.v.py b/casper/contracts/simple_casper.v.py
index 3b94cc9..6b02682 100644
--- a/casper/contracts/simple_casper.v.py
+++ b/casper/contracts/simple_casper.v.py
@@ -72,9 +72,6 @@ main_hash_justified: public(bool)
# Value used to calculate the per-epoch fee that validators should be charged
deposit_scale_factor: public(decimal(m)[int128])
-last_nonvoter_rescale: public(decimal)
-last_voter_rescale: public(decimal)
-
current_epoch: public(int128)
last_finalized_epoch: public(int128)
last_justified_epoch: public(int128)
@@ -244,6 +241,7 @@ def insta_finalize():
# Returns the current collective reward factor, which rewards the dynasty for high-voting levels.
@private
+@constant
def collective_reward() -> decimal:
epoch: int128 = self.current_epoch
live: bool = self.esf() <= 2
@@ -323,6 +321,15 @@ def total_curdyn_deposits_in_wei() -> wei_value:
def total_prevdyn_deposits_in_wei() -> wei_value:
return floor(self.total_prevdyn_deposits * self.deposit_scale_factor[self.current_epoch])
+@public
+@constant
+def last_voter_rescale() -> decimal:
+ return 1 + self.collective_reward()
+
+@public
+@constant
+def last_nonvoter_rescale() -> decimal:
+ return (1 + self.collective_reward()) / (1 + self.reward_factor)
@public
# cannot be labeled @constant because of external call
@@ -505,9 +512,8 @@ def initialize_epoch(epoch: int128):
self.current_epoch = epoch
- self.last_voter_rescale = 1 + self.collective_reward()
- self.last_nonvoter_rescale = self.last_voter_rescale / (1 + self.reward_factor)
- self.deposit_scale_factor[epoch] = self.deposit_scale_factor[epoch - 1] * self.last_nonvoter_rescale
+ self.deposit_scale_factor[epoch] = self.deposit_scale_factor[epoch - 1] * \
+ (1 + self.collective_reward()) / (1 + self.reward_factor)
self.total_slashed[epoch] = self.total_slashed[epoch - 1]
if self.deposit_exists(): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
I frequently have to explain what is actually happening with the scale factor and collective rewards. I also have to frequently re-figure out what's going on. It's very opaque.
Need to reward the names of things and also probably write a post.
The text was updated successfully, but these errors were encountered: