Skip to content

Commit

Permalink
feat(satp-hermes): add protobuf gateway refactor
Browse files Browse the repository at this point in the history
Authored by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): satp proto update (hyperledger-cacti#3147)

* feat(satp-hermes): update protos

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

* feat(satp-hermes): protos

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

* feat(satp-hermes): protos

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

---------

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

feat(satp-hermes): update protos

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

feat(satp-hermes): core stage services message names update

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

feat(satp-hermes): gRPC server start implementation and gateway_refactor in handlers

Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>

fix(satp-hermes): satp proto update

also updates yarn lock

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

fix(satp-hermes): update yarn, comment method

fix(satp-hermes): update yarn

ci(satp-hermes): fix bungee and satp ci

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>
  • Loading branch information
LordKubaya authored and RafaelAPB committed Jan 31, 2025
1 parent da02a85 commit 5f022ce
Show file tree
Hide file tree
Showing 47 changed files with 7,544 additions and 367 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1759,33 +1759,33 @@ jobs:
with:
name: coverage-reports-35
path: ./code-coverage-ts/**/
# cactus-plugin-satp-hermes:
# continue-on-error: false
# env:
# FULL_BUILD_DISABLED: true
# JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
# JEST_TEST_RUNNER_DISABLED: false
# TAPE_TEST_RUNNER_DISABLED: true
# needs: build-dev
# runs-on: ubuntu-22.04
# steps:
# - name: Use Node.js ${{ env.NODEJS_VERSION }}
# uses: actions/setup-node@v4.0.3
# with:
# node-version: ${{ env.NODEJS_VERSION }}
# - uses: actions/checkout@v4.1.7
# - id: yarn-cache-dir-path
# name: Get yarn cache directory path
# run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
# - id: yarn-cache
# name: Restore Yarn Cache
# uses: actions/cache@v4.0.2
# with:
# key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
# path: ./.yarn/
# restore-keys: |
# ${{ runner.os }}-yarn-
# - run: ./tools/ci.sh
cactus-plugin-satp-hermes:
continue-on-error: false
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
TAPE_TEST_RUNNER_DISABLED: true
needs: build-dev
runs-on: ubuntu-22.04
steps:
- name: Use Node.js ${{ env.NODEJS_VERSION }}
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ env.NODEJS_VERSION }}
- uses: actions/checkout@v4.1.1
- id: yarn-cache-dir-path
name: Get yarn cache directory path
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
- id: yarn-cache
name: Restore Yarn Cache
uses: actions/cache@v4.0.1
with:
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
path: ./.yarn/
restore-keys: |
${{ runner.os }}-yarn-
- run: ./tools/ci.sh
cp-bungee-hermes:
continue-on-error: false
env:
Expand All @@ -1794,8 +1794,8 @@ jobs:
# Free space left: 26 MB
FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED: false
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_PATTERN: packages/cactus-plugin-bungee-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cp-bungee-hermes
JEST_TEST_CODE_COVERAGE_ENABLED: true
TAPE_TEST_RUNNER_DISABLED: true
Expand All @@ -1815,7 +1815,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
path: ./.yarn/
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
${{ runner.os }}-yarn-
- run: ./tools/ci.sh
if: ${{ env.RUN_CODE_COVERAGE == 'true' }}
- name: Upload coverage reports as artifacts
Expand Down
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = {
setupFilesAfterEnv: ["jest-extended/all", "./jest.setup.console.logs.js"],
testTimeout: 60 * 60 * 1000,
moduleNameMapper: {
"^(.+)/(.+)_pb\\.js$": "$1/$2_pb"
},
"^(.+)/(.+)_pb\\.js$": "$1/$2_pb",
},
testMatch: [
`**/cactus-*/src/test/typescript/{unit,integration,benchmark}/**/*.test.ts`,
`**/cacti-*/src/test/typescript/{unit,integration,benchmark}/**/*.test.ts`,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,157 @@ package cacti.satp.v02.common;

import "google/protobuf/empty.proto";

// TODO: requires fully qualified path from buf.gen.yaml
import "cacti/satp/v02/common/message.proto";



message SessionData {
string id = 1;
string version = 2;
string transfer_context_id = 3;
MessageStagesHashes hashes = 4;
cacti.satp.v02.common.PayloadProfile payload_profile = 5;
MessageStagesSignatures signatures = 6;
string max_retries = 7;
string max_timeout = 8;
string logging_profile = 9;
string recipient_base_path = 10;
string source_base_path = 11;
string access_control_profile = 12;
string application_profile = 13;
int64 last_sequence_number = 14;
string sender_gateway_network_id = 15;
string recipient_gateway_network_id = 16;
string source_ledger_asset_id = 17;
string recipient_ledger_asset_id = 18;
string server_gateway_pubkey = 19;
string client_gateway_pubkey = 20;
string verified_originator_entity_id = 21;
string verified_beneficiary_entity_id = 22;
string asset_profile_id = 23;
string digital_asset_id = 24;
string originator_pubkey = 25;
string beneficiary_pubkey = 26;
string sender_gateway_owner_id = 27;
string receiver_gateway_owner_id = 28;
string hash_transfer_init_claims = 29;
cacti.satp.v02.common.SignatureAlgorithm signature_algorithm = 30;
cacti.satp.v02.common.LockType lock_type = 31;
uint64 lock_expiration_time = 32;
cacti.satp.v02.common.Permissions permitions = 33;
string developer_urn = 34;
cacti.satp.v02.common.CredentialProfile credential_profile = 35;
string subsequent_calls = 36;
string history = 37;
bool multiple_claims_allowed = 38;
bool multiple_cancels_allowed = 39;
string last_message_received_timestamp = 40;
MessageStagesTimestamps processed_timestamps = 41;
MessageStagesTimestamps received_timestamps = 42;
cacti.satp.v02.common.LockAssertionClaim lock_assertion_claim = 43;
cacti.satp.v02.common.LockAssertionFormat lock_assertion_format = 44;
cacti.satp.v02.common.MintAssertionClaims mint_assertion_claims = 45;
cacti.satp.v02.common.MintAssertionClaimsFormat mint_assertion_claims_format = 46;
cacti.satp.v02.common.BurnAssertionClaim burn_assertion_claim = 47;
cacti.satp.v02.common.BurnAssertionClaimFormat burn_assertion_claim_format = 48;
cacti.satp.v02.common.AssignmentAssertionClaim assignment_assertion_claim = 49;
cacti.satp.v02.common.AssignmentAssertionClaimFormat assignment_assertion_claim_format = 50;
}



message MessageStagesHashes {
Stage1Hashes stage1 = 1;
Stage2Hashes stage2 = 2;
Stage3Hashes stage3 = 3;
}

message Stage1Hashes {
string transfer_proposal_request_message_hash = 1;
string transfer_proposal_receipt_message_hash = 2;
string transfer_proposal_reject_message_hash = 3;
string transfer_commence_request_message_hash = 4;
string transfer_commence_response_message_hash = 5;
}

message Stage2Hashes {
string lock_assertion_request_message_hash = 1;
string lock_assertion_receipt_message_hash = 2;
}

message Stage3Hashes {
string commit_preparation_request_message_hash = 1;
string commit_ready_response_message_hash = 2;
string commit_final_assertion_request_message_hash = 3;
string commit_final_acknowledgement_receipt_response_message_hash = 4;
string transfer_complete_request_message_hash = 5;
string transfer_complete_response_message_hash = 6;
}

message MessageStagesSignatures {
Stage1Signatures stage1 = 1;
Stage2Signatures stage2 = 2;
Stage3Signatures stage3 = 3;
}

message Stage1Signatures {
string transfer_proposal_request_message_client_signature = 1;
string transfer_proposal_receipt_message_server_signature = 2;
string transfer_proposal_reject_message_server_signature = 3;
string transfer_commence_request_message_client_signature = 4;
string transfer_commence_response_message_server_signature = 5;
}

message Stage2Signatures {
string lock_assertion_request_message_client_signature = 1;
string lock_assertion_receipt_message_server_signature = 2;
}

message Stage3Signatures {
string commit_preparation_request_message_client_signature = 1;
string commit_ready_response_message_server_signature = 2;
string commit_final_assertion_request_message_client_signature = 3;
string commit_final_acknowledgement_receipt_response_message_server_signature = 4;
string transfer_complete_request_message_client_signature = 5;
string transfer_complete_response_message_server_signature = 6;
}

message MessageStagesTimestamps {
Stage1Timestamps stage1 = 1;
Stage2Timestamps stage2 = 2;
Stage3Timestamps stage3 = 3;
}

message Stage1Timestamps {
string transfer_proposal_request_message_timestamp = 1;
string transfer_proposal_receipt_message_timestamp = 2;
string transfer_proposal_reject_message_timestamp = 3;
string transfer_commence_request_message_timestamp = 4;
string transfer_commence_response_message_timestamp = 5;
}

message Stage2Timestamps {
string lock_assertion_request_message_timestamp = 1;
string lock_assertion_receipt_message_timestamp = 2;
}

message Stage3Timestamps {
string commit_preparation_request_message_timestamp = 1;
string commit_ready_response_message_timestamp = 2;
string commit_final_assertion_request_message_timestamp = 3;
string commit_final_acknoledgement_receipt_response_message_timestamp = 4;
string transfer_complete_request_message_timestamp = 5;
string transfer_complete_response_message_timestamp = 6;
}

message SendStatusRequest {
string status = 1;
bool hasBackup = 2;
bool has_backup = 2;
}

message SendStatusResponse {
string status = 1;
bool hasBackup = 2;
bool has_backup = 2;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@

syntax = "proto3";
package cacti.satp.v02.stage_0;
package cacti.satp.v02;

import "google/protobuf/empty.proto";
import "cacti/satp/v02/common/message.proto";

service SATPStage0 {
// util RPCs

// step RPCs
rpc TransferProposalClaims(TransferProposalClaimsRequest) returns (TransferProposalClaimsResponse) {};
// todo other rpcs
}

message TransferProposalClaimsRequest {
string message_type = 1;
string asset_asset_id = 2;
string asset_profile_id = 3;
string verified_originator_entity_id = 4;
string verified_beneficiary_entity_id = 5;
string originator_pubkey = 6;
string beneficiary_pubkey = 7;
string sender_gateway_network_id = 8;
string recipient_gateway_network_id = 9;
string client_identity_pubkey = 10;
string server_identity_pubkey = 11;
string sender_gateway_owner_id = 12;
string receiver_gateway_owner_id = 13;
message PreTransferVerificationAndContextEstablishmentRequest {
cacti.satp.v02.common.CommonSatp context = 1;
cacti.satp.v02.common.TransferClaims transferClaims = 2;
// todo other fields
}

// TODO
message TransferProposalClaimsResponse {
string message_type = 1;
message PreTransferVerificationAndContextEstablishmentResponse {

}

service SatpStage0Service {
// util RPCs

// step RPCs
rpc TransferProposalClaims(PreTransferVerificationAndContextEstablishmentRequest) returns (PreTransferVerificationAndContextEstablishmentResponse) {};
// todo other rpcs
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@

syntax = "proto3";
package cacti.satp.v02.stage_1;
package cacti.satp.v02;

import "google/protobuf/empty.proto";
import "cacti/satp/v02/common/message.proto";


service SATPStage1 {
// util RPCs
message TransferProposalRequestMessage {
cacti.satp.v02.common.CommonSatp common = 1;
cacti.satp.v02.common.TransferClaims transfer_init_claims = 2;
cacti.satp.v02.common.TransferClaimsFormat transfer_init_claims_format = 3;
cacti.satp.v02.common.NetworkCapabilities network_capabilities = 4;
bool multiple_claims_allowed = 5;
bool multiple_cancels_allowed = 6;
}

// step RPCs
message TransferProposalReceiptRejectMessage {
cacti.satp.v02.common.CommonSatp common = 1;
string hash_transfer_init_claims = 2;
cacti.satp.v02.common.TransferClaims transfer_counter_claims = 3;
string timestamp = 4;
}

message TransferCommenceRequestMessage {
cacti.satp.v02.common.CommonSatp common = 1;
string hash_transfer_init_claims = 2;
string client_transfer_number = 3;
}

message TransferCommenceResponseMessage {
cacti.satp.v02.common.CommonSatp common = 1;
}

service SatpStage1Service {
rpc TransferProposal(TransferProposalRequestMessage) returns (TransferProposalReceiptRejectMessage) {}
rpc TransferCommence(TransferCommenceRequestMessage) returns (TransferCommenceResponseMessage) {}
}
Loading

0 comments on commit 5f022ce

Please sign in to comment.