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

Remove the AddrIndexrs dependency in the dispenser. #1352

Closed
ouziel-slama opened this issue Jan 23, 2024 · 13 comments
Closed

Remove the AddrIndexrs dependency in the dispenser. #1352

ouziel-slama opened this issue Jan 23, 2024 · 13 comments

Comments

@ouziel-slama
Copy link
Contributor

ouziel-slama commented Jan 23, 2024

Unless you figure out why the protocol needs it, there's no point adding dependencies that make it harder for everyone to install Counterparty. Bitcoind is normally sufficient for the protocol, adding heavy dependencies can only make adoption of an application more difficult.
Once a transaction is in the database we should not need the backend to parse a message! We cannot consider the Blockchain as a whole as the Counterparty database. This makes no sense.

@adamkrellenstein
Copy link
Member

Ah I thought that this was necessary! 🤯

@ouziel-slama
Copy link
Contributor Author

I thought so too! but the only reason to have something like addrindexrs is if we need to retrieve all Bitcoin transactions for a given address. And I can't find this functionality used anywhere except in an API endpoint.

@ouziel-slama
Copy link
Contributor Author

I found: https://github.com/CounterpartyXCP/counterparty-lib/blob/master/counterpartylib/lib/messages/dispenser.py#L195
Again the dispenser who breaks the design of Counterparty without thinking about the consequences.
I'm leaving this ticket open because this horror needs to be removed. Once a transaction is in the database we should not need the backend to parse a message! We cannot consider the Blockchain as a whole as the Counterparty database. This makes no sense.

@Jpja
Copy link

Jpja commented Jan 24, 2024

For context; the cannot open on another address if it has any confirmed bitcoin txs rule was added with 9.61. It was a response to dispensers put up on exchange hot wallets. These addresses keep receiving BTC over and over, triggering thousands of dispenses. I believe addrindexrs was modified for this update alone.

A limit of 1000 dispenses was also introduced with 9.61, addressing the same problem.

@adamkrellenstein
Copy link
Member

uh can we roll that back so we can fix the core architecture? @ouziel-slama is right, this kind of thing breaks the whole transaction model and will have significant consequences for performance optimization

@ouziel-slama
Copy link
Contributor Author

ouziel-slama commented Jan 24, 2024

For context; the cannot open on another address if it has any confirmed bitcoin txs rule was added with 9.61. It was a response to dispensers put up on exchange hot wallets. These addresses keep receiving BTC over and over, triggering thousands of dispenses. I believe addrindexrs was modified for this update alone.

A limit of 1000 dispenses was also introduced with 9.61, addressing the same problem.

Sorry I'm not sure I understand! either the dispenser is still full and open and several thousand dispenses should not be a problem. Either the dispenser is empty or closed and this should not create a "dispense" in the base.
If there are performance problems with only a few thousand dispenses, it is most likely because of the underlying problem of the dispenser which is not using messages. By persisting in wanting to keep a function that makes no sense we inevitably end up putting in patches which make the problem worse...

@ouziel-slama
Copy link
Contributor Author

A limit of https://github.com/CounterpartyXCP/counterparty-lib/pull/1264 was also introduced with 9.61, addressing the same problem.

@Jpja @adamkrellenstein the limit of 1000 sounds enough to resolve the problem for now, right ? if yes then let's remove "cannot open on another address if it has any confirmed bitcoin txs" as quickly as possible.

@adamkrellenstein
Copy link
Member

Kill it with fire 🔥

@Jpja
Copy link

Jpja commented Jan 24, 2024

the limit of 1000 sounds enough to resolve the problem for now, right

Yes, agree. Let's remove "cannot open on another address if it has any confirmed bitcoin txs"

@ouziel-slama ouziel-slama changed the title Remove addrindexrs Remove the addrindexrs dependency in the dispenser. Jan 24, 2024
@ouziel-slama
Copy link
Contributor Author

ouziel-slama commented Jan 24, 2024

Ah I finally (re)found why we need an addrindex and I remember now :) here https://github.com/CounterpartyXCP/counterparty-lib/blob/master/counterpartylib/lib/backend/__init__.py#L224 for the pubkeyhash_to_pubkey function.
However, we should never use this function inside a contract! I renamed the issue and edited the OP.

@jotapea
Copy link
Contributor

jotapea commented Jan 28, 2024

the only reason to have something like addrindexrs is if we need to retrieve all Bitcoin transactions for a given address

This is what dispensers do. While open + units remaining, any source address that sends enough bitcoin to a dispenser destination address will trigger a dispense. It is logically simple, but I understand it might break previous assumptions like all Counterparty transactions must have the CNTRPRTY message...

Will the "retrieve all Bitcoin transactions for a given address" functionality be moved to counterparty-lib? This is what needs to happen in order to continue supporting dispensers as they exist now...

Or what are people thinking about how to move forward with dispensers?

@adamkrellenstein
Copy link
Member

See https://github.com/CounterpartyXCP/counterparty-lib/issues/1331

@adamkrellenstein adamkrellenstein added this to the Next Next Release! milestone Feb 3, 2024
@adamkrellenstein adamkrellenstein changed the title Remove the addrindexrs dependency in the dispenser. Remove the AddrIndexrs dependency in the dispenser. Mar 24, 2024
@adamkrellenstein
Copy link
Member

adamkrellenstein commented May 26, 2024

See #1764

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

No branches or pull requests

4 participants