Skip to content

Commit

Permalink
Merge pull request #43 from sotatek-dev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Sotatek-TanHoang authored Sep 18, 2024
2 parents ede77ca + c82dfc0 commit 3923944
Show file tree
Hide file tree
Showing 18 changed files with 1,457 additions and 867 deletions.
11 changes: 11 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ services:
networks:
- myNetwork
user: node
validate-mina-signature-1:
image: mina-bridge:1.0.0
command: >
sh -c "npm run console validate-mina-bridge-unlock"
tty: true
restart: always
depends_on:
- postgres
networks:
- myNetwork
user: node
postgres:
container_name: mina-bridge-${NODE_ENV}-postgres
image: postgres:15.3-alpine3.18
Expand Down
4 changes: 3 additions & 1 deletion nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
"deleteOutDir": true,
"assets": ["src/modules/crawler/minaSc/*.js"],
"watchAssets": true
}
}
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
"ioredis": "^5.3.2",
"joi": "^17.11.0",
"log4js": "^6.9.1",
"mina-fungible-token": "0.1.0",
"mina-fungible-token": "1.0.0",
"mina-signer": "^2.1.1",
"nestjs-console": "^9.0.0",
"nestjs-typeorm-custom-repository": "^1.1.1",
"o1js": "0.18.0",
"o1js": "1.6.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"pg": "^8.11.3",
Expand Down
17 changes: 17 additions & 0 deletions src/database/repositories/multi-signature.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ import { MultiSignature } from '@modules/crawler/entities/multi-signature.entity
@EntityRepository(MultiSignature)
export class MultiSignatureRepository extends BaseRepository<MultiSignature> {
protected alias: ETableName = ETableName.MULTI_SIGNATURE;
public async upsertErrorAndRetryMultiSignature(validator: string, txId: number, errorCode: unknown) {
const validatorSignature = await this.findOne({
where: { txId, validator },
});
if (!validatorSignature) {
await this.save(
new MultiSignature({
txId,
validator,
retry: 1,
errorCode,
}),
);
} else {
await this.update({ txId, validator }, { retry: ++validatorSignature.retry, errorCode });
}
}
}
18 changes: 17 additions & 1 deletion src/modules/crawler/crawler.console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class CrawlerConsole {
command: 'validate-eth-bridge-unlock',
description: 'validate ETH Bridge unlock',
})
async handleValidateMinaLockTx() {
async handleValidateEthLockTx() {
try {
while (true) {
this.senderEVMBridge.unlockEVMTransaction();
Expand All @@ -60,6 +60,21 @@ export class CrawlerConsole {
}
}

@Command({
command: 'validate-mina-bridge-unlock',
description: 'validate MINA Bridge unlock',
})
async handleValidateMinaLockTx() {
try {
while (true) {
this.senderMinaBridge.handleValidateUnlockTxMina();
await sleep(15);
}
} catch (error) {
this.logger.error(error);
}
}

@Command({
command: 'sender-eth-bridge-unlock',
description: 'sender ETH Bridge unlock',
Expand All @@ -74,6 +89,7 @@ export class CrawlerConsole {
this.logger.error(error);
}
}


@Command({
command: 'crawl-mina-bridge-contract',
Expand Down
2 changes: 1 addition & 1 deletion src/modules/crawler/crawler.minabridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CrawlContract, EventLog } from '@modules/crawler/entities';

import { LoggerService } from '@shared/modules/logger/logger.service';

import { Bridge } from './minaSc/minaBridgeSC';
import { Bridge } from './minaSc/Bridge.js';

@Injectable()
export class SCBridgeMinaCrawler {
Expand Down
233 changes: 233 additions & 0 deletions src/modules/crawler/minaSc/Bridge.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3923944

Please sign in to comment.