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

New endpoint /transaction/scrs-by-tx-hash/:txHash #6373

Merged
merged 12 commits into from
Aug 14, 2024

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Aug 5, 2024

Reasoning behind the pull request

  • Added a new endpoint to fetch smart contract results by transaction hash

Proposed changes

  • Added a new REST endpoint

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?

@miiu96 miiu96 self-assigned this Aug 6, 2024
@miiu96 miiu96 changed the title new endpoint New endpoint /transaction/scrs-by-tx-hash/:txHash Aug 6, 2024
@miiu96 miiu96 marked this pull request as ready for review August 6, 2024 12:06
api/groups/transactionGroup.go Show resolved Hide resolved
facade/nodeFacade.go Show resolved Hide resolved
node/external/nodeApiResolver.go Show resolved Hide resolved
node/external/transactionAPI/apiTransactionProcessor.go Outdated Show resolved Hide resolved
return nil, fmt.Errorf("%s: %w", ErrTransactionNotFound.Error(), err)
}

resultsHashes, err := atp.historyRepository.GetResultsHashesByTxHash(decodedTxHash, miniblockMetadata.Epoch)
Copy link
Contributor

Choose a reason for hiding this comment

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

please check: I think we also need to query the same miniblock on the next epoch. I think the miniblock is now stored only once based on the source epoch. There is a chance that the destination epoch is the next source epoch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The results hashes contains information for multiple epochs.
This case in covered.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@sstanculeanu sstanculeanu self-requested a review August 12, 2024 12:10
iulianpascalau
iulianpascalau previously approved these changes Aug 12, 2024
@@ -64,6 +64,8 @@ var ErrTxGenerationFailed = errors.New("transaction generation failed")
// ErrValidationEmptyTxHash signals that an empty tx hash was provided
var ErrValidationEmptyTxHash = errors.New("TxHash is empty")

var ErrValidationEmptySCRHash = errors.New("SCRHash is empty")
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

return nil, err
}

scrsAPI := make([]*transaction.ApiSmartContractResult, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
scrsAPI := make([]*transaction.ApiSmartContractResult, 0)
scrsAPI := make([]*transaction.ApiSmartContractResult, 0, len(resultsHashes.ScResultsHashesAndEpoch))

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

iulianpascalau
iulianpascalau previously approved these changes Aug 12, 2024
Copy link

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 3cbcc0c7fcd26d7c7ece0bb2c50da02747c6a991
  • Current Branch: new-endpoint-scrs-by-tx-hash
  • mx-chain-go Target Branch: rc/v1.7.next1
  • mx-chain-simulator-go Target Branch: ``
  • mx-chain-testing-suite Target Branch: ``

🚀 Environment Variables:

  • TIMESTAMP: 13082024-085131
  • PYTEST_EXIT_CODE: 0
    🎉 MultiversX CI/CD Workflow Complete!

Copy link
Collaborator

@danidrasovean danidrasovean left a comment

Choose a reason for hiding this comment

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

Normal allin test: rc -> new-endpoint-scrs-by-tx-ha-3cbcc0c7fc

--- Specific errors ---

block hash does not match 651
wrong nonce in block 304
miniblocks does not match 0
num miniblocks does not match 0
miniblock hash does not match 0
block bodies does not match 1
receipts hash missmatch 0

/------/

--- Statistics ---

Nr. of all ERRORS: 0
Nr. of all WARNS: 263
Nr. of new ERRORS: 0
Nr. of new WARNS: 10
Nr. of PANICS: 0

/------/

--- ERRORS ---

/------/

@miiu96 miiu96 merged commit 4fa8c2d into rc/v1.7.next1 Aug 14, 2024
10 checks passed
@miiu96 miiu96 deleted the new-endpoint-scrs-by-tx-hash branch August 14, 2024 06:14
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.

4 participants