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

katzenmint: prune documents if it's not corrected #183

Merged
merged 26 commits into from
Dec 6, 2023
Merged

katzenmint: prune documents if it's not corrected #183

merged 26 commits into from
Dec 6, 2023

Conversation

sc0Vu
Copy link
Contributor

@sc0Vu sc0Vu commented Mar 17, 2023

Description

see #181

prune documents if it's not corrected

remove rawdoc from cache and server

TODO:

  • test katzenmint for a while

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have checked that any new log messages doesn't inavertedly link compromising information to an external observer about the Meson Mixnet.

@sc0Vu sc0Vu requested a review from a team March 17, 2023 14:14
@@ -383,15 +384,31 @@ func (state *KatzenmintState) GetDocument(epoch uint64, height int64) ([]byte, *
* Document *
*****************************************/

func (s *KatzenmintState) pruneDocument() {
begin := storageKey(descriptorsBucket, []byte{}, s.currentEpoch)
end := storageKey(descriptorsBucket, []byte{}, s.currentEpoch+1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure this is the correct end calculation? Considering that we have epochs in minutes e.g. 10 mins, if you add +1 then it makes the end at 11 minutes and not at the next epoch tecnically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, remove this function for now. Probably need to discuss how many old documents we should keep (katzenpost kept 3).

escaped := s.tree.IterateRange(begin, end, true, func(key, value []byte) (ret bool) {
desc, err := s11n.ParseDescriptorWithoutVerify(value)
if err != nil {
// TODO: check different error
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you be more precise here with what needs to be the actual error and if it's something more involved and complex, you should open an issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error might be corrupted data or invalid certificate (outdated/incorrect encoding). Because the network was stuck or offline (still need to find the root cause), the descriptors might be expired in local database (saved before generate document). How about we remove descriptors and wait them submit again?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Mikerah is this possible to generate different block hash for old blocks with expired certificate?

}

adjFetchDelay()
c.log.Debugf("[Deprecated] Dequeued GetConsesus for send.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's deprecated, why not just remove it?

// might happened when network stuck or the data was corrupted
// should remove the outdated or corrupted data
s.tree.Remove(key)
// s.tree.Remove(key)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you do more processing here if the tree data is corrupted?

@@ -107,6 +110,8 @@ func newTendermint(app abci.Application, config *cfg.Config, logger log.Logger)
func init() {
rootCmd.PersistentFlags().StringVar(&configFile, "config", "katzenmint.toml", "Path to katzenmint.toml")
runCmd.Flags().IntVar(&dbCacheSize, "dbcachesize", 100, "Cache size for katzenmint db")
runCmd.Flags().StringVar(&cpuProfilePath, "cpuprofilepath", "", "Path to the pprof cpu profile")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should add that these are for debugging

@sc0Vu sc0Vu merged commit c15aa5a into develop Dec 6, 2023
9 checks passed
@sc0Vu sc0Vu deleted the patch-181 branch December 6, 2023 03:44
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