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

v1.10.13 #2172

Merged
21 commits merged into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0ac1937
Fix typo in block formation logic documentation (#2158)
kyoshisuki Oct 11, 2023
c50ea11
Marshal blocks and transactions inside API calls (#2153)
StephenButtolph Oct 11, 2023
7f61fee
Remove lock options from the info api (#2149)
StephenButtolph Oct 11, 2023
e6dab5d
Remove write lock option from the avm static API (#2154)
StephenButtolph Oct 11, 2023
0f95f13
Remove write lock option from the avm wallet API (#2155)
StephenButtolph Oct 11, 2023
99fc926
Fix json marshalling of Sets (#2161)
StephenButtolph Oct 11, 2023
1bc63d4
Rename `removeSubnetValidatorValidation` to `verifyRemoveSubnetValida…
dhrubabasu Oct 11, 2023
8247f74
Remove write lock option from the xsvm API (#2152)
StephenButtolph Oct 11, 2023
aae7260
Remove lock options from the IPCs api (#2151)
StephenButtolph Oct 11, 2023
18fbdef
Remove lock options from the admin API (#2150)
StephenButtolph Oct 11, 2023
9725095
Remove aliasing of `math` standard lib (#2163)
dhrubabasu Oct 11, 2023
2eb6e84
Remove write lock option from the platformvm API (#2157)
StephenButtolph Oct 11, 2023
9dbf82a
Remove write lock option from the avm rpc API (#2156)
StephenButtolph Oct 11, 2023
9da2e62
Remove context lock from API VM interface (#2165)
StephenButtolph Oct 12, 2023
8d2c4f2
Use set.Of rather than set.Add (#2164)
StephenButtolph Oct 12, 2023
007f98d
Bump google.golang.org/grpc from 1.55.0 to 1.58.3 (#2159)
dependabot[bot] Oct 13, 2023
50f131e
[x/merkledb] `Prefetcher` interface (#2167)
patrick-ogrady Oct 13, 2023
9d44ec2
Validator Diffs: docs and UTs cleanup (#2037)
abi87 Oct 16, 2023
188f2b2
MerkleDB Reduce buffer creation/memcopy on path construction (#2124)
dboehm-avalabs Oct 16, 2023
4da9491
Fix some P-chain UTs (#2117)
abi87 Oct 17, 2023
2d8222d
Update versions for v1.10.13 (#2180)
StephenButtolph Oct 17, 2023
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
10 changes: 10 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ linters:
- gosec
- gosimple
- govet
- importas
- ineffassign
# - lll
- misspell
Expand Down Expand Up @@ -107,6 +108,15 @@ linters-settings:
gosec:
excludes:
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
importas:
# Do not allow unaliased imports of aliased packages.
no-unaliased: false
# Do not allow non-required aliases.
no-extra-aliases: false
# List of aliases
alias:
- pkg: github.com/ava-labs/avalanchego/utils/math
alias: safemath
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
Expand Down
40 changes: 40 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Release Notes

## [v1.10.13](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.13)

This version is backwards compatible to [v1.10.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.0). It is optional, but encouraged.

The plugin version is updated to `29` all plugins must update to be compatible.

### Fixes

- Added `Prefetcher` to the `merkledb` interface
- Fixed json marshalling of `TrackedSubnets` and `AllowedNodes`

### What's Changed

- Fix typo in block formation logic documentation by @kyoshisuki in https://github.com/ava-labs/avalanchego/pull/2158
- Marshal blocks and transactions inside API calls by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2153
- Remove lock options from the info api by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2149
- Remove write lock option from the avm static API by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2154
- Remove write lock option from the avm wallet API by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2155
- Fix json marshalling of Sets by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2161
- Rename `removeSubnetValidatorValidation` to `verifyRemoveSubnetValidatorTx` by @dhrubabasu in https://github.com/ava-labs/avalanchego/pull/2162
- Remove lock options from the IPCs api by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2151
- Remove write lock option from the xsvm API by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2152
- Remove lock options from the admin API by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2150
- Remove aliasing of `math` standard lib by @dhrubabasu in https://github.com/ava-labs/avalanchego/pull/2163
- Remove write lock option from the platformvm API by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2157
- Remove write lock option from the avm rpc API by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2156
- Remove context lock from API VM interface by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2165
- Use set.Of rather than set.Add by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2164
- Bump google.golang.org/grpc from 1.55.0 to 1.58.3 by @dependabot in https://github.com/ava-labs/avalanchego/pull/2159
- [x/merkledb] `Prefetcher` interface by @patrick-ogrady in https://github.com/ava-labs/avalanchego/pull/2167
- Validator Diffs: docs and UTs cleanup by @abi87 in https://github.com/ava-labs/avalanchego/pull/2037
- MerkleDB Reduce buffer creation/memcopy on path construction by @dboehm-avalabs in https://github.com/ava-labs/avalanchego/pull/2124
- Fix some P-chain UTs by @abi87 in https://github.com/ava-labs/avalanchego/pull/2117

### New Contributors

- @kyoshisuki made their first contribution in https://github.com/ava-labs/avalanchego/pull/2158

**Full Changelog**: https://github.com/ava-labs/avalanchego/compare/v1.10.12...v1.10.13

## [v1.10.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.12)

This version is backwards compatible to [v1.10.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.0). It is optional, but encouraged.
Expand Down
54 changes: 42 additions & 12 deletions api/admin/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"net/http"
"path"
"sync"

"github.com/gorilla/rpc/v2"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/ava-labs/avalanchego/api/server"
"github.com/ava-labs/avalanchego/chains"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/json"
Expand Down Expand Up @@ -53,23 +53,24 @@ type Config struct {
// Admin is the API service for node admin management
type Admin struct {
Config
lock sync.RWMutex
profiler profiler.Profiler
}

// NewService returns a new admin API service.
// All of the fields in [config] must be set.
func NewService(config Config) (*common.HTTPHandler, error) {
newServer := rpc.NewServer()
func NewService(config Config) (http.Handler, error) {
server := rpc.NewServer()
codec := json.NewCodec()
newServer.RegisterCodec(codec, "application/json")
newServer.RegisterCodec(codec, "application/json;charset=UTF-8")
if err := newServer.RegisterService(&Admin{
Config: config,
profiler: profiler.New(config.ProfileDir),
}, "admin"); err != nil {
return nil, err
}
return &common.HTTPHandler{Handler: newServer}, nil
server.RegisterCodec(codec, "application/json")
server.RegisterCodec(codec, "application/json;charset=UTF-8")
return server, server.RegisterService(
&Admin{
Config: config,
profiler: profiler.New(config.ProfileDir),
},
"admin",
)
}

// StartCPUProfiler starts a cpu profile writing to the specified file
Expand All @@ -79,6 +80,9 @@ func (a *Admin) StartCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply
zap.String("method", "startCPUProfiler"),
)

a.lock.Lock()
defer a.lock.Unlock()

return a.profiler.StartCPUProfiler()
}

Expand All @@ -89,6 +93,9 @@ func (a *Admin) StopCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply)
zap.String("method", "stopCPUProfiler"),
)

a.lock.Lock()
defer a.lock.Unlock()

return a.profiler.StopCPUProfiler()
}

Expand All @@ -99,6 +106,9 @@ func (a *Admin) MemoryProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) e
zap.String("method", "memoryProfile"),
)

a.lock.Lock()
defer a.lock.Unlock()

return a.profiler.MemoryProfile()
}

Expand All @@ -109,6 +119,9 @@ func (a *Admin) LockProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) err
zap.String("method", "lockProfile"),
)

a.lock.Lock()
defer a.lock.Unlock()

return a.profiler.LockProfile()
}

Expand Down Expand Up @@ -157,6 +170,9 @@ func (a *Admin) AliasChain(_ *http.Request, args *AliasChainArgs, _ *api.EmptyRe
return err
}

a.lock.Lock()
defer a.lock.Unlock()

if err := a.ChainManager.Alias(chainID, args.Alias); err != nil {
return err
}
Expand Down Expand Up @@ -201,6 +217,10 @@ func (a *Admin) Stacktrace(_ *http.Request, _ *struct{}, _ *api.EmptyReply) erro
)

stacktrace := []byte(utils.GetStacktrace(true))

a.lock.Lock()
defer a.lock.Unlock()

return perms.WriteFile(stacktraceFile, stacktrace, perms.ReadWrite)
}

Expand Down Expand Up @@ -233,6 +253,9 @@ func (a *Admin) SetLoggerLevel(_ *http.Request, args *SetLoggerLevelArgs, _ *api
return errNoLogLevel
}

a.lock.Lock()
defer a.lock.Unlock()

var loggerNames []string
if len(args.LoggerName) > 0 {
loggerNames = []string{args.LoggerName}
Expand Down Expand Up @@ -278,6 +301,10 @@ func (a *Admin) GetLoggerLevel(_ *http.Request, args *GetLoggerLevelArgs, reply
zap.String("method", "getLoggerLevels"),
logging.UserString("loggerName", args.LoggerName),
)

a.lock.RLock()
defer a.lock.RUnlock()

reply.LoggerLevels = make(map[string]LogAndDisplayLevels)
var loggerNames []string
// Empty name means all loggers
Expand Down Expand Up @@ -329,6 +356,9 @@ func (a *Admin) LoadVMs(r *http.Request, _ *struct{}, reply *LoadVMsReply) error
zap.String("method", "loadVMs"),
)

a.lock.Lock()
defer a.lock.Unlock()

ctx := r.Context()
loadedVMs, failedVMs, err := a.VMRegistry.ReloadWithReadLock(ctx)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions api/common_args_responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package api

import (
stdjson "encoding/json"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/formatting"
"github.com/ava-labs/avalanchego/utils/json"
Expand Down Expand Up @@ -75,7 +77,7 @@ type GetBlockByHeightArgs struct {

// GetBlockResponse is the response object for the GetBlock API.
type GetBlockResponse struct {
Block interface{} `json:"block"`
Block stdjson.RawMessage `json:"block"`
// If GetBlockResponse.Encoding is formatting.Hex, GetBlockResponse.Block is
// the string representation of the block under hex encoding.
// If GetBlockResponse.Encoding is formatting.JSON, GetBlockResponse.Block
Expand Down Expand Up @@ -105,7 +107,7 @@ type GetTxReply struct {
// the tx under hex encoding.
// If [GetTxArgs.Encoding] is [JSON], [Tx] is the actual tx, which will be
// returned as JSON to the caller.
Tx interface{} `json:"tx"`
Tx stdjson.RawMessage `json:"tx"`
Encoding formatting.Encoding `json:"encoding"`
}

Expand Down
39 changes: 17 additions & 22 deletions api/info/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/network"
"github.com/ava-labs/avalanchego/network/peer"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/networking/benchlist"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/utils/constants"
Expand Down Expand Up @@ -59,7 +58,6 @@ type Parameters struct {
VMManager vms.Manager
}

// NewService returns a new admin API service
func NewService(
parameters Parameters,
log logging.Logger,
Expand All @@ -69,27 +67,24 @@ func NewService(
network network.Network,
validators validators.Set,
benchlist benchlist.Manager,
) (*common.HTTPHandler, error) {
newServer := rpc.NewServer()
) (http.Handler, error) {
server := rpc.NewServer()
codec := json.NewCodec()
newServer.RegisterCodec(codec, "application/json")
newServer.RegisterCodec(codec, "application/json;charset=UTF-8")
if err := newServer.RegisterService(&Info{
Parameters: parameters,
log: log,
chainManager: chainManager,
vmManager: vmManager,
myIP: myIP,
networking: network,
validators: validators,
benchlist: benchlist,
}, "info"); err != nil {
return nil, err
}
return &common.HTTPHandler{
LockOptions: common.NoLock,
Handler: newServer,
}, nil
server.RegisterCodec(codec, "application/json")
server.RegisterCodec(codec, "application/json;charset=UTF-8")
return server, server.RegisterService(
&Info{
Parameters: parameters,
log: log,
chainManager: chainManager,
vmManager: vmManager,
myIP: myIP,
networking: network,
validators: validators,
benchlist: benchlist,
},
"info",
)
}

// GetNodeVersionReply are the results from calling GetNodeVersion
Expand Down
Loading