ava-labs / hypersdk

Opinionated Framework for Building Hyper-Scalable Blockchains on Avalanche
Other
205 stars 113 forks source link

Pass `vm.networkManager` while initializing a hypervm. #820

Open manojkgorle opened 7 months ago

manojkgorle commented 7 months ago

This enables Hyper VMS to communicate messages in their P2P. This enables nodes to transfer arbitrary data between them or pass some necessary off-chain messages.

The Controller interface changes to this:

type Controller interface {
    Initialize(
        inner *VM, // hypersdk VM
        snowCtx *snow.Context,
                NetworkManager *network.Manager
        gatherer ametrics.MultiGatherer,
        genesisBytes []byte,
        upgradeBytes []byte,
        configBytes []byte,
    ) (
        config Config,
        genesis Genesis,
        builder builder.Builder,
        gossiper gossiper.Gossiper,
        vmDB database.Database,
        stateDB database.Database,
        handler Handlers,
        actionRegistry chain.ActionRegistry,
        authRegistry chain.AuthRegistry,
        authEngines map[uint8]AuthEngine,
        err error,
    )

    Rules(t int64) chain.Rules // ms

    StateManager() chain.StateManager

    Accepted(ctx context.Context, blk *chain.StatelessBlock) error
    Rejected(ctx context.Context, blk *chain.StatelessBlock) error

    Shutdown(context.Context) error
}
github-actions[bot] commented 5 months ago

This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen label will exempt this issue from future lifecycle events.