Skip to content

Commit

Permalink
feat(quorum): private transaction support
Browse files Browse the repository at this point in the history
-----------------------------------------
	- Added v2.3.0-deploy-contract-from-json-private.test.ts that would support private
	transaction test for Quorum.
	- Added a QuorumPrivateTransactionConfig on openapi.json
	- Added Web3JsQuorum on plugin-ledger-connector-quorum and added a transact private
	method to be able to proceed with the private transaction.
	- Currently the privateUrl in the test is being truely optional
	and we need to address this in the future.
	- We are just passing privateUrl in all the instances even though
	we don't need to do private transactions everywhere.

Fixes #951

Co-authored-by: Travis Payne <[email protected]>
Co-authored-by: johnhomantaring <[email protected]>
Co-authored-by: jagpreetsinghsasan <[email protected]>
Co-authored-by: aldousalvarez [email protected]
Co-authored-by: Peter Somogyvari <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
5 people committed Jun 12, 2023
1 parent e5d2ceb commit 3c944d6
Show file tree
Hide file tree
Showing 9 changed files with 692 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,46 @@
}
}
},
"QuorumPrivateTransactionConfig" : {
"type": "object",
"required" : [
"privateFor"
],
"properties" : {
"privateFrom": {
"type": "string",
"nullable": false
},
"privateFor": {
"type": "array",
"default": [],
"items": {},
"nullable": false
},
"isPrivate": {
"type": "boolean",
"default": false,
"nullable": false
},
"gasPrice": {
"type": "number",
"nullable": false
},
"gasLimit": {
"type": "number",
"nullable": false
},
"privateKey": {
"type": "string",
"nullable": false
},
"privacyGroupId": {
"type": "string",
"nullable": false
}

}
},
"Web3TransactionReceipt": {
"type": "object",
"required": [
Expand Down Expand Up @@ -354,7 +394,33 @@
"to": {
"type": "string",
"nullable": false
}
},
"logs": {
"type": "array",
"default": [],
"items": {},
"nullable": false
},
"logsBloom": {
"type": "string",
"nullable": false
},
"revertReason": {
"type": "string",
"nullable": false
},
"output": {
"type": "string",
"nullable": false
},
"commitmentHash": {
"type": "string",
"nullable": false
},
"cumulativeGasUSed": {
"type": "number",
"nullable": false
}
}
},
"ContractJSON": {
Expand Down Expand Up @@ -436,6 +502,9 @@
"minimum": 0,
"default": 60000,
"nullable": false
},
"privateTransactionConfig": {
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
}
}
},
Expand All @@ -448,7 +517,7 @@
"transactionReceipt": {
"$ref": "#/components/schemas/Web3TransactionReceipt"
}
}
}
},
"DeployContractSolidityBytecodeV1Request": {
"type": "object",
Expand All @@ -466,10 +535,23 @@
"maxLength": 100,
"nullable": false
},
"contractAbi": {
"description": "The application binary interface of the solidity contract",
"type": "array",
"items": {},
"nullable": false
},
"web3SigningCredential": {
"$ref": "#/components/schemas/Web3SigningCredential",
"nullable": false
},
"bytecode": {
"type": "string",
"nullable": false,
"minLength": 1,
"maxLength": 24576,
"description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode"
},
"keychainId": {
"type": "string",
"description": "The keychainId for retrieve the contracts json.",
Expand All @@ -482,7 +564,15 @@
"nullable": false
},
"gasPrice": {
"type": "string",
"type": "number",
"nullable": false
},
"nonce": {
"type": "number",
"nullable": false
},
"value": {
"type": "number",
"nullable": false
},
"timeoutMs": {
Expand All @@ -502,6 +592,9 @@
"type": "array",
"default": [],
"items": {}
},
"privateTransactionConfig": {
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
}
}
},
Expand Down Expand Up @@ -726,6 +819,9 @@
"$ref": "#/components/schemas/ContractJSON",
"description": "For use when not using keychain, pass the contract in as this variable",
"nullable": false
},
"privateTransactionConfig": {
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,24 @@ export interface DeployContractSolidityBytecodeV1Request {
* @memberof DeployContractSolidityBytecodeV1Request
*/
contractName: string;
/**
* The application binary interface of the solidity contract
* @type {Array<any>}
* @memberof DeployContractSolidityBytecodeV1Request
*/
contractAbi?: Array<any>;
/**
*
* @type {Web3SigningCredential}
* @memberof DeployContractSolidityBytecodeV1Request
*/
web3SigningCredential: Web3SigningCredential;
/**
* See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode
* @type {string}
* @memberof DeployContractSolidityBytecodeV1Request
*/
bytecode?: string;
/**
* The keychainId for retrieve the contracts json.
* @type {string}
Expand All @@ -183,10 +195,22 @@ export interface DeployContractSolidityBytecodeV1Request {
gas?: number;
/**
*
* @type {string}
* @type {number}
* @memberof DeployContractSolidityBytecodeV1Request
*/
gasPrice?: string;
gasPrice?: number;
/**
*
* @type {number}
* @memberof DeployContractSolidityBytecodeV1Request
*/
nonce?: number;
/**
*
* @type {number}
* @memberof DeployContractSolidityBytecodeV1Request
*/
value?: number;
/**
* The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.
* @type {number}
Expand All @@ -205,6 +229,12 @@ export interface DeployContractSolidityBytecodeV1Request {
* @memberof DeployContractSolidityBytecodeV1Request
*/
constructorArgs?: Array<any>;
/**
*
* @type {QuorumPrivateTransactionConfig}
* @memberof DeployContractSolidityBytecodeV1Request
*/
privateTransactionConfig?: QuorumPrivateTransactionConfig;
}
/**
*
Expand Down Expand Up @@ -315,6 +345,12 @@ export interface InvokeContractJsonObjectV1Request {
* @memberof InvokeContractJsonObjectV1Request
*/
contractJSON: ContractJSON;
/**
*
* @type {QuorumPrivateTransactionConfig}
* @memberof InvokeContractJsonObjectV1Request
*/
privateTransactionConfig?: QuorumPrivateTransactionConfig;
}
/**
*
Expand Down Expand Up @@ -526,6 +562,55 @@ export interface InvokeRawWeb3EthMethodV1Response {
*/
errorDetail?: string;
}
/**
*
* @export
* @interface QuorumPrivateTransactionConfig
*/
export interface QuorumPrivateTransactionConfig {
/**
*
* @type {string}
* @memberof QuorumPrivateTransactionConfig
*/
privateFrom?: string;
/**
*
* @type {Array<any>}
* @memberof QuorumPrivateTransactionConfig
*/
privateFor: Array<any>;
/**
*
* @type {boolean}
* @memberof QuorumPrivateTransactionConfig
*/
isPrivate?: boolean;
/**
*
* @type {number}
* @memberof QuorumPrivateTransactionConfig
*/
gasPrice?: number;
/**
*
* @type {number}
* @memberof QuorumPrivateTransactionConfig
*/
gasLimit?: number;
/**
*
* @type {string}
* @memberof QuorumPrivateTransactionConfig
*/
privateKey?: string;
/**
*
* @type {string}
* @memberof QuorumPrivateTransactionConfig
*/
privacyGroupId?: string;
}
/**
*
* @export
Expand Down Expand Up @@ -607,6 +692,12 @@ export interface RunTransactionRequest {
* @memberof RunTransactionRequest
*/
timeoutMs?: number;
/**
*
* @type {QuorumPrivateTransactionConfig}
* @memberof RunTransactionRequest
*/
privateTransactionConfig?: QuorumPrivateTransactionConfig;
}
/**
*
Expand Down Expand Up @@ -1230,6 +1321,42 @@ export interface Web3TransactionReceipt {
* @memberof Web3TransactionReceipt
*/
to: string;
/**
*
* @type {Array<any>}
* @memberof Web3TransactionReceipt
*/
logs?: Array<any>;
/**
*
* @type {string}
* @memberof Web3TransactionReceipt
*/
logsBloom?: string;
/**
*
* @type {string}
* @memberof Web3TransactionReceipt
*/
revertReason?: string;
/**
*
* @type {string}
* @memberof Web3TransactionReceipt
*/
output?: string;
/**
*
* @type {string}
* @memberof Web3TransactionReceipt
*/
commitmentHash?: string;
/**
*
* @type {number}
* @memberof Web3TransactionReceipt
*/
cumulativeGasUSed?: number;
}

/**
Expand Down
Loading

0 comments on commit 3c944d6

Please sign in to comment.