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

[fastx client] Sender Local State Still Holds Transferred Object #105

Closed
oxade opened this issue Dec 30, 2021 · 7 comments
Closed

[fastx client] Sender Local State Still Holds Transferred Object #105

oxade opened this issue Dec 30, 2021 · 7 comments

Comments

@oxade
Copy link
Contributor

oxade commented Dec 30, 2021

TLDR:
Transferring an object still retains the object within the sender's object_ids records.
Is this expected? Can we simply wipe the local record after sending?

Example: based on enhancements in #91

Store two account addresses for use

mbp> ACCOUNT1=`./client --committee committee.json --accounts accounts.json query-accounts-addrs | head -n 1`
mbp> ACCOUNT2=`./client --committee committee.json --accounts accounts.json query-accounts-addrs | tail -n -1`

Get the objects for this account (sender) by checking its local view of its object_ids. See impl for getting own objects: https://github.com/MystenLabs/fastnft/pull/91/files#diff-6e566db7624762b34cc7884f7a5cce3e9825cf696dfe1806fe9a6a094e11aacdR456

mbp> ./client --committee committee.json --accounts accounts.json query-objects "$ACCOUNT1"

0x5a495cfb1d1b38c7bf94cdc58539cc66: SequenceNumber(0)
0x91ba3cb52d6b3067dce87572c91db097: SequenceNumber(0)
0xb42238a512eae64e17ced7436931cfc6: SequenceNumber(0)
0xe8779bda58fdd370881ef99ffbb9dad4: SequenceNumber(0)

Get the objects for this account (recipient) by checking its local view of its object_ids

mbp> ./client --committee committee.json --accounts accounts.json query-objects "$ACCOUNT2"

0x02682009b51e0b15eca544447c3d6f60: SequenceNumber(0)
0x532a8c8d4500468016e706d273e3e357: SequenceNumber(0)
0x605b840990609db1a63121a01cb17579: SequenceNumber(0)
0x8a91b430eae5edf93492320815059b68: SequenceNumber(0)

Store the objects available for sender in ACCOUNT1_OBJECT1

mbp> ACCOUNT1_OBJECT1=`./client --committee committee.json --accounts accounts.json query-objects "$ACCOUNT1" | head -n 1 |  awk -F: '{ print $1 }'`

Transfer ACCOUNT1_OBJECT1 from ACCOUNT1 to ACCOUNT2

mbp> ./client --committee committee.json --accounts accounts.json transfer "$ACCOUNT1_OBJECT1" --from "$ACCOUNT1" --to "$ACCOUNT2"

[2021-12-30T01:41:35Z INFO  client] Starting transfer
[2021-12-30T01:41:35Z INFO  client] Transfer confirmed after 3388 us
CertifiedOrder { order: Order { kind: Transfer(Transfer { sender: AZAhx6VlS+S/q2ObEyHCEuyPH06qcnZqKyR5xkX6wTk=, recipient: FastPay(/+2qSQ3PKSDmEjaqppXwJoDEjMBMrizDree5gdAFPIE=), object_id: 5A495CFB1D1B38C7BF94CDC58539CC66, sequence_number: SequenceNumber(0), user_data: UserData(None) }), signature: sxBJKBnF+KB0hW93x9SjMsnQw1G2z2ifwo9Q8Yl6EzCylZQqARZ86ABp6dJ/Gq/TJHV40Lrooc02s4HDUX0rDQ== }, signatures: [(qzIYFVQQ272wf3xNxWUvYellgrL+Oo1VMxv+VcCDKmw=, XIL2Za+ee0aExhuKMGZWEPBNUB3SNsH6uXZ/j/4BvtqGJFVuGPJFHHju+86Q0mR/tjmVsRoqwoSMkQ466g29CA==), (dLMfEfRDC6Mu+yyB9u9RWiY7KvuIOiiH+/NUc7hERkQ=, jB93zCkkAx43MjTeSkuApQdjPj/VGkFWdRGheMlZgbfX8VbpVZiHt9uWpq3vpqCbnXeoNvMH5NdRfQGC9z4jAw==), (YicAzMw7SsOtTmU3VIOFoXFAokj3GwEgYJ+ZaH/hTUU=, rUAJaCFCfuqpcWyRPdIZcenFoSUM7nOzieeqJeDPUvHnFpca3sQy7ZvpVNgbI2htAhEk9P0rWpUjfX9E+nFsDg==)] }
[2021-12-30T01:41:35Z INFO  client] Updating recipient's local balance
[2021-12-30T01:41:35Z INFO  client] Saved user account states

Check ACCOUNT2 objects state. Has the new object and seq number is updated

mbp> ./client --committee committee.json --accounts accounts.json query-objects "$ACCOUNT2"

0x02682009b51e0b15eca544447c3d6f60: SequenceNumber(0)
0x532a8c8d4500468016e706d273e3e357: SequenceNumber(0)
0x5a495cfb1d1b38c7bf94cdc58539cc66: SequenceNumber(1)     <----------- New account has the object
0x605b840990609db1a63121a01cb17579: SequenceNumber(0)
0x8a91b430eae5edf93492320815059b68: SequenceNumber(0)

Check ACCOUNT1 objects state. Still has old object, but seq number is updated

mbp> ./client --committee committee.json --accounts accounts.json query-objects "$ACCOUNT1"

0x5a495cfb1d1b38c7bf94cdc58539cc66: SequenceNumber(1)      <----------- Old account also has object in its object_ids
0x91ba3cb52d6b3067dce87572c91db097: SequenceNumber(0)
0xb42238a512eae64e17ced7436931cfc6: SequenceNumber(0)
0xe8779bda58fdd370881ef99ffbb9dad4: SequenceNumber(0)
@patrickkuo
Copy link
Contributor

Agree, I think we should update the local copy once the owner changed

@gdanezis
Copy link
Collaborator

0x5a495cfb1d1b38c7bf94cdc58539cc66: SequenceNumber(1) <----------- Old account also has object in its object_ids

Is this just a question of filtering out objects that are not owned by this user when producing this list?

@oxade
Copy link
Contributor Author

oxade commented Dec 30, 2021

0x5a495cfb1d1b38c7bf94cdc58539cc66: SequenceNumber(1) <----------- Old account also has object in its object_ids

Is this just a question of filtering out objects that are not owned by this user when producing this list?

@gdanezis that's one way to do it at query time, which we'll need when syncing for recvd objects anyways.
But is it wrong to just pop the object from the local copy list after a TX?
I'm asking because idk if the algorithm is designed around the list being append-only or something.

@oxade
Copy link
Contributor Author

oxade commented Dec 30, 2021

Agree, I think we should update the local copy once the owner changed

@patrickkuo should I fix this? Or do you wanna do it as part of your enhancements to get_own_objects?

@patrickkuo
Copy link
Contributor

it's a small fix, I can include it in my PR, the "transferred" object_id should be safe to remove as the client don't really need it locally anymore, one question I have is do we prune the certificates as well or not...

@oxade
Copy link
Contributor Author

oxade commented Dec 30, 2021

it's a small fix, I can include it in my PR, the "transferred" object_id should be safe to remove as the client don't really need it locally anymore, one question I have is do we prune the certificates as well or not...

Okay, if it's small, I can wait or cherry pick it.
What do you mean by prune certs?

@oxade oxade changed the title [fastx client] Sender Still Holds Transferred Object [fastx client] Sender Local State Still Holds Transferred Object Jan 5, 2022
@sblackshear
Copy link
Collaborator

I think this is fixed based on what I saw in the demo--please reopen if not!

mwtian pushed a commit that referenced this issue Sep 12, 2022
This commit wires in the block-remover component to the primary node setup.
mwtian pushed a commit to mwtian/sui that referenced this issue Sep 29, 2022
This commit wires in the block-remover component to the primary node setup.
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 a pull request may close this issue.

4 participants