Skip to content

Commit d1d191b

Browse files
committed
add test case of address size
1 parent a3d4983 commit d1d191b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

framework/src/main/java/org/tron/core/services/jsonrpc/filters/LogFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public LogFilter(FilterRequest fr) throws JsonRpcInvalidParamsException {
9494
}
9595
}
9696
if (t.size() > maxSubWidth) {
97-
throw new JsonRpcInvalidParamsException("topics' width should be <= " + maxSubWidth);
97+
throw new JsonRpcInvalidParamsException(
98+
"topic size of one row should be <= " + maxSubWidth);
9899
}
99100
withTopic(t.toArray(new byte[t.size()][]));
100101
} else {

framework/src/test/java/org/tron/core/jsonrpc/JsonRpcTest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,18 @@ public void testLogFilter() {
241241
Assert.assertTrue(e.getMessage().contains("invalid address"));
242242
}
243243

244-
//address width should be <= 20
244+
//address size should be <= 20
245+
List<String> addresses = new ArrayList<>();
246+
for (int i = 0; i < 100; i++) {
247+
addresses.add("0x1D3005237D6516EA794456BBEE9978B5B7AE491F");
248+
}
249+
try {
250+
new LogFilter(new FilterRequest(null, null, addresses, null, null));
251+
} catch (JsonRpcInvalidParamsException e) {
252+
Assert.assertEquals("address size should be <= 20", e.getMessage());
253+
}
245254

246-
//topic's width should be <= 20
255+
//topic size of one row should be <= 20
247256
List<String> subTopics = new ArrayList<>();
248257
for (int i = 0; i < 100; i++) {
249258
subTopics.add("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");
@@ -253,7 +262,7 @@ public void testLogFilter() {
253262
try {
254263
new LogFilter(new FilterRequest(null, null, null, topics, null));
255264
} catch (JsonRpcInvalidParamsException e) {
256-
Assert.assertEquals("topics' width should be <= 20", e.getMessage());
265+
Assert.assertEquals("topic size of one row should be <= 20", e.getMessage());
257266
}
258267
}
259268

0 commit comments

Comments
 (0)