Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
275d24b
proposalToVote - calculated correct
sasurobert Jul 11, 2025
f4975d0
added unit test
sasurobert Jul 11, 2025
90ce68e
fixes and more checks after AI audit.
sasurobert Jul 14, 2025
f546718
fixes and more checks after AI audit.
sasurobert Jul 14, 2025
4ba5301
added test for create and withdraw from new delegation contract
sasurobert Jul 14, 2025
5bff92c
added test for create and withdraw from new delegation contract
sasurobert Jul 14, 2025
7b70197
one more flag check.
sasurobert Jul 14, 2025
3004525
Merge pull request #7106 from multiversx/governance-fix-one-more-time
sstanculeanu Jul 15, 2025
96668e3
fixes /transaction/cost endpoint
miiu96 Jul 16, 2025
7264d5d
fix log message
miiu96 Jul 17, 2025
ab85eed
fix unit tests
miiu96 Jul 17, 2025
05159bc
fix import
miiu96 Jul 17, 2025
83d2d09
fix
miiu96 Jul 17, 2025
362ae99
unit tests
miiu96 Jul 17, 2025
066a31c
remove test
miiu96 Jul 17, 2025
d7b86df
change logs
miiu96 Jul 17, 2025
e1f4a84
change logs
miiu96 Jul 17, 2025
ff92a5e
fixes after review
miiu96 Jul 17, 2025
a2840e5
refactoring
miiu96 Jul 18, 2025
22f04af
small fix
miiu96 Jul 18, 2025
a50bac4
Merge pull request #6625 from multiversx/rc/barnard
valentin-lup Jul 18, 2025
6239d49
proper wasmer location
sstanculeanu Jul 18, 2025
8fe8efb
proper fix
sstanculeanu Jul 18, 2025
9a69ece
Update api/groups/transactionGroup.go
miiu96 Jul 18, 2025
cdb5e4b
renamed after review
sstanculeanu Jul 18, 2025
a8a121d
Merge pull request #7124 from multiversx/wasmer-location
sstanculeanu Jul 18, 2025
e4df41b
compressed flags
sstanculeanu Jul 18, 2025
b664569
fixed tests in respect with the new penalization
sstanculeanu Jul 18, 2025
8c3665e
Merge pull request #7126 from multiversx/v1.10.4-dev-config
sstanculeanu Jul 21, 2025
c32e38d
fixes
miiu96 Jul 24, 2025
6d1d4ac
extra unit
miiu96 Jul 25, 2025
7eaf02f
fix integration test
miiu96 Jul 25, 2025
6643ab0
fixes
miiu96 Jul 28, 2025
b27851b
Merge branch 'master' into fix-tx-cost-endpoint
miiu96 Jul 28, 2025
35ade78
extra check mock
miiu96 Jul 28, 2025
20b8d9e
Merge remote-tracking branch 'origin/fix-tx-cost-endpoint' into fix-t…
miiu96 Jul 28, 2025
2ada0d7
Revert "extra check mock"
miiu96 Jul 28, 2025
3e6825e
fixes
miiu96 Jul 28, 2025
32b3365
Merge pull request #7116 from multiversx/fix-tx-cost-endpoint
sstanculeanu Jul 29, 2025
030d8c1
Merge branch 'master' into merge-master-into-state-changes
ssd04 Aug 19, 2025
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
11 changes: 7 additions & 4 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ jobs:
BUILD_DIR=${GITHUB_WORKSPACE}/build
VM_GO_VERSION=$(cat go.mod | grep mx-chain-vm-go | sort -n | tail -n -1| awk -F '/' '{print$3}'| sed 's/ /@/g')
VM_GO_DIR=${GOPATH}/pkg/mod/github.com/multiversx/${VM_GO_VERSION}
LEGACY_VM_VERSION=$(cat go.mod | grep mx-chain-vm-v | sort -n | tail -n -1| awk -F '/' '{print$3}'| sed 's/ /@/g')
LEGACY_VM_DIR=${GOPATH}/pkg/mod/github.com/multiversx/${LEGACY_VM_VERSION}

echo "GOOS=${GOOS}" >> $GITHUB_ENV
echo "GOARCH=${GOARCH}" >> $GITHUB_ENV
echo "ARCHIVE=${ARCHIVE}" >> $GITHUB_ENV
echo "BUILD_DIR=${BUILD_DIR}" >> $GITHUB_ENV
echo "VM_GO_VERSION=${VM_GO_VERSION}" >> $GITHUB_ENV
echo "VM_GO_DIR=${VM_GO_DIR}" >> $GITHUB_ENV
echo "LEGACY_VM_DIR=${LEGACY_VM_DIR}" >> $GITHUB_ENV

- name: Build
run: |
Expand All @@ -72,23 +75,23 @@ jobs:

if [[ "$GOOS" == linux && "$GOARCH" == amd64 ]]; then
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer2/libvmexeccapi.so ${BUILD_DIR}/libvmexeccapi.so
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer/libwasmer_linux_amd64.so ${BUILD_DIR}/libwasmer_linux_amd64.so
cp --verbose --no-preserve=mode,ownership ${LEGACY_VM_DIR}/wasmer/libwasmer_linux_amd64.so ${BUILD_DIR}/libwasmer_linux_amd64.so
fi

# Actually, there's no runner for this combination (as of March 2024).
if [[ "$GOOS" == linux && "$GOARCH" == arm64 ]]; then
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer2/libvmexeccapi_arm.so ${BUILD_DIR}/libvmexeccapi_arm.so
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer/libwasmer_linux_arm64_shim.so ${BUILD_DIR}/libwasmer_linux_arm64_shim.so
cp --verbose --no-preserve=mode,ownership ${LEGACY_VM_DIR}/wasmer/libwasmer_linux_arm64_shim.so ${BUILD_DIR}/libwasmer_linux_arm64_shim.so
fi

if [[ "$GOOS" == darwin && "$GOARCH" == amd64 ]]; then
cp -v ${VM_GO_DIR}/wasmer2/libvmexeccapi.dylib ${BUILD_DIR}/libvmexeccapi.dylib
cp -v ${VM_GO_DIR}/wasmer/libwasmer_darwin_amd64.dylib ${BUILD_DIR}/libwasmer_darwin_amd64.dylib
cp -v ${LEGACY_VM_DIR}/wasmer/libwasmer_darwin_amd64.dylib ${BUILD_DIR}/libwasmer_darwin_amd64.dylib
fi

if [[ "$GOOS" == darwin && "$GOARCH" == arm64 ]]; then
cp -v ${VM_GO_DIR}/wasmer2/libvmexeccapi_arm.dylib ${BUILD_DIR}/libvmexeccapi_arm.dylib
cp -v ${VM_GO_DIR}/wasmer/libwasmer_darwin_arm64_shim.dylib ${BUILD_DIR}/libwasmer_darwin_arm64_shim.dylib
cp -v ${LEGACY_VM_DIR}/wasmer/libwasmer_darwin_arm64_shim.dylib ${BUILD_DIR}/libwasmer_darwin_arm64_shim.dylib
fi

if [[ "$GOOS" == linux ]]; then
Expand Down
55 changes: 55 additions & 0 deletions api/groups/transactionGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/api/errors"
"github.com/multiversx/mx-chain-go/api/middleware"
Expand All @@ -24,11 +25,13 @@ import (
const (
sendTransactionEndpoint = "/transaction/send"
simulateTransactionEndpoint = "/transaction/simulate"
simulateSCRCostEndpoint = "/transaction/cost-scr"
sendMultipleTransactionsEndpoint = "/transaction/send-multiple"
getTransactionEndpoint = "/transaction/:hash"
getScrsByTxHashEndpoint = "/transaction/scrs-by-tx-hash/:txhash"
sendTransactionPath = "/send"
simulateTransactionPath = "/simulate"
simulateSCRCostPath = "/cost-scr"
costPath = "/cost"
sendMultiplePath = "/send-multiple"
getTransactionPath = "/:txhash"
Expand All @@ -51,6 +54,7 @@ type transactionFacadeHandler interface {
ValidateTransactionForSimulation(tx *transaction.Transaction, checkSignature bool) error
SendBulkTransactions([]*transaction.Transaction) (uint64, error)
SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, error)
SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
GetTransaction(hash string, withResults bool) (*transaction.ApiTransactionResult, error)
GetSCRsByTxHash(txHash string, scrHash string) ([]*transaction.ApiSmartContractResult, error)
GetTransactionsPool(fields string) (*common.TransactionsPoolAPIResponse, error)
Expand Down Expand Up @@ -103,6 +107,17 @@ func NewTransactionGroup(facade transactionFacadeHandler) (*transactionGroup, er
},
},
},
{
Path: simulateSCRCostPath,
Method: http.MethodPost,
Handler: tg.simulateSCR,
AdditionalMiddlewares: []shared.AdditionalMiddleware{
{
Middleware: middleware.CreateEndpointThrottlerFromFacade(simulateSCRCostEndpoint, facade),
Position: shared.Before,
},
},
},
{
Path: costPath,
Method: http.MethodPost,
Expand Down Expand Up @@ -168,6 +183,46 @@ type TxResponse struct {
Timestamp uint64 `json:"timestamp"`
}

func (tg *transactionGroup) simulateSCR(c *gin.Context) {
var scr = smartContractResult.SmartContractResult{}
err := c.ShouldBindJSON(&scr)
if err != nil {
c.JSON(
http.StatusBadRequest,
shared.GenericAPIResponse{
Data: nil,
Error: fmt.Sprintf("%s: %s", errors.ErrValidation.Error(), err.Error()),
Code: shared.ReturnCodeRequestError,
},
)
return
}

start := time.Now()
executionResults, err := tg.getFacade().SimulateSCRExecutionCost(&scr)
logging.LogAPIActionDurationIfNeeded(start, "API call: SimulateSCRExecution")
if err != nil {
c.JSON(
http.StatusInternalServerError,
shared.GenericAPIResponse{
Data: nil,
Error: err.Error(),
Code: shared.ReturnCodeInternalError,
},
)
return
}

c.JSON(
http.StatusOK,
shared.GenericAPIResponse{
Data: executionResults,
Error: "",
Code: shared.ReturnCodeSuccess,
},
)
}

// simulateTransaction will receive a transaction from the client and will simulate its execution and return the results
func (tg *transactionGroup) simulateTransaction(c *gin.Context) {
var ftx = transaction.FrontendTransaction{}
Expand Down
11 changes: 11 additions & 0 deletions api/mock/facadeStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mock

import (
"encoding/hex"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"math/big"

"github.com/multiversx/mx-chain-core-go/core"
Expand Down Expand Up @@ -99,6 +100,16 @@ type FacadeStub struct {
P2PPrometheusMetricsEnabledCalled func() bool
AuctionListHandler func() ([]*common.AuctionListValidatorAPIResponse, error)
GetSCRsByTxHashCalled func(txHash string, scrHash string) ([]*transaction.ApiSmartContractResult, error)
SimulateSCRExecutionCostCalled func(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
}

// SimulateSCRExecutionCost -
func (f *FacadeStub) SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error) {
if f.SimulateSCRExecutionCostCalled != nil {
return f.SimulateSCRExecutionCostCalled(scr)
}

return nil, nil
}

// GetSCRsByTxHash -
Expand Down
2 changes: 2 additions & 0 deletions api/shared/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/esdt"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-core-go/data/validator"
"github.com/multiversx/mx-chain-core-go/data/vm"
Expand Down Expand Up @@ -112,6 +113,7 @@ type FacadeHandler interface {
ValidateTransactionForSimulation(tx *transaction.Transaction, checkSignature bool) error
SendBulkTransactions([]*transaction.Transaction) (uint64, error)
SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, error)
SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
GetTransaction(hash string, withResults bool) (*transaction.ApiTransactionResult, error)
ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)
EncodeAddressPubkey(pk []byte) (string, error)
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/api.toml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@
# /transaction/cost will receive a single transaction in JSON format and will return the estimated cost of it
{ Name = "/cost", Open = true },

# /transaction/cost-scr will receive a single smart contract result in JSON format and will return the estimated cost of it
{ Name = "/cost-scr", Open = true },

# /transaction/pool will return the hashes of the transactions that are currently in the pool
# /transaction/pool?fields=sender,receiver,gaslimit,gasprice will return hashes and all the optional fields mentioned that are currently in the pool
# /transaction/pool?by-sender=erd1... will return the hashes of the transactions that are currently in the pool for the sender
Expand Down
4 changes: 1 addition & 3 deletions cmd/node/config/economics.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
[FeeSettings]
GasLimitSettings = [
{EnableEpoch = 0, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "1500000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "15000000000", MaxGasLimitPerTx = "1500000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "10"},
{EnableEpoch = 1, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "10"},
{EnableEpoch = 2, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "10"},
{EnableEpoch = 3, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "2"},
{EnableEpoch = 1, MaxGasLimitPerBlock = "1500000000", MaxGasLimitPerMiniBlock = "250000000", MaxGasLimitPerMetaBlock = "15000000000", MaxGasLimitPerMetaMiniBlock = "250000000", MaxGasLimitPerTx = "600000000", MinGasLimit = "50000", ExtraGasLimitGuardedTx = "50000", MaxGasHigherFactorAccepted = "2"},
]
MinGasPrice = "1000000000" #will yield min tx fee of 0.00005 eGLD
GasPriceModifier = 0.01
Expand Down
16 changes: 8 additions & 8 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
GovernanceEnableEpoch = 1

# GovernanceDisableProposeEnableEpoch represents the epoch when governance disable proposal is enabled
GovernanceDisableProposeEnableEpoch = 6
GovernanceDisableProposeEnableEpoch = 1

# GovernanceFixesEnableEpoch represents the epoch when governance fixes are enabled
GovernanceFixesEnableEpoch = 7
GovernanceFixesEnableEpoch = 1

# DelegationManagerEnableEpoch represents the epoch when the delegation manager is enabled
# epoch should not be 0
Expand Down Expand Up @@ -352,22 +352,22 @@
CheckBuiltInCallOnTransferValueAndFailEnableRound = 1

# MaskVMInternalDependenciesErrorsEnableEpoch represents the epoch when the additional internal erorr masking in vm is enabled
MaskVMInternalDependenciesErrorsEnableEpoch = 2
MaskVMInternalDependenciesErrorsEnableEpoch = 1

# FixBackTransferOPCODEEnableEpoch represents the epoch when the fix for back transfers opcode will be enabled
FixBackTransferOPCODEEnableEpoch = 2
FixBackTransferOPCODEEnableEpoch = 1

# ValidationOnGobDecodeEnableEpoch represents the epoch when validation on GobDecode will be taken into account
ValidationOnGobDecodeEnableEpoch = 2
ValidationOnGobDecodeEnableEpoch = 1

# BarnardOpcodesEnableEpoch represents the epoch when Barnard opcodes will be enabled
BarnardOpcodesEnableEpoch = 2
BarnardOpcodesEnableEpoch = 1

# FixGetBalanceEnableEpoch represents the epoch when Barnard opcodes will be enabled
FixGetBalanceEnableEpoch = 2
FixGetBalanceEnableEpoch = 1

# AutomaticActivationOfNodesDisableEpoch represents the epoch when automatic activation of nodes for validators is disabled
AutomaticActivationOfNodesDisableEpoch = 2
AutomaticActivationOfNodesDisableEpoch = 1

# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
BLSMultiSignerEnableEpoch = [
Expand Down
2 changes: 1 addition & 1 deletion consensus/spos/bls/v2/subroundBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func (sr *subroundBlock) processReceivedBlock(

defer func() {
sw.Stop("processReceivedBlock")
log.Info("time measurements of processReceivedBlock", sw.GetMeasurements()...)
log.Debug("time measurements of processReceivedBlock", sw.GetMeasurements()...)

sr.SetProcessingBlock(false)
}()
Expand Down
6 changes: 6 additions & 0 deletions facade/initial/initialNodeFacade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/esdt"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-core-go/data/validator"
"github.com/multiversx/mx-chain-core-go/data/vm"
Expand Down Expand Up @@ -171,6 +172,11 @@ func (inf *initialNodeFacade) SimulateTransactionExecution(_ *transaction.Transa
return nil, errNodeStarting
}

// SimulateSCRExecutionCost returns nil and error
func (inf *initialNodeFacade) SimulateSCRExecutionCost(_ *smartContractResult.SmartContractResult) (*transaction.CostResponse, error) {
return nil, errNodeStarting
}

// GetTransaction returns nil and error
func (inf *initialNodeFacade) GetTransaction(_ string, _ bool) (*transaction.ApiTransactionResult, error) {
return nil, errNodeStarting
Expand Down
3 changes: 3 additions & 0 deletions facade/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/esdt"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-core-go/data/validator"
"github.com/multiversx/mx-chain-go/common"
Expand Down Expand Up @@ -116,6 +117,7 @@ type NodeHandler interface {

// TransactionSimulatorProcessor defines the actions which a transaction simulator processor has to implement
type TransactionSimulatorProcessor interface {
ProcessSCR(scr *smartContractResult.SmartContractResult, currentHeader coreData.HeaderHandler) (*txSimData.SimulationResultsWithVMOutput, error)
ProcessTx(tx *transaction.Transaction, currentHeader coreData.HeaderHandler) (*txSimData.SimulationResultsWithVMOutput, error)
IsInterfaceNil() bool
}
Expand All @@ -125,6 +127,7 @@ type ApiResolver interface {
ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, common.BlockInfo, error)
ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)
SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, error)
SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
StatusMetrics() external.StatusMetricsHandler
GetTotalStakedValue(ctx context.Context) (*api.StakeValues, error)
GetDirectStakedList(ctx context.Context) ([]*api.DirectStakedValue, error)
Expand Down
11 changes: 11 additions & 0 deletions facade/mock/apiResolverStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mock

import (
"context"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"

"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
Expand Down Expand Up @@ -51,6 +52,16 @@ type ApiResolverStub struct {
GetWaitingManagedKeysCalled func() ([]string, error)
GetWaitingEpochsLeftForPublicKeyCalled func(publicKey string) (uint32, error)
GetSCRsByTxHashCalled func(txHash string, scrHash string) ([]*transaction.ApiSmartContractResult, error)
SimulateSCRExecutionCostCalled func(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
}

// SimulateSCRExecutionCost -
func (ars *ApiResolverStub) SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error) {
if ars.SimulateSCRExecutionCostCalled != nil {
return ars.SimulateSCRExecutionCostCalled(scr)
}

return nil, nil
}

// GetSCRsByTxHash -
Expand Down
6 changes: 6 additions & 0 deletions facade/nodeFacade.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
apiData "github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/esdt"
"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-core-go/data/validator"
"github.com/multiversx/mx-chain-core-go/data/vm"
Expand Down Expand Up @@ -307,6 +308,11 @@ func (nf *nodeFacade) SimulateTransactionExecution(tx *transaction.Transaction)
return nf.apiResolver.SimulateTransactionExecution(tx)
}

// SimulateSCRExecutionCost will simulate a smart contract results and will return the gas cost
func (nf *nodeFacade) SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error) {
return nf.apiResolver.SimulateSCRExecutionCost(scr)
}

// GetTransaction gets the transaction with a specified hash
func (nf *nodeFacade) GetTransaction(hash string, withResults bool) (*transaction.ApiTransactionResult, error) {
return nf.apiResolver.GetTransaction(hash, withResults)
Expand Down
2 changes: 2 additions & 0 deletions factory/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
crypto "github.com/multiversx/mx-chain-crypto-go"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"

"github.com/multiversx/mx-chain-core-go/data/smartContractResult"
"github.com/multiversx/mx-chain-go/cmd/node/factory"
"github.com/multiversx/mx-chain-go/common"
cryptoCommon "github.com/multiversx/mx-chain-go/common/crypto"
Expand Down Expand Up @@ -267,6 +268,7 @@ type NetworkComponentsHandler interface {

// TransactionEvaluator defines the transaction evaluator actions
type TransactionEvaluator interface {
SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, error)
ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)
IsInterfaceNil() bool
Expand Down
Loading
Loading