Sitelet https://github.com/graphprotocol/graph-node/pull/384
Skip to content

Add network identifier check on startup - #384

Merged
timmclean merged 1 commit into
masterfrom
tim/net-mistake
Sep 19, 2018
Merged

timmclean merged 1 commit into
masterfrom
tim/net-mistake

Conversation

@timmclean

Copy link
Copy Markdown
Contributor

Check that we are connected to the same Ethereum network as the last time this network name was used. Panic block ingestor if, for example, the user switches from mainnet to kovan but does not use a new network name.

add_network_if_missing will be refactored away when the new block processing work gets merged in, but I'm sticking with that design for now

Maybe @nenadjaja could test this?

Closes #377

Comment thread store/postgres/src/store.rs Outdated
// Network is in database and has identifiers
Some((Some(last_net_version), Some(last_genesis_block_hash))) => {
if last_net_version != new_net_version {
panic!("Ethereum node provided net_version {}, but we expected {}. Did you change networks without changing the network name?", new_net_version, last_net_version);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The two panic lines are a little too long. Can we break them up roughly like this?

panic!("Ethereum node provided net_version {}, \
        but we expected {}. Did you change networks \
        ...);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, good catch. I guess cargo fmt doesn't remove all of my formatting obligations :)

@timmclean timmclean changed the title datasource, graph, graphql, mock, store: Add network identifier check on startup Add network identifier check on startup Sep 19, 2018
… on startup

Check that we are connected to the same Ethereum network as the last
time this network name was used.

@Jannis Jannis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good now. I'll update Travis tomorrow to ignore failed builds with Rust beta.

@timmclean
timmclean merged commit c1712f3 into master Sep 19, 2018
@Jannis
Jannis deleted the tim/net-mistake branch October 3, 2018 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants