can someone help me with this ecrecover issue? The code below is a truffle test. The recoverSigner function just calls ecrecover, but the return is always '0x'. Recovering with ethereumjs-util works fine.
Geth v1.8.17 (clique private network) Truffle v4.1.14 Solidity v0.4.24
//Front-end
const msg = new Buffer('hello')
const sig = web3.eth.sign(web3.eth.accounts[0], '0x' + msg.toString('hex'))
//Back-end
const res = ethUtil.fromRpcSig(sig)
const prefix = new Buffer("\x19Ethereum Signed Message:\n")
const prefixedMsg = ethUtil.keccak256(Buffer.concat([prefix, New Buffer(String(msg.length)), msg]))
const pubKey = ethUtil.ecrecover(prefixedMsg, res.v, res.r, res.s)
const addrBuf = ethUtil.pubToAddress(pubKey)
const addrEthJS = ethUtil.bufferToHex(addrBuf)
assert.equal(accounts[0], addrEthJS) // Ok!
//Ethereum Network
let addrSolidity = await instance.recoverSigner(ethUtil.bufferToHex(prefixedMsg), res.v, ethUtil.bufferToHex(res.r), ethUtil.bufferToHex(res.s))
assert.equal(accounts[0], addrSolidity) // Fail! recoverSigner returns '0X'