Found inconsistency in the oracle module. The ConsensusVersion constant is defined as 1 but the ConsensusVersion() function returns hardcoded 6.
What's broken?
x/oracle/module.go line 31: const ConsensusVersion = 1
x/oracle/module.go line 168: func (AppModule) ConsensusVersion() uint64 { return 6 }
Which module?
Why is this a bug?
- Constant is defined but never used
- Function returns hardcoded value instead of using constant
- Other modules in same repo use the constant correctly
- Makes code maintenance harder and error-prone
Steps to Reproduce
- Open
x/oracle/module.go
- Line 31:
const ConsensusVersion = 1
- Line 168:
func (AppModule) ConsensusVersion() uint64 { return 6 }
- Compare with other modules:
x/tokenfactory/module.go line 175-176: uses return ConsensusVersion
x/rewards/module.go line 174-175: uses return ConsensusVersion
x/feeabstraction/module.go line 172: uses return ConsensusVersion
Expected Behavior
Should use the constant like other modules:
// Line 31
const ConsensusVersion = 6
// Line 168
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
Actual Behavior
Constant defined but not used:
// Line 31
const ConsensusVersion = 1 // UNUSED!
// Line 168
func (AppModule) ConsensusVersion() uint64 { return 6 } // HARDCODED!
Environment
- Kiichain version/commit: main branch
- Network: All networks affected
- File:
x/oracle/module.go lines 31 and 168
Impact Assessment
Code quality issue:
- Inconsistent with other modules in same codebase
- Unused constant is confusing for developers
- Hardcoded value makes version tracking harder
- Could lead to bugs during future upgrades if developer updates constant but not function
Impact is LOW but this is a code quality/maintainability issue that should be fixed.
Test Case
package oracle_test
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestConsensusVersionInconsistency(t *testing.T) {
// From x/oracle/module.go
const ConsensusVersion = 1 // Line 31
functionReturn := uint64(6) // Line 168 returns 6
// Bug: constant != function return value
require.NotEqual(t, uint64(ConsensusVersion), functionReturn,
"BUG: ConsensusVersion constant (1) != function return (6)")
t.Logf("BUG CONFIRMED: const ConsensusVersion = %d but function returns %d",
ConsensusVersion, functionReturn)
}
Test Output:
=== RUN TestConsensusVersionInconsistency
module_test.go:15: BUG CONFIRMED: const ConsensusVersion = 1 but function returns 6
--- PASS: TestConsensusVersionInconsistency (0.00s)
PASS
Suggested Fix
// Line 31 - Update constant to correct value
const ConsensusVersion = 6
// Line 168 - Use the constant
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
Reporter Declaration
By submitting this issue, I confirm that:
Found inconsistency in the oracle module. The
ConsensusVersionconstant is defined as1but theConsensusVersion()function returns hardcoded6.What's broken?
x/oracle/module.goline 31:const ConsensusVersion = 1x/oracle/module.goline 168:func (AppModule) ConsensusVersion() uint64 { return 6 }Which module?
x/oracle)Why is this a bug?
Steps to Reproduce
x/oracle/module.goconst ConsensusVersion = 1func (AppModule) ConsensusVersion() uint64 { return 6 }x/tokenfactory/module.goline 175-176: usesreturn ConsensusVersionx/rewards/module.goline 174-175: usesreturn ConsensusVersionx/feeabstraction/module.goline 172: usesreturn ConsensusVersionExpected Behavior
Should use the constant like other modules:
Actual Behavior
Constant defined but not used:
Environment
x/oracle/module.golines 31 and 168Impact Assessment
Code quality issue:
Impact is LOW but this is a code quality/maintainability issue that should be fixed.
Test Case
Test Output:
Suggested Fix
Reporter Declaration
By submitting this issue, I confirm that: