Documentation
¶
Overview ¶
Package proposervm is a generated GoMock package.
Index ¶
- Constants
- func NewHTTPHandler(vm *VM) (http.Handler, error)
- type Block
- type Config
- type GetProposedHeightArgs
- type GetProposedHeightReply
- type MockPostForkBlock
- func (m *MockPostForkBlock) Accept(arg0 context.Context) error
- func (m *MockPostForkBlock) Bytes() []byte
- func (m *MockPostForkBlock) EXPECT() *MockPostForkBlockMockRecorder
- func (m *MockPostForkBlock) Height() uint64
- func (m *MockPostForkBlock) ID() ids.ID
- func (m *MockPostForkBlock) Parent() ids.ID
- func (m *MockPostForkBlock) Reject(arg0 context.Context) error
- func (m *MockPostForkBlock) Status() choices.Status
- func (m *MockPostForkBlock) Timestamp() time.Time
- func (m *MockPostForkBlock) Verify(arg0 context.Context) error
- type MockPostForkBlockMockRecorder
- func (mr *MockPostForkBlockMockRecorder) Accept(arg0 any) *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Bytes() *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Height() *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) ID() *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Parent() *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Reject(arg0 any) *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Status() *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Timestamp() *gomock.Call
- func (mr *MockPostForkBlockMockRecorder) Verify(arg0 any) *gomock.Call
- type OracleBlock
- type PostForkBlock
- type Service
- type VM
- func (vm *VM) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]chainblock.Block, error)
- func (vm *VM) BuildBlock(ctx context.Context) (chainblock.Block, error)
- func (vm *VM) Commit() error
- func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (vm *VM) GetAncestors(ctx context.Context, blkID ids.ID, maxBlocksNum int, maxBlocksSize int, ...) ([][]byte, error)
- func (vm *VM) GetBlock(ctx context.Context, id ids.ID) (chainblock.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) GetFullPostForkBlock(ctx context.Context, blkID ids.ID) (chainblock.Block, error)
- func (vm *VM) GetLastStateSummary(ctx context.Context) (chainblock.StateSummary, error)
- func (vm *VM) GetOngoingSyncStateSummary(ctx context.Context) (chainblock.StateSummary, error)
- func (vm *VM) GetStateSummary(ctx context.Context, height uint64) (chainblock.StateSummary, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) ParseBlock(ctx context.Context, b []byte) (chainblock.Block, error)
- func (vm *VM) ParseLocalBlock(ctx context.Context, b []byte) (chainblock.Block, error)
- func (vm *VM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (chainblock.StateSummary, error)
- func (vm *VM) SetPreference(ctx context.Context, preferred ids.ID) error
- func (vm *VM) SetState(ctx context.Context, newState uint32) error
- func (vm *VM) Shutdown(ctx context.Context) error
- func (vm *VM) StateSyncEnabled(ctx context.Context) (bool, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
Constants ¶
const ( // DefaultMinBlockDelay should be kept as whole seconds because block // timestamps are only specific to the second. DefaultMinBlockDelay = time.Second // DefaultNumHistoricalBlocks as 0 results in never deleting any historical // blocks. DefaultNumHistoricalBlocks uint64 = 0 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
type Block interface {
chainblock.Block
// contains filtered or unexported methods
}
type Config ¶
type Config struct {
Upgrades upgrade.Config
// Configurable minimal delay among blocks issued consecutively
MinBlkDelay time.Duration
// Maximal number of block indexed.
// Zero signals all blocks are indexed.
NumHistoricalBlocks uint64
// Block signer
StakingLeafSigner crypto.Signer
// Block certificate
StakingCertLeaf *staking.Certificate
// Registerer for metric metrics
Registerer metric.Registerer
// Automining configuration
AutominingEnabled bool
// AutominingInterval is the interval between automatic block production
AutominingInterval time.Duration
}
type GetProposedHeightArgs ¶ added in v1.16.56
type GetProposedHeightArgs struct{}
GetProposedHeightArgs are the arguments for GetProposedHeight
type GetProposedHeightReply ¶ added in v1.16.56
type GetProposedHeightReply struct {
// ProposedHeight is the P-Chain height that would be proposed
// for the next block built on the current preferred block
ProposedHeight uint64 `json:"proposedHeight"`
}
GetProposedHeightReply is the response from GetProposedHeight
type MockPostForkBlock ¶ added in v1.1.11
type MockPostForkBlock struct {
// contains filtered or unexported fields
}
MockPostForkBlock is a mock of PostForkBlock interface.
func NewMockPostForkBlock ¶ added in v1.1.11
func NewMockPostForkBlock(ctrl *gomock.Controller) *MockPostForkBlock
NewMockPostForkBlock creates a new mock instance.
func (*MockPostForkBlock) Accept ¶ added in v1.1.11
func (m *MockPostForkBlock) Accept(arg0 context.Context) error
Accept mocks base method.
func (*MockPostForkBlock) Bytes ¶ added in v1.1.11
func (m *MockPostForkBlock) Bytes() []byte
Bytes mocks base method.
func (*MockPostForkBlock) EXPECT ¶ added in v1.1.11
func (m *MockPostForkBlock) EXPECT() *MockPostForkBlockMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPostForkBlock) Height ¶ added in v1.1.11
func (m *MockPostForkBlock) Height() uint64
Height mocks base method.
func (*MockPostForkBlock) ID ¶ added in v1.1.11
func (m *MockPostForkBlock) ID() ids.ID
ID mocks base method.
func (*MockPostForkBlock) Parent ¶ added in v1.1.11
func (m *MockPostForkBlock) Parent() ids.ID
Parent mocks base method.
func (*MockPostForkBlock) Reject ¶ added in v1.1.11
func (m *MockPostForkBlock) Reject(arg0 context.Context) error
Reject mocks base method.
func (*MockPostForkBlock) Status ¶ added in v1.1.11
func (m *MockPostForkBlock) Status() choices.Status
Status mocks base method.
func (*MockPostForkBlock) Timestamp ¶ added in v1.1.11
func (m *MockPostForkBlock) Timestamp() time.Time
Timestamp mocks base method.
type MockPostForkBlockMockRecorder ¶ added in v1.1.11
type MockPostForkBlockMockRecorder struct {
// contains filtered or unexported fields
}
MockPostForkBlockMockRecorder is the mock recorder for MockPostForkBlock.
func (*MockPostForkBlockMockRecorder) Accept ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Accept(arg0 any) *gomock.Call
Accept indicates an expected call of Accept.
func (*MockPostForkBlockMockRecorder) Bytes ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockPostForkBlockMockRecorder) Height ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Height() *gomock.Call
Height indicates an expected call of Height.
func (*MockPostForkBlockMockRecorder) ID ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockPostForkBlockMockRecorder) Parent ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Parent() *gomock.Call
Parent indicates an expected call of Parent.
func (*MockPostForkBlockMockRecorder) Reject ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Reject(arg0 any) *gomock.Call
Reject indicates an expected call of Reject.
func (*MockPostForkBlockMockRecorder) Status ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Status() *gomock.Call
Status indicates an expected call of Status.
func (*MockPostForkBlockMockRecorder) Timestamp ¶ added in v1.1.11
func (mr *MockPostForkBlockMockRecorder) Timestamp() *gomock.Call
Timestamp indicates an expected call of Timestamp.
type OracleBlock ¶ added in v1.16.56
type OracleBlock interface {
chainblock.Block
Options(context.Context) ([2]chainblock.Block, error)
}
OracleBlock is a block that can return multiple child options
type PostForkBlock ¶
type PostForkBlock interface {
Block
// contains filtered or unexported methods
}
type Service ¶ added in v1.16.56
type Service struct {
// contains filtered or unexported fields
}
Service wraps proposervm for RPC/JSON-RPC access
func (*Service) GetProposedHeight ¶ added in v1.16.56
func (s *Service) GetProposedHeight(r *http.Request, _ *GetProposedHeightArgs, reply *GetProposedHeightReply) error
GetProposedHeight returns the P-Chain height that would be proposed for the next block built on the current preferred block.
Example JSON-RPC call:
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"proposervm.getProposedHeight",
"params" :{}
}' -H 'content-type:application/json;' http://127.0.0.1:9650/ext/bc/C/rpc
type VM ¶
type VM struct {
chainblock.ChainVM
Config
state.State
proposer.Windower
tree.Tree
mockable.Clock
// contains filtered or unexported fields
}
func New ¶
func New( vm chainblock.ChainVM, config Config, ) *VM
New performs best when [minBlkDelay] is whole seconds. This is because block timestamps are only specific to the second.
func (*VM) BatchedParseBlock ¶
func (*VM) BuildBlock ¶
func (*VM) CreateHandlers ¶ added in v1.16.56
CreateHandlers returns HTTP handlers for both the proposervm API and the inner ChainVM
func (*VM) GetAncestors ¶
func (*VM) GetBlockIDAtHeight ¶
vm.ctx.Lock should be held
func (*VM) GetFullPostForkBlock ¶ added in v1.1.11
Note: this is a contention heavy call that should be avoided for frequent/repeated indexer ops
func (*VM) GetLastStateSummary ¶
func (vm *VM) GetLastStateSummary(ctx context.Context) (chainblock.StateSummary, error)
func (*VM) GetOngoingSyncStateSummary ¶
func (vm *VM) GetOngoingSyncStateSummary(ctx context.Context) (chainblock.StateSummary, error)
func (*VM) GetStateSummary ¶
func (vm *VM) GetStateSummary(ctx context.Context, height uint64) (chainblock.StateSummary, error)
func (*VM) Initialize ¶
func (*VM) ParseBlock ¶
func (*VM) ParseLocalBlock ¶
func (*VM) ParseStateSummary ¶
func (vm *VM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (chainblock.StateSummary, error)
Note: it's important that ParseStateSummary do not use any index or state to allow summaries being parsed also by freshly started node with no previous state.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
LP181 implements the epoch logic specified here: https://github.com/luxfi/LPs/blob/main/LPs/181-p-chain-epoched-views/README.md
|
LP181 implements the epoch logic specified here: https://github.com/luxfi/LPs/blob/main/LPs/181-p-chain-epoched-views/README.md |
|
Package proposer is a generated GoMock package.
|
Package proposer is a generated GoMock package. |
|
proposermock
Package proposermock is a generated GoMock package.
|
Package proposermock is a generated GoMock package. |
|
Package scheduler is a generated GoMock package.
|
Package scheduler is a generated GoMock package. |
|
schedulermock
Package schedulermock is a generated GoMock package.
|
Package schedulermock is a generated GoMock package. |
|
Package state is a generated GoMock package.
|
Package state is a generated GoMock package. |
|
statemock
Package statemock is a generated GoMock package.
|
Package statemock is a generated GoMock package. |