Context
Pool state is fully initialized on creation regardless of whether all fields are immediately needed.
Current Limitation/Problem
Full state initialization creates storage rent burden for fields not used until later operations.
Expected Outcome
Lazy initialization pattern where pool state fields are initialized on first use rather than pool creation.
Acceptance Criteria
- Identify deferrable state fields: not needed until first borrow, first liquidation, etc.
- Check-exists pattern: if field not initialized, use default
- On-first-use initialization: initialize on first operation that needs the field
- Gas cost front-loading: defer gas cost from creation to first operation
- Migration path for existing pools
- Storage rent savings: initial vs lazy initialization over pool lifetime
Technical Scope
contracts/lending-pool/src/lazy.rs - lazy initialization pattern
- State field classification: eager vs lazy
- Storage rent analysis per field
- Edge cases: concurrent first-use operations, initialization failure recovery
Context
Pool state is fully initialized on creation regardless of whether all fields are immediately needed.
Current Limitation/Problem
Full state initialization creates storage rent burden for fields not used until later operations.
Expected Outcome
Lazy initialization pattern where pool state fields are initialized on first use rather than pool creation.
Acceptance Criteria
Technical Scope
contracts/lending-pool/src/lazy.rs- lazy initialization pattern