Skip to content

Commit

Permalink
Undo last commit
Browse files Browse the repository at this point in the history
This reverts commit a40ff77.
  • Loading branch information
MaxMustermann2 committed Jun 28, 2024
1 parent a40ff77 commit c07dad7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 35 deletions.
6 changes: 2 additions & 4 deletions src/core/BootstrapLzReceiver.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
pragma solidity ^0.8.19;

import {OAppReceiverUpgradeable, Origin} from "../lzApp/OAppReceiverUpgradeable.sol";

import {BootstrapStorage} from "../storage/BootstrapStorage.sol";
import {GatewayStorage} from "../storage/GatewayStorage.sol";
import {PausableUpgradeable} from "@openzeppelin-upgradeable/contracts/utils/PausableUpgradeable.sol";

abstract contract BootstrapLzReceiver is PausableUpgradeable, OAppReceiverUpgradeable, BootstrapStorage {
Expand Down Expand Up @@ -37,10 +35,10 @@ abstract contract BootstrapLzReceiver is PausableUpgradeable, OAppReceiverUpgrad
public
view
virtual
override(GatewayStorage, OAppReceiverUpgradeable)
override(OAppReceiverUpgradeable)
returns (uint64)
{
return GatewayStorage.nextNonce(srcEid, sender);
return inboundNonce[srcEid][sender] + 1;
}

}
13 changes: 0 additions & 13 deletions src/core/ClientChainGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ import {OAppReceiverUpgradeable} from "../lzApp/OAppReceiverUpgradeable.sol";
import {MessagingFee, OAppSenderUpgradeable} from "../lzApp/OAppSenderUpgradeable.sol";

import {ClientChainGatewayStorage} from "../storage/ClientChainGatewayStorage.sol";

import {GatewayStorage} from "../storage/GatewayStorage.sol";
import {ClientGatewayLzReceiver} from "./ClientGatewayLzReceiver.sol";
import {LSTRestakingController} from "./LSTRestakingController.sol";
import {NativeRestakingController} from "./NativeRestakingController.sol";

import {IOAppCore} from "@layerzero-v2/oapp/contracts/oapp/interfaces/IOAppCore.sol";
import {OptionsBuilder} from "@layerzero-v2/oapp/contracts/oapp/libs/OptionsBuilder.sol";
import {ILayerZeroReceiver} from "@layerzero-v2/protocol/contracts/interfaces/ILayerZeroReceiver.sol";
import {OwnableUpgradeable} from "@openzeppelin-upgradeable/contracts/access/OwnableUpgradeable.sol";
import {Initializable} from "@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol";
import {PausableUpgradeable} from "@openzeppelin-upgradeable/contracts/utils/PausableUpgradeable.sol";
Expand Down Expand Up @@ -170,14 +167,4 @@ contract ClientChainGateway is
return (SENDER_VERSION, RECEIVER_VERSION);
}

function nextNonce(uint32 srcEid, bytes32 sender)
public
view
virtual
override(ClientGatewayLzReceiver, GatewayStorage, ILayerZeroReceiver)
returns (uint64)
{
return GatewayStorage.nextNonce(srcEid, sender);
}

}
6 changes: 2 additions & 4 deletions src/core/ClientGatewayLzReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ pragma solidity ^0.8.19;
import {IExoCapsule} from "../interfaces/IExoCapsule.sol";
import {IVault} from "../interfaces/IVault.sol";
import {OAppReceiverUpgradeable, Origin} from "../lzApp/OAppReceiverUpgradeable.sol";

import {ClientChainGatewayStorage} from "../storage/ClientChainGatewayStorage.sol";
import {GatewayStorage} from "../storage/GatewayStorage.sol";

import {PausableUpgradeable} from "@openzeppelin-upgradeable/contracts/utils/PausableUpgradeable.sol";

Expand Down Expand Up @@ -71,10 +69,10 @@ abstract contract ClientGatewayLzReceiver is PausableUpgradeable, OAppReceiverUp
public
view
virtual
override(GatewayStorage, OAppReceiverUpgradeable)
override(OAppReceiverUpgradeable)
returns (uint64)
{
return GatewayStorage.nextNonce(srcEid, sender);
return inboundNonce[srcEid][sender] + 1;
}

function afterReceiveDepositResponse(bytes memory requestPayload, bytes calldata responsePayload)
Expand Down
8 changes: 2 additions & 6 deletions src/core/ExocoreGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import {
OAppUpgradeable,
Origin
} from "../lzApp/OAppUpgradeable.sol";

import {ExocoreGatewayStorage} from "../storage/ExocoreGatewayStorage.sol";
import {GatewayStorage} from "../storage/GatewayStorage.sol";

import {OAppCoreUpgradeable} from "../lzApp/OAppCoreUpgradeable.sol";
import {IOAppCore} from "@layerzero-v2/oapp/contracts/oapp/interfaces/IOAppCore.sol";
Expand Down Expand Up @@ -346,12 +344,10 @@ contract ExocoreGateway is
public
view
virtual
// since there are 3 contracts with this function, it must be defined so that
// the compiler knows which one to call
override(GatewayStorage, ILayerZeroReceiver, OAppReceiverUpgradeable)
override(ILayerZeroReceiver, OAppReceiverUpgradeable)
returns (uint64)
{
return GatewayStorage.nextNonce(srcEid, sender);
return inboundNonce[srcEid][sender] + 1;
}

}
4 changes: 0 additions & 4 deletions src/storage/GatewayStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,4 @@ contract GatewayStorage {
inboundNonce[srcChainId][srcAddress] = nonce;
}

function nextNonce(uint32 srcEid, bytes32 sender) public view virtual returns (uint64) {
return inboundNonce[srcEid][sender] + 1;
}

}
6 changes: 2 additions & 4 deletions test/mocks/ExocoreGatewayMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import {
OAppUpgradeable,
Origin
} from "src/lzApp/OAppUpgradeable.sol";

import {ExocoreGatewayStorage} from "src/storage/ExocoreGatewayStorage.sol";
import {GatewayStorage} from "src/storage/GatewayStorage.sol";

import {IOAppCore} from "@layerzero-v2/oapp/contracts/oapp/interfaces/IOAppCore.sol";
import {OptionsBuilder} from "@layerzero-v2/oapp/contracts/oapp/libs/OptionsBuilder.sol";
Expand Down Expand Up @@ -337,10 +335,10 @@ contract ExocoreGatewayMock is
public
view
virtual
override(GatewayStorage, ILayerZeroReceiver, OAppReceiverUpgradeable)
override(ILayerZeroReceiver, OAppReceiverUpgradeable)
returns (uint64)
{
return GatewayStorage.nextNonce(srcEid, sender);
return inboundNonce[srcEid][sender] + 1;
}

}

0 comments on commit c07dad7

Please sign in to comment.