Skip to content

Conversation

@lazynina
Copy link
Member

No description provided.

Copy link
Member Author

lazynina commented Feb 15, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @lazynina and the rest of your teammates on Graphite Graphite

Copy link
Collaborator

@superzordon superzordon left a comment

Choose a reason for hiding this comment

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

A few small refactors for code understandability and cleanliness, but otherwise looks good to me!

entries/pkid.go Outdated

// Transform the entries into a list of keys to delete.
keysToDelete := consumer.KeysToDelete(uniqueEntries)
keysToDelete = consumer.FilterKeysByPrefix(keysToDelete, lib.Prefixes.PrefixSnapshotLeaderSchedule)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
keysToDelete = consumer.FilterKeysByPrefix(keysToDelete, lib.Prefixes.PrefixSnapshotLeaderSchedule)
leaderSchedKeysToDelete := consumer.FilterKeysByPrefix(keysToDelete, lib.Prefixes.PrefixSnapshotLeaderSchedule)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to make it easier in the future to understand how to add support for a different prefix type

entries/pkid.go Outdated
// Execute the delete query.
if _, err := db.NewDelete().
Model(&LeaderScheduleEntry{}).
Where("badger_key IN (?)", bun.In(keysToDelete)).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Where("badger_key IN (?)", bun.In(keysToDelete)).
Where("badger_key IN (?)", bun.In(leaderSchedKeysToDelete)).

entries/pkid.go Outdated
func PkidBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB, params *lib.DeSoParams) error {
// We check before we call this function that there is at least one operation type.
// We also ensure before this that all entries have the same operation type.
glog.Infof("PkidBatchOperation: Putting %d entries into the database", len(entries))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets remove this before merging, or if it's necessary for debugging in a deployed environment, just throw a FIXME above it to remove.

@lazynina lazynina force-pushed the update-block-and-txn-based-on-pos-updates branch from ddeafd4 to 8840576 Compare February 16, 2024 21:03
Base automatically changed from update-block-and-txn-based-on-pos-updates to feature/proof-of-stake February 16, 2024 21:03
@lazynina lazynina merged commit 60c44ed into feature/proof-of-stake Feb 16, 2024
@lazynina lazynina deleted the leader-schedule branch February 16, 2024 21:04
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.

3 participants