Skip to content

Commit

Permalink
hotfix: fix da dtl get queue is null from l1 data, that may cause ver… (
Browse files Browse the repository at this point in the history
#987)

…… (#985)

hotfix: fix da dtl get queue is null from l1 data, that may cause
verfier invalid siger error

# Goals of PR

Core changes:

- Describe changes here

Notes:

- Write notes here

Related Issues:

- Link issues here
  • Loading branch information
guoshijiang committed Jun 13, 2023
2 parents 5614403 + 7a91930 commit db61814
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 33 deletions.
7 changes: 3 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**/Dockerfile* @shidaxi
/.github @shidaxi
/ops @shidaxi @bradyjoestar
/tss @byteflyfunny
/subsidy @curryxbo
/mt-batcher @guoshijiang
/* @wukongcheng @bradyjoestar @silmaj @HaoyangLiu
/tss @byteflyfunny @agnarsong
/mt-batcher @guoshijiang @agnarsong
/* @wukongcheng @bradyjoestar @Sha3nS @HaoyangLiu @agnarsong
73 changes: 44 additions & 29 deletions packages/data-transport-layer/src/services/da-ingestion/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,17 @@ export class DaIngestionService extends BaseService<DaIngestionServiceOptions> {
)

// batch transaction list
await this._storeBatchTransactionsByDSId(
const execOk = await this._storeBatchTransactionsByDSId(
dataStoreRollupId['data_store_id'],
index,
this.options.mantleDaUpgradeDataStoreId
)

this.logger.info('store batch transactions by store id', {
execOk,
})
if (!execOk) {
return
}
// put rollup store info to db
await this.state.db.putRollupStoreByBatchIndex(
{
Expand Down Expand Up @@ -320,7 +325,7 @@ export class DaIngestionService extends BaseService<DaIngestionServiceOptions> {
) {
const transactionEntries: TransactionEntry[] = []
if (storeId <= 0) {
return []
return false
}
const batchTxs = await this.GetBatchTransactionByDataStoreId(storeId)
.then((rst) => {
Expand All @@ -332,7 +337,7 @@ export class DaIngestionService extends BaseService<DaIngestionServiceOptions> {
})
try {
if (batchTxs.length === 0) {
return
return false
}
for (const batchTx of batchTxs) {
const queueOrigin =
Expand Down Expand Up @@ -371,34 +376,43 @@ export class DaIngestionService extends BaseService<DaIngestionServiceOptions> {
s: '0x'.concat(sigS),
},
}
let gasLimit = BigNumber.from(0).toString()
let target = constants.AddressZero
let origin = null
if (batchTx['TxMeta']['queueIndex'] != null) {
const enqueue = await this.state.db.getEnqueueByIndex(
BigNumber.from(batchTx['TxMeta']['queueIndex']).toNumber()
)
if (enqueue != null) {
gasLimit = enqueue.gasLimit
target = enqueue.target
origin = enqueue.origin
const lastestEnqueue = await this.state.db.getLatestEnqueue()
if (lastestEnqueue.index > batchTx['TxMeta']['queueIndex']) {
this.logger.info('get queue index from da and l1(EigenLayer)', {
lastestEnqueue: lastestEnqueue.index,
queueIndex: batchTx['TxMeta']['queueIndex'],
})
const enqueue = await this.state.db.getEnqueueByIndex(
BigNumber.from(batchTx['TxMeta']['queueIndex']).toNumber()
)
let gasLimit = BigNumber.from(0).toString()
let target = constants.AddressZero
let origin = null
if (enqueue != null) {
gasLimit = enqueue.gasLimit
target = enqueue.target
origin = enqueue.origin
}
transactionEntries.push({
index: batchTx['TxMeta']['index'],
batchIndex: daBatchIndex,
blockNumber: batchTx['TxMeta']['l1BlockNumber'],
timestamp: batchTx['TxMeta']['l1Timestamp'],
gasLimit,
target,
origin,
data: txData,
queueOrigin,
value: batchTx['TxDetail']['value'],
queueIndex: batchTx['TxMeta']['queueIndex'],
decoded,
confirmed: true,
})
} else {
return false
}
}
transactionEntries.push({
index: batchTx['TxMeta']['index'],
batchIndex: daBatchIndex,
blockNumber: batchTx['TxMeta']['l1BlockNumber'],
timestamp: batchTx['TxMeta']['l1Timestamp'],
gasLimit,
target,
origin,
data: txData,
queueOrigin,
value: batchTx['TxDetail']['value'],
queueIndex: batchTx['TxMeta']['queueIndex'],
decoded,
confirmed: true,
})
this.daIngestionMetrics.currentL2TransactionIndex.set(
batchTx['TxMeta']['index']
)
Expand All @@ -409,6 +423,7 @@ export class DaIngestionService extends BaseService<DaIngestionServiceOptions> {
storeId + upgradeBatchIndex
)
this.daIngestionMetrics.syncDataStoreId.set(upgradeBatchIndex + storeId)
return true
} catch (error) {
throw new Error(`eigen layer sync finish, error is: ${error}`)
}
Expand Down

0 comments on commit db61814

Please sign in to comment.