You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon reviewing the codebase, several optimizations were identified that could enhance the efficiency and readability of the code.
Problem Scenarios
The validate_tx function is redundantly called twice in the check_proposal_tx function, during
process proposal, leading to unnecessary overhead. 1st: /process_proposal.rs#L249-L256
2nd: /process_proposal.rs#L265-L270
The previously defined inner_tx_hash should be used instead of &tx.raw_header_hash() . mempool_validation()
Move parameter obtaining from storage outside loop iterations to minimize unnecessary storage calls. In this way, the number of calls to storage would be reduced. /governance.rs#L79
Since the validate_wrapper_bytes function is specific to Wrapper transactions, the transaction type check should be performed at the beginning of the function. If the transaction is not a WrapperTx, an error
should be immediately returned. /prepare_proposal.rs#L286
Recommendation
To improve performance, it is recommended to implement the suggestions outlined in the Problem Scenarios section.
The text was updated successfully, but these errors were encountered:
Reported by Informal Systems.
Description
Upon reviewing the codebase, several optimizations were identified that could enhance the efficiency and readability of the code.
Problem Scenarios
validate_tx
function is redundantly called twice in thecheck_proposal_tx
function, duringprocess proposal, leading to unnecessary overhead. 1st: /process_proposal.rs#L249-L256
2nd: /process_proposal.rs#L265-L270
inner_tx_hash
should be used instead of &tx.raw_header_hash() .mempool_validation()
validate_wrapper_bytes
function is specific to Wrapper transactions, the transaction type check should be performed at the beginning of the function. If the transaction is not a WrapperTx, an errorshould be immediately returned. /prepare_proposal.rs#L286
Recommendation
To improve performance, it is recommended to implement the suggestions outlined in the Problem Scenarios section.
The text was updated successfully, but these errors were encountered: