eth_sign
Description
The eth_sign
issue arises due to the fact that VeChain and Ethereum use different hash functions, more information on this subject here. This failure is justifiable as it is a design difference between the two chains. To fix the failing tests, we imported Ethereum's hash function and replaced the eth_sign
method with one that generates signatures using the required hash function.
The following changes we made:
In compatProvider.ts
compatProvider.ts
In web3-providers-connex/src/compatProvider.ts
we changed the error response returned to the following:
In provider.ts
provider.ts
In web3-providers-connex/src/provider.ts
we imported hashEthMessage
and bufferToHex
from utils.js
We also added the method eth_sign
in the method map
and defined the function in the same file
In utils.ts
utils.ts
In web3-providers-connex/src/utils.ts
we imported keccak256
from 'thor-devkit'.
Then we defined two new functions hashEthMessage
that hashes a string with Ethereum's hash function and a helper function bufferToHex
.
In getChainId.test.ts
getChainId.test.ts
The final change was in web3-providers-connex/test/web3/getChainId.test.ts
where we replaced the main-net URL with the local instance of thor instead.
Contracts Affected
SignatureChecker
Last updated