Skip to content

Commit

Permalink
fix(Upgradable): improved contract id verification (#116)
Browse files Browse the repository at this point in the history
* fix(Upgradable): improved contract id verification

* revert(Implementation): preserving current bytecode

* chore(npm): version bump

(cherry picked from commit 6632513)
re1ro committed Nov 21, 2023
1 parent 771ccb1 commit 90c604c
Showing 6 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts/test/utils/TestInterchainAddressTracker.sol
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ contract TestInterchainAddressTracker is InterchainAddressTracker, Ownable {
string[] memory trustedAddresses
) Ownable(msg.sender) {
_setChainName(chainName_);

if (_CHAIN_NAME_SLOT != bytes32(uint256(keccak256('interchain-address-tracker-chain-name')) - 1))
revert Invalid();

2 changes: 1 addition & 1 deletion contracts/upgradable/Upgradable.sol
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ abstract contract Upgradable is Ownable, Implementation, IUpgradable {
bytes32 newImplementationCodeHash,
bytes calldata params
) external override onlyOwner {
if (IUpgradable(newImplementation).contractId() != IUpgradable(this).contractId())
if (IUpgradable(newImplementation).contractId() != IUpgradable(implementation()).contractId())
revert InvalidImplementation();

if (newImplementationCodeHash != newImplementation.codehash) revert InvalidCodeHash();
2 changes: 1 addition & 1 deletion contracts/utils/InterchainAddressTracker.sol
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ contract InterchainAddressTracker is IInterchainAddressTracker {

function _setChainName(string memory chainName_) internal {
StringStorage.set(_CHAIN_NAME_SLOT, chainName_);
}
}

/**
* @dev Gets the name of the chain this is deployed at
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-gmp-sdk-solidity",
"version": "5.6.2",
"version": "5.6.3",
"description": "Solidity GMP SDK and utilities provided by Axelar for cross-chain development",
"main": "index.js",
"scripts": {
4 changes: 1 addition & 3 deletions test/utils/InterchainAddressTracker.js
Original file line number Diff line number Diff line change
@@ -6,9 +6,7 @@ const { expect } = chai;
const { deployContract } = require('../utils.js');

describe('InterchainAddressTracker', () => {
let ownerWallet,
otherWallet,
interchainAddressTracker;
let ownerWallet, otherWallet, interchainAddressTracker;

const otherRemoteAddress = 'any string as an address';
const otherChain = 'Other Name';

0 comments on commit 90c604c

Please sign in to comment.