Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set http body limit conf #1327

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugin/evm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ type Config struct {
// Note: only supports AddressedCall payloads as defined here:
// https://github.com/ava-labs/avalanchego/tree/7623ffd4be915a5185c9ed5e11fa9be15a6e1f00/vms/platformvm/warp/payload#addressedcall
WarpOffChainMessages []hexutil.Bytes `json:"warp-off-chain-messages"`

// RPC settings
HttpBodyLimit uint64 `json:"http-body-limit"`
}

// EthAPIs returns an array of strings representing the Eth APIs that should be enabled
Expand Down
7 changes: 7 additions & 0 deletions plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,10 @@ func newHandler(name string, service interface{}) (http.Handler, error) {
// CreateHandlers makes new http handlers that can handle API calls
func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error) {
handler := rpc.NewServer(vm.config.APIMaxDuration.Duration)
if vm.config.HttpBodyLimit > 0 {
handler.SetHTTPBodyLimit(int(vm.config.HttpBodyLimit))
}

enabledAPIs := vm.config.EthAPIs()
if err := attachEthService(handler, vm.eth.APIs(), enabledAPIs); err != nil {
return nil, err
Expand Down Expand Up @@ -1042,6 +1046,9 @@ func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error) {
// CreateStaticHandlers makes new http handlers that can handle API calls
func (vm *VM) CreateStaticHandlers(context.Context) (map[string]http.Handler, error) {
handler := rpc.NewServer(0)
if vm.config.HttpBodyLimit > 0 {
handler.SetHTTPBodyLimit(int(vm.config.HttpBodyLimit))
}
if err := handler.RegisterName("static", &StaticService{}); err != nil {
return nil, err
}
Expand Down
Loading