對indexed关键字的疑惑 #406
對indexed关键字的疑惑
#406
-
想請問 |
Beta Was this translation helpful? Give feedback.
Answered by
XdpCs
Nov 8, 2023
Replies: 2 comments 1 reply
-
这个描述当时也困扰了我,目前我了解到的是如果用 indexed 修饰的变量长度超出被保存为hash值的话,因为hash的单向性是无法获取原始值的,也就没有起到 indexed 用作检索的作用。 |
Beta Was this translation helpful? Give feedback.
1 reply
-
You can use this demo. // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract aa {
struct S {
uint a;
uint b;
}
mapping(uint=>uint) public aa;
event a(S indexed s);
event b(mapping(uint=>uint) indexed aaa);
function f() public returns (S memory) {
emit a(S(1, 2));
aa[11]=22;
emit b(aa);
return S(1, 2);
}
} You will get this error.
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
XdpCs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use this demo.
You will get this error.