-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathreceipts.go
More file actions
670 lines (544 loc) · 18.8 KB
/
receipts.go
File metadata and controls
670 lines (544 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
package sequence
import (
"bytes"
"context"
"fmt"
"math/big"
"github.com/0xsequence/ethkit/ethcoder"
"github.com/0xsequence/ethkit/ethrpc"
"github.com/0xsequence/ethkit/go-ethereum"
"github.com/0xsequence/ethkit/go-ethereum/accounts/abi"
"github.com/0xsequence/ethkit/go-ethereum/common"
"github.com/0xsequence/ethkit/go-ethereum/common/hexutil"
"github.com/0xsequence/ethkit/go-ethereum/core/types"
"github.com/0xsequence/go-sequence/contracts"
"github.com/0xsequence/go-sequence/core"
)
type Receipt struct {
*types.Receipt
MetaTxnID MetaTxnID
Status MetaTxnStatus
Reason string
Logs []*types.Log
Index uint
Transaction *Transaction
Receipts []*Receipt
}
func (r *Receipt) Find(metaTxnID MetaTxnID) *Receipt {
if r.MetaTxnID == metaTxnID {
return nil // the parent of this receipt is the receipt we want
}
for _, receipt := range r.Receipts {
if receipt.MetaTxnID == metaTxnID {
return r
}
found := receipt.Find(metaTxnID)
if found != nil {
return found
}
}
return nil
}
func (r *Receipt) setNativeReceipt(receipt *types.Receipt) {
r.Receipt = receipt
for _, child := range r.Receipts {
child.setNativeReceipt(receipt)
}
}
// This method is duplicated code from: `compressor/contract.go`
// can't be used directly, because it would create a circular dependency
func DecompressCalldata(ctx context.Context, to *common.Address, data []byte, provider ethrpc.Interface) (common.Address, []byte, error) {
if len(data) == 0 {
return common.Address{}, nil, fmt.Errorf("empty transaction data")
}
if data[0] != byte(0x00) {
return common.Address{}, nil, fmt.Errorf("not compressed data")
}
// Replace first byte with `METHOD_DECOMPRESS_1` (0x06)
// and call `.to`
c2 := make([]byte, len(data))
copy(c2, data)
c2[0] = byte(0x06)
res, err := provider.CallContract(ctx, ethereum.CallMsg{To: to, Data: c2}, nil)
if err != nil {
return common.Address{}, nil, err
}
if len(res) < 32 {
return common.Address{}, nil, fmt.Errorf("decompressed data too short")
}
addr := common.BytesToAddress(res[len(res)-32:])
return addr, res[:len(res)-32], nil
}
func TryDecodeCalldata(
ctx context.Context,
provider *ethrpc.Provider,
transaction *types.Transaction,
) (common.Address, Transactions, *big.Int, []byte, error) {
decodedTransactions, decodedNonce, decodedSignature, err := DecodeExecdata(transaction.Data(), common.Address{}, nil)
if err == nil {
return *transaction.To(), decodedTransactions, decodedNonce, decodedSignature, nil
}
// Try decoding it decompressed
addr, decompressed, err2 := DecompressCalldata(ctx, transaction.To(), transaction.Data(), provider)
if err2 != nil {
// Don't bubble up the decompression error, as it might not be a decompression error
return common.Address{}, nil, nil, nil, err
}
decodedTransactions, decodedNonce, decodedSignature, err = DecodeExecdata(decompressed, common.Address{}, nil)
if err != nil {
return common.Address{}, nil, nil, nil, err
}
return addr, decodedTransactions, decodedNonce, decodedSignature, nil
}
func DecodeReceipt(ctx context.Context, receipt *types.Receipt, provider *ethrpc.Provider) ([]*Receipt, []*types.Log, error) {
transaction, _, err := provider.TransactionByHash(ctx, receipt.TxHash)
if err != nil {
return nil, nil, err
}
wallet, decodedTransactions, decodedNonce, decodedSignature, err := TryDecodeCalldata(ctx, provider, transaction)
if err != nil {
return nil, nil, err
}
receipt.Logs = removeZKSyncLogs(receipt.Logs)
isGuestExecute := decodedNonce != nil && len(decodedSignature) == 0
logs, receipts, err := decodeReceipt(receipt.Logs, decodedTransactions, decodedNonce, wallet, transaction.ChainId(), isGuestExecute)
if err != nil {
return nil, nil, err
}
for _, child := range receipts {
child.setNativeReceipt(receipt)
}
return receipts, logs, nil
}
var zkSyncAddresses = map[common.Address]struct{}{
common.HexToAddress("0x0000000000000000000000000000000000008006"): {},
common.HexToAddress("0x000000000000000000000000000000000000800A"): {},
}
func removeZKSyncLogs(logs []*types.Log) []*types.Log {
logs_ := make([]*types.Log, 0, len(logs))
for _, log := range logs {
if _, ok := zkSyncAddresses[log.Address]; !ok {
logs_ = append(logs_, log)
}
}
return logs_
}
func V1IsTxExecutedEvent(log *types.Log, hash common.Hash) bool {
return len(log.Topics) == 0 &&
len(log.Data) == 32 &&
bytes.Equal(log.Data, hash[:])
}
func V1IsTxFailedEvent(log *types.Log, hash common.Hash) bool {
return len(log.Topics) == 1 &&
log.Topics[0] == V1TxFailedEventSig &&
bytes.HasPrefix(log.Data, hash[:])
}
func V2IsTxExecutedEvent(log *types.Log, hash common.Hash) bool {
return len(log.Topics) == 2 &&
log.Topics[0] == V2TxExecutedEventSig &&
bytes.Equal(log.Topics[1][:], hash[:])
}
func V3IsCallSucceededEvent(log *types.Log, hash common.Hash) bool {
transaction, _, err := V3DecodeCallSucceededEvent(log)
if err != nil {
return false
}
return transaction == hash
}
func V3IsCallFailedEvent(log *types.Log, hash common.Hash) bool {
transaction, _, _, err := V3DecodeCallFailedEvent(log)
if err != nil {
return false
}
return transaction == hash
}
func V3IsCallAbortedEvent(log *types.Log, hash common.Hash) bool {
transaction, _, _, err := V3DecodeCallAbortedEvent(log)
if err != nil {
return false
}
return transaction == hash
}
func V3IsCallSkippedEvent(log *types.Log, hash common.Hash) bool {
transaction, _, err := V3DecodeCallSkippedEvent(log)
if err != nil {
return false
}
return transaction == hash
}
func V3DecodeCallSucceededEvent(log *types.Log) (common.Hash, *big.Int, error) {
event := contracts.V3.WalletStage1Module.ABI.Events["CallSucceeded"]
if len(log.Topics) == 0 || log.Topics[0] != event.ID {
return common.Hash{}, nil, fmt.Errorf("not CallSucceeded")
}
switch len(log.Topics) {
case 1:
// TODO: we can remove this as its the old v3-rc.4 and earlier format
legacyInputs := make(abi.Arguments, len(event.Inputs))
copy(legacyInputs, event.Inputs)
legacyInputs[0].Indexed = false
args, err := legacyInputs.Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, fmt.Errorf("unable to decode CallSucceeded: %w", err)
}
if len(args) != 2 {
return common.Hash{}, nil, fmt.Errorf("%v CallSucceeded arguments, expected two", len(args))
}
digest, ok := args[0].([common.HashLength]byte)
if !ok {
return common.Hash{}, nil, fmt.Errorf("CallSucceeded digest is %T, expected common.Hash", args[0])
}
index, ok := args[1].(*big.Int)
if !ok {
return common.Hash{}, nil, fmt.Errorf("CallSucceeded index is %T, expected *big.Int", args[1])
}
return digest, index, nil
case 2:
args, err := event.Inputs.NonIndexed().Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, fmt.Errorf("unable to decode CallSucceeded: %w", err)
}
if len(args) != 1 {
return common.Hash{}, nil, fmt.Errorf("%v non-indexed CallSucceeded arguments, expected one", len(args))
}
digest := log.Topics[1]
index, ok := args[0].(*big.Int)
if !ok {
return common.Hash{}, nil, fmt.Errorf("CallSucceeded index is %T, expected *big.Int", args[0])
}
return digest, index, nil
default:
return common.Hash{}, nil, fmt.Errorf("%v topics, expected one or two", len(log.Topics))
}
}
func V3DecodeCallFailedEvent(log *types.Log) (common.Hash, *big.Int, error, error) {
event := contracts.V3.WalletStage1Module.ABI.Events["CallFailed"]
if len(log.Topics) == 0 || log.Topics[0] != event.ID {
return common.Hash{}, nil, nil, fmt.Errorf("not CallFailed")
}
switch len(log.Topics) {
case 1:
legacyInputs := make(abi.Arguments, len(event.Inputs))
copy(legacyInputs, event.Inputs)
legacyInputs[0].Indexed = false
args, err := legacyInputs.Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, nil, fmt.Errorf("unable to decode CallFailed: %w", err)
}
if len(args) != 3 {
return common.Hash{}, nil, nil, fmt.Errorf("%v CallFailed arguments, expected three", len(args))
}
digest, ok := args[0].([common.HashLength]byte)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallFailed digest is %T, expected common.Hash", args[0])
}
index, ok := args[1].(*big.Int)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallFailed index is %T, expected *big.Int", args[1])
}
reason, ok := args[2].([]byte)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallFailed reason is %T, expected []byte", args[2])
}
var reason_ error
if reason__, err := abi.UnpackRevert(reason); err == nil {
reason_ = fmt.Errorf("%v", reason__)
} else {
reason_ = fmt.Errorf("%v", hexutil.Encode(reason))
}
return digest, index, reason_, nil
case 2:
args, err := event.Inputs.NonIndexed().Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, nil, fmt.Errorf("unable to decode CallFailed: %w", err)
}
if len(args) != 2 {
return common.Hash{}, nil, nil, fmt.Errorf("%v non-indexed CallFailed arguments, expected two", len(args))
}
digest := log.Topics[1]
index, ok := args[0].(*big.Int)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallFailed index is %T, expected *big.Int", args[0])
}
reason, ok := args[1].([]byte)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallFailed reason is %T, expected []byte", args[1])
}
var reason_ error
if reason__, err := abi.UnpackRevert(reason); err == nil {
reason_ = fmt.Errorf("%v", reason__)
} else {
reason_ = fmt.Errorf("%v", hexutil.Encode(reason))
}
return digest, index, reason_, nil
default:
return common.Hash{}, nil, nil, fmt.Errorf("%v topics, expected one or two", len(log.Topics))
}
}
func V3DecodeCallAbortedEvent(log *types.Log) (common.Hash, *big.Int, error, error) {
event := contracts.V3.WalletStage1Module.ABI.Events["CallAborted"]
if len(log.Topics) == 0 || log.Topics[0] != event.ID {
return common.Hash{}, nil, nil, fmt.Errorf("not CallAborted")
}
switch len(log.Topics) {
case 1:
legacyInputs := make(abi.Arguments, len(event.Inputs))
copy(legacyInputs, event.Inputs)
legacyInputs[0].Indexed = false
args, err := legacyInputs.Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, nil, fmt.Errorf("unable to decode CallAborted: %w", err)
}
if len(args) != 3 {
return common.Hash{}, nil, nil, fmt.Errorf("%v CallAborted arguments, expected three", len(args))
}
digest, ok := args[0].([common.HashLength]byte)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallAborted digest is %T, expected common.Hash", args[0])
}
index, ok := args[1].(*big.Int)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallAborted index is %T, expected *big.Int", args[1])
}
reason, ok := args[2].([]byte)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallAborted reason is %T, expected []byte", args[2])
}
var reason_ error
if reason__, err := abi.UnpackRevert(reason); err == nil {
reason_ = fmt.Errorf("%v", reason__)
} else {
reason_ = fmt.Errorf("%v", hexutil.Encode(reason))
}
return digest, index, reason_, nil
case 2:
args, err := event.Inputs.NonIndexed().Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, nil, fmt.Errorf("unable to decode CallAborted: %w", err)
}
if len(args) != 2 {
return common.Hash{}, nil, nil, fmt.Errorf("%v non-indexed CallAborted arguments, expected two", len(args))
}
digest := log.Topics[1]
index, ok := args[0].(*big.Int)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallAborted index is %T, expected *big.Int", args[0])
}
reason, ok := args[1].([]byte)
if !ok {
return common.Hash{}, nil, nil, fmt.Errorf("CallAborted reason is %T, expected []byte", args[1])
}
var reason_ error
if reason__, err := abi.UnpackRevert(reason); err == nil {
reason_ = fmt.Errorf("%v", reason__)
} else {
reason_ = fmt.Errorf("%v", hexutil.Encode(reason))
}
return digest, index, reason_, nil
default:
return common.Hash{}, nil, nil, fmt.Errorf("%v topics, expected one or two", len(log.Topics))
}
}
func V3DecodeCallSkippedEvent(log *types.Log) (common.Hash, *big.Int, error) {
event := contracts.V3.WalletStage1Module.ABI.Events["CallSkipped"]
if len(log.Topics) == 0 || log.Topics[0] != event.ID {
return common.Hash{}, nil, fmt.Errorf("not CallSkipped")
}
switch len(log.Topics) {
case 1:
legacyInputs := make(abi.Arguments, len(event.Inputs))
copy(legacyInputs, event.Inputs)
legacyInputs[0].Indexed = false
args, err := legacyInputs.Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, fmt.Errorf("unable to decode CallSkipped: %w", err)
}
if len(args) != 2 {
return common.Hash{}, nil, fmt.Errorf("%v CallSkipped arguments, expected two", len(args))
}
digest, ok := args[0].([common.HashLength]byte)
if !ok {
return common.Hash{}, nil, fmt.Errorf("CallSkipped digest is %T, expected common.Hash", args[0])
}
index, ok := args[1].(*big.Int)
if !ok {
return common.Hash{}, nil, fmt.Errorf("CallSkipped index is %T, expected *big.Int", args[1])
}
return digest, index, nil
case 2:
args, err := event.Inputs.NonIndexed().Unpack(log.Data)
if err != nil {
return common.Hash{}, nil, fmt.Errorf("unable to decode CallSkipped: %w", err)
}
if len(args) != 1 {
return common.Hash{}, nil, fmt.Errorf("%v non-indexed CallSkipped arguments, expected one", len(args))
}
digest := log.Topics[1]
index, ok := args[0].(*big.Int)
if !ok {
return common.Hash{}, nil, fmt.Errorf("CallSkipped index is %T, expected *big.Int", args[0])
}
return digest, index, nil
default:
return common.Hash{}, nil, fmt.Errorf("%v topics, expected one or two", len(log.Topics))
}
}
func V2IsTxFailedEvent(log *types.Log, hash common.Hash) bool {
return len(log.Topics) == 2 &&
log.Topics[0] == V2TxFailedEventSig &&
bytes.Equal(log.Topics[1][:], hash[:])
}
func V1DecodeTxFailedEvent(log *types.Log) (common.Hash, string, error) {
if len(log.Topics) != 1 || log.Topics[0] != V1TxFailedEventSig {
return common.Hash{}, "", fmt.Errorf("not a TxFailed event")
}
var hash common.Hash
var revert []byte
if err := ethcoder.ABIUnpackArgumentsByRef([]string{"bytes32", "bytes"}, log.Data, []interface{}{&hash, &revert}); err != nil {
return common.Hash{}, "", err
}
reason, err := abi.UnpackRevert(revert)
if err != nil {
return common.Hash{}, "", err
}
return hash, reason, nil
}
func V2DecodeTxFailedEvent(log *types.Log) (common.Hash, string, uint, error) {
if len(log.Topics) != 2 || log.Topics[0] != V2TxFailedEventSig {
return common.Hash{}, "", 0, fmt.Errorf("not a TxFailed event")
}
hash := common.BytesToHash(log.Topics[1][:])
var index uint
var revert []byte
if err := ethcoder.ABIUnpackArgumentsByRef([]string{"uint256", "bytes"}, log.Data, []interface{}{&index, &revert}); err != nil {
return common.Hash{}, "", 0, err
}
reason, err := abi.UnpackRevert(revert)
if err != nil {
return common.Hash{}, "", 0, err
}
return hash, reason, index, nil
}
func DecodeTxFailedEvent(log *types.Log) (common.Hash, string, uint, error) {
return V2DecodeTxFailedEvent(log)
}
func DecodeNonceChangeEvent(log *types.Log) (*big.Int, *big.Int, error) {
if len(log.Topics) != 1 || log.Topics[0] != NonceChangeEventSig {
return nil, nil, fmt.Errorf("not a NonceChange event")
}
var space, nonce *big.Int
if err := ethcoder.ABIUnpackArgumentsByRef([]string{"uint256", "uint256"}, log.Data, []interface{}{&space, &nonce}); err != nil {
return nil, nil, err
}
return space, nonce, nil
}
func decodeReceipt(logs []*types.Log, transactions Transactions, nonce *big.Int, address common.Address, chainID *big.Int, isGuestExecute bool) ([]*types.Log, []*Receipt, error) {
isSelfExecute := nonce == nil
digestType := MetaTxnWalletExec
if isSelfExecute {
digestType = MetaTxnSelfExec
} else if isGuestExecute {
digestType = MetaTxnGuestExec
}
metaTxnID, hash, _ := ComputeMetaTxnID(chainID, address, transactions, nonce, digestType)
var digest core.PayloadDigest
if nonce != nil {
space, nonce := DecodeNonce(nonce)
payload, err := transactions.Payload(address, chainID, space, nonce)
if err != nil {
return nil, nil, fmt.Errorf("unable to convert transactions to payload: %w", err)
}
digest = payload.Digest()
}
var topLevelLogs []*types.Log
var receipts []*Receipt
// check if we should expect a NonceChange event
if !isSelfExecute && !isGuestExecute {
if len(logs) > 0 {
if _, _, err := DecodeNonceChangeEvent(logs[0]); err != nil {
return nil, nil, fmt.Errorf("expected NonceChange event")
}
// consume the NonceChange event
topLevelLogs = append(topLevelLogs, logs[0])
logs = logs[1:]
}
}
// create a receipt for each transaction
for i, transaction := range transactions {
receipt := Receipt{
MetaTxnID: metaTxnID,
Status: MetaTxnReverted,
Index: uint(i),
Transaction: transaction,
}
for len(logs) > 0 {
var log *types.Log
log, logs = logs[0], logs[1:]
isTxExecuted := V1IsTxExecutedEvent(log, hash) || V2IsTxExecutedEvent(log, hash)
if V3IsCallSucceededEvent(log, digest.Hash) {
isTxExecuted = true
receipt.MetaTxnID = MetaTxnID(digest.Hash.String()[2:])
}
var isTxFailed bool
var failedReason string
if !isTxExecuted {
var failedHash common.Hash
var err error
failedHash, failedReason, err = V1DecodeTxFailedEvent(log)
if err != nil {
failedHash, failedReason, _, err = V2DecodeTxFailedEvent(log)
}
if err != nil {
var reason error
failedHash, _, reason, err = V3DecodeCallFailedEvent(log)
failedReason = fmt.Sprint(reason)
if err == nil {
receipt.MetaTxnID = MetaTxnID(digest.Hash.String()[2:])
}
}
if err != nil {
var reason error
failedHash, _, reason, err = V3DecodeCallAbortedEvent(log)
failedReason = fmt.Sprint(reason)
if err == nil {
receipt.MetaTxnID = MetaTxnID(digest.Hash.String()[2:])
}
}
if err != nil {
failedHash, _, err = V3DecodeCallSkippedEvent(log)
if err == nil {
receipt.MetaTxnID = MetaTxnID(digest.Hash.String()[2:])
}
}
isTxFailed = err == nil && (failedHash == hash || failedHash == digest.Hash)
}
if isTxExecuted || isTxFailed {
if isTxExecuted {
receipt.Status = MetaTxnExecuted
} else if isTxFailed {
receipt.Status = MetaTxnFailed
receipt.Reason = failedReason
}
topLevelLogs = append(topLevelLogs, log)
break
} else {
receipt.Logs = append(receipt.Logs, log)
}
}
if transaction.Transactions != nil {
var err error
receipt.Logs, receipt.Receipts, err = decodeReceipt(receipt.Logs, transaction.Transactions, transaction.Nonce, transaction.To, chainID, isGuestExecuteTransaction(transaction))
if err != nil {
return nil, nil, err
}
}
receipts = append(receipts, &receipt)
}
if len(logs) > 0 {
return nil, nil, fmt.Errorf("%v unexpected events", len(logs))
}
return topLevelLogs, receipts, nil
}
func isGuestExecuteTransaction(transaction *Transaction) bool {
return transaction.Nonce != nil && len(transaction.Signature) == 0
}