@ -121,10 +121,10 @@ contract ArbL2ToL1IsmTest is Test {
function test_postDispatch_revertWhen_notLastDispatchedMessage ( ) public {
deployAll ( ) ;
/ / vm . expectRevert (
/ / " AbstractMessageIdAuthHook: message not latest dispatched "
/ / ) ;
/ / hook . postDispatch ( testMetadata , encodedMessage ) ;
vm . expectRevert (
" AbstractMessageIdAuthHook: message not latest dispatched "
) ;
hook . postDispatch ( testMetadata , encodedMessage ) ;
}
function test_verify_outboxCall ( ) public {
@ -133,11 +133,14 @@ contract ArbL2ToL1IsmTest is Test {
bytes memory encodedOutboxTxMetadata = _encodeOutboxTx (
address ( hook ) ,
address ( ism ) ,
messageId
messageId ,
1 ether
) ;
vm . deal ( address ( arbBridge ) , 1 ether ) ;
arbBridge . setL2ToL1Sender ( address ( hook ) ) ;
assertTrue ( ism . verify ( encodedOutboxTxMetadata , encodedMessage ) ) ;
assertEq ( address ( testRecipient ) . balance , 1 ether ) ;
}
function test_verify_statefulVerify ( ) public {
@ -190,7 +193,8 @@ contract ArbL2ToL1IsmTest is Test {
bytes memory encodedOutboxTxMetadata = _encodeOutboxTx (
address ( hook ) ,
address ( ism ) ,
messageId
messageId ,
1 ether
) ;
vm . etch ( address ( arbBridge ) , new bytes ( 0 ) ) ; / / this is a way to test that the arbBridge isn ' t called again
@ -211,10 +215,11 @@ contract ArbL2ToL1IsmTest is Test {
bytes memory encodedOutboxTxMetadata = _encodeOutboxTx (
address ( this ) ,
address ( ism ) ,
messageId
messageId ,
0
) ;
arbBridge . setL2ToL1Sender ( address ( hook ) ) ;
arbBridge . setL2ToL1Sender ( address ( this ) ) ;
vm . expectRevert ( " ArbL2ToL1Ism: l2Sender != authorizedHook " ) ;
ism . verify ( encodedOutboxTxMetadata , encodedMessage ) ;
@ -226,7 +231,8 @@ contract ArbL2ToL1IsmTest is Test {
bytes memory encodedOutboxTxMetadata = _encodeOutboxTx (
address ( hook ) ,
address ( this ) ,
messageId
messageId ,
0
) ;
arbBridge . setL2ToL1Sender ( address ( hook ) ) ;
@ -243,7 +249,8 @@ contract ArbL2ToL1IsmTest is Test {
bytes memory encodedOutboxTxMetadata = _encodeOutboxTx (
address ( hook ) ,
address ( ism ) ,
incorrectMessageId
incorrectMessageId ,
0
) ;
bytes memory encodedHookData = abi . encodeCall (
@ -275,14 +282,13 @@ contract ArbL2ToL1IsmTest is Test {
assertFalse ( ism . verify ( new bytes ( 0 ) , encodedMessage ) ) ;
}
/ / function test_verify_withMsgValue
/* ============ helper functions ============ */
function _encodeOutboxTx (
address _hook ,
address _ism ,
bytes32 _messageId
bytes32 _messageId ,
uint256 _value
) internal view returns ( bytes memory ) {
bytes memory encodedHookData = abi . encodeCall (
AbstractMessageIdAuthorizedIsm . verifyMessageId ,
@ -299,6 +305,7 @@ contract ArbL2ToL1IsmTest is Test {
MOCK_L2_BLOCK ,
MOCK_L1_BLOCK ,
block . timestamp ,
_value ,
encodedHookData
) ;
}