Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Feb 10, 2024
1 parent 76fef95 commit 319dc9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 54 deletions.
7 changes: 2 additions & 5 deletions packages/protocol/contracts/signal/SignalService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,16 @@ contract SignalService is EssentialContract, ISignalService {
hrr = IHopRelayRegistry(resolve("hop_relay_registry", false));
}

bytes32 stateRoot = ICrossChainSync(p.crossChainSync).getSyncedSnippet(p.height).stateRoot;
if (stateRoot == 0) revert SS_CROSS_CHAIN_SYNC_ZERO_STATE_ROOT();

// If a signal is sent from chainA -> chainB -> chainC (this chain), we verify the proofs in
// the following order:
// 1. using chainC's latest parent's stateRoot to verify that chainB's TaikoL1/TaikoL2 contract has
// 1. using chainC's latest parent's stateRoot to verify that chainB's TaikoL1/TaikoL2
// contract has
// sent a given hop stateRoot on chainB using its own signal service.
// 2. using the verified hop stateRoot to verify that the source app on chainA has sent a
// signal using its own signal service.
// We always verify the proofs in the reversed order (top to bottom).
for (uint256 i; i < p.hops.length; ++i) {
Hop memory hop = p.hops[i];
if (hop.stateRoot == stateRoot) revert SS_INVALID_HOP_PROOF();

if (!hrr.isRelayRegistered(_srcChainId, hop.chainId, hop.relay)) {
revert SS_INVALID_RELAY();
Expand Down
42 changes: 0 additions & 42 deletions packages/protocol/script/AuthorizeRemoteTaikoProtocols.s.sol

This file was deleted.

14 changes: 7 additions & 7 deletions packages/protocol/test/signal/SignalService.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,34 @@ contract TestSignalService is TaikoTest {

function test_SignalService_sendSignal_revert() public {
vm.expectRevert(SignalService.SS_INVALID_SIGNAL.selector);
relayer.sendSignal(0);
signalService.sendSignal(0);
}

function test_SignalService_isSignalSent_revert() public {
bytes32 signal = bytes32(uint256(1));
vm.expectRevert(SignalService.SS_INVALID_APP.selector);
relayer.isSignalSent(address(0), signal);
signalService.isSignalSent(address(0), signal);

signal = bytes32(uint256(0));
vm.expectRevert(SignalService.SS_INVALID_SIGNAL.selector);
relayer.isSignalSent(Alice, signal);
signalService.isSignalSent(Alice, signal);
}

function test_SignalService_sendSignal_isSignalSent() public {
vm.startPrank(Alice);
bytes32 signal = bytes32(uint256(1));
relayer.sendSignal(signal);
signalService.sendSignal(signal);

assertTrue(relayer.isSignalSent(Alice, signal));
assertTrue(signalService.isSignalSent(Alice, signal));
}

function test_SignalService_getSignalSlot() public {
vm.startPrank(Alice);
for (uint8 i = 1; i < 100; ++i) {
bytes32 signal = bytes32(block.prevrandao + i);
relayer.sendSignal(signal);
signalService.sendSignal(signal);

assertTrue(relayer.isSignalSent(Alice, signal));
assertTrue(signalService.isSignalSent(Alice, signal));
}
}

Expand Down

0 comments on commit 319dc9e

Please sign in to comment.