Skip to content

Commit b7f1c3f

Browse files
committed
fix: restrict reference scripts to the ones that are actual in use. fix caribic stop command and prevent updating the example env
1 parent 0716f2c commit b7f1c3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+207
-512
lines changed

cardano/gateway/src/app.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { MithrilModule } from './shared/modules/mithril/mithril.module';
1212

1313
@Module({
1414
imports: [
15-
// IBCEventWatcherModule,
16-
// ScheduleModule.forRoot(),
1715
TypeOrmModule.forRoot(DatabaseConfig),
1816
ConfigModule.forRoot({
1917
load: [

cardano/gateway/src/config/constant.config.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,72 @@
1-
import { ConnectionConfig as IOgmiosClientConfig } from '@cardano-ogmios/client';
2-
import deploymentConfig, { IDeploymentConfig } from './valiator.config';
3-
import { connectionConfig } from './kupmios.config';
41
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
52

6-
export interface IConfig {
7-
deployment: IDeploymentConfig;
8-
ogmiosClientConfig: IOgmiosClientConfig;
3+
type DeploymentConfig = {
4+
validators: {
5+
spendHandler: {
6+
title: string;
7+
script: string;
8+
scriptHash: string;
9+
address: string;
10+
};
11+
spendClient: {
12+
title: string;
13+
script: string;
14+
scriptHash: string;
15+
address: string;
16+
};
17+
mintHandlerValidator: {
18+
title: string;
19+
script: string;
20+
scriptHash: string;
21+
address: string;
22+
};
23+
mintClient: {
24+
title: string;
25+
script: string;
26+
scriptHash: string;
27+
address: string;
28+
};
29+
mintConnection: {
30+
title: string;
31+
script: string;
32+
scriptHash: string;
33+
address: string;
34+
};
35+
spendConnection: {
36+
title: string;
37+
script: string;
38+
scriptHash: string;
39+
address: string;
40+
};
41+
mintChannel: {
42+
title: string;
43+
script: string;
44+
scriptHash: string;
45+
address: string;
46+
};
47+
spendChannel: {
48+
title: string;
49+
script: string;
50+
scriptHash: string;
51+
address: string;
52+
};
53+
};
54+
nonceUtxo: {
55+
txHash: string;
56+
outputIndex: number;
57+
};
58+
handlerAuthToken: {
59+
policyId: string;
60+
name: string;
61+
};
62+
};
63+
64+
interface Config {
65+
deployment: DeploymentConfig;
966
ogmiosEndpoint: string;
1067
kupoEndpoint: string;
1168
database: PostgresConnectionOptions;
12-
cardanoBridgeUrl: string;
69+
1370
cardanoChainHost: string;
1471
cardanoChainPort: number;
1572
cardanoChainNetworkMagic: number;
@@ -19,16 +76,15 @@ export interface IConfig {
1976
mtithrilGenesisVerificationKey: string;
2077
}
2178

22-
export default (): Partial<IConfig> => ({
23-
deployment: deploymentConfig(),
24-
ogmiosClientConfig: connectionConfig,
79+
export default (): Partial<Config> => ({
2580
ogmiosEndpoint: process.env.OGMIOS_ENDPOINT,
2681
kupoEndpoint: process.env.KUPO_ENDPOINT,
27-
cardanoBridgeUrl: process.env.CARDANO_BRIDGE_URL,
82+
2883
cardanoChainHost: process.env.CARDANO_CHAIN_HOST,
2984
cardanoChainPort: Number(process.env.CARDANO_CHAIN_PORT || 3001),
3085
cardanoChainNetworkMagic: Number(process.env.CARDANO_CHAIN_NETWORK_MAGIC || 42),
3186
cardanoEpochNonceGenesis: process.env.CARDANO_EPOCH_NONCE_GENESIS,
87+
3288
mithrilEndpoint: process.env.MITHRIL_ENDPOINT,
3389
mtithrilGenesisVerificationKey: process.env.MITHRIL_GENESIS_VERIFICATION_KEY,
3490
});

cardano/gateway/src/config/kupmios.config.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

cardano/gateway/src/config/valiator.config.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

cardano/gateway/src/query/services/db-sync.service.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -360,18 +360,4 @@ export class DbSyncService {
360360
}
361361
return results.length > 0 ? results[0].block_no : 0;
362362
}
363-
364-
// async queryListBlockByImmutableFileNo(immutableFileNo: number): Promise<number[]> {
365-
// const query = "SELECT DISTINCT block_number as block_no FROM cardano_tx WHERE immutable_file_number=?;";
366-
// const blocks = await this.secondConnection.query(query, [immutableFileNo]);
367-
368-
// return blocks.map((block) => block.block_no);
369-
// }
370-
371-
// async queryListImmutableFileNoByBlockNos(blockNos: number[]): Promise<number[]> {
372-
// const query = `SELECT DISTINCT immutable_file_number FROM cardano_tx WHERE block_number IN (${blockNos.map(() => `?`).join(",")});`;
373-
// const files = await this.secondConnection.query(query, blockNos);
374-
375-
// return files.map((file) => file.immutable_file_number);
376-
// }
377363
}

cardano/gateway/src/query/services/query.service.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
QueryNewClientRequest,
1313
QueryNewClientResponse,
1414
} from '@plus/proto-types/build/ibc/core/client/v1/query';
15-
import { BlockData, ClientState, ConsensusState } from '@plus/proto-types/build/ibc/lightclients/ouroboros/ouroboros';
15+
import { BlockData } from '@plus/proto-types/build/ibc/lightclients/ouroboros/ouroboros';
1616
import {
1717
ClientState as ClientStateTendermint,
1818
ConsensusState as ConsensusStateTendermint,
@@ -22,15 +22,8 @@ import {
2222
ConsensusState as ConsensusStateMithril,
2323
MithrilHeader,
2424
} from '@plus/proto-types/build/ibc/lightclients/mithril/mithril';
25-
import {
26-
InteractionContext,
27-
WebSocketCloseHandler,
28-
WebSocketErrorHandler,
29-
createInteractionContext,
30-
} from '@cardano-ogmios/client';
31-
import { LedgerStateQueryClient, createLedgerStateQueryClient } from '@cardano-ogmios/client/dist/LedgerStateQuery';
25+
3226
import { BlockDto } from '../dtos/block.dto';
33-
import { connectionConfig } from '@config/kupmios.config';
3427
import { Any } from '@plus/proto-types/build/google/protobuf/any';
3528
import { LucidService } from '@shared/modules/lucid/lucid.service';
3629
import { ConfigService } from '@nestjs/config';
@@ -90,10 +83,8 @@ import { bytesFromBase64 } from '@plus/proto-types/build/helpers';
9083
import { getIdByTokenName } from '@shared/helpers/helper';
9184
import { decodeMintChannelRedeemer, decodeSpendChannelRedeemer } from '../../shared/types/channel/channel-redeemer';
9285
import {
93-
MintConnectionRedeemer,
9486
decodeMintConnectionRedeemer,
9587
decodeSpendConnectionRedeemer,
96-
encodeMintConnectionRedeemer,
9788
} from '../../shared/types/connection/connection-redeemer';
9889
import { decodeIBCModuleRedeemer } from '../../shared/types/port/ibc_module_redeemer';
9990
import { Packet } from '@shared/types/channel/packet';
@@ -107,12 +98,6 @@ import {
10798
normalizeMithrilStakeDistribution,
10899
normalizeMithrilStakeDistributionCertificate,
109100
} from '../../shared/helpers/mithril-header';
110-
import { convertString2Hex } from '../../shared/helpers/hex';
111-
import {
112-
blockHeight as queryBlockHeight,
113-
genesisConfiguration,
114-
systemStart as querySystemStart,
115-
} from '../../shared/helpers/ogmios';
116101

117102
@Injectable()
118103
export class QueryService {

cardano/gateway/src/shared/helpers/block-results.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { convertHeaderToTendermint } from '../types/header';
2727
import { Header } from '@plus/proto-types/build/ibc/lightclients/tendermint/v1/tendermint';
2828
import { Any } from '@plus/proto-types/build/google/protobuf/any';
2929

30-
export function normalizeEventConnection(evtType: ConnectionState): string {
30+
function normalizeEventConnection(evtType: ConnectionState): string {
3131
switch (evtType) {
3232
case ConnectionState.Init:
3333
return EVENT_TYPE_CONNECTION.OPEN_INIT;
@@ -76,7 +76,7 @@ export function normalizeTxsResultFromConnDatum(connDatum: ConnectionDatum, conn
7676
} as unknown as ResponseDeliverTx;
7777
}
7878

79-
export function normalizeEventChannel(evtType: ChannelState): string {
79+
function normalizeEventChannel(evtType: ChannelState): string {
8080
switch (evtType) {
8181
case ChannelState.Init:
8282
return EVENT_TYPE_CHANNEL.OPEN_INIT;

cardano/gateway/src/shared/helpers/channel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { KEY_CHANNEL_END_PREFIX, KEY_CHANNEL_PREFIX, KEY_PORT_PREFIX } from '../../constant';
22
import { AuthToken } from '../types/auth-token';
3-
import { convertString2Hex, hashSha3_256, hexToBytes } from './hex';
3+
import { hashSha3_256, hexToBytes } from './hex';
44

55
export function getChannelIdByTokenName(tokenName: string, baseToken: AuthToken, prefix: string): string {
66
const baseTokenPart = hashSha3_256(baseToken.policyId + baseToken.name).slice(0, 40);

cardano/gateway/src/shared/helpers/commitment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import crypto from 'crypto';
22
import { Packet } from '../types/channel/packet';
3-
import { convertHex2String, fromHex, hashSHA256, toHex } from './hex';
3+
import { fromHex, hashSHA256, toHex } from './hex';
44

55
// CommitPacket calculates the packet commitment bytes
66
export function commitPacket(packet: Packet): string {

0 commit comments

Comments
 (0)