Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
elenaizaguirre opened this issue Jun 28, 2021 · 3 comments · Fixed by #1488
Assignees
Labels
bug Something isn't working Quorum

Comments

@elenaizaguirre
Copy link
Contributor

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.

@elenaizaguirre elenaizaguirre added the bug Something isn't working label Jun 28, 2021
@petermetz
Copy link
Contributor

@elenaizaguirre Does Quorum support the geth keychain? I'm foggy on the details but I think I read somewhere that it doesn't allow it (could be 100% wrong)

@elenaizaguirre
Copy link
Contributor Author

@petermetz I think that is not the problem because adding gas parameter it works:

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

Furthermore, the error is not thrown only when using geth keychain, it happens with private key too.

@petermetz
Copy link
Contributor

@elenaizaguirre Oh my bad, I misunderstood then. Thank you for clalrifying!

@AzaharaC AzaharaC self-assigned this Sep 13, 2021
@petermetz petermetz changed the title fix(quorum): apiV1QuorumRunTransaction does not behave the same with different types of credentials fix(connector-quorum): runTransaction does not behave the same with different types of credentials Sep 13, 2021
AzaharaC added a commit to AzaharaC/cactus that referenced this issue Oct 28, 2021
…dger-cacti#1098

Signed-off-by: AzaharaC <a.castano.benito@accenture.com>
AzaharaC added a commit to AzaharaC/cactus that referenced this issue Nov 3, 2021
…dger-cacti#1098

Signed-off-by: AzaharaC <a.castano.benito@accenture.com>
petermetz pushed a commit that referenced this issue Nov 5, 2021
Signed-off-by: AzaharaC <a.castano.benito@accenture.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Quorum
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants