Skip to content

Commit

Permalink
squash!(satp-hermes): rebase with main
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Belchior <[email protected]>
  • Loading branch information
RafaelAPB committed Nov 9, 2024
1 parent 6ad3fcd commit 13e0302
Show file tree
Hide file tree
Showing 9 changed files with 6,919 additions and 11,930 deletions.
24 changes: 12 additions & 12 deletions examples/cactus-example-cbdc-bridging-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@
},
"dependencies": {
"@foundry-rs/hardhat-forge": "0.1.17",
"@hyperledger/cactus-api-client": "2.0.0-rc.7",
"@hyperledger/cactus-cmd-api-server": "2.0.0-rc.7",
"@hyperledger/cactus-common": "2.0.0-rc.7",
"@hyperledger/cactus-core": "2.0.0-rc.7",
"@hyperledger/cactus-core-api": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-ledger-connector-besu": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-ledger-connector-fabric": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-ledger-connector-xdai": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-object-store-ipfs": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-satp-hermes": "2.0.0-rc.7",
"@hyperledger/cactus-test-tooling": "2.0.0-rc.7",
"@hyperledger/cactus-api-client": "2.0.0",
"@hyperledger/cactus-cmd-api-server": "2.0.0",
"@hyperledger/cactus-common": "2.0.0",
"@hyperledger/cactus-core": "2.0.0",
"@hyperledger/cactus-core-api": "2.0.0",
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-besu": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-fabric": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-xdai": "2.0.0",
"@hyperledger/cactus-plugin-object-store-ipfs": "2.0.0",
"@hyperledger/cactus-plugin-satp-hermes": "2.0.0",
"@hyperledger/cactus-test-tooling": "2.0.0",
"@openzeppelin/contracts": "5.0.2",
"@openzeppelin/contracts-upgradeable": "4.9.6",
"async-exit-hook": "2.0.1",
Expand Down
83 changes: 42 additions & 41 deletions packages/cacti-plugin-weaver-driver-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,48 @@
"bugs": {
"url": "https://github.com/hyperledger-cacti/cacti/issues"
},
{
"name": "Venkatraman Ramakrishna",
"email": "[email protected]",
"url": "https://researcher.watson.ibm.com/researcher/view.php?person=in-vramakr2"
"contributors": [
{
"name": "Venkatraman Ramakrishna",
"email": "[email protected]",
"url": "https://researcher.watson.ibm.com/researcher/view.php?person=in-vramakr2"
},
{
"name": "Sandeep Nishad",
"email": "[email protected]",
"url": "https://github.com/sandeepnRES"
},
{
"name": "Krishnasuri Narayanam",
"email": "[email protected]",
"url": "https://research.ibm.com/people/krishnasuri-narayanam"
}
],
"main": "dist/lib/main/typescript/index.js",
"module": "dist/lib/main/typescript/index.js",
"types": "dist/lib/main/typescript/index.d.ts",
"files": [
"dist/*"
],
"scripts": {
"build": "cd src/main/typescript && make build",
"build-image": "cd src/main/typescript && make build-image",
"build-image-local": "cd src/main/typescript && make build-image-local",
"build-local": "cd src/main/typescript && make build-local",
"clean": "cd src/main/typescript && make clean",
"clean-local": "cd src/main/typescript && make clean-local",
"publish": "cd src/main/typescript && make push-image && make push-image-latest",
"postpublish": "cd src/main/typescript && make push-image-latest",
"watch": "npm-watch"
},
"engines": {
"node": ">=18",
"npm": ">=8"
},
{
"name": "Sandeep Nishad",
"email": "[email protected]",
"url": "https://github.com/sandeepnRES"
"publishConfig": {
"access": "public"
},
{
"name": "Krishnasuri Narayanam",
"email": "[email protected]",
"url": "https://research.ibm.com/people/krishnasuri-narayanam"
}
],
"main": "dist/lib/main/typescript/index.js",
"module": "dist/lib/main/typescript/index.js",
"types": "dist/lib/main/typescript/index.d.ts",
"files": [
"dist/*"
],
"scripts": {
"build": "cd src/main/typescript && make build",
"build-image": "cd src/main/typescript && make build-image",
"build-image-local": "cd src/main/typescript && make build-image-local",
"build-local": "cd src/main/typescript && make build-local",
"clean": "cd src/main/typescript && make clean",
"clean-local": "cd src/main/typescript && make clean-local",
"publish": "cd src/main/typescript && make push-image && make push-image-latest",
"postpublish": "cd src/main/typescript && make push-image-latest",
"watch": "npm-watch"
},
"engines": {
"node": ">=18",
"npm": ">=8"
},
"publishConfig": {
"access": "public"
},
"browserMinified": "dist/cacti-weaver-driver-fabric.web.umd.min.js",
"mainMinified": "dist/cacti-weaver-driver-fabric.node.umd.min.js",
"watch": {}
"browserMinified": "dist/cacti-weaver-driver-fabric.web.umd.min.js",
"mainMinified": "dist/cacti-weaver-driver-fabric.node.umd.min.js",
"watch": {}
}
20 changes: 10 additions & 10 deletions packages/cactus-plugin-ccmodel-hephaestus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperledger/cactus-plugin-ccmodel-hephaestus",
"version": "2.0.0-rc.7",
"version": "2.0.0",
"description": "A web service plugin that provides management capabilities on cross-chain transactions visualization.",
"keywords": [
"Hyperledger",
Expand Down Expand Up @@ -62,22 +62,22 @@
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js"
},
"dependencies": {
"@hyperledger/cactus-common": "2.0.0-rc.7",
"@hyperledger/cactus-core": "2.0.0-rc.7",
"@hyperledger/cactus-core-api": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-ledger-connector-besu": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-ledger-connector-ethereum": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-ledger-connector-fabric": "2.0.0-rc.7",
"@hyperledger/cactus-common": "2.0.0",
"@hyperledger/cactus-core": "2.0.0",
"@hyperledger/cactus-core-api": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-besu": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-ethereum": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-fabric": "2.0.0",
"express": "4.21.0",
"run-time-error-cjs": "1.4.0",
"rxjs": "7.8.1",
"typescript-optional": "2.0.1",
"uuid": "10.0.0"
},
"devDependencies": {
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.7",
"@hyperledger/cactus-test-geth-ledger": "2.0.0-rc.7",
"@hyperledger/cactus-test-tooling": "2.0.0-rc.7",
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0",
"@hyperledger/cactus-test-geth-ledger": "2.0.0",
"@hyperledger/cactus-test-tooling": "2.0.0",
"@types/express": "5.0.0",
"@types/uuid": "10.0.0",
"body-parser": "1.20.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/cactus-plugin-ledger-connector-ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
"sanitize-html": "2.12.1",
"socket.io-client-fixed-types": "4.5.4",
"typescript-optional": "2.0.1",
"web3": "4.14.0",
"web3-eth": "4.10.0",
"web3-eth-contract": "4.7.0"
"web3": "4.4.0",
"web3-eth": "4.4.0",
"web3-eth-contract": "4.2.0"
},
"devDependencies": {
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ export function signTransaction(
| FeeMarketEIP1559Transaction
| BlobEIP4844Transaction;
} {
let chainConfiguration = new Common({ chain: Chain.Mainnet });
let chainConfiguration = new Common({
chain: Chain.Mainnet,
hardfork: "istanbul",
});
if (customChainInfo) {
chainConfiguration = Common.custom(customChainInfo);
}

const transaction = TransactionFactory.fromTxData(txData, {
common: chainConfiguration,
common: chainConfiguration as any,
});
if (privateKey.toLowerCase().startsWith("0x")) {
privateKey = privateKey.slice(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import Web3, { BlockHeaderOutput, FMT_BYTES, FMT_NUMBER } from "web3";
import { NewHeadsSubscription } from "web3-eth";
import { NewHeadsSubscription, RegisteredSubscription } from "web3-eth";
import type { Socket as SocketIoSocket } from "socket.io";

import {
Expand All @@ -21,10 +21,7 @@ import {
WatchBlocksV1,
Web3Transaction,
} from "../generated/openapi/typescript-axios";
import {
ConvertWeb3ReturnToString,
Web3StringReturnFormat,
} from "../types/util-types";
import { ConvertWeb3ReturnToString } from "../types/util-types";

const DEFAULT_HTTP_POLL_INTERVAL = 1000 * 5; // 5 seconds
const LAST_SEEN_LATEST_BLOCK = -1; // must be negative number, will be replaced with latest block in code
Expand Down Expand Up @@ -337,7 +334,7 @@ export class WatchBlocksV1SubscriptionEndpoint extends WatchBlocksV1Endpoint {
}

public async subscribe() {
const { socket, log, web3, isGetBlockData } = this;
const { socket, log, isGetBlockData } = this;
log.info(`${WatchBlocksV1.Subscribe} [WS Subscription] => ${socket.id}`);

if (this.isSubscribed) {
Expand All @@ -352,46 +349,54 @@ export class WatchBlocksV1SubscriptionEndpoint extends WatchBlocksV1Endpoint {
await this.emitAllSinceLastSeenBlock();

log.debug("Subscribing to Web3 new block headers event...");
this.newBlocksSubscription = await web3.eth.subscribe(
"newBlockHeaders",
undefined,
Web3StringReturnFormat,
);

this.newBlocksSubscription.on("data", async (blockHeader) => {
try {
log.debug("newBlockHeaders:", blockHeader);

if (typeof blockHeader.number === undefined) {
throw new Error(
`Missing block number in received block header (number: ${blockHeader.number}, hash: ${blockHeader.hash})`,
);
}
const blockNumber = Number(blockHeader.number);
if (blockNumber - this.lastSeenBlock > 2) {
log.info(
`Detected missing blocks since latest one (blockNumber: ${blockNumber}, lastSeenBlock: ${this.lastSeenBlock})`,
);
await this.emitAllSinceLastSeenBlock();
}
const options = {
subscription: "newBlockHeaders" as keyof RegisteredSubscription,
parameters: {},
formatter: (data: BlockHeaderOutput) => data,
};

let next: WatchBlocksV1Progress;
if (isGetBlockData) {
next = await this.getFullBlockProgress(blockNumber);
} else {
next = await this.headerDataToBlockProgress(blockHeader);
this.newBlocksSubscription = (await this.web3.eth.subscribe(
options.subscription,
options.parameters,
)) as unknown as NewHeadsSubscription;

this.newBlocksSubscription?.on(
"data",
async (blockHeader: BlockHeaderOutput) => {
try {
log.debug("newBlockHeaders:", blockHeader);

if (blockHeader.number === undefined || blockHeader.number === null) {
throw new Error(
`Missing block number in received block header (number: ${blockHeader.number}, hash: ${blockHeader.hash})`,
);
}
const blockNumber = Number(blockHeader.number);
if (blockNumber - this.lastSeenBlock > 2) {
log.info(
`Detected missing blocks since latest one (blockNumber: ${blockNumber}, lastSeenBlock: ${this.lastSeenBlock})`,
);
await this.emitAllSinceLastSeenBlock();
}

let next: WatchBlocksV1Progress;
if (isGetBlockData) {
next = await this.getFullBlockProgress(blockNumber);
} else {
next = await this.headerDataToBlockProgress(blockHeader);
}

socket.emit(WatchBlocksV1.Next, next);

this.lastSeenBlock = blockNumber;
} catch (error) {
log.warn("Error when parsing subscribed block data:", error);
}
},
);

socket.emit(WatchBlocksV1.Next, next);

this.lastSeenBlock = blockNumber;
} catch (error) {
log.warn("Error when parsing subscribed block data:", error);
}
});

this.newBlocksSubscription.on("error", async (error) => {
console.log("Error when subscribing to new block header: ", error);
this.newBlocksSubscription?.on("error", async (error: Error) => {
log.error("Error when subscribing to new block header: ", error);
socket.emit(WatchBlocksV1.Error, safeStringifyException(error));
await this.unsubscribe();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { v4 as uuidV4 } from "uuid";
import { AddressInfo } from "net";
import { Server as SocketIoServer } from "socket.io";
import Web3, { HexString } from "web3";
import { Address } from "@ethereumjs/util";

import {
LogLevelDesc,
Expand Down Expand Up @@ -49,6 +50,7 @@ import {
signTransaction,
} from "../../../main/typescript/public-api";
import { K_CACTI_ETHEREUM_TOTAL_TX_COUNT } from "../../../main/typescript/prometheus-exporter/metrics";
import { AddressLike } from "ethers";

const containerImageName = "ghcr.io/hyperledger/cacti-geth-all-in-one";
const containerImageVersion = "2023-07-27-2a8c48ed6";
Expand Down Expand Up @@ -351,11 +353,11 @@ describe("Ethereum contract deploy and invoke using keychain tests", () => {

test("invoke Web3SigningCredentialType.None", async () => {
const testEthAccount2 = web3.eth.accounts.create();

const address = Address.fromString(testEthAccount2.address);
const value = 10e6;
const { serializedTransactionHex } = signTransaction(
{
to: testEthAccount2.address,
to: address,
value,
maxPriorityFeePerGas: 0,
maxFeePerGas: 0x40000000,
Expand Down
14 changes: 8 additions & 6 deletions packages/cactus-plugin-satp-hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Interoperability",
"Distributed Ledger Technology",
"IETF",
"Hyperledger Cacti",
"Secure Asset Transfer Protocol"
],
"repository": {
Expand Down Expand Up @@ -87,21 +88,22 @@
}
},
"dependencies": {
"@bufbuild/protobuf": "1.10.0",
"@connectrpc/connect": "1.3.0",
"@connectrpc/connect-express": "1.3.0",
"@connectrpc/connect-node": "1.3.0",
"@connectrpc/protoc-gen-connect-es": "1.3.0",
"@hyperledger/cactus-cmd-api-server": "2.0.0",
"@hyperledger/cactus-common": "2.0.0",
"@hyperledger/cactus-core": "2.0.0",
"@hyperledger/cactus-core-api": "2.0.0",
"@hyperledger/cactus-plugin-bungee-hermes": "2.0.0",
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-besu": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-ethereum": "2.0.0",
"@hyperledger/cactus-plugin-ledger-connector-fabric": "2.0.0",
"@hyperledger/cactus-plugin-object-store-ipfs": "2.0.0",
"@hyperledger/cactus-test-tooling": "2.0.0",
"@connectrpc/connect": "1.3.0",
"@connectrpc/connect-express": "1.3.0",
"@connectrpc/connect-node": "1.3.0",
"@connectrpc/protoc-gen-connect-es": "1.3.0",
"@bufbuild/protobuf": "1.10.0",
"@hyperledger/cactus-plugin-bungee-hermes": "2.0.0",
"axios": "1.7.7",
"bignumber.js": "9.1.2",
"bn.js": "5.2.1",
Expand Down
Loading

0 comments on commit 13e0302

Please sign in to comment.