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

feature(dot/sync): implement *tipSyncer.hasCurrentWorker, add minPeers, slotDuration to chainSync, check if syncing in *core.Service.HandleTransactionMessage #1881

Merged
merged 9 commits into from
Oct 13, 2021

Conversation

noot
Copy link
Contributor

@noot noot commented Oct 11, 2021

Changes

  • implement *tipSyncer.hasCurrentWorker
  • add minPeers, slotDuration to chainSync and use these where needed
  • update *core.Service.HandleTransactionMessage to not validate transaction messages while in bootstrap sync mode, as the runtime will not be the same as it is near the head and will cause lots of failure messages.

Tests

go test ./dot/core
go test ./dot/sync

Issues

Primary Reviewer

@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #1881 (2cc41c2) into development (45772bf) will increase coverage by 0.33%.
The diff coverage is 64.86%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #1881      +/-   ##
===============================================
+ Coverage        59.42%   59.76%   +0.33%     
===============================================
  Files              192      187       -5     
  Lines            19521    19185     -336     
===============================================
- Hits             11601    11465     -136     
+ Misses            6009     5814     -195     
+ Partials          1911     1906       -5     
Flag Coverage Δ
unit-tests 59.76% <64.86%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/gossamer/config.go 72.68% <ø> (+0.31%) ⬆️
dot/core/messages.go 66.66% <0.00%> (-9.10%) ⬇️
dot/network/service.go 70.43% <0.00%> (-0.21%) ⬇️
lib/runtime/constants.go 0.00% <ø> (ø)
dot/services.go 71.42% <60.00%> (+3.54%) ⬆️
dot/sync/tip_syncer.go 83.01% <68.42%> (-2.04%) ⬇️
dot/sync/chain_sync.go 54.78% <75.00%> (+0.23%) ⬆️
dot/core/test_helpers.go 83.82% <100.00%> (-6.66%) ⬇️
dot/sync/syncer.go 30.76% <100.00%> (ø)
dot/state/block_notify.go 78.37% <0.00%> (-10.82%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a095d95...2cc41c2. Read the comment docs.

Copy link
Contributor

@arijitAD arijitAD left a comment

Choose a reason for hiding this comment

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

Minor changes. Otherwise looks good.
Rename Network.go -> network.go

@@ -738,3 +738,8 @@ func (*Service) StartingBlock() int64 {
// TODO: refactor this to get the data from the sync service
return 0
}

// IsSynced returns whether we are synced (not longer in bootstrap mode) or not
Copy link
Contributor

Choose a reason for hiding this comment

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

// IsSynced returns whether we are synced (no longer in bootstrap mode) or not

Comment on lines 39 to 44
const defaultMinPeers = 1

var (
testTimeout = time.Second * 5
defaultSlotDuration = time.Second * 6
)
Copy link
Contributor

Choose a reason for hiding this comment

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

const (
	defaultMinPeers     = 1
	testTimeout         = time.Second * 5
	defaultSlotDuration = time.Second * 6
)

continue
}

// worker start is less than than existing worker's start
Copy link
Contributor

Choose a reason for hiding this comment

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

			// worker start is less than existing worker's start

continue
}

// worker start is greater than than existing worker's start
Copy link
Contributor

Choose a reason for hiding this comment

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

			// worker start is less than existing worker's start

logger.Debug("ignoring TransactionMessage, not yet synced")
return false, nil
}

Copy link
Member

Choose a reason for hiding this comment

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

question: if we're not synced yet, this msg could not be added to a retry queue? is ok to ignore TransactionMessage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we potentially won't be able to validate it for 3 days or more, in which case the transaction is almost certain to have been included (or discarded) already. also the memory usage from storing all of them might be a concern. I think it's ok to just ignore them for now, maybe in the future we can consider some queue

@noot noot merged commit bf903f2 into development Oct 13, 2021
@noot noot deleted the noot/sync-cont branch October 13, 2021 13:27
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

🎉 This PR is included in version 0.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

timwu20 pushed a commit to timwu20/gossamer that referenced this pull request Dec 6, 2021
…ers, slotDuration to `chainSync`, check if syncing in `*core.Service.HandleTransactionMessage` (ChainSafe#1881)
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.

dot/sync: pass min/max peers, slot duration to chainSync research and refactor syncing algorithm
3 participants