NDRS-157: get block limits from the chainspec#113
NDRS-157: get block limits from the chainspec#113Fraser999 merged 3 commits intocasper-network:masterfrom
Conversation
|
There's a lot of going on in here, things that are unrelated to each other (changes to makefile, adding defaults, adding new config params to the chainspec etc) and still only one commit :) |
|
Yeah - sorry. It's down to the order in which the task evolved. I was half way through the changes to the deploy buffer when I found out I needed to change the chainspec. I guess at that point I should have stashed my changes and just worked on the chainspec since that could be a standalone commit. I have no excuse for the Makefile being bundled in here except habit. Let me see if I can split these up. |
resources/local/chainspec.toml
Outdated
| # The upper limit of total gas of all deploys in a block. | ||
| block_gas_limit = 10000000000000 | ||
| # The maximum number of deploys permitted in a single block. | ||
| block_max_deploy_count = 3 |
There was a problem hiding this comment.
This shouldn't be part of chainspec since it's going to be removed. We're not validating it either.
There was a problem hiding this comment.
Ah - I must have misunderstood the conversation. I'll remove it.
Don't do it now. I have already started reviewing and you would have to force push. |
| where | ||
| REv: From<StorageRequest<Storage>> + Send, | ||
| { | ||
| // TODO - should the current protocol version be passed in here? |
There was a problem hiding this comment.
Yes, it should probably come from the consensus together with the request.
There was a problem hiding this comment.
I'd prefer if consensus only passed in the block height and era number, from which it should be possible to compute the protocol version?
There was a problem hiding this comment.
I don't know, maybe. That's what we're really doing in Scala – consensus provides block height (not even era number which might have been a mistake really 🤔 ) and there's a component that returns a proper configuration.
Sure, decoupling consensus from the idea of chainspec and upgrades makes sense. It would have to be initialized with the proper set of configurations itself.
There was a problem hiding this comment.
I'm not clear on how I'd derive the protocol version from a given block height and era number yet, but since I'm not even getting those passed here, how about if I add a protocol_version field to BlockContext which is always set to 1.0.0 for now? Then if consensus wants to change to pass block height and era, we'd have to update this call site to accommodate it.
There was a problem hiding this comment.
You wouldn't be doing it – chainspec handler (or whatever the name is of the component that is initialized with the chainspec files) has to know the mapping between block height and the chainspec version.
There was a problem hiding this comment.
OK - I'll leave this as a TODO for now.
| let version = Version::from((1, 0, 0)); | ||
| effect_builder | ||
| .get_chainspec(version) | ||
| .event(move |result| Event::GetChainspecResult { |
There was a problem hiding this comment.
So we're requesting the chainspec every time via an effect? That seems convoluted: Some components will probably use some value from the chainspec every time they handle an event.
I think the consensus component currently gets initialized with some information from the chain specs, and stores it internally — maybe also not a good idea, since it duplicates the data?
I'm not sure what's the best approach to this, but it would be good to have a solution that gives all components quick (and easy!) access to the chainspec at all times.
There was a problem hiding this comment.
In Scala node we were keeping chainspecs, keyed by protocol version, in memory and every time a block was about to be created (or was being validated) we would fetch that chainspec and use.
There was a problem hiding this comment.
My initial thought was to cache copies of the chainspec (or relevant parts) in components which needed it too in order to simplify things, but @EdHastingsCasperLabs made a good point about these needing to be kept synchronized with the definitive one held by the storage component.
Changing from that pattern is probably worthy of a discussion outside of this PR?
| #[from] | ||
| Request(DeployBufferRequest), | ||
| /// A new deploy should be buffered. | ||
| Buffer { |
There was a problem hiding this comment.
I'm still surprised that we're treating deploy storage and deploy buffer separately – i.e. latter doesn't wrap the former but maybe I'm wrong.
3302: Merge 1.4.8 to dev r=mpapierski a=mpapierski This PR merges the 1.4.8 bugfix release into dev by cherry-picking relevant fixes from the history of the v1.4.8 release. A complete history of v1.4.8 release as compared to dev: dev...v1.4.8 Commits cherry-picked in order starting from `Clippy fixes with recent stable` (a369e37). | Message | Git SHA on v1.4.8 | Cherry-picked | | --- | --- | --- | `(Merge #115, 2022-08-14)` | b94c4f7 | merge commit | `(version bump casper-node and assembly script, 2022-08-12)` | 389dddc | 696206e | `(Merge pull request #114 from casper-network/regression-20220727-part2, 2022-08-12)` | 281061f | merge commit | `(Add changelog and docs., 2022-08-12)` | 01999db | a301241 | `(Shuffle ensure_* functions in order, 2022-08-12)` | 3677f9d | 99bfdd9 | `(Simplify checking algorithm, 2022-08-12)` | 6658738 | 5a7d1bd | `(Fix clippy issues., 2022-08-12)` | 0ee97fc | empty commit | `(Add checks to avoid panics in the gas accounting, 2022-08-11)` | 4340204 | 3881820 | `(Add regression tests for gas counter injector., 2022-08-11)` | e710b8e | 09f023a | `(Restrict access to non-declared globals., 2022-08-10)` | 7944881 | a2ca3dc | `(Regression tests for global set/get access., 2022-08-10)` | 843cf53 | 5432145 | `(Merge #113, 2022-08-03)` | 298dfaa | merge commit | `(further updates required for version bumps, 2022-08-03)` | 9129165 | 5c07b4e | `(Bumping EE, casper-node and assembly script (to keep from erroring on publish)., 2022-08-02)` | 55a413d | 6823aa6 | `(Merge pull request #110 from casper-network/regression-20220727, 2022-08-02)` | 17a39d8 | | `(Fix backwards compatibility, 2022-08-02)` | 476a236 | 1ac4e8c | `(Apply suggestions from code review, 2022-08-02)` | 7ae3f1d | 11c0f95 | `(Rewrite for clarity as `@goral09` suggested, 2022-08-01)` | 7b84dfa | 1de2f62 | `(Ensure internal gas function cannot be imported., 2022-07-29)` | 31fe6b3 | 822bea0 | `(Ensure functions max param size., 2022-07-29)` | ea0f05c | 8f2dff4 | `(Ensure module doesnt declare more than 256 globals, 2022-07-29)` | 20a667a | 496f5a8 | `(Limit the size of a br_table to 256 elements., 2022-07-29)` | 3d51997 | 83023e1 | `(Apply review comments, 2022-07-29)` | e562a5c | 5ec9af7 | `(Apply review comments, 2022-07-28)` | 223d861 | f064a36 | `(Lower the table size to 4k, 2022-07-28)` | 438f56e | 66b3e9c | `(Fix the issue by imposing a limit for table size., 2022-07-27)` | 7dc6dcb | bec2292 | `(Add regression test to trigger the issue., 2022-07-27)` | 1eafe74 | c31d448 | `(Clippy fixes with recent stable, 2022-07-27)` | a369e37 | effectively empty commit | Co-authored-by: Michał Papierski <michal@casperlabs.io> Co-authored-by: Joe Sacher <321623+sacherjj@users.noreply.github.com> Co-authored-by: Fraser Hutchison <fraser@casperlabs.io>
This PR changes the deploy buffer to retrieve deploy configuration data from the chainspec rather than relying on having the values passed in.
After discussion, it has also required two new fields to be added to the
DeployConfigportion of the chainspec:block_gas_limit: u64defaulted to 10,000,000,000,000block_max_deploy_count: u32defaulted to 3Default impls have been added for
chainspec::DeployConfigandchainspec::HighwayConfig. These were only implemented for theirchainspec::configcounterparts previously, but implementing them for the actual chainspec types makes for simpler testing. The config counterparts now have theirDefaults implemented via the default values of the main chainspec structs.There are also a few unrelated fixes to the Makefile included in this PR.