Skip to content

chore: gas optimizations (OZ N-12) #1158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: horizon-oz2/n11-misleading-naming
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ abstract contract DataServicePausable is Pausable, DataService, IDataServicePaus
}

/// @inheritdoc IDataServicePausable
function pause() external override onlyPauseGuardian whenNotPaused {
function pause() external override onlyPauseGuardian {
_pause();
}

/// @inheritdoc IDataServicePausable
function unpause() external override onlyPauseGuardian whenPaused {
function unpause() external override onlyPauseGuardian {
_unpause();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ abstract contract DataServicePausableUpgradeable is PausableUpgradeable, DataSer
}

/// @inheritdoc IDataServicePausable
function pause() external override onlyPauseGuardian whenNotPaused {
function pause() external override onlyPauseGuardian {
_pause();
}

/// @inheritdoc IDataServicePausable
function unpause() external override onlyPauseGuardian whenPaused {
function unpause() external override onlyPauseGuardian {
_unpause();
}

Expand Down
3 changes: 2 additions & 1 deletion packages/horizon/contracts/staking/HorizonStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,9 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
* @param _tokens The amount of tokens to add to the provision
*/
function _addToProvision(address _serviceProvider, address _verifier, uint256 _tokens) private {
Provision storage prov = _provisions[_serviceProvider][_verifier];
require(_tokens != 0, HorizonStakingInvalidZeroTokens());

Provision storage prov = _provisions[_serviceProvider][_verifier];
require(prov.createdAt != 0, HorizonStakingInvalidProvision(_serviceProvider, _verifier));
uint256 tokensIdle = _getIdleStake(_serviceProvider);
require(_tokens <= tokensIdle, HorizonStakingInsufficientIdleStake(_tokens, tokensIdle));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ library LegacyAllocation {
) internal {
require(!self[allocationId].exists(), LegacyAllocationAlreadyExists(allocationId));

State memory allocation = State({ indexer: indexer, subgraphDeploymentId: subgraphDeploymentId });
self[allocationId] = allocation;
self[allocationId] = State({ indexer: indexer, subgraphDeploymentId: subgraphDeploymentId });
}

/**
Expand Down