-
-
Notifications
You must be signed in to change notification settings - Fork 871
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
Problem with zero in unit256 indexed event #2728
Comments
Hello @sstepanchuk. Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository. Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster. Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue. |
Thanks. Fixing now. |
nice, thank you! @jxom also. can you pls open this issue? |
should be fixed in latest version |
okay |
This issue has been locked since it has been closed for more than 14 days. If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread. |
Check existing issues
Viem Version
2.21.7
Current Behavior
Event filter ignore prop, if prop = 0, so filter not work properly
Expected Behavior
Event filter should filter events by this prop if prop = 0, filter should return events with prop = 0
Steps To Reproduce
emit any event with indexed unit256 property with 0 value.
emit any event with indexed unit256 property with value diffrent from 0.
try to get event log that have value 0, you will recive all logs, not only this log
Link to Minimal Reproducible Example
No response
Anything else?
My event
struct Pixel { address owner; uint24 color; } event PixelChanged( uint256 indexed Y, uint256 indexed X, address indexed changer, Pixel old, Pixel current );
part of my TS code
`(BigInt.prototype as any).toJSON = function () {
return this.toString();
};
async function deployBoardFixture() {
const [owner, otherAccount] = await hre.viem.getWalletClients();
}
const { board, owner } = await loadFixture(deployBoardFixture);
const changes = await board.getEvents.PixelChanged({
Y: 0,
X: 0,
changer: owner.account.address
}, {
strict: true
});
console.log(JSON.stringify(changes, null, ' '));
`
JSON that return console log:
[ { "eventName": "PixelChanged", "args": { "Y": "0", "X": "0", "changer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "old": { "owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "color": 1 }, "current": { "owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "color": 1 } }, "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "blockHash": "0x11f6502c9d8dcef7ecddfc259ccef94de8893883399834b49c772836abfdf6ce", "blockNumber": "2", "data": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000001", "logIndex": 0, "removed": false, "topics": [ "0x84b3faa68b847ee5bd2633b3149d770ed66d387f87b8bfcf7fe5bffc28a59ddf", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" ], "transactionHash": "0xde8652351b4eb0f3a0bbb99ec5bb0c605de7cfc9f2ca9e99cb278ca0916fe4e3", "transactionIndex": 0 }, { "eventName": "PixelChanged", "args": { "Y": "0", "X": "1", "changer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "old": { "owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "color": 2 }, "current": { "owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "color": 2 } }, "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "blockHash": "0x11f6502c9d8dcef7ecddfc259ccef94de8893883399834b49c772836abfdf6ce", "blockNumber": "2", "data": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000002000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000002", "logIndex": 1, "removed": false, "topics": [ "0x84b3faa68b847ee5bd2633b3149d770ed66d387f87b8bfcf7fe5bffc28a59ddf", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000001", "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" ], "transactionHash": "0xde8652351b4eb0f3a0bbb99ec5bb0c605de7cfc9f2ca9e99cb278ca0916fe4e3", "transactionIndex": 0 } ]
The text was updated successfully, but these errors were encountered: