-
Notifications
You must be signed in to change notification settings - Fork 11
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
Refactor indexing #1302
base: staging
Are you sure you want to change the base?
Refactor indexing #1302
Conversation
06801e4
to
31274d8
Compare
31274d8
to
b06f30c
Compare
} | ||
remote := database.NewRemote(database.Wrap(bt, table)) | ||
go func() { | ||
log.Info("starting remote raw store on port 8087") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid confusion we should read the port number from the args here
for _, blob := range blobs { | ||
if blob.TxIndex > txPerBlockLimit { | ||
return nil, fmt.Errorf("unexpected number of transactions in block expected at most %d but got: %v, tx: %x", txPerBlockLimit, blob.TxIndex, blob.Indexed.GetHash()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably good to add validation for the transaction hash length
|
||
func (t *Transformer) Withdrawal(chainID string, block *types.Eth1Block) (map[string][]database.Item, map[string][]database.Item, error) { | ||
updateMetadata := make(map[string][]database.Item) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add back the validation to throw an error if the number of block withdrawals exceeds MaxWithdrawalsPerPayload
|
||
func parseTx(tx *types.Eth1TransactionIndexed) *Interaction { | ||
return &Interaction{ | ||
ChainID: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChainID: "", | |
ChainID: "", // TODO parse chain ID |
Time: tx.Time.AsTime(), | ||
Type: "Transaction", | ||
Value: tx.Value, | ||
Asset: "ETH", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asset: "ETH", | |
Asset: "ETH", // TODO parse asset from tx |
The main goal of this PR is to remove functionalities from
⚠️ Please do not focus on the code quality, I tried to change as little as possible to reduce risk of breaking something. The goal here is not to refactor everything but to separate things, remove coupling, introduce dependancies injections and a tests.
db
package and put them into there own object "easily" testable. Those changes aim at removing the basic indexing flow.Overview of the new architecture
Those are the main package to focus your review on.
Lot of the changed lines come from generated code around contract bindings. You can find those in
internal/contracts
, and I would suggest to not spend too much time on those beside maybe having a look at the readme hereinternal/contracts/README.md
.