-
Notifications
You must be signed in to change notification settings - Fork 6
Enforce miner wormhole address #344
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
base: testnet/planck
Are you sure you want to change the base?
Conversation
* exponentially decaying token rewards * script to simulate emissions * clean up constants and switch python script to rust test * log if we hit max supply somehow
* exponentially decaying token rewards * script to simulate emissions * clean up constants and switch python script to rust test * log if we hit max supply somehow
…hain into illuzen/miner-wormhole
|
ah looks like we got the decaying rewards in here too...maybe it's ok? |
| traits::{AccountIdConversion, Saturating}, | ||
| }; | ||
|
|
||
| const UNIT: u128 = 1_000_000_000_000u128; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can pass this from the runtime as part of the Config as a constant. otherwise, duplicate definition
| // Log readable amounts (convert to tokens by dividing by 1e12) | ||
| if let (Ok(total), Ok(treasury), Ok(miner_amt), Ok(current), Ok(fees)) = ( | ||
| TryInto::<u128>::try_into(total_reward), | ||
| TryInto::<u128>::try_into(treasury_reward), | ||
| TryInto::<u128>::try_into(miner_reward), | ||
| TryInto::<u128>::try_into(current_supply), | ||
| TryInto::<u128>::try_into(tx_fees), | ||
| ) { | ||
| let remaining: u128 = | ||
| TryInto::<u128>::try_into(max_supply.saturating_sub(current_supply)) | ||
| .unwrap_or(0); | ||
| log::debug!(target: "mining-rewards", "💰 Total reward: {:.6}", total as f64 / UNIT as f64); | ||
| log::debug!(target: "mining-rewards", "💰 Treasury reward: {:.6}", treasury as f64 / UNIT as f64); | ||
| log::debug!(target: "mining-rewards", "💰 Miner reward: {:.6}", miner_amt as f64 / UNIT as f64); | ||
| log::debug!(target: "mining-rewards", "💰 Current supply: {:.2}", current as f64 / UNIT as f64); | ||
| log::debug!(target: "mining-rewards", "💰 Remaining supply: {:.2}", remaining as f64 / UNIT as f64); | ||
| log::debug!(target: "mining-rewards", "💰 Transaction fees: {:.6}", fees as f64 / UNIT as f64); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to not have these lines? or at least have it as a single debug print call? it adds almost 20 lines of code just to print a debug log
| let treasury_reward = | ||
| total_reward.saturating_mul(treasury_portion.into()) / 100u32.into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we use Permill or Perbill we wouldn't need to have this division here
This does not involve meaningful change to the block header. Instead, we reinterpret the 32 byte accountid as the wormhole address preimage and send rewards there.
Also deleted the redundant and outdated mining info in the readme and updated mining.md