Skip to content

Commit

Permalink
fix: DendrETHAdapter compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimo99 committed Aug 20, 2024
1 parent d994739 commit fdc7640
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions packages/evm/contracts/adapters/DendrETH/DendrETHAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ contract DendrETHAdapter is BlockHashAdapter {
bytes32 _blockHash,
bytes32[] calldata _blockHashProof
) external {
if (!SSZ.verifySlot(_slot, _slotProof, _finalizedBlockHeader)) {
revert InvalidSlot();
}

if (!SSZ.verifyBlockNumber(_blockNumber, _blockNumberProof, _finalizedBlockHeader)) {
revert InvalidBlockNumberProof();
}

if (!SSZ.verifyBlockHash(_blockHash, _blockHashProof, _finalizedBlockHeader)) {
revert InvalidBlockHashProof();
}

ILightClient lightClient = ILightClient(DENDRETH);

uint256 currentIndex = lightClient.currentIndex();
Expand All @@ -50,22 +62,10 @@ contract DendrETHAdapter is BlockHashAdapter {
} while (i != currentIndex);

if (!found) {
revert BlockHeaderNotAvailable(slot);
}

if (!SSZ.verifySlot(_slot, _slotProof, _finalizedBlockHeader)) {
revert InvalidSlot();
}

if (!SSZ.verifyBlockNumber(_blockNumber, _blockNumberProof, _finalizedBlockHeader)) {
revert InvalidBlockNumberProof();
}

if (!SSZ.verifyBlockHash(_blockHash, _blockHashProof, _finalizedBlockHeader)) {
revert InvalidBlockHashProof();
revert BlockHeaderNotAvailable(_slot);
}

_storeHash(SOURCE_CHAIN_ID, blockNumber, blockHash);
_storeHash(SOURCE_CHAIN_ID, _blockNumber, _blockHash);
}

/// @notice Updates DendrETH Light client and stores the given block
Expand All @@ -82,8 +82,6 @@ contract DendrETHAdapter is BlockHashAdapter {
) external {
ILightClient lightClient = ILightClient(DENDRETH);

lightClient.light_client_update(update);

bytes32 finalizedHeaderRoot = lightClient.finalizedHeaderRoot();

if (!SSZ.verifySlot(_slot, _slotProof, finalizedHeaderRoot)) {
Expand All @@ -98,6 +96,8 @@ contract DendrETHAdapter is BlockHashAdapter {
revert InvalidBlockHashProof();
}

_storeHash(SOURCE_CHAIN_ID, blockNumber, blockHash);
lightClient.light_client_update(update);

_storeHash(SOURCE_CHAIN_ID, _blockNumber, _blockHash);
}
}

0 comments on commit fdc7640

Please sign in to comment.