Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve reliability of get block template protocol in mm proxy #3141

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Jul 27, 2021

Description

The main change here is to check the tip height after retrieving the
block template but before MMR roots are calculated. When mining quickly
in cucumber tests, this race condition occurs. Previously, this would be
ok, the miner would simply mine 1 behind the current tip height. But
because we can no longer calculate MMRs prior to the tip, this MMR call
(get_new_block) now returns an error, which fails cucumber.

get_new_block now returns a FailedPrecondition GRPC error status in the event
that the block template submitted is not for the current chain tip. This allows
clients to more easily identify this case, typically by asking for a new template.

This refactor was performed because the protocol was gaining too much
complexity to exist in a single function.

Some extra changes to get all cucumbers to pass:

  • Replace --daemon flags with --non-interactive
  • Used more 'tolerant' step for As a user I want to change base node for a wallet scenario

Motivation and Context

The Verify all coinbases in hybrid mining are accounted for cucumber test is flakey
due to change in semantics for get_new_block since #3109. The possibility of this occurring
with normal difficulties is usually tiny, but may be a symptom of a slow get_coinbase request.

How Has This Been Tested?

Merge mined on local machine
Verify all coinbases in hybrid mining are accounted for passes
Suggest that we run tests with monero pool and nodejs pool

Checklist:

  • I'm merging against the development branch.
  • I have squashed my commits into a single commit.

@sdbondi sdbondi marked this pull request as draft July 27, 2021 19:10
@sdbondi sdbondi changed the title fix(cucumber): improve reliability of get block template protocol in mm proxy WIP fix(cucumber): improve reliability of get block template protocol in mm proxy Jul 27, 2021
@sdbondi sdbondi changed the title WIP fix(cucumber): improve reliability of get block template protocol in mm proxy fix(cucumber): improve reliability of get block template protocol in mm proxy Jul 28, 2021
@sdbondi sdbondi marked this pull request as ready for review July 28, 2021 06:52
@sdbondi sdbondi force-pushed the cucumber-flakey-fixes branch 2 times, most recently from 0e3b322 to e1c8114 Compare July 28, 2021 07:21
@sdbondi sdbondi changed the title fix(cucumber): improve reliability of get block template protocol in mm proxy fix: improve reliability of get block template protocol in mm proxy Jul 28, 2021
The main change here is to check the tip height after retrieving the
block template but before MMR roots are calculated. When mining quickly
in cucumber tests, this race condition occurs. Previously, this would be
ok, the miner would simply mine 1 behind the current tip height. But
because we can no longer calculate MMRs prior to the tip, this MMR call
(`get_new_block`) now returns an error.

Emits handling errors to stderr to make it quicker/easier to diagnose issues
without going into the logs.

This refactor was performed because the protocol was gaining too much
complexity to exist in a single function.
@aviator-app
Copy link
Contributor

aviator-app bot commented Jul 28, 2021

PR queued successfully. Your position in queue is: 1

@aviator-app aviator-app bot merged commit 6afde62 into tari-project:development Jul 28, 2021
@sdbondi sdbondi deleted the cucumber-flakey-fixes branch July 28, 2021 09:20
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