CodeChain-io / CodeChain-io/foundry

Optimize transaction and transaction result db

Aperta
#50 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
36
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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 |

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

L’issue non indica file di implementazione né test; individua innanzitutto il codice di storage per gli header, i body e le informazioni aggiuntive delle transazioni e dei risultati delle transazioni. Definisci l’organizzazione target per queste colonne lasciando invariati state trie e mempool backup, quindi verifica che la rappresentazione risultante preservi i dati di blocco, transazione, fattura e indirizzo elencati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
databases
Tipo di issue
Refactoring
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.