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

fix epoch saving #909

Merged
merged 4 commits into from
Apr 9, 2024
Merged

fix epoch saving #909

merged 4 commits into from
Apr 9, 2024

Conversation

Valentine1898
Copy link
Contributor

close #908

const { sctParams } = await this.querier.app.appParams();
const { sctParams } = (await this.indexedDb.getAppParams()) ?? {};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also fixed this, we don't need to request sctParams from the full node since we store them in indexed-db

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this.indexedDb.addEpoch() should go above this

Copy link
Contributor

Choose a reason for hiding this comment

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

@grod220 why's that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The params are used further down. There seems to be code in between that doesn't use the params.

Comment on lines +480 to +482
// avoid saving the same epoch twice
if (previousEpoch?.startHeight === startHeight) return;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At first I thought it would be best to link to epochRoot.
But it seems that binding to a unique startHeight is just as good, plus I'm not sure that epochRoot is guaranteed to be unique for every epoch

@Valentine1898 Valentine1898 requested review from grod220 and jessepinho and removed request for grod220 April 9, 2024 11:39
Copy link
Collaborator

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Will let Jesse review this one, but good catch!

const { sctParams } = await this.querier.app.appParams();
const { sctParams } = (await this.indexedDb.getAppParams()) ?? {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this.indexedDb.addEpoch() should go above this

Copy link
Contributor

@jessepinho jessepinho left a comment

Choose a reason for hiding this comment

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

Great catch — minor comment re: a variable name, then ship it!

packages/storage/src/indexed-db/indexed-db.test.ts Outdated Show resolved Hide resolved
Co-authored-by: Jesse Pinho <jesse@jessepinho.com>
@jessepinho
Copy link
Contributor

oh sorry @Valentine1898 , before you merge, could you please bump the IndexedDB version number so that people's DBs re-sync from scratch without the problematic epochs?

@Valentine1898
Copy link
Contributor Author

oh sorry @Valentine1898 , before you merge, could you please bump the IndexedDB version number so that people's DBs re-sync from scratch without the problematic epochs?

Yes, it makes sense even though the indexed-db structure has not changed

@Valentine1898 Valentine1898 merged commit 5248540 into main Apr 9, 2024
6 checks passed
@Valentine1898 Valentine1898 deleted the fix-epoch-saving branch April 9, 2024 16:39
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.

Incorrect current epoch when sending a delegatе transaction
3 participants