Skip to content

fix(connector-quorum): runTransaction does not behave the same with different types of credentials #1098

Closed
@elenaizaguirre

Description

@elenaizaguirre

Function apiV1QuorumRunTransaction of cactus-plugin-ledger-connector-quorum does not behave the same with different types of credentials

Expected Behavior

We expect Quorum connector to accept the same arguments as a transaction to run apiV1QuorumRunTransaction function independently of the type of credential used for sign the transaction.

Current Behavior

Now, apiV1QuorumRunTransaction can run without gas argument of schema QuorumTransactionConfig only using authentication of type GethKeychainPassword.

Possible Solution

Look at the code for default values of transaction fields and remove them.

We might define required parameters in QuorumTransactionConfig schema (in openapi.json) and validate them with express-openapi-validator package at web services. Autogenerated QuorumTransactionConfig interface will be updated automatically.

Steps to Reproduce

  1. Create a Web3SigningSchema of type CactusKeychainRef (linked to a keychain plugin) or PrivateKeyHex:

    const cactusCredential = {
        type: Web3SigningCredentialType.CactusKeychainRef,
        ethAccount: testEthAccount1.address,
        keychainEntryKey,
        keychainId,
    }
    const privateKeyCredential = {
        type: Web3SigningCredentialType.PrivateKeyHex,
        ethAccount: testEthAccount2.address,
        secret: testEthAccount2.privateKey,
    }
  2. Call apiV1QuorumRunTransaction function with cactusCredential, without gas field:

    const parameters = {
        web3SigningCredential: cactusCredential,
        transactionConfig: {
            from: cactusCredential.ethAccount,
            to: privateKeyCredential.ethAccount,
            value: 10e7,
        },
      };
    const res = await apiClient.apiV1QuorumRunTransaction(
        parameters as RunTransactionRequest,
    );

    The previous code does not work.

  3. Create a Web3SigningSchema of type GethKeychainPassword with a genesis account:

    const gethCredential = {
        type: Web3SigningCredentialType.GethKeychainPassword,
        ethAccount: firstHighNetWorthAccount,
        secret: "",
    }
  4. Call apiV1QuorumRunTransaction function with gethCredential, without gas field:

    const parameters = {
        web3SigningCredential: gethCredential,
        transactionConfig: {
            from: gethCredential.ethAccount,
            to: privateKeyCredential.ethAccount,
            value: 10e7,
        },
      };
    const res = await apiClient.apiV1QuorumRunTransaction(
        parameters as RunTransactionRequest,
    );

    The previous code does work

Context (Environment)

This issue has appeared when trying different ways to authenticate against Quorum.

Is located at package cactus-plugin-ledger-quorum

Detailed Description

Now, apiV1QuorumRunTransaction can run without gas argument of QuorumTransactionConfig schema only using authentication of type GethKeychainPassword. With CactusKeychainRef and PrivateKeyHex authentication types does not work.

We might require all parameters that are mandatory for Quorum.

Metadata

Metadata

Assignees

Labels

QuorumbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions