-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[rpc] Get protocol config endpoint #11510
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
@@ -52,12 +75,33 @@ pub fn getters_macro(input: TokenStream) -> TokenStream { | |||
} else { | |||
panic!("Expected angle bracketed arguments."); | |||
}; | |||
Some(quote! { | |||
|
|||
let getter =quote! { |
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.
nit spacing
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.
Fixed in this PR #11767
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.
🆒 i feel like half of this battle was wrangling with types and getters lol
/// /// Returns the value of the field if exists at the given version, otherise None | ||
/// pub fn lookup_attr(&self, value: String) -> Option<ProtocolConfigValue>; | ||
/// | ||
/// /// Returns a map of all confgis to values |
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.
Nit: configs
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.
Fixed in this PR #11767
Indeed, thats the fun part |
## Description Formatting nits from #11510 ## Test Plan N/A --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
Description
Adds RPC support to get protocol config.
If the protocol config is not specified, the node returns the config for the epoch its currently processing.
Examples
1. Valid protocol version (9) specified
2. Invalid protocol version specified
3. No protocol version specified
Although this node supports protocol version 1-10, it is currently syncing TXs at version 1, so it returns 1 as thats the highest it can process currently given its objects state.
Other utilities
Adds some utilities useful for CLI and protocol config attr discovery.
Needed to support RPC queries of protocol config info.
First a wrapper enum is introduced since config value types are heterogenous.
The wrapper will automatically pick up the type for all config attributes and add it to the enum variant
1. Logic to lookup protocol config attributes by string repr
lookup_attr(&self, attr_as_string) -> Option<ProtocolConfigValue>
2. Logic to return a BTreeMap of config attrs to their values
attr_map(&self) -> BTreeMap<String, Option<ProtocolConfigValue>>
This is equivalent to looping over all entries of
lookup_attr(value)
and putting them in a mapTest Plan
Unit tests
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
Release notes