-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Distribute burningman role to contributors who burned bsq #6405
Distribute burningman role to contributors who burned bsq #6405
Conversation
f5ee4d9
to
1e0cb12
Compare
Rebased on master |
From my side its complete now. I continue on another new PR for accounting of the received BTC but that should not have implications on that code. I will do a final in depth testing once all is complete but I tested that PR to some good extent. Please do not merge before DAO voting has accepted the proposal. |
Proposal got accepted by DAO voting: bisq-network/proposals#390 (comment) |
Before merging please coordinate. There will be another PR and the activation data and some other data need to be finalized before merge. |
caa29ca
to
ba841a8
Compare
core/src/main/java/bisq/core/support/dispute/refund/RefundManager.java
Outdated
Show resolved
Hide resolved
core/src/main/java/bisq/core/support/dispute/DisputeValidation.java
Outdated
Show resolved
Hide resolved
core/src/main/java/bisq/core/dao/burningman/BurningManService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/bisq/core/dao/burningman/BurningManService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/bisq/core/dao/burningman/DelayedPayoutTxReceiverService.java
Show resolved
Hide resolved
} | ||
|
||
// If too long for OpReturn we hash it | ||
if (opReturnData.length > 80) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 80 bytes going to be relayed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.talkcrypto.org/blog/2016/12/30/op_return-40-to-80-bytes/
https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch05.html
OP_RETURN was initially proposed with a limit of 80 bytes, but the limit was reduced to 40 bytes when
the feature was released. In February 2015, in version 0.10 of Bitcoin Core, the limit was raised back to
80 bytes. Nodes may choose not to relay or mine OP_RETURN, or only relay and mine OP_RETURN
containing less than 80 bytes of data.
Not 100% clear if there might be issues with nodes not relaying, but seems that 80 bytes is standard limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this comment:
https://stackoverflow.com/questions/24845429/maximum-size-of-data-bitcoin-op-return-tx-can-handle
Please note that the up to 80 part is misleading: one data push can handle up to 75 bytes. Therefore OP_RETURNs with 76-to-80 bytes need special handling: encoded with OP_PUSHDATA1 with 1-byte length. More details: bitcoin.stackexchange.com/questions/116080/… –
Adam B
Nov 22 at 14:32
UPDATE: The first version of this answer suggested using two data pushes, updated to use OP_PUSHDATA1.
Further research has clarified the issue:
OP_RETURN max data length is 80 bytes, however Maximum bytes in one push data is 75 bytes. Therefore data of sizes between 76 to 80 need to be encoded with OP_PUSHDATA1!
The script in this transaction is in fact invalid, 6a 4d 53 57 should be interpreted as OP_RETURN OP_PUSHDATA2 53 57, after which 22355 (0x5753) bytes are expected.
Correct encoding would be to use OP_PUSHDATA1 for data of length 76 to 80 bytes.
50 6a 4c 4d <77 bytes> OP_RETURN OP_PUSHDATA1 4d <77 bytes>
25f89e5
to
bf3a360
Compare
Rebased on master. |
.map(candidate -> new Tuple2<>(Math.round(candidate.getCappedBurnAmountShare() * spendableAmount), | ||
candidate.getMostRecentAddress().get())) | ||
.map(candidate -> { | ||
double cappedBurnAmountShare = candidate.getCappedBurnAmountShare() / adjustment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be called adjustedBurnAmountShare
for clarity. It's now possible that some receivers get more than their max allowed, although only by a few satoshis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it does not really add a risk as its only small amounts
core/src/main/java/bisq/core/dao/burningman/BurningManService.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
// If too long for OpReturn we hash it | ||
if (opReturnData.length > 80) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this comment:
https://stackoverflow.com/questions/24845429/maximum-size-of-data-bitcoin-op-return-tx-can-handle
Please note that the up to 80 part is misleading: one data push can handle up to 75 bytes. Therefore OP_RETURNs with 76-to-80 bytes need special handling: encoded with OP_PUSHDATA1 with 1-byte length. More details: bitcoin.stackexchange.com/questions/116080/… –
Adam B
Nov 22 at 14:32
UPDATE: The first version of this answer suggested using two data pushes, updated to use OP_PUSHDATA1.
Further research has clarified the issue:
OP_RETURN max data length is 80 bytes, however Maximum bytes in one push data is 75 bytes. Therefore data of sizes between 76 to 80 need to be encoded with OP_PUSHDATA1!
The script in this transaction is in fact invalid, 6a 4d 53 57 should be interpreted as OP_RETURN OP_PUSHDATA2 53 57, after which 22355 (0x5753) bytes are expected.
Correct encoding would be to use OP_PUSHDATA1 for data of length 76 to 80 bytes.
50 6a 4c 4d <77 bytes> OP_RETURN OP_PUSHDATA1 4d <77 bytes>
Ok, I reduce the opReturn to 40 bytes. Its anyway just a new feature without concrete use case so far and an only UI thing. |
47a3906
to
b25c25c
Compare
Rebased on master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more comments at the moment, will have to test it but code wise I think it looks good.
In regtest, the first person to burn is has a suggested amount in the range of a few thousand BSQ. Thereafter, burn targets are much smaller than what the first BM burned. e.g. Alice burns 2000 BSQ. All other BMs will only be allowed to burn 220 BSQ. Soon after, no one can burn anything, even if they go through several cycles of compensation. |
// interferes with usage of the burningManCandidatesByName map. | ||
// Those are the hashes used by legacy BM for burning BTC received from DPT. | ||
Set<String> hashes = Set.of("1701e47e5d8030f444c182b5e243871ebbaeadb5e82f", | ||
"1701293c488822f98e70e047012f46f5f1647f37deb7"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these burningman hashes hard-coded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the hashes in the opReturn at burn txs of the BM to tag different use cases (btc fee, del payout tx to refund agent, del payout tx to trader)
// interferes with usage of the burningManCandidatesByName map. | ||
// The hash used by legacy BM for burning BTC received from BTC trade fees. | ||
Set<String> hashes = Set.of("1701721206fe6b40777763de1c741f4fd2706d94775d"); | ||
LegacyBurningMan legacyBurningManBtcFees = getLegacyBurningMan(LEGACY_BURNING_MAN_BTC_FEES_ADDRESS, hashes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same again, hardcoded? I have to replace it with the relevant hashes from my database in order to pick up the legacy burningman's activity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean for testing it with regtest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Regtest. I'm confused as to the necessity for hardcoding those hashes: if BM3 does a fee burn, I would have expected it to get integrated in real time, instead of pasting into the sourcecode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The burn tx opReturn data are arbitrary bytes. One can add some preimage which gets hashed in the UI, and that is what the BM is doing to tag the diff. burn txs to groups. So this helps us to filter for burn txs from btc fees and those for DPTs.
b25c25c
to
dd684a4
Compare
We will use that for the optional address field in compensation requests and interpret empty input as Optional.empty. Signed-off-by: HenrikJannsen <[email protected]>
We cannot add a new field as that would break DAO consensus. Add optional text field for burningManReceiverAddress to CompensationProposal UI. Signed-off-by: HenrikJannsen <[email protected]>
Will be used later by BurningMan domain. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
…ill be used later) Change return type of FormBuilder.addTableViewWithHeader Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
…utsForDepositTxRequest and ProcessModel. Use BurningManService.getBtcFeeReceiverAddress at createFeeTx tasks. Verify takers burningManSelectionHeight if BurningManService.isActivated at MakerProcessesInputsForDepositTxRequest and OpenOfferManager. Stores burningManSelectionHeight in ProcessModel. Add BurningManService fields to OfferAvailabilityModel, PlaceOfferModel, OpenOfferManager and Provider Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
Add getCycleAtIndex convenience method to DaoStateService Signed-off-by: HenrikJannsen <[email protected]>
A cycle is the fundamental unit in the DAO, months/years have no relevance, so using cycles as base helps avoids some potential weird behaviour with data getting updated at cycle events. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
… 100% from capped burn shares. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
For chainHeights < genesisHeight+3*grid we ended up with future chainHeights Signed-off-by: HenrikJannsen <[email protected]>
It is not included in BurningManCandidate candidate map as that would complicate things. We only want to show it in the UI for informational purposes. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
…er fee in DelayedPayoutTxReceiverService.getSpendableAmount Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
…ity. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
…arameters Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
…ES_ADDRESS Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
Remove sorting as not needed. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
… some outputs fall below the min. amount limit. Signed-off-by: HenrikJannsen <[email protected]>
Signed-off-by: HenrikJannsen <[email protected]>
dd684a4
to
a17eb60
Compare
Signed-off-by: HenrikJannsen <[email protected]>
Close that as #6423 is th final PR and based on that. |
Implements bisq-network/proposals#390
Based on #6404
Starts at commit 33c08c7