Skip to content

Commit

Permalink
Add gaps and _disableInitializers call in Bridge.sol (#3)
Browse files Browse the repository at this point in the history
* Added gaps and _disableInitializers call in Bridge.sol
  • Loading branch information
KyrylR authored Nov 21, 2024
1 parent 88447c2 commit bdd6417
Show file tree
Hide file tree
Showing 14 changed files with 3,402 additions and 2,648 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Bug Report
description: File a bug report
labels: ['bug']
assignees:
- Arvolear
assignees:
- arvolear
body:
- type: markdown
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Feature request
description: Suggest a new feature
labels: ['feature']
assignees:
- Arvolear
assignees:
- arvolear
body:
- type: textarea
id: feature-description
Expand Down
4 changes: 1 addition & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: setup

description: setup

runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16.18.x"
node-version: "20.18.x"
cache: npm
- name: Install packages
run: npm install
Expand Down
7 changes: 7 additions & 0 deletions contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ contract Bridge is
ERC1155Handler,
NativeHandler
{
/**
* @dev Disables the ability to call initializers.
*/
constructor() {
_disableInitializers();
}

function __Bridge_init(
address[] calldata signers_,
uint256 signaturesThreshold_
Expand Down
7 changes: 7 additions & 0 deletions contracts/handlers/ERC1155Handler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import {IERC1155MintableBurnable} from "../interfaces/tokens/IERC1155MintableBur
* @title ERC1155Handler
*/
abstract contract ERC1155Handler is IERC1155Handler, ERC1155Holder {
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;

/**
* @inheritdoc IERC1155Handler
*/
Expand Down
7 changes: 7 additions & 0 deletions contracts/handlers/ERC20Handler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ import {IERC20MintableBurnable} from "../interfaces/tokens/IERC20MintableBurnabl
abstract contract ERC20Handler is IERC20Handler {
using SafeERC20 for IERC20MintableBurnable;

/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;

/**
* @inheritdoc IERC20Handler
*/
Expand Down
7 changes: 7 additions & 0 deletions contracts/handlers/ERC721Handler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import {IERC721MintableBurnable} from "../interfaces/tokens/IERC721MintableBurna
* @title ERC721Handler
*/
abstract contract ERC721Handler is IERC721Handler, ERC721Holder {
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;

/**
* @inheritdoc IERC721Handler
*/
Expand Down
7 changes: 7 additions & 0 deletions contracts/handlers/NativeHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import {INativeHandler} from "../interfaces/handlers/INativeHandler.sol";
* @title NativeHandler
*/
abstract contract NativeHandler is INativeHandler {
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;

receive() external payable {}

/**
Expand Down
7 changes: 7 additions & 0 deletions contracts/utils/Hashes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ pragma solidity ^0.8.9;
abstract contract Hashes {
mapping(bytes32 => bool) public usedHashes; // keccak256(txHash . txNonce) => is used

/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;

function containsHash(bytes32 txHash_, uint256 txNonce_) external view returns (bool) {
bytes32 nonceHash_ = keccak256(abi.encodePacked(txHash_, txNonce_));

Expand Down
7 changes: 7 additions & 0 deletions contracts/utils/Signers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ abstract contract Signers is OwnableUpgradeable {

EnumerableSet.AddressSet internal _signers;

/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;

function __Signers_init(
address[] calldata signers_,
uint256 signaturesThreshold_
Expand Down
Loading

0 comments on commit bdd6417

Please sign in to comment.