Problem
getActivePieceCount(uint256 setId) has O(n) complexity where n = nextPieceId[setId]. For datasets with tens of thousands of pieces, this exceeds the gas limit for eth_call requests.
Reproduction
On mainnet verifier (0xBADd0B92C1c71d02E7d520f64c0876538fa2557F):
# Works - small dataset
cast call 0xBADd0B92C1c71d02E7d520f64c0876538fa2557F "getActivePieceCount(uint256)(uint256)" 1 --rpc-url https://api.node.glif.io/rpc/v1
# Returns: 2
# Fails - large dataset (54,568 pieces)
cast call 0xBADd0B92C1c71d02E7d520f64c0876538fa2557F "getActivePieceCount(uint256)(uint256)" 89 --rpc-url https://api.node.glif.io/rpc/v1
# Error: out of gas
Note: getActivePieces with pagination works fine for the same dataset.
Problem
getActivePieceCount(uint256 setId)has O(n) complexity where n =nextPieceId[setId]. For datasets with tens of thousands of pieces, this exceeds the gas limit foreth_callrequests.Reproduction
On mainnet verifier (
0xBADd0B92C1c71d02E7d520f64c0876538fa2557F):Note:
getActivePieceswith pagination works fine for the same dataset.