Skip to content

Commit 77f1225

Browse files
committed
fix panic
1 parent 303d6f1 commit 77f1225

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

rpc/rpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func (rpc *RPC) TransactionReceipt(ctx context.Context, txHash ethcommon.Hash) (
289289
return callFallbackThenMainWithResult(ctx, rpc, func(ctx context.Context, cli *ethclient.Client) (*ethtypes.Receipt, error) {
290290
var receipt *ethtypes.Receipt
291291
err := rpc.callCheckingNetworkID(ctx, cli, ethrpc.BatchElem{
292-
Method: "eth_sendRawTransaction",
292+
Method: "eth_getTransactionReceipt",
293293
Args: []interface{}{txHash},
294294
Result: &receipt,
295295
})

server/l2.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ func (l2 *L2) processBlock(ctx context.Context, blockNumber uint64) error {
516516
flashtestationsTxCount++
517517
builderTxCount++
518518
}
519-
519+
520520
if l2.cfg.MonitorBuilderPolicyContract != "" && l2.isBuilderPolicyAddWorkloadIdTx(tx) {
521521
go func() {
522522
l2.handleAddWorkloadIdTx(ctx, tx.Hash())
@@ -1180,6 +1180,7 @@ func (l2 *L2) handleAddWorkloadIdTx(ctx context.Context, txHash ethcommon.Hash)
11801180
zap.Error(err),
11811181
zap.String("tx", txHash.Hex()),
11821182
)
1183+
return
11831184
}
11841185

11851186
if receipt.Status == ethtypes.ReceiptStatusFailed {
@@ -1191,9 +1192,13 @@ func (l2 *L2) handleAddWorkloadIdTx(ctx context.Context, txHash ethcommon.Hash)
11911192

11921193
for _, log := range receipt.Logs {
11931194
if len(log.Topics) > 1 && log.Topics[0] == l2.builderPolicyAddWorkloadIdEventSignature {
1194-
workloadId := ethcommon.BytesToAddress(log.Topics[1].Bytes())
1195+
// workloadId is bytes32 (32 bytes), stored directly in Topics[1]
1196+
// log.Topics[1] is a common.Hash which is [32]byte
1197+
workloadId := [32]byte(log.Topics[1])
1198+
11951199
l.Info("Workload added to policy",
11961200
zap.String("workloadId", hex.EncodeToString(workloadId[:])),
1201+
zap.String("tx", txHash.Hex()),
11971202
)
11981203
metrics.WorkloadAddedToPolicyCount.Record(ctx, 1, otelapi.WithAttributes(
11991204
attribute.KeyValue{Key: "kind", Value: attribute.StringValue("l2")},
@@ -1204,7 +1209,9 @@ func (l2 *L2) handleAddWorkloadIdTx(ctx context.Context, txHash ethcommon.Hash)
12041209
}
12051210
}
12061211

1207-
return
1212+
l.Warn("WorkloadAddedToPolicy event not found in transaction",
1213+
zap.String("tx", txHash.Hex()),
1214+
)
12081215
}
12091216

12101217
// Extract TEE address and raw quote from TEEServiceRegistered event

0 commit comments

Comments
 (0)