diff --git a/CHANGELOG.md b/CHANGELOG.md index b88ef5615..df5e87317 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased changes +## 7.0.4 + +- Fix a bug where the next payday time reported by the `GetTokenomicsInfo` query was + incorrect (#1240). + ## 7.0.3 - Fix a bug in the computation of the genesis height after the second protocol update. (#1237) diff --git a/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs b/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs index b578420f0..fc807f05b 100644 --- a/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs +++ b/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs @@ -2798,8 +2798,8 @@ doMint pbs mint = do bspBank bsp & unhashed %~ (Rewards.totalGTU +~ mintTotal mint) - . (Rewards.bakingRewardAccount +~ mintBakingReward mint) - . (Rewards.finalizationRewardAccount +~ mintFinalizationReward mint) + . (Rewards.bakingRewardAccount +~ mintBakingReward mint) + . (Rewards.finalizationRewardAccount +~ mintFinalizationReward mint) let updAcc = addAccountAmount $ mintDevelopmentCharge mint foundationAccount <- (^. cpFoundationAccount) <$> lookupCurrentParameters (bspUpdates bsp) newAccounts <- Accounts.updateAccountsAtIndex' updAcc foundationAccount (bspAccounts bsp) diff --git a/concordium-consensus/src/Concordium/Queries.hs b/concordium-consensus/src/Concordium/Queries.hs index d0ff53eba..37227e8fa 100644 --- a/concordium-consensus/src/Concordium/Queries.hs +++ b/concordium-consensus/src/Concordium/Queries.hs @@ -920,11 +920,20 @@ getRewardStatus = return $ epochToUTC <$> reward ) ( \bp -> do - reward <- BS.getRewardStatus =<< blockState bp + bState <- blockState bp + reward <- BS.getRewardStatus bState + -- The reward status includes the next payday epoch. To convert this to a UTCTime, + -- we get the current epoch and the trigger block time (which we treat as the time of + -- the start of the next epoch) from the seed state. For each epoch after the next + -- epoch, we add the epoch duration to the trigger block time to get the time of the + -- payday. + ss <- BS.getSeedState bState + let nextEpoch = ss ^. epoch + 1 + let deltaEpochs e = if e > nextEpoch then fromIntegral (e - nextEpoch) else 0 BaseV1.CoreGenesisParametersV1{..} <- SkovV1.gmParameters <$> use SkovV1.genesisMetadata let epochToUTC e = timestampToUTCTime $ - addDuration genesisTime (fromIntegral e * genesisEpochDuration) + addDuration (ss ^. triggerBlockTime) (deltaEpochs e * genesisEpochDuration) return $ epochToUTC <$> reward ) diff --git a/concordium-node/Cargo.lock b/concordium-node/Cargo.lock index 37a55117a..a339ca8f8 100644 --- a/concordium-node/Cargo.lock +++ b/concordium-node/Cargo.lock @@ -787,7 +787,7 @@ dependencies = [ [[package]] name = "concordium_node" -version = "7.0.3" +version = "7.0.4" dependencies = [ "anyhow", "app_dirs2", diff --git a/concordium-node/Cargo.toml b/concordium-node/Cargo.toml index 657d5753c..00ca61530 100644 --- a/concordium-node/Cargo.toml +++ b/concordium-node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "concordium_node" -version = "7.0.3" # must be kept in sync with 'is_compatible_version' in 'src/configuration.rs' +version = "7.0.4" # must be kept in sync with 'is_compatible_version' in 'src/configuration.rs' description = "Concordium Node" authors = ["Concordium "] exclude = [".gitignore", ".gitlab-ci.yml", "test/**/*","**/**/.gitignore","**/**/.gitlab-ci.yml"] diff --git a/concordium-node/src/consensus_ffi/ffi.rs b/concordium-node/src/consensus_ffi/ffi.rs index 1faddf7de..086121b6c 100644 --- a/concordium-node/src/consensus_ffi/ffi.rs +++ b/concordium-node/src/consensus_ffi/ffi.rs @@ -1977,12 +1977,11 @@ impl ConsensusContainer { pub fn send_finalization(&self, genesis_index: u32, msg: &[u8]) -> ConsensusFfiResponse { wrap_send_data_to_c!(self, genesis_index, msg, receiveFinalizationMessage) - .check_consistent() + .check_consistent() } pub fn send_finalization_record(&self, genesis_index: u32, rec: &[u8]) -> ConsensusFfiResponse { - wrap_send_data_to_c!(self, genesis_index, rec, receiveFinalizationRecord) - .check_consistent() + wrap_send_data_to_c!(self, genesis_index, rec, receiveFinalizationRecord).check_consistent() } /// Send a transaction to consensus. Return whether the operation succeeded