Skip to content

Commit

Permalink
solana: update readme
Browse files Browse the repository at this point in the history
Signed-off-by: bingyuyap <[email protected]>
  • Loading branch information
bingyuyap committed Oct 5, 2024
1 parent aa575da commit ca386e6
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions svm/programs/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

0 comments on commit ca386e6

Please sign in to comment.