Skip to content

Commit

Permalink
chore: added utils to test method routing (#1780)
Browse files Browse the repository at this point in the history
* added utils to test method routing

* added osmosis to policy
  • Loading branch information
omerlavanet authored Dec 3, 2024
1 parent 100ba7e commit 70bfa01
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ endpoints:
- api-interface: tendermintrpc
chain-id: LAV1
network-address:
address: "127.0.0.1:2220"
address: "127.0.0.1:2224"
node-urls:
- url: ws://127.0.0.1:26657/websocket
- url: http://127.0.0.1:26657
- url: http://127.0.0.1:26657
addons:
- archive
- url: https://trustless-api.com
- url: http://127.0.0.1:4444
methods:
- block
- block_by_hash
Expand All @@ -18,7 +18,7 @@ endpoints:
- api-interface: grpc
chain-id: LAV1
network-address:
address: "127.0.0.1:2220"
address: "127.0.0.1:2224"
node-urls:
- url: 127.0.0.1:9090
- url: 127.0.0.1:9090
Expand All @@ -27,7 +27,7 @@ endpoints:
- api-interface: rest
chain-id: LAV1
network-address:
address: "127.0.0.1:2220"
address: "127.0.0.1:2224"
node-urls:
- url: http://127.0.0.1:1317
- url: http://127.0.0.1:1317
Expand Down
20 changes: 20 additions & 0 deletions cookbook/projects/policy_all_chains_with_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,26 @@ Policy:
extensions:
- "archive"
mixed: true
- chain_id: OSMOSIS
requirements:
- collection:
api_interface: "rest"
type: "GET"
extensions:
- "archive"
mixed: true
- collection:
api_interface: "grpc"
type: ""
extensions:
- "archive"
mixed: true
- collection:
api_interface: "tendermintrpc"
type: ""
extensions:
- "archive"
mixed: true
- chain_id: COSMOSHUB
requirements:
- collection:
Expand Down
6 changes: 5 additions & 1 deletion scripts/init_chain_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PROVIDERSTAKE="500000000000ulava"
PROVIDER1_LISTENER="127.0.0.1:2221"
PROVIDER2_LISTENER="127.0.0.1:2222"
PROVIDER3_LISTENER="127.0.0.1:2223"
# PROVIDER4_LISTENER="127.0.0.1:2224"

sleep 4

Expand All @@ -67,7 +68,7 @@ lavad tx gov vote $(latest_vote) yes -y --from alice --gas-adjustment "1.5" --ga
echo; echo "#### Buy DefaultPlan subscription for user1 ####"
lavad tx subscription buy DefaultPlan $(lavad keys show user1 -a) --enable-auto-renewal -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
# wait_count_blocks 2
# lavad tx project set-policy $(lavad keys show user1 -a)-admin ./cookbook/projects/policy_all_chains_with_addon.yml -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
# lavad tx project set-policy $(lavad keys show user1 -a)-admin ./cookbook/projects/policy_all_chains_with_extension.yml -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

# MANTLE
CHAINS="ETH1,SEP1,HOL1,OSMOSIS,FTM250,CELO,LAV1,OSMOSIST,ALFAJORES,ARB1,ARBN,APT1,STRK,JUN1,COSMOSHUB,POLYGON1,EVMOS,OPTM,BASES,CANTO,SUIT,SOLANA,BSC,AXELAR,AVAX,FVM,NEAR,SQDSUBGRAPH,AGR,AGRT,KOIIT,AVAXT,CELESTIATM"
Expand All @@ -82,6 +83,9 @@ lavad tx pairing bulk-stake-provider $BASE_CHAINS $PROVIDERSTAKE "$PROVIDER2_LIS
echo; echo "#### Staking provider 3 ####"
lavad tx pairing bulk-stake-provider $BASE_CHAINS $PROVIDERSTAKE "$PROVIDER3_LISTENER,1" 1 $(operator_address) -y --delegate-commission 50 --from servicer3 --provider-moniker "servicer3" --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

# echo; echo "#### Staking provider 4 ####"
# lavad tx pairing bulk-stake-provider $BASE_CHAINS $PROVIDERSTAKE "$PROVIDER4_LISTENER,1" 1 $(operator_address) -y --delegate-commission 50 --from servicer4 --provider-moniker "servicer4" --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE

echo; echo "#### Waiting 1 block ####"
wait_count_blocks 1

Expand Down
9 changes: 7 additions & 2 deletions scripts/test/httpServer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
import sys

payload_ret = "OK"

class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.print_request()
Expand All @@ -26,10 +28,11 @@ def print_request(self):
print(f"Body:\n{body.decode('utf-8')}")

# Send a response back to the client
response = payload_ret.encode('utf-8')
self.send_response(200)
self.send_header("Content-type", "text/html")
self.send_header("Content-type", "application/json")
self.end_headers()
self.wfile.write(b"OK")
self.wfile.write(response)

def run_server(port=8000):
server_address = ('', port)
Expand All @@ -40,6 +43,8 @@ def run_server(port=8000):
if __name__ == '__main__':
if len(sys.argv) > 1:
port = int(sys.argv[1])
if len(sys.argv) > 2:
payload_ret = sys.argv[2]
run_server(port)
else:
run_server()

0 comments on commit 70bfa01

Please sign in to comment.