Comments (9)
We should probably get some help from those doing the Substrate benchmarking when it comes time to figure out our weight values
from parity-bridges-common.
will try to span finalization process over several transactions.
Note that with substrate we also have on_initialize
method in our pallet, so we can do some chunk of work on every block without an extra transaction required to trigger this logic. I imagine it might be possible to:
- Submit (& verify) all details needed for finalisation
- Process these details in chunks within
on_initialize
for couple of subsequent blocks.
The "cost" would not be covered by the user though, but rather cause some chain slowdown, so we need to be super sure that this doesn't open up some DoS vector.
from parity-bridges-common.
So I'm proposing to mark all methods with #[weight=0] (or whatever you suggest) and change that afterwards.
Sounds good. Let's add a TODO
and this issue number to make sure we address that.
The main problem is that we can't compute weight of header import call by looking at the header itself. The main source of uncertainty is finality computations - we may need to read arbitrary number of headers (and write some updates after that) if validators haven't been finalized headers for too long.
I'd be down for defining some upper bounds and possibly (at least have a) fall-back to a slower mechanism, where we have to process the finality in smaller chunks to make sure we don't go over that upper bound.
Number of headers that are expected to be read can also be passed with the call itself to avoid storage read - then we check if that's actually the case when the call is being processed. That will allow having a dynamic weight without incurring extra state read on computation.
from parity-bridges-common.
from parity-bridges-common.
Did some finality benches. There has been significant finalization delay in at Kovan chain start => it is a good illustration on how current finality affects block import time. So with current code, block import times are:
block1: 5ms
...
block10: 7ms
...
block50: 10ms
...
block100: 16ms
...
block150: 22ms
...
block500: 64ms
...
block750: 98ms
...
block1000: 123ms
...
block1926: 231ms
Without finality, everything is constant:
block1: 4ms
...
block10: 4ms
...
block1926: 4ms
This ^^^ doesn't include storage modifications during actual finalization, so when first block will be finalized, it'll be another spike in import time. So I'm going to:
- try to reorganize finalization code to make it closer to
O(1)
instead ofO(N)
; - if this ^^^ attempt will fail, or it'll require too much additional storage operations => will try to span finalization process over several transactions. This is what I really want to avoid, because it'll also affect relayer logic, but otherwise we might see stalls on actual chains later.
from parity-bridges-common.
Great idea! Probably we can use the same logic for pruning.
from parity-bridges-common.
So to compute weights we need to prepare some benchmarks - like it is done here. More docs here: https://www.shawntabrizi.com/substrate-graph-benchmarks/docs/#/
from parity-bridges-common.
I was talking with Shawn and he said that to prepare actual weights we should use the "new" automated approach. There's an issue for it in paritytech/substrate#6168, and code to generate weights automatically in paritytech/substrate#6567
from parity-bridges-common.
Closing for now. If we plan to switch to new weights, let's open a new issues instead.
from parity-bridges-common.
Related Issues (20)
- Create Polkadot BEEFY dashboards HOT 1
- Support/Help Snowbridge design better UX fee model HOT 1
- Making relayer compatible with runtime upgrades
- Submit bridges presentation proposal for Decoded 2024
- Submit XCMv5 presentation proposal for Decoded 2024
- Limit number of items we hold in memory HOT 1
- Add relay subcommand to relay single GRANDPA proof/para head proof/message/confirmation
- Add force_import calls to the pallets
- Remove OutboundLaneApi runtime APIs
- Consider deduplicating "may_refund_cal_fee" logic
- Rename our 'obsolete' extensions to something that actually reflects what they are doing
- substrate-relay v1.5.0 error HOT 2
- Polkadot<>Kusama zombienet tests: allow connecting chains from different releases
- Split and migrate `origin/bridges-v2` branch HOT 1
- Add GRANDPA call limits verification to the relayer code HOT 1
- Relay version metric returns invalid value
- Make sure we backported and released all relevant patches from 1.7.0 untill 1.11.0 HOT 6
- Jsonrpsee subscriptions are leaking
- On-demand headers relay: error in the relay_mandatory_header_from_range HOT 4
- Remove complex, on-demand and batch relayers code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parity-bridges-common.