Skip to content

Commit

Permalink
feat(besu): remove hard dependency on keychain
Browse files Browse the repository at this point in the history
    Primary Changes
    ---------------
    1. Updated besu connector to remove hard
       dependency on keychain

    Changes required to incorporate 1)
    ----------------------------------
    2. Updated openapi.tpl.json to have non-keychain
       endpoints
    3. Generated code and updated web-services for them
    4. Updated transact( ) and deployContract( ) fx
    5. Added deployContractNoKeychain( ) fx

Fixes #963

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
  • Loading branch information
jagpreetsinghsasan authored and petermetz committed Jul 18, 2024
1 parent 497ea32 commit f5b60b4
Show file tree
Hide file tree
Showing 19 changed files with 2,191 additions and 476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,73 @@
}
}
},
"DeployContractSolidityBytecodeNoKeychainV1Request": {
"type": "object",
"required": [
"contractName",
"contractAbi",
"contractJson",
"bytecode",
"web3SigningCredential",
"keychainId",
"constructorArgs"
],
"additionalProperties": false,
"properties": {
"contractName": {
"type": "string",
"description": "The contract name for retrieve the contracts json on the keychain.",
"minLength": 1,
"maxLength": 100,
"nullable": false
},
"contractAbi": {
"description": "The application binary interface of the solidity contract",
"type": "array",
"items": {},
"nullable": false
},
"contractJSONString": {
"description": "For use when not using keychain, pass the contract in as this string variable",
"nullable": false,
"type": "string"
},
"constructorArgs": {
"type": "array",
"items": {},
"default": []
},
"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"
},
"gas": {
"type": "number",
"nullable": false
},
"gasPrice": {
"type": "string",
"nullable": false
},
"timeoutMs": {
"type": "number",
"description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.",
"minimum": 0,
"default": 60000,
"nullable": false
},
"privateTransactionConfig": {
"$ref": "#/components/schemas/BesuPrivateTransactionConfig"
}
}
},
"DeployContractSolidityBytecodeV1Response": {
"type": "object",
"required": ["transactionReceipt"],
Expand Down Expand Up @@ -1016,6 +1083,40 @@
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode-no-keychain": {
"post": {
"x-hyperledger-cacti": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode-no-keychain"
}
},
"operationId": "deployContractSolBytecodeNoKeychainV1",
"summary": "Deploys the bytecode of a Solidity contract without the need of keychain",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeployContractSolidityBytecodeNoKeychainV1Request"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Response"
}
}
}
}
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-balance": {
"post": {
"x-hyperledger-cacti": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,73 @@
}
}
},
"DeployContractSolidityBytecodeNoKeychainV1Request": {
"type": "object",
"required": [
"contractName",
"contractAbi",
"contractJson",
"bytecode",
"web3SigningCredential",
"keychainId",
"constructorArgs"
],
"additionalProperties": false,
"properties": {
"contractName": {
"type": "string",
"description": "The contract name for retrieve the contracts json on the keychain.",
"minLength": 1,
"maxLength": 100,
"nullable": false
},
"contractAbi": {
"description": "The application binary interface of the solidity contract",
"type": "array",
"items": {},
"nullable": false
},
"contractJSONString": {
"description": "For use when not using keychain, pass the contract in as this string variable",
"nullable": false,
"type": "string"
},
"constructorArgs": {
"type": "array",
"items": {},
"default": []
},
"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"
},
"gas": {
"type": "number",
"nullable": false
},
"gasPrice": {
"type": "string",
"nullable": false
},
"timeoutMs": {
"type": "number",
"description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.",
"minimum": 0,
"default": 60000,
"nullable": false
},
"privateTransactionConfig": {
"$ref": "#/components/schemas/BesuPrivateTransactionConfig"
}
}
},
"DeployContractSolidityBytecodeV1Response": {
"type": "object",
"required": ["transactionReceipt"],
Expand Down Expand Up @@ -1016,6 +1083,40 @@
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode-no-keychain": {
"post": {
"x-hyperledger-cacti": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode-no-keychain"
}
},
"operationId": "deployContractSolBytecodeNoKeychainV1",
"summary": "Deploys the bytecode of a Solidity contract without the need of keychain",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeployContractSolidityBytecodeNoKeychainV1Request"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Response"
}
}
}
}
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-balance": {
"post": {
"x-hyperledger-cacti": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ models/besu_private_transaction_config_pb.proto
models/besu_transaction_config_pb.proto
models/besu_transaction_config_to_pb.proto
models/consistency_strategy_pb.proto
models/deploy_contract_solidity_bytecode_no_keychain_v1_request_pb.proto
models/deploy_contract_solidity_bytecode_v1_request_pb.proto
models/deploy_contract_solidity_bytecode_v1_response_pb.proto
models/eth_contract_invocation_type_pb.proto
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Hyperledger Cactus Plugin - Connector Besu
Can perform basic tasks on a Besu ledger
The version of the OpenAPI document: 2.0.0-rc.2
Generated by OpenAPI Generator: https://openapi-generator.tech
*/

syntax = "proto3";

package org.hyperledger.cacti.plugin.ledger.connector.besu;

import "google/protobuf/any.proto";

import "models/besu_private_transaction_config_pb.proto";
import "models/web3_signing_credential_pb.proto";

message DeployContractSolidityBytecodeNoKeychainV1RequestPB {

// The contract name for retrieve the contracts json on the keychain.
string contractName = 328784197;

// The application binary interface of the solidity contract
repeated google.protobuf.Any contractAbi = 512852493;

// For use when not using keychain, pass the contract in as this string variable
string contractJSONString = 405816750;

repeated google.protobuf.Any constructorArgs = 336490508;

Web3SigningCredentialPB web3SigningCredential = 451211679;

// See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode
string bytecode = 256554254;

float gas = 102105;

string gasPrice = 5271059;

// The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.
float timeoutMs = 51479271;

BesuPrivateTransactionConfigPB privateTransactionConfig = 276796542;

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ syntax = "proto3";
package org.hyperledger.cacti.plugin.ledger.connector.besu.services.defaultservice;

import "google/protobuf/empty.proto";
import "models/deploy_contract_solidity_bytecode_no_keychain_v1_request_pb.proto";
import "models/deploy_contract_solidity_bytecode_v1_request_pb.proto";
import "models/deploy_contract_solidity_bytecode_v1_response_pb.proto";
import "models/get_balance_v1_request_pb.proto";
Expand All @@ -33,6 +34,8 @@ import "models/sign_transaction_request_pb.proto";
import "models/sign_transaction_response_pb.proto";

service DefaultService {
rpc DeployContractSolBytecodeNoKeychainV1 (DeployContractSolBytecodeNoKeychainV1Request) returns (DeployContractSolidityBytecodeV1ResponsePB);

rpc DeployContractSolBytecodeV1 (DeployContractSolBytecodeV1Request) returns (DeployContractSolidityBytecodeV1ResponsePB);

rpc GetBalanceV1 (GetBalanceV1Request) returns (GetBalanceV1ResponsePB);
Expand All @@ -57,6 +60,11 @@ service DefaultService {

}

message DeployContractSolBytecodeNoKeychainV1Request {
DeployContractSolidityBytecodeNoKeychainV1RequestPB deployContractSolidityBytecodeNoKeychainV1RequestPB = 1;

}

message DeployContractSolBytecodeV1Request {
DeployContractSolidityBytecodeV1RequestPB deployContractSolidityBytecodeV1RequestPB = 1;

Expand Down
Loading

0 comments on commit f5b60b4

Please sign in to comment.