Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rapidrelayer #19

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Rapid Relayer does not use the `tx_search` query of Hermes to handle packets fro
- We need something more rapid.

### How We Fix This
- We removed the `tx_search` query, and handle packets in parallel across several blocks at once.
- We removed the `tx_search` query, and handled packets in parallel across several blocks at once.
- Keep track of `synced_height` and `latest_height`.
- Multi-threaded workers: packet handler and event feeder. The event feeder feeds the packet from new blocks to a cache and the packet handler fetches packets from it. This way, even if the packet handler stops, the event feeder will continue to operate.
- We remove the slow call of `tx_search`.
Expand Down Expand Up @@ -90,7 +90,7 @@ and a /syncInfo volume which will contain the state
```bash
docker run -it -v/tmp/rr/config:/config -v/tmp/rr/syncInfo:/syncInfo -d rapid-relayer:latest
```
this should start the relayer in a docker container using your config, and placing the state in a separate volume
this should start the relayer in a docker container using your config, and place the state in a separate volume

## SyncInfo

Expand Down
18 changes: 9 additions & 9 deletions src/chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ export class Chain {
}
}

// filter timeout that already done.
// filter timeout that is already done.
// filter by unreceivedAcks
await Promise.all(
Object.keys(timeoutPackets).map(async (path) => {
if (timeoutPackets[path].length === 0) return
const unrecivedPackets = await this.lcd.ibc.unreceivedAcks(
const unreceivedPackets = await this.lcd.ibc.unreceivedAcks(
timeoutPackets[path][0].packetData.source_port,
timeoutPackets[path][0].packetData.source_channel,
timeoutPackets[path].map((packet) => packet.packetData.sequence)
Expand All @@ -378,14 +378,14 @@ export class Chain {
await Promise.all(
Object.keys(timeoutPackets).map(async (path) => {
if (timeoutPackets[path].length === 0) return
const unrecivedPackets =
const unreceivedPackets =
await this.counterpartyChain.lcd.ibc.unreceivedPackets(
timeoutPackets[path][0].packetData.destination_port,
timeoutPackets[path][0].packetData.destination_channel,
timeoutPackets[path].map((packet) => packet.packetData.sequence)
)

const unrecivedSequences = unrecivedPackets.sequences.map((sequence) =>
const unreceivedSequences = unrecivedPackets.sequences.map((sequence) =>
Number(sequence)
)

Expand All @@ -395,23 +395,23 @@ export class Chain {
})
)

// filter recv packets that already done.
// filter recv packets that are already done.
await Promise.all(
Object.keys(recvPackets).map(async (path) => {
if (recvPackets[path].length === 0) return
const unrecivedPackets =
const unreceivedPackets =
await this.counterpartyChain.lcd.ibc.unreceivedPackets(
recvPackets[path][0].packetData.destination_port,
recvPackets[path][0].packetData.destination_channel,
recvPackets[path].map((packet) => packet.packetData.sequence)
)

const unrecivedSequences = unrecivedPackets.sequences.map((sequence) =>
const unreceivedSequences = unreceivedPackets.sequences.map((sequence) =>
Number(sequence)
)

recvPackets[path] = recvPackets[path].filter((packet) =>
unrecivedSequences.includes(packet.packetData.sequence)
unreceivedSequences.includes(packet.packetData.sequence)
)
})
)
Expand Down Expand Up @@ -444,7 +444,7 @@ export class Chain {
const unrecivedSequences: number[] = []
await Promise.all(
packets.map(async (packet) => {
const unrecivedPackets =
const unreceivedPackets =
await this.counterpartyChain.lcd.ibc.unreceivedAcks(
packet.packetData.packet.source_port,
packet.packetData.packet.source_channel,
Expand Down
2 changes: 1 addition & 1 deletion src/chain/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class WalletManager {
)
retried++

// if fail to broadcast, return error result to make regenerate msgs
// if fails to broadcast, return an error result to make regenerate msgs
if (retried >= MAX_RETRY) {
this.requestIndexInprogress++
error(`[runRequestWorker] Max retry exceeded`)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/rawProof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function getRawProof(
)
}

// we don't need the results, but we can ensure the data is the proper format
// we don't need the results, but we can ensure the data is in the proper format
checkAndParseOp(proof.ops[0], 'ics23:iavl')
checkAndParseOp(proof.ops[1], 'ics23:simple')

Expand Down
2 changes: 1 addition & 1 deletion src/msgs/updateClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async function getValidatorSet(
count++
}
const proposerAddress = block.block.header.proposer_address
// we need to query the header to find out who the proposer was, and pull them out
// we need to query the header to find out who the proposer was and pull them out
const validators = await chain.rpc.validatorsAll(height)
let totalVotingPower = BigInt(0)
const mappedValidators: Validator[] = validators.validators.map((val) => {
Expand Down