8000 Support DelegatedSending invites from arbitrary stars by Fang- · Pull Request #17 · urbit/azimuth · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support DelegatedSending invites from arbitrary stars #17

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

Merged
merged 1 commit into from
May 29, 2019

Conversation

Fang-
Copy link
Collaborator
@Fang- Fang- commented May 29, 2019

Currently, stars can only give invites to their child planets. Since most early adopters (among who many star owners) own/use planets somewhere under ~zod, this makes them unable to send out invites as themselves. Instead, they must manually spawn a planet to whoever they want to give invites to, and only from there build out invite trees.

In this PR, we change the logic in the contract to allow planets receiving invites from any amount of arbitrary stars, rather than just their prefix.

The pools mapping(uint32 => uint16) becomes a mapping(uint32 => mapping(uint16 => uint16)), and we add in both a mapping(uint32 => uint16[]) poolStars and a mapping(uint32 => mapping(uint16 => bool)) poolStarsRegistered to aid in discovering and managing that data respectively.

It remains up to client implementations to discover planets that are eligible for sending. This is a bit more work than it used to be, but isn't the end of the world. I will add functionality for this into azimuth-js soon.

With that, supports receiving invites from any number of stars,
rather than just a planet's prefix.
@Fang- Fang- requested review from jtobin and philipcmonk May 29, 2019 17:47
Copy link
Collaborator
@philipcmonk philipcmonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct. I may have mentioned it before, but there is an approve-like concern with setPoolSize, which is that if someone in a pool of size N sees in the mempool that the pool size is about to change to M, they can quickly send invites for N planets with a relatively high gas price, hopefully beating the setPoolSize transaction. In this way, they can send N+M invites, when we should be able to restrict them to sending only max(N,M).

The two general approaches to mitigating this are: (1) define changePoolSize as a delta rather than an absolute number or (2) have setPoolSize accept an old-size argument, and we only change the pool size if that matches the current size of the pool. However, because these will generally be used in contexts that have non-zero preexisting trust, I don't think it's a problem.

@Fang-
Copy link
Collaborator Author
Fang- commented May 29, 2019

Neither of the proposed solutions account for the "I'm taking away a planet's invites" case, where the "race condition" would still end up with more consumed invites than desired. But, again,

because these will generally be used in contexts that have non-zero preexisting trust, I don't think it's a problem.

So, agree on leaving this "unsolved".

(Though I guess as a defense, stars could temporarily disable Delegated Sending support (by un-setting their spawn proxy) while they make such changes.)

@Fang- Fang- merged commit 00906e3 into master May 29, 2019
@Fang- Fang- deleted the delegated-sending branch May 29, 2019 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet < 4195 /span>
Development

Successfully merging this pull request may close these issues.

2 participants
0