Skip to content

Commit

Permalink
v0.4.2 (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
nxqbao authored Jan 31, 2023
2 parents f610858 + d83102b commit 1d3f5e3
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ interface IValidatorInfo {
*/
function getBridgeOperators() external view returns (address[] memory);

/**
* @dev Returns the bridge operator list corresponding to validator address list.
*/
function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);

/**
* @dev Returns whether the address is bridge operator or not.
*/
Expand Down
2 changes: 2 additions & 0 deletions contracts/mocks/validator/MockValidatorSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ contract MockValidatorSet is IRoninValidatorSet, CandidateManager {

function getBridgeOperators() external view override returns (address[] memory) {}

function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view override returns (address[] memory) {}

function isBridgeOperator(address) external pure override returns (bool) {
return true;
}
Expand Down
7 changes: 1 addition & 6 deletions contracts/ronin/slash-indicator/CreditScore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,8 @@ abstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintena
uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)
? 0
: Math.subNonNegative(_gainCreditScore, _indicator);
uint256 _scoreBeforeGain = _creditScore[_validator];
uint256 _scoreAfterGain = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);

if (_scoreBeforeGain != _scoreAfterGain) {
_creditScore[_validator] = _scoreAfterGain;
}

_creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);
_updatedCreditScores[_i] = _creditScore[_validator];
}

Expand Down
4 changes: 1 addition & 3 deletions contracts/ronin/staking/RewardCalculation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ abstract contract RewardCalculation is IRewardPool {
_rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;
_aRps[_i - _count] = _pool.aRps += _rps;
_accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);
if (_pool.shares.inner != _stakingTotal) {
_pool.shares.inner = _stakingTotal;
}
_pool.shares.inner = _stakingTotal;
_shares[_i - _count] = _pool.shares.inner;
_poolAddrs[_i - _count] = _poolAddr;
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/ronin/validator/CoinbaseExecution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ abstract contract CoinbaseExecution is
IBridgeTracking _bridgeTracking = _bridgeTrackingContract;
uint256 _totalBridgeBallots = _bridgeTracking.totalBallots(_lastPeriod);
uint256 _totalBridgeVotes = _bridgeTracking.totalVotes(_lastPeriod);
uint256[] memory _bridgeBallots = _bridgeTracking.getManyTotalBallots(_lastPeriod, _currentValidators);
address[] memory _correspondingBridgeOperators = getBridgeOperatorsOf(_currentValidators);
uint256[] memory _bridgeBallots = _bridgeTracking.getManyTotalBallots(_lastPeriod, _correspondingBridgeOperators);
(
uint256 _missingVotesRatioTier1,
uint256 _missingVotesRatioTier2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ abstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganiz
}
}

/**
* @inheritdoc IValidatorInfo
*/
function getBridgeOperatorsOf(address[] memory _validatorAddrs)
public
view
override
returns (address[] memory _result)
{
_result = new address[](_validatorAddrs.length);
for (uint _i = 0; _i < _result.length; _i++) {
_result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);
}
}

/**
* @inheritdoc IValidatorInfo
*/
Expand Down
138 changes: 80 additions & 58 deletions deployments/ronin-testnet/RoninValidatorSetLogic.json

Large diffs are not rendered by default.

112 changes: 56 additions & 56 deletions deployments/ronin-testnet/SlashIndicatorLogic.json

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions deployments/ronin-testnet/StakingLogic.json

Large diffs are not rendered by default.

0 comments on commit 1d3f5e3

Please sign in to comment.