Files
consensus/engine/chain/block/vm.go
T
zeekay 4aac78700d Refactor: remove dead code, add thread safety, improve test coverage
- Remove unused packages: engine/dag/{getter,bootstrap,vertex/vertexmock},
  engine/pq/{bootstrap,block}, core/{tracker,verify}
- Add sync.RWMutex to protocol/wave for thread-safe map access
- Increase engine/dag test coverage from 11.7% to 98.3%
- Add comprehensive tests for DAG consensus, vertex, and engine
- All 27 packages pass tests, 16 at 100% coverage
2025-12-13 07:42:01 +00:00

60 lines
1.5 KiB
Go

package block
import (
"context"
"errors"
"time"
consensuscontext "github.com/luxfi/consensus/context"
"github.com/luxfi/consensus/core"
"github.com/luxfi/database/manager"
"github.com/luxfi/ids"
)
var (
// ErrRemoteVMNotImplemented is returned when the remote VM is not implemented
ErrRemoteVMNotImplemented = errors.New("remote VM not implemented")
// ErrStateSyncableVMNotImplemented is returned when state syncable VM is not implemented
ErrStateSyncableVMNotImplemented = errors.New("state syncable VM not implemented")
)
// BatchedChainVM extends ChainVM with batch operations
type BatchedChainVM interface {
ChainVM
GetAncestors(
ctx context.Context,
blkID ids.ID,
maxBlocksNum int,
maxBlocksSize int,
maxBlocksRetrievalTime time.Duration,
) ([][]byte, error)
BatchedParseBlock(ctx context.Context, blks [][]byte) ([]Block, error)
}
// BuildBlockWithContextChainVM extends ChainVM with context-aware block building
type BuildBlockWithContextChainVM interface {
ChainVM
BuildBlockWithContext(ctx context.Context, blockCtx *Context) (Block, error)
}
// ChainContext provides chain context
type ChainContext struct {
*consensuscontext.Context
}
// DBManager manages databases
type DBManager = manager.Manager
// Re-export core types for backwards compatibility
type (
MessageType = core.MessageType
Message = core.Message
Fx = core.Fx
)
// Message type constants re-exported from core
const (
PendingTxs = core.PendingTxs
StateSyncDone = core.StateSyncDone
)