@@ -10,69 +10,74 @@ import (
10
10
bridge_abi "scroll-tech/bridge/abi"
11
11
)
12
12
13
- func TestPackRelayMessageWithProof (t * testing.T ) {
13
+ func TestEventSignature (t * testing.T ) {
14
14
assert := assert .New (t )
15
15
16
- l1MessengerABI , err := bridge_abi .L1MessengerMetaData .GetAbi ()
16
+ assert .Equal (bridge_abi .L1SentMessageEventSignature , common .HexToHash ("104371f3b442861a2a7b82a070afbbaab748bb13757bf47769e170e37809ec1e" ))
17
+ assert .Equal (bridge_abi .L1RelayedMessageEventSignature , common .HexToHash ("4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c" ))
18
+ assert .Equal (bridge_abi .L1FailedRelayedMessageEventSignature , common .HexToHash ("99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f" ))
19
+
20
+ assert .Equal (bridge_abi .L1CommitBatchEventSignature , common .HexToHash ("2cdc615c74452778c0fb6184735e014c13aad2b62774fe0b09bd1dcc2cc14a62" ))
21
+ assert .Equal (bridge_abi .L1FinalizeBatchEventSignature , common .HexToHash ("6be443154c959a7a1645b4392b6fa97d8e8ab6e8fd853d7085e8867083737d79" ))
22
+
23
+ assert .Equal (bridge_abi .L1QueueTransactionEventSignature , common .HexToHash ("bdcc7517f8fe3db6506dfd910942d0bbecaf3d6a506dadea65b0d988e75b9439" ))
24
+
25
+ assert .Equal (bridge_abi .L2SentMessageEventSignature , common .HexToHash ("104371f3b442861a2a7b82a070afbbaab748bb13757bf47769e170e37809ec1e" ))
26
+ assert .Equal (bridge_abi .L2RelayedMessageEventSignature , common .HexToHash ("4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c" ))
27
+ assert .Equal (bridge_abi .L2FailedRelayedMessageEventSignature , common .HexToHash ("99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f" ))
28
+
29
+ assert .Equal (bridge_abi .L2ImportBlockEventSignature , common .HexToHash ("a7823f45e1ee21f9530b77959b57507ad515a14fa9fa24d262ee80e79b2b5745" ))
30
+
31
+ assert .Equal (bridge_abi .L2AppendMessageEventSignature , common .HexToHash ("faa617c2d8ce12c62637dbce76efcc18dae60574aa95709bdcedce7e76071693" ))
32
+ }
33
+
34
+ func TestPackRelayL2MessageWithProof (t * testing.T ) {
35
+ assert := assert .New (t )
36
+ l1MessengerABI , err := bridge_abi .L1ScrollMessengerMetaData .GetAbi ()
17
37
assert .NoError (err )
18
38
19
39
proof := bridge_abi.IL1ScrollMessengerL2MessageProof {
20
- BlockHeight : big .NewInt (0 ),
21
- BatchIndex : big .NewInt (0 ),
40
+ BatchHash : common.Hash {},
22
41
MerkleProof : make ([]byte , 0 ),
23
42
}
24
- _ , err = l1MessengerABI .Pack ("relayMessageWithProof" , common.Address {}, common.Address {}, big .NewInt (0 ), big .NewInt (0 ), big . NewInt ( 0 ), big . NewInt ( 0 ), make ([]byte , 0 ), proof )
43
+ _ , err = l1MessengerABI .Pack ("relayMessageWithProof" , common.Address {}, common.Address {}, big .NewInt (0 ), big .NewInt (0 ), make ([]byte , 0 ), proof )
25
44
assert .NoError (err )
26
45
}
27
46
28
47
func TestPackCommitBatch (t * testing.T ) {
29
48
assert := assert .New (t )
30
49
31
- l1RollupABI , err := bridge_abi .RollupMetaData .GetAbi ()
50
+ scrollChainABI , err := bridge_abi .ScrollChainMetaData .GetAbi ()
32
51
assert .NoError (err )
33
52
34
- txns := make ([]bridge_abi.IZKRollupLayer2Transaction , 5 )
35
- for i := 0 ; i < 5 ; i ++ {
36
- txns [i ] = bridge_abi.IZKRollupLayer2Transaction {
37
- Caller : common.Address {},
38
- Target : common.Address {},
39
- Nonce : 0 ,
40
- Gas : 0 ,
41
- GasPrice : big .NewInt (0 ),
42
- Value : big .NewInt (0 ),
43
- Data : make ([]byte , 0 ),
44
- R : big .NewInt (0 ),
45
- S : big .NewInt (0 ),
46
- V : 0 ,
47
- }
53
+ header := bridge_abi.IScrollChainBlockContext {
54
+ BlockHash : common.Hash {},
55
+ ParentHash : common.Hash {},
56
+ BlockNumber : 0 ,
57
+ Timestamp : 0 ,
58
+ BaseFee : big .NewInt (0 ),
59
+ GasLimit : 0 ,
60
+ NumTransactions : 0 ,
61
+ NumL1Messages : 0 ,
48
62
}
49
63
50
- header := bridge_abi.IZKRollupLayer2BlockHeader {
51
- BlockHash : common.Hash {},
52
- ParentHash : common.Hash {},
53
- BaseFee : big .NewInt (0 ),
54
- StateRoot : common.Hash {},
55
- BlockHeight : 0 ,
56
- GasUsed : 0 ,
57
- Timestamp : 0 ,
58
- ExtraData : make ([]byte , 0 ),
59
- Txs : txns ,
64
+ batch := bridge_abi.IScrollChainBatch {
65
+ Blocks : []bridge_abi.IScrollChainBlockContext {header },
66
+ PrevStateRoot : common.Hash {},
67
+ NewStateRoot : common.Hash {},
68
+ WithdrawTrieRoot : common.Hash {},
69
+ BatchIndex : 0 ,
70
+ L2Transactions : make ([]byte , 0 ),
60
71
}
61
72
62
- batch := bridge_abi.IZKRollupLayer2Batch {
63
- BatchIndex : 0 ,
64
- ParentHash : common.Hash {},
65
- Blocks : []bridge_abi.IZKRollupLayer2BlockHeader {header },
66
- }
67
-
68
- _ , err = l1RollupABI .Pack ("commitBatch" , batch )
73
+ _ , err = scrollChainABI .Pack ("commitBatch" , batch )
69
74
assert .NoError (err )
70
75
}
71
76
72
77
func TestPackFinalizeBatchWithProof (t * testing.T ) {
73
78
assert := assert .New (t )
74
79
75
- l1RollupABI , err := bridge_abi .RollupMetaData .GetAbi ()
80
+ l1RollupABI , err := bridge_abi .ScrollChainMetaData .GetAbi ()
76
81
assert .NoError (err )
77
82
78
83
proof := make ([]* big.Int , 10 )
@@ -86,12 +91,43 @@ func TestPackFinalizeBatchWithProof(t *testing.T) {
86
91
assert .NoError (err )
87
92
}
88
93
89
- func TestPackRelayMessage (t * testing.T ) {
94
+ func TestPackRelayL1Message (t * testing.T ) {
95
+ assert := assert .New (t )
96
+
97
+ l2MessengerABI , err := bridge_abi .L2ScrollMessengerMetaData .GetAbi ()
98
+ assert .NoError (err )
99
+
100
+ _ , err = l2MessengerABI .Pack ("relayMessage" , common.Address {}, common.Address {}, big .NewInt (0 ), big .NewInt (0 ), make ([]byte , 0 ))
101
+ assert .NoError (err )
102
+ }
103
+
104
+ func TestPackSetL1BaseFee (t * testing.T ) {
90
105
assert := assert .New (t )
91
106
92
- l2MessengerABI , err := bridge_abi .L2MessengerMetaData .GetAbi ()
107
+ l1GasOracleABI , err := bridge_abi .L1GasPriceOracleMetaData .GetAbi ()
108
+ assert .NoError (err )
109
+
110
+ baseFee := big .NewInt (2333 )
111
+ _ , err = l1GasOracleABI .Pack ("setL1BaseFee" , baseFee )
93
112
assert .NoError (err )
113
+ }
114
+
115
+ func TestPackSetL2BaseFee (t * testing.T ) {
116
+ assert := assert .New (t )
117
+
118
+ l2GasOracleABI , err := bridge_abi .L2GasPriceOracleMetaData .GetAbi ()
119
+ assert .NoError (err )
120
+
121
+ baseFee := big .NewInt (2333 )
122
+ _ , err = l2GasOracleABI .Pack ("setL2BaseFee" , baseFee )
123
+ assert .NoError (err )
124
+ }
125
+
126
+ func TestPackImportBlock (t * testing.T ) {
127
+ assert := assert .New (t )
128
+
129
+ l1BlockContainerABI := bridge_abi .L1BlockContainerABI
94
130
95
- _ , err = l2MessengerABI .Pack ("relayMessage " , common.Address {}, common. Address {}, big . NewInt ( 0 ), big . NewInt ( 0 ), big . NewInt ( 0 ), big . NewInt ( 0 ), make ([]byte , 0 ))
131
+ _ , err := l1BlockContainerABI .Pack ("importBlockHeader " , common.Hash {}, make ([]byte , 0 ), false )
96
132
assert .NoError (err )
97
133
}
0 commit comments