From 2b7f19c8fc1d1475d7b64ab924a033b266d2b6cf Mon Sep 17 00:00:00 2001 From: bingyuyap Date: Sat, 5 Oct 2024 13:37:07 +0800 Subject: [PATCH] solana: update readme Signed-off-by: bingyuyap --- svm/programs/router/README.md | 47 +++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/svm/programs/router/README.md b/svm/programs/router/README.md index 2b86668a..067114d4 100644 --- a/svm/programs/router/README.md +++ b/svm/programs/router/README.md @@ -12,6 +12,7 @@ classDiagram class IntegratorChainTransceivers { bump: u8 chain_id: u16 + owner: Pubkey next_in_transceiver_id: u8 next_out_transceiver_id: u8 in_transceiver_bitmap: Bitmap @@ -26,33 +27,34 @@ classDiagram } class Bitmap { - bitmap: u128 + map: u128 } - Config "1" -- "" IntegratorChainTransceivers : tracks + Config "1" -- "*" IntegratorChainTransceivers : tracks IntegratorChainTransceivers "1" -- "2" Bitmap : uses - Bitmap "1" -- "" RegisteredTransceiver : tracks + IntegratorChainTransceivers "1" -- "*" RegisteredTransceiver : manages ``` ### Key Components 1. **Config**: Stores global configuration for the GMP Router. - - Tracks the integrator ID counter. - - Singleton account created during program initialization. + - Tracks the integrator ID counter. + - Singleton account created during program initialization. 2. **IntegratorChainTransceivers**: Manages transceivers for a specific integrator on a particular chain. - - Uses bitmaps for efficient storage and lookup of transceiver statuses. - - Maintains separate counters for incoming and outgoing transceivers. + - Uses bitmaps for efficient storage and lookup of transceiver statuses. + - Maintains separate counters for incoming and outgoing transceivers. + - Stores the owner of the account. 3. **RegisteredTransceiver**: Represents a registered transceiver in the GMP Router. - - Associated with a specific integrator and chain. - - Has a unique ID within its integrator and chain context. + - Associated with a specific integrator and chain. + - Has a unique ID within its integrator and chain context. 4. **Bitmap**: Utility struct for efficient storage and manipulation of boolean flags. - - Used to track the status of transceivers (active/inactive). + - Used to track the status of transceivers (active/inactive). ### Relationships @@ -65,3 +67,28 @@ classDiagram This structure allows for efficient management of multiple integrators, chains, and transceivers within the GMP Router system. It provides a scalable and flexible architecture for handling cross-chain message passing. For detailed documentation on each component and its methods, please refer to the source files and generated API documentation. + +### Tests + +1. InitIntegratorChainTransceivers +[x] Test init_integrator_chain_transceivers success +[x] Test init_integrator_chain_transceivers already initialized +[x] Test init_integrator_chain_transceivers for different chains +[ ] Test init_integrator_chain_transceivers with invalid chain ID +[ ] Test init_integrator_chain_transceivers with invalid owner + +2. RegisterTransceiver +[x] Test register_transceiver success +[x] Test register_transceiver bitmap overflow +[x] Test register_transceiver with non-authority +[ ] Test registration of outgoing transceivers +[ ] Test attempt to register a duplicate transceiver +[ ] Test registration with invalid chain ID +[ ] Test registration with invalid transceiver address + +3. TransferIntegratorChainTransceiversOwnership +[x] Test successful ownership transfer +[x] Test attempt to transfer ownership with non-owner account +[ ] Test attempt to transfer ownership to the same owner +[ ] Test attempt to transfer ownership to a zero address +[ ] Test registration of transceivers after ownership transfer