diff --git a/app/app.go b/app/app.go index 0411c22c3f..26662c0488 100644 --- a/app/app.go +++ b/app/app.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "io/fs" + "maps" "math" "net/http" "os" @@ -1343,9 +1344,7 @@ func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { // GetMaccPerms returns a copy of the module account permissions func GetMaccPerms() map[string][]string { dupMaccPerms := make(map[string][]string) - for k, v := range maccPerms { - dupMaccPerms[k] = v - } + maps.Copy(dupMaccPerms, maccPerms) return dupMaccPerms } diff --git a/x/cronos/rpc/api.go b/x/cronos/rpc/api.go index 5567b9f85f..0aae376d55 100644 --- a/x/cronos/rpc/api.go +++ b/x/cronos/rpc/api.go @@ -279,11 +279,9 @@ func (api *CronosAPI) ReplayBlock(blockNrOrHash rpctypes.BlockNumberOrHash, post } // minus one to get the context of block beginning - contextHeight := blockNumber - 1 - if contextHeight < 1 { + contextHeight := max(blockNumber-1, // 0 is a special value in `ContextWithHeight` - contextHeight = 1 - } + 1) rsp, err := api.cronosQueryClient.ReplayBlock(rpctypes.ContextWithHeight(contextHeight), req) if err != nil { return nil, err