-
Notifications
You must be signed in to change notification settings - Fork 167
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
Create ApplicationDescription blob type #2612
base: graphite-base/2612
Are you sure you want to change the base?
Create ApplicationDescription blob type #2612
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
dccbffc
to
1edf821
Compare
58ee530
to
ea2a259
Compare
linera-base/src/data_types.rs
Outdated
pub fn new_data(bytes: Vec<u8>) -> Self { | ||
BlobContent::new_data(bytes).into() | ||
pub fn new_data(bytes: Vec<u8>) -> Result<Self, bcs::Error> { | ||
BlobContent::new_data(bytes).try_into() |
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.
That really can't fail, can it? Would it make sense to expect
here? (And in the other methods that can't fail?)
Or even inline the relevant part of the implementation, so the Result
doesn't show up in the first place?
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.
Yes, if it fails, something is very wrong 😅 so it might make sense to panic. I'll change it!
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.
Approving, but maybe let's wait with merging this until the follow-up PR is also approved, so we don't have those duplicated types on main
for too long.
73f3541
to
cd0f531
Compare
91372cb
to
7fb263d
Compare
cd0f531
to
18622a1
Compare
7fb263d
to
b3b01c9
Compare
b3b01c9
to
f8b54d6
Compare
f8b54d6
to
38bd265
Compare
linera-execution/src/lib.rs
Outdated
@@ -142,6 +142,8 @@ pub enum ExecutionError { | |||
JoinError(#[from] linera_base::task::Error), | |||
#[error(transparent)] | |||
DecompressionError(#[from] DecompressionError), | |||
#[error(transparent)] | |||
BcsError(#[from] bcs::Error), |
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.
Is there a reason for moving this?
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 think I removed it then added it somewhere else by accident as the PR evolved. Will fix
linera-core/src/client/mod.rs
Outdated
let mut blobs = Vec::new(); | ||
for byte_vec in bytes { | ||
blobs.push(Blob::new_data(byte_vec)); | ||
} |
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.
let mut blobs = Vec::new(); | |
for byte_vec in bytes { | |
blobs.push(Blob::new_data(byte_vec)); | |
} | |
let blobs = bytes.into_iter().map(Blob::new_data).collect::<Vec<_>>(); |
would allocate the right vector size right away.
b49501f
to
78912fd
Compare
38bd265
to
e7a9b98
Compare
78912fd
to
bb341a0
Compare
e7a9b98
to
ae67606
Compare
bb341a0
to
84566e6
Compare
84566e6
to
ca23cb5
Compare
ae67606
to
7abc4b3
Compare
let mut blobs = Vec::with_capacity(bytes.len()); | ||
for byte_vec in bytes { | ||
blobs.push(Blob::new_data(byte_vec)); | ||
} |
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.
(Maybe more concise?)
let mut blobs = Vec::with_capacity(bytes.len()); | |
for byte_vec in bytes { | |
blobs.push(Blob::new_data(byte_vec)); | |
} | |
let blobs = bytes.into_iter().map(Blob::new_data).collect::<Vec<_>>(); |
pub creator_chain_id: ChainId, | ||
/// Height of the block that created this application. | ||
pub block_height: BlockHeight, | ||
/// At what efffect index of the block this application was created. |
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.
/// At what efffect index of the block this application was created. | |
/// At what effect index of the block this application was created. |
|
||
impl<A: Ord> Ord for BlobApplicationId<A> { | ||
fn cmp(&self, other: &Self) -> std::cmp::Ordering { | ||
(self.application_description_hash, self.bytecode_id) |
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.
If we destructure in these methods, the compiler will warn us in case we add any additional fields.
/// Loads data blob content from a file. | ||
pub async fn load_data_blob_from_file(path: impl AsRef<Path>) -> io::Result<Self> { | ||
pub async fn load_data_blob_from_file(path: impl AsRef<Path>) -> Result<Self, io::Error> { |
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.
(Why?)
e9a3222
to
b550792
Compare
Motivation
We need a new
ApplicationDescription
blob typeProposal
Add the blob type, but don't use it yet.
Test Plan
CI
Release Plan