@@ -111,35 +111,54 @@ contract SequencerInbox is GasRefundEnabled, ISequencerInbox {
111
111
112
112
function getTimeBounds () internal view virtual returns (IBridge.TimeBounds memory ) {
113
113
IBridge.TimeBounds memory bounds;
114
- ISequencerInbox.MaxTimeVariation memory maxTimeVariation_ = maxTimeVariation ();
115
- if (block .timestamp > maxTimeVariation_.delaySeconds) {
116
- bounds.minTimestamp = uint64 (block .timestamp - maxTimeVariation_.delaySeconds);
114
+ (
115
+ uint256 delayBlocks_ ,
116
+ uint256 futureBlocks_ ,
117
+ uint256 delaySeconds_ ,
118
+ uint256 futureSeconds_
119
+ ) = maxTimeVariationInternal ();
120
+ if (block .timestamp > delaySeconds_) {
121
+ bounds.minTimestamp = uint64 (block .timestamp - delaySeconds_);
117
122
}
118
- bounds.maxTimestamp = uint64 (block .timestamp + maxTimeVariation_.futureSeconds );
119
- if (block .number > maxTimeVariation_.delayBlocks ) {
120
- bounds.minBlockNumber = uint64 (block .number - maxTimeVariation_.delayBlocks );
123
+ bounds.maxTimestamp = uint64 (block .timestamp + futureSeconds_ );
124
+ if (block .number > delayBlocks_ ) {
125
+ bounds.minBlockNumber = uint64 (block .number - delayBlocks_ );
121
126
}
122
- bounds.maxBlockNumber = uint64 (block .number + maxTimeVariation_.futureBlocks );
127
+ bounds.maxBlockNumber = uint64 (block .number + futureBlocks_ );
123
128
return bounds;
124
129
}
125
130
126
131
function maxTimeVariation () public view returns (ISequencerInbox.MaxTimeVariation memory ) {
132
+ (
133
+ uint256 delayBlocks_ ,
134
+ uint256 futureBlocks_ ,
135
+ uint256 delaySeconds_ ,
136
+ uint256 futureSeconds_
137
+ ) = maxTimeVariationInternal ();
138
+
139
+ return
140
+ ISequencerInbox.MaxTimeVariation ({
141
+ delayBlocks: delayBlocks_,
142
+ futureBlocks: futureBlocks_,
143
+ delaySeconds: delaySeconds_,
144
+ futureSeconds: futureSeconds_
145
+ });
146
+ }
147
+
148
+ function maxTimeVariationInternal ()
149
+ internal
150
+ view
151
+ returns (
152
+ uint256 ,
153
+ uint256 ,
154
+ uint256 ,
155
+ uint256
156
+ )
157
+ {
127
158
if (_chainIdChanged ()) {
128
- return
129
- ISequencerInbox.MaxTimeVariation ({
130
- delayBlocks: 1 ,
131
- futureBlocks: 1 ,
132
- delaySeconds: 1 ,
133
- futureSeconds: 1
134
- });
159
+ return (1 , 1 , 1 , 1 );
135
160
} else {
136
- return
137
- ISequencerInbox.MaxTimeVariation ({
138
- delayBlocks: delayBlocks,
139
- futureBlocks: futureBlocks,
140
- delaySeconds: delaySeconds,
141
- futureSeconds: futureSeconds
142
- });
161
+ return (delayBlocks, futureBlocks, delaySeconds, futureSeconds);
143
162
}
144
163
}
145
164
@@ -162,12 +181,10 @@ contract SequencerInbox is GasRefundEnabled, ISequencerInbox {
162
181
baseFeeL1,
163
182
messageDataHash
164
183
);
165
- ISequencerInbox.MaxTimeVariation memory maxTimeVariation_ = maxTimeVariation ();
184
+ ( uint256 delayBlocks_ , , uint256 delaySeconds_ , ) = maxTimeVariationInternal ();
166
185
// Can only force-include after the Sequencer-only window has expired.
167
- if (l1BlockAndTime[0 ] + maxTimeVariation_.delayBlocks >= block .number )
168
- revert ForceIncludeBlockTooSoon ();
169
- if (l1BlockAndTime[1 ] + maxTimeVariation_.delaySeconds >= block .timestamp )
170
- revert ForceIncludeTimeTooSoon ();
186
+ if (l1BlockAndTime[0 ] + delayBlocks_ >= block .number ) revert ForceIncludeBlockTooSoon ();
187
+ if (l1BlockAndTime[1 ] + delaySeconds_ >= block .timestamp ) revert ForceIncludeTimeTooSoon ();
171
188
172
189
// Verify that message hash represents the last message sequence of delayed message to be included
173
190
bytes32 prevDelayedAcc = 0 ;
0 commit comments