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

Publish and Claim: Inbox API for Capability Bootstrapping #1983

Merged
merged 43 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4527cfe
add types for publish, unpublish, and claim to AuthAccount
dsainati1 Sep 13, 2022
d62f381
move functions to nested Inbox struct type
dsainati1 Sep 14, 2022
28679da
publish returns a Bool
dsainati1 Sep 14, 2022
6b3ddab
add permit function
dsainati1 Sep 14, 2022
ccc0c98
add unpermit function
dsainati1 Sep 14, 2022
7b6a49b
add allowlist field
dsainati1 Sep 14, 2022
9dcce96
add allowlist to public account inbox
dsainati1 Sep 15, 2022
948aeb4
add constructors for inbox values
dsainati1 Sep 15, 2022
0c47d0b
add constructors for inbox values
dsainati1 Sep 15, 2022
f247b60
implement computed field for allowlist
dsainati1 Sep 15, 2022
5c03729
implement permit function
dsainati1 Sep 15, 2022
d744581
implement unpermit function
dsainati1 Sep 16, 2022
4646884
implementation for publish
dsainati1 Sep 16, 2022
e1ee4f2
implementation of unpublish
dsainati1 Sep 16, 2022
1106d4b
type assertion when unpublishing
dsainati1 Sep 16, 2022
263f3ff
update type signatures to reflect requirement that they be capabilities
dsainati1 Sep 16, 2022
2d1c888
implement claim
dsainati1 Sep 19, 2022
5b6f120
add tests for publish and unpublish
dsainati1 Sep 19, 2022
20031b1
tests for claim
dsainati1 Sep 19, 2022
93e469a
fix tests
dsainati1 Sep 19, 2022
cb0de89
Merge branch 'master' of github.com:onflow/cadence into sainati/1951-…
dsainati1 Sep 26, 2022
0c7cd5c
remove allowlist, permit and unpermit
dsainati1 Sep 26, 2022
cb73d1b
add events on publish and claim
dsainati1 Sep 26, 2022
c90d0ca
Update runtime/account_test.go
dsainati1 Sep 29, 2022
0073d91
add documentation for inbox API
dsainati1 Sep 30, 2022
b7e5e2f
Merge branch 'master' of github.com:onflow/cadence into sainati/1951-…
dsainati1 Sep 30, 2022
ccaf768
Merge branch 'sainati/1951-publish-claim' of github.com:onflow/cadenc…
dsainati1 Sep 30, 2022
43831ea
Apply suggestions from code review
dsainati1 Oct 3, 2022
922cda6
Apply suggestions from code review
dsainati1 Oct 3, 2022
f024efe
Merge branch 'master' of github.com:onflow/cadence into sainati/1951-…
dsainati1 Oct 3, 2022
a6ce50d
use a new PublishedValue type to store published values instead of ha…
dsainati1 Oct 3, 2022
8ab3220
fix lint
dsainati1 Oct 3, 2022
cb9adb7
Merge branch 'master' of github.com:onflow/cadence into sainati/1951-…
dsainati1 Oct 5, 2022
7445bd6
respond to review
dsainati1 Oct 5, 2022
e3da05b
fix statictype enum changes
dsainati1 Oct 5, 2022
d24a53f
add comment to primitive static type test
dsainati1 Oct 5, 2022
a786026
Merge branch 'master' of github.com:onflow/cadence into sainati/1951-…
dsainati1 Oct 5, 2022
d8b7d46
merge
dsainati1 Oct 5, 2022
fdf8b75
Update docs/language/accounts.mdx
dsainati1 Oct 6, 2022
64f8581
Merge branch 'master' of github.com:onflow/cadence into sainati/1951-…
dsainati1 Oct 6, 2022
3e00678
respond to review
dsainati1 Oct 6, 2022
e8eea18
split InboxValueRemoved into two events for unpublish and claim
dsainati1 Oct 6, 2022
23a228d
Merge branch 'sainati/1951-publish-claim' of github.com:onflow/cadenc…
dsainati1 Oct 6, 2022
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
2 changes: 1 addition & 1 deletion runtime/interpreter/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,7 @@ func TestEncodeDecodeCapabilityValue(t *testing.T) {
// positive integer to follow
0x18,
// public account (tag)
0x5b,
0x59,
dsainati1 marked this conversation as resolved.
Show resolved Hide resolved
dsainati1 marked this conversation as resolved.
Show resolved Hide resolved
}

testEncodeDecode(t,
Expand Down
4 changes: 2 additions & 2 deletions runtime/interpreter/primitivestatictype.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ const (
_
_
_
dsainati1 marked this conversation as resolved.
Show resolved Hide resolved
PrimitiveStaticTypePublicAccountInbox
PrimitiveStaticTypeAuthAccountInbox
PrimitiveStaticTypeAuthAccount
PrimitiveStaticTypePublicAccount
PrimitiveStaticTypeDeployedContract
Expand All @@ -199,6 +197,8 @@ const (
PrimitiveStaticTypeAuthAccountKeys
PrimitiveStaticTypePublicAccountKeys
PrimitiveStaticTypeAccountKey
PrimitiveStaticTypePublicAccountInbox
PrimitiveStaticTypeAuthAccountInbox

// !!! *WARNING* !!!
// ADD NEW TYPES *BEFORE* THIS WARNING.
Expand Down
42 changes: 21 additions & 21 deletions runtime/interpreter/primitivestatictype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion runtime/interpreter/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -18616,7 +18616,9 @@ func (v LinkValue) ChildStorables() []atree.Storable {

type PublishedValue struct {
Recipient AddressValue
Value *CapabilityValue
// NB: If `publish` and `claim` are ever extended to support arbitrary values, rather than just capabilities,
// this will need to be changed to `Value`, and more storage-related operations must be implemented for `PublishedValue`
Value *CapabilityValue
}

func NewPublishedValue(memoryGauge common.MemoryGauge, recipient AddressValue, value *CapabilityValue) *PublishedValue {
Expand Down
4 changes: 2 additions & 2 deletions runtime/stdlib/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ func accountInboxUnpublishFunction(
value := publishedValue.Value.Transfer(
inter,
getLocationRange,
atree.Address(address),
atree.Address{},
true,
nil,
)
Expand Down Expand Up @@ -991,7 +991,7 @@ func accountInboxClaimFunction(
value := publishedValue.Value.Transfer(
inter,
getLocationRange,
atree.Address(address),
atree.Address{},
true,
nil,
)
Expand Down