Skip to content
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

Function issues: naming, exposing and params #50

Closed
ducthotran2010 opened this issue Nov 4, 2022 · 6 comments · Fixed by #77 or #80
Closed

Function issues: naming, exposing and params #50

ducthotran2010 opened this issue Nov 4, 2022 · 6 comments · Fixed by #77 or #80

Comments

@ducthotran2010
Copy link
Contributor

function _setPrioritizedValidatorNumber(uint256 _number) internal {

    I can't see public corresponding function of this.

Originally posted by @minh-bq in #22 (comment)

@ducthotran2010 ducthotran2010 changed the title Expose functions Function issue: exposing and params Nov 4, 2022
@ducthotran2010
Copy link
Contributor Author

function bulkJailed(address[] memory _addrList) external view override returns (bool[] memory _result) {

function miningRewardDeprecatedAtPeriod(address[] memory _blockProducers, uint256 _period)

The memory params can be set to calldata to save gas

@ducthotran2010
Copy link
Contributor Author

      I can't see public corresponding function of this.

Originally posted by @minh-bq in #22 (comment)

/**
* @dev Sets the bonus amount per block for block producer.
*
* Emits the event `BlockProducerBonusPerBlockUpdated`.
*
*/
function _setBlockProducerBonusPerBlock(uint256 _amount) internal {
_blockProducerBonusPerBlock = _amount;
emit BlockProducerBonusPerBlockUpdated(_amount);
}
/**
* @dev Sets the bonus amount per block for bridge operator.
*
* Emits the event `BridgeOperatorBonusPerBlockUpdated`.
*
*/
function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {
_bridgeOperatorBonusPerBlock = _amount;
emit BridgeOperatorBonusPerBlockUpdated(_amount);
}

@ducthotran2010
Copy link
Contributor Author

ducthotran2010 commented Nov 4, 2022

function deductStakedAmount(address _consensusAddr, uint256 _amount) public onlyValidatorContract {

The public key can be set to external since no function in the contract call it #22 (comment)

@ducthotran2010
Copy link
Contributor Author

ducthotran2010 commented Nov 4, 2022

Since we have some functions proceeding the pool in batch, we should indicate the specific pool that is not exist. We could use string.concat() for adding the address of pool in the revert message.

Originally posted by @nxqbao in #22 (comment)

require(_validatorContract.isValidatorCandidate(_poolAddr), "StakingManager: query for non-existent pool");

Suggestion: Using String lib from OZ
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/7201e6707f6631d9499a569f492870ebdd4133cf/contracts/utils/Strings.sol#L64-L69

    if(!_validatorContract.isValidatorCandidate(_poolAddr)) {
      revert(string(abi.encodePacked(
        "StakingManager: query for non-existent pool ",
        Strings.toHexString(_poolAddr)
      )));
    }

@ducthotran2010 ducthotran2010 changed the title Function issue: exposing and params Function issues: naming, exposing and params Nov 4, 2022
@ducthotran2010
Copy link
Contributor Author

@ducthotran2010
Copy link
Contributor Author

  function _beforeClaimReward(address _poolAddr, address _user) internal returns (uint256 _amount) {

Originally posted by @ducthotran2010 in #22 (comment)

function _claimReward(address _poolAddr, address _user) internal returns (uint256 _amount) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants