mirror of
https://github.com/status-im/snt-gas-relay.git
synced 2025-02-28 13:40:29 +00:00
Fixing bug verifiying instance
This commit is contained in:
parent
7126b4e3e0
commit
cd0f768d17
@ -51,11 +51,11 @@ contract Factory is Controlled {
|
||||
);
|
||||
}
|
||||
|
||||
function isKernel(bytes32 _codeHash) public returns (bool){
|
||||
function isKernel(bytes32 _codeHash) public view returns (bool){
|
||||
return hashToVersion[_codeHash] > 0;
|
||||
}
|
||||
|
||||
function isKernel(address _addr) public returns (bool){
|
||||
function isKernel(address _addr) public view returns (bool){
|
||||
return versionMap[_addr] > 0;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
"IdentityGasRelay": {
|
||||
"abiFile": "../abi/IdentityGasRelay.json",
|
||||
"isIdentity": true,
|
||||
"factoryAddress": "0x5F6cDe612C45039AaC867075703Bc118cEA4D531",
|
||||
"factoryAddress": "0x6202a2b202Ccf859fd93Ecee33C2D20f20462836",
|
||||
"kernelVerification": "isKernel(bytes32)",
|
||||
"allowedFunctions": [
|
||||
{
|
||||
|
@ -59,6 +59,7 @@ class MessageProcessor {
|
||||
const contract = this.settings.getContractByTopic(message.topic);
|
||||
const instanceCodeHash = this.web3.utils.soliditySha3(await this.web3.eth.getCode(input.address));
|
||||
const kernelVerifSignature = this.web3.utils.soliditySha3(contract.kernelVerification).slice(0, 10);
|
||||
if(instanceCodeHash == null) return false;
|
||||
|
||||
let verificationResult = await this.web3.eth.call({
|
||||
to: contract.factoryAddress,
|
||||
@ -133,8 +134,13 @@ class MessageProcessor {
|
||||
|
||||
if(!await this._validateInput(message, input)) return; // TODO Log
|
||||
|
||||
if(contract.isIdentity && !this._validateInstance(message, input))
|
||||
|
||||
if(contract.isIdentity){
|
||||
let validInstance = await this._validateInstance(message, input);
|
||||
if(!validInstance){
|
||||
return this._reply("Invalid identity instance", message);
|
||||
}
|
||||
}
|
||||
|
||||
const params = this._obtainParametersFunc(contract, input);
|
||||
|
||||
@ -176,7 +182,7 @@ class MessageProcessor {
|
||||
}
|
||||
} catch(exc){
|
||||
if(exc.message.indexOf("revert") > -1)
|
||||
return this._reply("Transaction will revert");
|
||||
return this._reply("Transaction will revert", message);
|
||||
}
|
||||
|
||||
const estimatedGasInToken = estimatedGas.mul(factor);
|
||||
|
Loading…
x
Reference in New Issue
Block a user