Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append log events for all inner transactions failure #6176

Merged
merged 15 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 70 additions & 64 deletions factory/processing/blockProcessorCreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/multiversx/mx-chain-go/process/smartContract/scrCommon"
"github.com/multiversx/mx-chain-go/process/throttle"
"github.com/multiversx/mx-chain-go/process/transaction"
"github.com/multiversx/mx-chain-go/process/transactionLog"
"github.com/multiversx/mx-chain-go/state"
"github.com/multiversx/mx-chain-go/state/syncer"
"github.com/multiversx/mx-chain-go/storage/txcache"
Expand Down Expand Up @@ -236,30 +237,32 @@ func (pcf *processComponentsFactory) newShardBlockProcessor(
return nil, err
}

failedTxLogsAccumulator := transactionLog.NewFailedTxLogsAccumulator()
txFeeHandler := postprocess.NewFeeAccumulator()
argsNewScProcessor := scrCommon.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: pcf.state.AccountsAdapter(),
BlockChainHook: vmFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: pcf.txLogsProcessor,
TxTypeHandler: txTypeHandler,
IsGenesisProcessing: false,
BadTxForwarder: badTxInterim,
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
VMOutputCacher: txcache.NewDisabledCache(),
WasmVMChangeLocker: wasmVMChangeLocker,
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: pcf.state.AccountsAdapter(),
BlockChainHook: vmFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: pcf.txLogsProcessor,
TxTypeHandler: txTypeHandler,
IsGenesisProcessing: false,
BadTxForwarder: badTxInterim,
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
VMOutputCacher: txcache.NewDisabledCache(),
WasmVMChangeLocker: wasmVMChangeLocker,
FailedTxLogsAccumulator: failedTxLogsAccumulator,
}

scProcessorProxy, err := processProxy.NewSmartContractProcessorProxy(argsNewScProcessor, pcf.epochNotifier)
Expand All @@ -277,26 +280,27 @@ func (pcf *processComponentsFactory) newShardBlockProcessor(
}

argsNewTxProcessor := transaction.ArgsNewTxProcessor{
Accounts: pcf.state.AccountsAdapter(),
Hasher: pcf.coreData.Hasher(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
SignMarshalizer: pcf.coreData.TxMarshalizer(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScProcessor: scProcessorProxy,
TxFeeHandler: txFeeHandler,
TxTypeHandler: txTypeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
ReceiptForwarder: receiptTxInterim,
BadTxForwarder: badTxInterim,
ArgsParser: argsParser,
ScrForwarder: scForwarder,
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
GuardianChecker: pcf.bootstrapComponents.GuardedAccountHandler(),
TxVersionChecker: pcf.coreData.TxVersionChecker(),
TxLogsProcessor: pcf.txLogsProcessor,
RelayedTxV3Processor: relayedTxV3Processor,
Accounts: pcf.state.AccountsAdapter(),
Hasher: pcf.coreData.Hasher(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
SignMarshalizer: pcf.coreData.TxMarshalizer(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScProcessor: scProcessorProxy,
TxFeeHandler: txFeeHandler,
TxTypeHandler: txTypeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
ReceiptForwarder: receiptTxInterim,
BadTxForwarder: badTxInterim,
ArgsParser: argsParser,
ScrForwarder: scForwarder,
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
GuardianChecker: pcf.bootstrapComponents.GuardedAccountHandler(),
TxVersionChecker: pcf.coreData.TxVersionChecker(),
TxLogsProcessor: pcf.txLogsProcessor,
RelayedTxV3Processor: relayedTxV3Processor,
FailedTxLogsAccumulator: failedTxLogsAccumulator,
}
transactionProcessor, err := transaction.NewTxProcessor(argsNewTxProcessor)
if err != nil {
Expand Down Expand Up @@ -565,31 +569,33 @@ func (pcf *processComponentsFactory) newMetaBlockProcessor(
return nil, err
}

failedTxLogsAccumulator := transactionLog.NewFailedTxLogsAccumulator()
txFeeHandler := postprocess.NewFeeAccumulator()
enableEpochs := pcf.epochConfig.EnableEpochs
argsNewScProcessor := scrCommon.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: pcf.state.AccountsAdapter(),
BlockChainHook: vmFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: pcf.txLogsProcessor,
IsGenesisProcessing: false,
BadTxForwarder: badTxForwarder,
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
VMOutputCacher: txcache.NewDisabledCache(),
WasmVMChangeLocker: wasmVMChangeLocker,
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: pcf.state.AccountsAdapter(),
BlockChainHook: vmFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: pcf.txLogsProcessor,
IsGenesisProcessing: false,
BadTxForwarder: badTxForwarder,
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
VMOutputCacher: txcache.NewDisabledCache(),
WasmVMChangeLocker: wasmVMChangeLocker,
FailedTxLogsAccumulator: failedTxLogsAccumulator,
}

scProcessorProxy, err := processProxy.NewSmartContractProcessorProxy(argsNewScProcessor, pcf.epochNotifier)
Expand Down
135 changes: 71 additions & 64 deletions factory/processing/txSimulatorProcessComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,29 +173,32 @@ func (pcf *processComponentsFactory) createArgsTxSimulatorProcessorForMeta(
return args, nil, nil, err
}

failedTxLogsAccumulator := transactionLog.NewFailedTxLogsAccumulator()

scProcArgs := scrCommon.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: smartContract.NewArgumentParser(),
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: accountsAdapter,
BlockChainHook: vmContainerFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: &processDisabled.FeeHandler{},
EconomicsFee: pcf.coreData.EconomicsData(),
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: txLogsProcessor,
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
BadTxForwarder: badTxInterim,
VMOutputCacher: vmOutputCacher,
WasmVMChangeLocker: pcf.coreData.WasmVMChangeLocker(),
IsGenesisProcessing: false,
VmContainer: vmContainer,
ArgsParser: smartContract.NewArgumentParser(),
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: accountsAdapter,
BlockChainHook: vmContainerFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: &processDisabled.FeeHandler{},
EconomicsFee: pcf.coreData.EconomicsData(),
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: txLogsProcessor,
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
BadTxForwarder: badTxInterim,
VMOutputCacher: vmOutputCacher,
WasmVMChangeLocker: pcf.coreData.WasmVMChangeLocker(),
IsGenesisProcessing: false,
FailedTxLogsAccumulator: failedTxLogsAccumulator,
}

scProcessor, err := smartContract.NewSmartContractProcessor(scProcArgs)
Expand Down Expand Up @@ -348,29 +351,32 @@ func (pcf *processComponentsFactory) createArgsTxSimulatorProcessorShard(

argsParser := smartContract.NewArgumentParser()

failedTxLogsAccumulator := transactionLog.NewFailedTxLogsAccumulator()

scProcArgs := scrCommon.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: accountsAdapter,
BlockChainHook: vmContainerFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: &processDisabled.FeeHandler{},
EconomicsFee: pcf.coreData.EconomicsData(),
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: txLogsProcessor,
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
BadTxForwarder: badTxInterim,
VMOutputCacher: vmOutputCacher,
WasmVMChangeLocker: pcf.coreData.WasmVMChangeLocker(),
IsGenesisProcessing: false,
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: pcf.coreData.Hasher(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
AccountsDB: accountsAdapter,
BlockChainHook: vmContainerFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncFactory.BuiltInFunctionContainer(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScrForwarder: scForwarder,
TxFeeHandler: &processDisabled.FeeHandler{},
EconomicsFee: pcf.coreData.EconomicsData(),
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: pcf.gasSchedule,
TxLogsProcessor: txLogsProcessor,
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
BadTxForwarder: badTxInterim,
VMOutputCacher: vmOutputCacher,
WasmVMChangeLocker: pcf.coreData.WasmVMChangeLocker(),
IsGenesisProcessing: false,
FailedTxLogsAccumulator: failedTxLogsAccumulator,
}

scProcessor, err := smartContract.NewSmartContractProcessor(scProcArgs)
Expand All @@ -379,26 +385,27 @@ func (pcf *processComponentsFactory) createArgsTxSimulatorProcessorShard(
}

argsTxProcessor := transaction.ArgsNewTxProcessor{
Accounts: accountsAdapter,
Hasher: pcf.coreData.Hasher(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
SignMarshalizer: pcf.coreData.TxMarshalizer(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScProcessor: scProcessor,
TxFeeHandler: txFeeHandler,
TxTypeHandler: txTypeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
ReceiptForwarder: receiptTxInterim,
BadTxForwarder: badTxInterim,
ArgsParser: argsParser,
ScrForwarder: scForwarder,
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
TxVersionChecker: pcf.coreData.TxVersionChecker(),
GuardianChecker: pcf.bootstrapComponents.GuardedAccountHandler(),
TxLogsProcessor: txLogsProcessor,
RelayedTxV3Processor: relayedTxV3Processor,
Accounts: accountsAdapter,
Hasher: pcf.coreData.Hasher(),
PubkeyConv: pcf.coreData.AddressPubKeyConverter(),
Marshalizer: pcf.coreData.InternalMarshalizer(),
SignMarshalizer: pcf.coreData.TxMarshalizer(),
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
ScProcessor: scProcessor,
TxFeeHandler: txFeeHandler,
TxTypeHandler: txTypeHandler,
EconomicsFee: pcf.coreData.EconomicsData(),
ReceiptForwarder: receiptTxInterim,
BadTxForwarder: badTxInterim,
ArgsParser: argsParser,
ScrForwarder: scForwarder,
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
EnableRoundsHandler: pcf.coreData.EnableRoundsHandler(),
TxVersionChecker: pcf.coreData.TxVersionChecker(),
GuardianChecker: pcf.bootstrapComponents.GuardedAccountHandler(),
TxLogsProcessor: txLogsProcessor,
RelayedTxV3Processor: relayedTxV3Processor,
FailedTxLogsAccumulator: failedTxLogsAccumulator,
}

txProcessor, err := transaction.NewTxProcessor(argsTxProcessor)
Expand Down
46 changes: 24 additions & 22 deletions genesis/process/metaGenesisBlockCreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/multiversx/mx-chain-go/process"
"github.com/multiversx/mx-chain-go/process/block/preprocess"
"github.com/multiversx/mx-chain-go/process/coordinator"
disabledProcess "github.com/multiversx/mx-chain-go/process/disabled"
"github.com/multiversx/mx-chain-go/process/factory"
"github.com/multiversx/mx-chain-go/process/factory/metachain"
disabledGuardian "github.com/multiversx/mx-chain-go/process/guardian/disabled"
Expand Down Expand Up @@ -437,28 +438,29 @@ func createProcessorsForMetaGenesisBlock(arg ArgsGenesisBlockCreator, enableEpoc

argsParser := smartContract.NewArgumentParser()
argsNewSCProcessor := scrCommon.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: arg.Core.Hasher(),
Marshalizer: arg.Core.InternalMarshalizer(),
AccountsDB: arg.Accounts,
BlockChainHook: virtualMachineFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncs,
PubkeyConv: arg.Core.AddressPubKeyConverter(),
ShardCoordinator: arg.ShardCoordinator,
ScrForwarder: scForwarder,
TxFeeHandler: genesisFeeHandler,
EconomicsFee: genesisFeeHandler,
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: arg.GasSchedule,
TxLogsProcessor: arg.TxLogsProcessor,
BadTxForwarder: badTxForwarder,
EnableRoundsHandler: enableRoundsHandler,
EnableEpochsHandler: enableEpochsHandler,
IsGenesisProcessing: true,
WasmVMChangeLocker: &sync.RWMutex{}, // local Locker as to not interfere with the rest of the components
VMOutputCacher: txcache.NewDisabledCache(),
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: arg.Core.Hasher(),
Marshalizer: arg.Core.InternalMarshalizer(),
AccountsDB: arg.Accounts,
BlockChainHook: virtualMachineFactory.BlockChainHookImpl(),
BuiltInFunctions: builtInFuncs,
PubkeyConv: arg.Core.AddressPubKeyConverter(),
ShardCoordinator: arg.ShardCoordinator,
ScrForwarder: scForwarder,
TxFeeHandler: genesisFeeHandler,
EconomicsFee: genesisFeeHandler,
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasSchedule: arg.GasSchedule,
TxLogsProcessor: arg.TxLogsProcessor,
BadTxForwarder: badTxForwarder,
EnableRoundsHandler: enableRoundsHandler,
EnableEpochsHandler: enableEpochsHandler,
IsGenesisProcessing: true,
WasmVMChangeLocker: &sync.RWMutex{}, // local Locker as to not interfere with the rest of the components
VMOutputCacher: txcache.NewDisabledCache(),
FailedTxLogsAccumulator: disabledProcess.NewFailedTxLogsAccumulator(),
}

scProcessorProxy, err := processProxy.NewSmartContractProcessorProxy(argsNewSCProcessor, epochNotifier)
Expand Down
Loading
Loading