Open guidanoli opened 1 month ago
I support the change. It’s basically removal of line https://github.com/cartesi/openapi-interfaces/blob/9b9d6088d6e2f93c333d5500e868116d7e57ba91/rollup.yaml#L429
Strong agree, but I would like to point that we also have to change the description of destination https://github.com/cartesi/openapi-interfaces/blob/9b9d6088d6e2f93c333d5500e868116d7e57ba91/rollup.yaml#L406
description: 20-byte address of the destination contract for which the payload will be sent.
Currently it specifiec it is the address of a contract and for ether withdrawals it can be the user who will be receiving the assets. Correct @guidanoli ?
Yes, destination
can be any Ethereum account address.
If the account has some code, we say it's a smart contract.
It’s basically removal of line https://github.com/cartesi/openapi-interfaces/blob/9b9d6088d6e2f93c333d5500e868116d7e57ba91/rollup.yaml#L429
Yes, and we should make it clear that zero is the default value.
Rationale
On SDK v1, vouchers had only two fields:
destination
andpayload
. On-chain, this triggers aCALL
instruction. This instruction also takes avalue
as stack input, but we didn't specify it, so Solidity would pass zero as the default value to message calls.On SDK v2, we introduced the
value
field to parameterize this stack input. In most cases, however, this field will still be zero. It will only be non-zero when there is some movement of Ether. The classic example is Ether withdrawals.If this field were made obligatory in the HTTP API, application back-ends would have to adapt every call to the
/voucher
entry-point, just to pass the same value, zero. To make this change backwards-compatible, we believe that we can make this field optional, with zero being a sensible default.Proposal
Make the
value
argument of the/voucher
entry-point optional. The default value should be zero, just like before. If this change is agreed upon, an equivalent issue should be opened onmachine-emulator-tools
.