-
Notifications
You must be signed in to change notification settings - Fork 198
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 and add unit tests for scheduled sc execution #2956
Refactor and add unit tests for scheduled sc execution #2956
Conversation
SebastianMarian
commented
Apr 2, 2021
•
edited
edited
- Added unit tests for scheduled txs execution component
- Refactor transactionsV2
maxCrossShardScCallsOrSpecialTxsPerShard := 0 | ||
|
||
processingInfo := processedTxsInfo{} | ||
cpmbi := txs.initCreateAndProcessMiniBlocks() |
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.
maybe some better name. it is complicated - cpmbi
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.
done
} | ||
|
||
senderAddressToSkip := []byte("") | ||
csmbi := txs.initCreateScheduledMiniBlocks() |
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.
there is little diference between csmbi and cpmbi from line 204.
txs.blockSizeComputation.AddNumMiniBlocks(1) | ||
} | ||
csmbi.mapCrossShardScCallTxs[receiverShardID]++ | ||
if csmbi.mapCrossShardScCallTxs[receiverShardID] > csmbi.maxCrossShardScCallTxsPerShard { |
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.
csmbi.mapCrossShardScCallTxs[receiverShardID] take out into a variable
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.
done
cpmbi.firstCrossShardScCallOrSpecialTxFound = true | ||
txs.blockSizeComputation.AddNumMiniBlocks(1) | ||
} | ||
cpmbi.mapCrossShardScCallsOrSpecialTxs[receiverShardID]++ |
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.
cpmbi.mapCrossShardScCallsOrSpecialTxs[receiverShardID] take out into a separate variable
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.
done
} | ||
|
||
isMiniBlockEmpty := len(miniBlock.TxHashes) == 0 | ||
firstMiniBlockSplitForReceiverShardFound := (txMbInfo.isReceiverSmartContractAddress && cpmbi.mapScsForShard[receiverShardID] == 0 && cpmbi.mapTxsForShard[receiverShardID] > 0) || |
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.
this is an incredibly complicated condition. can we make it easier ?
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.
refactored
|
||
senderAddressToSkip = []byte("") | ||
|
||
gasRefunded := txs.gasHandler.GasRefunded(txHash) |
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.
This gasRefunded approach should be modified exactly like in PR: #3016
…ts-for-scheduled-sc-execution
…duled-sc-execution' into refactor-and-unit-tests-for-scheduled-sc-execution