-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feat/ibc app ics20 add timestamp ( develop ) #385
Merged
Merged
Changes from all commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
45fa9b4
docs: cw721
phamphong9981 b27aa4c
docs: cw20
phamphong9981 ccc8fbd
Merge branch 'main' into docs/cw721
fibonacci998 0fa8225
Merge branch 'main' into docs/cw20
fibonacci998 5e50079
fix: update validator as UNSPECIFIED when not found onchain
fibonacci998 147fb9b
fix: remove token and delegator_shares when validator is UNRECOGNIZED
fibonacci998 dde6426
feat: crawl ibc tao
phamphong9981 6fd8005
feat: add test for unrecognized validator
fibonacci998 6db3990
feat: crawl genesis ibc tao
phamphong9981 d8eb803
feat: add migration to add index time to block, tx
fibonacci998 928e7b9
fix: code
phamphong9981 f38720d
Merge pull request #289 from aura-nw/feat/ibc_tao_genesis
phamphong9981 454a38a
fix: code
phamphong9981 49ad0b2
Merge pull request #293 from aura-nw/feat/add-index-by-time-to-block-tx
peara a901780
Merge pull request #276 from aura-nw/fix/update-validator-not-found
peara 49bcd7c
Merge pull request #249 from aura-nw/docs/cw20
peara 6924407
Merge pull request #243 from aura-nw/docs/cw721
peara 2f4cc12
feat: ibc app
phamphong9981 fc2478d
feat: ibc app
phamphong9981 32d103a
fix: allow whitelist query can have depth more than config (#312)
fibonacci998 685bb4b
feat: reindex cw20 service ( main ) (#277)
phamphong9981 92795eb
refactor: cw20/cw721 index and add relation ( main ) (#306)
phamphong9981 b6b007c
fix: duplicate latest migrate contract (#304)
phamphong9981 3640cff
test: ibc app
phamphong9981 4344974
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_app
phamphong9981 a5a406a
fix: review
phamphong9981 887ecfd
Feat/statistics (#272)
peara 8c01c5c
refactor: migrate cw721 activity missing smart contract event ( main …
phamphong9981 4b36f2e
feat: ibc app ics20
phamphong9981 3c325dc
Fix/account stat with feegrant (#337)
fibonacci998 4adfdf0
Update api_gateway.service.ts (#336)
fibonacci998 be9a80d
feat: ibc ics20 send
phamphong9981 a67e9f0
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_…
phamphong9981 91e03ce
feat: ibc ics20 send
phamphong9981 1d438ea
feat: ibc ics20 recv
phamphong9981 eab1ff1
feat: ibc ics20 recv
phamphong9981 6cd21c3
feat: handle ics20 ack
phamphong9981 3252d7c
feat: handle ics20 timeout
phamphong9981 93c2622
test: test
phamphong9981 a439d90
fix: code
phamphong9981 d7b5ea2
fix: code
phamphong9981 1cab04a
feat: ibc app ics20
phamphong9981 d6277cc
feat: ibc ics20 send
phamphong9981 3e5301b
feat: ibc ics20 send
phamphong9981 e13d572
feat: ibc ics20 recv
phamphong9981 e560026
feat: ibc ics20 recv
phamphong9981 44363b8
feat: handle ics20 ack
phamphong9981 0cd9a16
feat: handle ics20 timeout
phamphong9981 c27556d
test: test
phamphong9981 ec38e36
fix: code
phamphong9981 a61ca2b
fix: code
phamphong9981 5c86a9f
fix: cw721 activity missing from/to ( main ) (#294)
phamphong9981 dcec038
feat: crawl ibc tao ( main ) (#278)
phamphong9981 7b8d852
refactor: code
phamphong9981 a5f4afc
fix: test
phamphong9981 0c7e603
refactor: code
phamphong9981 4586cf5
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 e37e210
fix: merge code
phamphong9981 2da7bd4
refactor: review code
phamphong9981 8c075f2
refactor: review code
phamphong9981 e8893da
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 2f1b208
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 e19387a
Fix/lint json file (#359)
fibonacci998 ce28ddd
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 49cc97d
Feat/ibc app ( main ) (#321)
phamphong9981 7ad5fe9
refactor: update status
phamphong9981 aca7828
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_…
phamphong9981 964adc1
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 64615ee
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 8d721fb
fix: smart contract missing label ( main ) (#366)
phamphong9981 0fe2af1
refactor: code
phamphong9981 972632d
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 635169c
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 66881ec
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 7714d57
fix: excessive data
phamphong9981 7aa36bc
fix: update msg_index by order in event and log (#327)
fibonacci998 8413367
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 2e837b9
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 5f99865
feat: add memo column
phamphong9981 6d9609a
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 356db4d
feat: health check job ( main ) (#345)
phamphong9981 403a648
refactor: performance cw721 media info ( main ) (#369)
phamphong9981 1b32e83
fix: fix lint and remove resilient, protobuf, upgrade graphql (#380)
fibonacci998 9661481
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_…
phamphong9981 42662f0
feat: add timestamp columns
phamphong9981 51d60ea
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 bdc6134
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 ca2a387
refactor: add start time and finish time
phamphong9981 176afaa
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 c21a846
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 bd23a9a
refactor: migration
phamphong9981 2f2886f
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Knex } from 'knex'; | ||
import { IbcIcs20, IbcMessage } from '../src/models'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.schema.alterTable('ibc_ics20', (table) => { | ||
table.timestamp('start_time'); | ||
table.timestamp('finish_time'); | ||
}); | ||
await knex.transaction(async (trx) => { | ||
const ibcIcs20s = await IbcIcs20.query().transacting(trx); | ||
const ibcMsgs = await IbcMessage.query() | ||
.transacting(trx) | ||
.joinRelated('message.transaction') | ||
.whereIn( | ||
'sequence_key', | ||
ibcIcs20s.map((ibcIcs20) => ibcIcs20.sequence_key) | ||
) | ||
.select( | ||
'message:transaction.timestamp', | ||
'ibc_message.sequence_key', | ||
'ibc_message.type' | ||
); | ||
if (ibcIcs20s.length > 0) { | ||
ibcIcs20s.forEach((ibcIcs20) => { | ||
ibcIcs20.start_time = ibcMsgs.find( | ||
(e) => | ||
e.sequence_key === ibcIcs20.sequence_key && | ||
e.type === IbcMessage.EVENT_TYPE.SEND_PACKET | ||
)?.timestamp; | ||
ibcIcs20.finish_time = ibcMsgs.find( | ||
(e) => | ||
e.sequence_key === ibcIcs20.sequence_key && | ||
[ | ||
IbcMessage.EVENT_TYPE.RECV_PACKET, | ||
IbcMessage.EVENT_TYPE.TIMEOUT_PACKET, | ||
IbcMessage.EVENT_TYPE.ACKNOWLEDGE_PACKET, | ||
].includes(e.type) | ||
)?.timestamp; | ||
}); | ||
await IbcIcs20.query() | ||
.transacting(trx) | ||
.insert(ibcIcs20s) | ||
.onConflict('id') | ||
.merge(); | ||
} | ||
}); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.alterTable('ibc_ics20', (table) => { | ||
table.dropColumns('start_time', 'finish_time'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,14 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
.andWhere('ibc_message.type', IbcMessage.EVENT_TYPE.SEND_PACKET) | ||
.andWhere('message:transaction.height', '>', startHeight) | ||
.andWhere('message:transaction.height', '<=', endHeight) | ||
.select( | ||
'message:transaction.timestamp', | ||
'ibc_message.sequence_key', | ||
'ibc_message.id', | ||
'ibc_message.src_channel_id', | ||
'ibc_message.type', | ||
'ibc_message.data' | ||
) | ||
.orderBy('message.id') | ||
.transacting(trx); | ||
if (ics20Sends.length > 0) { | ||
|
@@ -79,6 +87,7 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
status: IbcIcs20.STATUS_TYPE.ONGOING, | ||
sequence_key: msg.sequence_key, | ||
type: msg.type, | ||
start_time: msg.timestamp, | ||
}) | ||
); | ||
await IbcIcs20.query().insert(ibcIcs20s).transacting(trx); | ||
|
@@ -104,6 +113,14 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
.andWhere('ibc_message.type', IbcMessage.EVENT_TYPE.RECV_PACKET) | ||
.andWhere('message:transaction.height', '>', startHeight) | ||
.andWhere('message:transaction.height', '<=', endHeight) | ||
.select( | ||
'message:transaction.timestamp', | ||
'ibc_message.sequence_key', | ||
'ibc_message.id', | ||
'ibc_message.dst_port_id', | ||
'ibc_message.dst_channel_id', | ||
'ibc_message.type' | ||
) | ||
.orderBy('message.id') | ||
.transacting(trx); | ||
if (ics20Recvs.length > 0) { | ||
|
@@ -150,6 +167,7 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
sequence_key: msg.sequence_key, | ||
type: msg.type, | ||
memo, | ||
finish_time: msg.timestamp, | ||
}); | ||
}); | ||
await IbcIcs20.query().insert(ibcIcs20s).transacting(trx); | ||
|
@@ -174,6 +192,11 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
.andWhere('message:transaction.height', '>', startHeight) | ||
.andWhere('message:transaction.height', '<=', endHeight) | ||
.orderBy('message.id') | ||
.select( | ||
'message:transaction.timestamp', | ||
'ibc_message.sequence_key', | ||
'ibc_message.id' | ||
) | ||
.transacting(trx); | ||
if (ics20Acks.length > 0) { | ||
// update success ack status for origin send ics20 | ||
|
@@ -229,6 +252,7 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
.andWhere('message:transaction.height', '>', startHeight) | ||
.andWhere('message:transaction.height', '<=', endHeight) | ||
.orderBy('message.id') | ||
.select('message:transaction.timestamp', 'ibc_message.sequence_key') | ||
.transacting(trx); | ||
if (ics20Timeouts.length > 0) { | ||
await this.updateOriginSendStatus( | ||
|
@@ -257,16 +281,26 @@ export default class CrawlIBCIcs20Service extends BullableService { | |
type: string, | ||
trx: Knex.Transaction | ||
) { | ||
await IbcIcs20.query() | ||
.transacting(trx) | ||
.patch({ | ||
status: type, | ||
}) | ||
.whereIn( | ||
'sequence_key', | ||
msgs.map((msg) => msg.sequence_key) | ||
) | ||
.andWhere('type', IbcMessage.EVENT_TYPE.SEND_PACKET); | ||
if (msgs.length > 0) { | ||
const ibcIcs20sKeyBy = _.keyBy( | ||
await IbcIcs20.query() | ||
.transacting(trx) | ||
.whereIn( | ||
'sequence_key', | ||
msgs.map((msg) => msg.sequence_key) | ||
) | ||
.andWhere('type', IbcMessage.EVENT_TYPE.SEND_PACKET), | ||
'sequence_key' | ||
); | ||
msgs.forEach((msg) => { | ||
ibcIcs20sKeyBy[msg.sequence_key].finish_time = msg.timestamp; | ||
ibcIcs20sKeyBy[msg.sequence_key].status = type; | ||
}); | ||
await IbcIcs20.query() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. timestamp không phải một row của ibc_mesage. Trong câu query cũ timestamp của ibc message là em lấy từ join select ra |
||
.insert(Object.values(ibcIcs20sKeyBy)) | ||
.onConflict('id') | ||
.merge(); | ||
} | ||
} | ||
|
||
async _start(): Promise<void> { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
còn sửa những cái cũ thì sao?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mới có trên dev nên em đang phân vân có sửa ko