Skip to content

chore: Refactor validator tx schema#1735

Open
sergerad wants to merge 1 commit intonextfrom
sergerad-validator-db-split
Open

chore: Refactor validator tx schema#1735
sergerad wants to merge 1 commit intonextfrom
sergerad-validator-db-split

Conversation

@sergerad
Copy link
Collaborator

@sergerad sergerad commented Mar 3, 2026

The validator currently stores overly large data in the DB that is not necessary.

Closes #1715.

@sergerad
Copy link
Collaborator Author

sergerad commented Mar 3, 2026

@bobbinth how do we decide on these points from #1715?

input note info (need to define what exactly gets stored)
output note info (need to define what exactly gets stored)
maybe some other metadata (e.g., initial account state hash, final account state hash, transaction fee).

@sergerad sergerad added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Mar 3, 2026
Copy link
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

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

Code LGTM, but I'm also uncertain what we need to store for notes.

Maybe @PhilippGackstatter has some ideas? afaik the point isn't to be able to reconstruct the transaction, but just identify and know its details.

Comment on lines +5 to +7
account_delta BLOB NOT NULL,
input_notes BLOB NOT NULL,
output_notes BLOB NOT NULL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

afaik these can all be empty

  • account delta can be empty for pass through txs, and
  • no input notes, and
  • no output notes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or is that fine as not null, and it will simply be an empty vector? cc @drahnr is Option::<Vec<u8>>::None and Vec<u8>::new() equivalent in sql/diesel land?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, all of these could be null.

Regarding what to store for notes - ideally, we should store full note data (even for private notes). For input notes, I think this should be pretty straight forward (I believe input notes for a transaction are already full notes). For output notes, this would be tricky as we actually don't have full info available in some cases. But maybe that's OK as an output note would need to become an input note at some point.

So, maybe for this PR, we just make sure we store full input notes (i.e., Vec<InputNote>) and w/e we get from the executed transaction as output notes (i.e., Vec<OutputNote>).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split Validator DB data

3 participants