Missing event emission on critical state change
The Stargate contract's setMaxClaimablePeriods function updates a critical configuration value without emitting an event. This reduces on-chain transparency and makes it harder for off-chain systems to track the change.
- Disclosed after under an hour
59244 sc insight missing event emission on critical state change
Submitted on Nov 10th 2025 at 10:42:38 UTC by @akioniace for Audit Comp | Vechain | Stargate Hayabusa
- Report ID: #59244
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/tree/main/packages/contracts/contracts/Stargate.sol
Description
Brief / Intro
The contract Stargate does not emit an event upon a critical state change. This omission reduces on-chain transparency and makes it difficult for off-chain systems to track important changes. It also breaks the best practice of emitting events on important state changes.
Vulnerability Details
The function Stargate::setMaxClaimablePeriods performs a critical state change by updating the maximum claimable period value, but it does not emit any event notifying about this change. Emitting an event on such state updates helps off-chain infrastructure (indexers, explorers, frontends) and improves transparency and auditability.
Relevant code:
/// @inheritdoc IStargate
function setMaxClaimablePeriods(
uint32 _maxClaimablePeriods
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_maxClaimablePeriods == 0) {
revert InvalidMaxClaimablePeriods();
}
_getStargateStorage().maxClaimablePeriods = _maxClaimablePeriods;
// @audit-issue: missing event emission
}
Impact Details
This is primarily a code-quality / best-practices issue. The consequences of missing event emission include:
- Reduced Transparency: Off-chain parties cannot easily verify important state changes.
- Poor Developer and User Experience: Front-ends and indexers cannot rely on an event to discover or react to the change without scanning on-chain state.
- Security Concerns: Absence of event logs makes it harder to audit and detect malicious or accidental changes.
References
Proof of Concept
{% stepper %} {% step %}
Step 1
Copy-paste the following test function into packages/contracts/test/unit/Stargate/Rewards.test.ts:
it("should emit an event when max claimable periods is updated (currently missing)", async () => {
// We expect the contract to emit something like "MaxClaimablePeriodsUpdated"
// But since it does NOT, this test will fail — proving the missing event issue.
await expect(
stargateContract.connect(deployer).setMaxClaimablePeriods(2000)
).to.emit(stargateContract, "MaxClaimablePeriodsUpdated") // <-- just mocked event for showing
.withArgs(2000);
});
{% endstep %}
{% step %}
Step 2
Run the tests. The test will fail with an error indicating no event was emitted:
@repo/contracts:test:hardhat: 203 passing (1m)
@repo/contracts:test:hardhat: 1 failing
@repo/contracts:test:hardhat:
@repo/contracts:test:hardhat: 1) shard-u4: Stargate: Rewards
@repo/contracts:test:hardhat: should emit an event when max claimable periods is updated (currently missing):
@repo/contracts:test:hardhat: AssertionError: Event "MaxClaimablePeriodsUpdated" doesn't exist in the contract
{% endstep %} {% endstepper %}
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The setter function updates storage without emitting an event, contrary to best practice for critical state changes.
Impact
This is primarily a code-quality issue; it reduces transparency and makes auditing changes harder, but does not by itself enable an attack.
What the attacker needed
Admin role required to call the setter
The fix
The function should emit an event whenever the maximum claimable periods value is updated.
How it was found
- Add a test that calls setMaxClaimablePeriods and expects an event.
- Run the tests and observe the failure because no such event exists.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Smart contracts can record events, which are like public log entries that outside programs can watch. This contract changes an important setting but does not write such a log entry, so tools that rely on logs cannot easily notice the change.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.