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

πŸ“Œ Specify exact ClaimableBalanceID.v0 arithmetic #1516

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions core/cap-0023.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,8 @@ The behavior of `CreateClaimableBalanceOp` is as follows:
not have at least `amount` available balance of `asset`
6. Deduct `amount` of `asset` from `sourceAccount`
7. Create a claimable balance entry with the following properties:
- `balanceID` of type `CLAIMABLE_BALANCE_ID_TYPE_V0`. `balanceID.v0()` equal to the SHA256 hash
of the `OperationID`, which is created with the `type` `ENVELOPE_TYPE_OP_ID`, `sourceAccount`
of the transaction (not the operation), the `seqNum` of the transaction, and the index of this operation
in the transaction as `opNum`.
- `createdBy = sourceAccount`
- `balanceID` of type `CLAIMABLE_BALANCE_ID_TYPE_V0`.[^id-arithmatic]
- `createdBy = sourceAccount` (of the transaction, not the operation)
- `claimants` as specified, with the exception that
- `CLAIM_PREDICATE_BEFORE_RELATIVE_TIME` will be converted to
`CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME` by adding `relBefore` to
Expand All @@ -344,6 +341,20 @@ The behavior of `CreateClaimableBalanceOp` is as follows:
- `asset` as specified in the operation
- `amount` as specified in the operation
- `reserve` equal to `claimants.size() * baseReserve`

[^id-arithmatic]: ```
OperationID = (
sourceAccount ||
sisuresh marked this conversation as resolved.
Show resolved Hide resolved
seqNum ||
opNum
)
balanceID.v0() = hex(sha256(OperationID))
sisuresh marked this conversation as resolved.
Show resolved Hide resolved
```
- `OperationID`: a union within the new `type` `ENVELOPE_TYPE_OP_ID`
JFWooten4 marked this conversation as resolved.
Show resolved Hide resolved
sisuresh marked this conversation as resolved.
Show resolved Hide resolved
- `sourceAccount`: unmuxed public key of the transaction's source
- `seqNum`: the transaction source account's sequence number
- `opNum`: position index of this operation in the transaction

8. Succeed with `CREATE_CLAIMABLE_BALANCE_SUCCESS` and the `balanceID` from the previous step.

`CreateClaimableBalanceOp` requires medium threshold because it can be used to
Expand Down
Loading