Skip to content

Gossip protocol#6

Open
desimira wants to merge 8 commits intomasterfrom
gossip-protocol
Open

Gossip protocol#6
desimira wants to merge 8 commits intomasterfrom
gossip-protocol

Conversation

@desimira
Copy link
Contributor

No description provided.

connection: 'connection',
incommingConnection: 'incommingConnection',
nodesList: 'nodesList',
idCreation: 'idCreation',
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably be idCreated

@@ -1,5 +1,7 @@
const _ = require('lodash');
const RelayerService = require('./../services/relayerService.js');
let event = require('./../relayer.js')
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think you use this and the name is wrong


static config () {
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://127.0.0.1:27017/counterfactual', { useNewUrlParser: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

The database connection should be passed as param to the node


socket.on(event.idCreation, async function(data){
await databaseManager.addToDatabase(data.counterfactualContractAddress, data)
console.log(`Identity on address ${data.counterfactualContractAddress} has been created and successfully saved on your database`)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not yet created but it has been counterfactually created

socket.on(event.idDeployed, async function(data){
let record = await databaseManager.findRecord(data)

if(record && record.status === 'notDeployed'){
Copy link
Contributor

Choose a reason for hiding this comment

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

notDeployed should be a constant somewhere

},


emitIdDataOnCreation: function(data){
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel that this can very easily be confused for actual deployment as opposed to Counterfactual creation. Maybe we should rename this to emitCounterfactualIdentityData


module.exports = {

addToDatabase: async function(counterfactualContractAddress, fullCounterfactualData){
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel these should be much more meaningful in the context - saveCounterfactualData, findCounterfactualData, etc...

if (counterfactualData) {
let record = await databaseManager.findRecord(identityAddress)

if (record) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check if someone has already executed this counterfactual transaction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants