Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinaNikolaevaa committed Mar 7, 2024
1 parent 47ebbf4 commit d66995c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
- auto
env:
NETWORK: ${{ github.event.inputs.network || 'terraform' }}
NUMPROCESSES: ${{ github.event.inputs.numprocesses || 4 }}
NUMPROCESSES: ${{ github.event.inputs.numprocesses || 8 }}
BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
SOLANA_URL: "${{ secrets.SOLANA_URL }}"
IMAGE: neonlabsorg/neon_tests
Expand Down Expand Up @@ -97,6 +97,7 @@ jobs:
env:
SOLANA_IP: ${{ needs.prepare-env.outputs.solana_ip }}
PROXY_IP: ${{ needs.prepare-env.outputs.proxy_ip }}
NETWORK: ${{ needs.prepare-env.outputs.network }}
if: |
always() &&
!contains(needs.*.result, 'failure') &&
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dapps.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dApps testing
run-name: dApps testing (${{ github.event.inputs.dapps || 'all dapps'}}, ${{ github.event.inputs.network || 'aws' }})
run-name: dApps testing (${{ github.event.inputs.dapps || 'all dapps'}}, ${{ github.event.inputs.network || 'terraform' }})

on:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openzeppelin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "OpenZeppelin"
name: "OpenZeppelin / ${{ github.event.inputs.network || 'night-stand' }}"

on:
schedule:
Expand Down
9 changes: 6 additions & 3 deletions deploy/cli/dapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
from paramiko.client import SSHClient

from deploy.cli.infrastructure import upload_service_logs, get_solana_accounts_in_tx
from deploy.cli.network_manager import NetworkManager

from utils.web3client import NeonChainWeb3Client
from utils.prices import get_neon_price


WEB3_CLIENT = NeonChainWeb3Client(os.environ.get("PROXY_URL"))
REPORT_HEADERS = ["Action", "Fee", "Cost in $", "Accounts", "TRx", "Estimated Gas", "Used Gas", "Used % of EG"]
NETWORK_MANAGER = NetworkManager()


def set_github_env(envs: tp.Dict, upper=True) -> None:
"""Set environment for github action"""
"""Set environment for GitHub action"""
path = os.getenv("GITHUB_ENV", str())
if os.path.exists(path):
with open(path, "a") as env_file:
Expand Down Expand Up @@ -56,6 +57,8 @@ def download_remote_docker_logs():


def prepare_report_data(directory):
proxy_url = NETWORK_MANAGER.get_network_param(os.environ.get("NETWORK"), "proxy_url")
web3_client = NeonChainWeb3Client(proxy_url)
out = {}
reports = {}
for path in glob.glob(str(pathlib.Path(directory) / "*-report.json")):
Expand All @@ -73,7 +76,7 @@ def prepare_report_data(directory):
out[app] = []
for action in reports[app]:
accounts, trx = get_solana_accounts_in_tx(action["tx"])
tx = WEB3_CLIENT.get_transaction_by_hash(action["tx"])
tx = web3_client.get_transaction_by_hash(action["tx"])
estimated_gas = int(tx.gas) if tx and tx.gas else None
used_gas = int(action["usedGas"])
row = [action["name"]]
Expand Down
11 changes: 6 additions & 5 deletions deploy/cli/infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

WEB3_CLIENT = NeonChainWeb3Client(os.environ.get("PROXY_URL"))
REPORT_HEADERS = ["Action", "Fee", "Cost in $", "Accounts", "TRx", "Estimated Gas", "Used Gas", "Used % of EG"]

NETWORK_MANAGER = NetworkManager()

def set_github_env(envs: tp.Dict, upper=True) -> None:
"""Set environment for github action"""
Expand Down Expand Up @@ -134,8 +134,7 @@ def upload_service_logs(ssh_client, service, artifact_logs):


def prepare_accounts(network_name, count, amount) -> tp.List:
network_manager = NetworkManager()
network = network_manager.get_network_object(network_name)
network = NETWORK_MANAGER.get_network_object(network_name)
accounts = faucet_cli.prepare_wallets_with_balance(network, count, amount)
if os.environ.get("CI"):
set_github_env(dict(accounts=",".join(accounts)))
Expand All @@ -144,9 +143,11 @@ def prepare_accounts(network_name, count, amount) -> tp.List:

def get_solana_accounts_in_tx(eth_transaction):
network = os.environ.get("NETWORK")
solana_url = NetworkManager().get_network_param(network, "solana_url")
solana_url = NETWORK_MANAGER.get_network_param(network, "solana_url")
proxy_url = NETWORK_MANAGER.get_network_param(network, "proxy_url")
sol_client = SolanaClient(solana_url)
trx = WEB3_CLIENT.get_solana_trx_by_neon(eth_transaction)
web3_client = NeonChainWeb3Client(proxy_url)
trx = web3_client.get_solana_trx_by_neon(eth_transaction)
tr = sol_client.get_transaction(Signature.from_string(trx["result"][0]), max_supported_transaction_version=0)
if tr.value.transaction.transaction.message.address_table_lookups:
alt = tr.value.transaction.transaction.message.address_table_lookups
Expand Down

0 comments on commit d66995c

Please sign in to comment.