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

WIP: Shwap prototype #3184

Draft
wants to merge 141 commits into
base: main
Choose a base branch
from
Draft

WIP: Shwap prototype #3184

wants to merge 141 commits into from

Conversation

walldiss
Copy link
Member

@walldiss walldiss commented Feb 12, 2024

Prototype for shwap protocol and storage. Contain all changes required for shwap implementation. This PR is not meant for merge. All changes will be extracted from prototype into smaller and nicer PRs.

Based on: #2675
Tracking issue: #2971

"github.com/celestiaorg/celestia-node/share/store/file"
)

// TODO(@walldiss): maybe move into separate subpkg?
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Comment on lines 83 to 84
// enough size. Otherwise Caller might not see the changes.
data = binary.BigEndian.AppendUint64(data, rid.Height)
Copy link
Member

Choose a reason for hiding this comment

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

True

Copy link
Member Author

Choose a reason for hiding this comment

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

Needs to be fixed tho

type Getter struct {
// TODO(@walldiss): why not blockservice?
Copy link
Member

Choose a reason for hiding this comment

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

Because we don't need to cache on disk in most cases

if ctx.Err() != nil {
return nil, ctx.Err()
}
return nil, fmt.Errorf("not all shares were found")
Copy link
Member

Choose a reason for hiding this comment

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

blocks, because now its generalized

datas[idx] = d
return nil
if data.RowIndex < uint16(from) || data.RowIndex >= uint16(to) {
// should never happen, because rows should be verified against root by the time they are returned
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need if then, if its never happens?

Comment on lines 140 to 145
if len(blks) != sqrLn/2 {
if ctx.Err() != nil {
return nil, ctx.Err()
}
return nil, fmt.Errorf("not all rows were found")
}
Copy link
Member

Choose a reason for hiding this comment

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

duplicates logic in getBlocks so can be removed

Comment on lines 137 to 139
func (sid SampleID) Release() {
sampleVerifiers.Delete(sid)
}
Copy link
Member

Choose a reason for hiding this comment

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

little reminder to godoc this

walldiss and others added 5 commits March 28, 2024 13:50
This PR introduces `full` and `bridge` node pruning via the
`--experimental-pruning` flag. Support is included for nodes that start
from scratch with pruning enabled and also for `archival` (nodes
retaining all historical blocks) that enable the
`--experimental-pruning` flag.

_Note that this PR does not support the conversion of a pruned node into
an archival one explicitly (it would not support re-syncing deleted
blocks)._

With pruning enabled, `full` and `bridge` nodes' block stores can be
expected not to exceed ~4TB (as the upper bound).

In follow-up PRs (hardening), the following features can be expected: 
- [x] discovery for archival nodes for archival sync
- [ ] inverted_index / light node pruning
- [ ] include more metrics for errors

TODO: 
- [x] clean up some TODOs
- [x] fix one flakey unit test
- [x] change values back to the actual (GC cycle, sampling window,
pruning window, etc).
- [x] figure out whether to store error in pruner checkpoint
- [x] fix issue with pruning genesis block via findPruneableHeaders
- [x] metrics for failed prunes
- [x] set a sane default for max pruneable / consider removing
`MaxPruneablePerGC` as now context timeouts are on a per block basis
- [ ] dedup findPruneableHeader test utility
- [x] badger dep

---------

Co-authored-by: Ryan <ryanford@poluglottos.com>
@@ -18,6 +18,7 @@ type Config struct {
EDSStoreParams *store.Parameters

UseShareExchange bool
UseShareSwap bool
Copy link
Member

Choose a reason for hiding this comment

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

Better keep it Shwap and rename the above one ot shrex, so there is less confusions around namings

walldiss and others added 13 commits March 28, 2024 18:40
# Conflicts:
#	core/listener_test.go
#	go.mod
#	go.sum
#	nodebuilder/core/module.go
#	nodebuilder/share/module.go
#	share/availability/light/availability.go
#	share/availability/light/availability_test.go
#	share/availability/light/testing.go
#	share/eds/byzantine/byzantine.go
#	share/eds/inverted_index.go
#	share/eds/metrics.go
#	share/eds/retriever_test.go
#	share/eds/store_test.go
#	share/getters/getter_test.go
#	share/getters/shrex.go
#	share/getters/shrex_test.go
#	share/ipld/corrupted_data_test.go
#	share/store/store_options.go
allow id marshallers to not depend on size of provided data container
fix id types to have both pointer and value receivers
R
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.

None yet

3 participants