Skip to content

Commit

Permalink
Refactor Obscuroscan to Tenscan
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Dec 21, 2023
1 parent 952a281 commit 06ecc56
Show file tree
Hide file tree
Showing 241 changed files with 98 additions and 7,744 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ go/enclave/main/main
tools/walletextension/main/main
tools/walletextension/main/wallet_extension
tools/networkmanager/main/main
tools/obscuroscan/main/main
tools/tenscan/main/main
**/node_modules/
**/dist
.git
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
integration/.build/wallet_extension/wal-ext-*.txt
integration/.build/eth2/*
integration/.build/faucet/*
integration/.build/obscuroscan/*
integration/.build/tenscan/*
integration/.build/tengateway/*
retention-days: 1

Expand Down
85 changes: 0 additions & 85 deletions .github/workflows/manual-deploy-obscuro-scan-2.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Deploys Tenscan on Azure for Testnet
# Builds the Tenscan image, pushes the image to dockerhub and starts the Tenscan on Azure

name: "[M] Deploy Tenscan 3 Testnet"
name: "[M] Deploy Tenscan Testnet"
run-name: "[M] Deploy Tenscan Testnet ( ${{ github.event.inputs.testnet_type }} )"
on:
workflow_dispatch:
Expand Down Expand Up @@ -46,21 +46,21 @@ jobs:

- name: Build and Push Docker FE Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_SCAN_FE }} -f ./tools/obscuroscan_v3/frontend/Dockerfile .
DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_SCAN_FE }} -f ./tools/tenscan/frontend/Dockerfile .
docker push ${{ vars.DOCKER_BUILD_TAG_SCAN_FE }}
- name: Build and Push Docker API Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_SCAN_API }} -f ./tools/obscuroscan_v2/backend/Dockerfile .
DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_SCAN_API }} -f ./tools/tenscan/backend/Dockerfile .
docker push ${{ vars.DOCKER_BUILD_TAG_SCAN_API }}
- name: "Deploy FE to Azure Container Instances"
uses: "azure/aci-deploy@v1"
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-obscuro-scan-v3
dns-name-label: ${{ github.event.inputs.testnet_type }}-ten-scan
image: ${{ vars.DOCKER_BUILD_TAG_SCAN_FE }}
name: ${{ github.event.inputs.testnet_type }}-fe-obscuro-scan-v3
name: ${{ github.event.inputs.testnet_type }}-fe-ten-scan
location: "uksouth"
restart-policy: "Never"
environment-variables: NEXT_PUBLIC_API_HOST=https://${{ github.event.inputs.testnet_type }}-api.obscuroscan.io NEXT_PUBLIC_FE_VERSION=${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }}
Expand All @@ -73,9 +73,9 @@ jobs:
uses: "azure/aci-deploy@v1"
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-api-obscuro-scan-v3
dns-name-label: ${{ github.event.inputs.testnet_type }}-api-ten-scan
image: ${{ vars.DOCKER_BUILD_TAG_SCAN_API }}
name: ${{ github.event.inputs.testnet_type }}-api-obscuro-scan-v3
name: ${{ github.event.inputs.testnet_type }}-api-ten-scan
location: "uksouth"
restart-policy: "Never"
command-line: ./cmd/backend --nodeHostAddress http://${{ vars.L2_RPC_URL_VALIDATOR }}:80 --serverAddress 0.0.0.0:80
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tools/walletextension/main/main
tools/walletextension/bin/**
tools/walletextension/main/wallet_extension
tools/networkmanager/main/main
tools/obscuroscan/main/main
tools/tenscan/main/main
integration/eth2network/main/main


Expand All @@ -44,7 +44,7 @@ integration/eth2network/main/main
**/enclave_logs.txt
**/host_logs.txt
**/wallet_extension_logs.txt
**/obscuroscan_logs.txt
**/tenscan_logs.txt

# Temp env files
testnet/.env
Expand Down
4 changes: 2 additions & 2 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ sidebar-list:

- title: Tools
children:
- title: ObscuroScan
url: testnet/obscuroscan
- title: Tenscan
url: testnet/tenscan
- title: Token Faucet
url: testnet/faucet

Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/testnet/deploying-a-smart-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Congratulations, your smart contract is now deployed to Ten Testnet!
Because Ten provides full privacy, the details of your transaction are encrypted and only visible to you, as the holder of your wallet's private key.

Now head over to the [TenScan page](https://docs.obscu.ro/testnet/obscuroscan/) to see how you can view the transaction details.
Now head over to the [TenScan page](https://docs.obscu.ro/testnet/tenscan/) to see how you can view the transaction details.
2 changes: 1 addition & 1 deletion go/common/httputil/httputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func ExecuteHTTPReq(client *http.Client, req *http.Request) ([]byte, error) {
return body, nil
}

// EnableCORS Allows Obscuroscan and WalletExtension APIs to serve other web apps via CORS.
// EnableCORS Allows Tenscan and WalletExtension APIs to serve other web apps via CORS.
func EnableCORS(resp http.ResponseWriter, req *http.Request) bool {
resp.Header().Set(CorsAllowOrigin, OriginAll)
if (*req).Method == ReqOptions {
Expand Down
2 changes: 1 addition & 1 deletion go/common/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
WalletExtCmp = "wallet_extension"
TestGethNetwCmp = "test_geth_network"
EthereumL1Cmp = "l1_host"
ObscuroscanCmp = "obscuroscan"
TenscanCmp = "tenscan"
CrossChainCmp = "cross_chain"
)

Expand Down
20 changes: 10 additions & 10 deletions go/host/container/host_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import (
)

const (
APIVersion1 = "1.0"
APINamespaceObscuro = "obscuro"
APINamespaceEth = "eth"
APINamespaceObscuroScan = "obscuroscan"
APINamespaceScan = "scan"
APINamespaceNetwork = "net"
APINamespaceTest = "test"
APINamespaceDebug = "debug"
APIVersion1 = "1.0"
APINamespaceObscuro = "obscuro"
APINamespaceEth = "eth"
APINamespaceTenScan = "tenscan"
APINamespaceScan = "scan"
APINamespaceNetwork = "net"
APINamespaceTest = "test"
APINamespaceDebug = "debug"
)

type HostContainer struct {
Expand Down Expand Up @@ -173,9 +173,9 @@ func NewHostContainer(cfg *config.HostConfig, services *host.ServicesRegistry, p
Public: true,
},
{
Namespace: APINamespaceObscuroScan,
Namespace: APINamespaceTenScan,
Version: APIVersion1,
Service: clientapi.NewObscuroScanAPI(h),
Service: clientapi.NewTenScanAPI(h),
Public: true,
},
{
Expand Down
20 changes: 10 additions & 10 deletions go/host/rpc/clientapi/client_api_obscuroscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import (

const txLimit = 100

// ObscuroScanAPI implements ObscuroScan-specific JSON RPC operations.
type ObscuroScanAPI struct {
// TenScanAPI implements TenScan-specific JSON RPC operations.
type TenScanAPI struct {
host host.Host
}

func NewObscuroScanAPI(host host.Host) *ObscuroScanAPI {
return &ObscuroScanAPI{
func NewTenScanAPI(host host.Host) *TenScanAPI {
return &TenScanAPI{
host: host,
}
}

// GetBlockHeaderByHash returns the header for the block with the given hash.
func (api *ObscuroScanAPI) GetBlockHeaderByHash(blockHash gethcommon.Hash) (*types.Header, error) {
func (api *TenScanAPI) GetBlockHeaderByHash(blockHash gethcommon.Hash) (*types.Header, error) {
blockHeader, err := api.host.DB().GetBlockByHash(blockHash)
if err != nil {
if errors.Is(err, errutil.ErrNotFound) {
Expand All @@ -41,12 +41,12 @@ func (api *ObscuroScanAPI) GetBlockHeaderByHash(blockHash gethcommon.Hash) (*typ

// GetBatch returns the batch with the given hash. Unlike `EthereumAPI.GetBlockByHash()`, returns the full
// `ExtBatch`, and not just the header.
func (api *ObscuroScanAPI) GetBatch(batchHash gethcommon.Hash) (*common.ExtBatch, error) {
func (api *TenScanAPI) GetBatch(batchHash gethcommon.Hash) (*common.ExtBatch, error) {
return api.host.DB().GetBatch(batchHash)
}

// GetBatchForTx returns the batch containing a given transaction hash.
func (api *ObscuroScanAPI) GetBatchForTx(txHash gethcommon.Hash) (*common.ExtBatch, error) {
func (api *TenScanAPI) GetBatchForTx(txHash gethcommon.Hash) (*common.ExtBatch, error) {
batchNumber, err := api.host.DB().GetBatchNumber(txHash)
if err != nil {
return nil, fmt.Errorf("could not retrieve batch containing a transaction with hash %s. Cause: %w", txHash, err)
Expand All @@ -62,7 +62,7 @@ func (api *ObscuroScanAPI) GetBatchForTx(txHash gethcommon.Hash) (*common.ExtBat

// GetLatestTransactions returns the hashes of the latest `num` transactions confirmed in batches (or all the
// transactions if there are less than `num` total transactions).
func (api *ObscuroScanAPI) GetLatestTransactions(num int) ([]gethcommon.Hash, error) {
func (api *TenScanAPI) GetLatestTransactions(num int) ([]gethcommon.Hash, error) {
// We prevent someone from requesting an excessive amount of transactions.
if num > txLimit {
return nil, fmt.Errorf("cannot request more than 100 latest transactions")
Expand Down Expand Up @@ -105,11 +105,11 @@ func (api *ObscuroScanAPI) GetLatestTransactions(num int) ([]gethcommon.Hash, er
}

// GetTotalTransactions returns the number of recorded transactions on the network.
func (api *ObscuroScanAPI) GetTotalTransactions() (*big.Int, error) {
func (api *TenScanAPI) GetTotalTransactions() (*big.Int, error) {
return api.host.DB().GetTotalTransactions()
}

// Attestation returns the node's attestation details.
func (api *ObscuroScanAPI) Attestation() (*common.AttestationReport, error) {
func (api *TenScanAPI) Attestation() (*common.AttestationReport, error) {
return api.host.EnclaveClient().Attestation()
}
12 changes: 6 additions & 6 deletions go/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const (
Health = "obscuro_health"
Config = "obscuro_config"

GetBlockHeaderByHash = "obscuroscan_getBlockHeaderByHash"
GetBatch = "obscuroscan_getBatch"
GetBatchForTx = "obscuroscan_getBatchForTx"
GetLatestTxs = "obscuroscan_getLatestTransactions"
GetTotalTxs = "obscuroscan_getTotalTransactions"
Attestation = "obscuroscan_attestation"
GetBlockHeaderByHash = "tenscan_getBlockHeaderByHash"
GetBatch = "tenscan_getBatch"
GetBatchForTx = "tenscan_getBatchForTx"
GetLatestTxs = "tenscan_getLatestTransactions"
GetTotalTxs = "tenscan_getTotalTransactions"
Attestation = "tenscan_attestation"
StopHost = "test_stopHost"
Subscribe = "eth_subscribe"
Unsubscribe = "eth_unsubscribe"
Expand Down
20 changes: 10 additions & 10 deletions integration/obscuroscan/obscuroscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/ten-protocol/go-ten/tools/tenscan/backend/config"
"github.com/ten-protocol/go-ten/tools/tenscan/backend/container"
"math/big"
"net/http"
"strings"
Expand All @@ -19,8 +21,6 @@ import (
"github.com/ten-protocol/go-ten/go/rpc"
"github.com/ten-protocol/go-ten/go/wallet"
"github.com/ten-protocol/go-ten/integration/datagenerator"
"github.com/ten-protocol/go-ten/tools/obscuroscan_v2/backend/config"
"github.com/ten-protocol/go-ten/tools/obscuroscan_v2/backend/container"
"github.com/valyala/fasthttp"

"github.com/ethereum/go-ethereum/log"
Expand All @@ -36,31 +36,31 @@ import (
func init() { //nolint:gochecknoinits
testlog.Setup(&testlog.Cfg{
LogDir: testLogs,
TestType: "obscuroscan",
TestType: "tenscan",
TestSubtype: "test",
LogLevel: log.LvlInfo,
})
}

const (
testLogs = "../.build/obscuroscan/"
testLogs = "../.build/tenscan/"
)

func TestObscuroscan(t *testing.T) {
func TestTenscan(t *testing.T) {
startPort := integration.StartPortTenscanUnitTest
createObscuroNetwork(t, startPort)

obsScanConfig := &config.Config{
tenScanConfig := &config.Config{
NodeHostAddress: fmt.Sprintf("http://127.0.0.1:%d", startPort+integration.DefaultHostRPCHTTPOffset),
ServerAddress: fmt.Sprintf("127.0.0.1:%d", startPort+integration.DefaultTenscanHTTPPortOffset),
LogPath: "sys_out",
}
serverAddress := fmt.Sprintf("http://%s", obsScanConfig.ServerAddress)
serverAddress := fmt.Sprintf("http://%s", tenScanConfig.ServerAddress)

obsScanContainer, err := container.NewObscuroScanContainer(obsScanConfig)
tenScanContainer, err := container.NewTenScanContainer(tenScanConfig)
require.NoError(t, err)

err = obsScanContainer.Start()
err = tenScanContainer.Start()
require.NoError(t, err)

// wait for the msg bus contract to be deployed
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestObscuroscan(t *testing.T) {
assert.NotEqual(t, configFetchObj.Item.SequencerID, gethcommon.Address{})

// Gracefully shutdown
err = obsScanContainer.Stop()
err = tenScanContainer.Stop()
assert.NoError(t, err)
}

Expand Down
Loading

0 comments on commit 06ecc56

Please sign in to comment.