cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.19k stars 3.58k forks source link

[Feature]: unordered tx: client-supplied unique identity #21134

Open yihuang opened 1 month ago

yihuang commented 1 month ago

Inspired by ton network highload v3 wallet type

Currently, we record the transaction hashes for replay protection, which is quite heavy. One alternative solution is to let the user provide an integer-based unique ID, the integer set could be encoded much more efficiently and can be stored in the account storage, instead of globally.

Positives

Negatives

tac0turtle commented 1 month ago

hmm i understand the client side benefits but it makes it stateful and would conflict with ordered txs. Using offchain indexing seems like the better approach for seeing how many txs are per account

yihuang commented 1 month ago

Using offchain indexing seems like the better approach for seeing how many txs are per account

yeah, I think the sequence issue is insignificant, I removed it and changed the issue to focus on the client-side id.

hmm i understand the client side benefits but it makes it stateful and would conflict with ordered txs.

I added the positives/negatives section for discussion, what do you mean by the conflicts with ordered txs? If an account is moved to unordered mode, it can't be ordered at the same time, but the other accounts can still be ordered.

It's kind of like ibc channels, the ordered/un-ordered semantics is per-channel, rather than per-message.

tac0turtle commented 1 month ago

in this design the clients need to have knowledge of previous IDs to avoid sending a different tx with the same ID correct? also would we not need to store all the IDs used, meaning we have to do a state lookup instead of a file look up?

yihuang commented 1 month ago

in this design the clients need to have knowledge of previous IDs to avoid sending a different tx with the same ID correct?

Yes, at least within the range of ttl, the same id can't be used again.

also would we not need to store all the IDs used, meaning we have to do a state lookup instead of a file look up?