Skip to content

Commit 7065667

Browse files
feat(satp-hermes): improve satp gateway configuration object
Signed-off-by: Tomas Silva <[email protected]>
1 parent 6b757ab commit 7065667

33 files changed

+633
-539
lines changed

packages/cactus-plugin-satp-hermes/README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Ethereum-compatible networks use Web3 signing credentials and contract addresses
371371
"networkId": "besu-mainnet",
372372
"connectorUrl": "https://besu-connector.example.com:4000",
373373
"web3SigningCredential": {
374-
"ethAccount": "${ETH_ACCOUNT}",
374+
"bridgeOwnerAccount": "${ETH_ACCOUNT}",
375375
"secret": "${ETH_PRIVATE_KEY}",
376376
"type": "PRIVATE_KEY_HEX"
377377
},
@@ -381,7 +381,9 @@ Ethereum-compatible networks use Web3 signing credentials and contract addresses
381381
"http": "https://mainnet.infura.io/v3/${PROJECT_ID}",
382382
"ws": "wss://mainnet.infura.io/ws/v3/${PROJECT_ID}"
383383
},
384-
"gasLimit": 3000000
384+
"gasConfig": {
385+
"gasLimit": "3000000"
386+
}
385387
}
386388
}
387389
```
@@ -613,11 +615,13 @@ const leafConfig = {
613615
ledgerType: "BESU_2X" // Ledger type constant for Besu 2.x
614616
},
615617
signingCredential: {
616-
ethAccount: "0x736dC9B8258Ec5ab2419DDdffA9e1fa5C201D0b4", // Ethereum account address
618+
bridgeOwnerAccount: "0x736dC9B8258Ec5ab2419DDdffA9e1fa5C201D0b4", // Public Key of the owner of the bridge representing its Ethereum account
617619
secret: "0xc31e76f70d6416337d3a7b7a8711a43e30a14963b5ba622fa6c9dbb5b4555986", // Private key in hex
618620
type: "PRIVATE_KEY_HEX"
619621
},
620-
gas: 999999999999999, // Default gas limit for transactions
622+
gasConfig: {
623+
gasLimit: "6000000", // Default gas limit for transactions
624+
},
621625
connectorOptions: {
622626
rpcApiHttpHost: "http://172.20.0.6:8545", // Besu JSON-RPC HTTP endpoint
623627
rpcApiWsHost: "ws://172.20.0.6:8546" // Besu JSON-RPC WebSocket endpoint
@@ -635,11 +639,14 @@ const leafConfig = {
635639
ledgerType: "ETHEREUM" // Ledger type constant for Ethereum
636640
},
637641
signingCredential: {
638-
ethAccount: "0x09D16c22216BC873e53c8D93A38420f48A81dF1B", // Ethereum account address
642+
bridgeOwnerAccount: "0x09D16c22216BC873e53c8D93A38420f48A81dF1B", // Public Key of the owner of the bridge representing its Ethereum account
639643
secret: "test", // Key store password or secret
640644
type: "GETH_KEYCHAIN_PASSWORD" // Credential type for geth keychain
641645
},
642-
gas: 5000000, // Default gas limit for transactions
646+
gasConfig: {
647+
gas: "6721975", // Default gas limit for transactions
648+
gasPrice: "20000000000" // Default gas Price
649+
},
643650
connectorOptions: {
644651
rpcApiHttpHost: "http://172.20.0.7:8545", // Ethereum JSON-RPC HTTP endpoint
645652
rpcApiWsHost: "ws://172.20.0.7:8546" // Ethereum JSON-RPC WebSocket endpoint
@@ -656,6 +663,10 @@ const gatewayConfig = {
656663
gid: {
657664
id: "gatewayId",
658665
name: "GatewayWithBesuConnection",
666+
identificationCredential: {
667+
signingAlgorithm: "SECP256K1",
668+
pubKey: "0x03a34e1d66b78e47fa1bba3445a6019acb5b9c87d0c6ad81c09e7d496682ae81fc",
669+
},
659670
version: [{ Core: "v02", Architecture: "v02", Crash: "v02" }],
660671
proofID: "mockProofID10",
661672
address: "http://gateway1.satp-hermes",
@@ -675,11 +686,13 @@ const gatewayConfig = {
675686
ledgerType: "BESU_2X",
676687
},
677688
signingCredential: {
678-
ethAccount: "0x736dC9B8258Ec5ab2419DDdffA9e1fa5C201D0b4",
689+
bridgeOwnerAccount: "0x736dC9B8258Ec5ab2419DDdffA9e1fa5C201D0b4",
679690
secret: "0xc31e76f70d6416337d3a7b7a8711a43e30a14963b5ba622fa6c9dbb5b4555986",
680691
type: "PRIVATE_KEY_HEX",
681692
},
682-
gas: 999999999999999,
693+
gasConfig: {
694+
gasLimit: "6000000",
695+
},
683696
connectorOptions: {
684697
rpcApiHttpHost: "http://172.20.0.6:8545",
685698
rpcApiWsHost: "ws://172.20.0.6:8546",

packages/cactus-plugin-satp-hermes/src/examples/config/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ All configuration files follow this standardized structure based on the SATP pro
129129
"ledgerType": "ETHEREUM"
130130
},
131131
"signingCredential": {
132-
"ethAccount": "0x...",
132+
"bridgeOwnerAccount": "0x...",
133133
"secret": "0x...",
134134
"type": "PRIVATE_KEY_HEX"
135135
},

packages/cactus-plugin-satp-hermes/src/examples/config/oracle-case1-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ledgerType": "ETHEREUM"
2727
},
2828
"signingCredential": {
29-
"ethAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
29+
"bridgeOwnerAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
3030
"secret": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
3131
"type": "PRIVATE_KEY_HEX"
3232
},

packages/cactus-plugin-satp-hermes/src/examples/config/oracle-case2-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ledgerType": "ETHEREUM"
2727
},
2828
"signingCredential": {
29-
"ethAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
29+
"bridgeOwnerAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
3030
"secret": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
3131
"type": "PRIVATE_KEY_HEX"
3232
},
@@ -47,7 +47,7 @@
4747
"ledgerType": "ETHEREUM"
4848
},
4949
"signingCredential": {
50-
"ethAccount": "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
50+
"bridgeOwnerAccount": "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
5151
"secret": "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
5252
"type": "PRIVATE_KEY_HEX"
5353
},

packages/cactus-plugin-satp-hermes/src/examples/config/oracle-case3-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ledgerType": "ETHEREUM"
2727
},
2828
"signingCredential": {
29-
"ethAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
29+
"bridgeOwnerAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
3030
"secret": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
3131
"type": "PRIVATE_KEY_HEX"
3232
},

packages/cactus-plugin-satp-hermes/src/examples/config/oracle-case4-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ledgerType": "ETHEREUM"
2727
},
2828
"signingCredential": {
29-
"ethAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
29+
"bridgeOwnerAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
3030
"secret": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
3131
"type": "PRIVATE_KEY_HEX"
3232
},
@@ -47,7 +47,7 @@
4747
"ledgerType": "ETHEREUM"
4848
},
4949
"signingCredential": {
50-
"ethAccount": "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
50+
"bridgeOwnerAccount": "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
5151
"secret": "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
5252
"type": "PRIVATE_KEY_HEX"
5353
},

packages/cactus-plugin-satp-hermes/src/examples/config/satp-gateway1-config.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@
4545
"gatewayClientPort": 3011,
4646
"gatewayServerPort": 3010,
4747
"gatewayOapiPort": 4010,
48-
"pubKey": "024c0cf54f92d23dbb3d409a8047aa2a44abcb911767d3516b19fd94c2358dec65"
48+
"identificationCredentials": {
49+
"signingAlgorithm": "SECP256K1",
50+
"pubKey": "024c0cf54f92d23dbb3d409a8047aa2a44abcb911767d3516b19fd94c2358dec65"
51+
}
4952
}
5053
],
5154
"environment": "development",
@@ -57,7 +60,7 @@
5760
"ledgerType": "ETHEREUM"
5861
},
5962
"signingCredential": {
60-
"ethAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
63+
"bridgeOwnerAccount": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
6164
"secret": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
6265
"type": "PRIVATE_KEY_HEX"
6366
},

packages/cactus-plugin-satp-hermes/src/examples/config/satp-gateway2-config.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
"gatewayClientPort": 3011,
2121
"gatewayServerPort": 3010,
2222
"gatewayOapiPort": 4010,
23-
"pubKey": "024c0cf54f92d23dbb3d409a8047aa2a44abcb911767d3516b19fd94c2358dec65"
23+
"identificationCredentials": {
24+
"signingAlgorithm": "SECP256K1",
25+
"pubKey": "024c0cf54f92d23dbb3d409a8047aa2a44abcb911767d3516b19fd94c2358dec65"
26+
}
27+
2428
},
2529
"logLevel": "TRACE",
2630
"counterPartyGateways": [
@@ -57,7 +61,7 @@
5761
"ledgerType": "ETHEREUM"
5862
},
5963
"signingCredential": {
60-
"ethAccount": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
64+
"bridgeOwnerAccount": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
6165
"secret": "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
6266
"type": "PRIVATE_KEY_HEX"
6367
},

packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,30 @@ export type Address =
140140
| `https://${string}`
141141
| `${number}.${number}.${number}.${number}`;
142142

143+
/**
144+
* Enumeration of supported signing algorithms.
145+
*
146+
* @description
147+
* Defines the cryptographic signing algorithms supported for
148+
* gateway identification credentials.
149+
*/
150+
export enum SupportedSigningAlgorithms {
151+
SECP256K1 = "SECP256K1",
152+
}
153+
154+
/**
155+
* Identification credential structure for gateways.
156+
*
157+
* @description
158+
* Defines the structure for gateway identification credentials
159+
* including the signing algorithm used for key generation and
160+
* the respective public key.
161+
*/
162+
export type IdentificationCredential = {
163+
signingAlgorithm: SupportedSigningAlgorithms;
164+
pubKey: string;
165+
};
166+
143167
/**
144168
* SATP gateway identity structure.
145169
*
@@ -150,8 +174,8 @@ export type Address =
150174
export type GatewayIdentity = {
151175
/** Unique gateway identifier */
152176
id: string;
153-
/** Optional public key for cryptographic operations */
154-
pubKey?: string;
177+
/** Optional identification credential for the gateway*/
178+
identificationCredential?: IdentificationCredential;
155179
/** Optional human-readable gateway name */
156180
name?: string;
157181
/** Supported SATP draft versions */

packages/cactus-plugin-satp-hermes/src/main/typescript/cross-chain-mechanisms/bridge/bridge-manager.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,14 @@ import { SATPLoggerProvider as LoggerProvider } from "../../core/satp-logger-pro
4040
import { SATPLogger as Logger } from "../../core/satp-logger";
4141
import { BridgeLeaf } from "./bridge-leaf";
4242
import { LedgerType } from "@hyperledger/cactus-core-api";
43-
import { BesuLeaf, IBesuLeafNeworkOptions } from "./leafs/besu-leaf";
43+
import { BesuLeaf } from "./leafs/besu-leaf";
4444
import {
4545
DeployLeafError,
4646
LeafError,
4747
UnsupportedNetworkError,
4848
WrapperContractAlreadyCreatedError,
4949
} from "../common/errors";
50-
import {
51-
EthereumLeaf,
52-
IEthereumLeafNeworkOptions,
53-
} from "./leafs/ethereum-leaf";
50+
import { EthereumLeaf } from "./leafs/ethereum-leaf";
5451
import { FabricLeaf, IFabricLeafNeworkOptions } from "./leafs/fabric-leaf";
5552
import { BridgeManagerAdminInterface } from "./interfaces/bridge-manager-admin-interface";
5653
import { BridgeManagerClientInterface } from "./interfaces/bridge-manager-client-interface";
@@ -60,7 +57,11 @@ import {
6057
} from "../../generated/proto/cacti/satp/v02/common/message_pb";
6158
import { SATPBridgeExecutionLayer } from "./satp-bridge-execution-layer";
6259
import { SATPBridgeExecutionLayerImpl } from "./satp-bridge-execution-layer-implementation";
63-
import { INetworkOptions } from "./bridge-types";
60+
import {
61+
IBesuNetworkConfig,
62+
IEthereumNetworkConfig,
63+
INetworkOptions,
64+
} from "./bridge-types";
6465
import {
6566
IOntologyManagerOptions,
6667
OntologyManager,
@@ -185,7 +186,7 @@ export class BridgeManager
185186
)}`,
186187
);
187188
const besuNetworkOptions =
188-
leafNetworkOptions as unknown as IBesuLeafNeworkOptions;
189+
leafNetworkOptions as unknown as IBesuNetworkConfig;
189190
if (!this.ontologyManager) {
190191
throw new Error(`${fnTag}, Ontology Manager is not defined`);
191192
}
@@ -215,7 +216,7 @@ export class BridgeManager
215216
)}`,
216217
);
217218
const ethereumNetworkOptions =
218-
leafNetworkOptions as unknown as IEthereumLeafNeworkOptions;
219+
leafNetworkOptions as unknown as IEthereumNetworkConfig;
219220
if (!this.ontologyManager) {
220221
throw new Error(`${fnTag}, Ontology Manager is not defined`);
221222
}

0 commit comments

Comments
 (0)