-
Notifications
You must be signed in to change notification settings - Fork 130
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
Make some headers submissions free #2873
Conversation
…of_ex + check it from the transaction extension
… to RefundBridgedGrandpaMessages
… messages transactions
…ty (this is not used yet - see next commit)
…ge GRANDPA transactions are obsolete and, if not, it may apply priority boost to
Leaving this comment as a guide on how we'll be integrating that into test (R<>W) bridge (test matters here - see details below):
We can restart relayer (actually run 3 relayers instead of one) after that - it may lose some funds if we keep running old relayer after this ^^^ upgrade. For P<>K bridge we need to take care of tokens :) So while we may apply the same changes ^^^ there, we need to have a schedule that takes into account:
Maybe we should do the following:
|
…coming from CheckAndBoostBridgeGrandpaTransactions
just a note:
I've seen in #2883 a description along the lines "header free for numbers divisible by some N" Should we do some interval: "free if |
My idea was that with fixed interval for free relay chain headers, we simplify everything - we could make almost everything by only checking block numbers. Without that, we would need to do some non-trivial computations to verify that header has been submitted for free. E.g. "free" parachain header (in current impl) is parachain header that is "proved" at "free" relay chain header. So we now can check if So it's mostly for simplicity of both onchain and offchain code. I could also imagine that your option is better if we'll keep using "complex" relayers, which are looking at the messages pallet and if there's something to relay, they start relaying parachain headers required to prove that "something", which in turn triggers relay chain header relaying to prove that parachain header. Then, if using intervals, it could sleep when bridge is not actually used and only do transactions when there's something to deliver. But then some malicious actor may front-run us by submittig his own transaction that proves block I was thinking about running standalone finality and parachain relays. The idea is that they're running and always submitting headers with a steady interval (hoping that relay chain also steadily produces its blocks). Ideally we better to use slots, because it is a measure of time (and users will be measuring bridge delays in time, not in blocks), but again - I thought the simplicity is better here. TLDR: we could do intervals, but it'll make some things more complex and yet there's no much gain from that. Could change the implementation if there's a consensus if intervals are better. |
Thank you for the explanation Slava! I am now aligned with you in favor of using block numbers for simplicity. |
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.
Did a first iteration. Left only some nits, mostly related to renamings so far. But as a high-level comment I was wondering if it would make sense to work on this on a separate feature branch in order to be able to have a security review on it if needed for example, before merging into polkadot-staging.
We can do security review even after merging to polkadot-sdk as long as it's before deploying to Polkadot (before fellowship/runtimes integration + release + upgrade). So, I think we can just work on polkadot-staging, we don't have any other features development here now anyway |
3a6d946: we now allow free submission of initial parachain heads. That is not a big deal for real bridges, because by the time this change lands there, we'll already have some bridged para heads there. But it should make our zombienet tests easier (in theory) |
…de of tx body, it is `None` and otherwise it is `Some`
85dfd1b: when validating tx from pool (not durin block import or creation), |
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.
LGTM! 💯
Co-authored-by: Adrian Catangiu <[email protected]>
I'm gonna start moving it to polkadot-sdk, starting with a separate PR for that: #2873 (comment) |
…paritytech/parity-bridges-common into sv-refund-non-mandatory-headers
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.
lgtm and the last question, this PR adds free execution by default, but what if anybody wants really the full paid execution without this free stuff?
I mean, what about adding something like type AllowFreeExecution: Get<bool>;
to the pallet configurations?
E.g. when the runtime specifies:
type AllowFreeExecution = ConstBool<false>
- everything will work as before this PRtype AllowFreeExecution = ConstBool<true>
- activates this free execution feature
It should be disabled by default if we set |
I've copied this PR to |
Extracted to a separate PR as requested here: paritytech/parity-bridges-common#2873 (comment)
Superseded by paritytech/polkadot-sdk#4102 |
supersedes paritytech/parity-bridges-common#2873 Draft because of couple of TODOs: - [x] fix remaining TODOs; - [x] double check that all changes from paritytech/parity-bridges-common#2873 are correctly ported; - [x] create a separate PR (on top of that one or a follow up?) for https://github.com/paritytech/polkadot-sdk/tree/sv-try-new-bridge-fees; - [x] fix compilation issues (haven't checked, but there should be many). --------- Co-authored-by: Adrian Catangiu <[email protected]>
supersedes paritytech/parity-bridges-common#2873 Draft because of couple of TODOs: - [x] fix remaining TODOs; - [x] double check that all changes from paritytech/parity-bridges-common#2873 are correctly ported; - [x] create a separate PR (on top of that one or a follow up?) for https://github.com/paritytech/polkadot-sdk/tree/sv-try-new-bridge-fees; - [x] fix compilation issues (haven't checked, but there should be many). --------- Co-authored-by: Adrian Catangiu <[email protected]>
supersedes paritytech/parity-bridges-common#2873 Draft because of couple of TODOs: - [x] fix remaining TODOs; - [x] double check that all changes from paritytech/parity-bridges-common#2873 are correctly ported; - [x] create a separate PR (on top of that one or a follow up?) for https://github.com/paritytech/polkadot-sdk/tree/sv-try-new-bridge-fees; - [x] fix compilation issues (haven't checked, but there should be many). --------- Co-authored-by: Adrian Catangiu <[email protected]>
related to #2871 - look there for overview of what happens here
Better to review commit-by-commit:
FreeHeadersInterval
parameter to thepallet-bridge-grandpa
. EveryFreeHeadersInterval
th bridged header submission is free for the submitter;is_free_execution_expected
flag to the recently addedsubmit_finality_proof_ex
. If it is set totrue
by the caller and during block creation (not checked during tx validation) there are no more entries left for the free headers in the block (it is limited by theMaxFreeHeadersPerBlock
parameter of thepallet-bridge-grandpa
), then transaction won't be included into the block and the submitter won't lose any fees;RefundBridgedMessages
transaction extension, used to check for obsolete standalone message transactions AND bump delivery priority for registered relayers. Previous extensions (RefundBridgedParachainMessages
andRefundBridgedGrandpaMessages
) also refund/bump batch transactions, but we do not need that for our new approach. Because we want transactions to be free (Pays::No
) instead of doing refunds (usingpallet-bridge-relayers
) and batch transactions are incompatible with that;check_obsolete_submit_finality_proof
now returnsTransactionValidity
with bumped priority;CheckAndBoostBridgeGrandpaTransactions
wrapper for thepallet-bridge-grandpa
, which actually boost standalonesubmit_finality_proof
(andsubmit_finality_proof_ex
) transactions using stuff introduced in previous commit;RewardsAccountParams
struct. But this struct is specific to messages (lanes) and when we deal with GRANDPA submissions, we do not have any lanes and funds will likely go to some treasury account;CheckAndBoostBridgeGrandpaTransactions
;pallet-bridge-parachains
returns true;FreeParachainUpdateForFreeRelayHeader
, which allows single free parachain head update for every free relay chain header.I think that's all changes we need in the runtime, but we'll need some changes to relayer (and maybe runtime APIs). But I was trying to wrap it by the end of the day, so will double check on friday.