-
Notifications
You must be signed in to change notification settings - Fork 204
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
Fixes outport refactor #5135
Fixes outport refactor #5135
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ func (s *sorter) getInvalidTxsExecutedInCurrentBlock(scheduledMbsFromPreviousBlo | |
for _, hash := range mb.TxHashes { | ||
_, found := allScheduledTxs[string(hash)] | ||
if found { | ||
scheduledExecutedInvalidTxsHashesPrevBlock = append(scheduledExecutedInvalidTxsHashesPrevBlock, string(hash)) | ||
scheduledExecutedInvalidTxsHashesPrevBlock = append(scheduledExecutedInvalidTxsHashesPrevBlock, hex.EncodeToString(hash)) | ||
continue | ||
} | ||
invalidTxHashes = append(invalidTxHashes, hash) | ||
|
@@ -249,9 +249,10 @@ func getRewardsTxsFromMe(pool *outport.TransactionPool, blockBody *block.Body, h | |
func extractTxsFromMap(txsHashes [][]byte, txs map[string]*outport.TxInfo) ([]data.TxWithExecutionOrderHandler, error) { | ||
result := make([]data.TxWithExecutionOrderHandler, 0, len(txsHashes)) | ||
for _, txHash := range txsHashes { | ||
tx, found := txs[string(txHash)] | ||
txHashHex := hex.EncodeToString(txHash) | ||
tx, found := txs[txHashHex] | ||
if !found { | ||
return nil, fmt.Errorf("cannot find transaction in pool, txHash: %s", hex.EncodeToString(txHash)) | ||
return nil, fmt.Errorf("cannot find transaction in pool, txHash: %s", txHashHex) | ||
} | ||
result = append(result, tx) | ||
} | ||
|
@@ -262,9 +263,10 @@ func extractTxsFromMap(txsHashes [][]byte, txs map[string]*outport.TxInfo) ([]da | |
func extractSCRsFromMap(txsHashes [][]byte, scrs map[string]*outport.SCRInfo) ([]data.TxWithExecutionOrderHandler, error) { | ||
result := make([]data.TxWithExecutionOrderHandler, 0, len(txsHashes)) | ||
for _, txHash := range txsHashes { | ||
scr, found := scrs[string(txHash)] | ||
txHashHex := hex.EncodeToString(txHash) | ||
scr, found := scrs[txHashHex] | ||
if !found { | ||
return nil, fmt.Errorf("cannot find scr in pool, txHash: %s", hex.EncodeToString(txHash)) | ||
return nil, fmt.Errorf("cannot find scr in pool, txHash: %s", txHashHex) | ||
} | ||
result = append(result, scr) | ||
} | ||
|
@@ -275,9 +277,10 @@ func extractSCRsFromMap(txsHashes [][]byte, scrs map[string]*outport.SCRInfo) ([ | |
func extractRewardsFromMap(txsHashes [][]byte, rewards map[string]*outport.RewardInfo) ([]data.TxWithExecutionOrderHandler, error) { | ||
result := make([]data.TxWithExecutionOrderHandler, 0, len(txsHashes)) | ||
for _, txHash := range txsHashes { | ||
reward, found := rewards[string(txHash)] | ||
txHashHex := hex.EncodeToString(txHash) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we keep the hash in hex format? This degrades the performance of the node as the hex.EncodeToString is more CPU intensive than the regular cast to string. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need the transaction hash hex-encoded in order can send it over to the WS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree, this does not degrade the performance of the validators as the code impacted is in |
||
reward, found := rewards[txHashHex] | ||
if !found { | ||
return nil, fmt.Errorf("cannot find reward in pool, txHash: %s", hex.EncodeToString(txHash)) | ||
return nil, fmt.Errorf("cannot find reward in pool, txHash: %s", txHashHex) | ||
} | ||
result = append(result, reward) | ||
} | ||
|
@@ -299,7 +302,8 @@ func extractExecutedTxHashes(mbIndex int, mbTxHashes [][]byte, header data.Heade | |
|
||
func extractAndPutScrsToDestinationMap(scrsHashes [][]byte, scrsMap map[string]*outport.SCRInfo, destinationMap map[string]data.TxWithExecutionOrderHandler) { | ||
for _, scrHash := range scrsHashes { | ||
scr, found := scrsMap[string(scrHash)] | ||
scrHashHex := hex.EncodeToString(scrHash) | ||
scr, found := scrsMap[scrHashHex] | ||
if !found { | ||
continue | ||
} | ||
|
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.
is this still backward compatible?
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.
yes is not a problem. because this part is used only in indexer
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.
agree, did not noticed that the package was actually
outport...