Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix: failing tests (#49)
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <[email protected]>
  • Loading branch information
JDawg287 authored Dec 20, 2023
1 parent b155b68 commit 9a32f2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion scripts/send-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ const main = async function (...args: string[]) {
[TOKEN_NAME, TOKEN_SYMBOL, MINT_CAP, DAILY_MINT_LIMIT, INITIAL_SUPPLY]
)
// Deploy token if not previously deployed
await erc20Messaging.deployToken(defaultToken, {
const deployTokenTx = await erc20Messaging.deployToken(defaultToken, {
gasLimit: 5_000_000
})
await deployTokenTx.wait()
// get token address
const token = await erc20Messaging.getTokenBySymbol(TOKEN_SYMBOL)
tokenAddress = token.addr
Expand Down
14 changes: 8 additions & 6 deletions tests/test_cert_inclusion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ set -e

source $LOCAL_ERC20_HOME/tests/utils.sh

export ERC20_MESSAGING_CONTRACT_ADDRESS=$(get_erc20_contract_address)
export TOPOS_CORE_PROXY_CONTRACT_ADDRESS=$(get_topos_core_proxy_contract_address)

function check_certificate_inclusion_with_retry()
{
Expand All @@ -13,14 +11,15 @@ function check_certificate_inclusion_with_retry()
for i in $(seq 1 $1);
do
certificate=$(npx ts-node $LOCAL_ERC20_HOME/scripts/get-certificate http://localhost:$INCAL_HOST_PORT $2)
if [ -z "$certificate" ]; then
if [ -n "$certificate" ]; then
echo 0
return
else
"$(($i+1))"
sleep 5
continue
fi
echo 0
break
done
echo 1
}

network_started=0
Expand All @@ -33,10 +32,13 @@ if [ $is_running -eq 1 ]; then
network_started=1
sleep 5 # Warm up network
fi
export ERC20_MESSAGING_CONTRACT_ADDRESS=$(get_erc20_contract_address)
export TOPOS_CORE_PROXY_CONTRACT_ADDRESS=$(get_topos_core_proxy_contract_address)


# Perform test
echo "Executing certificate inclusion test..."
check_artifacts
incal_subnet_id=$(get_incal_subnet_id)
receipts_root=$(send_token_with_retry 3 $incal_subnet_id $TOPOS_HOST_PORT)
echo "Receipts root hash: $receipts_root"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_transaction_in_certificate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function get_transaction_in_certificate()
awk -F 'transaction_hash: ' '{print $2}' | awk -F ',' '{print $1'} | tail -1)
}

export ERC20_MESSAGING_CONTRACT_ADDRESS=$(get_erc20_contract_address)

network_started=0

Expand All @@ -23,12 +22,13 @@ if [ $is_running -eq 1 ]; then
network_started=1
sleep 5 # Warm up network
fi
export ERC20_MESSAGING_CONTRACT_ADDRESS=$(get_erc20_contract_address)


# Make token transaction
echo "Executing test of transaction inclusion in certificate..."
check_artifacts
topos_subnet_id=$(get_topos_subnet_id)
echo "Topos subnet id is $topos_subnet_id"
tx_hash=$(send_token_with_retry 3 $topos_subnet_id $INCAL_HOST_PORT "txhash")
transaction_valid=$?
echo "Transaction send token result: $transaction_valid, tx hash: $tx_hash"
Expand Down

0 comments on commit 9a32f2e

Please sign in to comment.