Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc: When Operation Source Accounts differ from that of the Parent Transaction #1022 #1413

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

anataliocs
Copy link
Contributor

@anataliocs anataliocs self-assigned this Mar 12, 2025
Copy link
Contributor

@ElliotFriend ElliotFriend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great start! left some notes throughout.

sidebar_position: 40
---

# When Operation Source Accounts differ from that of the Parent Transaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the markdown side of things, having this "top-level" single-# heading is redundant if it's the same as the title.

---
title: "When Operation Source Accounts differ from that of the Parent Transaction"
sidebar_label: Unique Source Accounts for Operations
description: "Learn"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little vague for a description? were you meaning for this to be "Learn" or was it a placeholder maybe?

Comment on lines +14 to +15
1. Operations that affect more than one account
2. Operations with a high threshold weight
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would really be more like Transactions that ... and Transactions with ... here


If a transaction has operations with multiple source accounts, it will require the source account signature for each operation.

One case where this happens is with specialized transactions such as [Sponsored Reserves](../../encyclopedia/transactions-specialized/sponsored-reserves) where a sponsoring account agrees to pay the base reserves for a sponsored account.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
One case where this happens is with specialized transactions such as [Sponsored Reserves](../../encyclopedia/transactions-specialized/sponsored-reserves) where a sponsoring account agrees to pay the base reserves for a sponsored account.
One case where this happens is with specialized transactions such as [Sponsored Reserves](../../encyclopedia/transactions-specialized/sponsored-reserves.mdx) where a sponsoring account agrees to pay the base reserves for a sponsored account.


## Operations that Affect multiple Accounts

If a transaction has operations with multiple source accounts, it will require the source account signature for each operation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be clearer. it reads a little like a single operation could have multiple source accounts attached to it. and signature for each operation sounds like every operation has to be signed. the transaction requires a valid signature from all source accounts present in the tx and/or the operations.

// 2. Both S1 and S2 sponsor trustlines for Account A for different assets.
//
let aAccount = await server.loadAccount(A.publicKey());
let tx = new TransactionBuilder(aAccount, { fee: BASE_FEE })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need the network passphrase in the tx builder options, too

}),
)
.addOperation(Operation.endSponsoringFutureReserves({}))
.setNetworkPassphrase(Networks.TESTNET)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, neat! i didn't know there was a .setNetworkPassphrase method... learned something new!

let txResponse = await server.submitTransaction(tx);
```

Learn more about [Sponsored Reserves here](../../encyclopedia/transactions-specialized/sponsored-reserves).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Learn more about [Sponsored Reserves here](../../encyclopedia/transactions-specialized/sponsored-reserves).
Learn more about [Sponsored Reserves here](../../encyclopedia/transactions-specialized/sponsored-reserves.mdx).


Learn more about [Sponsored Reserves here](../../encyclopedia/transactions-specialized/sponsored-reserves).

## Operations with a High Threshold Weight
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part is less about the operation having a high threshold. by default, every account has equal low/med/high threshold weights, and the master signer can sign for any of them. it's more about the account having some kind of multisig scheme set up. i think this section could be revised to make that dynamic more of the focus


```ts
//
// 2. Both S1 and S2 sponsor trustlines for Account A for different assets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be numbered as 2.? seems a bit out of place

@briwylde08
Copy link
Contributor

In general, I wonder if the second example is a relevant scenario in which you would use a different source account for operations within a transaction.

For high threshold operations, you would be more concerned about the signatures of the transaction (multisig) rather than different operation source accounts.

Unless I'm missing something here!

@briwylde08
Copy link
Contributor

Also, not sure if this should go in the sidebar like this. It kind of reads more like a how-to guide? We should maybe move it into Stellar Basics or something and then link to it from the Operations and Transactions section.

@stellar-jenkins
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants