Skip to content

Commit

Permalink
[I-03] fix typo in _upcomingEpoch param
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-muller committed Jan 21, 2025
1 parent cbfc765 commit a19c17e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions contracts/KeyGenHistory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract KeyGenHistory is Initializable, OwnableUpgradeable, IKeyGenHistory {

/// @dev ensures that Key Generation functions are called with wrong _epoch
/// parameter to prevent old and wrong transactions get picked up.
modifier onlyUpcommingEpoch(uint256 _epoch) {
modifier onlyUpcomingEpoch(uint256 _epoch) {
if (IStakingHbbft(validatorSetContract.getStakingContract()).stakingEpoch() + 1 != _epoch) {
revert IncorrectEpoch();
}
Expand Down Expand Up @@ -137,10 +137,10 @@ contract KeyGenHistory is Initializable, OwnableUpgradeable, IKeyGenHistory {
}

function writePart(
uint256 _upcommingEpoch,
uint256 _upcomingEpoch,
uint256 _roundCounter,
bytes memory _part
) external onlyUpcommingEpoch(_upcommingEpoch) onlyCorrectRound(_roundCounter) {
) external onlyUpcomingEpoch(_upcomingEpoch) onlyCorrectRound(_roundCounter) {
// It can only be called by a new validator which is elected but not yet finalized...
// ...or by a validator which is already in the validator set.
if (!validatorSetContract.isPendingValidator(msg.sender)) {
Expand All @@ -156,10 +156,10 @@ contract KeyGenHistory is Initializable, OwnableUpgradeable, IKeyGenHistory {
}

function writeAcks(
uint256 _upcommingEpoch,
uint256 _upcomingEpoch,
uint256 _roundCounter,
bytes[] memory _acks
) external onlyUpcommingEpoch(_upcommingEpoch) onlyCorrectRound(_roundCounter) {
) external onlyUpcomingEpoch(_upcomingEpoch) onlyCorrectRound(_roundCounter) {
// It can only be called by a new validator which is elected but not yet finalized...
// ...or by a validator which is already in the validator set.
if (!validatorSetContract.isPendingValidator(msg.sender)) {
Expand Down
4 changes: 2 additions & 2 deletions contracts/TxPermissionHbbft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ contract TxPermissionHbbft is Initializable, OwnableUpgradeable, ITxPermission,
) {
//is the epoch parameter correct ?

// return if the data length is not big enough to pass a upcommingEpoch parameter.
// return if the data length is not big enough to pass a upcomingEpoch parameter.
// we could add an addition size check, that include the minimal size of the part as well.
if (_data.length < 36) {
return (NONE, false);
Expand All @@ -361,7 +361,7 @@ contract TxPermissionHbbft is Initializable, OwnableUpgradeable, ITxPermission,
validatorSetContract.getPendingValidatorKeyGenerationMode(_sender) ==
IValidatorSetHbbft.KeyGenMode.WriteAck
) {
// return if the data length is not big enough to pass a upcommingEpoch parameter.
// return if the data length is not big enough to pass a upcomingEpoch parameter.
// we could add an addition size check, that include the minimal size of the part as well.
if (_data.length < 36) {
return (NONE, false);
Expand Down
8 changes: 4 additions & 4 deletions test/KeyGenHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ describe('KeyGenHistory', () => {
// NOTE: It does not really send the transaction with 0 gas price,
// because that would only work if the network nodes would already
// run on the test contracts deployed here.
async function writePart(upcommingEpochNumber: string, round: string, parts: any, from: string) {
await keyGenHistoryPermission.callFunction('writePart', from, [upcommingEpochNumber, round, parts]);
async function writePart(upcomingEpochNumber: string, round: string, parts: any, from: string) {
await keyGenHistoryPermission.callFunction('writePart', from, [upcomingEpochNumber, round, parts]);
}

async function writeAcks(upcommingEpochNumber: string, round: string, parts: any, from: string) {
await keyGenHistoryPermission.callFunction('writeAcks', from, [upcommingEpochNumber, round, parts]);
async function writeAcks(upcomingEpochNumber: string, round: string, parts: any, from: string) {
await keyGenHistoryPermission.callFunction('writeAcks', from, [upcomingEpochNumber, round, parts]);
}

async function announceAvailability(pool: string) {
Expand Down
2 changes: 1 addition & 1 deletion test/testhelpers/Permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Permission<T extends BaseContract> {

//const numberFromContract = await txPermission._getSliceUInt256(4, asEncoded);
//const numberFromContract2 = await txPermission._decodeUInt256Param(4, asEncoded);
//console.log('upcommingEpochNumber: ', numberFromContract.toString());
//console.log('upcomingEpochNumber: ', numberFromContract.toString());
//console.log('numberFromContract2', numberFromContract2.toString());


Expand Down

0 comments on commit a19c17e

Please sign in to comment.