mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Check for SIGILL before using gohashtree (#11224)
* Check for SIGILL before using gohashtree * gohashtree dep * check error * move to config startup * Kasey's advice * review #1 Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,7 @@ go_library(
|
||||
deps = [
|
||||
"//cmd:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"@com_github_prysmaticlabs_gohashtree//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_urfave_cli_v2//:go_default_library",
|
||||
],
|
||||
|
||||
@@ -20,9 +20,13 @@ The process for implementing new features using this package is as follows:
|
||||
package features
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/prysmaticlabs/gohashtree"
|
||||
"github.com/prysmaticlabs/prysm/v3/cmd"
|
||||
"github.com/prysmaticlabs/prysm/v3/config/params"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -225,8 +229,23 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
|
||||
cfg.DisablePullTips = true
|
||||
}
|
||||
if ctx.Bool(enableVecHTR.Name) {
|
||||
logEnabled(enableVecHTR)
|
||||
cfg.EnableVectorizedHTR = true
|
||||
sigc := make(chan os.Signal, 1)
|
||||
signal.Notify(sigc, syscall.SIGILL)
|
||||
defer signal.Stop(sigc)
|
||||
buffer := make([][32]byte, 2)
|
||||
err := gohashtree.Hash(buffer, buffer)
|
||||
if err != nil {
|
||||
log.Error("could not test if gohashtree is supported")
|
||||
} else {
|
||||
t := time.NewTimer(time.Millisecond * 100)
|
||||
select {
|
||||
case <-sigc:
|
||||
log.Error("gohashtree is not supported in this CPU")
|
||||
case <-t.C:
|
||||
logEnabled(enableVecHTR)
|
||||
cfg.EnableVectorizedHTR = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if ctx.Bool(disableForkChoiceDoublyLinkedTree.Name) {
|
||||
logEnabled(disableForkChoiceDoublyLinkedTree)
|
||||
|
||||
Reference in New Issue
Block a user