-
Notifications
You must be signed in to change notification settings - Fork 15
BoundedString to BoundedVec #622
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ use parity_scale_codec::MaxEncodedLen; | |
use parity_scale_codec::{Decode, Encode}; | ||
use scale_info::TypeInfo; | ||
use serde::{Deserialize, Serialize}; | ||
use sidechain_domain::byte_string::{BoundedString, SizedByteString}; | ||
use sidechain_domain::byte_string::SizedByteString; | ||
use sidechain_domain::{ | ||
CrossChainPublicKey, DelegatorKey, MainchainKeyHash, PermissionedCandidateData, | ||
RegistrationData, ScEpochNumber, ScSlotNumber, StakeDelegation, StakePoolPublicKey, UtxoId, | ||
|
@@ -461,13 +461,15 @@ impl AsCardanoSPO for BlockAuthor { | |
} | ||
} | ||
|
||
pub const MAX_METADATA_URL_LENGTH: u32 = 512; | ||
parameter_types! { | ||
pub const MaxMetadataUrlLength: u32 = 512; | ||
} | ||
|
||
#[derive( | ||
Clone, Debug, MaxEncodedLen, Encode, Decode, Serialize, Deserialize, PartialEq, Eq, TypeInfo, | ||
)] | ||
pub struct BlockProducerMetadataType { | ||
pub url: BoundedString<MAX_METADATA_URL_LENGTH>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is our own reference runtime implementation, not some code that anyone other than us is forced to use. We can make any assumptions that are convenient for us to do here. I went with a string-like type, because that's easy and intuitive for us to work with. |
||
pub url: BoundedVec<u8, MaxMetadataUrlLength>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this change reflected in RPC? I would like to see "before" and "after" before approving such a change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is hard to answer clearly that one, it actually depends on what will be the source of data. If type will be created from runtime (i.e. Decode trait will be involved), then in theory it may contain non utf-8 characters, so further serialization of this type with |
||
pub hash: SizedByteString<32>, | ||
} | ||
|
||
|
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.
looks quite long, should we short it?