Skip to content
This repository has been archived by the owner on Jun 21, 2020. It is now read-only.

BLD: adjusting to core & ppal msgs #123

Closed
wants to merge 12 commits into from
19 changes: 11 additions & 8 deletions src/core/core_messages_scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@
"userDHKey": {"type": "string"},
"gasLimit": {"type": "number"},
"contractAddress": {"type": "string"},
"preCode": {
"type": "array",
"items": {
"type": "number",
"minItems": 1
}
}
"preCode": {"type": "string"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how did that happen but I think the right thing to do is to change it in core to Vec<u8>

},
"required": ["preCode", "encryptedArgs", "encryptedFn", "userDHKey", "gasLimit", "contractAddress"],
"additionalProperties": false
Expand All @@ -163,7 +157,16 @@
"required": ["input"],
"additionalProperties": false
},
"GetPTTRequest": {},
"GetPTTRequest": {
"properties":{
"input": {
"type": "array",
"items": {"type": "string"}
elichai marked this conversation as resolved.
Show resolved Hide resolved
}
},
"required": ["input"],
"additionalProperties": false
},
"PTTResponse": {
"properties": {
"input": {
Expand Down
5 changes: 1 addition & 4 deletions src/policy/p2p_messages/principal_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ class MsgPrincipal {
}

toJson() {
return {
'requestMessage': this.getRequest(),
'workerSig': this.getSig(),
};
return [this.getRequest(),this.getSig()];
lacabra marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/worker/controller/actions/GetStateKeysAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ class GetStateKeysAction {
}

execute(params) {
let onResponse = params.onResponse;
let onResponse;
try { // We account for the fact that params may be undefined
onResponse = params.onResponse;
} catch (e) {
onResponse = () => {};
}
if (!onResponse) {
lacabra marked this conversation as resolved.
Show resolved Hide resolved
onResponse = () => {};
}
Expand All @@ -37,7 +42,7 @@ class GetStateKeysAction {
principalResponse = await this._controller.principal().getStateKeys(msg);
} catch (err) {
// TODO: Errors.
this._controller.logger().error(`Failed Principal node connection: ${err}`);
this._controller.logger().error(`Failed Principal node connection: ${err.code} - ${err.message}`);
return onResponse(err, null);
}
this._pttResponse({response: principalResponse.data, sig: principalResponse.sig}, (err, response) => {
Expand Down