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 <k.christopoulos@rocketfueldev.com>
  • Loading branch information
kchrist-rocketfueldev committed Oct 30, 2023
1 parent 589e250 commit 1735455
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN yarn run build:binaries
# This build takes the production build from staging build

FROM node:slim AS runtime
ENV GRPC_URL=runtime:50051
WORKDIR /usr/src/app
COPY --from=appbuild /usr/src/app/common/docker/out/kyve* ./
CMD ["./kyve-linux-x64"]
2 changes: 1 addition & 1 deletion common/docker/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
type IConfig = string;

export default class Docker implements IRuntime {
private static readonly GRPC_URL = 'localhost:50051';
private static readonly GRPC_URL = process.env.GRPC_URL || 'localhost:50051';

private grpcClient: RuntimeClient;

Expand Down
11 changes: 5 additions & 6 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,20 +265,22 @@ 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 });
Expand Down

0 comments on commit 1735455

Please sign in to comment.