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

Bug-fix: Fix /transaction/cost api route #5878

Closed
wants to merge 2 commits into from

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Jan 26, 2024

Reasoning behind the pull request

Proposed changes

  • Set CurrentHeader in the BlockChainHook used for transaction cost computation.

Testing procedure

  • Run a node on devnet on shard 1 with this branch and ensure the cost is computed correctly for the example from the mx-chain-proxy-go GitHub issue

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?

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (06f147d) 80.14% compared to head (fb1a7a6) 80.14%.

Files Patch % Lines
...ocess/transactionEvaluator/transactionEvaluator.go 42.85% 3 Missing and 1 partial ⚠️
...ocess/transactionEvaluator/transactionSimulator.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5878      +/-   ##
==========================================
- Coverage   80.14%   80.14%   -0.01%     
==========================================
  Files         708      708              
  Lines       94043    94055      +12     
==========================================
+ Hits        75373    75380       +7     
- Misses      13326    13329       +3     
- Partials     5344     5346       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -63,6 +66,9 @@ func NewAPITransactionEvaluator(args ArgsApiTransactionEvaluator) (*apiTransacti
if check.IfNil(args.EnableEpochsHandler) {
return nil, process.ErrNilEnableEpochsHandler
}
if check.IfNil(args.BlockChain) {
return nil, process.ErrNilBlockChain
Copy link
Contributor

Choose a reason for hiding this comment

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

add unit test?

@@ -84,7 +91,9 @@ func (ate *apiTransactionEvaluator) SimulateTransactionExecution(tx *transaction
ate.mutExecution.Unlock()
}()

return ate.txSimulator.ProcessTx(tx)
currentHeader := ate.blockChain.GetCurrentBlockHeader()
Copy link
Contributor

Choose a reason for hiding this comment

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

unit tests?

@miiu96 miiu96 changed the base branch from master to rc/v1.7.0 January 26, 2024 12:15
@miiu96 miiu96 changed the base branch from rc/v1.7.0 to master January 26, 2024 12:19
@miiu96 miiu96 closed this Jan 26, 2024
@miiu96 miiu96 deleted the fix-tx-cost-and-simulate-api-route branch January 26, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants