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
New storer events hashes by transaction hash #2428
Conversation
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.
Good implementation - Event name does not sound super good. It may be confused by smart contract events and logs. We need an API for those as well - next sprint maybe.
node/nodeTransactionsEvents.go
Outdated
return scr, nil | ||
} | ||
|
||
func (n *Node) adaptSmartContractResult(scr *smartContractResult.SmartContractResult) *transaction.SmartContractResultApi { |
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.
scrToscrApi ? and maybe have the same type of function names for all these transformation (rewards, transactions, receipts) and move them to a separate file.
…nto EN-7997-events-hashes-tx-hash
originalTxHash := string(rec.TxHash) | ||
if eventsHashes, ok := eventsHashesMap[originalTxHash]; ok { | ||
// append receipt hash in already create event | ||
eventsHashes.ReceiptsHash = []byte(receiptHash) |
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.
if it's just 1 receipt then overwriting the receipt on the ok branch would be unreachable code right?
we could then simply create the entry for this hash always and add it to the map without checking for existence first.
} | ||
|
||
eventsHashes, err := eventsHashesIndex.getEventsHashesByTxHash(txWithReceiptHash, epoch) | ||
require.Nil(t, err) | ||
require.Equal(t, expectedEvents, eventsHashes) | ||
} | ||
|
||
func TestGroupSmartContractResults(t *testing.T) { |
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.
Before I was referring to directly testing the grouping function, but all right.
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.
System Test Passed
Extend API route
/transaction/:hash
with a query parameter?withResults=true
in order to can return also the results that are generated by a transaction:This feature will be activated if we have [DbLookupExtensions] Enabled = true