diff --git a/.github/workflows/rosetta.yml b/.github/workflows/rosetta.yml deleted file mode 100644 index 0338cf72fc..0000000000 --- a/.github/workflows/rosetta.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Rosetta -# Rosetta runs rosetta-cli to verify that provenance still meets the Rosetta api -on: - pull_request: - push: - branches: - - main - -# Set concurrency for this workflow to cancel in-progress jobs if retriggered. -# The github.ref is only available when triggered by a PR so fall back to github.run_id for other cases. -# The github.run_id is unique for each run, giving each such invocation it's own unique concurrency group. -# Basically, if you push to a PR branch, jobs that are still running for that PR will be cancelled. -# But jobs started because of a merge to main or a release tag push are not cancelled. -concurrency: - group: ${{ github.workflow }}-${{ github.ref || github.run_id }} - cancel-in-progress: true - -jobs: - rosetta: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - uses: technote-space/get-diff-action@v6.1.2 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - client/rosetta/** - .github/workflows/rosetta.yml - - uses: actions/setup-go@v5 - if: ${{ env.GIT_DIFF }} - with: - go-version: '1.21' - - name: Go mod vendor - if: ${{ env.GIT_DIFF }} - run: | - go mod vendor - - name: rosetta - if: ${{ env.GIT_DIFF }} - run: make test-rosetta diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c4612a2b8..a0cc8c1792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * The `provenanced query account` command has been removed. It is still available as `provenanced query auth account` [#1971](https://github.com/provenance-io/provenance/pull/1971). * Move the genesis-related commands into a new `genesis` sub-command, and remove the `genesis-` parts of their names [#1971](https://github.com/provenance-io/provenance/pull/1971). * Many of the SDK's query commands have had their usage altered [#1971](https://github.com/provenance-io/provenance/pull/1971). +* Rosetta has been removed from the `provenanced` executable [#1981](https://github.com/provenance-io/provenance/pull/1981). + It is now a stand-alone service. See: for more info. ### Deprecated diff --git a/Makefile b/Makefile index 40d798e1d6..018b7bdde5 100644 --- a/Makefile +++ b/Makefile @@ -537,11 +537,6 @@ update-swagger-docs: statik proto-swagger-gen .PHONY: update-swagger-docs -test-rosetta: - docker build -t rosetta-ci:latest -f client/rosetta/rosetta-ci/Dockerfile . - docker-compose -f client/rosetta/docker-compose.yaml --project-directory ./ up --abort-on-container-exit --exit-code-from test_rosetta --build -.PHONY: test-rosetta - ############################## ### Relayer ############################## diff --git a/client/rosetta/README.md b/client/rosetta/README.md deleted file mode 100644 index 7bba8ebdf5..0000000000 --- a/client/rosetta/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# rosetta - -This directory contains the files required to run the rosetta CI. It builds `provenanced` based on the current codebase. - -## docker-compose.yaml - -Builds: - -- provenanced, setup using the testnode configuration just like localnet -- faucet is required so we can test the construction API by transfering funds through send_funds.sh -- rosetta is the rosetta node used by rosetta-cli to interact with the cosmos-sdk app -- test_rosetta in the Makefile runs the rosetta-cli test against construction API and data API - -## configuration - -Contains the required files to set up rosetta cli and make it work against its workflows. - -## rosetta-cli - -Contains the files for a deterministic network, with fixed keys and some actions on there, to test parsing of msgs and historical balances. - -## Notes - -- Keyring password is 12345678 -- This implementation is a modification from cosmos-sdk: https://github.com/cosmos/cosmos-sdk/tree/master/contrib/rosetta diff --git a/client/rosetta/configuration/bootstrap.json b/client/rosetta/configuration/bootstrap.json deleted file mode 100644 index 22ec9a13e8..0000000000 --- a/client/rosetta/configuration/bootstrap.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "account_identifier": { - "address":"pb1kezmr2chzy7w00nhh7qxhpqphdwum3j0jxxcrn" - }, - "currency":{ - "symbol":"nhash", - "decimals":0 - }, - "value": "999990000000" - } -] \ No newline at end of file diff --git a/client/rosetta/configuration/faucet.py b/client/rosetta/configuration/faucet.py deleted file mode 100644 index 0c9473e074..0000000000 --- a/client/rosetta/configuration/faucet.py +++ /dev/null @@ -1,24 +0,0 @@ -from http.server import HTTPServer, BaseHTTPRequestHandler -import subprocess - -import os - - -class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): - - def do_POST(self): - try: - content_len = int(self.headers.get('Content-Length')) - addr = self.rfile.read(content_len).decode("utf-8") - subprocess.call(['sh', './send_funds.sh', addr]) - self.send_response(200) - self.end_headers() - except Exception as e: - print("failed " + str(e)) - os._exit(1) - - -if __name__ == "__main__": - print("starting faucet server...") - httpd = HTTPServer(('0.0.0.0', 8000), SimpleHTTPRequestHandler) - httpd.serve_forever() diff --git a/client/rosetta/configuration/rosetta.json b/client/rosetta/configuration/rosetta.json deleted file mode 100644 index 7403c79a20..0000000000 --- a/client/rosetta/configuration/rosetta.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "network": { - "blockchain": "provenance", - "network": "testing" - }, - "online_url": "http://rosetta:8080", - "data_directory": "", - "http_timeout": 300, - "max_retries": 5, - "retry_elapsed_time": 0, - "max_online_connections": 0, - "max_sync_concurrency": 0, - "tip_delay": 60, - "log_configuration": true, - "construction": { - "offline_url": "http://rosetta:8080", - "max_offline_connections": 0, - "stale_depth": 0, - "broadcast_limit": 0, - "ignore_broadcast_failures": false, - "clear_broadcasts": false, - "broadcast_behind_tip": false, - "block_broadcast_limit": 0, - "rebroadcast_all": false, - "constructor_dsl_file": "transfer.ros", - "end_conditions": { - "create_account": 1, - "transfer": 1 - } - }, - "data": { - "active_reconciliation_concurrency": 0, - "inactive_reconciliation_concurrency": 0, - "inactive_reconciliation_frequency": 0, - "log_blocks": false, - "log_transactions": false, - "log_balance_changes": false, - "log_reconciliations": false, - "ignore_reconciliation_error": false, - "exempt_accounts": "", - "bootstrap_balances": "bootstrap.json", - "interesting_accounts": "", - "reconciliation_disabled": false, - "inactive_discrepency_search_disabled": false, - "balance_tracking_disabled": false, - "coin_tracking_disabled": false, - "end_conditions": { - "tip": true - } - } -} \ No newline at end of file diff --git a/client/rosetta/configuration/run_tests.sh b/client/rosetta/configuration/run_tests.sh deleted file mode 100755 index d7cceea4e2..0000000000 --- a/client/rosetta/configuration/run_tests.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -set -e - -wait_for_rosetta() { - timeout 120 sh -c 'until nc -z $0 $1; do sleep 1; done' rosetta 8080 -} - -sleep 30 -echo "waiting for rosetta instance to be up" -wait_for_rosetta - -echo "checking data API" -rosetta-cli check:data --configuration-file ./config/rosetta.json - -echo "checking construction API" -rosetta-cli check:construction --configuration-file ./config/rosetta.json - diff --git a/client/rosetta/configuration/send_funds.sh b/client/rosetta/configuration/send_funds.sh deleted file mode 100644 index 62cfa6c4b4..0000000000 --- a/client/rosetta/configuration/send_funds.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -set -e -addr=$(provenanced -t keys show node0 -a --keyring-backend=test --home=/testrosetta/node0) -echo "12345678" | provenanced -t tx bank send "$addr" "$1" 100000000000nhash --chain-id="chain-local" --node tcp://provenance:26657 --yes --keyring-backend=test --home=/testrosetta/node0 --gas-prices="1905nhash" --gas=auto --gas-adjustment=1.5 diff --git a/client/rosetta/configuration/transfer.ros b/client/rosetta/configuration/transfer.ros deleted file mode 100644 index a79fd231f5..0000000000 --- a/client/rosetta/configuration/transfer.ros +++ /dev/null @@ -1,105 +0,0 @@ -request_funds(1){ - find_account{ - currency = {"symbol":"nhash", "decimals":0}; - random_account = find_balance({ - "minimum_balance":{ - "value": "0", - "currency": {{currency}} - }, - "create_limit":1 - }); - }, - send_funds{ - account_identifier = {{random_account.account_identifier}}; - address = {{account_identifier.address}}; - idk = http_request({ - "method": "POST", - "url": "http:\/\/faucet:8000", - "timeout": 10, - "body": {{random_account.account_identifier.address}} - }); - }, - // Create a separate scenario to request funds so that - // the address we are using to request funds does not - // get rolled back if funds do not yet exist. - request{ - loaded_account = find_balance({ - "account_identifier": {{random_account.account_identifier}}, - "minimum_balance":{ - "value": "50", - "currency": {{currency}} - } - }); - } -} -create_account(1){ - create{ - network = {"network":"testing", "blockchain":"provenance"}; - key = generate_key({"curve_type": "secp256k1"}); - account = derive({ - "network_identifier": {{network}}, - "public_key": {{key.public_key}} - }); - // If the account is not saved, the key will be lost! - save_account({ - "account_identifier": {{account.account_identifier}}, - "keypair": {{key}} - }); - } -} -transfer(3){ - transfer{ - transfer.network = {"network":"testing", "blockchain":"provenance"}; - currency = {"symbol":"nhash", "decimals":0}; - sender = find_balance({ - "minimum_balance":{ - "value": "100000000000", - "currency": {{currency}} - } - }); - acc_identifier = {{sender.account_identifier}}; - sender_address = {{acc_identifier.address}}; - // Set the recipient_amount as some value <= sender.balance-max_fee - max_fee = "1000"; - fee_amount = "1"; - fee_value = 0 - {{fee_amount}}; - available_amount = {{sender.balance.value}} - {{max_fee}}; - recipient_amount = random_number({"minimum": "1", "maximum": {{available_amount}}}); - print_message({"recipient_amount":{{recipient_amount}}}); - // Find recipient and construct operations - sender_amount = 0 - {{recipient_amount}}; - recipient = find_balance({ - "not_account_identifier":[{{sender.account_identifier}}], - "minimum_balance":{ - "value": "0", - "currency": {{currency}} - }, - "create_limit": 100, - "create_probability": 50 - }); - transfer.confirmation_depth = "1"; - recipient_account_identifier = {{recipient.account_identifier}}; - recipient_address = {{recipient_account_identifier.address}}; - transfer.operations = [ - { - "operation_identifier":{"index":0}, - "type":"/cosmos.bank.v1beta1.MsgSend", - "account":{{sender.account_identifier}}, - "metadata": { - "amount": [ - { - "amount": {{recipient_amount}}, - "denom": {{currency.symbol}} - } - ], - "from_address": {{sender_address}}, - "to_address": {{recipient_address}} - } - } - ]; - transfer.preprocess_metadata = { - "gas_price": "476250000nhash", - "gas_limit": 250000 - }; - } -} diff --git a/client/rosetta/docker-compose.yaml b/client/rosetta/docker-compose.yaml deleted file mode 100644 index 1e3f0e5638..0000000000 --- a/client/rosetta/docker-compose.yaml +++ /dev/null @@ -1,59 +0,0 @@ -version: "3" - -services: - provenance: - container_name: provenance - image: rosetta-ci:latest - command: [ - "provenanced", - "-t", - "--home", "/testrosetta/node0", - "start", - "--pruning", "nothing", - "--rpc.laddr", "tcp://0.0.0.0:26657", - "--minimum-gas-prices", "0.0025nhash", - ] - ports: - - 9090:9090 - - 26656-26657:26656-26657 - - 1317:1317 - logging: - driver: "none" - - rosetta: - container_name: rosetta - image: rosetta-ci:latest - command: [ - "provenanced", - "rosetta", - "-t", - "--blockchain", "provenance", - "--network", "testing", - "--tendermint", "provenance:26657", - "--grpc", "provenance:9090", - "--addr", ":8080", - "--testnet", "true", - "--home", "/testrosetta/node0", - ] - ports: - - 8080:8080 - depends_on: - - provenance - - faucet: - image: rosetta-ci:latest - working_dir: /rosetta - command: ["python3","-u", "faucet.py"] - expose: - - 8080 - depends_on: - - rosetta - - test_rosetta: - image: tendermintdev/rosetta-cli:v0.6.7 - volumes: - - ./client/rosetta/configuration:/rosetta/config:z - command: ["./config/run_tests.sh"] - working_dir: /rosetta - depends_on: - - rosetta \ No newline at end of file diff --git a/client/rosetta/rosetta-ci/Dockerfile b/client/rosetta/rosetta-ci/Dockerfile deleted file mode 100644 index e40e98ed87..0000000000 --- a/client/rosetta/rosetta-ci/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -FROM golang:1.21-bullseye as build -ARG VERSION - -WORKDIR /go/src/github.com/provenance-io/provenance -ENV GOPRIVATE=github.com/provenance-io -RUN apt-get update && apt-get upgrade -y - -COPY client/ ./client/ -COPY app/ ./app/ -COPY go.* ./ -COPY cmd/ ./cmd/ -COPY internal/ ./internal/ -COPY x/ ./x/ -COPY vendor/ ./vendor/ - -# Build the binaries -RUN go build -mod vendor \ - -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/version.Name=Provenance-Blockchain' \ - -o /go/bin/ ./cmd/... -RUN echo "Completed go build" - -RUN echo "Initializing provenance" - -# Initialize provenance to run with the default node configuration -WORKDIR /testrosetta -RUN provenanced testnet -t --v 1 -o . --starting-ip-address=0.0.0.0 --keyring-backend=test --chain-id=chain-local - -### -FROM debian:bullseye-slim -ENV LOCALNET=1 - -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y curl jq && \ - apt-get clean && \ - apt-get install -y python3 && \ - rm -rf /var/lib/apt/lists/ - -# Source binaries from the build above -COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.x86_64.so /lib/x86_64-linux-gnu/libwasmvm.x86_64.so -COPY --from=build /go/bin/provenanced /usr/bin/provenanced -COPY --from=build /testrosetta /testrosetta - -WORKDIR /rosetta -COPY ./client/rosetta/configuration ./ -RUN chmod +x run_tests.sh -RUN chmod +x send_funds.sh -RUN chmod +x faucet.py - -RUN chmod -R 0777 ./ - -ENV PATH=$PATH:/bin -ENV PIO_HOME="/provenance/testrosetta" diff --git a/cmd/provenanced/cmd/root.go b/cmd/provenanced/cmd/root.go index 9f829bb840..d60b872a03 100644 --- a/cmd/provenanced/cmd/root.go +++ b/cmd/provenanced/cmd/root.go @@ -201,8 +201,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, b keys.Commands(), ) - // Add Rosetta command - // rootCmd.AddCommand(rosettacmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) // TODO[1760]: rosetta // Disable usage when the start command returns an error. startCmd, _, err := rootCmd.Find([]string{"start"}) if err != nil { diff --git a/go.mod b/go.mod index fccf0896bb..099f567db3 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.2.1 - // github.com/cosmos/rosetta v0.50.2 // TODO[1760]: rosetta github.com/ghodss/yaml v1.0.0 github.com/golang/protobuf v1.5.4 github.com/google/uuid v1.6.0