From 8eb46451fb797ec375f78a3b142f3b2ff2eae4d8 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 14 Jun 2024 12:17:22 +0530 Subject: [PATCH 1/6] add TestRepairSize --- tests/api_tests/repair_allocation_test.go | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/tests/api_tests/repair_allocation_test.go b/tests/api_tests/repair_allocation_test.go index 8deecce837..3995adbb6b 100644 --- a/tests/api_tests/repair_allocation_test.go +++ b/tests/api_tests/repair_allocation_test.go @@ -347,3 +347,103 @@ func TestRepairAllocation(testSetup *testing.T) { } }) } + +func TestRepairSize(testSetup *testing.T) { + t := test.NewSystemTest(testSetup) + wallet := createWallet(t) + sdkClient.SetWallet(t, wallet) + apiClient.CreateReadPool(t, wallet, 0.5, client.TxSuccessfulStatus) + + t.RunSequentiallyWithTimeout("repair size in case of no blobber failure should be zero", 5 * time.Minute, func(t *test.SystemTest) { + // create allocation with default blobber requirements + blobberRequirements := model.DefaultBlobberRequirements(wallet.Id, wallet.PublicKey) + allocationBlobbers := apiClient.GetAllocationBlobbers(t, wallet, &blobberRequirements, client.HttpOkStatus) + allocationID := apiClient.CreateAllocation(t, wallet, allocationBlobbers, client.TxSuccessfulStatus) + t.Logf("allocationID: %v", allocationID) + + // create and upload a file of 2KB to allocation. + op := sdkClient.AddUploadOperation(t, "", "", int64(1024 * 2)) + sdkClient.MultiOperation(t, allocationID, []sdk.OperationRequest{op}) + + // assert both upload and download size should be zero + alloc, err := sdk.GetAllocation(allocationID) + require.NoErrorf(t, err, "allocation ID %v is not found", allocationID) + rs, err := alloc.RepairSize("/") + require.Nil(t, err) + t.Logf("repair size: %v", rs) + require.Equal(t, uint64(0), rs.UploadSize, "upload size doesn't match") + require.Equal(t, uint64(0), rs.DownloadSize, "download size doesn't match") + }) + + t.RunSequentiallyWithTimeout("repair size on single blobber failure should match", 5 * time.Minute, func(t *test.SystemTest) { + // create allocation with default blobber requirements + blobberRequirements := model.DefaultBlobberRequirements(wallet.Id, wallet.PublicKey) + blobberRequirements.DataShards = 2 + blobberRequirements.ParityShards = 2 + blobberRequirements.Size = 2056 + allocationBlobbers := apiClient.GetAllocationBlobbers(t, wallet, &blobberRequirements, client.HttpOkStatus) + allocationID := apiClient.CreateAllocation(t, wallet, allocationBlobbers, client.TxSuccessfulStatus) + t.Logf("allocationID: %v", allocationID) + + // create and upload a file of 2KB to allocation. + // one blobber url is set invalid to mimic failure. + alloc, err := sdk.GetAllocation(allocationID) + require.NoErrorf(t, err, "allocation ID %v is not found", allocationID) + alloc.Blobbers[0].Baseurl = "http://0zus.com/" + op := sdkClient.AddUploadOperation(t, "", "", int64(1024 * 2)) + sdkClient.MultiOperation(t, allocationID, []sdk.OperationRequest{op}, client.WithRepair(alloc.Blobbers)) + + // assert upload and download size should be 1KB and 2KB respectively + rs, err := alloc.RepairSize("/") + require.Nil(t, err) + t.Logf("repair size: %v", rs) + require.Equal(t, uint64(1024), rs.UploadSize, "upload size doesn't match") + require.Equal(t, uint64(1024 * 2), rs.DownloadSize, "download size doesn't match") + }) + + t.RunSequentiallyWithTimeout("repair size with nested directories and two blobber failure should match", 5 * time.Minute, func(t *test.SystemTest) { + // create allocation with default blobber requirements + blobberRequirements := model.DefaultBlobberRequirements(wallet.Id, wallet.PublicKey) + blobberRequirements.DataShards = 2 + blobberRequirements.ParityShards = 4 + allocationBlobbers := apiClient.GetAllocationBlobbers(t, wallet, &blobberRequirements, client.HttpOkStatus) + allocationID := apiClient.CreateAllocation(t, wallet, allocationBlobbers, client.TxSuccessfulStatus) + t.Logf("allocationID: %v", allocationID) + + // create and upload two files of 1KB each to / and /dir1. + // two blobber url is set invalid to mimic failure. + alloc, err := sdk.GetAllocation(allocationID) + require.NoErrorf(t, err, "allocation ID %v is not found", allocationID) + alloc.Blobbers[0].Baseurl = "http://0zus.com/" + alloc.Blobbers[1].Baseurl = "http://0zus.com/" + ops := []sdk.OperationRequest{ + sdkClient.AddUploadOperationWithPath(t, allocationID, "/dir1/"), + sdkClient.AddUploadOperationWithPath(t, allocationID, "/dir1/"), + sdkClient.AddUploadOperationWithPath(t, allocationID, "/"), + sdkClient.AddUploadOperationWithPath(t, allocationID, "/"), + } + sdkClient.MultiOperation(t, allocationID, ops, client.WithRepair(alloc.Blobbers)) + + // assert both upload and download size should be 2KB in /dir1 + rs, err := alloc.RepairSize("/dir1") + require.Nilf(t, err, "error getting repair size in /dir1: %v", err) + t.Logf("repair size: %v", rs) + require.Equal(t, uint64(1024 * 2), rs.UploadSize, "upload size in directory /dir1 doesn't match") + require.Equal(t, uint64(1024 * 2), rs.DownloadSize, "download size in directory dir1 doesn't match") + + // with trailing slash + // assert both upload and download size should be 2KB in /dir1/ + rs, err = alloc.RepairSize("/dir1/") + require.Nilf(t, err, "error getting repair size in /dir1/: %v", err) + t.Logf("repair size: %v", rs) + require.Equal(t, uint64(1024 * 2), rs.UploadSize, "upload size in directory /dir1/ doesn't match") + require.Equal(t, uint64(1024 * 2), rs.DownloadSize, "download size in directory /dir1/ doesn't match") + + // assert both upload and download size should be 4KB in root directory + rs, err = alloc.RepairSize("/") + require.Nilf(t, err, "error getting repair size in /: %v", err) + t.Logf("repair size: %v", rs) + require.Equal(t, uint64(1024 * 4), rs.UploadSize, "upload size in root directory doesn't match") + require.Equal(t, uint64(1024 * 4), rs.DownloadSize, "download size in root directory doesn't match") + }) +} \ No newline at end of file From cf721294d637f80a942c3daae2fad229cbb9166a Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 14 Jun 2024 13:50:09 +0530 Subject: [PATCH 2/6] add cli tests --- internal/cli/model/model.go | 8 +++ tests/cli_tests/zboxcli_repair_test.go | 93 ++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 tests/cli_tests/zboxcli_repair_test.go diff --git a/internal/cli/model/model.go b/internal/cli/model/model.go index de279353f8..8bdc3a8588 100644 --- a/internal/cli/model/model.go +++ b/internal/cli/model/model.go @@ -733,6 +733,14 @@ type ReadMarker struct { BlockNumber int64 `json:"block_number"` } +// holds result of repair size +type RepairSize struct { + // upload size in bytes + UploadSize uint64 `json:"upload_size"` + // download size in bytes + DownloadSize uint64 `json:"download_size"` +} + var StorageKeySettings = []string{ "owner_id", } diff --git a/tests/cli_tests/zboxcli_repair_test.go b/tests/cli_tests/zboxcli_repair_test.go new file mode 100644 index 0000000000..9fa1123324 --- /dev/null +++ b/tests/cli_tests/zboxcli_repair_test.go @@ -0,0 +1,93 @@ +package cli_tests + +import ( + "encoding/json" + "fmt" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/0chain/system_test/internal/api/util/test" + "github.com/0chain/system_test/internal/cli/model" + cliutils "github.com/0chain/system_test/internal/cli/util" + "github.com/stretchr/testify/require" +) + +func TestRepairSize(testSetup *testing.T) { + t := test.NewSystemTest(testSetup) + + t.RunSequentiallyWithTimeout("repair size should work", 5 * time.Minute, func(t *test.SystemTest) { + allocSize := int64(1 * MB) + fileSize := int64(512 * KB) + + allocationID := setupAllocation(t, configPath, map[string]interface{}{ + "size": allocSize, + "parity": 1, + "data": 1, + }) + + filename := generateRandomTestFileName(t) + err := createFileWithSize(filename, fileSize) + require.Nil(t, err) + + output, err := uploadFile(t, configPath, map[string]interface{}{ + "allocation": allocationID, + "remotepath": "/", + "localpath": filename, + }, true) + require.Nil(t, err, strings.Join(output, "\n")) + require.Len(t, output, 2) + + expected := fmt.Sprintf( + "Status completed callback. Type = text/plain. Name = %s", + filepath.Base(filename), + ) + require.Equal(t, expected, output[1]) + + output, err = getRepairSize(t, configPath, map[string]interface{}{ + "allocation": allocationID, + "repairpath": "/", + }, true) + require.Nilf(t, err, "error getting repair size: %v", err) + var rs model.RepairSize + err = json.Unmarshal([]byte(output[0]), &rs) + require.Nilf(t, err, "error unmarshal repair size: %v", err) + require.Equal(t, uint64(0), rs.UploadSize, "upload size should be zero") + require.Equal(t, uint64(0), rs.DownloadSize, "download size should be zero") + + // optional repairpath + output, err = getRepairSize(t, configPath, map[string]interface{}{ + "allocation": allocationID, + }, true) + require.Nilf(t, err, "error getting repair size: %v", err) + var rs2 model.RepairSize + err = json.Unmarshal([]byte(output[0]), &rs2) + require.Nilf(t, err, "error unmarshal repair size: %v", err) + require.Equal(t, uint64(0), rs2.UploadSize, "upload size should be zero") + require.Equal(t, uint64(0), rs2.DownloadSize, "download size should be zero") + }) + +} + +func getRepairSize(t *test.SystemTest, cliConfigFilename string, param map[string]interface{}, retry bool) ([]string, error) { + return getRepairSizeForWallet(t, escapedTestName(t), cliConfigFilename, param, retry) +} + +func getRepairSizeForWallet(t *test.SystemTest, wallet, cliConfigFilename string, param map[string]interface{}, retry bool) ([]string, error) { + t.Logf("getting Repair size...") + + p := createParams(param) + cmd := fmt.Sprintf( + "./zbox repair-size %s --silent --wallet %s_wallet.json --configDir ./config --config %s", + p, + wallet, + cliConfigFilename, + ) + + if retry { + return cliutils.RunCommand(t, cmd, 3, time.Second*40) + } else { + return cliutils.RunCommandWithoutRetry(cmd) + } +} \ No newline at end of file From 8e451f9e2c7a02a1362ef741d1ee60540c8a103e Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 14 Jun 2024 14:13:34 +0530 Subject: [PATCH 3/6] update gosdk version --- go.mod | 4 ++-- go.sum | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 6fbabdfc4b..031df856c1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC2 + github.com/0chain/gosdk v1.15.2-0.20240614082721-1b8ad4f48bc6 github.com/go-resty/resty/v2 v2.7.0 github.com/herumi/bls-go-binary v1.31.0 github.com/shopspring/decimal v1.3.1 @@ -23,7 +23,7 @@ require ( github.com/andybalholm/brotli v1.0.5 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/lithammer/shortuuid/v3 v3.0.7 // indirect github.com/minio/sha256-simd v1.0.1 // indirect diff --git a/go.sum b/go.sum index 378c1268f0..c59a4fa573 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM= github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc= github.com/0chain/gosdk v1.14.0-RC2 h1:OIpjj7mDKxVqJVlxJKm8/fPzdJRN5roXO7/plBCtmTg= github.com/0chain/gosdk v1.14.0-RC2/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.15.2-0.20240614082721-1b8ad4f48bc6 h1:f8fN6PuvE/Iu1LqrJH5q20eWOFB/NjlDA8TIDMqZgAg= +github.com/0chain/gosdk v1.15.2-0.20240614082721-1b8ad4f48bc6/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -240,6 +242,7 @@ github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wo github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 h1:FbyIK0BfvXVZTOxKOe2dlxJqSPSF2ZXOv2Mc7dvS7sc= github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= From 5a98103b50ae7584ad8284027d3f1fb3d2576a2d Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 14 Jun 2024 14:28:19 +0530 Subject: [PATCH 4/6] apply gofmt --- internal/cli/model/model.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cli/model/model.go b/internal/cli/model/model.go index 8bdc3a8588..b43542add2 100644 --- a/internal/cli/model/model.go +++ b/internal/cli/model/model.go @@ -736,9 +736,9 @@ type ReadMarker struct { // holds result of repair size type RepairSize struct { // upload size in bytes - UploadSize uint64 `json:"upload_size"` + UploadSize uint64 `json:"upload_size"` // download size in bytes - DownloadSize uint64 `json:"download_size"` + DownloadSize uint64 `json:"download_size"` } var StorageKeySettings = []string{ From 50b905a2ad2b2a8a5a635a55d94e2a5204cc2409 Mon Sep 17 00:00:00 2001 From: Yaroslav Svitlytskyi <53532703+YarikRevich@users.noreply.github.com> Date: Sat, 6 Jul 2024 02:16:59 +0200 Subject: [PATCH 5/6] Feature: migrate from the usage of Tenderly forks in favour of Tenderly virtual testnets for ST (#1078) * feature: performed migration from tenderly forks in favour of tenderly virtual testnets * fix: fixed bugs * fix: fixed bugs * fix: debug * fix: fixed bugs * fix: fixed tenderly rpc call issue * fix: fixed bugs * fix: debug * fix: debug * fix: fixed bugs * fix: fixed bugs * fix: fixed bugs * fix: fixed bugs * fix: fixed bugs --- .../workflows/chimney-and-blobber-tests.yaml | 2 +- .github/workflows/ci-dev-st.yml | 92 +++------------ .github/workflows/ci.yml | 90 ++------------ .../workflows/nightly-challenge-sprint.yaml | 92 ++------------- .github/workflows/nightly-current-sprint.yaml | 90 ++------------ .github/workflows/nightly-cypress-run.yaml | 92 ++------------- .github/workflows/nightly-staging.yml | 111 ++++-------------- .github/workflows/tokenomics_ci.yml | 26 ++-- internal/api/util/tenderly/tenderly.go | 36 +----- 9 files changed, 107 insertions(+), 524 deletions(-) diff --git a/.github/workflows/chimney-and-blobber-tests.yaml b/.github/workflows/chimney-and-blobber-tests.yaml index 8d861a4045..665fe0a7ce 100644 --- a/.github/workflows/chimney-and-blobber-tests.yaml +++ b/.github/workflows/chimney-and-blobber-tests.yaml @@ -48,5 +48,5 @@ jobs: run_smoke_tests: false run_s3mgrt_system_tests: false run_challenge_system_tests: false - TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ secrets.TENDERLY_VIRTUAL_TESTNET_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} diff --git a/.github/workflows/ci-dev-st.yml b/.github/workflows/ci-dev-st.yml index 4c72549ad6..6e28f71912 100644 --- a/.github/workflows/ci-dev-st.yml +++ b/.github/workflows/ci-dev-st.yml @@ -77,83 +77,17 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV - - name: "Parse Tenderly fork creation transaction result" + - name: "Parse Tenderly virtual testnet creation transaction result" run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" - run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV - name: "Deploy 0Chain" if: github.event_name == 'push' || github.event.inputs.existing_network == '' @@ -163,8 +97,16 @@ jobs: kube_config: ${{ secrets[format('DEVSTKC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} + + - name: "Remove Tenderly virtual testnet" + if: always() + run: | + curl -X DELETE \ + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf284351ac..3fbc6b0364 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,83 +121,17 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV - - name: "Parse Tenderly fork creation transaction result" + - name: "Parse Tenderly virtual testnet creation transaction result" run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" - run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV - name: "Deploy 0Chain" if: github.event_name == 'push' || github.event.inputs.existing_network == '' @@ -207,10 +141,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run System tests" @@ -227,20 +161,20 @@ jobs: run_cli_system_tests: true run_tokenomics_system_tests: false test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} run_smoke_tests: ${{ env.RUN_SMOKE_TESTS }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} DROPBOX_ACCESS_TOKEN: ${{ secrets.DROPBOX_ACCESS_TOKEN }} GDRIVE_ACCESS_TOKEN: ${{ secrets.GDRIVE_ACCESS_TOKEN }} - - name: "Remove Tenderly fork" + - name: "Remove Tenderly virtual testnet" if: always() run: | curl -X DELETE \ -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }} + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} - name: "Set PR status as ${{ job.status }}" if: ${{ (success() || failure()) && steps.findPr.outputs.number && github.event.inputs.test_file_filter == '' }} diff --git a/.github/workflows/nightly-challenge-sprint.yaml b/.github/workflows/nightly-challenge-sprint.yaml index 7e8621d534..a7496ada2f 100644 --- a/.github/workflows/nightly-challenge-sprint.yaml +++ b/.github/workflows/nightly-challenge-sprint.yaml @@ -25,83 +25,17 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV - - name: "Parse Tenderly fork creation transaction result" + - name: "Parse Tenderly virtual testnet creation transaction result" run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" - run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -110,10 +44,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run Challenge System tests" @@ -132,17 +66,17 @@ jobs: run_s3mgrt_system_tests: false run_challenge_system_tests: true test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} - - - name: "Remove Tenderly fork" + + - name: "Remove Tenderly virtual testnet" if: always() run: | curl -X DELETE \ -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }} + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} notify_slack_on_failure: runs-on: [self-hosted, arc-runner] diff --git a/.github/workflows/nightly-current-sprint.yaml b/.github/workflows/nightly-current-sprint.yaml index 83e6f62019..c8fa03000f 100644 --- a/.github/workflows/nightly-current-sprint.yaml +++ b/.github/workflows/nightly-current-sprint.yaml @@ -25,83 +25,17 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV - - name: "Parse Tenderly fork creation transaction result" + - name: "Parse Tenderly virtual testnet creation transaction result" run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" - run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -110,10 +44,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run System tests" @@ -130,17 +64,17 @@ jobs: run_tokenomics_system_tests: false run_smoke_tests: false test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} - - name: "Remove Tenderly fork" + - name: "Remove Tenderly virtual testnet" if: always() run: | curl -X DELETE \ -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }} + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} - name: "Check if should send slack notification" if: failure() diff --git a/.github/workflows/nightly-cypress-run.yaml b/.github/workflows/nightly-cypress-run.yaml index 48077861ec..e0d2aea93d 100644 --- a/.github/workflows/nightly-cypress-run.yaml +++ b/.github/workflows/nightly-cypress-run.yaml @@ -32,83 +32,17 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV - - - name: "Parse Tenderly fork creation transaction result" - run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" - run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV + + - name: "Parse Tenderly virtual testnet creation transaction result" + run: | + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -117,19 +51,19 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - - name: "Remove Tenderly fork" + - name: "Remove Tenderly virtual testnet" if: always() run: | curl -X DELETE \ -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }} + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} build-and-push-bolt-docker-image: runs-on: arc-runner diff --git a/.github/workflows/nightly-staging.yml b/.github/workflows/nightly-staging.yml index da0e7fcc28..cc61fc4a36 100644 --- a/.github/workflows/nightly-staging.yml +++ b/.github/workflows/nightly-staging.yml @@ -3,10 +3,10 @@ concurrency: group: "nightly-tests-${{ github.ref }}-${{ github.event_name }}" cancel-in-progress: true on: - schedule: - # Runs every morning at 2am UTC - - cron: '0 2 * * *' - workflow_dispatch: + schedule: + # Runs every morning at 2am UTC + - cron: '0 2 * * *' + workflow_dispatch: jobs: system-tests: @@ -25,83 +25,18 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV - - - name: "Parse Tenderly fork creation transaction result" - run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV + + - name: "Parse Tenderly virtual testnet creation transaction result" run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -110,10 +45,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run System tests" @@ -130,17 +65,17 @@ jobs: run_tokenomics_system_tests: false run_smoke_tests: false test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} - - name: "Remove Tenderly fork" + - name: "Remove Tenderly virtual testnet" if: always() run: | curl -X DELETE \ -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }} + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} - name: "Check if should send slack notification" if: failure() @@ -151,8 +86,8 @@ jobs: default: false notify_slack_on_failure: - runs-on: [self-hosted, arc-runner] - needs: [system-tests] + runs-on: [ self-hosted, arc-runner ] + needs: [ system-tests ] if: always() && (needs.system-tests.result == 'failure') steps: - name: "Notify Slack" @@ -167,10 +102,10 @@ jobs: ] }' curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }} - + notify_slack_on_success: - runs-on: [self-hosted, arc-runner] - needs: [system-tests] + runs-on: [ self-hosted, arc-runner ] + needs: [ system-tests ] if: always() && (needs.system-tests.result == 'success') steps: - name: "Notify Slack" diff --git a/.github/workflows/tokenomics_ci.yml b/.github/workflows/tokenomics_ci.yml index aee1663824..de2819d052 100644 --- a/.github/workflows/tokenomics_ci.yml +++ b/.github/workflows/tokenomics_ci.yml @@ -56,7 +56,7 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/"" @@ -75,7 +75,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.TOKENOMICS_ALLOCATION_TESTS }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} @@ -88,7 +88,7 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/"" @@ -107,7 +107,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.TOKENOMICS_CHALLENGE_REWARD_TESTS }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} @@ -120,7 +120,7 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/"" @@ -139,7 +139,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.TOKENOMICS_ALLOCATION_ADD_OR_REPLACE_BLOBBER_TESTS }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} @@ -152,7 +152,7 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/"" @@ -171,7 +171,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.TOKENOMICS_READ_REWARD_TESTS }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} @@ -189,7 +189,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.TOKENOMICS_SLASH_REWARD_TESTS }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} @@ -202,7 +202,7 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/"" @@ -221,7 +221,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.TOKENOMICS_MIN_STAKE_TESTS }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} @@ -234,7 +234,7 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/"" @@ -253,7 +253,7 @@ jobs: run_cli_system_tests: false run_tokenomics_system_tests: true tokenomics_test_filter: ${{ env.CLIENT_THROTTLING }} - TENDERLY_FORK_ID: "" + TENDERLY_VIRTUAL_TESTNET_ID: "" run_smoke_tests: ${{ inputs.run_smoke_tests }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} diff --git a/internal/api/util/tenderly/tenderly.go b/internal/api/util/tenderly/tenderly.go index fe08ca7d15..aef74976aa 100644 --- a/internal/api/util/tenderly/tenderly.go +++ b/internal/api/util/tenderly/tenderly.go @@ -10,9 +10,8 @@ import ( const InitialBalance = "0x56BC75E2D63100000" // 100 ethers in hex -// Client represents Ethereum client, which -// uses Tenderly fork node to perform snapshots -// and revert changes using requests to EVM +// Client represents Ethereum client, which uses Tenderly fork node to perform snapshots and revert changes using requests +// to EVM. type Client struct { client jsonrpc.RPCClient } @@ -24,35 +23,6 @@ func NewClient(tenderlyNodeURL string) *Client { } } -// CreateSnapshot creates network snapshot with a help of Ethereum JSON-RPC method call. -// Returns snapshot hash, which is available to be used to revert a state of the network -func (c *Client) CreateSnapshot() (string, error) { - resp, err := c.client.Call(context.Background(), "evm_snapshot") - if err != nil { - return "", err - } - if resp.Error != nil { - return "", errors.New(resp.Error.Error()) - } - result, ok := resp.Result.(string) - if !ok { - return "", ErrConversion - } - return result, nil -} - -// Revert reverts a state of Ethereum network using snapshot hash with a help of Ethereum JSON-RPC method call. -func (c *Client) Revert(snapshotHash string) error { - resp, err := c.client.Call(context.Background(), "evm_revert", snapshotHash) - if err != nil { - return err - } - if resp.Error != nil { - return errors.New(resp.Error.Error()) - } - return nil -} - // InitBalance sets pre-defined initial balance for the given ethereum address func (c *Client) InitBalance(ethereumAddress string) error { resp, err := c.client.Call(context.Background(), "tenderly_setBalance", []string{ethereumAddress}, InitialBalance) @@ -67,7 +37,7 @@ func (c *Client) InitBalance(ethereumAddress string) error { // InitErc20Balance sets pre-defined initial balance for the given erc20 token address func (c *Client) InitErc20Balance(tokenAddress, ethereumAddress string) error { - resp, err := c.client.Call(context.Background(), "tenderly_setErc20Balance", tokenAddress, ethereumAddress, InitialBalance) + resp, err := c.client.Call(context.Background(), "tenderly_setErc20Balance", tokenAddress, []string{ethereumAddress}, InitialBalance) if err != nil { return err } From 679cdc7313cc4cbd32141a8b5573744063fbef13 Mon Sep 17 00:00:00 2001 From: Yaroslav Svitlytskyi <53532703+YarikRevich@users.noreply.github.com> Date: Sun, 7 Jul 2024 00:56:42 +0200 Subject: [PATCH 6/6] hotfix: applied tenderly virtual network setup for all the workflows (#1082) --- .github/workflows/chimney-and-blobber-tests.yaml | 2 +- .github/workflows/ci-dev-st.yml | 5 +++-- .github/workflows/ci.yml | 7 ++++--- .github/workflows/nightly-challenge-sprint.yaml | 7 ++++--- .github/workflows/nightly-current-sprint.yaml | 7 ++++--- .github/workflows/nightly-cypress-run.yaml | 5 +++-- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/chimney-and-blobber-tests.yaml b/.github/workflows/chimney-and-blobber-tests.yaml index 665fe0a7ce..a2ba4a55c8 100644 --- a/.github/workflows/chimney-and-blobber-tests.yaml +++ b/.github/workflows/chimney-and-blobber-tests.yaml @@ -48,5 +48,5 @@ jobs: run_smoke_tests: false run_s3mgrt_system_tests: false run_challenge_system_tests: false - TENDERLY_VIRTUAL_TESTNET_ID: ${{ secrets.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: "" svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} diff --git a/.github/workflows/ci-dev-st.yml b/.github/workflows/ci-dev-st.yml index 6e28f71912..a7a24f02b7 100644 --- a/.github/workflows/ci-dev-st.yml +++ b/.github/workflows/ci-dev-st.yml @@ -88,6 +88,7 @@ jobs: - name: "Parse Tenderly virtual testnet creation transaction result" run: | echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" if: github.event_name == 'push' || github.event.inputs.existing_network == '' @@ -97,10 +98,10 @@ jobs: kube_config: ${{ secrets[format('DEVSTKC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Remove Tenderly virtual testnet" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fbc6b0364..5cf539cb58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,6 +132,7 @@ jobs: - name: "Parse Tenderly virtual testnet creation transaction result" run: | echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" if: github.event_name == 'push' || github.event.inputs.existing_network == '' @@ -141,10 +142,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run System tests" @@ -161,7 +162,7 @@ jobs: run_cli_system_tests: true run_tokenomics_system_tests: false test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} run_smoke_tests: ${{ env.RUN_SMOKE_TESTS }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} diff --git a/.github/workflows/nightly-challenge-sprint.yaml b/.github/workflows/nightly-challenge-sprint.yaml index a7496ada2f..68f9ee0581 100644 --- a/.github/workflows/nightly-challenge-sprint.yaml +++ b/.github/workflows/nightly-challenge-sprint.yaml @@ -36,6 +36,7 @@ jobs: - name: "Parse Tenderly virtual testnet creation transaction result" run: | echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -44,10 +45,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run Challenge System tests" @@ -66,7 +67,7 @@ jobs: run_s3mgrt_system_tests: false run_challenge_system_tests: true test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_VIRTUAL_TESTNET_ID: "" + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} diff --git a/.github/workflows/nightly-current-sprint.yaml b/.github/workflows/nightly-current-sprint.yaml index c8fa03000f..7c5179c44f 100644 --- a/.github/workflows/nightly-current-sprint.yaml +++ b/.github/workflows/nightly-current-sprint.yaml @@ -36,6 +36,7 @@ jobs: - name: "Parse Tenderly virtual testnet creation transaction result" run: | echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -44,10 +45,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run System tests" @@ -64,7 +65,7 @@ jobs: run_tokenomics_system_tests: false run_smoke_tests: false test_file_filter: ${{ env.TEST_FILE_FILTER }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} diff --git a/.github/workflows/nightly-cypress-run.yaml b/.github/workflows/nightly-cypress-run.yaml index e0d2aea93d..4854408d1d 100644 --- a/.github/workflows/nightly-cypress-run.yaml +++ b/.github/workflows/nightly-cypress-run.yaml @@ -43,6 +43,7 @@ jobs: - name: "Parse Tenderly virtual testnet creation transaction result" run: | echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -51,10 +52,10 @@ jobs: kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} teardown_condition: "TESTS_PASSED" SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_VIRTUAL_TESTNET_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Remove Tenderly virtual testnet"