CodeChain-io / CodeChain-io/foundry
Optimize transaction and transaction result db
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 36
- Forks
- 11
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Currently, the storage of transaction and transaction result is not organized well.
The current implementation uses five columns to store data. Two of them are used to store a state trie and a mempool backup. You don't need to change these columns. Other columns are used to store headers, bodies, and extra information. I think they can be optimized.
Below describes the current implementation for those columns.
HEADER
- block hash =>
BlockHeader
BlockHeader
| field name | type |
|---|---|
| parent_hash | H256 |
| author | Address |
| state_root | H256 |
| transactions_root | H256 |
| results_root | H256 |
| score | U256 |
| number | u64 |
| timestamp | u64 |
| extra_data | Bytes |
| seals | ...Bytes[] |
BODY
- block hash =>
BlockBody
BlockBody
| field name | type | description |
|---|---|---|
| header | Bytes | rlp of header |
| transactions | UnverifiedTransaction[] |
EXTRA
- block hash =>
BlockDetails - transaction hash =>
TransactionAddress - transaction tracker =>
TransactionAddress[] - block hash =>
Invoice[] - and epoch transactions which are not used yet.
Invoice
[0x1] or [0x2, error_hint]
TransactionAddress
| field name | type |
|---|---|
| block hash | H256 |
| index | usize |
BlockDetails
| field name | type |
|---|---|
| number | u64 |
| total score | U256 |
| parent | H256 |
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue benennt keine Implementierungsdateien oder Tests; ermittle zunächst den Speicher-Code für Header, Bodies und zusätzliche Informationen von Transaktionen und Transaktionsergebnissen. Definiere die Zielorganisation für diese Spalten, wobei state trie und mempool backup unverändert bleiben, und überprüfe anschließend, dass die resultierende Darstellung die aufgeführten Block-, Transaktions-, Rechnungs- und Adressdaten bewahrt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- databases
- Issue-Typ
- Refactoring
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100