web3j
web3j copied to clipboard
When use with hardhat, the request failed when block number < 2 digit
When use with hardhat, the request failed when block number < 2 digit
In class JsonRpc2_0Web3j, it uses a lot of Numeric.toHexStringWithPrefixSafe to encode block number. Eg. at ethGetFilterLogs When the number is less than 2 digit, it adds an additional 0 to the encoded number. Eg. 8 -> 0x08 (instead of 0x8). This is being rejected by hardhat.
06-15 15:12:06 DEBUG - {"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x08"],"id":3} (HttpLoggingInterceptor.kt:209) 06-15 15:12:06 DEBUG - {"jsonrpc":"2.0","id":3,"error":{"code":-32602,"message":"Errors encountered in param 0: Invalid value "0x08" supplied to : QUANTITY"}} (HttpLoggingInterceptor.kt:270)
Environment: Hardhat 2.3.1 Web3j 4.9.1
Oh, it's fixed at 4.9.2. Please ignore this.