-
Notifications
You must be signed in to change notification settings - Fork 228
Update history repository #7365
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
Merged
miiu96
merged 10 commits into
feat/supernova-async-exec
from
update-db-lookup-ext-supernova
Oct 29, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
263f6a7
update history repository
miiu96 b8720f8
Merge branch 'feat/supernova-async-exec' into update-db-lookup-ext-su…
miiu96 9dada4a
happy path
miiu96 24935a9
Merge branch 'feat/supernova-async-exec' into update-db-lookup-ext-su…
miiu96 dffeac2
fix unit tests
miiu96 2f271f6
fixes
miiu96 2d3db61
fixes after review
miiu96 41c191f
Merge branch 'feat/supernova-async-exec' into update-db-lookup-ext-su…
miiu96 3e85464
Merge branch 'feat/supernova-async-exec' into update-db-lookup-ext-su…
miiu96 e7a51f2
fixes after second review
miiu96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| package dblookupext | ||
|
|
||
| import ( | ||
| "encoding/hex" | ||
| "fmt" | ||
|
|
||
| "github.com/multiversx/mx-chain-core-go/data" | ||
| "github.com/multiversx/mx-chain-core-go/data/block" | ||
| "github.com/multiversx/mx-chain-core-go/marshal" | ||
| "github.com/multiversx/mx-chain-go/common" | ||
| "github.com/multiversx/mx-chain-go/process" | ||
| "github.com/multiversx/mx-chain-go/storage" | ||
| ) | ||
|
|
||
| func getIntermediateTxs(cache storage.Cacher, headerHash []byte) (map[string]data.TransactionHandler, map[string]data.TransactionHandler, error) { | ||
| cachedIntermediateTxs, ok := cache.Get(headerHash) | ||
| if !ok { | ||
| log.Warn("intermediateTxs not found in dataPool", "hash", headerHash) | ||
| return nil, nil, fmt.Errorf("%w for header %s", process.ErrMissingHeader, hex.EncodeToString(headerHash)) | ||
| } | ||
|
|
||
| cachedIntermediateTxsMap, ok := cachedIntermediateTxs.(map[block.Type]map[string]data.TransactionHandler) | ||
| if !ok { | ||
| return nil, nil, fmt.Errorf("%w for cached intermediate transaction %s", process.ErrWrongTypeAssertion, hex.EncodeToString(headerHash)) | ||
| } | ||
|
|
||
| scrs := cachedIntermediateTxsMap[block.SmartContractResultBlock] | ||
| receipts := cachedIntermediateTxsMap[block.ReceiptBlock] | ||
|
|
||
| return scrs, receipts, nil | ||
| } | ||
|
|
||
| func getLogs(cache storage.Cacher, headerHash []byte) ([]*data.LogData, error) { | ||
| logsKey := common.PrepareLogEventsKey(headerHash) | ||
| cachedLogs, ok := cache.Get(logsKey) | ||
| if !ok { | ||
| log.Warn("logs not found in dataPool", "hash", headerHash) | ||
| return nil, fmt.Errorf("%w for header %s", process.ErrMissingHeader, hex.EncodeToString(headerHash)) | ||
| } | ||
| cachedLogsSlice, ok := cachedLogs.([]*data.LogData) | ||
| if !ok { | ||
| return nil, fmt.Errorf("%w for cached logs %s", process.ErrWrongTypeAssertion, hex.EncodeToString(headerHash)) | ||
| } | ||
| return cachedLogsSlice, nil | ||
| } | ||
|
|
||
| func getIntraMbs(cache storage.Cacher, marshaller marshal.Marshalizer, headerHash []byte) ([]*block.MiniBlock, error) { | ||
| cachedIntraMBs, ok := cache.Get(headerHash) | ||
| if !ok { | ||
| log.Warn("intra miniblocks not found in dataPool", "hash", headerHash) | ||
| return nil, fmt.Errorf("%w for header %s", process.ErrMissingHeader, hex.EncodeToString(headerHash)) | ||
| } | ||
| cachedLogsBuff := cachedIntraMBs.([]byte) | ||
| var intraMBs []*block.MiniBlock | ||
| errUnmarshal := marshaller.Unmarshal(&intraMBs, cachedLogsBuff) | ||
| if errUnmarshal != nil { | ||
| return nil, fmt.Errorf("%w getIntraMbs: cannot unmarshall", errUnmarshal) | ||
| } | ||
|
|
||
| return intraMBs, nil | ||
| } | ||
|
|
||
| func getBody(cache storage.Cacher, marshaller marshal.Marshalizer, baseExecResult data.BaseExecutionResultHandler, shardID uint32) (*block.Body, error) { | ||
| miniBlockHeaderHandlers, err := extractMiniBlocksHeaderHandlersFromExecResult(baseExecResult, shardID) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| var miniBlocks block.MiniBlockSlice | ||
| for _, miniBlockHeaderHandler := range miniBlockHeaderHandlers { | ||
| mbHash := miniBlockHeaderHandler.GetHash() | ||
| cachedMiniBlock, found := cache.Get(mbHash) | ||
| if !found { | ||
| log.Warn("mini block from execution result not cached after execution", | ||
| "mini block hash", mbHash) | ||
| return nil, process.ErrMissingMiniBlock | ||
| } | ||
|
|
||
| cachedMiniBlockBytes := cachedMiniBlock.([]byte) | ||
|
|
||
| var miniBlock *block.MiniBlock | ||
| err = marshaller.Unmarshal(&miniBlock, cachedMiniBlockBytes) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| miniBlocks = append(miniBlocks, miniBlock) | ||
| } | ||
|
|
||
| return &block.Body{MiniBlocks: miniBlocks}, nil | ||
| } | ||
|
|
||
| // TODO reuse the method that was moved into common after PR #7337 is merged | ||
| func extractMiniBlocksHeaderHandlersFromExecResult( | ||
| baseExecResult data.BaseExecutionResultHandler, | ||
| headerShard uint32, | ||
| ) ([]data.MiniBlockHeaderHandler, error) { | ||
| if headerShard == common.MetachainShardId { | ||
| metaExecResult, ok := baseExecResult.(data.MetaExecutionResultHandler) | ||
| if !ok { | ||
| log.Warn("extractMiniBlocksHeaderHandlersFromExecResult assert failed to MetaExecutionResultHandler") | ||
| return nil, process.ErrWrongTypeAssertion | ||
| } | ||
|
|
||
| return metaExecResult.GetMiniBlockHeadersHandlers(), nil | ||
| } | ||
|
|
||
| execResult, ok := baseExecResult.(data.ExecutionResultHandler) | ||
| if !ok { | ||
| log.Warn("extractMiniBlocksHeaderHandlersFromExecResult assert failed to ExecutionResultHandler") | ||
| return nil, process.ErrWrongTypeAssertion | ||
| } | ||
|
|
||
| return execResult.GetMiniBlockHeadersHandlers(), nil | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
perhaps add a todo to reuse the method that was moved into common here: #7337
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.
added TODO