diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 4008e3a7b4e..83097774128 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -40,7 +40,7 @@ jobs: if: steps.checkdocs.outputs.build_docs == 'true' uses: acud/openapi-dockerized@v1 with: - build-roots: 'openapi/Swarm.yaml openapi/SwarmDebug.yaml' + build-roots: 'openapi/Swarm.yaml' env: AWS_ACCESS_KEY_ID: ${{ secrets.DO_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.DO_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7d7edc9e0b4..75eec69aab7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,10 +33,9 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - - name: Set the API and debug API versions + - name: Set the API version run: | echo "BEE_API_VERSION=$(grep '^ version:' openapi/Swarm.yaml | awk '{print $2}')" >> $GITHUB_ENV - echo "BEE_DEBUG_API_VERSION=$(grep '^ version:' openapi/SwarmDebug.yaml | awk '{print $2}')" >> $GITHUB_ENV - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: @@ -50,4 +49,3 @@ jobs: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} BEE_API_VERSION: ${{ env.BEE_API_VERSION }} - BEE_DEBUG_API_VERSION: ${{ env.BEE_DEBUG_API_VERSION }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 0f8844cbfdc..d84f3b1e8cd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -19,7 +19,6 @@ builds: - -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }} - -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }} - -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }} - - -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }} env: - CGO_ENABLED=0 goos: @@ -43,7 +42,6 @@ builds: - -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }} - -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }} - -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }} - - -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }} env: - CGO_ENABLED=0 goos: @@ -69,7 +67,6 @@ builds: - -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }} - -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }} - -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }} - - -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }} env: - CGO_ENABLED=0 goos: @@ -89,7 +86,6 @@ builds: - -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }} - -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }} - -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }} - - -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }} env: - CGO_ENABLED=0 goos: @@ -108,7 +104,6 @@ builds: - -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }} - -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }} - -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }} - - -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }} env: - CGO_ENABLED=0 goos: diff --git a/CODING.md b/CODING.md index 98efe16e63f..f72712ee8fe 100644 --- a/CODING.md +++ b/CODING.md @@ -206,9 +206,9 @@ A value of `all` will enable the highest verbosity of V-level. Examples: -`curl -XPUT http://localhost:1635/loggers/bm9kZS8q/none` - will disable all loggers; `bm9kZS8q` is base64 encoded `node/*` regular expression. +`curl -XPUT http://localhost:1633/loggers/bm9kZS8q/none` - will disable all loggers; `bm9kZS8q` is base64 encoded `node/*` regular expression. -`curl -XPUT http://localhost:1635/loggers/bm9kZS9hcGlbMV1bXT4-ODI0NjM0OTMzMjU2/error` - will set the verbosity of the logger with the subsystem `node/api[1][]>>824634933256` to `error`. +`curl -XPUT http://localhost:1633/loggers/bm9kZS9hcGlbMV1bXT4-ODI0NjM0OTMzMjU2/error` - will set the verbosity of the logger with the subsystem `node/api[1][]>>824634933256` to `error`. ## Commit Messages diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba690740ec1..88973b5ffe2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ These are work items that are good if you're contributing to the codebase for th - Performance optimizations - The best way to propose any optimizations would be to provide the relevant data to describe the problem and then also the same data after the optimizations are done. Keep in mind, Bee nodes work in a distributed system, so changes that would seem good locally may not hold in some cases. The Bee client in debug mode can show you metrics as well as pprof information. This can be used to demonstrate the optimizations. + The best way to propose any optimizations would be to provide the relevant data to describe the problem and then also the same data after the optimizations are done. Keep in mind, Bee nodes work in a distributed system, so changes that would seem good locally may not hold in some cases. The Bee client can show you metrics as well as pprof information. This can be used to demonstrate the optimizations. - Concurrency related optimizations diff --git a/Dockerfile b/Dockerfile index 38b13602cb1..e0f0738de6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee COPY --from=build /src/dist/bee /usr/local/bin/bee -EXPOSE 1633 1634 1635 +EXPOSE 1633 1634 USER bee WORKDIR /home/bee VOLUME /home/bee/.bee diff --git a/Dockerfile.ci b/Dockerfile.ci index 2c12b44ad4a..b2f962ddc13 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -8,7 +8,7 @@ RUN addgroup --system bee --gid 998; \ COPY bee /bee -EXPOSE 1633 1634 1635 +EXPOSE 1633 1634 USER bee WORKDIR /home/bee diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index 907c29ed0ab..cd1fe90dc0d 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -14,7 +14,7 @@ RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee COPY bee /usr/local/bin/bee -EXPOSE 1633 1634 1635 +EXPOSE 1633 1634 USER bee WORKDIR /home/bee VOLUME /home/bee/.bee diff --git a/Dockerfile.scratch b/Dockerfile.scratch index 85905fd691b..40b0bec6c94 100644 --- a/Dockerfile.scratch +++ b/Dockerfile.scratch @@ -17,7 +17,7 @@ COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs COPY --from=0 /etc/passwd /etc/passwd COPY --from=0 /home /home -EXPOSE 1633 1634 1635 +EXPOSE 1633 1634 USER bee WORKDIR /home/bee VOLUME /home/bee/.bee diff --git a/Makefile b/Makefile index 46da4995b14..9aa79e4f9cd 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ REACHABILITY_OVERRIDE_PUBLIC ?= false BATCHFACTOR_OVERRIDE_PUBLIC ?= 5 BEE_API_VERSION ?= "$(shell grep '^ version:' openapi/Swarm.yaml | awk '{print $$2}')" -BEE_DEBUG_API_VERSION ?= "$(shell grep '^ version:' openapi/SwarmDebug.yaml | awk '{print $$2}')" VERSION ?= "$(shell git describe --tags --abbrev=0 | cut -c2-)" COMMIT_HASH ?= "$(shell git describe --long --dirty --always --match "" || true)" @@ -24,7 +23,6 @@ LDFLAGS ?= -s -w \ -X github.com/ethersphere/bee/v2.commitHash="$(COMMIT_HASH)" \ -X github.com/ethersphere/bee/v2.commitTime="$(COMMIT_TIME)" \ -X github.com/ethersphere/bee/v2/pkg/api.Version="$(BEE_API_VERSION)" \ --X github.com/ethersphere/bee/v2/pkg/api.DebugVersion="$(BEE_DEBUG_API_VERSION)" \ -X github.com/ethersphere/bee/v2/pkg/p2p/libp2p.reachabilityOverridePublic="$(REACHABILITY_OVERRIDE_PUBLIC)" \ -X github.com/ethersphere/bee/v2/pkg/postage/listener.batchFactorOverridePublic="$(BATCHFACTOR_OVERRIDE_PUBLIC)" diff --git a/README.md b/README.md index c5fb6fdf04c..c310e4fea89 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![codecov](https://codecov.io/gh/ethersphere/bee/branch/master/graph/badge.svg?token=63RNRLO3RU)](https://codecov.io/gh/ethersphere/bee) [![Go Report Card](https://goreportcard.com/badge/github.com/ethersphere/bee)](https://goreportcard.com/report/github.com/ethersphere/bee) [![API OpenAPI Specs](https://img.shields.io/badge/openapi-api-blue)](https://docs.ethswarm.org/api/) -[![Debug API OpenAPI Specs](https://img.shields.io/badge/openapi-debugapi-lightblue)](https://docs.ethswarm.org/debug-api/) ![Docker Pulls](https://img.shields.io/docker/pulls/ethersphere/bee) ![GitHub all releases](https://img.shields.io/github/downloads/ethersphere/bee/total) ![GitHub](https://img.shields.io/github/license/ethersphere/bee) @@ -27,7 +26,7 @@ There are two versioning schemes used in Bee that you should be aware of. The ma strict Semantic Versioning. Bee hosts different peer-to-peer wire protocol implementations and individual protocol breaking changes would necessitate a bump in the major part of the version. Breaking changes are expected with bumps of the minor version component. New (backward-compatible) features and bug fixes are expected with a bump of the patch component. Major version bumps are reserved for significant changes in Swarm's incentive structure. -The second set of versions that are important are the Bee's API versions (denoted in our [Bee](https://github.com/ethersphere/bee/blob/master/openapi/Swarm.yaml) and [Bee Debug](https://github.com/ethersphere/bee/blob/master/openapi/SwarmDebug.yaml) OpenAPI specifications). These versions **do follow** +The second is the Bee's API version (denoted in our [Bee](https://github.com/ethersphere/bee/blob/master/openapi/Swarm.yaml) OpenAPI specifications). This version **follows** Semantic Versioning and hence you should follow these for breaking changes. ## Contributing diff --git a/cmd/bee/cmd/cmd.go b/cmd/bee/cmd/cmd.go index e02e3ff6f3f..964bb0754c1 100644 --- a/cmd/bee/cmd/cmd.go +++ b/cmd/bee/cmd/cmd.go @@ -34,8 +34,6 @@ const ( optionNameP2PAddr = "p2p-addr" optionNameNATAddr = "nat-addr" optionNameP2PWSEnable = "p2p-ws-enable" - optionNameDebugAPIEnable = "debug-api-enable" - optionNameDebugAPIAddr = "debug-api-addr" optionNameBootnodes = "bootnode" optionNameNetworkID = "network-id" optionWelcomeMessage = "welcome-message" @@ -256,8 +254,6 @@ func (c *command) setAllFlags(cmd *cobra.Command) { cmd.Flags().String(optionNameNATAddr, "", "NAT exposed address") cmd.Flags().Bool(optionNameP2PWSEnable, false, "enable P2P WebSocket transport") cmd.Flags().StringSlice(optionNameBootnodes, []string{""}, "initial nodes to connect to") - cmd.Flags().Bool(optionNameDebugAPIEnable, false, "enable debug HTTP API") - cmd.Flags().String(optionNameDebugAPIAddr, ":1635", "debug HTTP API listen address") cmd.Flags().Uint64(optionNameNetworkID, chaincfg.Mainnet.NetworkID, "ID of the Swarm network") cmd.Flags().StringSlice(optionCORSAllowedOrigins, []string{}, "origins with CORS headers enabled") cmd.Flags().Bool(optionNameTracingEnabled, false, "enable tracing") diff --git a/cmd/bee/cmd/start.go b/cmd/bee/cmd/start.go index e659d125116..d69be019c05 100644 --- a/cmd/bee/cmd/start.go +++ b/cmd/bee/cmd/start.go @@ -73,7 +73,6 @@ func (c *command) initStartCmd() (err error) { fmt.Print(beeWelcomeMessage) fmt.Printf("\n\nversion: %v - planned to be supported until %v, please follow https://ethswarm.org/\n\n", bee.Version, endSupportDate()) - fmt.Printf("DEPRECATION NOTICE:\nThe Debug API is deprecated and will be removed in the next release, version [2.2.0].\nPlease update your integrations to use the main Bee API to avoid service disruptions.\n\n") logger.Info("bee version", "version", bee.Version) go startTimeBomb(logger) @@ -214,11 +213,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo } } - debugAPIAddr := c.config.GetString(optionNameDebugAPIAddr) - if !c.config.GetBool(optionNameDebugAPIEnable) { - debugAPIAddr = "" - } - signerConfig, err := c.configureSigner(cmd, logger) if err != nil { return nil, err @@ -301,7 +295,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo DBWriteBufferSize: c.config.GetUint64(optionNameDBWriteBufferSize), DBDisableSeeksCompaction: c.config.GetBool(optionNameDBDisableSeeksCompaction), APIAddr: c.config.GetString(optionNameAPIAddr), - DebugAPIAddr: debugAPIAddr, Addr: c.config.GetString(optionNameP2PAddr), NATAddr: c.config.GetString(optionNameNATAddr), EnableWS: c.config.GetBool(optionNameP2PWSEnable), diff --git a/cmd/bee/cmd/start_dev.go b/cmd/bee/cmd/start_dev.go index a372094bf20..189363a455d 100644 --- a/cmd/bee/cmd/start_dev.go +++ b/cmd/bee/cmd/start_dev.go @@ -57,15 +57,9 @@ func (c *command) initStartDevCmd() (err error) { fmt.Println("Starting in development mode") fmt.Println() - debugAPIAddr := c.config.GetString(optionNameDebugAPIAddr) - if !c.config.GetBool(optionNameDebugAPIEnable) { - debugAPIAddr = "" - } - // generate signer in here b, err := node.NewDevBee(logger, &node.DevOptions{ APIAddr: c.config.GetString(optionNameAPIAddr), - DebugAPIAddr: debugAPIAddr, Logger: logger, DBOpenFilesLimit: c.config.GetUint64(optionNameDBOpenFilesLimit), DBBlockCacheCapacity: c.config.GetUint64(optionNameDBBlockCacheCapacity), @@ -140,9 +134,7 @@ func (c *command) initStartDevCmd() (err error) { }, } - cmd.Flags().Bool(optionNameDebugAPIEnable, true, "enable debug HTTP API") cmd.Flags().String(optionNameAPIAddr, ":1633", "HTTP API listen address") - cmd.Flags().String(optionNameDebugAPIAddr, ":1635", "debug HTTP API listen address") cmd.Flags().String(optionNameVerbosity, "info", "log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace") cmd.Flags().Uint64(optionNameDevReserveCapacity, 4194304, "cache reserve capacity") cmd.Flags().StringSlice(optionCORSAllowedOrigins, []string{}, "origins with CORS headers enabled") diff --git a/openapi/SwarmCommon.yaml b/openapi/SwarmCommon.yaml index 42e3f79d46f..b32fa88c8a4 100644 --- a/openapi/SwarmCommon.yaml +++ b/openapi/SwarmCommon.yaml @@ -439,10 +439,6 @@ components: type: string default: "0.0.0" description: The default value is set in case the bee binary was not build correctly. - debugApiVersion: - type: string - default: "0.0.0" - description: The default value is set in case the bee binary was not build correctly. PostageBatch: type: object diff --git a/openapi/SwarmDebug.yaml b/openapi/SwarmDebug.yaml deleted file mode 100644 index 986456cb527..00000000000 --- a/openapi/SwarmDebug.yaml +++ /dev/null @@ -1,1170 +0,0 @@ -openapi: 3.0.3 -info: - version: 4.1.2 - title: Bee Debug API - description: "A list of the currently provided debug interfaces to interact with the bee node" - -security: - - {} - -externalDocs: - description: Browse the documentation @ the Swarm Docs - url: "https://docs.ethswarm.org" - -servers: - - url: "http://{apiRoot}:{port}" - variables: - apiRoot: - default: "localhost" - description: Base address of the local bee node debug API - port: - default: "1635" - description: Service port provided in bee node config - -paths: - "/addresses": - get: - summary: Get overlay and underlay addresses of the node - tags: - - Connectivity - responses: - "200": - description: Own node underlay and overlay addresses - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Addresses" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/accounting": - get: - summary: Get all accounting associated values with all known peers - tags: - - Balance - responses: - "200": - description: Own accounting associated values with all known peers - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/PeerAccountingData" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/balances": - get: - summary: Get the balances with all known peers including prepaid services - tags: - - Balance - responses: - "200": - description: Own balances with all known peers - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Balances" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/balances/{address}": - get: - summary: Get the balances with a specific peer including prepaid services - tags: - - Balance - parameters: - - in: path - name: address - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - responses: - "200": - description: Balance with the specific peer - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Balance" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/blocklist": - get: - summary: Get a list of blocklisted peers - tags: - - Connectivity - responses: - "200": - description: Returns overlay addresses of blocklisted peers - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Peers" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/consumed": - get: - summary: Get the past due consumption balances with all known peers - tags: - - Balance - responses: - "200": - description: Own past due consumption balances with all known peers - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Balances" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/consumed/{address}": - get: - summary: Get the past due consumption balance with a specific peer - tags: - - Balance - parameters: - - in: path - name: address - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - responses: - "200": - description: Past-due consumption balance with the specific peer - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Balance" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chequebook/address": - get: - summary: Get the address of the chequebook contract used - tags: - - Chequebook - responses: - "200": - description: Ethereum address of chequebook contract - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/ChequebookAddress" - - "/chequebook/balance": - get: - summary: Get the balance of the chequebook - tags: - - Chequebook - responses: - "200": - description: Balance of the chequebook - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/ChequebookBalance" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chunks/{address}": - get: - summary: Check if chunk at address exists locally - tags: - - Chunk - parameters: - - in: path - name: address - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of chunk - responses: - "200": - description: Chunk exists - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Response" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - default: - description: Default response - - "/connect/{multiAddress}": - post: - summary: Connect to address - tags: - - Connectivity - parameters: - - in: path - allowReserved: true - name: multiAddress - schema: - $ref: "SwarmCommon.yaml#/components/schemas/MultiAddress" - required: true - description: Underlay address of peer - responses: - "200": - description: Returns overlay address of connected peer - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Address" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/reservestate": - get: - summary: Get reserve state - tags: - - Status - responses: - "200": - description: Reserve State - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/ReserveState" - default: - description: Default response - - "/chainstate": - get: - summary: Get chain state - tags: - - Status - responses: - "200": - description: Chain State - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/ChainState" - default: - description: Default response - - "/node": - get: - summary: Get information about the node - tags: - - Status - responses: - "200": - description: Information about the node - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Node" - default: - description: Default response - - "/peers": - get: - summary: Get a list of peers - tags: - - Connectivity - responses: - "200": - description: Returns overlay addresses of connected peers - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Peers" - default: - description: Default response - - "/peers/{address}": - delete: - summary: Remove peer - tags: - - Connectivity - parameters: - - in: path - name: address - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - responses: - "200": - description: Disconnected peer - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Response" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/pingpong/{address}": - post: - summary: Try connection to node - tags: - - Connectivity - parameters: - - in: path - name: address - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - responses: - "200": - description: Returns round trip time for given peer - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/RttMs" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/health": - get: - summary: Get node overall health Status - description: | - Health Status will indicate node healthiness. - - If node is unhealthy please check node logs for errors. - tags: - - Status - responses: - "200": - description: Health Status of node - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/HealthStatus" - default: - description: Default response - - "/readiness": - get: - summary: Readiness endpoint indicates if node is ready to start accepting traffic - tags: - - Status - responses: - "200": - description: Indicates that node is ready - $ref: "SwarmCommon.yaml#/components/responses/200" - "400": - description: Indicates that node is not ready - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response - - "/settlements/{address}": - get: - summary: Get amount of sent and received from settlements with a peer - tags: - - Settlements - parameters: - - in: path - name: address - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - responses: - "200": - description: Amount of sent or received from settlements with a peer - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Settlement" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/settlements": - get: - summary: Get settlements with all known peers and total amount sent or received - tags: - - Settlements - responses: - "200": - description: Settlements with all known peers and total amount sent or received - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Settlements" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/timesettlements": - get: - summary: Get time based settlements with all known peers and total amount sent or received - tags: - - Settlements - responses: - "200": - description: Time based settlements with all known peers and total amount sent or received - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/Settlements" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/topology": - get: - description: Get topology of known network - tags: - - Connectivity - responses: - "200": - description: Swarm topology of the bee node - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BzzTopology" - - "/welcome-message": - get: - summary: Get configured P2P welcome message - tags: - - Connectivity - responses: - "200": - description: Welcome message - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/WelcomeMessage" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - post: - summary: Set P2P welcome message - tags: - - Connectivity - requestBody: - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/WelcomeMessage" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/HealthStatus" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chequebook/cashout/{peer-id}": - get: - summary: Get last cashout action for the peer - parameters: - - in: path - name: peer-id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - tags: - - Chequebook - responses: - "200": - description: Cashout status - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwapCashoutStatus" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - post: - summary: Cashout the last cheque for the peer - parameters: - - in: path - name: peer-id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - - $ref: "SwarmCommon.yaml#/components/parameters/GasPriceParameter" - - $ref: "SwarmCommon.yaml#/components/parameters/GasLimitParameter" - tags: - - Chequebook - responses: - "201": - description: OK - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionResponse" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "429": - $ref: "SwarmCommon.yaml#/components/responses/429" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chequebook/cheque/{peer-id}": - get: - summary: Get last cheques for the peer - parameters: - - in: path - name: peer-id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - required: true - description: Swarm address of peer - tags: - - Chequebook - responses: - "200": - description: Last cheques - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/ChequePeerResponse" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chequebook/cheque": - get: - summary: Get last cheques for all peers - tags: - - Chequebook - responses: - "200": - description: Last cheques - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/ChequeAllPeersResponse" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chequebook/deposit": - post: - summary: Deposit tokens from overlay address into chequebook - parameters: - - in: query - name: amount - schema: - type: integer - required: true - description: amount of tokens to deposit - - $ref: "SwarmCommon.yaml#/components/parameters/GasPriceParameter" - tags: - - Chequebook - responses: - "201": - description: Transaction hash of the deposit transaction - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/chequebook/withdraw": - post: - summary: Withdraw tokens from the chequebook to the overlay address - parameters: - - in: query - name: amount - schema: - type: integer - required: true - description: amount of tokens to withdraw - - $ref: "SwarmCommon.yaml#/components/parameters/GasPriceParameter" - tags: - - Chequebook - responses: - "201": - description: Transaction hash of the withdraw transaction - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/redistributionstate": - get: - summary: Get current status of node in redistribution game - tags: - - RedistributionState - responses: - "200": - description: Redistribution status info - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/RedistributionStatusResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - "/wallet": - get: - summary: Get wallet balance for BZZ and xDai - tags: - - Wallet - responses: - "200": - description: Wallet balance info - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/WalletResponse" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - "/wallet/withdraw/{coin}": - post: - summary: Allows withdrawals of BZZ or xDAI to provided (whitelisted) address - tags: - - Wallet - parameters: - - in: query - name: amount - required: true - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BigInt" - - in: query - name: address - required: true - schema: - $ref: "SwarmCommon.yaml#/components/schemas/EthereumAddress" - - in: path - name: coin - required: true - schema: - $ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress" - responses: - "200": - content: - application/json: - schema: - $ref: 'SwarmCommon.yaml#/components/schemas/WalletTxResponse' - description: OK - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - description: Amount greater than ballance or coin is other than BZZ/xDAI - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/transactions": - get: - summary: Get list of pending transactions - tags: - - Transaction - responses: - "200": - description: List of pending transactions - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/PendingTransactionsResponse" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/transactions/{txHash}": - get: - summary: Get information about a sent transaction - parameters: - - in: path - name: txHash - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionHash" - required: true - description: Hash of the transaction - tags: - - Transaction - responses: - "200": - description: Get info about transaction - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionInfo" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - post: - summary: Rebroadcast existing transaction - parameters: - - in: path - name: txHash - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionHash" - required: true - description: Hash of the transaction - tags: - - Transaction - responses: - "200": - description: Hash of the transaction - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionResponse" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - delete: - summary: Cancel existing transaction - parameters: - - in: path - name: txHash - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionHash" - required: true - description: Hash of the transaction - - $ref: "SwarmCommon.yaml#/components/parameters/GasPriceParameter" - tags: - - Transaction - responses: - "200": - description: Hash of the transaction - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/TransactionResponse" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/stamps": - get: - summary: Get stamps for this node - tags: - - Postage Stamps - responses: - "200": - description: Returns an array of postage batches. - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/DebugPostageBatchesResponse" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - - default: - description: Default response - - "/stamps/{batch_id}": - parameters: - - in: path - name: batch_id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchID" - required: true - description: Swarm address of the stamp - get: - summary: Get an individual postage batch status - tags: - - Postage Stamps - responses: - "200": - description: Returns an individual postage batch state - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/DebugPostageBatch" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response - - "/stamps/{batch_id}/buckets": - parameters: - - in: path - name: batch_id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchID" - required: true - description: Swarm address of the stamp - get: - summary: Get extended bucket data of a batch - tags: - - Postage Stamps - responses: - "200": - description: Returns extended bucket data of the provided batch ID - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/PostageStampBuckets" - "404": - $ref: "SwarmCommon.yaml#/components/responses/404" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response - - "/stamps/{amount}/{depth}": - post: - summary: Buy a new postage batch. - description: Be aware, this endpoint creates an on-chain transactions and transfers BZZ from the node's Ethereum account and hence directly manipulates the wallet balance! - tags: - - Postage Stamps - parameters: - - in: path - name: amount - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BigInt" - required: true - description: Amount of BZZ added that the postage batch will have. - - in: path - name: depth - schema: - type: integer - required: true - description: Batch depth which specifies how many chunks can be signed with the batch. It is a logarithm. Must be higher than default bucket depth (16) - - in: query - name: label - schema: - type: string - required: false - description: An optional label for this batch - - in: header - name: immutable - schema: - type: boolean - required: false - responses: - "201": - description: Returns the newly created postage batch ID - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchIDResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "429": - $ref: "SwarmCommon.yaml#/components/responses/429" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/stamps/topup/{batch_id}/{amount}": - patch: - summary: Top up an existing postage batch. - description: Be aware, this endpoint creates on-chain transactions and transfers BZZ from the node's Ethereum account and hence directly manipulates the wallet balance! - tags: - - Postage Stamps - parameters: - - in: path - name: batch_id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchID" - required: true - description: Batch ID to top up - - in: path - name: amount - schema: - type: integer - required: true - description: Amount of BZZ per chunk to top up to an existing postage batch. - responses: - "202": - description: Returns the postage batch ID that was topped up - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchIDResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "429": - $ref: "SwarmCommon.yaml#/components/responses/429" - "402": - $ref: "SwarmCommon.yaml#/components/responses/402" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/stamps/dilute/{batch_id}/{depth}": - patch: - summary: Dilute an existing postage batch. - description: Be aware, this endpoint creates on-chain transactions and transfers BZZ from the node's Ethereum account and hence directly manipulates the wallet balance! - tags: - - Postage Stamps - parameters: - - in: path - name: batch_id - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchID" - required: true - description: Batch ID to dilute - - in: path - name: depth - schema: - type: integer - required: true - description: New batch depth. Must be higher than the previous depth. - responses: - "202": - description: Returns the postage batch ID that was diluted. - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/BatchIDResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "429": - $ref: "SwarmCommon.yaml#/components/responses/429" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/batches": - get: - summary: Get all globally available batches that were purchased by all nodes. - tags: - - Postage Stamps - responses: - "200": - description: Returns an array of all available and currently valid postage batches. - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/DebugPostageAllBatchesResponse" - - default: - description: Default response - - "/stake/{amount}": - post: - summary: Deposit some amount for staking. - description: Be aware, this endpoint creates an on-chain transactions and transfers BZZ from the node's Ethereum account and hence directly manipulates the wallet balance. - tags: - - Staking - parameters: - - in: path - name: amount - schema: - type: string - description: Amount of BZZ added that will be deposited for staking. - - $ref: "SwarmCommon.yaml#/components/parameters/GasPriceParameter" - - $ref: "SwarmCommon.yaml#/components/parameters/GasLimitParameter" - responses: - "200": - $ref: "SwarmCommon.yaml#/components/schemas/StakeDepositResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/stake": - get: - summary: Get the staked amount. - description: This endpoint fetches the staked amount from the blockchain. - tags: - - Staking - responses: - "200": - $ref: "SwarmCommon.yaml#/components/schemas/GetStakeResponse" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - delete: - summary: Withdraw all staked amount. - description: Be aware, this endpoint creates an on-chain transactions and transfers BZZ from the node's Ethereum account and hence directly manipulates the wallet balance. - tags: - - Staking - parameters: - - $ref: "SwarmCommon.yaml#/components/parameters/GasPriceParameter" - - $ref: "SwarmCommon.yaml#/components/parameters/GasLimitParameter" - responses: - "200": - $ref: "SwarmCommon.yaml#/components/schemas/WithdrawAllStakeResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - "500": - $ref: "SwarmCommon.yaml#/components/responses/500" - default: - description: Default response - - "/loggers": - get: - summary: Get all available loggers. - tags: - - Logging - responses: - "200": - description: Returns an array of all available loggers, also represented in short form in a tree. - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/LoggerResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response - - "/loggers/{exp}": - get: - summary: Get all available loggers that match the specified expression. - parameters: - - in: path - name: exp - schema: - $ref: "SwarmCommon.yaml#/components/schemas/LoggerExp" - required: true - description: Regular expression or a subsystem that matches the logger(s). - tags: - - Logging - responses: - "200": - description: Returns an array of all available loggers that matches given expression, also represented in short form in a tree. - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/LoggerResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response - put: - summary: Set logger(s) verbosity level. - parameters: - - in: path - name: exp - schema: - $ref: "SwarmCommon.yaml#/components/schemas/LoggerExp" - required: true - description: Regular expression or a subsystem that matches the logger(s). - tags: - - Logging - responses: - "200": - description: The verbosity was changed successfully. - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response - - "/status": - get: - summary: Get the current status snapshot of this node. - tags: - - Node Status - responses: - "200": - description: Returns the current node status snapshot. - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/StatusSnapshotResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response. - - "/status/peers": - get: - summary: Get the current status snapshot of this node connected peers. - tags: - - Node Status - responses: - "200": - description: Returns the status snapshot of this node connected peers - content: - application/json: - schema: - $ref: "SwarmCommon.yaml#/components/schemas/StatusResponse" - "400": - $ref: "SwarmCommon.yaml#/components/responses/400" - default: - description: Default response. diff --git a/packaging/bee.yaml b/packaging/bee.yaml index 560352926e1..6db6944b84c 100644 --- a/packaging/bee.yaml +++ b/packaging/bee.yaml @@ -24,10 +24,6 @@ data-dir: /var/lib/bee # db-write-buffer-size: 33554432 ## disables db compactions triggered by seeks # db-disable-seeks-compaction: false -## debug HTTP API listen address (default ":1635") -debug-api-addr: 127.0.0.1:1635 -## enable debug HTTP API -debug-api-enable: true ## cause the node to start in full mode # full-node: false ## NAT exposed address diff --git a/packaging/docker/README.md b/packaging/docker/README.md index cd95f1d131f..bce886018ae 100644 --- a/packaging/docker/README.md +++ b/packaging/docker/README.md @@ -43,7 +43,7 @@ docker-compose pull && docker-compose up -d ## Running multiple Bee nodes It is easy to run multiple bee nodes with docker compose by adding more services to `docker-compose.yaml` To do so, open `docker-compose.yaml`, copy lines 4-54 and past this after line 54 (whole bee-1 section). -In the copied lines, replace all occurrences of `bee-1` with `bee-2` and adjust the `API_ADDR` and `P2P_ADDR` and `DEBUG_API_ADDR` to respectively `1733`, `1734` and `127.0.0.1:1735` +In the copied lines, replace all occurrences of `bee-1` with `bee-2` and adjust the `API_ADDR` and `P2P_ADDR` to respectively `1733`, `1734.` Lastly, add your newly configured services under `volumes` (last lines), such that it looks like: ```yaml volumes: diff --git a/packaging/docker/docker-compose.yml b/packaging/docker/docker-compose.yml index f0b21be7701..56b6581d574 100644 --- a/packaging/docker/docker-compose.yml +++ b/packaging/docker/docker-compose.yml @@ -17,8 +17,6 @@ services: - BEE_DB_BLOCK_CACHE_CAPACITY - BEE_DB_WRITE_BUFFER_SIZE - BEE_DB_DISABLE_SEEKS_COMPACTION - - BEE_DEBUG_API_ADDR - - BEE_DEBUG_API_ENABLE - BEE_FULL_NODE - BEE_NAT_ADDR - BEE_NETWORK_ID @@ -48,7 +46,6 @@ services: ports: - "${API_ADDR:-1633}${BEE_API_ADDR:-:1633}" - "${P2P_ADDR:-1634}${BEE_P2P_ADDR:-:1634}" - - "${DEBUG_API_ADDR:-127.0.0.1:1635}${BEE_DEBUG_API_ADDR:-:1635}" volumes: - bee-1:/home/bee/.bee command: start diff --git a/packaging/docker/env b/packaging/docker/env index a9da56ae85e..f578f1ea9c9 100644 --- a/packaging/docker/env +++ b/packaging/docker/env @@ -26,10 +26,6 @@ # BEE_DB_WRITE_BUFFER_SIZE=33554432 ## disables db compactions triggered by seeks # BEE_DB_DISABLE_SEEKS_COMPACTION=false -## debug HTTP API listen address (default :1635) -# BEE_DEBUG_API_ADDR=:1635 -## enable debug HTTP API -# BEE_DEBUG_API_ENABLE=false ## enable global pinning ## cause the node to start in full mode # BEE_FULL_NODE=false diff --git a/packaging/homebrew-amd64/bee.yaml b/packaging/homebrew-amd64/bee.yaml index 235ad42e781..79470f1b7a4 100644 --- a/packaging/homebrew-amd64/bee.yaml +++ b/packaging/homebrew-amd64/bee.yaml @@ -24,10 +24,6 @@ data-dir: /usr/local/var/lib/swarm-bee # db-write-buffer-size: 33554432 ## disables db compactions triggered by seeks # db-disable-seeks-compaction: false -## debug HTTP API listen address (default ":1635") -debug-api-addr: 127.0.0.1:1635 -## enable debug HTTP API -debug-api-enable: true ## cause the node to start in full mode # full-node: false ## NAT exposed address diff --git a/packaging/homebrew-arm64/bee.yaml b/packaging/homebrew-arm64/bee.yaml index 212fadca581..5b52b272d31 100644 --- a/packaging/homebrew-arm64/bee.yaml +++ b/packaging/homebrew-arm64/bee.yaml @@ -24,10 +24,6 @@ data-dir: /opt/homebrew/var/lib/swarm-bee # db-write-buffer-size: 33554432 ## disables db compactions triggered by seeks # db-disable-seeks-compaction: false -## debug HTTP API listen address (default ":1635") -debug-api-addr: 127.0.0.1:1635 -## enable debug HTTP API -debug-api-enable: true ## cause the node to start in full mode # full-node: false ## NAT exposed address diff --git a/packaging/scoop/bee.yaml b/packaging/scoop/bee.yaml index 18c01229b2c..6efdc90bb20 100644 --- a/packaging/scoop/bee.yaml +++ b/packaging/scoop/bee.yaml @@ -14,10 +14,6 @@ config: ./bee.yaml data-dir: ./data ## cache capacity in chunks, multiply by 4096 to get approximate capacity in bytes # cache-capacity: 1000000 -## debug HTTP API listen address (default ":1635") -# debug-api-addr: 127.0.0.1:1635 -## enable debug HTTP API -# debug-api-enable: false ## cause the node to start in full mode # full-node: false ## NAT exposed address diff --git a/pkg/api/accounting_test.go b/pkg/api/accounting_test.go index 7a807aa811e..c2db87d2cdb 100644 --- a/pkg/api/accounting_test.go +++ b/pkg/api/accounting_test.go @@ -56,7 +56,6 @@ func TestAccountingInfo(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithPeerAccountingFunc(accountingFunc)}, }) @@ -112,7 +111,6 @@ func TestAccountingInfoError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithPeerAccountingFunc(accountingFunc)}, }) diff --git a/pkg/api/api.go b/pkg/api/api.go index 4e356a14d69..fec8ab44afe 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -161,7 +161,6 @@ type Service struct { wsWg sync.WaitGroup // wait for all websockets to close on exit quit chan struct{} - // from debug API overlay *swarm.Address publicKey ecdsa.PublicKey pssPublicKey ecdsa.PublicKey diff --git a/pkg/api/api_test.go b/pkg/api/api_test.go index 6a96812a908..bf2c5288c5a 100644 --- a/pkg/api/api_test.go +++ b/pkg/api/api_test.go @@ -105,7 +105,6 @@ type testServerOptions struct { Steward steward.Interface WsHeaders http.Header Authenticator auth.Authenticator - DebugAPI bool Restricted bool DirectUpload bool Probe *api.Probe @@ -235,12 +234,10 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket. WsPingPeriod: o.WsPingPeriod, Restricted: o.Restricted, }, extraOpts, 1, erc20) - if o.DebugAPI { - s.MountTechnicalDebug() - s.MountDebug() - } else { - s.MountAPI() - } + + s.MountTechnicalDebug() + s.MountDebug() + s.MountAPI() if o.DirectUpload { chanStore = newChanStore(o.Storer.PusherFeed()) @@ -251,21 +248,6 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket. t.Cleanup(ts.Close) var ( - httpClient = &http.Client{ - Transport: web.RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - u, err := url.Parse(ts.URL + r.URL.String()) - if err != nil { - return nil, err - } - r.URL = u - return ts.Client().Transport.RoundTrip(r) - }), - } - conn *websocket.Conn - err error - ) - - if !o.DebugAPI { httpClient = &http.Client{ Transport: web.RoundTripperFunc(func(r *http.Request) (*http.Response, error) { requestURL := r.URL.String() @@ -287,7 +269,9 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket. return transport.RoundTrip(r) }), } - } + conn *websocket.Conn + err error + ) if o.WsPath != "" { u := url.URL{Scheme: "ws", Host: ts.Listener.Addr().String(), Path: o.WsPath} diff --git a/pkg/api/balances_test.go b/pkg/api/balances_test.go index 174196d253a..d5434c3d3c8 100644 --- a/pkg/api/balances_test.go +++ b/pkg/api/balances_test.go @@ -32,7 +32,6 @@ func TestBalances(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithCompensatedBalancesFunc(compensatedBalancesFunc)}, }) @@ -72,7 +71,6 @@ func TestBalancesError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithCompensatedBalancesFunc(compensatedBalancesFunc)}, }) @@ -92,7 +90,6 @@ func TestBalancesPeers(t *testing.T) { return big.NewInt(100000000000000000), nil } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithCompensatedBalanceFunc(compensatedBalanceFunc)}, }) @@ -113,7 +110,6 @@ func TestBalancesPeersError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithCompensatedBalanceFunc(compensatedBalanceFunc)}, }) @@ -133,7 +129,6 @@ func TestBalancesPeersNoBalance(t *testing.T) { return nil, accounting.ErrPeerNoBalance } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithCompensatedBalanceFunc(compensatedBalanceFunc)}, }) @@ -186,7 +181,6 @@ func TestConsumedBalances(t *testing.T) { return ret, err } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithBalancesFunc(balancesFunc)}, }) @@ -227,7 +221,6 @@ func TestConsumedError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithBalancesFunc(balancesFunc)}, }) @@ -247,7 +240,6 @@ func TestConsumedPeers(t *testing.T) { return big.NewInt(1000000000000000000), nil } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithBalanceFunc(balanceFunc)}, }) @@ -268,7 +260,6 @@ func TestConsumedPeersError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithBalanceFunc(balanceFunc)}, }) @@ -288,7 +279,6 @@ func TestConsumedPeersNoBalance(t *testing.T) { return nil, accounting.ErrPeerNoBalance } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, AccountingOpts: []mock.Option{mock.WithBalanceFunc(balanceFunc)}, }) @@ -303,7 +293,7 @@ func TestConsumedPeersNoBalance(t *testing.T) { func Test_peerBalanceHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -352,7 +342,7 @@ func Test_peerBalanceHandler_invalidInputs(t *testing.T) { func Test_compensatedPeerBalanceHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string diff --git a/pkg/api/chequebook_test.go b/pkg/api/chequebook_test.go index b9b9cbdef32..e0276654d45 100644 --- a/pkg/api/chequebook_test.go +++ b/pkg/api/chequebook_test.go @@ -40,7 +40,6 @@ func TestChequebookBalance(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{ mock.WithChequebookBalanceFunc(chequebookBalanceFunc), mock.WithChequebookAvailableBalanceFunc(chequebookAvailableBalanceFunc), @@ -71,7 +70,6 @@ func TestChequebookBalanceError(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{mock.WithChequebookBalanceFunc(chequebookBalanceFunc)}, }) @@ -95,7 +93,6 @@ func TestChequebookAvailableBalanceError(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{ mock.WithChequebookBalanceFunc(chequebookBalanceFunc), mock.WithChequebookAvailableBalanceFunc(chequebookAvailableBalanceFunc), @@ -118,7 +115,6 @@ func TestChequebookAddress(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{mock.WithChequebookAddressFunc(chequebookAddressFunc)}, }) @@ -154,7 +150,6 @@ func TestChequebookWithdraw(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{mock.WithChequebookWithdrawFunc(chequebookWithdrawFunc)}, }) @@ -184,7 +179,6 @@ func TestChequebookWithdraw(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{mock.WithChequebookWithdrawFunc(chequebookWithdrawFunc)}, }) @@ -218,7 +212,6 @@ func TestChequebookDeposit(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{mock.WithChequebookDepositFunc(chequebookDepositFunc)}, }) @@ -249,7 +242,6 @@ func TestChequebookDeposit(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, ChequebookOpts: []mock.Option{mock.WithChequebookDepositFunc(chequebookDepositFunc)}, }) @@ -358,7 +350,6 @@ func TestChequebookLastCheques(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithLastReceivedChequesFunc(lastReceivedChequesFunc), swapmock.WithLastSentChequesFunc(lastSentChequesFunc)}, }) @@ -472,7 +463,6 @@ func TestChequebookLastChequesPeer(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithLastReceivedChequeFunc(lastReceivedChequeFunc), swapmock.WithLastSentChequeFunc(lastSentChequeFunc)}, }) @@ -512,7 +502,6 @@ func TestChequebookCashout(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithCashChequeFunc(cashChequeFunc)}, }) @@ -543,7 +532,6 @@ func TestChequebookCashout_CustomGas(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithCashChequeFunc(cashChequeFunc)}, }) @@ -619,7 +607,6 @@ func TestChequebookCashoutStatus(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithCashoutStatusFunc(cashoutStatusFunc)}, }) @@ -667,7 +654,6 @@ func TestChequebookCashoutStatus(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithCashoutStatusFunc(cashoutStatusFunc)}, }) @@ -706,7 +692,6 @@ func TestChequebookCashoutStatus(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []swapmock.Option{swapmock.WithCashoutStatusFunc(cashoutStatusFunc)}, }) @@ -733,7 +718,7 @@ func TestChequebookCashoutStatus(t *testing.T) { func Test_chequebookLastPeerHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string diff --git a/pkg/api/debugstorage_test.go b/pkg/api/debugstorage_test.go index bb12a5585fd..14a669f6b10 100644 --- a/pkg/api/debugstorage_test.go +++ b/pkg/api/debugstorage_test.go @@ -35,8 +35,7 @@ func TestDebugStorage(t *testing.T) { } ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, - Storer: mockstorer.NewWithDebugInfo(want), + Storer: mockstorer.NewWithDebugInfo(want), }) jsonhttptest.Request(t, ts, http.MethodGet, "/debugstore", http.StatusOK, diff --git a/pkg/api/health.go b/pkg/api/health.go index 33b6481b6ee..e153b9114f0 100644 --- a/pkg/api/health.go +++ b/pkg/api/health.go @@ -12,18 +12,16 @@ import ( ) type healthStatusResponse struct { - Status string `json:"status"` - Version string `json:"version"` - APIVersion string `json:"apiVersion"` - DebugAPIVersion string `json:"debugApiVersion"` + Status string `json:"status"` + Version string `json:"version"` + APIVersion string `json:"apiVersion"` } func (s *Service) healthHandler(w http.ResponseWriter, _ *http.Request) { status := s.probe.Healthy() jsonhttp.OK(w, healthStatusResponse{ - Status: status.String(), - Version: bee.Version, - APIVersion: Version, - DebugAPIVersion: DebugVersion, + Status: status.String(), + Version: bee.Version, + APIVersion: Version, }) } diff --git a/pkg/api/health_test.go b/pkg/api/health_test.go index 3446e167895..11c79f5366c 100644 --- a/pkg/api/health_test.go +++ b/pkg/api/health_test.go @@ -23,10 +23,9 @@ func TestHealth(t *testing.T) { // When probe is not set health endpoint should indicate that node is not healthy jsonhttptest.Request(t, testServer, http.MethodGet, "/health", http.StatusOK, jsonhttptest.WithExpectedJSONResponse(api.HealthStatusResponse{ - Status: "nok", - Version: bee.Version, - APIVersion: api.Version, - DebugAPIVersion: api.Version, + Status: "nok", + Version: bee.Version, + APIVersion: api.Version, })) }) @@ -40,28 +39,25 @@ func TestHealth(t *testing.T) { // Current health probe is pending which should indicate that API is not healthy jsonhttptest.Request(t, testServer, http.MethodGet, "/health", http.StatusOK, jsonhttptest.WithExpectedJSONResponse(api.HealthStatusResponse{ - Status: "nok", - Version: bee.Version, - APIVersion: api.Version, - DebugAPIVersion: api.Version, + Status: "nok", + Version: bee.Version, + APIVersion: api.Version, })) // When we set health probe to OK it should indicate that node is healthy probe.SetHealthy(api.ProbeStatusOK) jsonhttptest.Request(t, testServer, http.MethodGet, "/health", http.StatusOK, jsonhttptest.WithExpectedJSONResponse(api.HealthStatusResponse{ - Status: "ok", - Version: bee.Version, - APIVersion: api.Version, - DebugAPIVersion: api.Version, + Status: "ok", + Version: bee.Version, + APIVersion: api.Version, })) // When we set health probe to NOK it should indicate that node is not healthy probe.SetHealthy(api.ProbeStatusNOK) jsonhttptest.Request(t, testServer, http.MethodGet, "/health", http.StatusOK, jsonhttptest.WithExpectedJSONResponse(api.HealthStatusResponse{ - Status: "nok", - Version: bee.Version, - APIVersion: api.Version, - DebugAPIVersion: api.Version, + Status: "nok", + Version: bee.Version, + APIVersion: api.Version, })) }) } diff --git a/pkg/api/logger_test.go b/pkg/api/logger_test.go index b8420b79067..4a3349f6681 100644 --- a/pkg/api/logger_test.go +++ b/pkg/api/logger_test.go @@ -72,7 +72,7 @@ func TestGetLoggers(t *testing.T) { t.Fatalf("unexpected error: %v", err) } - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) jsonhttptest.Request(t, client, http.MethodGet, "/loggers", http.StatusOK, jsonhttptest.WithUnmarshalJSONResponse(&have), ) @@ -88,7 +88,7 @@ func TestSetLoggerVerbosity(t *testing.T) { api.ReplaceLogSetVerbosityByExp(fn) }(api.LogSetVerbosityByExp) - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) type data struct { exp string @@ -143,7 +143,7 @@ func TestSetLoggerVerbosity(t *testing.T) { func Test_loggerGetHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -192,7 +192,7 @@ func Test_loggerGetHandler_invalidInputs(t *testing.T) { func Test_loggerSetVerbosityHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string diff --git a/pkg/api/p2p_test.go b/pkg/api/p2p_test.go index 5cf9de6124c..933596afff7 100644 --- a/pkg/api/p2p_test.go +++ b/pkg/api/p2p_test.go @@ -40,7 +40,6 @@ func TestAddresses(t *testing.T) { ethereumAddress := common.HexToAddress("abcd") testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PublicKey: privateKey.PublicKey, PSSPublicKey: pssPrivateKey.PublicKey, Overlay: overlay, @@ -79,7 +78,6 @@ func TestAddresses_error(t *testing.T) { testErr := errors.New("test error") testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithAddressesFunc(func() ([]multiaddr.Multiaddr, error) { return nil, testErr })), diff --git a/pkg/api/peer_test.go b/pkg/api/peer_test.go index 0697a6277d2..fdda7b8edf4 100644 --- a/pkg/api/peer_test.go +++ b/pkg/api/peer_test.go @@ -51,7 +51,6 @@ func TestConnect(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithConnectFunc(func(ctx context.Context, addr ma.Multiaddr) (*bzz.Address, error) { if addr.String() == errorUnderlay { return nil, testErr @@ -82,7 +81,6 @@ func TestConnect(t *testing.T) { t.Run("error - add peer", func(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithConnectFunc(func(ctx context.Context, addr ma.Multiaddr) (*bzz.Address, error) { if addr.String() == errorUnderlay { return nil, testErr @@ -109,7 +107,6 @@ func TestDisconnect(t *testing.T) { testErr := errors.New("test error") testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithDisconnectFunc(func(addr swarm.Address, reason string) error { if reason != "user requested disconnect" { return testErr @@ -166,7 +163,6 @@ func TestPeer(t *testing.T) { overlay := swarm.MustParseHexAddress("ca1e9f3938cc1425c6061b96ad9eb93e134dfe8734ad490164ef20af9d1cf59c") testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithPeersFunc(func() []p2p.Peer { return []p2p.Peer{{Address: overlay}} })), @@ -188,7 +184,6 @@ func TestBlocklistedPeers(t *testing.T) { overlay := swarm.MustParseHexAddress("ca1e9f3938cc1425c6061b96ad9eb93e134dfe8734ad490164ef20af9d1cf59c") testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithBlocklistedPeersFunc(func() ([]p2p.BlockListedPeer, error) { return []p2p.BlockListedPeer{{Peer: p2p.Peer{Address: overlay}}}, nil })), @@ -206,7 +201,6 @@ func TestBlocklistedPeersErr(t *testing.T) { overlay := swarm.MustParseHexAddress("ca1e9f3938cc1425c6061b96ad9eb93e134dfe8734ad490164ef20af9d1cf59c") testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithBlocklistedPeersFunc(func() ([]p2p.BlockListedPeer, error) { return []p2p.BlockListedPeer{{Peer: p2p.Peer{Address: overlay}}}, errors.New("some error") })), @@ -224,7 +218,7 @@ func TestBlocklistedPeersErr(t *testing.T) { func Test_peerConnectHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -260,7 +254,7 @@ func Test_peerConnectHandler_invalidInputs(t *testing.T) { func Test_peerDisconnectHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string diff --git a/pkg/api/pingpong_test.go b/pkg/api/pingpong_test.go index 4dffae5b0e6..9de99103619 100644 --- a/pkg/api/pingpong_test.go +++ b/pkg/api/pingpong_test.go @@ -39,7 +39,6 @@ func TestPingpong(t *testing.T) { }) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, Pingpong: pingpongService, }) @@ -79,7 +78,7 @@ func TestPingpong(t *testing.T) { func Test_pingpongHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string diff --git a/pkg/api/postage_test.go b/pkg/api/postage_test.go index ebf808c1c7a..13e3dda13d6 100644 --- a/pkg/api/postage_test.go +++ b/pkg/api/postage_test.go @@ -65,7 +65,6 @@ func TestPostageCreateStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -90,7 +89,6 @@ func TestPostageCreateStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -111,7 +109,6 @@ func TestPostageCreateStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -132,7 +129,6 @@ func TestPostageCreateStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -161,7 +157,6 @@ func TestPostageCreateStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -182,7 +177,6 @@ func TestPostageCreateStamp(t *testing.T) { t.Parallel() ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SyncStatus: func() (bool, error) { return false, nil }, }) @@ -197,7 +191,6 @@ func TestPostageCreateStamp(t *testing.T) { t.Parallel() ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SyncStatus: func() (bool, error) { return true, errors.New("oops") }, }) @@ -223,7 +216,7 @@ func TestPostageGetStamps(t *testing.T) { t.Parallel() bs := mock.New(mock.WithChainState(cs), mock.WithBatch(b)) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bs, BlockTime: 2 * time.Second}) + ts, _, _, _ := newTestServer(t, testServerOptions{Post: mp, BatchStore: bs, BlockTime: 2 * time.Second}) jsonhttptest.Request(t, ts, http.MethodGet, "/stamps", http.StatusOK, jsonhttptest.WithExpectedJSONResponse(&api.PostageStampsResponse{ @@ -259,7 +252,7 @@ func TestPostageGetStamps(t *testing.T) { } ecs := &postage.ChainState{Block: 10, TotalAmount: big.NewInt(15), CurrentPrice: big.NewInt(12)} ebs := mock.New(mock.WithChainState(ecs)) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: emp, BatchStore: ebs, BlockTime: 2 * time.Second}) + ts, _, _, _ := newTestServer(t, testServerOptions{Post: emp, BatchStore: ebs, BlockTime: 2 * time.Second}) jsonhttptest.Request(t, ts, http.MethodGet, "/stamps/"+hex.EncodeToString(eb.ID), http.StatusNotFound, jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{ @@ -281,7 +274,7 @@ func TestGetAllBatches(t *testing.T) { mp := mockpost.New(mockpost.WithIssuer(si)) cs := &postage.ChainState{Block: 10, TotalAmount: big.NewInt(5), CurrentPrice: big.NewInt(2)} bs := mock.New(mock.WithChainState(cs), mock.WithBatch(b)) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bs, BlockTime: 2 * time.Second}) + ts, _, _, _ := newTestServer(t, testServerOptions{Post: mp, BatchStore: bs, BlockTime: 2 * time.Second}) oneBatch := struct { Batches []api.PostageBatchResponse `json:"batches"` @@ -318,7 +311,7 @@ func TestPostageGetStamp(t *testing.T) { mp := mockpost.New(mockpost.WithIssuer(si)) cs := &postage.ChainState{Block: 10, TotalAmount: big.NewInt(5), CurrentPrice: big.NewInt(2)} bs := mock.New(mock.WithChainState(cs), mock.WithBatch(b)) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bs, BlockTime: 2 * time.Second}) + ts, _, _, _ := newTestServer(t, testServerOptions{Post: mp, BatchStore: bs, BlockTime: 2 * time.Second}) t.Run("ok", func(t *testing.T) { t.Parallel() @@ -346,7 +339,7 @@ func TestPostageGetBuckets(t *testing.T) { si := postage.NewStampIssuer("", "", batchOk, big.NewInt(3), 11, 10, 1000, true) mp := mockpost.New(mockpost.WithIssuer(si)) - ts, _, _, _ := newTestServer(t, testServerOptions{Post: mp, DebugAPI: true}) + ts, _, _, _ := newTestServer(t, testServerOptions{Post: mp}) buckets := make([]api.BucketData, 1024) for i := range buckets { buckets[i] = api.BucketData{BucketID: uint32(i)} @@ -369,7 +362,7 @@ func TestPostageGetBuckets(t *testing.T) { t.Parallel() mpNotFound := mockpost.New() - tsNotFound, _, _, _ := newTestServer(t, testServerOptions{Post: mpNotFound, DebugAPI: true}) + tsNotFound, _, _, _ := newTestServer(t, testServerOptions{Post: mpNotFound}) jsonhttptest.Request(t, tsNotFound, http.MethodGet, "/stamps/"+batchOkStr+"/buckets", http.StatusNotFound) }) @@ -383,7 +376,6 @@ func TestReserveState(t *testing.T) { t.Parallel() ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, BatchStore: mock.New(mock.WithRadius(5)), Storer: mockstorer.New(), }) @@ -397,7 +389,6 @@ func TestReserveState(t *testing.T) { t.Parallel() ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, BatchStore: mock.New(), Storer: mockstorer.New(), }) @@ -418,7 +409,6 @@ func TestChainState(t *testing.T) { CurrentPrice: big.NewInt(5), } ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, BatchStore: mock.New(mock.WithChainState(cs)), BackendOpts: []backendmock.Option{backendmock.WithBlockNumberFunc(func(ctx context.Context) (uint64, error) { return 1, nil @@ -460,7 +450,6 @@ func TestPostageTopUpStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -490,7 +479,6 @@ func TestPostageTopUpStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -512,7 +500,6 @@ func TestPostageTopUpStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -533,7 +520,6 @@ func TestPostageTopUpStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -557,7 +543,6 @@ func TestPostageTopUpStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -595,7 +580,6 @@ func TestPostageDiluteStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -625,7 +609,6 @@ func TestPostageDiluteStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -647,7 +630,6 @@ func TestPostageDiluteStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -668,7 +650,6 @@ func TestPostageDiluteStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -692,7 +673,6 @@ func TestPostageDiluteStamp(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -812,7 +792,6 @@ func TestPostageAccessHandler(t *testing.T) { ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, PostageContract: contract, }) @@ -837,7 +816,7 @@ func TestPostageAccessHandler(t *testing.T) { func Test_postageCreateHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -887,7 +866,7 @@ func Test_postageCreateHandler_invalidInputs(t *testing.T) { func Test_postageGetStampBucketsHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -949,7 +928,7 @@ func Test_postageGetStampBucketsHandler_invalidInputs(t *testing.T) { func Test_postageGetStampHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -1012,7 +991,7 @@ func Test_postageGetStampHandler_invalidInputs(t *testing.T) { func Test_postageTopUpHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -1091,7 +1070,7 @@ func Test_postageTopUpHandler_invalidInputs(t *testing.T) { func Test_postageDiluteHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string diff --git a/pkg/api/redistribution_test.go b/pkg/api/redistribution_test.go index 88bf00abe51..07b4bc28cfe 100644 --- a/pkg/api/redistribution_test.go +++ b/pkg/api/redistribution_test.go @@ -36,7 +36,6 @@ func TestRedistributionStatus(t *testing.T) { t.Errorf("redistribution put state: %v", err) } srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, StateStorer: store, TransactionOpts: []mock.Option{ mock.WithTransactionFeeFunc(func(ctx context.Context, txHash common.Hash) (*big.Int, error) { @@ -61,7 +60,6 @@ func TestRedistributionStatus(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, BeeMode: api.LightMode, StateStorer: statestore.NewStateStore(), TransactionOpts: []mock.Option{ diff --git a/pkg/api/router.go b/pkg/api/router.go index 0396dd2b2de..aaa75725b09 100644 --- a/pkg/api/router.go +++ b/pkg/api/router.go @@ -34,7 +34,7 @@ func (s *Service) MountTechnicalDebug() { s.mountTechnicalDebug() s.Handler = web.ChainHandlers( - httpaccess.NewHTTPAccessLogHandler(s.logger, s.tracer, "debug api access"), + httpaccess.NewHTTPAccessLogHandler(s.logger, s.tracer, "api access"), handlers.CompressHandler, s.corsHandler, web.NoCacheHeadersHandler, @@ -46,7 +46,7 @@ func (s *Service) MountDebug() { s.mountBusinessDebug() s.Handler = web.ChainHandlers( - httpaccess.NewHTTPAccessLogHandler(s.logger, s.tracer, "debug api access"), + httpaccess.NewHTTPAccessLogHandler(s.logger, s.tracer, "api access"), handlers.CompressHandler, s.corsHandler, web.NoCacheHeadersHandler, @@ -370,7 +370,6 @@ func (s *Service) mountAPI() { func (s *Service) mountBusinessDebug() { handle := func(path string, handler http.Handler) { - s.logger.Warning(fmt.Sprintf("DEPRECATION NOTICE: %s endpoint is now part of the main Bee API. The Debug API will be removed in the next release, version [2.2.0]. Update your integrations to use the main Bee API to avoid service disruptions.", path)) if s.Restricted { handler = web.ChainHandlers(auth.PermissionCheckHandler(s.auth), web.FinalHandler(handler)) } @@ -413,9 +412,9 @@ func (s *Service) mountBusinessDebug() { "DELETE": http.HandlerFunc(s.peerDisconnectHandler), }) - handle("/chunks/{address}", jsonhttp.MethodHandler{ - "GET": http.HandlerFunc(s.hasChunkHandler), - }) + //handle("/chunks/{address}", jsonhttp.MethodHandler{ + // "GET": http.HandlerFunc(s.hasChunkHandler), + //}) handle("/topology", jsonhttp.MethodHandler{ "GET": http.HandlerFunc(s.topologyHandler), diff --git a/pkg/api/settlements_test.go b/pkg/api/settlements_test.go index 86f2e2e42e1..f76997e1b8c 100644 --- a/pkg/api/settlements_test.go +++ b/pkg/api/settlements_test.go @@ -39,7 +39,6 @@ func TestSettlements(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []mock.Option{mock.WithSettlementsSentFunc(settlementsSentFunc), mock.WithSettlementsRecvFunc(settlementsRecvFunc)}, }) @@ -90,7 +89,6 @@ func TestSettlementsError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []mock.Option{mock.WithSettlementsSentFunc(settlementsSentFunc)}, }) @@ -110,7 +108,6 @@ func TestSettlementsPeers(t *testing.T) { return big.NewInt(1000000000000000000), nil } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []mock.Option{mock.WithSettlementSentFunc(settlementSentFunc)}, }) @@ -138,7 +135,6 @@ func TestSettlementsPeersNoSettlements(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []mock.Option{ mock.WithSettlementSentFunc(errFunc), mock.WithSettlementRecvFunc(noErrFunc), @@ -158,7 +154,6 @@ func TestSettlementsPeersNoSettlements(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []mock.Option{ mock.WithSettlementSentFunc(noErrFunc), mock.WithSettlementRecvFunc(errFunc), @@ -178,7 +173,7 @@ func TestSettlementsPeersNoSettlements(t *testing.T) { func Test_peerSettlementsHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -233,7 +228,6 @@ func TestSettlementsPeersError(t *testing.T) { return nil, wantErr } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, SwapOpts: []mock.Option{mock.WithSettlementSentFunc(settlementSentFunc)}, }) diff --git a/pkg/api/staking_test.go b/pkg/api/staking_test.go index e6f4d0b2296..0d6dac27587 100644 --- a/pkg/api/staking_test.go +++ b/pkg/api/staking_test.go @@ -39,7 +39,7 @@ func TestDepositStake(t *testing.T) { return txHash, nil }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodPost, depositStake(minStake), http.StatusOK) }) @@ -52,7 +52,7 @@ func TestDepositStake(t *testing.T) { return common.Hash{}, staking.ErrInsufficientStakeAmount }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodPost, depositStake(invalidMinStake), http.StatusBadRequest, jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{Code: http.StatusBadRequest, Message: "insufficient stake amount"})) }) @@ -65,7 +65,7 @@ func TestDepositStake(t *testing.T) { return common.Hash{}, staking.ErrInsufficientFunds }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodPost, depositStake(minStake), http.StatusBadRequest) jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{Code: http.StatusBadRequest, Message: "out of funds"}) }) @@ -78,7 +78,7 @@ func TestDepositStake(t *testing.T) { return common.Hash{}, fmt.Errorf("some error") }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodPost, depositStake(minStake), http.StatusInternalServerError) jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{Code: http.StatusInternalServerError, Message: "cannot stake"}) }) @@ -96,7 +96,6 @@ func TestDepositStake(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, StakingContract: contract, }) @@ -117,7 +116,7 @@ func TestGetStake(t *testing.T) { return big.NewInt(1), nil }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodGet, "/stake", http.StatusOK, jsonhttptest.WithExpectedJSONResponse(&api.GetStakeResponse{StakedAmount: bigint.Wrap(big.NewInt(1))})) }) @@ -130,7 +129,7 @@ func TestGetStake(t *testing.T) { return big.NewInt(0), fmt.Errorf("get stake failed") }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contractWithError}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contractWithError}) jsonhttptest.Request(t, ts, http.MethodGet, "/stake", http.StatusInternalServerError, jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{Code: http.StatusInternalServerError, Message: "get staked amount failed"})) }) @@ -139,7 +138,7 @@ func TestGetStake(t *testing.T) { func Test_stakingDepositHandler_invalidInputs(t *testing.T) { t.Parallel() - client, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + client, _, _, _ := newTestServer(t, testServerOptions{}) tests := []struct { name string @@ -185,7 +184,7 @@ func TestWithdrawAllStake(t *testing.T) { return txHash, nil }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodDelete, "/stake", http.StatusOK, jsonhttptest.WithExpectedJSONResponse( &api.WithdrawAllStakeResponse{TxHash: txHash.String()})) }) @@ -198,7 +197,7 @@ func TestWithdrawAllStake(t *testing.T) { return common.Hash{}, staking.ErrInsufficientStake }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodDelete, "/stake", http.StatusBadRequest, jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{Code: http.StatusBadRequest, Message: "insufficient stake to withdraw"})) }) @@ -211,7 +210,7 @@ func TestWithdrawAllStake(t *testing.T) { return common.Hash{}, fmt.Errorf("some error") }), ) - ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, StakingContract: contract}) + ts, _, _, _ := newTestServer(t, testServerOptions{StakingContract: contract}) jsonhttptest.Request(t, ts, http.MethodDelete, "/stake", http.StatusInternalServerError) jsonhttptest.WithExpectedJSONResponse(&jsonhttp.StatusResponse{Code: http.StatusInternalServerError, Message: "cannot withdraw stake"}) }) @@ -229,7 +228,6 @@ func TestWithdrawAllStake(t *testing.T) { }), ) ts, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, StakingContract: contract, }) diff --git a/pkg/api/status_test.go b/pkg/api/status_test.go index cc2c568abf4..8dadff7484c 100644 --- a/pkg/api/status_test.go +++ b/pkg/api/status_test.go @@ -58,7 +58,6 @@ func TestGetStatus(t *testing.T) { client, _, _, _ := newTestServer(t, testServerOptions{ BeeMode: mode, - DebugAPI: true, NodeStatus: statusSvc, }) @@ -71,8 +70,7 @@ func TestGetStatus(t *testing.T) { t.Parallel() client, _, _, _ := newTestServer(t, testServerOptions{ - BeeMode: api.DevMode, - DebugAPI: true, + BeeMode: api.DevMode, NodeStatus: status.NewService( log.Noop, nil, diff --git a/pkg/api/topology_test.go b/pkg/api/topology_test.go index ebd22532f3b..11dd6703791 100644 --- a/pkg/api/topology_test.go +++ b/pkg/api/topology_test.go @@ -14,7 +14,7 @@ import ( func TestTopologyOK(t *testing.T) { t.Parallel() - testServer, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + testServer, _, _, _ := newTestServer(t, testServerOptions{}) var body []byte opts := jsonhttptest.WithPutResponseBody(&body) diff --git a/pkg/api/transaction_test.go b/pkg/api/transaction_test.go index 46e066c4091..c23cc9cf3f5 100644 --- a/pkg/api/transaction_test.go +++ b/pkg/api/transaction_test.go @@ -42,7 +42,6 @@ func TestTransactionStoredTransaction(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithStoredTransactionFunc(func(txHash common.Hash) (*transaction.StoredTransaction, error) { return &transaction.StoredTransaction{ @@ -84,7 +83,6 @@ func TestTransactionStoredTransaction(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithStoredTransactionFunc(func(txHash common.Hash) (*transaction.StoredTransaction, error) { return nil, transaction.ErrUnknownTransaction @@ -103,7 +101,6 @@ func TestTransactionStoredTransaction(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithStoredTransactionFunc(func(txHash common.Hash) (*transaction.StoredTransaction, error) { return nil, errors.New("err") @@ -155,7 +152,6 @@ func TestTransactionList(t *testing.T) { } testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithPendingTransactionsFunc(func() ([]common.Hash, error) { return []common.Hash{txHash1, txHash2}, nil @@ -210,7 +206,6 @@ func TestTransactionListError(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithPendingTransactionsFunc(func() ([]common.Hash, error) { return nil, errors.New("err") @@ -233,7 +228,6 @@ func TestTransactionListError(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithPendingTransactionsFunc(func() ([]common.Hash, error) { return []common.Hash{txHash1}, nil @@ -261,7 +255,6 @@ func TestTransactionResend(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithResendTransactionFunc(func(ctx context.Context, txHash common.Hash) error { return nil @@ -280,7 +273,6 @@ func TestTransactionResend(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithResendTransactionFunc(func(ctx context.Context, txHash common.Hash) error { return transaction.ErrUnknownTransaction @@ -300,7 +292,6 @@ func TestTransactionResend(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithResendTransactionFunc(func(ctx context.Context, txHash common.Hash) error { return transaction.ErrAlreadyImported @@ -320,7 +311,6 @@ func TestTransactionResend(t *testing.T) { t.Parallel() testServer, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, TransactionOpts: []mock.Option{ mock.WithResendTransactionFunc(func(ctx context.Context, txHash common.Hash) error { return errors.New("err") diff --git a/pkg/api/version.go b/pkg/api/version.go index b9bf36154c4..44086d8bc47 100644 --- a/pkg/api/version.go +++ b/pkg/api/version.go @@ -6,4 +6,3 @@ package api // Version is set in the build process. var Version = "0.0.0" -var DebugVersion = "0.0.0" diff --git a/pkg/api/wallet_test.go b/pkg/api/wallet_test.go index c6f7449d51a..d5c09efaeeb 100644 --- a/pkg/api/wallet_test.go +++ b/pkg/api/wallet_test.go @@ -28,7 +28,6 @@ func TestWallet(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, Erc20Opts: []erc20mock.Option{ erc20mock.WithBalanceOfFunc(func(ctx context.Context, address common.Address) (*big.Int, error) { return big.NewInt(10000000000000000), nil @@ -54,7 +53,6 @@ func TestWallet(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, BackendOpts: []backendmock.Option{ backendmock.WithBalanceAt(func(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error) { return new(big.Int), nil @@ -73,7 +71,6 @@ func TestWallet(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, Erc20Opts: []erc20mock.Option{ erc20mock.WithBalanceOfFunc(func(ctx context.Context, address common.Address) (*big.Int, error) { return new(big.Int), nil @@ -95,7 +92,7 @@ func TestWalletWithdraw(t *testing.T) { t.Run("address not whitelisted", func(t *testing.T) { t.Parallel() - srv, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + srv, _, _, _ := newTestServer(t, testServerOptions{}) jsonhttptest.Request(t, srv, http.MethodPost, "/wallet/withdraw/BZZ?address=0xaf&amount=99999999", http.StatusBadRequest, jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{ @@ -107,7 +104,7 @@ func TestWalletWithdraw(t *testing.T) { t.Run("invalid coin type", func(t *testing.T) { t.Parallel() - srv, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true}) + srv, _, _, _ := newTestServer(t, testServerOptions{}) jsonhttptest.Request(t, srv, http.MethodPost, "/wallet/withdraw/BTC?address=0xaf&amount=99999999", http.StatusBadRequest, jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{ @@ -120,7 +117,6 @@ func TestWalletWithdraw(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", }) @@ -135,7 +131,6 @@ func TestWalletWithdraw(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", Erc20Opts: []erc20mock.Option{ erc20mock.WithBalanceOfFunc(func(ctx context.Context, address common.Address) (*big.Int, error) { @@ -155,7 +150,6 @@ func TestWalletWithdraw(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", Erc20Opts: []erc20mock.Option{ erc20mock.WithBalanceOfFunc(func(ctx context.Context, address common.Address) (*big.Int, error) { @@ -177,7 +171,6 @@ func TestWalletWithdraw(t *testing.T) { txHash := common.HexToHash("0x00f") srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", Erc20Opts: []erc20mock.Option{ erc20mock.WithBalanceOfFunc(func(ctx context.Context, address common.Address) (*big.Int, error) { @@ -205,7 +198,6 @@ func TestWalletWithdraw(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", }) @@ -220,7 +212,6 @@ func TestWalletWithdraw(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", BackendOpts: []backendmock.Option{ backendmock.WithBalanceAt(func(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error) { @@ -240,7 +231,6 @@ func TestWalletWithdraw(t *testing.T) { t.Parallel() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", BackendOpts: []backendmock.Option{ backendmock.WithBalanceAt(func(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error) { @@ -262,7 +252,6 @@ func TestWalletWithdraw(t *testing.T) { txHash := common.HexToHash("0x00f") srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, WhitelistedAddr: "0xaf", BackendOpts: []backendmock.Option{ backendmock.WithBalanceAt(func(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error) { diff --git a/pkg/api/welcome_message_test.go b/pkg/api/welcome_message_test.go index 39d7c19a039..6eb6670e8ab 100644 --- a/pkg/api/welcome_message_test.go +++ b/pkg/api/welcome_message_test.go @@ -23,7 +23,6 @@ func TestGetWelcomeMessage(t *testing.T) { const DefaultTestWelcomeMessage = "Hello World!" srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithGetWelcomeMessageFunc(func() string { return DefaultTestWelcomeMessage }))}) @@ -75,8 +74,7 @@ func TestSetWelcomeMessage(t *testing.T) { mockP2P := mock.New() srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, - P2P: mockP2P, + P2P: mockP2P, }) if tC.wantMessage == "" { @@ -112,7 +110,6 @@ func TestSetWelcomeMessageInternalServerError(t *testing.T) { testURL := "/welcome-message" srv, _, _, _ := newTestServer(t, testServerOptions{ - DebugAPI: true, P2P: mock.New(mock.WithSetWelcomeMessageFunc(func(string) error { return testError })), diff --git a/pkg/node/devnode.go b/pkg/node/devnode.go index 1b090654295..2c64f990591 100644 --- a/pkg/node/devnode.go +++ b/pkg/node/devnode.go @@ -68,13 +68,11 @@ type DevBee struct { pssCloser io.Closer errorLogWriter io.Writer apiServer *http.Server - debugAPIServer *http.Server } type DevOptions struct { Logger log.Logger APIAddr string - DebugAPIAddr string CORSAllowedOrigins []string DBOpenFilesLimit uint64 ReserveCapacity uint64 @@ -194,37 +192,6 @@ func NewDevBee(logger log.Logger, o *DevOptions) (b *DevBee, err error) { } }(probe) - var debugApiService *api.Service - - if o.DebugAPIAddr != "" { - debugAPIListener, err := net.Listen("tcp", o.DebugAPIAddr) - if err != nil { - return nil, fmt.Errorf("debug api listener: %w", err) - } - - debugApiService = api.New(mockKey.PublicKey, mockKey.PublicKey, overlayEthAddress, nil, logger, mockTransaction, batchStore, api.DevMode, true, true, chainBackend, o.CORSAllowedOrigins, inmemstore.New()) - debugAPIServer := &http.Server{ - IdleTimeout: 30 * time.Second, - ReadHeaderTimeout: 3 * time.Second, - Handler: debugApiService, - ErrorLog: stdlog.New(b.errorLogWriter, "", 0), - } - - debugApiService.MountTechnicalDebug() - debugApiService.SetProbe(probe) - - go func() { - logger.Info("starting debug api server", "address", debugAPIListener.Addr()) - - if err := debugAPIServer.Serve(debugAPIListener); err != nil && !errors.Is(err, http.ErrServerClosed) { - logger.Debug("debug api server failed to start", "error", err) - logger.Error(nil, "debug api server failed to start") - } - }() - - b.debugAPIServer = debugAPIServer - } - localStore, err := storer.New(context.Background(), "", &storer.Options{ Logger: logger, CacheCapacity: 1_000_000, @@ -406,24 +373,12 @@ func NewDevBee(logger log.Logger, o *DevOptions) (b *DevBee, err error) { Restricted: o.Restricted, }, debugOpts, 1, erc20) apiService.MountTechnicalDebug() + apiService.MountDebug() apiService.MountAPI() - apiService.SetProbe(probe) + apiService.SetProbe(probe) apiService.SetP2P(p2ps) apiService.SetSwarmAddress(&swarmAddress) - apiService.MountDebug() - - if o.DebugAPIAddr != "" { - debugApiService.SetP2P(p2ps) - debugApiService.SetSwarmAddress(&swarmAddress) - debugApiService.MountDebug() - - debugApiService.Configure(signer, authenticator, tracer, api.Options{ - CORSAllowedOrigins: o.CORSAllowedOrigins, - WsPingPeriod: 60 * time.Second, - Restricted: o.Restricted, - }, debugOpts, 1, erc20) - } apiListener, err := net.Listen("tcp", o.APIAddr) if err != nil { @@ -477,15 +432,6 @@ func (b *DevBee) Shutdown() error { return nil }) } - if b.debugAPIServer != nil { - eg.Go(func() error { - if err := b.debugAPIServer.Shutdown(ctx); err != nil { - return fmt.Errorf("debug api server: %w", err) - } - return nil - }) - } - if err := eg.Wait(); err != nil { mErr = multierror.Append(mErr, err) } diff --git a/pkg/node/node.go b/pkg/node/node.go index fa3f3f861b5..f50574cdecc 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -89,7 +89,6 @@ type Bee struct { ctxCancel context.CancelFunc apiCloser io.Closer apiServer *http.Server - debugAPIServer *http.Server resolverCloser io.Closer errorLogWriter io.Writer tracerCloser io.Closer @@ -127,7 +126,6 @@ type Options struct { DBBlockCacheCapacity uint64 DBDisableSeeksCompaction bool APIAddr string - DebugAPIAddr string Addr string NATAddr string EnableWS bool @@ -379,7 +377,6 @@ func NewBee( logger.Info("starting with restricted APIs") } - // set up basic debug api endpoints for debugging and /health endpoint beeNodeMode := api.LightMode if o.FullNodeMode { beeNodeMode = api.FullMode @@ -405,59 +402,6 @@ func NewBee( b.stamperStoreCloser = stamperStore var apiService *api.Service - var debugService *api.Service - - if o.DebugAPIAddr != "" { - if o.MutexProfile { - _ = runtime.SetMutexProfileFraction(1) - } - - if o.BlockProfile { - runtime.SetBlockProfileRate(1) - } - - debugAPIListener, err := net.Listen("tcp", o.DebugAPIAddr) - if err != nil { - return nil, fmt.Errorf("debug api listener: %w", err) - } - - debugService = api.New( - *publicKey, - pssPrivateKey.PublicKey, - overlayEthAddress, - o.WhitelistedWithdrawalAddress, - logger, - transactionService, - batchStore, - beeNodeMode, - o.ChequebookEnable, - o.SwapEnable, - chainBackend, - o.CORSAllowedOrigins, - stamperStore, - ) - debugService.Restricted = o.Restricted - debugService.MountTechnicalDebug() - debugService.SetProbe(probe) - - debugAPIServer := &http.Server{ - IdleTimeout: 30 * time.Second, - ReadHeaderTimeout: 3 * time.Second, - Handler: debugService, - ErrorLog: stdlog.New(b.errorLogWriter, "", 0), - } - - go func() { - logger.Info("starting debug server", "address", debugAPIListener.Addr()) - - if err := debugAPIServer.Serve(debugAPIListener); err != nil && !errors.Is(err, http.ErrServerClosed) { - logger.Debug("debug api server failed to start", "error", err) - logger.Error(nil, "debug api server failed to start") - } - }() - - b.debugAPIServer = debugAPIServer - } if o.APIAddr != "" { if o.MutexProfile { @@ -635,9 +579,7 @@ func NewBee( var registry *promc.Registry - if debugService != nil { - registry = debugService.MetricsRegistry() - } else if apiService != nil { + if apiService != nil { registry = apiService.MetricsRegistry() } @@ -1153,73 +1095,13 @@ func NewBee( Restricted: o.Restricted, }, extraOpts, chainID, erc20Service) - apiService.MountAPI() apiService.MountDebug() + apiService.MountAPI() apiService.SetSwarmAddress(&swarmAddress) apiService.SetRedistributionAgent(agent) } - if o.DebugAPIAddr != "" { - // register metrics from components - debugService.MustRegisterMetrics(p2ps.Metrics()...) - debugService.MustRegisterMetrics(pingPong.Metrics()...) - debugService.MustRegisterMetrics(acc.Metrics()...) - debugService.MustRegisterMetrics(localStore.Metrics()...) - debugService.MustRegisterMetrics(kad.Metrics()...) - debugService.MustRegisterMetrics(saludService.Metrics()...) - debugService.MustRegisterMetrics(stateStoreMetrics.Metrics()...) - - if pullerService != nil { - debugService.MustRegisterMetrics(pullerService.Metrics()...) - } - - if agent != nil { - debugService.MustRegisterMetrics(agent.Metrics()...) - } - - debugService.MustRegisterMetrics(pushSyncProtocol.Metrics()...) - debugService.MustRegisterMetrics(pusherService.Metrics()...) - debugService.MustRegisterMetrics(pullSyncProtocol.Metrics()...) - debugService.MustRegisterMetrics(retrieval.Metrics()...) - debugService.MustRegisterMetrics(lightNodes.Metrics()...) - debugService.MustRegisterMetrics(hive.Metrics()...) - - if bs, ok := batchStore.(metrics.Collector); ok { - debugService.MustRegisterMetrics(bs.Metrics()...) - } - if ls, ok := eventListener.(metrics.Collector); ok { - debugService.MustRegisterMetrics(ls.Metrics()...) - } - if pssServiceMetrics, ok := pssService.(metrics.Collector); ok { - debugService.MustRegisterMetrics(pssServiceMetrics.Metrics()...) - } - if swapBackendMetrics, ok := chainBackend.(metrics.Collector); ok { - debugService.MustRegisterMetrics(swapBackendMetrics.Metrics()...) - } - if apiService != nil { - debugService.MustRegisterMetrics(apiService.Metrics()...) - } - if l, ok := logger.(metrics.Collector); ok { - debugService.MustRegisterMetrics(l.Metrics()...) - } - debugService.MustRegisterMetrics(pseudosettleService.Metrics()...) - if swapService != nil { - debugService.MustRegisterMetrics(swapService.Metrics()...) - } - - debugService.Configure(signer, authenticator, tracer, api.Options{ - CORSAllowedOrigins: o.CORSAllowedOrigins, - WsPingPeriod: 60 * time.Second, - Restricted: o.Restricted, - }, extraOpts, chainID, erc20Service) - - debugService.SetP2P(p2ps) - debugService.SetSwarmAddress(&swarmAddress) - debugService.MountDebug() - debugService.SetRedistributionAgent(agent) - } - if err := kad.Start(ctx); err != nil { return nil, err } @@ -1283,15 +1165,6 @@ func (b *Bee) Shutdown() error { return nil }) } - if b.debugAPIServer != nil { - eg.Go(func() error { - if err := b.debugAPIServer.Shutdown(ctx); err != nil { - return fmt.Errorf("debug api server: %w", err) - } - return nil - }) - } - if err := eg.Wait(); err != nil { mErr = multierror.Append(mErr, err) } diff --git a/pkg/topology/kademlia/doc.go b/pkg/topology/kademlia/doc.go index 39fb7c25624..2407d289535 100644 --- a/pkg/topology/kademlia/doc.go +++ b/pkg/topology/kademlia/doc.go @@ -10,7 +10,7 @@ A thorough explanation of the logic in the `manage()` forever loop: The `manageC` channel gets triggered every time there's a change in the information regarding peers we know about. This can be a result of: (1) A peer has disconnected from us (2) A peer has been added to the list of -known peers (from discovery, debugapi, bootnode flag or just because it +known peers (from discovery, api, bootnode flag or just because it was persisted in the address book and the node has been restarted). So the information has been changed, and potentially upon disconnection,