1

We have been working on Document Signing App which sends an email when a user uploads a document and sends it to sign to another 3-4 users. The user gets the email and tries to sign the document which does a blockchain transaction whose status is always failed.

We have been trying to debug this but unfortunately we haven’t any details lately, We have tried various codes but no changes have changed the status of transaction.

Our System Details :

Provider : Alchemy Network : Goerli / Localhost ( Hardhat node ) Local Dev : Hardhat

We also tried to use hardhat console.sol but we could not get any logs in the contract when using Hardhat node, No logs were printed using npx hardhat test. We have been facing this problem since almost a week now and the transaction is stil failing.

Snapshot of Local Error :

ProviderError: Error: Transaction reverted without a reason string at HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:78:19) at GanacheGasMultiplierProvider.request (node_modules/hardhat/src/internal/core/providers/gas-providers.ts:312:34) at processTicksAndRejections (node:internal/process/task_queues:96:5)

Smart Contract that is failing in actual transaction :

function sign(bytes32 hash, bytes32 signatureHash, address signer) public {
    console.log("Entered Sign Function");
    require(checkDoc(hash),"check doc failed");
       require(documents[hash].signers[signer] == 1, "signer failed");
        documents[hash].remainingSignatures--;
        documents[hash].signers[signer] = block.timestamp;
        emit Signature(hash, signatureHash, signer, 'Signature');
        if (documents[hash].remainingSignatures == 0){
            documents[hash].status = currentState.signed;
            emit Signed(hash, 'Signed');
}

Require is not the issue because when we comment out require statements the transaction is still failing.

Code for Test case that is failing :

  it("Signing contract", async function () {
    const DocumentSigning = await ethers.getContractFactory("DocumentSigning");
    const document_signing = await DocumentSigning.deploy();
    const transactionOptions = {
      gasLimit: 2500000
    }
    await document_signing.sign("0x46742b637a5c1d01460033c3bd178d1fafe78e0dffa5d2d1841dcccaf70d30a9", "0xef02795fa1b0c97abe843fb461b4625a6a24662bff227862d7d292c9fc69c1ab", "0x07906aae1204f6f3b81673562db7776af9acf83c", transactionOptions);
  });
});

The values for test cases have been hardcoded for now to test the actual transaction flow.

Can some help on this as soon as possible?

Adding link to a sample transaction that failed :

https://goerli.etherscan.io/tx/0x4c1665f793541846457a27467236d5fccca63588be3064c78682f666393adc74

TylerH
  • 20,799
  • 66
  • 75
  • 101
aneesh kapur
  • 69
  • 1
  • 3
  • Probably there's an underflow here `documents[hash].remainingSignatures--;`. Can you comment out this line and check what happens? – 0xSanson Jul 12 '22 at 13:17

0 Answers0