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
3 changes: 2 additions & 1 deletion cmd/goal/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@ var listParticipationKeysCmd = &cobra.Command{
if err == nil {
votingBytes := parts[fn].Voting.OneTimeSignatureVerifier
vrfBytes := parts[fn].VRF.PK
if string(onlineAccountInfo.Participation.ParticipationPK) == string(votingBytes[:]) &&
if onlineAccountInfo.Participation != nil &&
(string(onlineAccountInfo.Participation.ParticipationPK) == string(votingBytes[:])) &&
(string(onlineAccountInfo.Participation.VRFPK) == string(vrfBytes[:])) &&
(onlineAccountInfo.Participation.VoteFirst == uint64(parts[fn].FirstValid)) &&
(onlineAccountInfo.Participation.VoteLast == uint64(parts[fn].LastValid)) &&
Expand Down
44 changes: 43 additions & 1 deletion test/e2e-go/cli/goal/expect/goalExpectCommon.exp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ namespace eval ::AlgorandGoal {
namespace export GetLedgerSupply
namespace export WaitForRound
namespace export Report
namespace export ListParticipationKeys
namespace export AddParticipationKey
namespace export TakeAccountOnline

# My Variables
set version 1.0
Expand Down Expand Up @@ -669,6 +672,45 @@ proc ::AlgorandGoal::Report { TEST_PRIMARY_NODE_DIR } {
-re {Last commited block: (\d+)} {puts "status check ok"}
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in GetLedgerSupply: $EXCEPTION"
::AlgorandGoal::Abort "ERROR in Report: $EXCEPTION"
}
}

# List Participation keys
proc ::AlgorandGoal::ListParticipationKeys { TEST_PRIMARY_NODE_DIR } {
if { [ catch {
spawn goal account listpartkeys -d $TEST_PRIMARY_NODE_DIR
expect {
timeout { ::AlgorandGoal::Abort "goal ListParticipationKeys timed out" }
close
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in ListParticipationKeys: $EXCEPTION"
}
}

# Add a participation key
proc ::AlgorandGoal::AddParticipationKey { ADDRESS FIRST_ROUND LAST_ROUND TEST_PRIMARY_NODE_DIR } {
if { [ catch {
spawn goal account addpartkey --address $ADDRESS --roundFirstValid $FIRST_ROUND --roundLastValid $LAST_ROUND -d $TEST_PRIMARY_NODE_DIR
expect {
timeout { ::AlgorandGoal::Abort "goal AddParticipationKey timed out" }
close
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in AddParticipationKey: $EXCEPTION"
}
}

# Register online participation with a given account
proc ::AlgorandGoal::TakeAccountOnline { ADDRESS FIRST_ROUND LAST_ROUND TEST_PRIMARY_NODE_DIR } {
if { [ catch {
spawn goal account changeonlinestatus --address $ADDRESS --firstvalid $FIRST_ROUND --lastvalid $LAST_ROUND -d datadir
expect {
timeout { ::AlgorandGoal::Abort "goal TakeAccountOnline timed out" }
close
}
} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in TakeAccountOnline: $EXCEPTION"
}
}
51 changes: 51 additions & 0 deletions test/e2e-go/cli/goal/expect/listExpiredParticipationKeyTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/expect -f

set err 0
log_user 1

if { [catch {

source goalExpectCommon.exp

set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]

puts "TEST_ALGO_DIR: $TEST_ALGO_DIR"
puts "TEST_DATA_DIR: $TEST_DATA_DIR"

set TIME_STAMP [clock seconds]

set TEST_ROOT_DIR $TEST_ALGO_DIR/root
set TEST_PRIMARY_NODE_DIR $TEST_ROOT_DIR/Primary/
set NETWORK_NAME test_net_expect_$TIME_STAMP
set NETWORK_TEMPLATE "$TEST_DATA_DIR/nettemplates/ThreeNodesEvenDist.json"

exec cp $TEST_DATA_DIR/../../gen/devnet/genesis.json $TEST_ALGO_DIR

# Create network
::AlgorandGoal::StartNetwork $NETWORK_NAME $NETWORK_TEMPLATE $TEST_ALGO_DIR $TEST_ROOT_DIR

set PRIMARY_WALLET_NAME unencrypted-default-wallet

set PRIMARY_ACCOUNT_ADDRESS [::AlgorandGoal::GetHighestFundedAccountForWallet $PRIMARY_WALLET_NAME $TEST_PRIMARY_NODE_DIR]

# Register participation keys
set ROUND_FIRST_VALID 1
set KEY_EXPIRY_ROUND 10
::AlgorandGoal::AddParticipationKey $PRIMARY_ACCOUNT_ADDRESS $ROUND_FIRST_VALID $KEY_EXPIRY_ROUND $TEST_PRIMARY_NODE_DIR
::AlgorandGoal::TakeAccountOnline $PRIMARY_ACCOUNT_ADDRESS $ROUND_FIRST_VALID $KEY_EXPIRY_ROUND $TEST_PRIMARY_NODE_DIR

# Wait for expiry
::AlgorandGoal::WaitForRound $KEY_EXPIRY_ROUND $TEST_PRIMARY_NODE_DIR

# List participation keys
::AlgorandGoal::ListParticipationKeys $TEST_PRIMARY_NODE_DIR

# Clean up
::AlgorandGoal::StopNetwork $NETWORK_NAME $TEST_ALGO_DIR $TEST_ROOT_DIR

exit 0

} EXCEPTION ] } {
::AlgorandGoal::Abort "ERROR in listExpiredParticipationKeyTest: $EXCEPTION"
}