Skip to content

Commit

Permalink
v2.1.2 (#292)
Browse files Browse the repository at this point in the history
* set decimals in postUpgradeInit

* more intentional function name

* comment

* call it postUpgradeInit

* add zero check

* Added post upgrade init sig

* chore: v2.1.2

---------

Co-authored-by: Henry <[email protected]>
Co-authored-by: gzeon <[email protected]>
  • Loading branch information
3 people authored Feb 5, 2025
1 parent 5c37272 commit f843905
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 9 additions & 0 deletions src/bridge/ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions test/signatures/ERC20Bridge
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"initialize(address,address)": "485cc955",
"nativeToken()": "e1758bd8",
"nativeTokenDecimals()": "ad48cb5e",
"postUpgradeInit()": "95fcea78",
"rollup()": "cb23bcb5",
"sequencerInbox()": "ee35f327",
"sequencerInboxAccs(uint256)": "16bf5579",
Expand Down

0 comments on commit f843905

Please sign in to comment.