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
Issue:
View endorsement chain option while verifying document is getting timed out or resulting in RPC errors
Issue Description:
When verifying a document and attempting to view the endorsement chain on the TradeTrust platform, the process often results in 'time out' or 'block range too wide' errors. This issue arises from an eth_getLogs RPC call that queries the blockchain (archive node) from the genesis block to the latest block. Due to the extensive block range, the process is resource-intensive and prone to errors.
Steps to Reproduce:
Create a document on the TradeTrust platform (e.g., eBoL) at TradeTrust Document Creator.
Verify the document on the TradeTrust platform at TradeTrust Verify.
Once the document is verified, click on the "View endorsement chain" option.
Alternatively, replicate the issue using the following command:
Suggested Enhancements:
To optimize the process and effectively fetch the data, it is recommended to implement an events mechanism in the smart contract functions. Logging events when actions such as issuing a document, transferring ownership, or changing ownership occur will allow for more efficient data retrieval using filter log
Example Enhancement:
Add events to the smart contract and log them during relevant actions. Below is an example of how to add and use events in a smart contract:
Smart Contract Example:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract DocumentManagement {
event DocumentIssued(address indexed issuer, uint256 indexed documentId, string documentHash);
event OwnershipTransferred(address indexed from, address indexed to, uint256 indexed documentId);
function issueDocument(uint256 documentId, string memory documentHash) public {
// Issue document logic...
emit DocumentIssued(msg.sender, documentId, documentHash);
}
function transferOwnership(address to, uint256 documentId) public {
// Transfer ownership logic...
emit OwnershipTransferred(msg.sender, to, documentId);
}
}
Related Pull Request:
A pull request was made to make the fromBlockNumber configurable for each chain, but implementing the event mechanism described above would provide a more optimized solution: PR #921
The text was updated successfully, but these errors were encountered:
Thank you for the suggestion! its a great suggestion for improvement, let me take it back to the team and analyse what we can do to the smart contract for this improvement.
Thank you very much for your suggestion. So far, we have been emitting events in our smart contract and using log filters in our frontend to query the blockchain.
Issue:
View endorsement chain option while verifying document is getting timed out or resulting in RPC errors
Issue Description:
When verifying a document and attempting to view the endorsement chain on the TradeTrust platform, the process often results in 'time out' or 'block range too wide' errors. This issue arises from an eth_getLogs RPC call that queries the blockchain (archive node) from the genesis block to the latest block. Due to the extensive block range, the process is resource-intensive and prone to errors.
Steps to Reproduce:
Create a document on the TradeTrust platform (e.g., eBoL) at TradeTrust Document Creator.
Verify the document on the TradeTrust platform at TradeTrust Verify.
Once the document is verified, click on the "View endorsement chain" option.
Alternatively, replicate the issue using the following command:
Suggested Enhancements:
To optimize the process and effectively fetch the data, it is recommended to implement an events mechanism in the smart contract functions. Logging events when actions such as issuing a document, transferring ownership, or changing ownership occur will allow for more efficient data retrieval using filter log
Example Enhancement:
Add events to the smart contract and log them during relevant actions. Below is an example of how to add and use events in a smart contract:
Smart Contract Example:
Query Logs with Filters:
Related Pull Request:
A pull request was made to make the fromBlockNumber configurable for each chain, but implementing the event mechanism described above would provide a more optimized solution:
PR #921
The text was updated successfully, but these errors were encountered: