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

fix: EVM-708 bridge fixes #703

Merged
merged 19 commits into from
Aug 16, 2024
13 changes: 13 additions & 0 deletions l1-contracts/contracts/bridgehub/Bridgehub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,19 @@ contract Bridgehub is IBridgehub, ReentrancyGuard, Ownable2StepUpgradeable, Paus
require(token != address(0), "BH: token not set");
baseTokenAssetId[_chainId] = DataEncoding.encodeNTVAssetId(block.chainid, token);
Copy link
Collaborator

@StanislavBreadless StanislavBreadless Aug 15, 2024

Choose a reason for hiding this comment

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

should be checked that the chain does not yet have the base token asset id set.

Probably reverting in case the token is set is too much (since the method is public and be frontrun), but at least not overwriting the base token should be done in case some chains have custom asset handler for base token

}

/// @notice Used to set the legacy chain address for the upgrade.
/// @notice This has to be used after the BH but before the STM is upgraded.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the comment is not correct, it has to be used after STM is upgraded, since getHyperchainLegacy is available only on the new one

/// @param _chainId The chainId of the legacy chain we are migrating.
function setLegacyChainAddress(uint256 _chainId) external {
address stm = stateTransitionManager[_chainId];
require(stm != address(0), "BH: chain not legacy");
require(!hyperchainMap.contains(_chainId), "BH: chain already migrated");
/// Note we have to do this before STM is upgraded.
address chainAddress = IStateTransitionManager(stm).getHyperchainLegacy(_chainId);
require(chainAddress != address(0), "BH: chain not legacy 2");
_registerNewHyperchain(_chainId, chainAddress);
}

//// Registry

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.