-
Notifications
You must be signed in to change notification settings - Fork 15
Minimal spec for initial consensus #10
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
base: eip-proposal
Are you sure you want to change the base?
Minimal spec for initial consensus #10
Conversation
i am curious what Kerman thinks of this. |
I purpose we also adhere to EIP-165 for how we announce additional features for 948 compliant interfaces. |
thats a great idea. i didnt know about 165 |
just added a new ticket for #13 @androolloyd @Kerman can you submit a review here. the EIP proposal changes look okay to me |
@kermankohli can you review too |
there's a bunch of metadata that's common to all proposals: would getter functions to address destination/uint amount to force subscriptions to minimally contain these 2 vars be a good idea? |
I think you tagged the wrong @Kerman! (Ive never met anyone with the /first/ name of Kerman before! hi! ) |
@johngriffin why is |
bytes32 gives you the flexibility to generate reproducible values for subscription ids from off chain data, one example I would have is that you could reference multiple subscription to a single account or contract through known third party piece of data, in my example an external subscription id you can generate a unique hash with (ERC948Contract address, recipient address, external_sub_id) and store that rather than having to ensure that people manage the values of on-chain data elsewhere. A large part about subscription and e-commerce is being able to adapt to the current ecosystem's use cases and tools, WooCommerce, Shopify, Magento, others. |
@androolloyd you can still do this with |
* @return a boolean to indicate whether the subscription exists and is valid | ||
|
||
``` | ||
function isValidSubscription(bytes32 _subscriptionId) |
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.
What is the purpose of having this as a separate function instead of just a part of a tupple that getSubscription() returns?
* @return a boolean to indicate whether the subscription was successfully cancelled | ||
|
||
``` | ||
function cancelSubscription(bytes32 _subscriptionId) |
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 still think it would be a good idea to consider changing this to uint256
:
- UUIDs and sha3 hashes are directly convertible to
uint256
- non-fungible token standard (721) is using
unit256
for IDs, so why wouldn't we follow existing best practices?
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'm working on a model where you sign the hash of an input set of data, and provide the signature as a part of the input data set.
function getSubscriptionHash(
address recipient,
uint256 value,
bytes data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 dataGas,
uint256 gasPrice,
address gasToken,
address delegateWallet
)
public
view
returns (bytes32)
{
return keccak256(
abi.encodePacked(byte(0x19), byte(0), this, recipient, value, data, operation, safeTxGas, dataGas, gasPrice, gasToken, delegateWallet)
);
}
returns a hash that is signed by the owner of the contract, and this signature is then stored by the merchant.
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 refute the notion that because ERC-721 is currently implementing their UUID's as a uint256 that it represents "best practices", it is definitely an accepted approach.
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.
Probably should have used a bit different wording: if everything else is the same, why shouldn't we go with something that's already out there?
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 believe constructing a hash as a sum of inputs gives a deterministic ID, and that has a higher value than one that is a scalar value.
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'm cool with using uint256, don't really see how it's different to using bytes32 since it's just a smaller conversion step unless I'm missing something.
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.
uint256 puts the onus of storing the reference to that variable off chain, rather than being able to compute it, that alone is too large of a headache IMO.
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.
@kermankohli yes, it's directly convertible to bytes32
(no additional cost). I was just pointing out to different types for the same thing across standards.
@androolloyd I don't follow. uint256
and bytes32
are interchangeable. Thus if you want to construct hash from a sum of inputs, that's fine - either bytes32 h
or uint256(h)
(conversion doesn't cost anything). Thinking more about it: having the ability to do arithmetic operations with IDs (uint256
) makes more sense than index access (bytes32
). I really think your choice of hash constructed IDs shouldn't be part of the standard nor should standard enforce it. There are other ways of how IDs can be constructed and it should be out of the scope of this standard.
Oh, one more thing - at some point using bytes32
instead of uint256
was more expensive (GAS-wise). Not sure if that's still the case, would like to think it got fixed.
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.
@lknix ok I better understand your positioning now, to continue on like I am with bytes32 I just need to cast the uint256 in the implementation.
I know that the input gas cost is eventually to be addressed but from what I can reason it hasn't yet been implemented or isn't slated for immediate fixing.
If there is truly no cost of conversion from uint256 to bytes32 vs bytes32/uint256 gas costs, then a uint256 type would be acceptable for our purposes.
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.
@androolloyd yes, that was the rationale - I probably wasn't clear enough since conversions/castings usually aren't as straightforward. Cost of conversion should be 0 but let's make sure that's the case :)
Aiming to get the spec started with the aspects that I see common to all proposals. This is in effect that a subscription ID will be a bytes32 value and there will be a cancel function and associated event.