Skip to content

Commit

Permalink
fix: get docker grpc target addr from env var
Browse files Browse the repository at this point in the history
Signed-off-by: Kostas Christopoulos <[email protected]>
  • Loading branch information
kchrist-rocketfueldev committed Oct 30, 2023
1 parent 589e250 commit ef0b4e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
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

# Build Stage 2
# 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"]
4 changes: 2 additions & 2 deletions common/docker/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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;

public config!: IConfig;

constructor() {
this.grpcClient = new RuntimeClient(
Docker.GRPC_URL,
Docker.RUNTIME_SERVER_ADDR,
grpc.credentials.createInsecure()
);
}
Expand Down
13 changes: 6 additions & 7 deletions docker-integrations/tendermint/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import * as grpc from '@grpc/grpc-js';
import axios from 'axios';

Expand Down Expand Up @@ -80,15 +79,13 @@ 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}`
);

const blockResults = blockResultsResponse.data.result;


// Construct the Value message
const value = {
block: block,
Expand Down Expand Up @@ -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;

}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ef0b4e4

Please sign in to comment.