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

Configurable stratum diff, block refresh, and extranonce #59

Merged
merged 10 commits into from
Dec 13, 2022

Conversation

rdugan
Copy link
Contributor

@rdugan rdugan commented Oct 26, 2022

Three new configurable features, with defaults set to previous values:

  • stratum diff to reduce network traffic and server load. Instantiated at the client level (rather than global) to allow easier transition to vardiff in the future if desired.
  • block refresh time, also to reduce network traffic and server load (as well as log spam)
  • extranonce support, to partition nonce space across multiple clients, preventing work overlap in case mining client does not randomize nonce

Also cleaned up CLI output a bit, including block counting.

@c0sco
Copy link

c0sco commented Dec 9, 2022

This has been working great for me, and closes #43.

Copy link
Owner

@onemorebsmith onemorebsmith left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, just one comment around changing the block wait to a duration instead of a naked string everywhere

// static value definitions to avoid overhead in diff translations
var (
maxTarget = big.NewFloat(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
minHash = new(big.Float).Quo(new(big.Float).SetMantExp(big.NewFloat(1), 256), maxTarget)
Copy link
Owner

Choose a reason for hiding this comment

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

really rolls right off the tongue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha yeah, don't love that representation, but i do think it's actually more clear than the bitshifting, and from what i've read, direct assignments are often faster, due to the compiler actually understanding the intention - not that it matters much for a single assignment. mainly i was struggling to wrap my head around the different representations, and was hoping this and the accompanying changes re: target/diff clarified things a bit.

@@ -21,6 +22,9 @@ type BridgeConfig struct {
PrintStats bool `yaml:"print_stats"`
UseLogFile bool `yaml:"log_to_file"`
HealthCheckPort string `yaml:"health_check_port"`
BlockWaitTime string `yaml:"block_wait_time"`
Copy link
Owner

Choose a reason for hiding this comment

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

change this from a string to a time.Duration? It'll make life easier later on. You can parse it directly using flag.DurationVar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure... was just following existing style, and am also new to go, so didn't dive in too deep. Will take a look.

@@ -60,8 +60,12 @@ func TestHeaderSerialization(t *testing.T) {
}

func TestPoolHzCalculation(t *testing.T) {
log.Println(shareValue)
log.Println(fixedDifficulty)
// TODO: figure out what we really want to test here.
Copy link
Owner

Choose a reason for hiding this comment

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

Yeah this was a thing then I deleted it for whatever reason.

@guiseco
Copy link

guiseco commented Dec 11, 2022

Hi guys! Any chance this pull request will be approved?

@rdugan
Copy link
Contributor Author

rdugan commented Dec 13, 2022

Ok, all three flags updated to appropriate types. Sorry, should have been doing this from a branch - now i have a couple other minor updates included.

  • Added total share diff counter to prometheus metrics, which is required for proper graphing of shares/hashrates w/o having to include mindiff config value in all queries (and will be critical if moving to vardiff)
  • Initialized all worker counters to 0, so rate functions can work properly w/ first data point
  • Added a couple dashboard json exports in the misc folder. The first one should be a drop-in replacement for the existing dash, the second one ('_w_price') requires a new metric in prometheus to scrape KAS price, which i have not added

@onemorebsmith onemorebsmith merged commit ba60eea into onemorebsmith:main Dec 13, 2022
@onemorebsmith
Copy link
Owner

@rdugan can you do a quick bullet-point writeup on everything you changed/added and I'll throw in in the release notes with a shoutout.

Also on how to use the new flags :)

Appreciate the work!

@rdugan
Copy link
Contributor Author

rdugan commented Dec 13, 2022

@onemorebsmith There's nothing really worth mentioning beyond the bullets in my original comment here. Maybe just remove the diff instantiation comment, as it's unnecessary detail for the release notes?

Also, the config params are pretty extensively documented in the config.yaml file.

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.

4 participants