diff --git a/go/enclave/components/batch_executor.go b/go/enclave/components/batch_executor.go index 82f771439..562635c35 100644 --- a/go/enclave/components/batch_executor.go +++ b/go/enclave/components/batch_executor.go @@ -624,6 +624,7 @@ func (executor *batchExecutor) executeTxs(ec *BatchExecutionContext, offset int, panic("Should not happen. Tx receipts and tx results do not match") } txResult.Receipt = txReceipts[i] + txResult.Receipt.TransactionIndex += uint(offset) } sort.Sort(sortByTxIndex(txResults)) diff --git a/go/enclave/core/utils.go b/go/enclave/core/utils.go index ae8922be4..a345d3ba1 100644 --- a/go/enclave/core/utils.go +++ b/go/enclave/core/utils.go @@ -60,7 +60,7 @@ func LogMethodDuration(logger gethlog.Logger, stopWatch *measure.Stopwatch, msg f(fmt.Sprintf("LogMethodDuration::%s", msg), newArgs...) } -// GetTxSigner returns the address that signed a transaction +// GetExternalTxSigner returns the address that signed a transaction func GetExternalTxSigner(tx *types.Transaction) (gethcommon.Address, error) { from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx) if err != nil { diff --git a/go/enclave/system/hooks.go b/go/enclave/system/hooks.go index 3156d7a0d..dbb6e0eae 100644 --- a/go/enclave/system/hooks.go +++ b/go/enclave/system/hooks.go @@ -200,6 +200,7 @@ func (s *systemContractCallbacks) CreateOnBatchEndTransaction(_ context.Context, tx := txExecResult.TxWithSender.Tx receipt := txExecResult.Receipt synTx := TransactionPostProcessor.StructsTransaction{ + From: *txExecResult.TxWithSender.Sender, Nonce: big.NewInt(int64(txExecResult.TxWithSender.Tx.Nonce())), GasPrice: tx.GasPrice(), GasLimit: big.NewInt(int64(tx.Gas())), @@ -214,15 +215,8 @@ func (s *systemContractCallbacks) CreateOnBatchEndTransaction(_ context.Context, synTx.To = gethcommon.Address{} // Zero address - contract deployment } - sender, err := core.GetExternalTxSigner(tx) - if err != nil { - s.logger.Error("CreateOnBatchEndTransaction: Failed to recover sender address", "error", err, "transactionHash", tx.Hash().Hex()) - return nil, fmt.Errorf("failed to recover sender address: %w", err) - } - synTx.From = sender - synTxs = append(synTxs, synTx) - s.logger.Debug("CreateOnBatchEndTransaction: Encoded transaction", log.TxKey, tx.Hash(), "sender", sender.Hex()) + s.logger.Debug("CreateOnBatchEndTransaction: Encoded transaction", log.TxKey, tx.Hash(), "sender", synTx.From) } data, err := transactionPostProcessorABI.Pack("onBlock", synTxs)