Skip to content

(VDB-1164) admin workaround#46

Merged
gslaughl merged 1 commit intostagingfrom
vdb-1164-admin-workaround
Feb 18, 2020
Merged

(VDB-1164) admin workaround#46
gslaughl merged 1 commit intostagingfrom
vdb-1164-admin-workaround

Conversation

@gslaughl
Copy link
Copy Markdown

This is a 2-parter. The first commit uses the result of web3_clientVersion instead of the name from admin_nodeInfo, and the other (more optional) commit uses the ipcPath in place of the node id. Both of these changes are an attempt to get all the info we need without relying on the admin interface.

The idea is that I'd expect nodes to be unique by a combination of their ipcPath and clientVersion, but I don't know for sure whether that's the case. Also, if we decide that this is a good way to move forward, then we'll probably need to change some logic somewhere so that nodes are unique by a combination of those 2 fields, rather than just id.

Copy link
Copy Markdown

@rmulhol rmulhol left a comment

Choose a reason for hiding this comment

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

LGTM!

Was initially planning to approve but want to raise two things worth considering before we merge:

  • if we apply this to a live running instance, it's likely that the same node will be treated as different (creating a new row) on startup - since it'll have a new ID
  • we lose the ability to distinguish between multiple nodes running on the same ipcPath (e.g. if you sync against a local parity node, destroy that node + sync a new one and restart - then those nodes will be treated as the same). I don't think this is realistically a problem but worth thinking about

)

var EmpytHeaderHash = "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
var EmptyHeaderHash = "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown

@rmulhol rmulhol left a comment

Choose a reason for hiding this comment

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

Still welcome others' thoughts but thinking that the issues raised above shouldn't be blockers (and perhaps warrant getting this merged sooner rather than later)

@elizabethengelman
Copy link
Copy Markdown

Those issues you mentioned @rmulhol are good thoughts to consider. Seems like if we do decide to switch over to geth0 (the non-diffing node) then the first issue won't be much of an issue if we get this merged in before the switch over, since it's a new node anyway, right?

And then the other thing I'm thinking is the note that @gslaughl mentioned above about needing to make sure that we change the node's unique identity to a combo of network + ipcPath before we merge this in and switch over to geth0, right?

@gslaughl gslaughl force-pushed the vdb-1164-admin-workaround branch from 3cd68b6 to 18d2ae7 Compare February 17, 2020 23:14
`INSERT INTO eth_nodes (genesis_block, network_id, eth_node_id, client_name)
VALUES ($1, $2, $3, $4)
ON CONFLICT (genesis_block, network_id, eth_node_id)
DO UPDATE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Trying to understand the implications of this - but how come we're changing what we're updating on conflict? Also, kind of wondering if we want to do anything on conflict. 🤔

Copy link
Copy Markdown
Author

@gslaughl gslaughl Feb 18, 2020

Choose a reason for hiding this comment

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

Yeah sorry, this bit is confusing. You're totally right, we don't want to do anything on conflict-- and this 'update' will never really do anything, since the conflict will only occur when the genesis_blocks are already equal.

Unfortunately, Postgres won't return anything from a RETURNING statement (line 53) after an ON CONFLICT DO NOTHING. So this is just an arbitrary, pointless update that's only there to get line 53 to work. I went ahead and reduced the update down to just 1 column (genesis_block), since I didn't see the point of faux-updating more than 1 column.

Copy link
Copy Markdown
Author

@gslaughl gslaughl Feb 18, 2020

Choose a reason for hiding this comment

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

Thinking I'll add a comment like "pointless update to make RETURNING work" or something

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wondering whether answer #2 from this is relevant here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah good call. That version seems a little more readable

@gslaughl gslaughl force-pushed the vdb-1164-admin-workaround branch from 18d2ae7 to 34fdbe9 Compare February 18, 2020 17:35
@gslaughl gslaughl force-pushed the vdb-1164-admin-workaround branch from 34fdbe9 to 44123c7 Compare February 18, 2020 18:12
@gslaughl gslaughl merged commit 12967e4 into staging Feb 18, 2020
@gslaughl gslaughl deleted the vdb-1164-admin-workaround branch February 18, 2020 21:08
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.

3 participants