Skip to content

Commit

Permalink
Merge branch 'master' into module_roots
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower authored May 22, 2024
2 parents bd02541 + e89ca9a commit cfb4b10
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ RUN apt-get update && apt-get install -y curl build-essential=12.9

FROM wasm-base as wasm-libs-builder
# clang / lld used by soft-float wasm
RUN apt-get install -y clang=1:14.0-55.7~deb12u1 lld=1:14.0-55.7~deb12u1 wabt
RUN apt-get update && \
apt-get install -y clang=1:14.0-55.7~deb12u1 lld=1:14.0-55.7~deb12u1 wabt
# pinned rust 1.75.0
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.75.0 --target x86_64-unknown-linux-gnu wasm32-unknown-unknown wasm32-wasi
COPY ./Makefile ./
Expand Down
11 changes: 6 additions & 5 deletions cmd/conf/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ type ParentChainConfig struct {
}

var L1ConnectionConfigDefault = rpcclient.ClientConfig{
URL: "",
Retries: 2,
Timeout: time.Minute,
ConnectionWait: time.Minute,
ArgLogLimit: 2048,
URL: "",
Retries: 2,
Timeout: time.Minute,
ConnectionWait: time.Minute,
ArgLogLimit: 2048,
WebsocketMessageSizeLimit: 256 * 1024 * 1024,
}

var L1ConfigDefault = ParentChainConfig{
Expand Down
5 changes: 5 additions & 0 deletions staker/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,13 +1097,18 @@ func (v *BlockValidator) Initialize(ctx context.Context) error {
for _, root := range moduleRoots {
if v.redisValidator != nil && validator.SpawnerSupportsModule(v.redisValidator, root) {
v.chosenValidator[root] = v.redisValidator
log.Info("validator chosen", "WasmModuleRoot", root, "chosen", "redis")
} else {
for _, spawner := range v.execSpawners {
if validator.SpawnerSupportsModule(spawner, root) {
v.chosenValidator[root] = spawner
log.Info("validator chosen", "WasmModuleRoot", root, "chosen", spawner.Name())
break
}
}
if v.chosenValidator[root] == nil {
log.Error("validator not found", "WasmModuleRoot", root)
}
}
}
return nil
Expand Down
38 changes: 21 additions & 17 deletions util/rpcclient/rpcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import (
)

type ClientConfig struct {
URL string `json:"url,omitempty" koanf:"url"`
JWTSecret string `json:"jwtsecret,omitempty" koanf:"jwtsecret"`
Timeout time.Duration `json:"timeout,omitempty" koanf:"timeout" reload:"hot"`
Retries uint `json:"retries,omitempty" koanf:"retries" reload:"hot"`
ConnectionWait time.Duration `json:"connection-wait,omitempty" koanf:"connection-wait"`
ArgLogLimit uint `json:"arg-log-limit,omitempty" koanf:"arg-log-limit" reload:"hot"`
RetryErrors string `json:"retry-errors,omitempty" koanf:"retry-errors" reload:"hot"`
RetryDelay time.Duration `json:"retry-delay,omitempty" koanf:"retry-delay"`
URL string `json:"url,omitempty" koanf:"url"`
JWTSecret string `json:"jwtsecret,omitempty" koanf:"jwtsecret"`
Timeout time.Duration `json:"timeout,omitempty" koanf:"timeout" reload:"hot"`
Retries uint `json:"retries,omitempty" koanf:"retries" reload:"hot"`
ConnectionWait time.Duration `json:"connection-wait,omitempty" koanf:"connection-wait"`
ArgLogLimit uint `json:"arg-log-limit,omitempty" koanf:"arg-log-limit" reload:"hot"`
RetryErrors string `json:"retry-errors,omitempty" koanf:"retry-errors" reload:"hot"`
RetryDelay time.Duration `json:"retry-delay,omitempty" koanf:"retry-delay"`
WebsocketMessageSizeLimit int64 `json:"websocket-message-size-limit,omitempty" koanf:"websocket-message-size-limit"`

retryErrors *regexp.Regexp
}
Expand All @@ -46,16 +47,18 @@ func (c *ClientConfig) Validate() error {
type ClientConfigFetcher func() *ClientConfig

var TestClientConfig = ClientConfig{
URL: "self",
JWTSecret: "",
URL: "self",
JWTSecret: "",
WebsocketMessageSizeLimit: 256 * 1024 * 1024,
}

var DefaultClientConfig = ClientConfig{
URL: "self-auth",
JWTSecret: "",
Retries: 3,
RetryErrors: "websocket: close.*|dial tcp .*|.*i/o timeout|.*connection reset by peer|.*connection refused",
ArgLogLimit: 2048,
URL: "self-auth",
JWTSecret: "",
Retries: 3,
RetryErrors: "websocket: close.*|dial tcp .*|.*i/o timeout|.*connection reset by peer|.*connection refused",
ArgLogLimit: 2048,
WebsocketMessageSizeLimit: 256 * 1024 * 1024,
}

func RPCClientAddOptions(prefix string, f *flag.FlagSet, defaultConfig *ClientConfig) {
Expand All @@ -67,6 +70,7 @@ func RPCClientAddOptions(prefix string, f *flag.FlagSet, defaultConfig *ClientCo
f.Uint(prefix+".retries", defaultConfig.Retries, "number of retries in case of failure(0 mean one attempt)")
f.String(prefix+".retry-errors", defaultConfig.RetryErrors, "Errors matching this regular expression are automatically retried")
f.Duration(prefix+".retry-delay", defaultConfig.RetryDelay, "delay between retries")
f.Int64(prefix+".websocket-message-size-limit", defaultConfig.WebsocketMessageSizeLimit, "websocket message size limit used by the RPC client. 0 means no limit")
}

type RpcClient struct {
Expand Down Expand Up @@ -256,9 +260,9 @@ func (c *RpcClient) Start(ctx_in context.Context) error {
var err error
var client *rpc.Client
if jwt == nil {
client, err = rpc.DialContext(ctx, url)
client, err = rpc.DialOptions(ctx, url, rpc.WithWebsocketMessageSizeLimit(c.config().WebsocketMessageSizeLimit))
} else {
client, err = rpc.DialOptions(ctx, url, rpc.WithHTTPAuth(node.NewJWTAuth([32]byte(*jwt))))
client, err = rpc.DialOptions(ctx, url, rpc.WithHTTPAuth(node.NewJWTAuth([32]byte(*jwt))), rpc.WithWebsocketMessageSizeLimit(c.config().WebsocketMessageSizeLimit))
}
cancelCtx()
if err == nil {
Expand Down

0 comments on commit cfb4b10

Please sign in to comment.