diff --git a/package.json b/package.json index 76354ea70..43ce82fb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@arbitrum/nitro-contracts", - "version": "2.1.1", + "version": "2.1.2", "description": "Layer 2 precompiles and rollup for Arbitrum Nitro", "author": "Offchain Labs, Inc.", "license": "BUSL-1.1", diff --git a/src/bridge/ERC20Bridge.sol b/src/bridge/ERC20Bridge.sol index d2d3bffc2..727c3a7fd 100644 --- a/src/bridge/ERC20Bridge.sol +++ b/src/bridge/ERC20Bridge.sol @@ -62,6 +62,15 @@ contract ERC20Bridge is AbsBridge, IERC20Bridge { } } + /// @notice When upgrading a custom fee chain from v1.x.x to v2.1.2, nativeTokenDecimals must be set to 18. + /// This is because v1.x.x contracts assume 18 decimals, but the ERC20Bridge does not have the decimals set in storage. + function postUpgradeInit() external onlyDelegated onlyProxyOwner { + // this zero check might save you from accidentally upgrading from v2.x.x to v2.1.2 + // it will not save you if your native token is supposed to have 0 decimals + require(nativeTokenDecimals == 0, "NONZERO_NATIVE_TOKEN_DECIMALS"); + nativeTokenDecimals = 18; + } + /// @inheritdoc IERC20Bridge function enqueueDelayedMessage( uint8 kind, diff --git a/test/signatures/ERC20Bridge b/test/signatures/ERC20Bridge index f7839312f..b47e657b7 100644 --- a/test/signatures/ERC20Bridge +++ b/test/signatures/ERC20Bridge @@ -13,6 +13,7 @@ "initialize(address,address)": "485cc955", "nativeToken()": "e1758bd8", "nativeTokenDecimals()": "ad48cb5e", + "postUpgradeInit()": "95fcea78", "rollup()": "cb23bcb5", "sequencerInbox()": "ee35f327", "sequencerInboxAccs(uint256)": "16bf5579",