Bug fixes

This commit is contained in:
Luis Fernando Molina committed 2021-12-01 08:36:30 +01:00
1 parent 58663b6968
commit 4c85b86231
4 files changed
+17 -14

No files matched your search

+2 -2
View File
@@ -38,8 +38,8 @@ exports.newEnvironment = function () {
PLATFORM_APP_SIGNING_ACCOUNT: 'Algo-Traders-Platform-1',
P2P_NETWORK_NODE_SIGNING_ACCOUNT: 'P2P-Network-Node-1',
P2P_NETWORK_NODE_MAX_INCOMING_CLIENTS: 1,
P2P_NETWORK_NODE_MAX_INCOMING_PEERS: 2,
P2P_NETWORK_NODE_MAX_OUTGOING_PEERS: 2
P2P_NETWORK_NODE_MAX_INCOMING_PEERS: 0,
P2P_NETWORK_NODE_MAX_OUTGOING_PEERS: 0
}
if (process.env.DATA_PATH) {
@@ -3707,7 +3707,7 @@
{
"type": "P2P Network Node",
"name": "P2P Network Node #2",
"config": "{\n \"codeName\": \"P2P-Network-Node-2\",\n \"host\": \"localhost\",\n \"webPort\": \"31248\",\n \"webSocketsPort\": \"18042\"\n}",
"config": "{\n \"codeName\": \"P2P-Network-Node-2\",\n \"host\": \"localhost\",\n \"webPort\": \"31249\",\n \"webSocketsPort\": \"18043\"\n}",
"project": "Governance",
"signingAccount": {
"type": "Signing Account",
@@ -3774,7 +3774,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -273,10 +273,10 @@ function newGovernanceFunctionLibraryProfileConstructor() {
console.log('Call to WEB3 Server failed. ' + response.error)
return
}
signSigningAccountData(response.privateKey)
signSigningAccountData(response.address, response.privateKey)
}
function signSigningAccountData(privateKey) {
function signSigningAccountData(blockchainAccount, privateKey) {
let request = {
url: 'WEB3',
@@ -349,6 +349,7 @@ function newGovernanceFunctionLibraryProfileConstructor() {
nodeType: targetNodeType,
nodeCodeName: codeName,
signingAccountNodeId: signingAccount.id,
blockchainAccount: blockchainAccount,
privateKey: privateKey,
userProfileHandle: userProfileHandle,
userProfileId: userProfile.id
@@ -8,7 +8,8 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
port: undefined,
callerRole: undefined,
p2pNetworkNode: undefined,
p2pNetworkIdentity: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetworkClientCodeName: undefined,
onConnectionClosedCallBack: undefined,
sendMessage: sendMessage,
initialize: initialize,
@@ -30,7 +31,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
thisObject.port = undefined
thisObject.callerRole = undefined
thisObject.p2pNetworkNode = undefined
thisObject.p2pNetworkIdentity = undefined
thisObject.p2pNetworkClientIdentity = undefined
thisObject.onConnectionClosedCallBack = undefined
web3 = undefined
@@ -38,10 +39,11 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
onMessageFunctionsMap = undefined
}
async function initialize(callerRole, p2pNetworkIdentity, p2pNetworkNode, onConnectionClosedCallBack) {
async function initialize(callerRole, p2pNetworkClientIdentity, p2pNetworkNode, onConnectionClosedCallBack) {
thisObject.callerRole = callerRole
thisObject.p2pNetworkIdentity = p2pNetworkIdentity
thisObject.p2pNetworkClientIdentity = p2pNetworkClientIdentity
thisObject.p2pNetworkClientCodeName = JSON.parse(thisObject.p2pNetworkClientIdentity.node.config).codeName
thisObject.p2pNetworkNode = p2pNetworkNode
thisObject.onConnectionClosedCallBack = onConnectionClosedCallBack
@@ -100,9 +102,9 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
let message = {
messageType: 'Handshake',
callerRole: thisObject.callerRole,
callerProfileHandle: SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileHandle,
callerProfileHandle: SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).userProfileHandle,
callerTimestamp: callerTimestamp,
callerNode: JSON.stringify(thisObject.p2pNetworkIdentity.node),
callerNode: JSON.stringify(thisObject.p2pNetworkClientIdentity.node),
step: 'One'
}
thisObject.socket.send(JSON.stringify(message))
@@ -162,7 +164,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
We will check that the profile handle we sent to the Network Node, is returned at the
signed message, to avoid man in the middle attacks.
*/
if (signedMessage.callerProfileHandle !== SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileHandle) {
if (signedMessage.callerProfileHandle !== SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).userProfileHandle) {
console.log('[ERROR] Web Sockets Network Client -> stepOneResponse -> The Network Node callerProfileHandle does not match my own userProfileHandle.')
reject()
return
@@ -192,7 +194,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
*/
thisObject.socket.onmessage = socketMessage => { stepTwoResponse(socketMessage) }
let signature = web3.eth.accounts.sign(JSON.stringify(signedMessage), SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).privateKey)
let signature = web3.eth.accounts.sign(JSON.stringify(signedMessage), SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).privateKey)
let message = {
messageType: 'Handshake',