Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PoulavBhowmick03 committed Oct 7, 2024
1 parent 229d3dc commit 8a8858d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/blockchain/ethereum/src/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "./Messaging.sol";
import "./UUPSProxied.sol";

import "starknet/IStarknetMessaging.sol";
import "openzeppelin-contracts/contracts/proxy/utils/Initializable.sol";

import "./IStarklaneEvent.sol";

Expand Down Expand Up @@ -50,9 +51,12 @@ contract Starklane is

/**
* @notice Initializes the implementation, only callable once.
*
* @param data Data to init the implementation.
*/

constructor() {
_disableInitializers();
}

function initialize(bytes calldata data) public onlyInit {
(
address owner,
Expand Down
19 changes: 19 additions & 0 deletions apps/blockchain/ethereum/test/Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ contract BridgeTest is Test, IStarklaneEvent {
IStarklane(bridge).enableBridge(true);
}

//
function test_initializersDisabled() public {
// Deploy a new instance of Starklane
Starklane newStarklane = new Starklane();

// Try to initialize the contract directly
bytes memory initData = abi.encode(
address(this),
address(0), // Mock Starknet Core address
uint256(0), // Mock Starklane L2 address
uint256(0) // Mock Starklane L2 selector
);

// Expect the initialization to revert
vm.expectRevert("Initializable: contract is already initialized");
newStarklane.initialize(initData);
}


//
function testFail_invalidIds() public {
uint256[] memory ids = new uint256[](0);
Expand Down

0 comments on commit 8a8858d

Please sign in to comment.