Skip to content

Commit 59e2353

Browse files
committed
refine starship test READMEs
1 parent e2c4013 commit 59e2353

File tree

3 files changed

+260
-0
lines changed

3 files changed

+260
-0
lines changed

networks/cosmos/starship/README.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,121 @@ Run
9595
yarn starship:test
9696
```
9797

98+
### Available Tests
99+
100+
The test suite includes comprehensive end-to-end tests covering various Cosmos SDK functionalities:
101+
102+
#### Authorization Tests (`authz.test.ts`)
103+
104+
Tests the Cosmos authz module functionality for delegating permissions between accounts:
105+
106+
- **Grant Authorization**: Tests granting `SendAuthorization` with spending limits and `GenericAuthorization` for specific message types
107+
- **Execute Authorized Actions**: Tests executing transactions on behalf of another account using granted permissions
108+
- **Revoke Authorization**: Tests revoking previously granted authorizations
109+
- **Key Scenarios**:
110+
- Granting limited send authorization with spending caps
111+
- Granting generic authorization for voting
112+
- Executing send transactions through authorization
113+
- Verifying authorization limits are enforced
114+
- Cleaning up authorizations by revoking them
115+
116+
#### Staking Tests (`staking.test.ts`)
117+
118+
Tests Cosmos staking operations including delegation and validator interactions:
119+
120+
- **Validator Discovery**: Queries and selects active validators for delegation
121+
- **Token Delegation**: Tests delegating tokens to validators using different signing modes
122+
- **Delegation Verification**: Verifies delegation amounts and validator assignments
123+
- **Key Scenarios**:
124+
- Querying bonded validators and selecting by stake amount
125+
- Delegating tokens using default, direct, and amino signing modes
126+
- Verifying delegation balances match expected amounts
127+
- Testing multiple delegation transactions to the same validator
128+
129+
#### Token Transfer Tests (`token.test.ts`)
130+
131+
Comprehensive testing of token transfers within and across chains:
132+
133+
- **Direct Mode Transfers**: Tests token transfers using direct (protobuf) signing
134+
- **Amino Mode Transfers**: Tests token transfers using amino (JSON) signing
135+
- **WebSocket Event Monitoring**: Tests real-time transaction event monitoring via WebSocket
136+
- **IBC Transfers**: Tests cross-chain token transfers using IBC protocol
137+
- **Key Scenarios**:
138+
- Sending OSMO tokens between accounts with balance verification
139+
- Monitoring transfer events in real-time using WebSocket subscriptions
140+
- Cross-chain IBC transfers from Osmosis to Cosmos Hub
141+
- Verifying IBC token receipt and denomination tracing
142+
143+
#### Governance Tests (`gov.test.ts`)
144+
145+
Tests Cosmos governance functionality including proposals and voting:
146+
147+
- **Proposal Submission**: Tests submitting text proposals to the governance module
148+
- **Voting Process**: Tests voting on proposals with different vote options
149+
- **Proposal Status Tracking**: Tests querying proposal status and vote tallies
150+
- **Validator Delegation**: Tests staking tokens to gain voting power
151+
- **Key Scenarios**:
152+
- Submitting governance proposals with proper deposits
153+
- Voting on proposals using different signers and vote options
154+
- Tracking proposal lifecycle from submission to completion
155+
- Verifying vote recording and tally calculations
156+
157+
#### Broadcast Tests (`broadcast.test.ts`)
158+
159+
Tests different transaction broadcasting methods and RPC functionality:
160+
161+
- **Async Broadcasting**: Tests `broadcastTxAsync` for fire-and-forget transactions
162+
- **Sync Broadcasting**: Tests `broadcastTxSync` for immediate response transactions
163+
- **Commit Broadcasting**: Tests `broadcastTxCommit` for confirmed transactions
164+
- **Error Handling**: Tests proper error responses for invalid transactions
165+
- **Key Scenarios**:
166+
- Testing different broadcast modes with various transaction types
167+
- Verifying proper RPC response formats
168+
- Handling invalid transactions and signature errors
169+
- Testing broadcast method performance characteristics
170+
171+
#### Query Client Tests (`query-client.test.ts`)
172+
173+
Tests the Cosmos query client functionality and RPC endpoint interactions:
174+
175+
- **RPC Connectivity**: Tests connection to Cosmos RPC endpoints
176+
- **Query Methods**: Tests various query methods for different modules
177+
- **Adapter Functionality**: Tests protocol adapters for different Cosmos versions
178+
- **Error Handling**: Tests proper error handling for failed queries
179+
- **Key Scenarios**:
180+
- Testing query client initialization and connection
181+
- Verifying query responses match expected formats
182+
- Testing different RPC adapter implementations
183+
- Handling network errors and timeouts gracefully
184+
185+
#### Signer Method Tests (`signer-methods.test.ts`)
186+
187+
Tests different signing methods and signer configurations:
188+
189+
- **Direct Signing**: Tests protobuf-based transaction signing
190+
- **Amino Signing**: Tests JSON-based legacy transaction signing
191+
- **Signer Configuration**: Tests various signer configuration options
192+
- **Multi-Signature**: Tests multi-signature transaction workflows
193+
- **Key Scenarios**:
194+
- Comparing direct vs amino signing results
195+
- Testing signer configuration with different parameters
196+
- Verifying signature formats and compatibility
197+
- Testing multi-signature transaction creation and signing
198+
199+
#### Setup Tests (`setup.test.ts`)
200+
201+
Infrastructure and environment setup tests:
202+
203+
- **Environment Validation**: Tests that the Starship environment is properly configured
204+
- **Chain Connectivity**: Tests connectivity to all configured chains
205+
- **Account Funding**: Tests faucet functionality for test account funding
206+
- **Service Health**: Tests that all required services are running and accessible
207+
- **Key Scenarios**:
208+
- Verifying Starship pods are running and healthy
209+
- Testing RPC endpoint accessibility
210+
- Validating test account creation and funding
211+
- Ensuring proper chain configuration and genesis state
212+
98213
## 5. Stop the infra
99214

100215
The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins).

networks/ethereum/starship/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,59 @@ Run
9595
yarn starship:test
9696
```
9797

98+
### Available Tests
99+
100+
The test suite includes comprehensive end-to-end tests covering Ethereum functionality including native ETH transfers, smart contract interactions, and utility functions:
101+
102+
#### Token Transfer Tests (`token.test.ts`)
103+
104+
Comprehensive testing of Ethereum token transfers and smart contract interactions:
105+
106+
- **ETH Transfers (Legacy)**: Tests native ETH transfers using legacy transaction format
107+
- **ETH Transfers (EIP-1559)**: Tests native ETH transfers using EIP-1559 transaction format with dynamic fees
108+
- **Smart Contract Deployment**: Tests deploying ERC-20 USDT contract to the test network
109+
- **ERC-20 Token Transfers**: Tests transferring ERC-20 tokens between accounts
110+
- **Personal Message Signing**: Tests signing arbitrary messages using personal_sign
111+
- **WebSocket Event Monitoring**: Tests real-time monitoring of smart contract events
112+
- **Key Scenarios**:
113+
- Sending ETH between accounts with balance verification and gas fee calculation
114+
- Deploying USDT smart contract and verifying deployment success
115+
- Transferring USDT tokens and verifying balance changes
116+
- Signing personal messages and validating signature format
117+
- Monitoring Transfer events via WebSocket for real-time contract interaction tracking
118+
- Testing both legacy and EIP-1559 transaction types for compatibility
119+
120+
**Network-Specific Considerations**:
121+
122+
- Uses local Hardhat node (http://127.0.0.1:8545) for testing
123+
- Tests with pre-funded accounts using deterministic private keys
124+
- Includes WebSocket testing (ws://127.0.0.1:8546) for event monitoring
125+
- Validates proper gas estimation and fee calculation for different transaction types
126+
- Tests contract interaction patterns including deployment, method calls, and event listening
127+
128+
#### Utility Function Tests (`utils.test.ts`)
129+
130+
Tests core Ethereum utility functions for address validation and data encoding:
131+
132+
- **Address Validation**: Tests Ethereum address format validation and checksum verification
133+
- **Address Conversion**: Tests conversion between different address formats (lowercase, uppercase, checksum)
134+
- **Data Encoding**: Tests UTF-8 to hex encoding and decoding functions
135+
- **Error Handling**: Tests proper error handling for invalid inputs
136+
- **Key Scenarios**:
137+
- Validating checksummed, lowercase, and uppercase Ethereum addresses
138+
- Detecting invalid checksum addresses and rejecting them
139+
- Converting addresses to proper checksum format
140+
- Encoding UTF-8 strings to hexadecimal representation
141+
- Decoding hex strings back to UTF-8 with proper error handling
142+
- Testing edge cases like invalid hex strings and malformed addresses
143+
144+
**Testing Patterns**:
145+
146+
- Comprehensive address format testing including EIP-55 checksum validation
147+
- Bidirectional encoding/decoding tests to ensure data integrity
148+
- Error boundary testing for malformed inputs
149+
- Validation of utility function reliability for production use
150+
98151
## 5. Stop the infra
99152

100153
The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins).

networks/injective/starship/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,98 @@ Run
9595
yarn starship:test
9696
```
9797

98+
### Available Tests
99+
100+
The test suite includes comprehensive end-to-end tests covering Injective Protocol functionality with Ethereum-compatible addressing and specialized Cosmos SDK features:
101+
102+
#### Staking Tests (`staking.test.ts`)
103+
104+
Tests Injective staking operations with Ethereum-style addressing and Cosmos SDK delegation:
105+
106+
- **Validator Discovery**: Queries and selects active validators for delegation using Injective RPC
107+
- **Token Delegation**: Tests delegating INJ tokens to validators using DirectSigner
108+
- **Delegation Verification**: Verifies delegation amounts and validator assignments
109+
- **Ethereum HD Path**: Uses Ethereum-style HD path (`m/44'/60'/0'/0/0`) for Injective compatibility
110+
- **Key Scenarios**:
111+
- Querying bonded validators and selecting by stake amount
112+
- Delegating tokens using Injective-specific signer configuration
113+
- Verifying delegation balances match expected amounts
114+
- Testing with EthSecp256k1HDWallet for Ethereum-compatible key derivation
115+
116+
**Injective-Specific Patterns**:
117+
118+
- Uses `EthSecp256k1HDWallet` instead of standard Cosmos wallets
119+
- Implements `queryClientWrapper` pattern to fix prototype chain issues
120+
- Uses Ethereum HD path for address derivation while maintaining Cosmos SDK compatibility
121+
- Applies Injective-specific signer configuration with compact signature format
122+
- Includes proper error handling for Injective network peculiarities
123+
124+
#### Token Transfer Tests (`token.test.ts`)
125+
126+
Comprehensive testing of INJ token transfers and IBC functionality:
127+
128+
- **Native INJ Transfers**: Tests transferring native INJ tokens between accounts
129+
- **IBC Transfers**: Tests cross-chain token transfers from Injective to Cosmos Hub
130+
- **Ethereum Addressing**: Uses Ethereum-style addresses with `inj` prefix
131+
- **Balance Verification**: Verifies token balances before and after transfers
132+
- **Key Scenarios**:
133+
- Sending INJ tokens between accounts with balance verification
134+
- Cross-chain IBC transfers to Cosmos Hub with denomination tracking
135+
- Testing with multiple wallet instances and address derivations
136+
- Verifying IBC token receipt and proper denomination handling
137+
138+
**Injective-Specific Patterns**:
139+
140+
- Uses `EthSecp256k1HDWallet` with Ethereum HD path for sender accounts
141+
- Switches to standard Cosmos HD path for Cosmos Hub recipients
142+
- Implements `queryClientWrapper` pattern for proper method binding
143+
- Uses Injective-specific signer configuration with proper defaults
144+
- Includes network-specific timeout and error handling
145+
146+
#### Governance Tests (`gov.test.ts`)
147+
148+
Tests Injective governance functionality including proposals and voting:
149+
150+
- **Proposal Submission**: Tests submitting text proposals to the Injective governance module
151+
- **Voting Process**: Tests voting on proposals with different vote options
152+
- **Validator Delegation**: Tests staking INJ tokens to gain voting power
153+
- **Proposal Status Tracking**: Tests querying proposal status and vote tallies
154+
- **Key Scenarios**:
155+
- Submitting governance proposals with proper deposits
156+
- Voting on proposals using both DirectSigner and AminoSigner
157+
- Tracking proposal lifecycle from submission to completion
158+
- Verifying vote recording and tally calculations with Injective-specific parameters
159+
160+
**Injective-Specific Patterns**:
161+
162+
- Uses dual signer setup (DirectSigner and AminoSigner) for compatibility testing
163+
- Implements proper encoder and converter registration for Injective message types
164+
- Uses `EthSecp256k1HDWallet` with Ethereum HD path for governance participants
165+
- Applies Injective-specific configuration for proposal parameters and voting periods
166+
- Includes proper handling of Injective governance module differences
167+
168+
#### Setup Tests (`setup.test.ts`)
169+
170+
Infrastructure and environment setup tests for Injective Protocol:
171+
172+
- **Environment Validation**: Tests that the Starship environment is properly configured for Injective
173+
- **Chain Connectivity**: Tests connectivity to Injective RPC endpoints
174+
- **Account Funding**: Tests faucet functionality for INJ token funding
175+
- **Wallet Compatibility**: Tests Ethereum-style wallet compatibility with Injective
176+
- **Key Scenarios**:
177+
- Verifying Starship pods are running and healthy for Injective
178+
- Testing RPC endpoint accessibility and proper responses
179+
- Validating test account creation with Ethereum-style addressing
180+
- Ensuring proper chain configuration and genesis state for Injective Protocol
181+
182+
**Injective-Specific Patterns**:
183+
184+
- Validates Ethereum-compatible address generation with `inj` prefix
185+
- Tests proper integration between Ethereum-style wallets and Cosmos SDK
186+
- Verifies Injective-specific RPC endpoints and query methods
187+
- Ensures proper configuration for Injective's unique protocol features
188+
- Tests compatibility between Ethereum tooling and Cosmos SDK functionality
189+
98190
## 5. Stop the infra
99191

100192
The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins).

0 commit comments

Comments
 (0)