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

Wrld 3 feature/process events #28

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

sylvaincormier
Copy link
Collaborator

No description provided.

…P request deadlines

- Define DataFetchedSuccessfully in the Event enum to signal successful data retrieval.
- Define HttpFetchingError in the Error enum for handling HTTP request failures.
- Correct the type mismatch in fetch_data by adjusting the .deadline() method to accept a Timestamp derived from the current time plus a Duration
This commit introduces the CardanoFollowerRpc trait along with its implementation, CardanoFollowerRpcImpl, which handles the submission of Cardano events via JSON-RPC within a Substrate node. Key highlights include:

- The `submitCardanoEvent` RPC method is defined to accept JSON string events. It deserializes these into an Event struct and stores the data in offchain storage using Substrate's persistent storage capabilities.
- Enhanced error handling provides detailed feedback for any failures encountered during the event parsing and storage processes.
- The RPC method is integrated into the existing Substrate node infrastructure using jsonrpsee_core's RpcModule, ensuring seamless interaction with other node components.

The implementation ensures that Cardano events are processed efficiently,
leveraging Substrate's offchain workers. Although the `submitCardanoEvent`
method itself is implemented synchronously, it is registered as an asynchronous RPC method
to align with jsonrpsee's asynchronous communication patterns. This setup not only caters to current needs but also provides a foundation for integrating more complex asynchronous operations in the future.
- Doc for ordering transactions
- cardano listnener test
- Docker network
… processing

- Changed RPC from ws to http
- Integrated offchain worker functionality to fetch and process data from an external JSON-RPC API endpoint.
- Added necessary imports and configurations for `no_std` environments, including `extern crate alloc` and appropriate `use` statements for `ToString` and `serde_json` functionalities.
- Implemented `fetch_all_events` function in the pallet to make a POST request to the JSON-RPC API and handle responses, including proper handling of content-type headers and JSON payloads.
- Added detailed logging to capture and print response codes and body content, improving debugging capabilities.
- Fixed type issues related to HTTP requests and payload handling by ensuring correct type usage and conversions.
- Refactored existing code to align with Substrate's offchain worker paradigms and best practices, including the usage of timeouts and error handling mechanisms.
…in pallet

- Added  struct with necessary fields and methods.
- Implemented leader election logic placeholder in  function.
- Created functions to fetch, validate, and process events: , , .
- Integrated event sequence validation with  function to ensure proper order and consistency among validators.
- Added extrinsic  to handle inclusion transactions, ensuring events are validated and ordered correctly.
- Implemented offchain worker hooks to fetch and process data, and submit inclusion transactions if the validator is the leader.
- Enhanced error handling and logging for better traceability.
- Defined storage map `EventStorage` to store events and facilitate mempool management.
Refactor pallet: Clean up and set up basic offchain functionality

- Removed unnecessary code and imports.
- Set up basic structure for offchain worker to fetch and process data.
- Implemented `fetch_data` function for HTTP requests.
- Added `manual_fetch` call to trigger data fetch.
- Ensured code compiles successfully.
…response

- Added deserialization of HTTP response body into Vec<CustomEvent> in fetch_all_events.
- Implemented processing of each fetched event in fetch_and_process_data.
- Improved error logging for failed event processing.
- Added CustomEvent struct and methods for creating and hashing events.
- Implemented pallet structure with Config trait and StorageMap for event storage.
- Added off-chain worker logic to fetch and process events from an external source.
- Implemented leader election logic and inclusion transaction creation.
- Enhanced HTTP request handling and error logging.
- Added placeholder functions for future integration with priority queue and KV store.
- Included synchronization logic for events with peers.
- Integrated new RPC endpoint for fetching all events from the priority queue.
- Added CustomEvent struct and methods for creating and hashing events.
- Implemented pallet structure with Config trait and StorageMap for event storage.
- Added off-chain worker logic to fetch and process events from an external source.
- Implemented leader election logic and inclusion transaction creation.
- Enhanced HTTP request handling and error logging.
- Added placeholder functions for future integration with priority queue and KV store.
- Included synchronization logic for events with peers.
- Integrated new RPC endpoint for fetching all events from the priority queue
- Added CustomEvent struct and methods for creating and hashing events.
- Implemented pallet structure with Config trait and StorageMap for event storage.
- Added off-chain worker logic to fetch and process events from an external source.
- Implemented leader election logic and inclusion transaction creation.
- Enhanced HTTP request handling and error logging.
- Added placeholder functions for future integration with priority queue and KV store.
- Included synchronization logic for events with peers.
- Integrated new RPC endpoint for fetching all events from the priority queue.
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.

1 participant