Description
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
-
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, }
-
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.
-
Create a Web3SigningSchema of type GethKeychainPassword with a genesis account:
const gethCredential = { type: Web3SigningCredentialType.GethKeychainPassword, ethAccount: firstHighNetWorthAccount, secret: "", }
-
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.