Skip to content

Commit 7c0dd2d

Browse files
committed
use normal getter for chain tree
1 parent 4d54a43 commit 7c0dd2d

File tree

2 files changed

+41
-20
lines changed

2 files changed

+41
-20
lines changed

l1-contracts/contracts/core/message-root/MessageRootBase.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ abstract contract MessageRootBase is IMessageRootBase, ReentrancyGuard, Initiali
5858
/// @dev The incremental merkle tree storing the chain message roots.
5959
/// @dev On L1, these are empty leaves and are populated only during the addition of the chain
6060
/// are not updated thereafter.
61-
mapping(uint256 chainId => DynamicIncrementalMerkle.Bytes32PushTree tree) public chainTree;
61+
mapping(uint256 chainId => DynamicIncrementalMerkle.Bytes32PushTree tree) internal chainTree;
6262

6363
/// @notice The mapping from block number to the global message root.
6464
/// @dev Each block might have multiple txs that change the historical root. You can safely use the final root in the block,
@@ -341,4 +341,8 @@ abstract contract MessageRootBase is IMessageRootBase, ReentrancyGuard, Initiali
341341
uint256 index = chainIndex[_chainId];
342342
return sharedTree.merklePath(index);
343343
}
344+
345+
function getChainTree(uint256 chainId) external view returns (DynamicIncrementalMerkle.Bytes32PushTree memory) {
346+
return chainTree[chainId];
347+
}
344348
}

l1-contracts/zkstack-out/MessageRootBase.sol/MessageRootBase.json

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,25 +173,6 @@
173173
],
174174
"stateMutability": "view"
175175
},
176-
{
177-
"type": "function",
178-
"name": "chainTree",
179-
"inputs": [
180-
{
181-
"name": "chainId",
182-
"type": "uint256",
183-
"internalType": "uint256"
184-
}
185-
],
186-
"outputs": [
187-
{
188-
"name": "_nextLeafIndex",
189-
"type": "uint256",
190-
"internalType": "uint256"
191-
}
192-
],
193-
"stateMutability": "view"
194-
},
195176
{
196177
"type": "function",
197178
"name": "currentChainBatchNumber",
@@ -243,6 +224,42 @@
243224
],
244225
"stateMutability": "view"
245226
},
227+
{
228+
"type": "function",
229+
"name": "getChainTree",
230+
"inputs": [
231+
{
232+
"name": "chainId",
233+
"type": "uint256",
234+
"internalType": "uint256"
235+
}
236+
],
237+
"outputs": [
238+
{
239+
"name": "",
240+
"type": "tuple",
241+
"internalType": "struct DynamicIncrementalMerkle.Bytes32PushTree",
242+
"components": [
243+
{
244+
"name": "_nextLeafIndex",
245+
"type": "uint256",
246+
"internalType": "uint256"
247+
},
248+
{
249+
"name": "_sides",
250+
"type": "bytes32[]",
251+
"internalType": "bytes32[]"
252+
},
253+
{
254+
"name": "_zeros",
255+
"type": "bytes32[]",
256+
"internalType": "bytes32[]"
257+
}
258+
]
259+
}
260+
],
261+
"stateMutability": "view"
262+
},
246263
{
247264
"type": "function",
248265
"name": "getMerklePathForChain",

0 commit comments

Comments
 (0)