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:storage collision in upgradable contract #245

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/blockchain/ethereum/src/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ contract StarklaneEscrow is Context {
// Mapping (collectionAddres => (tokenId => depositor)).
mapping(address => mapping(uint256 => address)) _escrow;

// Storage gaps
uint256[50] private __gap;

/**
* @notice Deposits the given tokens into escrow.
*
Expand Down Expand Up @@ -87,4 +90,8 @@ contract StarklaneEscrow is Context {
function _isEscrowed(address collection, uint256 id) internal view returns (bool) {
return _escrow[collection][id] > address(0x0);
}

}



6 changes: 6 additions & 0 deletions apps/blockchain/ethereum/src/Messaging.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ contract StarklaneMessaging is Ownable {
// The mapping mimics the Starknet messaging with a ref count like status.
mapping(bytes32 => uint256) _autoWithdrawn;

// Storage gaps
uint256[50] private __gap;

/**
*/
event MessageHashAutoWithdrawAdded(bytes32 msgHash);
Expand Down Expand Up @@ -92,4 +95,7 @@ contract StarklaneMessaging is Ownable {
revert WithdrawMethodError();
}
}

}


9 changes: 9 additions & 0 deletions apps/blockchain/ethereum/src/State.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ contract StarklaneState is Ownable {

// Bridge L2 selector to deposit token from L1.
felt252 _starklaneL2Selector;

// Storage gaps
uint256[50] private __gap;

/**
* @notice Retrieves info about Starklane L2 mapping.
Expand Down Expand Up @@ -47,4 +50,10 @@ contract StarklaneState is Ownable {
function setStarklaneL2Selector(uint256 l2Selector) public onlyOwner {
_starklaneL2Selector = Cairo.felt252Wrap(l2Selector);
}



}



3 changes: 3 additions & 0 deletions apps/blockchain/ethereum/src/UUPSProxied.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ error NotPayableError();
contract UUPSOwnableProxied is Ownable, UUPSUpgradeable {
// Mapping for implementations initialization.
mapping(address implementation => bool initialized) _initializedImpls;

// Storage gaps
uint256[50] private __gap;

// onlyInit
modifier onlyInit() {
Expand Down
3 changes: 3 additions & 0 deletions apps/blockchain/ethereum/src/token/CollectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ contract CollectionManager {
// Mapping between L1<->L2 contracts addresses.
mapping(address => snaddress) _l1ToL2Addresses;

// Storage gaps
uint256[50] private __gap;

/**
* @notice A collection has been deployed due to the
* first token being bridged from L2.
Expand Down
Loading