diff --git a/Dockerfile b/Dockerfile index 120ddf35..8559d078 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM node:lts AS appbuild WORKDIR /usr/src/app COPY . . -RUN yarn docker-setup +RUN yarn build:docker RUN cd ./common/docker RUN yarn run build:binaries @@ -12,6 +12,7 @@ RUN yarn run build:binaries # This build takes the production build from staging build FROM node:slim AS runtime +ENV RUNTIME_SERVER_ADDR=runtime:50051 WORKDIR /usr/src/app COPY --from=appbuild /usr/src/app/common/docker/out/kyve* ./ CMD ["./kyve-linux-x64"] diff --git a/common/docker/src/runtime.ts b/common/docker/src/runtime.ts index c5bd5756..c67a3329 100644 --- a/common/docker/src/runtime.ts +++ b/common/docker/src/runtime.ts @@ -17,7 +17,7 @@ import { type IConfig = string; export default class Docker implements IRuntime { - private static readonly GRPC_URL = 'localhost:50051'; + private static readonly RUNTIME_SERVER_ADDR = process.env.RUNTIME_SERVER_ADDR || 'localhost:50051'; private grpcClient: RuntimeClient; @@ -25,7 +25,7 @@ export default class Docker implements IRuntime { constructor() { this.grpcClient = new RuntimeClient( - Docker.GRPC_URL, + Docker.RUNTIME_SERVER_ADDR, grpc.credentials.createInsecure() ); } diff --git a/docker-integrations/tendermint/src/server.ts b/docker-integrations/tendermint/src/server.ts index d1938f3a..828df545 100644 --- a/docker-integrations/tendermint/src/server.ts +++ b/docker-integrations/tendermint/src/server.ts @@ -1,4 +1,3 @@ - import * as grpc from '@grpc/grpc-js'; import axios from 'axios'; @@ -80,7 +79,6 @@ export class TendermintServer { const block = blockResponse.data.result; - // Fetch block results from rpc at the given block height const blockResultsResponse = await axios.get( `${config.rpc}/block_results?height=${key}` @@ -88,7 +86,6 @@ export class TendermintServer { const blockResults = blockResultsResponse.data.result; - // Construct the Value message const value = { block: block, @@ -268,25 +265,27 @@ export class TendermintServer { }; if ( - JSON.stringify(proposedDataItem) === JSON.stringify(validationDataItem) + JSON.stringify(proposedDataItem) === JSON.stringify(validationDataItem) ) { callback(null, { vote: VOTE.VALID }); return; } // prevent nondeterministic misbehaviour due to osmosis-1 specific problems - if (validationDataItem.value.block.block.header.chain_id === "osmosis-1") { + if ( + validationDataItem.value.block.block.header.chain_id === 'osmosis-1' + ) { // remove nondeterministic begin_block_events to prevent incorrect invalid vote delete validationDataItem.value.block_results.begin_block_events; delete proposedDataItem.value.block_results.begin_block_events; if ( - JSON.stringify(proposedDataItem) === JSON.stringify(validationDataItem) + JSON.stringify(proposedDataItem) === + JSON.stringify(validationDataItem) ) { // vote abstain if begin_block_events are not equal callback(null, { vote: VOTE.ABSTAIN }); return; - } } diff --git a/package.json b/package.json index 368e80ec..08d514ab 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "scripts": { "setup": "lerna clean && yarn install && lerna run build", - "docker-setup": "yarn nx reset && yarn install && lerna run build", + "build:docker": "yarn nx reset && yarn install && lerna run build", "graph": "yarn nx graph", "build": "lerna run build", "build:binaries": "lerna run build:binaries --concurrency 1",