Skip to content

Commit

Permalink
Merge branch 'master' into cgroupsv2-resourcemanager
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson authored Aug 10, 2023
2 parents a007e25 + 0485120 commit 325566f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
5 changes: 2 additions & 3 deletions cmd/genericconf/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ func (a AuthRPCConfig) Apply(stackConf *node.Config) {
stackConf.AuthPort = a.Port
stackConf.AuthVirtualHosts = []string{} // dont allow http access
stackConf.JWTSecret = a.JwtSecret
// a few settings are not available as stanard config, but we can change the default. sigh..
node.DefaultAuthOrigins = a.Origins
node.DefaultAuthModules = a.API
stackConf.AuthModules = a.API
stackConf.AuthOrigins = a.Origins
}

var AuthRPCConfigDefault = AuthRPCConfig{
Expand Down
3 changes: 3 additions & 0 deletions cmd/nitro-val/nitro_val.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func mainImpl() int {

return genericconf.InitLog(newCfg.LogType, log.Lvl(newCfg.LogLevel), &newCfg.FileLogging, pathResolver(nodeConfig.Persistent.LogDir))
})

valnode.EnsureValidationExposedViaAuthRPC(&stackConf)

stack, err := node.New(&stackConf)
if err != nil {
flag.Usage()
Expand Down
7 changes: 6 additions & 1 deletion cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ func mainImpl() int {

resourcemanager.Init(&nodeConfig.Node.ResourceManagement)

var sameProcessValidationNodeEnabled bool
if nodeConfig.Node.BlockValidator.Enable && (nodeConfig.Node.BlockValidator.ValidationServer.URL == "self" || nodeConfig.Node.BlockValidator.ValidationServer.URL == "self-auth") {
sameProcessValidationNodeEnabled = true
valnode.EnsureValidationExposedViaAuthRPC(&stackConf)
}
stack, err := node.New(&stackConf)
if err != nil {
flag.Usage()
Expand Down Expand Up @@ -427,7 +432,7 @@ func mainImpl() int {
fatalErrChan := make(chan error, 10)

var valNode *valnode.ValidationNode
if nodeConfig.Node.BlockValidator.Enable && (nodeConfig.Node.BlockValidator.ValidationServer.URL == "self" || nodeConfig.Node.BlockValidator.ValidationServer.URL == "self-auth") {
if sameProcessValidationNodeEnabled {
valNode, err = valnode.CreateValidationNode(
func() *valnode.Config { return &liveNodeConfig.Get().Validation },
stack,
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
Submodule go-ethereum updated 0 files
2 changes: 2 additions & 0 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ func createTestValidationNode(t *testing.T, ctx context.Context, config *valnode
stackConf.P2P.NoDiscovery = true
stackConf.P2P.ListenAddr = ""

valnode.EnsureValidationExposedViaAuthRPC(&stackConf)

stack, err := node.New(&stackConf)
Require(t, err)

Expand Down
14 changes: 13 additions & 1 deletion validator/valnode/valnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ type ValidationNode struct {
jitSpawner *server_jit.JitSpawner
}

func EnsureValidationExposedViaAuthRPC(stackConf *node.Config) {
found := false
for _, module := range stackConf.AuthModules {
if module == server_api.Namespace {
found = true
break
}
}
if !found {
stackConf.AuthModules = append(stackConf.AuthModules, server_api.Namespace)
}
}

func CreateValidationNode(configFetcher ValidationConfigFetcher, stack *node.Node, fatalErrChan chan error) (*ValidationNode, error) {
config := configFetcher()
locator, err := server_common.NewMachineLocator(config.Wasm.RootPath)
Expand All @@ -84,7 +97,6 @@ func CreateValidationNode(configFetcher ValidationConfigFetcher, stack *node.Nod
if err != nil {
return nil, err
}
node.DefaultAuthModules = []string{server_api.Namespace}
var serverAPI *server_api.ExecServerAPI
var jitSpawner *server_jit.JitSpawner
if config.UseJit {
Expand Down

0 comments on commit 325566f

Please sign in to comment.