Skip to content

Commit

Permalink
Add some of the network logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihajlo-Pavlovic committed Dec 19, 2024
1 parent af4739d commit 5bb2386
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
ual,
includeMetadata,
assertionId,
isOperationV0,
} = commandData;

// if (paranetUAL) {
Expand Down Expand Up @@ -109,17 +110,21 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {

let assertionPromise;

if (assertionId) {
assertionPromise = this.tripleStoreService
.getV6Assertion(TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, assertionId)
.then((result) => {
this.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.GET.GET_REMOTE_GET_ASSERTION_END,
operationId,
blockchain,
);
return result;
});
if (isOperationV0) {
if (!assertionId) {
// Find assertion id
} else {
assertionPromise = this.tripleStoreService
.getV6Assertion(TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, assertionId)
.then((result) => {
this.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.GET.GET_REMOTE_GET_ASSERTION_END,
operationId,
blockchain,
);
return result;
});
}
} else {
assertionPromise = this.tripleStoreService
.getAssertion(
Expand Down
5 changes: 4 additions & 1 deletion src/commands/protocols/get/sender/get-find-shard-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class GetFindShardCommand extends FindShardCommand {
getOperationCommandSequence(nodePartOfShard, commandData) {
const sequence = [];
if (nodePartOfShard) {
sequence.push('localGetCommand');
// If operationV0 and no assertionId found go directly to networkGet
if (!commandData.isOperationV0 || commandData.assertionId) {
sequence.push('localGetCommand');
}
}
sequence.push('networkGetCommand');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class GetScheduleMessagesCommand extends ProtocolScheduleMessagesCommand {
paranetUAL: command.data.paranetUAL,
paranetId: command.data.paranetId,
paranetMetadata: command.data.paranetMetadata,
assertionId: command.data.isOperationV0,
isOperationV0: command.data.assertionId,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class GetRequestCommand extends ProtocolRequestCommand {
ual,
paranetUAL,
paranetId,
isOperationV0,
assertionId,
} = command.data;

return {
Expand All @@ -58,6 +60,8 @@ class GetRequestCommand extends ProtocolRequestCommand {
ual,
paranetUAL,
paranetId,
isOperationV0,
assertionId,
};
}

Expand Down
2 changes: 2 additions & 0 deletions src/controllers/rpc/get-rpc-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class GetController extends BaseController {
state: message.data.state ?? DEFAULT_GET_STATE,
paranetUAL: message.data.paranetUAL,
paranetId: message.data.paranetId,
isOperationV0: message.data.isOperationV0,
assertionId: message.data.assertionId,
},
transactional: false,
});
Expand Down

0 comments on commit 5bb2386

Please sign in to comment.