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

HAL-04: Add warning to HolographOperator for setUtilityToken #354

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

alexanderattar
Copy link
Contributor

Description

This simply provides a warning for an issue identified by Halborn. We would like to keep the function for now although it should never need to be called outside of a dev environment. In the super unlikely reason this would ever need to be called on production, the warning provides instructions for clearing the _bondedAmounts mapping during the migration.

The HolographOperator contract implements the function setUtilityToken():

/**
 * @notice Update the Holograph Utility Token address
 * @param utilityToken address of the Holograph Utility Token smart contract to use
 */
function setUtilityToken(address utilityToken) external onlyAdmin {
  assembly {
    sstore(_utilityTokenSlot, utilityToken)
  }
}

However, when a new utility token is set by an admin, the _bondedAmounts mapping is not reset to 0, breaking all the slashing infrastructure.

Recommendation
When a new utility token is set by an admin all the _bondedAmounts keys should be reset to 0. On the other hand, as the previous suggestion is nearly impossible to implement without very high gas costs, consinder simply removing the setUtilityToken() function.

Checklist before requesting a review

  • I have performed a self-review of my code
  • Code styles have been enforced
  • All Foundry tests are passing

@sogoiii sogoiii changed the title Add warning to HolographOperator for setUtilityToken HAL-04: Add warning to HolographOperator for setUtilityToken Aug 20, 2024
Copy link
Contributor

@sogoiii sogoiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sogoiii sogoiii merged commit 341d1e3 into develop Aug 20, 2024
3 checks passed
@sogoiii sogoiii deleted the feature/add-warning-on-set-utility-token branch August 20, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants