Skip to content

Commit

Permalink
Merge pull request #15 from initia-labs/chore/spellcheck
Browse files Browse the repository at this point in the history
chore: add spellcheck
  • Loading branch information
ALPAC-4 authored Dec 5, 2024
2 parents 23bfaf5 + 4b3a024 commit ef23680
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .github/config/.codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cips
pullrequest
keypair
pastTime
hasTables
Nam
EyT
upTo
initia
minitia
expRes
28 changes: 28 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Spell Check

on:
pull_request:

jobs:
spellcheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Run codespell
continue-on-error: true
run: |
sudo apt-get install codespell -y
codespell -w --skip="*.json,*.mjs,*.git" --ignore-words=.github/config/.codespellignore
- uses: peter-evans/[email protected]
if: github.event_name != 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: fix typos"
title: "chore: fix typos"
branch: "chore/fix-typos"
delete-branch: true
body: |
This PR fixes typos in the codebase.
Please review it, and merge if everything is fine.
If there are proto changes, run `make proto-gen` and commit the changes.
10 changes: 5 additions & 5 deletions src/chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class Chain {
this.packetsToHandle = this.packetsToHandle.slice(packets.length)
}
} catch (e) {
this.error(`Fail to handle packet. resonse - ${e}`)
this.error(`Fail to handle packet. response - ${e}`)
} finally {
this.workers['packet_handler'] = new Date().valueOf()
await delay(1000)
Expand Down Expand Up @@ -255,7 +255,7 @@ export class Chain {
this.packetsToHandle.push(...results)
this.fedHeight = heights[heights.length - 1]
} catch (e) {
this.error(`Fail to fetch block result. resonse - ${e}`)
this.error(`Fail to fetch block result. response - ${e}`)
} finally {
this.workers['event_feeder'] = new Date().valueOf()
await delay(100)
Expand All @@ -266,13 +266,13 @@ export class Chain {
private async latestHeightWorker() {
// to prevent rerun
if (
(this.workers['latest_height_worekr'] ?? 0) >
(this.workers['latest_height_worker'] ?? 0) >
new Date().valueOf() - 5 * 60 * 1000
) {
return
}

this.debug('Activate latest height worekr')
this.debug('Activate latest height worker')

// TODO add websocket options
const MAX_RETRY = 10
Expand Down Expand Up @@ -308,7 +308,7 @@ export class Chain {
)
}
} finally {
this.workers['latest_height_worekr'] = new Date().valueOf()
this.workers['latest_height_worker'] = new Date().valueOf()
await delay(1000)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import express from 'express'
import { runPair } from './lib/chainPair'
import { config } from './lib/config'
import { ChainStatus } from './chain/types'
import { registery } from './lib/metric'
import { registry } from './lib/metric'
import { info } from './lib/logger'

async function main() {
Expand Down Expand Up @@ -33,8 +33,8 @@ async function main() {
const metricApp = express()

metricApp.get('/metrics', (req, res) => {
res.setHeader('content-type', registery.contentType)
registery
res.setHeader('content-type', registry.contentType)
registry
.metrics()
.then((response) => res.send(response))
.catch(() => res.status(500).send('Fail to get metrics'))
Expand Down
6 changes: 3 additions & 3 deletions src/lib/metric.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Registry, Counter, collectDefaultMetrics } from 'prom-client'

export const registery = new Registry()
export const registry = new Registry()

collectDefaultMetrics({ register: registery })
collectDefaultMetrics({ register: registry })

export const metrics = {
chain: createChainMetric(),
Expand Down Expand Up @@ -91,6 +91,6 @@ interface ChainMetric {
}

function register(metric: Counter): Counter {
registery.registerMetric(metric)
registry.registerMetric(metric)
return metric
}
2 changes: 1 addition & 1 deletion src/lib/transform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Height as CosmjsHeight } from 'cosmjs-types/ibc/core/client/v1/client'
import { Height as InitiajsHeight } from '@initia/initia.js'

export class Transfrom {
export class Transform {
static height(height: CosmjsHeight): InitiajsHeight
static height(height: InitiajsHeight): CosmjsHeight

Expand Down
4 changes: 2 additions & 2 deletions src/msgs/ack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ProofOps } from 'cosmjs-types/tendermint/crypto/proof'
import { CommitmentProof } from 'cosmjs-types/cosmos/ics23/v1/proofs'
import { MerkleProof } from 'cosmjs-types/ibc/core/commitment/v1/commitment'
import { Chain } from 'src/chain'
import { Transfrom } from 'src/lib/transform'
import { Transform } from 'src/lib/transform'
import { getRawProof } from 'src/lib/rawProof'

export async function generateMsgAck(
Expand All @@ -19,7 +19,7 @@ export async function generateMsgAck(
ack.packet,
ack.acknowledgement,
proof,
Transfrom.height(height),
Transform.height(height),
srcChain.wallet.address()
)

Expand Down
4 changes: 2 additions & 2 deletions src/msgs/recvPacet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Packet } from '@initia/initia.js'
import { MsgRecvPacket } from '@initia/initia.js/dist/core/ibc/core/channel/msgs'
import { Height } from 'cosmjs-types/ibc/core/client/v1/client'
import { Chain } from 'src/chain'
import { Transfrom } from 'src/lib/transform'
import { Transform } from 'src/lib/transform'
import { getRawProof } from 'src/lib/rawProof'
import { convertProofsToIcs23 } from './ack'

Expand All @@ -16,7 +16,7 @@ export async function generateMsgRecvPacket(
const msg = new MsgRecvPacket(
packet,
proof,
Transfrom.height(height),
Transform.height(height),
srcChain.wallet.address()
)

Expand Down
4 changes: 2 additions & 2 deletions src/msgs/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MsgTimeout } from '@initia/initia.js/dist/core/ibc/core/channel/msgs'
import { Height } from 'cosmjs-types/ibc/core/client/v1/client'
import { Uint64 } from '@cosmjs/math'
import { Chain } from 'src/chain'
import { Transfrom } from 'src/lib/transform'
import { Transform } from 'src/lib/transform'
import { Packet } from '@initia/initia.js'
import { getRawProof } from 'src/lib/rawProof'
import { convertProofsToIcs23 } from './ack'
Expand All @@ -20,7 +20,7 @@ export async function generateMsgTimeout(
return new MsgTimeout(
packet,
proof,
Transfrom.height(proofHeight),
Transform.height(proofHeight),
sequence,
srcChain.wallet.address()
)
Expand Down

0 comments on commit ef23680

Please sign in to comment.