Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Return Touched Accounts inside the Spawn and Call Receipts #375

Closed
Tracked by #89
YaronWittenstein opened this issue Sep 12, 2021 · 3 comments · Fixed by #430
Closed
Tracked by #89

Return Touched Accounts inside the Spawn and Call Receipts #375

YaronWittenstein opened this issue Sep 12, 2021 · 3 comments · Fixed by #430
Assignees
Labels
go-svm Features required for the go-svm or other clients medium Medium-sized task must-for-mainnet Must be done before Mainnet svm

Comments

@YaronWittenstein
Copy link
Contributor

YaronWittenstein commented Sep 12, 2021

Notes

Before working on this issue, please make sure this one is addressed #406

Details

While calling an existing Account (i.e., executing a Call transaction) and spawning new ones (involves running a constructor), we might transfer coins between different Accounts.

go-spacemesh would like to be notified which accounts were involved in coins transfers as part of executing a transaction.

In other words, each time the svm_transfer host function is being called, we'd like to append the source and destination into the Touched Accounts set.

The logged source will always be the same Address - the currently executing Account.
So the implementation can optimize that, but keeping things simple and stupid in the solution might be a better approach.

The task of the issue is to make sure that Spawn and Call receipts will have a new touched_accounts field that will contain this list of Account Addresses.

Encoding

Lastly, this field should also be encoded in the returned Receipts.

See the svm-codec code here:
https://github.com/spacemeshos/svm/tree/master/crates/codec/src/receipt

@YaronWittenstein YaronWittenstein added go-svm Features required for the go-svm or other clients v0.3 svm labels Sep 12, 2021
@YaronWittenstein YaronWittenstein added this to the Aug 30 Sprint milestone Sep 12, 2021
@moshababo moshababo removed this from the Aug 30 Sprint milestone Sep 13, 2021
@YaronWittenstein YaronWittenstein removed their assignment Oct 13, 2021
@YaronWittenstein YaronWittenstein added must-for-mainnet Must be done before Mainnet medium Medium-sized task good first issue Good for newcomers labels Oct 19, 2021
@YaronWittenstein YaronWittenstein removed the good first issue Good for newcomers label Oct 31, 2021
@neysofu
Copy link
Contributor

neysofu commented Dec 2, 2021

Just clarifying this: "touched accounts" is a set, and as such doesn't make any distinction between source and destination because it's, duh, a set (like std::collections::HashSet). source and destination are out-of-band terms that we use to understand what items should be included in that set. @YaronWittenstein do we agree on this?

@YaronWittenstein
Copy link
Contributor Author

To my understanding, yes!
It's the list of accounts that have been involved in at least one coins transfer during the transaction execution.

@neysofu
Copy link
Contributor

neysofu commented Dec 2, 2021

Nice, we're on the same page then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-svm Features required for the go-svm or other clients medium Medium-sized task must-for-mainnet Must be done before Mainnet svm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants