diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e74bccce1..cba3d629094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -317,6 +317,7 @@ - [9751](https://github.com/vegaprotocol/vega/issues/9751) - Make sure that LP fee party accounts exists. - [9762](https://github.com/vegaprotocol/vega/issues/9762) - Referral fees API not filtering by party correctly. - [9775](https://github.com/vegaprotocol/vega/issues/9775) - Do not pay discount if set is not eligible +- [9788](https://github.com/vegaprotocol/vega/issues/9788) - Fix transfer account validation. ## 0.72.1 diff --git a/commands/proposal_submission.go b/commands/proposal_submission.go index 09289d1d826..c322688629a 100644 --- a/commands/proposal_submission.go +++ b/commands/proposal_submission.go @@ -37,19 +37,29 @@ import ( const ReferenceMaxLen int = 100 -var ( - validSources = map[protoTypes.AccountType]struct{}{ - protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE: {}, - protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD: {}, - protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY: {}, - protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE: {}, - } - validDestinations = map[protoTypes.AccountType]struct{}{ +var validTransfers = map[protoTypes.AccountType]map[protoTypes.AccountType]struct{}{ + protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY: { protoTypes.AccountType_ACCOUNT_TYPE_GENERAL: {}, + protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE: {}, + protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE: {}, protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_POSITION: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_RELATIVE_RETURN: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING: {}, + }, + protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE: { + protoTypes.AccountType_ACCOUNT_TYPE_GENERAL: {}, + protoTypes.AccountType_ACCOUNT_TYPE_BOND: {}, + protoTypes.AccountType_ACCOUNT_TYPE_MARGIN: {}, + protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE: {}, protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE: {}, protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY: {}, - protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE: {}, + protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD: {}, protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: {}, protoTypes.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES: {}, protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES: {}, @@ -58,8 +68,24 @@ var ( protoTypes.AccountType_ACCOUNT_TYPE_REWARD_RELATIVE_RETURN: {}, protoTypes.AccountType_ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY: {}, protoTypes.AccountType_ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING: {}, - } -) + }, + protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE: { + protoTypes.AccountType_ACCOUNT_TYPE_GENERAL: {}, + protoTypes.AccountType_ACCOUNT_TYPE_BOND: {}, + protoTypes.AccountType_ACCOUNT_TYPE_MARGIN: {}, + protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE: {}, + protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY: {}, + protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_POSITION: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_RELATIVE_RETURN: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY: {}, + protoTypes.AccountType_ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING: {}, + }, +} func CheckProposalSubmission(cmd *commandspb.ProposalSubmission) error { return checkProposalSubmission(cmd).ErrorOrNil() @@ -494,48 +520,47 @@ func checkNewTransferChanges(change *protoTypes.ProposalTerms_NewTransfer) Error if changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_UNSPECIFIED { return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.source_type", ErrIsRequired) } - + validDest, ok := validTransfers[changes.SourceType] // source account type may be one of the following: - if _, ok := validSources[changes.SourceType]; !ok { + if !ok { return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.source_type", ErrIsNotValid) } - if changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_UNSPECIFIED { return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination_type", ErrIsRequired) } - if changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD && changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD { + if _, ok := validDest[changes.DestinationType]; !ok { return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination_type", ErrIsNotValid) } + dest := changes.DestinationType - if changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY && changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY { - return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination_type", ErrIsNotValid) - } - - // destination account type may be one of the following: - if _, ok := validDestinations[changes.DestinationType]; !ok { - return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination_type", ErrIsNotValid) - } - - if changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_GENERAL && !IsVegaPublicKey(changes.Destination) { + // party accounts: check pubkey + if (dest == protoTypes.AccountType_ACCOUNT_TYPE_GENERAL || + dest == protoTypes.AccountType_ACCOUNT_TYPE_BOND || + dest == protoTypes.AccountType_ACCOUNT_TYPE_MARGIN) && + !IsVegaPublicKey(changes.Destination) { errs.AddForProperty("proposal_submission.terms.change.new_transfer.changes.destination", ErrShouldBeAValidVegaPublicKey) } - if (changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD || - changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY || - changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE) && - len(changes.Source) > 0 { + // insurance account type requires a source, other sources are global + if changes.SourceType == protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE { + if len(changes.Source) == 0 { + return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.source", ErrIsNotValid) + } + // destination == source + if dest == changes.SourceType && changes.Source == changes.Destination { + return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination", ErrIsNotValid) + } + } else if len(changes.Source) > 0 { return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.source", ErrIsNotValid) } - if (changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD || - changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY || - changes.DestinationType == protoTypes.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE) && - len(changes.Destination) > 0 { - return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination", ErrIsNotValid) - } - - if changes.SourceType == changes.DestinationType && changes.Source == changes.Destination { + // global destination accounts == no source + if (dest == protoTypes.AccountType_ACCOUNT_TYPE_GENERAL || + dest == protoTypes.AccountType_ACCOUNT_TYPE_INSURANCE || + dest == protoTypes.AccountType_ACCOUNT_TYPE_BOND || + dest == protoTypes.AccountType_ACCOUNT_TYPE_MARGIN) && + len(changes.Destination) == 0 { return errs.FinalAddForProperty("proposal_submission.terms.change.new_transfer.changes.destination", ErrIsNotValid) } diff --git a/commands/proposal_submission_new_transfer_test.go b/commands/proposal_submission_new_transfer_test.go index c956307da75..7fa24d8da22 100644 --- a/commands/proposal_submission_new_transfer_test.go +++ b/commands/proposal_submission_new_transfer_test.go @@ -137,7 +137,7 @@ func testInvalidDestForMetric(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: tp, Destination: "", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -178,7 +178,7 @@ func testInvalidAssetForMetric(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: inv, Destination: "", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -205,7 +205,7 @@ func testInvalidAssetForMetric(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES, Destination: "", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -224,7 +224,7 @@ func testInvalidAssetForMetric(t *testing.T) { }, }) - require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.recurring.dispatch_strategy.asset_for_metric"), commands.ErrShouldBeAValidVegaID) + require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.recurring.dispatch_strategy.asset_for_metric"), commands.ErrShouldBeAValidVegaID, err.Error()) } func testRecurringWithDispatchInvalidTypes(t *testing.T) { @@ -240,6 +240,8 @@ func testRecurringWithDispatchInvalidTypes(t *testing.T) { delete(invalidTypes, types.AccountType_ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY) delete(invalidTypes, types.AccountType_ACCOUNT_TYPE_REWARD_RELATIVE_RETURN) delete(invalidTypes, types.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_POSITION) + delete(invalidTypes, types.AccountType_ACCOUNT_TYPE_INSURANCE) + delete(invalidTypes, types.AccountType_ACCOUNT_TYPE_GENERAL) delete(invalidTypes, types.AccountType_ACCOUNT_TYPE_UNSPECIFIED) @@ -251,7 +253,7 @@ func testRecurringWithDispatchInvalidTypes(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: inv, Destination: "", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -267,7 +269,7 @@ func testRecurringWithDispatchInvalidTypes(t *testing.T) { }, }, }) - require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.destination_type"), commands.ErrIsNotValid) + require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.destination_type"), commands.ErrIsNotValid, inv.String()) } } @@ -279,7 +281,7 @@ func testRecurringWithDestinationAndDispatch(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: "zohar", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -306,7 +308,7 @@ func testOneOffWithNegativeDeliverOn(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: "zohar", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -332,7 +334,7 @@ func testInvalidGeneralPubKey(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: "zohar", TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -352,14 +354,13 @@ func testInvalidGeneralPubKey(t *testing.T) { func testOneOffWithInvalidDestinationType(t *testing.T) { dests := []types.AccountType{ - types.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES, - types.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES, - types.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES, - types.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS, - types.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_POSITION, - types.AccountType_ACCOUNT_TYPE_REWARD_RELATIVE_RETURN, - types.AccountType_ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY, - types.AccountType_ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING, + types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, + types.AccountType_ACCOUNT_TYPE_SETTLEMENT, + types.AccountType_ACCOUNT_TYPE_MARGIN, + types.AccountType_ACCOUNT_TYPE_BOND, + types.AccountType_ACCOUNT_TYPE_FEES_MAKER, + types.AccountType_ACCOUNT_TYPE_FEES_INFRASTRUCTURE, + types.AccountType_ACCOUNT_TYPE_FEES_LIQUIDITY, } for _, dest := range dests { @@ -370,7 +371,7 @@ func testOneOffWithInvalidDestinationType(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: dest, TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, Asset: "abcde", @@ -395,8 +396,9 @@ func testNewRecurringGovernanceTransferInvalidEndEpoch(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, + Destination: crypto.RandomHash(), TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, Asset: "abcde", Kind: &types.NewTransferConfiguration_Recurring{ @@ -421,8 +423,9 @@ func testNewTransferWithNoKind(t *testing.T) { Changes: &types.NewTransferConfiguration{ FractionOfBalance: "0.5", Amount: "1000", - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, + Destination: crypto.RandomHash(), TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, Asset: "abcde", }, @@ -475,7 +478,7 @@ func testNewTransferChangeSubmissionWithoutDestinationTypeFails(t *testing.T) { Change: &types.ProposalTerms_NewTransfer{ NewTransfer: &types.NewTransfer{ Changes: &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, }, }, }, @@ -512,7 +515,7 @@ func testNewTransferChangeSubmissionInvalidDestinationTypeFails(t *testing.T) { Change: &types.ProposalTerms_NewTransfer{ NewTransfer: &types.NewTransfer{ Changes: &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType(at), }, }, @@ -546,7 +549,6 @@ func testNewTransferChangeSubmissionInvalidSourceTypeFails(t *testing.T) { } delete(allAccountTypes, int32(types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY)) delete(allAccountTypes, int32(types.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE)) - delete(allAccountTypes, int32(types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD)) delete(allAccountTypes, int32(types.AccountType_ACCOUNT_TYPE_INSURANCE)) delete(allAccountTypes, int32(types.AccountType_ACCOUNT_TYPE_UNSPECIFIED)) @@ -562,10 +564,10 @@ func testNewTransferChangeSubmissionInvalidSourceTypeFails(t *testing.T) { }, }, }) - require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.source_type"), commands.ErrIsNotValid) + require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.source_type"), commands.ErrIsNotValid, types.AccountType(at).String()) } - validSourceAccountTypes := []types.AccountType{types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, types.AccountType_ACCOUNT_TYPE_INSURANCE} + validSourceAccountTypes := []types.AccountType{types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, types.AccountType_ACCOUNT_TYPE_INSURANCE} for _, at := range validSourceAccountTypes { err := checkProposalSubmission(&commandspb.ProposalSubmission{ Terms: &types.ProposalTerms{ @@ -588,7 +590,7 @@ func testNewTransferChangeSubmissionInvalidSourceFails(t *testing.T) { Change: &types.ProposalTerms_NewTransfer{ NewTransfer: &types.NewTransfer{ Changes: &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, Source: "some source", DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, }, @@ -606,14 +608,15 @@ func testNewTransferChangeSubmissionInvalidDestinationFails(t *testing.T) { NewTransfer: &types.NewTransfer{ Changes: &types.NewTransferConfiguration{ SourceType: types.AccountType_ACCOUNT_TYPE_INSURANCE, - DestinationType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, - Destination: "some destination", + Source: "some market", + DestinationType: types.AccountType_ACCOUNT_TYPE_INSURANCE, + Destination: "", }, }, }, }, }) - require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.destination"), commands.ErrIsNotValid) + require.Contains(t, err.Get("proposal_submission.terms.change.new_transfer.changes.destination"), commands.ErrIsNotValid, err.Error()) } func testCancelTransferChangeSubmission(t *testing.T) { @@ -675,7 +678,7 @@ func testNewTransferChangeSubmissionInvalidTransferTypeFails(t *testing.T) { Change: &types.ProposalTerms_NewTransfer{ NewTransfer: &types.NewTransfer{ Changes: &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: crypto.RandomHash(), TransferType: tp, @@ -694,7 +697,7 @@ func testNewTransferChangeSubmissionInvalidTransferTypeFails(t *testing.T) { func testNewTransferChangeSubmissionInvalidAmountFails(t *testing.T) { transfer := &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: crypto.RandomHash(), TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -759,7 +762,7 @@ func testNewTransferChangeSubmissionInvalidAmountFails(t *testing.T) { func testNewTransferChangeSubmissionInvalidAseetFails(t *testing.T) { transfer := &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: crypto.RandomHash(), TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING, @@ -797,7 +800,7 @@ func testNewTransferChangeSubmissionInvalidFractionFails(t *testing.T) { } transfer := &types.NewTransferConfiguration{ - SourceType: types.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD, + SourceType: types.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY, DestinationType: types.AccountType_ACCOUNT_TYPE_GENERAL, Destination: crypto.RandomHash(), TransferType: types.GovernanceTransferType_GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING,