ava-labs / ava-labs/avalanchego

refactor(sae): unify time functions in VM config and hooks

Open
#5,259 1 comment 0 reactions 0 assignees View on GitHub
enhancement evm sae
Dominant language
Go
Stars
2.4k
Forks
863
Avg merge
3d 8h
Merged PRs (30d)
64

Description

See: https://github.com/ava-labs/avalanchego/blob/7fc1fe66b9c10f8032c866ba2bd6157306f28abd/vms/saevm/sae/vm_test.go#L266

Tests need to set the same mock clock in both `vmConfig.Now` and `vmConfig.Hooks.Now`. Easy to forget one.

Could have hooks derive their time from the VM config's `Now` function, or have a single source of truth that both read from.

Contributor guide

Open the contributing guide

Research direction

Start with vms/saevm/sae/vm_test.go around line 266 and inspect how the test configures vmConfig.Now and vmConfig.Hooks.Now. Trace the VM config and hooks time entry points to determine where the duplicate clock values are introduced. Done means tests need one mock-clock source while both VM configuration and hooks observe the same time.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.