Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): introduce getTransitions in TaikoL1 #18154

Merged
merged 10 commits into from
Sep 21, 2024
Prev Previous commit
Next Next commit
fix
  • Loading branch information
YoGhurt111 committed Sep 20, 2024
commit 5dd741dfd609cf7fc248759d1e0a167efda4a3ff
10 changes: 6 additions & 4 deletions packages/protocol/contracts/layer1/based/LibUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ library LibUtils {
if (_blockIds.length == 0 || _blockIds.length != _tids.length) {
revert L1_INVALID_PARAMS();
}
TaikoData.TransitionState[] memory transitions;
TaikoData.TransitionState[] memory transitions =
new TaikoData.TransitionState[](_blockIds.length);
for (uint256 i; i < _blockIds.length; ++i) {
transitions.push(getTransition(_state, _config, _blockIds[i], _tids[i]));
transitions[i] = getTransition(_state, _config, _blockIds[i], _tids[i]);
}
return transitions;
}
Expand Down Expand Up @@ -235,9 +236,10 @@ library LibUtils {
if (_blockIds.length == 0 || _blockIds.length != _parentHashes.length) {
revert L1_INVALID_PARAMS();
}
TaikoData.TransitionState[] memory transitions;
TaikoData.TransitionState[] memory transitions =
new TaikoData.TransitionState[](_blockIds.length);
for (uint256 i; i < _blockIds.length; ++i) {
transitions.push(getTransition(_state, _config, _blockIds[i], _parentHashes[i]));
transitions[i] = getTransition(_state, _config, _blockIds[i], _parentHashes[i]);
}
return transitions;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/layer1/based/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents {
}

/// @notice Gets the state transitions for a batch of block.
/// @param _blockId Index array of the blocks.
/// @param _parentHash The transition id array of the blocks.
/// @param _blockIds Index array of the blocks.
/// @param _tids The transition id array of the blocks.
/// @return The state transition array of the blocks.
function getTransitions(
uint64[] calldata _blockIds,
Expand Down
Loading