@@ -23,6 +23,7 @@ import (
2323 "github.com/ava-labs/libevm/params"
2424 "github.com/ava-labs/libevm/rlp"
2525 "github.com/ava-labs/strevm/blocks"
26+ "github.com/ava-labs/strevm/hook"
2627 "github.com/ava-labs/strevm/queue"
2728 "github.com/ava-labs/strevm/saexec"
2829)
@@ -35,13 +36,13 @@ type VM struct {
3536 snowCtx * snow.Context
3637 snowcommon.AppHandler
3738 toEngine chan <- snowcommon.Message
38- hooks Hooks
39+ hooks hook. Points
3940 now func () time.Time
4041
4142 consensusState utils.Atomic [snow.State ]
4243
4344 blocks sink.Mutex [blockMap ]
44- preference atomic.Pointer [Block ]
45+ preference atomic.Pointer [blocks. Block ]
4546 last last
4647
4748 db ethdb.Database
@@ -56,15 +57,15 @@ type VM struct {
5657}
5758
5859type (
59- blockMap map [common.Hash ]* Block
60+ blockMap map [common.Hash ]* blocks. Block
6061 last struct {
6162 synchronousTime uint64
62- accepted , executed , settled atomic.Pointer [Block ]
63+ accepted , executed , settled atomic.Pointer [blocks. Block ]
6364 }
6465)
6566
6667type Config struct {
67- Hooks Hooks
68+ Hooks hook. Points
6869 ChainConfig * params.ChainConfig
6970 DB ethdb.Database
7071 // At the point of upgrade from synchronous to asynchronous execution, the
@@ -129,7 +130,7 @@ func New(ctx context.Context, c Config) (*VM, error) {
129130 return vm , nil
130131}
131132
132- func (vm * VM ) newBlock (b * types.Block , parent , lastSettled * Block ) (* Block , error ) {
133+ func (vm * VM ) newBlock (b * types.Block , parent , lastSettled * blocks. Block ) (* blocks. Block , error ) {
133134 return blocks .New (b , parent , lastSettled , vm .logger ())
134135}
135136
@@ -186,8 +187,8 @@ func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error) {
186187 }, nil
187188}
188189
189- func (vm * VM ) GetBlock (ctx context.Context , blkID ids.ID ) (* Block , error ) {
190- b , err := sink .FromMutex (ctx , vm .blocks , func (blocks blockMap ) (* Block , error ) {
190+ func (vm * VM ) GetBlock (ctx context.Context , blkID ids.ID ) (* blocks. Block , error ) {
191+ b , err := sink .FromMutex (ctx , vm .blocks , func (blocks blockMap ) (* blocks. Block , error ) {
191192 if b , ok := blocks [common .Hash (blkID )]; ok {
192193 return b , nil
193194 }
@@ -216,7 +217,7 @@ func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (*Block, error) {
216217 return vm .newBlock (ethB , nil , nil )
217218}
218219
219- func (vm * VM ) ParseBlock (ctx context.Context , blockBytes []byte ) (* Block , error ) {
220+ func (vm * VM ) ParseBlock (ctx context.Context , blockBytes []byte ) (* blocks. Block , error ) {
220221 b := new (types.Block )
221222 if err := rlp .DecodeBytes (blockBytes , b ); err != nil {
222223 return nil , err
@@ -227,7 +228,7 @@ func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (*Block, error)
227228 return vm .newBlock (b , nil , nil )
228229}
229230
230- func (vm * VM ) BuildBlock (ctx context.Context ) (* Block , error ) {
231+ func (vm * VM ) BuildBlock (ctx context.Context ) (* blocks. Block , error ) {
231232 return vm .buildBlock (ctx , uint64 (vm .now ().Unix ()), vm .preference .Load ())
232233}
233234
0 commit comments