Skip to content
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
15 changes: 8 additions & 7 deletions test/e2e-go/cli/goal/expect/goalExpectCommon.exp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ proc ::AlgorandGoal::AccountTransfer { FROM_WALLET_NAME FROM_WALLET_PASSWORD FRO
set TRANSACTION_ID "NOT SET"
spawn goal clerk send --fee $FEE_AMOUNT --wallet $FROM_WALLET_NAME --amount $TRANSFER_AMOUNT --from $FROM_ACCOUNT_ADDRESS --to $TO_ACCOUNT_ADDRESS -d $TEST_PRIMARY_NODE_DIR -N
expect {
timeout { close; ::AlgorandGoal::Abort "Timed out transfering funds" }
timeout { close; ::AlgorandGoal::Abort "Timed out transferring funds" }
"Please enter the password for wallet '$FROM_WALLET_NAME':" { send "$FROM_WALLET_PASSWORD\r" }
-re {transaction ID: ([A-Z0-9]{52})} {set TRANSACTION_ID $expect_out(1,string); close }
}
Expand Down Expand Up @@ -309,7 +309,7 @@ proc ::AlgorandGoal::WaitForAccountBalance { WALLET_NAME ACCOUNT_ADDRESS EXPECTE
if { $ACCOUNT_BALANCE == $EXPECTED_BALANCE } {
puts "Account balance OK: $ACCOUNT_BALANCE"; break
} else {
puts "Account balance: ''$ACCOUNT_BALANCE' does not match expected balance: '$EXPECTED_BALANCE'"
puts "Account balance: '$ACCOUNT_BALANCE' does not match expected balance: '$EXPECTED_BALANCE'"
if { $i >= 10 } then { ::AlgorandGoal::Abort "Account balance $ACCOUNT_BALANCE does not match expected amount: $EXPECTED_BALANCE"; break;}
}
}
Expand All @@ -336,26 +336,26 @@ proc ::AlgorandGoal::AssetCreate { CREATOR WALLET_NAME WALLET_PASSWORD TOTAL_SUP
# Transfer asset
proc ::AlgorandGoal::AssetTransfer { WALLET_NAME WALLET_PASSWORD FROM_ADDR TO_ADDR ASSET_ID ASSET_AMOUNT TEST_PRIMARY_NODE_DIR} {
if { [ catch {
spawn goal asset send -d $TEST_PRIMARY_NODE_DIR -w $WALLET_NAME --from $FROM_ADDR --to $TO_ADDR --assetid $ASSET_ID --amount $ASSET_AMOUNT
spawn goal asset send -d $TEST_PRIMARY_NODE_DIR -w $WALLET_NAME --from $FROM_ADDR --to $TO_ADDR --assetid $ASSET_ID --amount $ASSET_AMOUNT
expect {
timeout { ::AlgorandGoal::Abort "Timed out asset transfer" }
"Please enter the password for wallet '$WALLET_NAME':" { send "$WALLET_PASSWORD\r" }
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in AsssetTransfer: $EXCEPTION"
::AlgorandGoal::Abort "ERROR in AssetTransfer: $EXCEPTION"
}
}

# write asset transfer to a txn file
proc ::AlgorandGoal::CreateAssetTransfer { FROM_ADDR TO_ADDR ASSET_ID ASSET_AMOUNT TEST_PRIMARY_NODE_DIR TXN_OUTPUT} {
if { [ catch {
spawn goal asset send -d $TEST_PRIMARY_NODE_DIR --from $FROM_ADDR --to $TO_ADDR --assetid $ASSET_ID --amount $ASSET_AMOUNT -o $TXN_OUTPUT
spawn goal asset send -d $TEST_PRIMARY_NODE_DIR --from $FROM_ADDR --to $TO_ADDR --assetid $ASSET_ID --amount $ASSET_AMOUNT -o $TXN_OUTPUT
expect {
timeout { ::AlgorandGoal::Abort "Timed out creating asset transfer transaction" }
close
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in CreateAsssetTransfer: $EXCEPTION"
::AlgorandGoal::Abort "ERROR in CreateAssetTransfer: $EXCEPTION"
}
}

Expand Down Expand Up @@ -462,6 +462,7 @@ proc ::AlgorandGoal::SignTransaction { WALLET_NAME WALLET_PASSWORD INPUT_TXN OUT

# Raw send
proc ::AlgorandGoal::RawSend { TXN_FILE TEST_PRIMARY_NODE_DIR } {
set timeout 30
if { [ catch {
set TRANSACTION_ID "NOT SET"
spawn goal clerk rawsend -f $TXN_FILE -d $TEST_PRIMARY_NODE_DIR
Expand Down Expand Up @@ -669,7 +670,7 @@ proc ::AlgorandGoal::Report { TEST_PRIMARY_NODE_DIR } {
timeout { ::AlgorandGoal::Abort "goal report timed out" }
"source code available at https://github.com/algorand/go-algorand" {puts "goal -v ok"}
-re {Genesis ID from genesis.json: *} {puts "genesis ID from genesis.json ok"}
-re {Last commited block: (\d+)} {puts "status check ok"}
-re {Last committed block: (\d+)} {puts "status check ok"}
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in Report: $EXCEPTION"
Expand Down
19 changes: 9 additions & 10 deletions test/e2e-go/cli/goal/expect/limitOrderTest.exp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if { [catch {
::AlgorandGoal::VerifyAccount $WALLET_2_NAME $WALLET_2_PASSWORD $ACCOUNT_2_ADDRESS $TEST_PRIMARY_NODE_DIR

# -------------------------- setup accounts ----------------------------------

# Transfer Algos from primary account to account 1
set MIN_BALANCE 1000000
set TRANSFER_AMOUNT [expr {1000 * $MIN_BALANCE}]
Expand Down Expand Up @@ -99,7 +99,6 @@ if { [catch {

# allow account 2 to accept this asset by sending 0 duckcoin to self
::AlgorandGoal::AssetTransfer $WALLET_2_NAME $WALLET_2_PASSWORD $ACCOUNT_2_ADDRESS $ACCOUNT_2_ADDRESS $ASSET_ID 0 $TEST_PRIMARY_NODE_DIR


# -------------------------- generate teal form template ----------------------------------

Expand All @@ -108,7 +107,7 @@ if { [catch {
puts "Current Dir: $WORK_DIR"
set TEAL_DIR "$TEST_DATA_DIR/../../tools/teal"
cd $TEAL_DIR

# generate teal assembly
set SWAP_N 3
set SWAP_D 2
Expand All @@ -124,14 +123,14 @@ if { [catch {
expect {
-re {^.+$} { close }
}

# compile teal assembly to bytecode
set CONTRACT_HASH [::AlgorandGoal::TealCompile $TEAL_SOURCE]

# -------------------------- limit order ----------------------------------

# initialize the escrow by sending 1000000 microAlgos into it
set CONTRACT_MICRO_ALGO 200000
set CONTRACT_MICRO_ALGO 200000
set TRANSACTION_ID [::AlgorandGoal::AccountTransfer $PRIMARY_WALLET_NAME "" $PRIMARY_ACCOUNT_ADDRESS $CONTRACT_MICRO_ALGO $CONTRACT_HASH $FEE_AMOUNT $TEST_PRIMARY_NODE_DIR]
puts "Fund contract account on transaction $TRANSACTION_ID"

Expand All @@ -151,15 +150,15 @@ if { [catch {

set LIMIT_CMB "$TEST_ROOT_DIR/limitcmb.tx"
exec cat $LIMIT_TXN_1 $LIMIT_TXN_2 > $LIMIT_CMB

set GROUP_TX_UNSIGNED "$TEST_ROOT_DIR/limitgrp.tx"
::AlgorandGoal::AssembleGroup $LIMIT_CMB $GROUP_TX_UNSIGNED

# Bob must sign his half of the transaction (Alice's half is authorized by the logic program's escrow)
# we must resplit the transaction (but this time they have the group fields set correctly)

set RAW_TX "$TEST_ROOT_DIR/limitraw.tx"
exec goal clerk split -i $GROUP_TX_UNSIGNED -o $RAW_TX
exec goal clerk split -i $GROUP_TX_UNSIGNED -o $RAW_TX

set RAW_TX_0 "$TEST_ROOT_DIR/limitraw-0.tx"
set RAW_TX_1 "$TEST_ROOT_DIR/limitraw-1.tx"
Expand All @@ -170,15 +169,15 @@ if { [catch {
after 3000 set stop_wait &
vwait stop_wait
unset stop_wait

# regroup the transactions and send the combined signed transactions to the network
set LIMIT_STX "$TEST_ROOT_DIR/limitraw.stx"
exec cat $RAW_TX_0 $RAW_STX_1 > $LIMIT_STX
puts "Assembled signed group txn."

set RAW_TRANSACTION_ID [::AlgorandGoal::RawSend $LIMIT_STX $TEST_PRIMARY_NODE_DIR]
puts "send limit order transaction in $RAW_TRANSACTION_ID"

# Shutdown the network
::AlgorandGoal::StopNetwork $NETWORK_NAME $TEST_ALGO_DIR $TEST_ROOT_DIR

Expand Down