aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

Topic filter in web3 API does not work with AVM topics #326

Closed nancyaion closed 5 years ago

nancyaion commented 5 years ago

The topics filter in kernel web3 API only works with 32 bytes topic value, thus works for FVM topics as they are hash values of 32 bytes. Our current AVM topics are defined as arbitrary length byte arrays. ./beta.sh --get-all-logs -t option only works when the AVM topic happens to be of 32 bytes length.

nancyaion commented 5 years ago

The fix is to hash the AVM topics to 32 bytes hash values, in a similar way that FVM topics are generated.

org.aion.avm.core.util.HashUtils.sha256() will be used for this purpose.

nancyaion commented 5 years ago

kernel commit dbf4c78e5dcbad2efef7d51f8cea33634e19b7a6

modify the unit test, as the AVM topics are now hash values, instead of the initial byte arrays