Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Some initial thoughts on needed interfaces/requirements for parathreads #6625

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

eskimor
Copy link
Member

@eskimor eskimor commented Jan 24, 2023

No description provided.

Copy link
Contributor

@sandreim sandreim left a comment

Choose a reason for hiding this comment

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

I've done a quick first pass, maybe on just 60% of the content here.

Comment on lines +261 to +265
Collators need to be able to bid securely in auctions for getting a slot. Idea:
Have restricted (proxy) accounts which are restricted to bidding on parathread
auctions for a specific `ParaId`. This can further be restricted to just a bid
per day/per hour/.... whatever is suitable for the parathread and greatly
reduces possible damage if keys are leaked/lost.
Copy link
Member

Choose a reason for hiding this comment

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

These should be session keys. An account on the relay chain could set its current collator session key. We could then let collators send unsigned transactions for bidding. If some locked funds on the account setting the collator key isn't enough, we could always deduct fees for the unsigned transaction from the account. The payment for the block would then always come from the account that set the keys. No one could then do that much bad with session keys if they are leaked, besides trying to bid for slots and burning the money in this way.

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/orgs/paritytech/projects/67/views/1?pane=issue&itemId=19145863 Have you seen this? I think a different idea is to have collators store a "hot" key which is a proxy that is only allowed to issue bids.

Collators are currently not registered on the relay chain, and any account can issue a bid "on behalf of" any collator. There is no real harm in buying blockspace for arbitrary collators, because the account paying for the blockspace is the one on the hook for the bid and the collator would receive any block rewards / transaction fees.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should support both. Giving the people more freedom on how to implement it. Either a collator is "pre-registered" and then uses an unsigned transaction to do the bidding on its own or we have some account that sends some BidFor { collator: Key, bid: Balance}. Internally both then map to the same function bid(collator: Key, bid: Balance)

Copy link
Contributor

Choose a reason for hiding this comment

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

It is usually better to have one way of doing things than 2. What benefit is there for collators to pre-register?

Copy link
Member

@bkchr bkchr Feb 3, 2023

Choose a reason for hiding this comment

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

When you pre-register a collator public key you wouldn't need any private key stored on your collator that has access to funds on the relay chain.

Copy link
Member

Choose a reason for hiding this comment

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

You would also need to have enough funds to pay transaction fees and constantly ensure that the account isn't running below ED. I mean you are right that these aren't hard technical points or change the fact that an attacker could still attack by draining the funds for bidding, but I think it makes the usage easier. But this isn't such an important topic and we could still later open the route for unsigned transactions. This isn't really any point that will change the implementation fundamentalally.

Copy link
Member Author

Choose a reason for hiding this comment

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

After a little research I like the proxy approach better as well (for now), because signed extrinsics come with a bunch of security features by default, which would need to be re-implemented for the unsigned case. Might not be a big deal, but I generally like not re-implementing the wheel, especially when it comes to security relevant matters.

You would also need to have enough funds to pay transaction fees and constantly ensure that the account isn't running below ED.

Wouldn't the same hold true for unsigned extrinsics signed by the CollatorId? Orders would still not be free, but will be charged to some account (coupled to the CollatorId).

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't the same hold true for unsigned extrinsics signed by the CollatorId? Orders would still not be free, but will be charged to some account (coupled to the CollatorId).

By orders you mean the bids? When you are using the proxy approach, you will need two accounts with funds in it. The account that is used to bid (which has all the funds in it to pay the bids) and the proxy account that controls the bidding (this is the account stored on the collator and requires funds to pay the tx fees). The collator will send transactions using the proxy account to bid with the bidding account. When we would have an unsigned extrinsic you would not need any funds to send the unsigned extrinsic as unsigned extrinsic by design don't pay any fees by default. Then you only need to have funds in the bidding accounts to pay the bids.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it. Yeah, I already noticed that proxy accounts are a bit of a pain from the user interface perspective. But using an unsigned extrinsic to avoid the bad user interface of proxy accounts seems a bit backwards - would it be hard to improve proxy accounts to benefit all use cases and not just parathreads? I don't see a fundamental reason why fees for transactions of a proxy account should not be paid by the proxied account - in fact we would need that for using the proxy account abstraction here anyway, because I am aiming on customizing fees to pay for the order as well, if that would be charged to the proxy account instead of the proxied account, then this would become rather pointless.

Looks like looking into customizing fees might be pointless after all.

By orders you mean the bids?

Yes orders are bids, because in our current model they are actually not bids anymore, but rather orders - which are either valid or invalid, but other than that the same.

Copy link
Member

Choose a reason for hiding this comment

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

would it be hard to improve proxy accounts to benefit all use cases and not just parathreads?

https://github.com/paritytech/substrate/issues/7054

because I am aiming on customizing fees to pay for the order as well

Fees are currently based on the weight and you can not that easily change this. However, with some custom signed extension it should maybe be possible.


The user can apply for a slot by placing a bid extrinsic. This bid will contain
some price the user is willing to pay for a core. These extrinsic go into a
transaction pool, as other extrinsics.
Copy link
Contributor

Choose a reason for hiding this comment

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

it would shed a lot of light if you would specify the parameters of that bid extrinsic.

node side? If we don't check signatures on the node side, then how can we be
spam resistant?

Then the block producer should put bids into the block, limited by some maximum
Copy link
Contributor

Choose a reason for hiding this comment

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

This implies that the bidding is basically off-runtime. What's the justification to handle this? I presume the parachain protocol has made similar decisions in other places as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Basically weight limit. Block producer can not just put everything that is available in there, no matter what. But we already revisited how bidding works, so this is pretty much obsolete already.

#### Runtime Implementation

More details on auctioning
[here](https://www.notion.so/paritytechnologies/Exotic-Scheduling-Auctions-53148e8d90d74411ab445b7d1dd6cfc8).
Copy link
Contributor

Choose a reason for hiding this comment

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

This is outdated as well, right?


}

struct PendingAvailabilityClaim {
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to include candidate hash, at least if it is intended to replace the fn availability_cores() runtime API. The provisioner in asynchronous backing needs to know which candidate it has the bitfields to include, so it can provide a candidate that's a child of it, if necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants