Skip to content

Commit 5fd9d62

Browse files
committed
chore: remove debug logs. cleanup offchain code
1 parent c100818 commit 5fd9d62

File tree

7 files changed

+4
-167
lines changed

7 files changed

+4
-167
lines changed

cardano/gateway/src/shared/types/header.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ function verifyAdjacent(
478478
maxClockDrift: bigint,
479479
trustedLevel: Rational,
480480
): boolean {
481-
console.log('verifyAdjacent');
482481
if (untrustedHeader.header.height !== trustedHeader.header.height + 1n) {
483482
throw new GrpcInvalidArgumentException('headers must be adjacent in height');
484483
}

cardano/gateway/src/tx/channel.service.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ export class ChannelService {
9494
const signedChannelOpenInitTxCompleted = await (await unsignedChannelOpenInitTxValidTo.complete()).sign
9595
.withWallet()
9696
.complete();
97-
// unsignedChannelOpenInitTxCompleted.txComplete.to_js_value()
98-
// console.log('channelOpenInit: ', unsignedChannelOpenInitTxCompleted.txComplete.to_json());
97+
9998
this.logger.log(signedChannelOpenInitTxCompleted.toHash(), 'channel open init - unsignedTX - hash');
10099
const response: MsgChannelOpenInitResponse = {
101100
channel_id: channelId,
@@ -232,13 +231,6 @@ export class ChannelService {
232231
}
233232

234233
async channelCloseInit(data: MsgChannelCloseInit): Promise<MsgChannelCloseInitResponse> {
235-
console.log('dataMsgChannelCloseInit');
236-
console.dir(
237-
{
238-
...data,
239-
},
240-
{ depth: 10 },
241-
);
242234
try {
243235
this.logger.log('Channel Close Init is processing');
244236
const { constructedAddress, channelCloseInitOperator } = validateAndFormatChannelCloseInitParams(data);
@@ -546,8 +538,6 @@ export class ChannelService {
546538

547539
// Get the keys (heights) of the map and convert them into an array
548540
const heightsArray = Array.from(clientDatum.state.consensusStates.keys());
549-
console.log('heightsArray', heightsArray);
550-
console.log('clientDatum.state.consensusStates', clientDatum.state.consensusStates);
551541

552542
if (!isValidProofHeight(heightsArray, channelOpenAckOperator.proofHeight.revisionHeight)) {
553543
throw new GrpcInternalException(`Invalid proof height: ${channelOpenAckOperator.proofHeight.revisionHeight}`);
@@ -598,9 +588,6 @@ export class ChannelService {
598588
([key]) => key.revisionHeight === channelOpenAckOperator.proofHeight.revisionHeight,
599589
);
600590

601-
console.log('channelDatum.state.channel.ordering', channelDatum.state.channel.ordering);
602-
console.log('orderFromJSON', orderFromJSON(ORDER_MAPPING_CHANNEL[channelDatum.state.channel.ordering]));
603-
604591
const cardanoChannelEnd: CardanoChannel = {
605592
state: CardanoChannelState.STATE_TRYOPEN,
606593
ordering: orderFromJSON(ORDER_MAPPING_CHANNEL[channelDatum.state.channel.ordering]),

cardano/gateway/src/tx/helper/channel.validate.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ export function validateAndFormatChannelOpenInitParams(data: MsgChannelOpenInit)
4646
break;
4747
}
4848

49-
console.log('orderingChannel', orderingChannel);
50-
5149
const channelOpenInitOperator: ChannelOpenInitOperator = {
5250
//TODO: check in channel.connection_hops
5351
connectionId: data.channel.connection_hops[0],

cardano/offchain/src/deployment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import {
2020
getNonceOutRef,
2121
readValidator,
2222
DeploymentTemplate,
23+
submitTx
2324
} from "./utils.ts";
2425
import {
2526
EMULATOR_ENV,
2627
HANDLER_TOKEN_NAME,
2728
PORT_PREFIX,
2829
TRANSFER_MODULE_PORT,
2930
} from "./constants.ts";
30-
import { submitTx } from "./utils.ts";
3131
import { AuthToken, AuthTokenSchema, HandlerDatum, HandlerOperator, MintPortRedeemer, OutputReference, OutputReferenceSchema } from "../types/index.ts";
3232

3333
// deno-lint-ignore no-explicit-any

cardano/offchain/src/utils.ts

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ export const formatTimestamp = (timestampInMilliseconds: number): string => {
8585
return formattedDate;
8686
};
8787

88-
export type Signer = {
89-
sk: string;
90-
address: string;
91-
};
92-
9388
export const generateTokenName = async (
9489
baseToken: AuthToken,
9590
prefix: string,
@@ -175,152 +170,11 @@ export const querySystemStart = async (ogmiosUrl: string) => {
175170
return parsedSystemTime;
176171
};
177172

178-
export const delay = (duration: number) => {
179-
let elapsedSeconds = 1;
180-
181-
const logElapsedTime = () => {
182-
Deno.stdout.writeSync(
183-
new TextEncoder().encode(`\rElapsed time: ${elapsedSeconds}s`)
184-
);
185-
elapsedSeconds++;
186-
};
187-
188-
const intervalId = setInterval(logElapsedTime, 1000);
189-
190-
console.log(`Delay ${duration}s`);
191-
192-
return new Promise<void>((resolve) => {
193-
setTimeout(() => {
194-
clearInterval(intervalId);
195-
Deno.stdout.writeSync(
196-
new TextEncoder().encode(`\rElapsed time: ${elapsedSeconds}s`)
197-
);
198-
Deno.stdout.writeSync(new TextEncoder().encode(`\r`));
199-
resolve();
200-
}, duration * 1000);
201-
});
202-
};
203-
204-
export const parseClientSequence = (clientId: string): bigint => {
205-
const fragments = clientId.split("-");
206-
207-
if (fragments.length < 2) throw new Error("Invalid client id format");
208-
209-
if (!(fragments.slice(0, -1).join("") === "ibc_client")) {
210-
throw new Error("Invalid client id format");
211-
}
212-
213-
return BigInt(fragments.pop()!);
214-
};
215-
216-
export const parseConnectionSequence = (connectionId: string): bigint => {
217-
const fragments = connectionId.split("-");
218-
219-
if (fragments.length != 2) throw new Error("Invalid connection id format");
220-
221-
if (!(fragments.slice(0, -1).join("") === "connection")) {
222-
throw new Error("Invalid connection id format");
223-
}
224-
225-
return BigInt(fragments.pop()!);
226-
};
227-
export const parseChannelSequence = (channelId: string): bigint => {
228-
const fragments = channelId.split("-");
229-
230-
if (fragments.length != 2) throw new Error("Invalid channel id format");
231-
232-
if (!(fragments.slice(0, -1).join("") === "channel")) {
233-
throw new Error("Invalid channel id format");
234-
}
235-
236-
return BigInt(fragments.pop()!);
237-
};
238-
239-
export const createReferenceScriptUtxo = async (
240-
lucid: LucidEvolution,
241-
referredScript: Script
242-
) => {
243-
const [, , referenceAddress] = readValidator(
244-
"reference_validator.refer_only.else",
245-
lucid
246-
);
247-
248-
const tx = lucid.newTx().pay.ToContract(
249-
referenceAddress,
250-
{
251-
kind: 'inline',
252-
value: Data.void(),
253-
},
254-
{},
255-
referredScript,
256-
);
257-
const completedTx = await tx.complete();
258-
const signedTx = await completedTx.sign.withWallet().complete();
259-
const txHash = await signedTx.submit();
260-
261-
await lucid.awaitTx(txHash, 2000);
262-
263-
const referenceUtxo = (
264-
await lucid.utxosByOutRef([{ txHash, outputIndex: 0 }])
265-
)[0];
266-
267-
return referenceUtxo;
268-
};
269-
270173
export const generateIdentifierTokenName = (outRef: OutputReference) => {
271174
const serializedData = Data.to(outRef, OutputReference);
272175
return hashSha3_256(serializedData);
273176
};
274177

275-
export const insertSortMap = <K, V>(
276-
inputMap: Map<K, V>,
277-
newKey: K,
278-
newValue: V,
279-
keyComparator?: (a: K, b: K) => number
280-
): Map<K, V> => {
281-
// Convert the Map to an array of key-value pairs
282-
const entriesArray: [K, V][] = Array.from(inputMap.entries());
283-
284-
// Add the new key-value pair to the array
285-
entriesArray.push([newKey, newValue]);
286-
287-
// Sort the array based on the keys using the provided comparator function
288-
entriesArray.sort((entry1, entry2) =>
289-
keyComparator
290-
? keyComparator(entry1[0], entry2[0])
291-
: Number(entry1[0]) - Number(entry2[0])
292-
);
293-
294-
// Create a new Map from the sorted array
295-
const sortedMap = new Map<K, V>(entriesArray);
296-
297-
return sortedMap;
298-
};
299-
300-
export const deleteSortMap = <K, V>(
301-
sortedMap: Map<K, V>,
302-
keyToDelete: K,
303-
keyComparator?: (a: K, b: K) => number
304-
): Map<K, V> => {
305-
// Convert the sorted map to an array of key-value pairs
306-
const entriesArray: [K, V][] = Array.from(sortedMap.entries());
307-
308-
// Find the index of the key to delete
309-
const indexToDelete = entriesArray.findIndex(([key]) =>
310-
keyComparator ? keyComparator(key, keyToDelete) === 0 : key === keyToDelete
311-
);
312-
313-
// If the key is found, remove it from the array
314-
if (indexToDelete !== -1) {
315-
entriesArray.splice(indexToDelete, 1);
316-
}
317-
318-
// Create a new Map from the modified array
319-
const updatedMap = new Map<K, V>(entriesArray);
320-
321-
return updatedMap;
322-
};
323-
324178
export const getNonceOutRef = async (
325179
lucid: LucidEvolution
326180
): Promise<[UTxO, OutputReference]> => {

chains/cardano/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
]
3838

3939
cardano-node-ogmios:
40-
image: cardanosolutions/ogmios:v6.13.0
40+
image: cardanosolutions/ogmios:v6.10.0
4141
logging:
4242
driver: "json-file"
4343
options:
@@ -62,7 +62,7 @@ services:
6262
]
6363

6464
kupo:
65-
image: cardanosolutions/kupo:v2.11.0
65+
image: cardanosolutions/kupo:v2.9.0
6666
logging:
6767
driver: "json-file"
6868
options:

dapps/ibc-explorer/src/containers/TransactionDetail/Packets/PacketDisplay/PacketTransfer/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const PacketTransfer = ({
1919
const currentPacketData = packetsData?.[packetId];
2020
if (!currentPacketData) return <></>;
2121
const packetMsgs = packetDataMgs?.[packetId];
22-
// console.log(packetMsgs);
2322
const relayerChain1Address = packetMsgs?.AcknowledgePacket?.sender || '';
2423
const relayerChain2Address = packetMsgs?.RecvPacket?.sender || '';
2524
const sender = packetMsgs?.SendPacket?.sender;

0 commit comments

Comments
 (0)