Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Commit 1a69eda

Browse files
committed
add arbitrum prover test
1 parent 081ae09 commit 1a69eda

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

contracts/test/ArbitrumProver.t.sol

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ contract ArbitrumProverTest is BaseTest {
2121
using Strings for address;
2222

2323
MockArbitrumProver prover;
24+
string unconfirmedState;
2425

2526
address private constant _INBOX_CONTRACT = 0xdac62f96404AB882F5a61CFCaFb0C470a19FC514;
2627

@@ -35,11 +36,13 @@ contract ArbitrumProverTest is BaseTest {
3536
string.concat(rootPath, "/test/data/invalids/ArbitrumInvalidBlockHeaders.json");
3637
string memory invalidL2StoragePath =
3738
string.concat(rootPath, "/test/data/invalids/ArbitrumInvalidL2Storage.json");
39+
string memory unconfirmedStatePath = string.concat(rootPath, "/test/data/invalids/ArbitrumUnconfirmed.json");
3840

3941
validProof = vm.readFile(path);
4042
invalidL1State = vm.readFile(invalidPath);
4143
invalidBlockHeaders = vm.readFile(invalidBlockHeadersPath);
4244
invalidL2Storage = vm.readFile(invalidL2StoragePath);
45+
unconfirmedState = vm.readFile(unconfirmedStatePath);
4346
}
4447

4548
function test_reverts_ifFinalityDelaySecondsStillInProgress() external fundAlice(_REWARD_AMOUNT) {
@@ -69,6 +72,19 @@ contract ArbitrumProverTest is BaseTest {
6972
prover.validateProof(inboxStorageKey, _INBOX_CONTRACT, attributes, abi.encode(proof));
7073
}
7174

75+
function test_reverts_ifUnconfirmed() external fundAlice(_REWARD_AMOUNT) {
76+
(string memory sourceChain, string memory sender, Message[] memory calls, bytes[] memory attributes) =
77+
_initMessage(_REWARD_AMOUNT);
78+
bytes32 messageId = _getMessageId(sourceChain, sender, calls, attributes);
79+
80+
ArbitrumProver.RIP7755Proof memory proof = _buildProof(unconfirmedState);
81+
bytes memory inboxStorageKey = _deriveStorageKey(messageId);
82+
83+
vm.prank(FILLER);
84+
vm.expectRevert(ArbitrumProver.NodeNotConfirmed.selector);
85+
prover.validateProof(inboxStorageKey, _INBOX_CONTRACT, attributes, abi.encode(proof));
86+
}
87+
7288
function test_reverts_ifInvalidRLPHeaders() external fundAlice(_REWARD_AMOUNT) {
7389
(string memory sourceChain, string memory sender, Message[] memory calls, bytes[] memory attributes) =
7490
_initMessage(_REWARD_AMOUNT);

0 commit comments

Comments
 (0)