diff --git a/.github/workflows/consensuswarn.yml b/.github/workflows/consensuswarn.yml new file mode 100644 index 000000000..d04f44bf0 --- /dev/null +++ b/.github/workflows/consensuswarn.yml @@ -0,0 +1,78 @@ +name: "Consensus Warn" + +permissions: read-all + +on: + pull_request: + +jobs: + main: + permissions: + pull-requests: write # For reading the PR and posting comment + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: orijtech/consensuswarn@main + with: + # Available BaseApp roots: + # - `go doc github.com/cosmos/cosmos-sdk/baseapp.BaseApp` + # - `go doc github.com/cosmos/cosmos-sdk/runtime.App` + # + # TODO_IN_THIS_PR: test. Does this even work with an app that uses `depinject`? + # TODO_CONSIDER: CURRENTLY MAY BE TOO VERBOSE. Consider removing functions that cause excessive noise or false positives. + # + # Critical consensus-related functions to monitor: + # + # PrepareProposal: + # Prepares a block proposal by selecting transactions to include in the block. + # A change here could affect what transactions are included in a block. + # + # ProcessProposal: + # Validates block proposals against consensus rules. + # Changes in this function could lead to consensus validation issues. + # + # FinalizeBlock: + # Finalizes the block by applying the transactions. + # This function is critical in ensuring that the block reaches consensus. + # + # Commit: + # Commits the application state after the block has been processed. + # Any changes here could impact state transitions and consensus. + # + # BeginBlock: + # Executes logic at the start of a new block. + # Changes here can influence the block initialization and its validity. + # + # EndBlock: + # Executes logic at the end of the block before committing. + # Can be crucial for final state updates that ensure consensus. + # + # VerifyVoteExtension: + # Verifies extended votes in the consensus process (Tendermint). + # Any changes could directly impact vote verification in consensus. + # + # ExtendVote: + # Adds vote extensions in the consensus process (Tendermint). + # Modifies how votes are extended, critical in consensus mechanics. + # + # Less-critical but related functions to monitor: + # + # CheckTx: + # Validates transactions in the mempool. While not part of the core consensus, + # changes here can affect what gets included in blocks, which indirectly impacts consensus. + # + # InitChain: + # Called during chain initialization. Important for network upgrades or starting a new chain. + # + # StoreConsensusParams: + # Stores consensus parameters in the chain state. + # Changes here could affect how consensus parameters are handled or updated. + # + # SimDeliver: + # Simulates transaction delivery for gas estimation and simulation. Not directly involved in consensus, + # but changes here could affect how transactions are simulated and processed before being included in a block. + # + # SimTxFinalizeBlock: + # Simulates a finalized block for testing and debugging purposes. + # Less critical, but could be monitored for changes that may affect testing and simulation behavior. + roots: github.com/cosmos/cosmos-sdk/baseapp.BaseApp.PrepareProposal,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.ProcessProposal,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.FinalizeBlock,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.Commit,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.VerifyVoteExtension,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.ExtendVote,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.CheckTx,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.InitChain,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.StoreConsensusParams,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.SimDeliver,github.com/cosmos/cosmos-sdk/baseapp.BaseApp.SimTxFinalizeBlock,github.com/cosmos/cosmos-sdk/runtime.App.BeginBlocker,github.com/cosmos/cosmos-sdk/runtime.App.EndBlocker,github.com/cosmos/cosmos-sdk/runtime.App.PreBlocker,github.com/cosmos/cosmos-sdk/runtime.App.Precommiter diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index da686f4bf..e8797cbb7 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -138,6 +138,10 @@ func (k Keeper) ProcessTokenLogicModules( claimSettlementCoin := cosmostypes.NewCoin("upokt", math.NewInt(0)) isSuccessful := false + if 2 > 1 { + fmt.Println("can this trigger consensuswarn?") + } + // This is emitted only when the function returns (successful or not) defer telemetry.EventSuccessCounter( "process_token_logic_modules", @@ -657,11 +661,12 @@ func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64()) newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimedTokenGlobalInflation)) - // DEV_NOTE: If new mint is less than 1 and more than 0, ceil it to 1 so that - // we never expect to process a claim with 0 minted tokens. - if newMintAmtFloat.Cmp(big.NewFloat(1)) < 0 && newMintAmtFloat.Cmp(big.NewFloat(0)) > 0 { - newMintAmtFloat = big.NewFloat(1) - } + // See if this triggers consensuswarn + // // DEV_NOTE: If new mint is less than 1 and more than 0, ceil it to 1 so that + // // we never expect to process a claim with 0 minted tokens. + // if newMintAmtFloat.Cmp(big.NewFloat(1)) < 0 && newMintAmtFloat.Cmp(big.NewFloat(0)) > 0 { + // newMintAmtFloat = big.NewFloat(1) + // } newMintAmtInt, _ := newMintAmtFloat.Int64() mintAmtCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt)) return mintAmtCoin, *newMintAmtFloat