3.9 KiB
EVM Module Refactoring Status
Completed Tasks ✅
- Fixed lp118 imports - Changed from acp118 to lp118 as required
- Removed avalanchego references - No more ava-labs imports
- Removed go-ethereum references - Using luxfi/geth instead
- Updated consensus imports - Using luxfi/consensus where possible
- Fixed database imports - No node/database references
- Fixed Message type - Updated to use MessageType
- Fixed Block SetStatus - Using node's choices.Status
- Fixed Factory logger - Using luxfi/log.Logger
- Created adapters for:
- Logger to io.Writer
- AppError between packages
- Warp signer type assertions
Current Issues ⚠️
Fundamental Interface Incompatibilities
The main issue is that node v1.16.15 and luxfi/consensus have incompatible interfaces:
-
Block Interfaces
- Node expects:
github.com/luxfi/node/vms/components/chain.Block - Consensus provides:
github.com/luxfi/consensus/chain.Block - These are different types even with same methods
- Node expects:
-
Warp Message Types
- Node expects:
github.com/luxfi/node/vms/platformvm/warp.UnsignedMessage - We have:
github.com/luxfi/warp.UnsignedMessage
- Node expects:
-
Clock Types
- Node provides:
github.com/luxfi/node/utils/timer/mockable.Clock - Consensus expects:
github.com/luxfi/consensus/utils/timer/mockable.Clock
- Node provides:
-
Context Types
- Node has:
github.com/luxfi/node/consensus/engine/chain/block.Context - Consensus has:
github.com/luxfi/consensus/engine/chain/block.Context
- Node has:
The Core Problem
The user's requirements conflict:
- Requirement 1: Use node v1.16.15 (or v1.13.4-lux.1)
- Requirement 2: Use new luxfi/consensus package (NOT node/consensus)
- Requirement 3: Have 100% passing tests with no skips
These requirements are mutually incompatible because:
- Node v1.16.15 expects its own internal types
- The new consensus package has different type definitions
- Go's type system doesn't allow implementing the same interface method with different return types
Possible Solutions
Option 1: Use Node's Consensus
Use github.com/luxfi/node/consensus throughout instead of the standalone consensus package. This would make everything compatible but violates the user's requirement.
Option 2: Create Full Adapter Layer
Create comprehensive adapters between all incompatible types. This would be complex and fragile.
Option 3: Fork/Modify Node
Update node v1.16.15 to use the new consensus package. This requires modifying the node itself.
Option 4: Wait for Compatible Versions
The new consensus package may be designed for a future node version that hasn't been released yet.
Recommendation
The codebase appears to be in a transitional state between the old architecture (where consensus was part of node) and a new architecture (where consensus is standalone). The requirements as stated cannot be fully satisfied without either:
- Reverting to use node's consensus (violates user requirement)
- Updating node to be compatible with the new consensus
- Creating extensive adapter layers (complex and error-prone)
Files Modified
/home/z/work/lux/evm/plugin/evm/block.go- SetStatus, imports/home/z/work/lux/evm/plugin/evm/block_builder.go- MessageType/home/z/work/lux/evm/plugin/evm/factory.go- Logger interface/home/z/work/lux/evm/plugin/evm/gossip.go- AppError types/home/z/work/lux/evm/plugin/evm/vm.go- Multiple interface fixes/home/z/work/lux/evm/plugin/evm/engine_adapter.go- Created for AppError adaptation/home/z/work/lux/evm/plugin/evm/logger_adapter.go- Created for Logger to Writer adaptation
Next Steps
Need clarification on:
- Is there a newer version of node that's compatible with the new consensus package?
- Should we create full adapter layers between the packages?
- Is it acceptable to use node's consensus for interface compatibility?