Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Dec 6, 2024
1 parent ce8e427 commit b747e2a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions go/enclave/components/batch_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion go/enclave/core/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 2 additions & 8 deletions go/enclave/system/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand All @@ -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)
Expand Down

0 comments on commit b747e2a

Please sign in to comment.