Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

upgrade base blockscout version to 5.3.1-beta #19

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ POSTGRES_MAX_NUM_CONNECTIONS=200
# Used by the blockscout makefile targets
IMAGE_NAME=kava-blockscout
LOCAL_IMAGE_TAG=local
PRODUCTION_IMAGE_TAG=v5.1.5
PRODUCTION_IMAGE_TAG=v5.3.1

# Used by the blockscout docker file
BLOCKSCOUT_VERSION=v5.1.5
BLOCKSCOUT_DOCKER_VERSION=5.3.1

# Used by the blockscout docker compose service
BLOCKSCOUT_HOST_PORT=4000
Expand All @@ -38,14 +38,15 @@ PORT=4000
DATABASE_URL=postgres://blockscout_user:blockscout_password123@postgres:5432/blockscout_testing?ssl=false
ECTO_USE_SSL=false
SECRET_KEY_BASE=56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN
INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=true
ETHEREUM_JSONRPC_VARIANT=geth
ETHEREUM_JSONRPC_HTTP_URL=http://kava:8545
ETHEREUM_JSONRPC_TRACE_URL=http://kava:8545
# uncomment below to have blockscout index public testnet
# ETHEREUM_JSONRPC_HTTP_URL=https://evm.data-testnet.kava.io
# ETHEREUM_JSONRPC_WS_URL=wss://wevm.data-testnet.kava.io
# uncomment below to have blockscout index mainnet
# ETHEREUM_JSONRPC_HTTP_URL=https://evm.data.kava.io
# ETHEREUM_JSONRPC_HTTP_URL=https://evm.data.infra.kava.io
# ETHEREUM_JSONRPC_TRACE_URL=https://evm.data.infra.kava.io
# ETHEREUM_JSONRPC_WS_URL=wss://wevm.data.kava.io

NETWORK= "Kava Ethereum Co-Chain"
Expand All @@ -59,10 +60,17 @@ BLOCKSCOUT_VERSION=v5.1.5-kava
INDEXER_CATCHUP_BLOCKS_BATCH_SIZE=1
INDEXER_CATCHUP_BLOCKS_CONCURRENCY=1
INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY=1
INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=true
INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
INDEXER_BLOCK_REWARD_CONCURRENCY=1
INDEXER_RECEIPTS_CONCURRENCY=1
INDEXER_COIN_BALANCES_CONCURRENCY=1
INDEXER_CATCHUP_BLOCK_INTERVAL=5s
# The block number, where import of blocks by catchup fetcher begins from.
FIRST_BLOCK=0
DISABLE_REALTIME_INDEXER=false
# Uncomment below to have indexer start and stop
# at a certain block range for indexing blocks
# FIRST_BLOCK=7069475
# LAST_BLOCK=7069485
# Uncomment below to have indexer start and stop
# at a certain block range for indexing internal transactions
# TRACE_FIRST_BLOCK=7069475
# TRACE_LAST_BLOCK=7069485
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ artifacts
# data generated by execution of tool(s)
tools/*.bytecode
tools/*.address_hash

postgres-data/
37 changes: 20 additions & 17 deletions DEVELOPMENT.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ vendor-blockscout:
# build a development version docker image of the service
build:
cd blockscout && \
docker build ./ -f Dockerfile -t ${IMAGE_NAME}:${LOCAL_IMAGE_TAG}
docker build ./ -f Dockerfile -t ${IMAGE_NAME}:${LOCAL_IMAGE_TAG} --build-arg BLOCKSCOUT_VERSION=${BLOCKSCOUT_DOCKER_VERSION}

.PHONY: build-db-exporter
# build the exporter image
Expand Down Expand Up @@ -83,6 +83,8 @@ reset:
# wipe just the database state and restart just the database
.PHONY: reset-postgres
reset-postgres:
docker compose stop postgres && \
rm -rf postgres-data && \
docker compose up -d postgres --force-recreate --renew-anon-volumes

.PHONY: refresh
Expand Down
4 changes: 2 additions & 2 deletions blockscout/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Raw version representing v5.1.5-beta
ARG BLOCKSCOUT_VERSION=5.1.5
# Raw version representing v5.3.1-beta
ARG BLOCKSCOUT_VERSION=5.3.1

#
# The backend-builder uses the official exlixir docker image that contains
Expand Down
2 changes: 1 addition & 1 deletion blockscout/blockscout-base
Submodule blockscout-base updated 549 files
13 changes: 0 additions & 13 deletions blockscout/patches/0003-parse-database-url-password-period.patch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 374b4a6091..78bbdf3522 100644
#, elixir-autogen, elixir-format
msgid "Version"
-msgstr ""
+msgstr "v5.1.5-kava-bc38c81"
+msgstr "v5.3.1-kava-232b6090d7"

#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:33
#, elixir-autogen, elixir-format
35 changes: 35 additions & 0 deletions devdocs/UPGRADING_BASE_BLOCKSCOUT_VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# UPGRADING_BASE_BLOCKSCOUT_VERSION

## Building

Checkout a branch from the current version of this repo, then cd into the blockscout source code dir and checkout the tag you wish to update

```bash
cd $repo_dir
cd blockscout/blockscout-base/
git checkout v5.3.1-beta
```

Test custom kava patches locally will apply to avoid long dev cycles building production container

```bash
cd $repo_dir
cd blockscout/blockscout-base/
git apply ../patches/*.patch
```

if all patches apply with no error message, move on, else modify / delete / integrate patches with latest updated blockscout source code as needed

## Publishing Official Versions

Update values of `PRODUCTION_IMAGE_TAG`` and`BLOCKSCOUT_VERSION` in `.env` file

Open a PR

[Example PR](https://github.com/Kava-Labs/kava-blockscout-build/pull/19)

Once PR is approved, merge and new containers will be published

Deploy to production by updating [value for image tag](https://github.com/Kava-Labs/infrastructure/blob/master/terraform/product/production/us-east-1/blockscout-mainnet/service/terragrunt.hcl#L56) and running `terragrunt apply`

[Example Infra PR](https://github.com/Kava-Labs/infrastructure/pull/378)
4 changes: 4 additions & 0 deletions elixir_lib/kava_comsos_api_client/.formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
26 changes: 26 additions & 0 deletions elixir_lib/kava_comsos_api_client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
kava_comsos_api_client-*.tar

# Temporary files, for example, from tests.
/tmp/
17 changes: 17 additions & 0 deletions elixir_lib/kava_comsos_api_client/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
default: test

.PHONY: deps
deps:
mix deps.get

.PHONY: build
build: deps
mix compile

.PHONY: test
test: build
mix test

.PHONY: repl
repl: build
iex -S mix
64 changes: 64 additions & 0 deletions elixir_lib/kava_comsos_api_client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# KavaComsosApiClient

Provides a low level client for making a subset of requests to a Kava Network's Node Cosmos JSON-RPC API.

## Installation

The package can be installed
by adding `kava_comsos_api_client` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:kava_comsos_api_client, "~> 0.1.0", hex: :kavaCosmosApiClient}
]
end
```

## Publishing New Versions

1. [Create a hex user](https://hex.pm/docs/publish)
1. Build docs and publish package

```bash
mix local.hex --force
mix hex.publish
```

## Development

### Building

To compile the app / library for iterative development

```bash
make build
```

### Testing

To run all elixir tests

```bash
make test
```

### Iterative Development

To start a read-execute-print-loop shell with all source code compiled

```bash
# launch repl
make repl
# run code
iex> client = %KavaComsosApiClient{}
%KavaComsosApiClient{
endpoint_url: "https://rpc.data.kava.io",
read_timeout_seconds: 5,
max_retries: 3
}
#....modify code

#recompile source code for use in repl shell
iex> recompile()
```
22 changes: 22 additions & 0 deletions elixir_lib/kava_comsos_api_client/lib/cosmos_tx.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule CosmosGetTxResponse do
defstruct [
:hash,
:height,
:index,
:tx_result,
:tx
]
end

defmodule TxResult do
defstruct [
:code,
:data,
:log,
:info,
:gas_wanted,
:gas_used,
:events,
:codespace
]
end
Loading