Skip to content
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

Merged
merged 4 commits into from
Mar 31, 2023
Merged

Fixes outport refactor #5135

merged 4 commits into from
Mar 31, 2023

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Mar 29, 2023

Reasoning behind the pull request

  • Fixed the part where the transactions were fetched from the pool in the execution order component.

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2023

Codecov Report

Patch coverage: 68.29% and no project coverage change.

Comparison is base (5116be3) 70.81% compared to head (3b17089) 70.82%.

❗ Current head 3b17089 differs from pull request most recent head 74dc1e4. Consider uploading reports for the commit 74dc1e4 to get more accurate results

Additional details and impacted files
@@                  Coverage Diff                   @@
##           feat/outport-refactor    #5135   +/-   ##
======================================================
  Coverage                  70.81%   70.82%           
======================================================
  Files                        675      675           
  Lines                      87822    87850   +28     
======================================================
+ Hits                       62193    62218   +25     
- Misses                     20939    20940    +1     
- Partials                    4690     4692    +2     
Impacted Files Coverage Δ
outport/factory/notifierFactory.go 72.22% <55.55%> (-17.78%) ⬇️
...ocess/executionOrder/transactionsExecutionOrder.go 76.63% <75.00%> (+0.51%) ⬆️
outport/notifier/eventNotifier.go 80.00% <81.81%> (-0.77%) ⬇️

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -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))
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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...

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
If I will let it non hex I will have problems with the marshaller because the hash is used as a string key in map structures.

Copy link
Contributor

Choose a reason for hiding this comment

The 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 outport... package

@miiu96 miiu96 self-assigned this Mar 31, 2023
mariusmihaic
mariusmihaic previously approved these changes Mar 31, 2023
go.mod Outdated
@@ -13,9 +13,9 @@ require (
github.com/google/gops v0.3.18
github.com/gorilla/websocket v1.5.0
github.com/mitchellh/mapstructure v1.5.0
github.com/multiversx/mx-chain-core-go v1.2.1-0.20230322093158-35195fa155c0
github.com/multiversx/mx-chain-core-go v1.2.1-0.20230329082847-b78e96c3ad5a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the latest commit hash
I think this should be 932a718276f65ff8f820720adf5e98c4cfdd3074.

Check here: multiversx/mx-chain-core-go#171

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -46,10 +48,15 @@ func NewEventNotifier(args ArgsEventNotifier) (*eventNotifier, error) {
if err != nil {
return nil, err
}
blockContainer, err := createBlockCreatorsContainer()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it at the same level as factory: CreateEventNotifier, just like you did on indexer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@miiu96 miiu96 merged commit ee0e9d2 into feat/outport-refactor Mar 31, 2023
@miiu96 miiu96 deleted the fixes-outport-refactor branch March 31, 2023 14:42
@schimih schimih added the ignore-for-release-notes Do not include item in release notes label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release-notes Do not include item in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants