Getaccruedcommission returns outdated accrued commission
The getAccruedCommission function returns the stored validatorAccruedCommission value without updating it to the current timestamp, so it can return a stale or zero amount. An attacker could rely on this incorrect value, though the report does not describe a concrete exploit beyond the stale read.
Plume Network
Originally disclosed on Immunefi
51979 sc low getaccruedcommission returns outdated accrued commission
- Submitted on: Aug 6th 2025 at 23:58:13 UTC by @holydevoti0n for Attackathon | Plume Network
- Report ID: #51979
- Report Type: Smart Contract
- Severity: Low
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/ValidatorFacet.sol
Description
Vulnerability Details
To get the total amount of commission accrued per token/validator, the getAccruedCommission function from ValidatorFacet must be called. The issue is that the accrued commission value returned is outdated because the function returns the stored validatorAccruedCommission value without ensuring it is updated up to the current timestamp (updates are only triggered by some other functions like stake/unstake, etc).
Relevant code:
/**
* @notice Get the amount of commission accrued for a specific token by a validator but not yet claimed.
* @return The total accrued commission for the specified token.
*/
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
if (!$s.validatorExists[validatorId]) {
revert ValidatorDoesNotExist(validatorId);
}
if (!$s.isRewardToken[token]) {
revert TokenDoesNotExist(token);
}
return $s.validatorAccruedCommission[validatorId][token];
}
Example scenario: if a validator accrues 10 tokens in commission over 1 hour, getAccruedCommission will only return that 10 tokens if validatorAccruedCommission[validatorId][token] has been updated since the accrual. Since getAccruedCommission does not itself enforce an update, it can return 0 (or another stale value) instead of the true current accrued amount.
Impact Details
getAccruedCommission can return an incorrect (stale) amount because it does not take into account commission accrued up to the current timestamp.
Recommendation
{% hint style="info" %}
Call updateRewardPerTokenForValidator (or the appropriate updater) before returning the accrued commission so the returned value is up to date.
{% endhint %}
Suggested change:
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
if (!$s.validatorExists[validatorId]) {
revert ValidatorDoesNotExist(validatorId);
}
if (!$s.isRewardToken[token]) {
revert TokenDoesNotExist(token);
}
+ PlumeRewardLogic.updateRewardPerTokenForValidator($s, token, validatorId);
return $s.validatorAccruedCommission[validatorId][token];
}
Proof of Concept
Add the following test in PlumeStakingDiamond.t.sol:
function testAccruedCommission_returnIncorrectValue() public {
ManagementFacet managementFacet = ManagementFacet(address(diamondProxy));
RewardsFacet rewardsFacet = RewardsFacet(address(diamondProxy));
ValidatorFacet validatorFacet = ValidatorFacet(address(diamondProxy));
StakingFacet stakingFacet = StakingFacet(address(diamondProxy));
// 1. SETUP
// Create a reward token and fund the treasury.
MockPUSD rewardToken = new MockPUSD();
address token = address(rewardToken);
vm.startPrank(admin);
rewardsFacet.addRewardToken(token, 1e18, 1e24); // 0.01 rewards per second
treasury.addRewardToken(token);
rewardToken.transfer(address(treasury), 10e22);
vm.stopPrank();
vm.startPrank(validatorAdmin);
uint256 newCommission = 50e16;
ValidatorFacet(address(diamondProxy)).setValidatorCommission(
DEFAULT_VALIDATOR_ID,
newCommission
);
vm.stopPrank();
// User stakes with the default validator.
uint16 validatorId = DEFAULT_VALIDATOR_ID;
vm.prank(user1);
stakingFacet.stake{value: 100e18}(validatorId);
// 2. ACCRUE REWARDS
// Let 1 day pass to accrue rewards while the validator is active.
vm.warp(block.timestamp + 1 days);
// fetch validatorId accrued commission
uint256 accruedCommission = validatorFacet.getAccruedCommission(validatorId, token);
assertEq(accruedCommission, 0, "Should be zero");
}
Run:
forge test --mt testAccruedCommission_returnIncorrectValue --via-ir
Output:
Ran 1 test for test/PlumeStakingDiamond.t.sol:PlumeStakingDiamondTest
[PASS] testAccruedCommission_returnIncorrectValue() (gas: 1483911)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.00ms (281.50µs CPU time)
Context
The target is ValidatorFacet.sol in the Plume Network staking contracts, a facet of a Diamond (EIP-2535) staking system. Validators in this system earn commission on the rewards that flow through them, and the commission is tracked per validator and per reward token in the storage field validatorAccruedCommission[validatorId][token].
The function under review is getAccruedCommission, a public view getter that is meant to report how much commission a validator has accrued for a given token but has not yet claimed. Its docstring states exactly that: "Get the amount of commission accrued for a specific token by a validator but not yet claimed."
Setup
The report does not describe any deployment, account setup or tooling beyond the test harness. The proof of concept is a Foundry test added to PlumeStakingDiamond.t.sol, run with forge test --mt testAccruedCommission_returnIncorrectValue --via-ir. The test uses the existing fixtures of that suite: a diamondProxy address, an admin, a validatorAdmin, a treasury, a user1, a MockPUSD reward token and the constant DEFAULT_VALIDATOR_ID. The facets are reached through the diamond proxy by casting its address to ManagementFacet, RewardsFacet, ValidatorFacet and StakingFacet.
Finding it
The researcher looked at what getAccruedCommission actually returns and noticed that it reads the stored accumulator directly and returns it without first bringing it up to date. The stored value is only refreshed as a side effect of other operations, such as stake and unstake, so between those calls the getter reports whatever was last written, not what has accrued since.
The function in question:
/**
* @notice Get the amount of commission accrued for a specific token by a validator but not yet claimed.
* @return The total accrued commission for the specified token.
*/
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
if (!$s.validatorExists[validatorId]) {
revert ValidatorDoesNotExist(validatorId);
}
if (!$s.isRewardToken[token]) {
revert TokenDoesNotExist(token);
}
return $s.validatorAccruedCommission[validatorId][token];
}
The two guards only check that the validator exists and that the token is a registered reward token. After that the function returns $s.validatorAccruedCommission[validatorId][token] unchanged. Nothing in the function advances the accumulator to the current timestamp.
The researcher's example: if a validator accrues 10 tokens of commission over one hour, getAccruedCommission returns that 10 only if validatorAccruedCommission[validatorId][token] has been updated since the accrual happened. Because the getter does not enforce an update, it can return 0, or any other stale value, instead of the true current amount.
Exploitation
The proof of concept is a single Foundry test that drives the system into a state where commission has demonstrably accrued and then shows the getter returning zero.
Step 1: register and fund a reward token
The test creates a MockPUSD reward token, registers it through RewardsFacet.addRewardToken with a rate of 1e18 and a cap of 1e24 (commented as 0.01 rewards per second), registers it with the treasury, and transfers 10e22 of the token to the treasury. All of this is done as admin.
MockPUSD rewardToken = new MockPUSD();
address token = address(rewardToken);
vm.startPrank(admin);
rewardsFacet.addRewardToken(token, 1e18, 1e24); // 0.01 rewards per second
treasury.addRewardToken(token);
rewardToken.transfer(address(treasury), 10e22);
vm.stopPrank();
Step 2: set the validator commission
As validatorAdmin, the test sets the commission of DEFAULT_VALIDATOR_ID to 50e16 through setValidatorCommission.
vm.startPrank(validatorAdmin);
uint256 newCommission = 50e16;
ValidatorFacet(address(diamondProxy)).setValidatorCommission(
DEFAULT_VALIDATOR_ID,
newCommission
);
vm.stopPrank();
Step 3: stake so that rewards start flowing
user1 stakes 100e18 of native value with the default validator. This is the stake operation that puts the system into a normal working state before the getter is read.
uint16 validatorId = DEFAULT_VALIDATOR_ID;
vm.prank(user1);
stakingFacet.stake{value: 100e18}(validatorId);
Step 4: let time pass
The test warps the chain forward by one day, so rewards accrue while the validator is active and commission on those rewards accrues with them.
vm.warp(block.timestamp + 1 days);
Step 5: read the accrued commission
The test calls the getter and asserts that it returns zero.
uint256 accruedCommission = validatorFacet.getAccruedCommission(validatorId, token);
assertEq(accruedCommission, 0, "Should be zero");
Step 6: run the test
forge test --mt testAccruedCommission_returnIncorrectValue --via-ir
The output confirms the assertion holds, that is, the getter returned zero after a full day of accrual:
Ran 1 test for test/PlumeStakingDiamond.t.sol:PlumeStakingDiamondTest
[PASS] testAccruedCommission_returnIncorrectValue() (gas: 1483911)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.00ms (281.50µs CPU time)
Root cause
The commission accumulator is a stored value that is only refreshed when certain state-changing functions run. getAccruedCommission is a view function that returns the stored field without invoking the updater, so its result reflects the last write rather than the present moment. The existence and reward-token checks do not address this; they validate inputs, not freshness.
Impact
The getter can return an incorrect, stale amount because it does not account for commission accrued up to the current timestamp. In the demonstrated case it returns zero where commission has accrued. The report frames this as a low severity correctness issue: the getter can return a stale amount until some other operation refreshes the stored value. The report does not describe any path by which this stale read leads to loss of funds or to a state-changing exploit.
Fix
The recommendation is to call updateRewardPerTokenForValidator (or the appropriate updater) before returning the accrued commission, so the returned value is current. The suggested diff adds one line to the getter:
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
if (!$s.validatorExists[validatorId]) {
revert ValidatorDoesNotExist(validatorId);
}
if (!$s.isRewardToken[token]) {
revert TokenDoesNotExist(token);
}
+ PlumeRewardLogic.updateRewardPerTokenForValidator($s, token, validatorId);
return $s.validatorAccruedCommission[validatorId][token];
}
Variants to test
- Other view getters over accumulator fields. Look for
viewfunctions that return a stored reward, commission, debt or index value without first calling the corresponding update routine. A positive result is a getter whose return value does not change after time passes and rewards accrue, but does change immediately after an unrelated stake or unstake call. - Same pattern behind a diamond. In a facet-based system, check whether the updater lives in a different facet or library from the getter and was simply forgotten in the read path. A positive result is a getter that returns a stale value while the state-changing sibling functions keep the field fresh.
- Time-warp differential tests. Write a test that reads the getter, warps forward, reads again, and compares against the value obtained after forcing an update. A positive result is a mismatch between the two reads that persists until a state-changing call is made.
- Consumers of the stale value. Trace where the getter's output is used, for example in claim calculations or in UI display of claimable amounts. A positive result is a downstream calculation that under- or over-reports what a validator can actually claim.
Hunting notes
This class of bug hides in read-only accessors of accounting state: reward per token, accrued fees, pending yield, debt and index values. During recon, the signal is a getter whose docstring promises a current total ("accrued", "pending", "claimable") while the body only returns a storage slot. Grep for view functions that return accumulator mappings and check whether any updater is called before the return. The report showed impact with a minimal Foundry test: set up the reward token and commission, stake, warp one day, and assert that the getter returns zero. That is enough to demonstrate the discrepancy without needing a fund-loss scenario, which fits the low severity assigned.
What happened, in plain words
Plume Network is a blockchain project, and this report is about a small piece of its staking software. Staking means locking up cryptocurrency for a while to help run the network, and in return you earn extra cryptocurrency called rewards. In Plume, some people act as validators: they run the machinery that keeps the network going, and they take a cut of the rewards that pass through them. That cut is called a commission.
The software keeps a running tally of how much commission each validator has earned but not yet collected. There is a function, a small named piece of code that other programs can call, whose whole job is to report that tally. Its name is getAccruedCommission, and its own description says it returns the commission "accrued for a specific token by a validator but not yet claimed".
The problem is that this function does not do the arithmetic needed to bring the tally up to the present moment. It simply reads a number that was written into the system's memory the last time some other action happened, such as someone staking or unstaking. If time passes and commission keeps building up, the stored number does not move on its own. So the function can report an old figure, including zero, even though the validator has genuinely earned commission in the meantime.
This is a correctness bug in a read-only path. The report describes no loss of funds. But anyone who trusts the number, a website showing a validator their earnings, another contract, or an integration, is shown something that is not true until some unrelated action happens to refresh the stored value. That is why it was rated low severity.
Background you need first
A few ideas come up again and again below, so here they are from scratch.
Smart contracts. A smart contract is a program that lives on a blockchain. Once deployed, it runs exactly as written, and anyone can call it. It can hold money and keep records. The Plume staking system is a collection of such contracts.
A Diamond (EIP-2535). A normal smart contract has a size limit, so large systems split themselves into pieces called facets and put a single front contract, the diamond, in front of them. Users talk to the diamond's address, and the diamond forwards each call to the facet that implements it. Think of a large office with one reception desk: you always walk up to the same desk, and the receptionist sends you to the right department. In this report the front contract is referred to as diamondProxy, and the departments are ManagementFacet, RewardsFacet, ValidatorFacet and StakingFacet.
Storage. Contracts have a permanent memory area called storage. Values written there stay until something overwrites them. The commission tally lives in a storage field named validatorAccruedCommission, indexed by validator and by token, so each validator has a separate figure for each reward token.
Tokens and reward tokens. A token is a digital asset on the blockchain. A reward token is one the system has been told to pay rewards in. The system keeps a list of which tokens count, and refuses to talk about any other token.
Validators and commission. A validator is an operator in the staking system. Commission is the validator's share of the rewards. It builds up continuously as time passes and rewards flow, but the system only recalculates and stores the figure when certain actions run.
A view function. A view function is one that promises not to change anything on the blockchain. It only reads. Because it cannot write, it cannot update the stored tally either. That is the heart of this bug.
Accrued. Accrued means earned over time but not yet paid out. "Accrued commission" is therefore "commission earned so far and still owed".
Foundry and forge test. Foundry is a toolkit for writing and running tests against smart contracts on a simulated blockchain on your own computer. forge test runs those tests. A test sets up a situation, performs actions, and then checks that the results are what the author expects.
vm.warp. In Foundry tests, vm.warp jumps the simulated blockchain's clock forward. It is how a test pretends that a day has passed without actually waiting a day.
vm.prank and vm.startPrank. These make the next call (or the calls until vm.stopPrank) appear to come from a particular account. They are how a test acts as the administrator, or as an ordinary user, without real logins.
assertEq. A test assertion that two values are equal. If they are not, the test fails. Here the researcher deliberately asserts that the reported commission is zero, because that is the wrong answer the bug produces.
The target
The file under review is ValidatorFacet.sol, one facet of the staking diamond. The function in question is reproduced in full below.
/**
* @notice Get the amount of commission accrued for a specific token by a validator but not yet claimed.
* @return The total accrued commission for the specified token.
*/
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
if (!$s.validatorExists[validatorId]) {
revert ValidatorDoesNotExist(validatorId);
}
if (!$s.isRewardToken[token]) {
revert TokenDoesNotExist(token);
}
return $s.validatorAccruedCommission[validatorId][token];
}
Line by line:
- The comment block at the top is the function's own promise to callers: it says it returns the commission accrued for a token by a validator and not yet claimed.
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256)declares the function. It takes two inputs: a validator identifier (a small number) and a token address (where that token lives on the blockchain). It ispublic, so anyone can call it, andview, so it promises only to read. It returns a whole number, the amount.PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();fetches a handle to the system's shared storage area, so the rest of the function can look things up there.- The first
ifchecks that the validator exists. If it does not, the function stops with an error,ValidatorDoesNotExist. - The second
ifchecks that the token is a registered reward token. If not, it stops withTokenDoesNotExist. - The final line returns the stored commission figure for that validator and token, exactly as it sits in storage.
The two checks are about whether the inputs make sense. Neither of them, and nothing else in the function, brings the stored figure up to the current time. The function reads the last written value and hands it back.
Why the number goes stale
The stored commission is refreshed only as a side effect of other operations, such as staking and unstaking. Between those operations, the stored value stays where it was. A view function cannot write, so it cannot refresh anything. The result is that the getter reports the last write, not the present moment.
The researcher's example makes it concrete: suppose a validator earns 10 tokens of commission over one hour. getAccruedCommission returns that 10 only if the stored figure has been updated since the earning happened. Because the getter does not force an update, it can return 0, or any other out-of-date value, instead of the true current amount.
Proving it with a test
The proof of concept is one Foundry test added to the existing test file PlumeStakingDiamond.t.sol. It uses the accounts and helpers that file already provides: diamondProxy (the front contract), admin, validatorAdmin, treasury, user1, a mock reward token called MockPUSD, and a constant DEFAULT_VALIDATOR_ID. The facets are reached by taking the diamond's address and treating it as each facet in turn, which is how the diamond forwarding works in practice.
The whole test:
function testAccruedCommission_returnIncorrectValue() public {
ManagementFacet managementFacet = ManagementFacet(address(diamondProxy));
RewardsFacet rewardsFacet = RewardsFacet(address(diamondProxy));
ValidatorFacet validatorFacet = ValidatorFacet(address(diamondProxy));
StakingFacet stakingFacet = StakingFacet(address(diamondProxy));
// 1. SETUP
// Create a reward token and fund the treasury.
MockPUSD rewardToken = new MockPUSD();
address token = address(rewardToken);
vm.startPrank(admin);
rewardsFacet.addRewardToken(token, 1e18, 1e24); // 0.01 rewards per second
treasury.addRewardToken(token);
rewardToken.transfer(address(treasury), 10e22);
vm.stopPrank();
vm.startPrank(validatorAdmin);
uint256 newCommission = 50e16;
ValidatorFacet(address(diamondProxy)).setValidatorCommission(
DEFAULT_VALIDATOR_ID,
newCommission
);
vm.stopPrank();
// User stakes with the default validator.
uint16 validatorId = DEFAULT_VALIDATOR_ID;
vm.prank(user1);
stakingFacet.stake{value: 100e18}(validatorId);
// 2. ACCRUE REWARDS
// Let 1 day pass to accrue rewards while the validator is active.
vm.warp(block.timestamp + 1 days);
// fetch validatorId accrued commission
uint256 accruedCommission = validatorFacet.getAccruedCommission(validatorId, token);
assertEq(accruedCommission, 0, "Should be zero");
}
What each part does, in order:
- The first four lines create four handles, one per facet, all pointing at the same
diamondProxyaddress. This is the reception-desk idea in code: one address, several departments. MockPUSD rewardToken = new MockPUSD();creates a fresh test token to act as the reward currency.address token = address(rewardToken);records where it lives.vm.startPrank(admin);makes everything untilvm.stopPrank()happen as the administrator.rewardsFacet.addRewardToken(token, 1e18, 1e24);tells the system that this token is a reward token, with a rate and a cap. The comment says the rate works out to 0.01 rewards per second.treasury.addRewardToken(token);registers the token with the treasury, the pot that pays rewards.rewardToken.transfer(address(treasury), 10e22);puts a supply of the token into the treasury so there is something to pay out.vm.stopPrank();ends the administrator impersonation.vm.startPrank(validatorAdmin);now acts as the validator's administrator.uint256 newCommission = 50e16;sets the commission rate to be applied.setValidatorCommission(DEFAULT_VALIDATOR_ID, newCommission)applies that rate to the default validator.vm.stopPrank();ends that impersonation.uint16 validatorId = DEFAULT_VALIDATOR_ID;remembers which validator we are dealing with.vm.prank(user1);makes only the next call come from an ordinary user.stakingFacet.stake{value: 100e18}(validatorId);has that user stake an amount with the validator. This stakes an amount with the validator, putting the system into a normal working state before the getter is read.vm.warp(block.timestamp + 1 days);jumps the simulated clock forward one day, so rewards and the validator's commission on them build up while the validator is active.uint256 accruedCommission = validatorFacet.getAccruedCommission(validatorId, token);calls the function under review and stores what it says.assertEq(accruedCommission, 0, "Should be zero");asserts that the answer is zero. This looks odd at first: the test passes when the function gives the wrong answer. That is the point. After a full day of accrual the correct figure should be positive, and the test proves the function instead reports zero.
Running it
The test is run with this command:
forge test --mt testAccruedCommission_returnIncorrectValue --via-ir
--mt selects the test by name, so only this one runs. --via-ir asks the compiler to use its newer compilation pipeline.
The output:
Ran 1 test for test/PlumeStakingDiamond.t.sol:PlumeStakingDiamondTest
[PASS] testAccruedCommission_returnIncorrectValue() (gas: 1483911)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.00ms (281.50µs CPU time)
The [PASS] line confirms the assertion held: after a day of accrual, the getter returned zero. Gas here is the simulated cost of running the test, and the timing figures are just how long the test took.
Root cause
The commission figure is a stored value that is only refreshed when certain state-changing functions run. getAccruedCommission is a view function that returns the stored field without invoking the updater, so its result reflects the last write rather than the present moment. The existence and reward-token checks do not help here: they validate the inputs, not the freshness of the number.
Impact
The getter can return an incorrect, out-of-date amount because it does not account for commission accrued up to the current timestamp. In the demonstrated case it returns zero where commission has accrued. The getter can return a figure that does not match the true accrued commission until some other operation refreshes the stored value. The report does not describe any path by which this stale read leads to loss of funds or to a state-changing exploit.
The fix
The recommendation is to call updateRewardPerTokenForValidator (or the appropriate updater) before returning the accrued commission, so the returned value is current. The suggested change adds one line to the getter:
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
if (!$s.validatorExists[validatorId]) {
revert ValidatorDoesNotExist(validatorId);
}
if (!$s.isRewardToken[token]) {
revert TokenDoesNotExist(token);
}
+ PlumeRewardLogic.updateRewardPerTokenForValidator($s, token, validatorId);
return $s.validatorAccruedCommission[validatorId][token];
}
The + line is the addition: before reading the stored figure, run the updater so the figure is brought up to date. The report does not state whether this change was applied.
Variants to test
- Other read-only getters over stored totals. Look for
viewfunctions that return a stored reward, commission, debt or index value without first calling the corresponding update routine. A positive result is a getter whose return value does not change after time passes and rewards accrue, but does change immediately after an unrelated stake or unstake call. - The same pattern behind a diamond. In a facet-based system, check whether the updater lives in a different facet or library from the getter and was simply forgotten in the read path. A positive result is a getter that returns a stale value while the state-changing sibling functions keep the field fresh.
- Time-warp differential tests. Write a test that reads the getter, warps forward, reads again, and compares against the value obtained after forcing an update. A positive result is a mismatch between the two reads that persists until a state-changing call is made.
- Consumers of the stale value. Trace where the getter's output is used, for example in claim calculations or in a website display of claimable amounts. A positive result is a downstream calculation that under- or over-reports what a validator can actually claim.
Hunting notes
This class of bug hides in read-only accessors of accounting state: reward per token, accrued fees, pending yield, debt and index values. During recon, the signal is a getter whose description promises a current total ("accrued", "pending", "claimable") while the body only returns a storage slot. Search for view functions that return stored totals and check whether any updater is called before the return. The report showed impact with a minimal Foundry test: set up the reward token and commission, stake, warp one day, and assert that the getter returns zero. That is enough to demonstrate the discrepancy without needing a fund-loss scenario, which fits the low severity assigned.
Glossary
- Smart contract: a program deployed on a blockchain that runs exactly as written and can be called by anyone.
- Blockchain: a shared, tamper-resistant record of transactions maintained by many computers.
- Staking: locking cryptocurrency for a period to support a network and earn rewards.
- Rewards: extra cryptocurrency paid for staking.
- Validator: an operator in the staking system who helps run the network and earns a share of rewards.
- Commission: the validator's cut of the rewards that flow through it.
- Accrued: earned over time but not yet paid out.
- Function: a named block of code that can be called with inputs and returns an output.
- Getter: a function whose only job is to read and return a value.
viewfunction: a function that promises not to change anything on the blockchain; it can only read.- Diamond (EIP-2535): a design where one front contract forwards calls to several smaller contracts called facets.
- Facet: one module of a diamond, holding part of the system's functions.
diamondProxy: the front contract address that users and tests call; it forwards to the right facet.- Storage: a contract's permanent memory, where values stay until overwritten.
- Token: a digital asset on a blockchain.
- Reward token: a token the system has been told to pay rewards in.
- Treasury: the pot of funds from which rewards are paid.
- Accumulator: a stored running total that is updated when certain operations run.
- Stale value: an out-of-date value that has not been refreshed since it was last written.
- Timestamp: the recorded time of a block, used by contracts to reason about time.
- Foundry: a toolkit for writing and running smart contract tests on a simulated blockchain.
forge test: the Foundry command that runs tests.- Test assertion (
assertEq): a check in a test that two values are equal; if not, the test fails. vm.warp: a Foundry test helper that jumps the simulated clock forward.vm.prank/vm.startPrank: Foundry test helpers that make calls appear to come from a chosen account.- Mock token (
MockPUSD): a stand-in token created for testing. - Gas: the cost, in computational effort, of running code on a blockchain or in a simulated test.
- Severity: how serious a bug is judged to be; this report is rated low.
- Root cause: the underlying reason a bug exists, as opposed to its visible symptom.
- Proof of concept: a concrete demonstration, here a test, that shows the bug actually happens.
- Differential test: a test that compares two readings or two paths to expose a discrepancy.
- Recon: the exploratory phase of a security review, looking around a codebase for suspicious patterns.