Skip to content

Commit da7b59f

Browse files
Antoine de Chevignéclaude
andcommitted
Fix code review issues for OP Stack integration
- Clean up event signatures: remove dead code, use single computed source - Lower default backfill batch size from 10000 to 10 for RPC compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent f7ca698 commit da7b59f

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

run/jobs/backfillOpDeposits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const logger = require('../lib/logger');
1111

1212
module.exports = async job => {
1313
const data = job.data || {};
14-
const { workspaceId, fromBlock, toBlock, batchSize = 10000 } = data;
14+
const { workspaceId, fromBlock, toBlock, batchSize = 10 } = data;
1515

1616
try {
1717
// Get OP chain config

run/jobs/backfillOpOutputs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const logger = require('../lib/logger');
1111

1212
module.exports = async job => {
1313
const data = job.data || {};
14-
const { workspaceId, fromBlock, toBlock, batchSize = 10000 } = data;
14+
const { workspaceId, fromBlock, toBlock, batchSize = 10 } = data;
1515

1616
try {
1717
// Get OP chain config

run/lib/opEvents.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,16 @@
66

77
const { ethers } = require('ethers');
88

9-
// Event signatures - keccak256 of event signature
9+
// Compute event signature from function signature string
10+
const computeEventSignature = (signature) => ethers.utils.id(signature);
11+
12+
// Event signatures - computed keccak256 hashes
1013
const EVENT_SIGNATURES = {
1114
// TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData)
12-
TRANSACTION_DEPOSITED: '0xb3813568d9991fc951961fcb4c784893574240a28925604d09fc577c55bb7c32',
13-
14-
// DisputeGameCreated(address indexed disputeProxy, uint32 indexed gameType, bytes32 indexed rootClaim)
15-
DISPUTE_GAME_CREATED: '0x5b565efe82411da98814f356d0e7bcb8f0c5b2c3f9e9b6b4d7f2e4e3b7b8c9a1',
16-
17-
// OutputProposed(bytes32 indexed outputRoot, uint256 indexed l2OutputIndex, uint256 indexed l2BlockNumber, uint256 l1Timestamp)
18-
OUTPUT_PROPOSED: '0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2'
19-
};
20-
21-
// Compute actual signatures to verify
22-
const computeEventSignature = (signature) => {
23-
return ethers.utils.id(signature);
24-
};
25-
26-
// Verify and update signatures (for debugging)
27-
const COMPUTED_SIGNATURES = {
2815
TRANSACTION_DEPOSITED: computeEventSignature('TransactionDeposited(address,address,uint256,bytes)'),
16+
// DisputeGameCreated(address indexed disputeProxy, uint32 indexed gameType, bytes32 indexed rootClaim)
2917
DISPUTE_GAME_CREATED: computeEventSignature('DisputeGameCreated(address,uint32,bytes32)'),
18+
// OutputProposed(bytes32 indexed outputRoot, uint256 indexed l2OutputIndex, uint256 indexed l2BlockNumber, uint256 l1Timestamp)
3019
OUTPUT_PROPOSED: computeEventSignature('OutputProposed(bytes32,uint256,uint256,uint256)')
3120
};
3221

@@ -142,7 +131,7 @@ const isTransactionDepositedEvent = (log, optimismPortalAddress) => {
142131
if (!log.address || !optimismPortalAddress) return false;
143132

144133
return log.address.toLowerCase() === optimismPortalAddress.toLowerCase() &&
145-
log.topics[0].toLowerCase() === COMPUTED_SIGNATURES.TRANSACTION_DEPOSITED.toLowerCase();
134+
log.topics[0].toLowerCase() === EVENT_SIGNATURES.TRANSACTION_DEPOSITED.toLowerCase();
146135
};
147136

148137
/**
@@ -156,7 +145,7 @@ const isDisputeGameCreatedEvent = (log, disputeGameFactoryAddress) => {
156145
if (!log.address || !disputeGameFactoryAddress) return false;
157146

158147
return log.address.toLowerCase() === disputeGameFactoryAddress.toLowerCase() &&
159-
log.topics[0].toLowerCase() === COMPUTED_SIGNATURES.DISPUTE_GAME_CREATED.toLowerCase();
148+
log.topics[0].toLowerCase() === EVENT_SIGNATURES.DISPUTE_GAME_CREATED.toLowerCase();
160149
};
161150

162151
/**
@@ -170,11 +159,11 @@ const isOutputProposedEvent = (log, l2OutputOracleAddress) => {
170159
if (!log.address || !l2OutputOracleAddress) return false;
171160

172161
return log.address.toLowerCase() === l2OutputOracleAddress.toLowerCase() &&
173-
log.topics[0].toLowerCase() === COMPUTED_SIGNATURES.OUTPUT_PROPOSED.toLowerCase();
162+
log.topics[0].toLowerCase() === EVENT_SIGNATURES.OUTPUT_PROPOSED.toLowerCase();
174163
};
175164

176165
module.exports = {
177-
EVENT_SIGNATURES: COMPUTED_SIGNATURES,
166+
EVENT_SIGNATURES,
178167
parseTransactionDeposited,
179168
parseDisputeGameCreated,
180169
parseOutputProposed,

0 commit comments

Comments
 (0)