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 concept of an "uninitialized" ContractId #377

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

ureeves
Copy link
Member

@ureeves ureeves commented Jul 29, 2024

We remove the concept of a ContractId being "uninitialized" and all related functionality, and in its place put in an improved ABI, using an integer to signal whether there is a caller or not. These two concepts are semantically equivalent, with the exception that in the former the contract at "zero" ContractId is not a possible caller - instead being considered "uninitialized".

As a consequence, we can return Option<ContractId> from piecrust_uplink::caller, which is a much clearer and more ergonomic API.

Eduardo Leegwater Simões added 3 commits July 30, 2024 00:53
The integer signals whether there is actually a caller or not. It will
be 1 if there is a caller, 0 if no caller, and the contract is the first
in the call chain.

This allows for contracts to more easily handle the situation in which
they're the first to be called, a situation which happens often
downstream in e.g. queries.
@ureeves ureeves requested review from miloszm, HDauven and moCello July 29, 2024 22:59
@ureeves ureeves merged commit e7787fb into main Jul 30, 2024
6 checks passed
@ureeves ureeves deleted the rm-contract-id-uninit branch July 30, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants