From 1f1c367e171d0f0f01a7f12247a243820d05c7bf Mon Sep 17 00:00:00 2001 From: Guillem Bonet Date: Thu, 29 Sep 2022 15:27:47 +0200 Subject: [PATCH 1/2] bump transactor and ganache Signed-off-by: Guillem Bonet --- docker-compose.e2e-basic.yml | 75 ++++++++------------------ e2e/connection_test.go | 3 +- e2e/mobile_entrypoint_test.go | 12 +++-- e2e/transactor/config.yaml | 87 ++++++++++++++++++++++++++++++ e2e/transactor/sidecar_config.yaml | 72 +++++++++++++++++++++++++ 5 files changed, 188 insertions(+), 61 deletions(-) create mode 100644 e2e/transactor/config.yaml create mode 100644 e2e/transactor/sidecar_config.yaml diff --git a/docker-compose.e2e-basic.yml b/docker-compose.e2e-basic.yml index c802c5f96..d67f8a18f 100644 --- a/docker-compose.e2e-basic.yml +++ b/docker-compose.e2e-basic.yml @@ -82,7 +82,7 @@ services: #private blockchain ganache: - image: trufflesuite/ganache:v7.0.3 + image: trufflesuite/ganache:v7.4.3 expose: - 8545 command: > @@ -90,7 +90,7 @@ services: #private blockchain ganache2: - image: trufflesuite/ganache:v7.0.3 + image: trufflesuite/ganache:v7.4.3 expose: - 8545 command: > @@ -108,44 +108,33 @@ services: - 9999:1080 transactordatabase: - image: 'mongo:4.2.3' - environment: - - MONGO_INITDB_ROOT_PASSWORD=root - - MONGO_INITDB_ROOT_USERNAME=root - - MONGO_INITDB_DATABASE=transactor - - MONGO_NON_ROOT_USERNAME=transactor - - MONGO_NON_ROOT_PASSWORD=transactor + image: postgres:13-alpine expose: - - 27017 - - 27018 - - 27019 - volumes: - - ./e2e/mongo-init.e2e.js:/docker-entrypoint-initdb.d/mongo-init.js:ro + - 5432 + environment: + - POSTGRES_USER=transactor + - POSTGRES_DB=transactor + - POSTGRES_PASSWORD=transactor + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 transactor-sidecar: - image: mysteriumnetwork/transactor-sidecar:2.7.4 + image: mysteriumnetwork/transactor-sidecar:3.0.10 depends_on: - transactordatabase - redis - http-mock command: > - "/usr/bin/sidecar" - -redisAddress="redis:6379" - -MongoUser=transactor - -MongoPass=transactor - -MongoHost=transactordatabase:27017 - -MongoDatabase=transactor - -MongoReplSet "" - -geckoUrl=http://http-mock:1080/gecko - -ethStaticGasPrice=0.001 - -maticStaticGasPrice=0.001 - -gasPriceUpdateInterval 2s - -gasStationOverrideChainsEth "" - -gasStationOverrideChainsMatic "" - -feeUpdateInterval 2s + /usr/bin/sidecar + -configPaths=/transactor/sidecar_config.yaml + volumes: + - ./e2e/transactor:/transactor transactor: - image: mysteriumnetwork/transactor:2.7.4 + image: mysteriumnetwork/transactor:3.0.10 environment: PORT: 8888 expose: @@ -158,32 +147,10 @@ services: - http-mock - transactor-sidecar command: > - -settlementThrottleTime=1ms - -stakeAmount 62000000000000000000 - -topUpAmount 7000000000000000000 - -chain1MystSCAddress 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -chain1Registries 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -chain1RPCEndpoint http://ganache:8545 - -chain1ChainID 5 - -chain2MystSCAddress 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -chain2Registries 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -chain2RPCEndpoint ws://ganache2:8545 - -chain2ChainID 80001 - -freeRegistration=true - -registrationGasLimit=450000 - -settlementCheckInterval=50ms - -ourIdentity 0x3d2cdbab09d2c8d613556769f37b47c82a5e13bf - -balanceCheckInterval 1s - -MongoUser transactor - -MongoPass transactor - -MongoHost transactordatabase:27017 - -MongoReplSet "" - -redisAddress "redis:6379" - -observerBaseURI="" - -hermesesWithEnabledWithdrawals="0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" - -fallbackChainHermeses="5=0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7,0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed;80001=0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7,0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed" + -configPaths=/transactor/config.yaml volumes: - ./e2e/blockchain/keystore:/keystore + - ./e2e/transactor:/transactor redis: image: bitnami/redis:6.2.6 diff --git a/e2e/connection_test.go b/e2e/connection_test.go index a3042f7fc..6d08b1f2b 100644 --- a/e2e/connection_test.go +++ b/e2e/connection_test.go @@ -475,7 +475,7 @@ func providerRegistrationFlow(t *testing.T, tequilapi *tequilapi_client.Client, assert.Eventually(t, func() bool { idStatus, _ := tequilapi.Identity(id) - return "Registered" == idStatus.RegistrationStatus + return idStatus.RegistrationStatus == "Registered" }, time.Second*30, time.Millisecond*500) // once we're registered, check some other information @@ -495,7 +495,6 @@ func providerRegistrationFlow(t *testing.T, tequilapi *tequilapi_client.Client, func topUpConsumer(t *testing.T, id string, hermesID common.Address, registrationFee *big.Int) { // TODO: once free registration is a thing of the past, remove this return - return // chid, err := crypto.GenerateChannelAddress(id, hermesID.Hex(), registryAddress, channelImplementation) // assert.NoError(t, err) diff --git a/e2e/mobile_entrypoint_test.go b/e2e/mobile_entrypoint_test.go index 6a7dab417..bf8f4e519 100644 --- a/e2e/mobile_entrypoint_test.go +++ b/e2e/mobile_entrypoint_test.go @@ -19,13 +19,13 @@ package e2e import ( "encoding/json" - "io/ioutil" "os" "strings" "testing" "time" "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mysteriumnetwork/node/config" @@ -34,7 +34,7 @@ import ( ) func TestMobileNodeConsumer(t *testing.T) { - dir, err := ioutil.TempDir("", "mobileEntryPoint") + dir, err := os.MkdirTemp("", "mobileEntryPoint") require.NoError(t, err) defer os.RemoveAll(dir) @@ -102,9 +102,11 @@ func TestMobileNodeConsumer(t *testing.T) { identity, err := node.GetIdentity(&mysterium.GetIdentityRequest{}) require.NoError(t, err) - balance, err := node.GetBalance(&mysterium.GetBalanceRequest{IdentityAddress: identity.IdentityAddress}) - require.NoError(t, err) - require.Equal(t, crypto.BigMystToFloat(balanceAfterRegistration), balance.Balance) + assert.Eventually(t, func() bool { + balance, err := node.GetBalance(&mysterium.GetBalanceRequest{IdentityAddress: identity.IdentityAddress}) + require.NoError(t, err) + return crypto.BigMystToFloat(balanceAfterRegistration) == balance.Balance + }, time.Second*5, 100*time.Millisecond) }) t.Run("Test identity export", func(t *testing.T) { diff --git a/e2e/transactor/config.yaml b/e2e/transactor/config.yaml new file mode 100644 index 000000000..a14cfe61d --- /dev/null +++ b/e2e/transactor/config.yaml @@ -0,0 +1,87 @@ +############## +# Gas config # +############## +gas: + chain_options: + 5: + multiplier: 1.5 + price_limit_gwei: 40 + increase_interval: 3m + 80001: + multiplier: 2 + price_limit_gwei: 45 + increase_interval: 3m + +########### +# Storage # +########### +storage: + redis: + addresses: + - "redis:6379" # Redis address + prefix: "transactor" + pool_size: 100 + pool_timeout: 5s + db: + psql_dsn: "postgres://transactor:transactor@transactordatabase:5432/transactor?sslmode=disable" # PostgreSQL DSN + max_idle_conns: 3 + max_open_conns: 4 + default_timeout: 15s + +########### +# Runtime # +########### +runtime: + keystore_dir: "/keystore" + our_identity: "0x3d2cdbab09d2c8d613556769f37b47c82a5e13bf" # The transactors identity address + identity_passphrase: "" # Identity passphrase + hermeses_with_enabled_withdrawals: # Hermeses which allow withdrawals and therefore can earn in their channel + - "0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" + hermeses_cache_duration: 24h # Amount of time for the hermes addresses are cache + max_requests_per_minute: 20 # The number of maximum write requests per hour per ip allowed before returning 429 + log_level: "debug" + +############## +# Blockchain # +############## +blockchain: + default_chain_id: 80001 # The chain id to use by default + chains: + 5: + rpc: "http://ganache:8545" # Rpc endpoints for the chain + fallback_hermeses: # Fallback list of hermes addresses + - "0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" + - "0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed" + registry_addresses: # A list of registry smart contract addresses + - "0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c" + myst_sc_address: "0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665" + transaction_processing_interval: 10ms + 80001: + rpc: "ws://ganache2:8545" + fallback_hermeses: + - "0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" + - "0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed" + registry_addresses: + - "0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c" + myst_sc_address: "0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665" + transaction_processing_interval: 10ms + +############ +# Registry # +############ +registry: + balance_check_interval: 1s # How often we check the balance for those who want to register + top_up_requeue_interval: 1m # How soon we retry a failed top up + cache_expiration: 1h # How often we let the user top up an identity + top_up_amount: 7000000000000000000 # The amount of myst the top up endpoint will transfer to the recipient + stake_amount: 62000000000000000000 # The amount of myst that will be transferred to the recipient during provider registration + registration_timeout: 1h # Determines how long we wait for balance before timing out the registration + registration_check_interval: 100ms # How often to check if registration transaction was mined + registration_gas_limit: 450000 # Specifies the gas limit set for registration transactions + free_registration: true # If given, registration is paid by transactor itself + +############### +# Settlements # +############### +settlements: + throttle: 1ms # Specifies how often a settlement can be tried diff --git a/e2e/transactor/sidecar_config.yaml b/e2e/transactor/sidecar_config.yaml new file mode 100644 index 000000000..c41a79635 --- /dev/null +++ b/e2e/transactor/sidecar_config.yaml @@ -0,0 +1,72 @@ +############## +# Gas config # +############## +gas: + update_interval: 30s # Update interval specifies how often we update gas prices + expiration: 1m # Expiration specifies the amount of time for which inserted gas price is valid for + update_chains: # Specify the chains will be updated with gas prices" + - 5 + - 80001 + eth_static_gas_price: 0.001 # Static gas price (in gwei ex: 12.5) used in eth payments when no dynamic gas pricer is present + matic_static_gas_price: 0.001 # Static gas price (in gwei ex: 12.5) used in matic payments when no dynamic gas pricer is present + + gas_station_override_chains_eth: # Overrides static matic gas pricer with built in external dynamic gas pricer for certain chains. + gas_station_override_chains_matic: # Overrides staitc gas pricer with built in external dynamic gas pricer for certain chains. + +########### +# Storage # +########### +storage: + redis: + addresses: + - "redis:6379" # Redis address + password: "" # Redis password + prefix: "transactor" + pool_size: 100 + pool_timeout: 5s + db: + psql_dsn: "postgres://transactor:transactor@transactordatabase:5432/transactor?sslmode=disable" # PostgreSQL DSN + max_idle_conns: 3 + max_open_conns: 4 + default_timeout: 15s + +########### +# Runtime # +########### +runtime: + gecko_url: http://http-mock:1080/gecko # the gecko url + log_level: "debug" + +############## +# Blockchain # +############## +blockchain: + default_chain_id: 80001 # The chain id to use by default + chains: + 5: + rpc: "http://ganache:8545" # Rpc endpoints for the chain + fallback_hermeses: # Fallback list of hermes addresses + - "0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" + - "0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed" + registry_addresses: # A list of registry smart contract addresses + - "0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c" + myst_sc_address: "0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665" + 80001: + rpc: "ws://ganache2:8545" + fallback_hermeses: + - "0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" + - "0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed" + registry_addresses: + - "0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c" + myst_sc_address: "0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665" + +######## +# Fees # +######## +fees: + update_interval: 2s # Update interval specifies how often we update fees + expiration: 10s # Expiration specifies the amount of time for which inserted fee is valid for + update_chains: # Specify the chains will be updated with fee prices + - 5 + - 80001 + multiplier: 0.1 # Fees multiplier From 14fa8688c1d081a22ced605a1320afdfb988c6df Mon Sep 17 00:00:00 2001 From: Guillem Bonet Date: Fri, 30 Sep 2022 10:46:01 +0200 Subject: [PATCH 2/2] update hermes and move back to previous ganache (last fails randomly) Signed-off-by: Guillem Bonet --- docker-compose.e2e-basic.yml | 36 ++--------- docker-compose.e2e-traversal.yml | 103 +++++++------------------------ e2e/connection_test.go | 14 ----- e2e/helpers.go | 66 -------------------- e2e/hermes/config.yaml | 64 +++++++++++++++++++ e2e/mongo-init.e2e.js | 26 -------- 6 files changed, 91 insertions(+), 218 deletions(-) delete mode 100644 e2e/helpers.go create mode 100644 e2e/hermes/config.yaml diff --git a/docker-compose.e2e-basic.yml b/docker-compose.e2e-basic.yml index d67f8a18f..1b4464867 100644 --- a/docker-compose.e2e-basic.yml +++ b/docker-compose.e2e-basic.yml @@ -82,7 +82,7 @@ services: #private blockchain ganache: - image: trufflesuite/ganache:v7.4.3 + image: trufflesuite/ganache:v7.0.3 expose: - 8545 command: > @@ -90,7 +90,7 @@ services: #private blockchain ganache2: - image: trufflesuite/ganache:v7.4.3 + image: trufflesuite/ganache:v7.0.3 expose: - 8545 command: > @@ -234,7 +234,7 @@ services: - ./e2e/pilvytis:/home/wiremock hermes2: - image: mysteriumnetwork/hermes:3.2.10 + image: mysteriumnetwork/hermes:3.3.15 environment: LOG_LEVEL: trace expose: @@ -243,38 +243,12 @@ services: - ganache - ganache2 - redis - - mongodb - transactor command: > - -identityPassphrase "" - -operator 0x761f2bb3e7ad6385a4c7833c5a26a8ddfdabf9f3 - -Chain1Myst 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -Chain1RPCEndpoint http://ganache:8545 - -Chain1ChainID 5 - -Chain1Registry 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -Chain1HermesAddress 0x599d43715DF3070f83355D9D90AE62c159E62A75 - -Chain1chImplementation 0xAA9C4E723609Cb913430143fbc86D3CBe7ADCa21 - -Chain2Myst 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -Chain2RPCEndpoint ws://ganache2:8545 - -Chain2ChainID 80001 - -Chain2Registry 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -Chain2HermesAddress 0x599d43715DF3070f83355D9D90AE62c159E62A75 - -Chain2chImplementation 0xAA9C4E723609Cb913430143fbc86D3CBe7ADCa21 - -keystoreDir /keystore - -bcDataRefreshInterval 1ns - -MongoUser hermes2 - -MongoReplSet rs0 - -MongoPass hermes2 - -MongoHost "mongodb:27017" - -MongoDatabase hermes2 - -MongoReplSet "" - -transactorBaseUri "http://transactor:8888/api/v1/" - -redisAddresses "redis:6379" - -bindAddr="0.0.0.0:8889" - -pilvytisBaseURL http://pilvytis-mock:8080 - -enablePayAndSettle true + -configPaths=/hermes/config.yaml volumes: - ./e2e/blockchain/keystore:/keystore + - ./e2e/hermes:/hermes myst-provider: build: diff --git a/docker-compose.e2e-traversal.yml b/docker-compose.e2e-traversal.yml index 6b440cef2..59939807a 100644 --- a/docker-compose.e2e-traversal.yml +++ b/docker-compose.e2e-traversal.yml @@ -225,19 +225,18 @@ services: transactordatabase: - image: 'mongo:4.2.3' - environment: - - MONGO_INITDB_ROOT_PASSWORD=root - - MONGO_INITDB_ROOT_USERNAME=root - - MONGO_INITDB_DATABASE=transactor - - MONGO_NON_ROOT_USERNAME=transactor - - MONGO_NON_ROOT_PASSWORD=transactor + image: postgres:13-alpine expose: - - 27017 - - 27018 - - 27019 - volumes: - - ./e2e/mongo-init.e2e.js:/docker-entrypoint-initdb.d/mongo-init.js:ro + - 5432 + environment: + - POSTGRES_USER=transactor + - POSTGRES_DB=transactor + - POSTGRES_PASSWORD=transactor + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 dns: 172.30.0.254 networks: public0: @@ -246,7 +245,7 @@ services: ipv4_address: 172.31.0.210 transactor-sidecar: - image: mysteriumnetwork/transactor-sidecar:2.7.4 + image: mysteriumnetwork/transactor-sidecar:3.0.10 sysctls: - net.ipv4.conf.default.rp_filter=0 - net.ipv4.conf.all.rp_filter=0 @@ -257,20 +256,10 @@ services: - redis - http-mock command: > - "/usr/bin/sidecar" - -redisAddress="redis:6379" - -MongoUser=transactor - -MongoPass=transactor - -MongoHost=transactordatabase:27017 - -MongoDatabase=transactor - -MongoReplSet "" - -geckoUrl=http://http-mock:1080/gecko - -ethStaticGasPrice=0.001 - -maticStaticGasPrice=0.001 - -gasPriceUpdateInterval 2s - -gasStationOverrideChainsEth "" - -gasStationOverrideChainsMatic "" - -feeUpdateInterval 2s + /usr/bin/sidecar + -configPaths=/transactor/sidecar_config.yaml + volumes: + - ./e2e/transactor:/transactor dns: 172.30.0.254 networks: public0: @@ -279,7 +268,7 @@ services: ipv4_address: 172.31.0.212 transactor: - image: mysteriumnetwork/transactor:2.7.4 + image: mysteriumnetwork/transactor:3.0.10 environment: PORT: 8888 expose: @@ -297,32 +286,10 @@ services: - http-mock - transactor-sidecar command: > - -settlementThrottleTime=1ms - -chain1RPCEndpoint http://ganache:8545 - -chain1ChainID 5 - -stakeAmount 62000000000000000000 - -topUpAmount 7000000000000000000 - -chain2MystSCAddress 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -chain2Registries 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -chain2RPCEndpoint ws://ganache2:8545 - -chain2ChainID 80001 - -registrationGasLimit=450000 - -settlementCheckInterval=50ms - -chain1MystSCAddress 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -chain1Registries 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -ourIdentity 0x3d2cdbab09d2c8d613556769f37b47c82a5e13bf - -balanceCheckInterval 1s - -MongoUser transactor - -MongoPass transactor - -MongoHost transactordatabase:27017 - -MongoReplSet "" - -freeRegistration=true - -redisAddress "redis:6379" - -observerBaseURI="" - -hermesesWithEnabledWithdrawals="0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7" - -fallbackChainHermeses="5=0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7,0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed;80001=0x676b9a084aC11CEeF680AF6FFbE99b24106F47e7,0x66D0a6DD6c1120B0e11513A4bA439f6eaed0E0Ed" + -configPaths=/transactor/config.yaml volumes: - ./e2e/blockchain/keystore:/keystore + - ./e2e/transactor:/transactor dns: 172.30.0.254 networks: public0: @@ -500,7 +467,7 @@ services: ipv4_address: 10.100.1.105 hermes2: - image: mysteriumnetwork/hermes:3.2.10 + image: mysteriumnetwork/hermes:3.3.15 sysctls: - net.ipv4.conf.default.rp_filter=0 - net.ipv4.conf.all.rp_filter=0 @@ -514,38 +481,12 @@ services: - ganache - ganache2 - redis - - mongodb - transactor command: > - -identityPassphrase "" - -Chain1Myst 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -Chain1RPCEndpoint http://ganache:8545 - -Chain1ChainID 5 - -Chain1HermesAddress 0x599d43715DF3070f83355D9D90AE62c159E62A75 - -Chain2Myst 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 - -Chain2RPCEndpoint ws://ganache2:8545 - -Chain2ChainID 80001 - -Chain2Registry 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -Chain2HermesAddress 0x599d43715DF3070f83355D9D90AE62c159E62A75 - -Chain2chImplementation 0xAA9C4E723609Cb913430143fbc86D3CBe7ADCa21 - -Chain1Registry 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c - -operator 0x761f2bb3e7ad6385a4c7833c5a26a8ddfdabf9f3 - -Chain1chImplementation 0xAA9C4E723609Cb913430143fbc86D3CBe7ADCa21 - -keystoreDir /keystore - -bcDataRefreshInterval 1ns - -MongoUser hermes2 - -MongoPass hermes2 - -MongoReplSet rs0 - -transactorBaseUri "http://transactor:8888/api/v1/" - -MongoHost "mongodb:27017" - -MongoDatabase hermes2 - -MongoReplSet "" - -redisAddresses "redis:6379" - -bindAddr "0.0.0.0:8889" - -pilvytisBaseURL http://pilvytis-mock:8080 - -enablePayAndSettle true + -configPaths=/hermes/config.yaml volumes: - ./e2e/blockchain/keystore:/keystore + - ./e2e/hermes:/hermes dns: 172.30.0.254 networks: public0: diff --git a/e2e/connection_test.go b/e2e/connection_test.go index 6d08b1f2b..611905e1b 100644 --- a/e2e/connection_test.go +++ b/e2e/connection_test.go @@ -62,7 +62,6 @@ var ( ethClient *ethclient.Client ethClientL2 *ethclient.Client ethSignerBuilder func(client *ethclient.Client) func(address common.Address, tx *types.Transaction) (*types.Transaction, error) - transactorMongo *Mongo ) var ( @@ -123,7 +122,6 @@ var consumersToTest = []*consumer{ func TestConsumerConnectsToProvider(t *testing.T) { initEthClient(t) - initTransactorMongo(t) tequilapiProvider := newTequilapiProvider() t.Run("Provider has a registered identity", func(t *testing.T) { @@ -315,9 +313,6 @@ func TestConsumerConnectsToProvider(t *testing.T) { err = c.tequila().Unlock(id.Address, "") assert.NoError(t, err) - err = transactorMongo.InsertRegistrationBounty(common.HexToAddress(id.Address)) - assert.NoError(t, err) - status, err := c.tequila().IdentityRegistrationStatus(id.Address) assert.NoError(t, err) assert.Equal(t, "Unregistered", status.Status) @@ -341,9 +336,6 @@ func TestConsumerConnectsToProvider(t *testing.T) { err = c.tequila().Unlock(id.Address, "") assert.NoError(t, err) - err = transactorMongo.InsertRegistrationBounty(common.HexToAddress(id.Address)) - assert.NoError(t, err) - status, err := c.tequila().IdentityRegistrationStatus(id.Address) assert.NoError(t, err) assert.Equal(t, "Unregistered", status.Status) @@ -413,12 +405,6 @@ func identityCreateFlow(t *testing.T, tequilapi *tequilapi_client.Client, idPass return id.Address } -func initTransactorMongo(t *testing.T) { - tm, err := NewMongo() - assert.NoError(t, err) - transactorMongo = tm -} - func initEthClient(t *testing.T) { addr := common.HexToAddress(addressForTopups) ks := keystore.NewKeyStore("/node/keystore", keystore.StandardScryptN, keystore.StandardScryptP) diff --git a/e2e/helpers.go b/e2e/helpers.go deleted file mode 100644 index 5047b931e..000000000 --- a/e2e/helpers.go +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2020 The "MysteriumNetwork/node" Authors. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package e2e - -import ( - "context" - "fmt" - "time" - - "github.com/ethereum/go-ethereum/common" - "go.mongodb.org/mongo-driver/bson/primitive" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" -) - -// Mongo represents a mongo driver -type Mongo struct { - db *mongo.Database -} - -// NewMongo returns a new mongo driver -func NewMongo() (*Mongo, error) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) - defer cancel() - uri := fmt.Sprintf("%v://%v:%v@%v/%v", "mongodb", "transactor", "transactor", "mongodb:27017", "transactor") - mongoClient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri)) - if err != nil { - return nil, fmt.Errorf("could not connect to mongodb: %w", err) - } - - return &Mongo{ - db: mongoClient.Database("transactor"), - }, nil -} - -type registrationBounty struct { - ID primitive.ObjectID `bson:"_id" json:"id"` - Identity string `bson:"identity" json:"identity"` -} - -// InsertRegistrationBounty inserts a new entry into the bounty collection -func (m *Mongo) InsertRegistrationBounty(identity common.Address) error { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) - defer cancel() - toInsert := registrationBounty{ - ID: primitive.NewObjectID(), - Identity: identity.Hex(), - } - _, err := m.db.Collection("registration_bounties").InsertOne(ctx, toInsert) - return err -} diff --git a/e2e/hermes/config.yaml b/e2e/hermes/config.yaml new file mode 100644 index 000000000..ed610d793 --- /dev/null +++ b/e2e/hermes/config.yaml @@ -0,0 +1,64 @@ +--- + +blockchain: + chain_1_rpc_endpoint: "http://ganache:8545" + chain_1_chain_id: 5 + chain_1_hermes_sc_address: 0x599d43715DF3070f83355D9D90AE62c159E62A75 + chain_1_channel_implementation: 0xAA9C4E723609Cb913430143fbc86D3CBe7ADCa21 + chain_1_registry: 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c + chain_1_myst_sc_address: 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 + chain_2_rpc_endpoint: "ws://ganache2:8545" + chain_2_chain_id: 80001 + chain_2_hermes_sc_address: 0x599d43715DF3070f83355D9D90AE62c159E62A75 + chain_2_channel_implementation: 0xAA9C4E723609Cb913430143fbc86D3CBe7ADCa21 + chain_2_registry: 0x241F6e1d0bB17f45767DC60A6Bd3D21Cdb543a0c + chain_2_myst_sc_address: 0x4D1d104AbD4F4351a0c51bE1e9CA0750BbCa1665 + bc_timeout: 30s + fallback_hermes_fee: 2000 + min_settlement_duration: 100 + +keystore: + operator: "0x761f2bb3e7ad6385a4c7833c5a26a8ddfdabf9f3" + keystore_dir: "./keystore" + identity_passphrase: "" + +storage: + redis: + redis_addresses: + - "redis:6379" + redis_data_prefix: "local_hermes2" + redis_lock_prefix: "lock_hermes2_lock" + redis_lock_max_retry: 5 + redis_lock_retry_backoff: 75ms + redis_pass: "" + redis_pool_size: 100 + redis_pool_timeout: 5s + agreement_expiration_time: 1h + +cache: + bc_data_refresh_interval: 1ns + beneficiary_cache_duration: 1ns + max_time_without_bc_sync: 1ns + +transactor: + base_uri: "http://transactor:8888/api/v1/" + timeout: 5s + +pilvytis: + base_uri: "http://pilvytis-mock:8080" + timeout: 5s + +common: + bind_addr: ":8889" + log_level: "debug" + +permissions: + enable_pay_and_settle: true + request_promise_disabled: false + provider_max_myst_bought_amount: 1000 + provider_withdrawal_cooldown: 1s + provider_lock_timeout: 1s + approx_myst_price_usd: 1 + fallback_eth_settle_threshold_usd: 1 + fallback_matic_settle_threshold_usd: 1 + max_promise_value_for_offchain: 0.5 diff --git a/e2e/mongo-init.e2e.js b/e2e/mongo-init.e2e.js index b601b2d0b..e147fc919 100644 --- a/e2e/mongo-init.e2e.js +++ b/e2e/mongo-init.e2e.js @@ -12,29 +12,3 @@ db.createUser( ] } ); -db = db.getSiblingDB('transactor'); -db.createUser( - { - user: "transactor", - pwd: "transactor", - roles: [ - { - role: "readWrite", - db: "transactor" - } - ] - } -); -db = db.getSiblingDB('hermes2'); -db.createUser( - { - user: "hermes2", - pwd: "hermes2", - roles: [ - { - role: "readWrite", - db: "hermes2" - } - ] - } -);