Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ Optional: generate sample data (transactions):
```
PYTHONPATH=. python3 ./systemtests/generate_testdata_on_network.py setup --network testnet
PYTHONPATH=. python3 ./systemtests/generate_testdata_on_network.py run --network testnet
PYTHONPATH=. python3 ./systemtests/generate_testdata_on_network.py run-for-relayed-v1-v2 --network testnet
```

Run the checks:
Expand Down
10 changes: 4 additions & 6 deletions cmd/rosetta/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ VERSION:
}

cliFlagActivationEpochSpica = cli.UintFlag{
Name: "activation-epoch-spica",
Usage: "Specifies the activation epoch for Spica release.",
Required: false,
Value: 1575,
Name: "activation-epoch-spica",
Usage: "Deprecated (not used anymore).",
Hidden: true,
Value: 0,
}

cliFlagShouldEnablePprofEndpoints = cli.BoolFlag{
Expand Down Expand Up @@ -254,7 +254,6 @@ type parsedCliFlags struct {
numHistoricalEpochs uint32
shouldHandleContracts bool
configFileCustomCurrencies string
activationEpochSpica uint32
shouldEnablePprofEndpoints bool
}

Expand Down Expand Up @@ -286,7 +285,6 @@ func getParsedCliFlags(ctx *cli.Context) parsedCliFlags {
numHistoricalEpochs: uint32(ctx.GlobalUint(cliFlagNumHistoricalEpochs.Name)),
shouldHandleContracts: ctx.GlobalBool(cliFlagShouldHandleContracts.Name),
configFileCustomCurrencies: ctx.GlobalString(cliFlagConfigFileCustomCurrencies.Name),
activationEpochSpica: uint32(ctx.GlobalUint(cliFlagActivationEpochSpica.Name)),
shouldEnablePprofEndpoints: ctx.GlobalBool(cliFlagShouldEnablePprofEndpoints.Name),
}
}
1 change: 0 additions & 1 deletion cmd/rosetta/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func startRosetta(ctx *cli.Context) error {
FirstHistoricalEpoch: cliFlags.firstHistoricalEpoch,
NumHistoricalEpochs: cliFlags.numHistoricalEpochs,
ShouldHandleContracts: cliFlags.shouldHandleContracts,
ActivationEpochSpica: cliFlags.activationEpochSpica,
})
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
multiversx_sdk==1.6.2
# We'll stay on the old version of the SDKs up until ~Supernova (on the purpose of testing the removal of relayed V1 and V2).
multiversx_sdk==1.6.3
requests>=2.32.0,<3.0.0
1 change: 0 additions & 1 deletion server/factory/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ type NetworkProvider interface {
ComputeReceiptHash(apiReceipt *transaction.ApiReceipt) (string, error)
ComputeTransactionFeeForMoveBalance(tx *transaction.ApiTransactionResult) *big.Int
GetMempoolTransactionByHash(hash string) (*transaction.ApiTransactionResult, error)
IsReleaseSpicaActive(epoch uint32) bool
LogDescription()
}
2 changes: 0 additions & 2 deletions server/factory/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type ArgsCreateNetworkProvider struct {
FirstHistoricalEpoch uint32
NumHistoricalEpochs uint32
ShouldHandleContracts bool
ActivationEpochSpica uint32
}

// CreateNetworkProvider creates a network provider
Expand Down Expand Up @@ -148,7 +147,6 @@ func CreateNetworkProvider(args ArgsCreateNetworkProvider) (NetworkProvider, err
FirstHistoricalEpoch: args.FirstHistoricalEpoch,
NumHistoricalEpochs: args.NumHistoricalEpochs,
ShouldHandleContracts: args.ShouldHandleContracts,
ActivationEpochSpica: args.ActivationEpochSpica,

ObserverFacade: &components.ObserverFacade{
Processor: baseProcessor,
Expand Down
9 changes: 0 additions & 9 deletions server/provider/networkProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type ArgsNewNetworkProvider struct {
FirstHistoricalEpoch uint32
NumHistoricalEpochs uint32
ShouldHandleContracts bool
ActivationEpochSpica uint32

ObserverFacade observerFacade

Expand All @@ -66,7 +65,6 @@ type networkProvider struct {
firstHistoricalEpoch uint32
numHistoricalEpochs uint32
shouldHandleContracts bool
activationEpochSpica uint32

observerFacade observerFacade

Expand Down Expand Up @@ -107,7 +105,6 @@ func NewNetworkProvider(args ArgsNewNetworkProvider) (*networkProvider, error) {
firstHistoricalEpoch: args.FirstHistoricalEpoch,
numHistoricalEpochs: args.NumHistoricalEpochs,
shouldHandleContracts: args.ShouldHandleContracts,
activationEpochSpica: args.ActivationEpochSpica,

observerFacade: args.ObserverFacade,

Expand Down Expand Up @@ -473,11 +470,6 @@ func (provider *networkProvider) ComputeTransactionFeeForMoveBalance(tx *transac
return fee
}

// IsReleaseSpicaActive returns whether the Spica release is active in the provided epoch
func (provider *networkProvider) IsReleaseSpicaActive(epoch uint32) bool {
return epoch >= provider.activationEpochSpica
}

// LogDescription writes a description of the network provider in the log output
func (provider *networkProvider) LogDescription() {
log.Info("Description of network provider",
Expand All @@ -491,7 +483,6 @@ func (provider *networkProvider) LogDescription() {
"firstHistoricalEpoch", provider.firstHistoricalEpoch,
"numHistoricalEpochs", provider.numHistoricalEpochs,
"shouldHandleContracts", provider.shouldHandleContracts,
"activationEpochSpica", provider.activationEpochSpica,
"nativeCurrency", provider.GetNativeCurrency().Symbol,
"customCurrencies", provider.GetCustomCurrenciesSymbols(),
)
Expand Down
1 change: 0 additions & 1 deletion server/services/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ type NetworkProvider interface {
ComputeReceiptHash(apiReceipt *transaction.ApiReceipt) (string, error)
ComputeTransactionFeeForMoveBalance(tx *transaction.ApiTransactionResult) *big.Int
GetMempoolTransactionByHash(hash string) (*transaction.ApiTransactionResult, error)
IsReleaseSpicaActive(epoch uint32) bool
}
2 changes: 0 additions & 2 deletions server/services/transactionEventsController_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ func TestTransactionEventsController_ExtractEvents(t *testing.T) {
networkProvider := testscommon.NewNetworkProviderMock()
controller := newTransactionEventsController(networkProvider)

networkProvider.MockActivationEpochSirius = 42

t.Run("SCDeploy", func(t *testing.T) {
topic0, _ := hex.DecodeString("00000000000000000500def8dad1161f8f0c38f3e6e73515ed81058f0b5606b8")
topic1, _ := hex.DecodeString("5cf4abc83e50c5309d807fc3f676988759a1e301001bc9a0265804f42af806b8")
Expand Down
15 changes: 0 additions & 15 deletions server/services/transactionsFeaturesDetector.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,6 @@ func (detector *transactionsFeaturesDetector) isInvalidTransactionOfTypeMoveBala
return withSendingValueToNonPayableContract || withMetaTransactionIsInvalid
}

func (detector *transactionsFeaturesDetector) isRelayedV1TransactionCompletelyIntrashardWithSignalError(tx *transaction.ApiTransactionResult, innerTx *innerTransactionOfRelayedV1) bool {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code.

innerTxSenderShard := detector.networkProvider.ComputeShardIdOfPubKey(innerTx.SenderPubKey)
innerTxReceiverShard := detector.networkProvider.ComputeShardIdOfPubKey(innerTx.ReceiverPubKey)

isCompletelyIntrashard := tx.SourceShard == tx.DestinationShard &&
innerTxSenderShard == innerTxReceiverShard &&
innerTxSenderShard == tx.SourceShard
if !isCompletelyIntrashard {
return false
}

isWithSignalError := detector.eventsController.hasAnySignalError(tx)
return isWithSignalError
}

func (detector *transactionsFeaturesDetector) isContractDeploymentWithSignalErrorOrIntrashardContractCallWithSignalError(tx *transaction.ApiTransactionResult) bool {
return detector.isContractDeploymentWithSignalError(tx) || (detector.isIntrashard(tx) && detector.isContractCallWithSignalError(tx))
}
Expand Down
57 changes: 0 additions & 57 deletions server/services/transactionsFeaturesDetector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,63 +75,6 @@ func TestTransactionsFeaturesDetector_IsInvalidTransactionOfTypeMoveBalanceThatO
})
}

func TestTransactionsFeaturesDetector_isRelayedV1TransactionCompletelyIntrashardWithSignalError(t *testing.T) {
networkProvider := testscommon.NewNetworkProviderMock()
detector := newTransactionsFeaturesDetector(networkProvider)

t.Run("arbitrary relayed tx", func(t *testing.T) {
tx := &transaction.ApiTransactionResult{
SourceShard: 0,
DestinationShard: 1,
}

innerTx := &innerTransactionOfRelayedV1{
SenderPubKey: testscommon.TestUserShard1.PubKey,
ReceiverPubKey: testscommon.TestUserShard2.PubKey,
}

featureDetected := detector.isRelayedV1TransactionCompletelyIntrashardWithSignalError(tx, innerTx)
require.False(t, featureDetected)
})

t.Run("completely intrashard relayed tx, but no signal error", func(t *testing.T) {
tx := &transaction.ApiTransactionResult{
SourceShard: 0,
DestinationShard: 0,
}

innerTx := &innerTransactionOfRelayedV1{
SenderPubKey: testscommon.TestUserAShard0.PubKey,
ReceiverPubKey: testscommon.TestUserBShard0.PubKey,
}

featureDetected := detector.isRelayedV1TransactionCompletelyIntrashardWithSignalError(tx, innerTx)
require.False(t, featureDetected)
})

t.Run("completely intrashard relayed tx, with signal error", func(t *testing.T) {
tx := &transaction.ApiTransactionResult{
SourceShard: 0,
DestinationShard: 0,
Logs: &transaction.ApiLogs{
Events: []*transaction.Events{
{
Identifier: transactionEventSignalError,
},
},
},
}

innerTx := &innerTransactionOfRelayedV1{
SenderPubKey: testscommon.TestUserAShard0.PubKey,
ReceiverPubKey: testscommon.TestUserBShard0.PubKey,
}

featureDetected := detector.isRelayedV1TransactionCompletelyIntrashardWithSignalError(tx, innerTx)
require.True(t, featureDetected)
})
}

func TestTransactionsFeatureDetector_isContractDeploymentWithSignalErrorOrIntrashardContractCallWithSignalError(t *testing.T) {
networkProvider := testscommon.NewNetworkProviderMock()
detector := newTransactionsFeaturesDetector(networkProvider)
Expand Down
3 changes: 0 additions & 3 deletions server/services/transactionsTransformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ func TestTransactionsTransformer_NormalTxToRosettaTx(t *testing.T) {
extension := newNetworkProviderExtension(networkProvider)
transformer := newTransactionsTransformer(networkProvider)

networkProvider.MockActivationEpochSirius = 42

t.Run("move balance tx", func(t *testing.T) {
tx := &transaction.ApiTransactionResult{
Hash: "aaaa",
Expand Down Expand Up @@ -1116,7 +1114,6 @@ func TestTransactionsTransformer_TransformBlockTxsHavingNFTBurn(t *testing.T) {
func TestTransactionsTransformer_TransformBlockTxsHavingClaimDeveloperRewards(t *testing.T) {
networkProvider := testscommon.NewNetworkProviderMock()
networkProvider.MockObservedActualShard = 0
networkProvider.MockActivationEpochSpica = 42

extension := newNetworkProviderExtension(networkProvider)
transformer := newTransactionsTransformer(networkProvider)
Expand Down
1 change: 0 additions & 1 deletion systemtests/check_with_mesh_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def run_rosetta(configuration: Configuration, shard: int):
f"--config-custom-currencies={configuration.config_file_custom_currencies}",
f"--first-historical-epoch={current_epoch}",
f"--num-historical-epochs={configuration.num_historical_epochs}",
f"--activation-epoch-spica={configuration.activation_epoch_spica}",
"--log-level=*:DEBUG",
"--handle-contracts",
"--pprof"
Expand Down
24 changes: 12 additions & 12 deletions systemtests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Configuration:
proxy_url: str
proxy_adapter_port: int
rosetta_port: int
activation_epoch_spica: int
activation_epoch_relayed_v3: int
custom_tokens_completness_epoch: int
deactivation_epoch_relayed_v1v2: int
check_construction_native_configuration_file: str
check_construction_custom_configuration_file: str
check_data_configuration_file: str
Expand All @@ -56,8 +56,8 @@ class Configuration:
proxy_url=ENV_MAINNET_PROXY_URL or DEFAULT_MAINNET_PROXY_URL,
proxy_adapter_port=10001,
rosetta_port=7091,
activation_epoch_spica=1538,
activation_epoch_relayed_v3=4294967295,
custom_tokens_completness_epoch=0,
deactivation_epoch_relayed_v1v2=4294967295,
check_construction_native_configuration_file="",
check_construction_custom_configuration_file="",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
Expand All @@ -75,8 +75,8 @@ class Configuration:
proxy_url=ENV_DEVNET_PROXY_URL or DEFAULT_DEVNET_PROXY_URL,
proxy_adapter_port=10002,
rosetta_port=7092,
activation_epoch_spica=2327,
activation_epoch_relayed_v3=1,
custom_tokens_completness_epoch=0,
deactivation_epoch_relayed_v1v2=4294967295,
check_construction_native_configuration_file="systemtests/mesh_cli_config/devnet-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/devnet-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
Expand All @@ -96,8 +96,8 @@ class Configuration:
proxy_url=ENV_TESTNET_PROXY_URL or DEFAULT_TESTNET_PROXY_URL,
proxy_adapter_port=10003,
rosetta_port=7093,
activation_epoch_spica=1,
activation_epoch_relayed_v3=1,
custom_tokens_completness_epoch=0,
deactivation_epoch_relayed_v1v2=4294967295,
check_construction_native_configuration_file="systemtests/mesh_cli_config/testnet-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/testnet-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
Expand All @@ -116,8 +116,8 @@ class Configuration:
proxy_url="http://localhost:7950",
proxy_adapter_port=10004,
rosetta_port=7094,
activation_epoch_spica=1,
activation_epoch_relayed_v3=1,
custom_tokens_completness_epoch=1,
deactivation_epoch_relayed_v1v2=2,
check_construction_native_configuration_file="systemtests/mesh_cli_config/localnet-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/localnet-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
Expand All @@ -137,8 +137,8 @@ class Configuration:
proxy_url=os.environ.get("INTERNAL_TESTNET_PROXY_URL", ""),
proxy_adapter_port=10005,
rosetta_port=7095,
activation_epoch_spica=1,
activation_epoch_relayed_v3=1,
custom_tokens_completness_epoch=1,
deactivation_epoch_relayed_v1v2=2,
check_construction_native_configuration_file="systemtests/mesh_cli_config/internal-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/internal-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
Expand Down
Loading
Loading