-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add register-ownership
command
#43
base: main
Are you sure you want to change the base?
Conversation
…tions' into feat/register-ownership
Co-authored-by: magecnion <magecnion@gmail.com>
…tions' into feat/register-ownership
Co-authored-by: magecnion <magecnion@gmail.com>
Co-authored-by: magecnion <magecnion@gmail.com>
Co-authored-by: magecnion <magecnion@gmail.com>
Co-authored-by: magecnion <magecnion@gmail.com>
Co-authored-by: magecnion <magecnion@gmail.com>
Co-authored-by: magecnion <magecnion@gmail.com>
…tions' into feat/register-ownership
register-collection
commandregister-ownership
command
* Update log level configuration for Laos-BTC. Update statefulset.yaml to use .Values.laosbtc.logLevel Add logLever field in values-digitalocean.yaml Add debug field in values-local.yaml Correct logLever to info in values-prod-digitalocean.yaml Correct logLever to info in values-prod-local.yaml * Enhance BRC721 script validation and structure Implement is_brc721_script function Add tests for BRC721 script validation Move BRC721_INIT_CODE to the main module Update register_collection to use new checks Refactor brc721_updater for new script logic * fix debuf in chart * fix clippy * refactoring * typo * index utxo on brc721
@@ -63,6 +63,22 @@ impl Brc721CollectionId { | |||
}, | |||
) | |||
} | |||
|
|||
pub fn to_leb128(&self) -> Vec<u8> { |
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 might be missing something, but it seems that this implementation isn't leveraging LEB128's efficiency as intended. For instance, a CollectionId { 1, 1 }
currently serializes to 5 bytes, while my understanding is that it should only take 2 bytes based on the LEB128 specification.
Could you clarify if there's a specific reason for this behavior? Perhaps I'm overlooking some design consideration.
The following implementation serializes to 2 bytes.
use std::io;
use leb128::write;
pub fn serialize<W: io::Write>(&self, mut writer: W) -> io::Result<()> {
write::unsigned(&mut writer, self.block)?;
write::unsigned(&mut writer, self.tx as u64)?;
Ok(())
}
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.
You're absolutely right about the inefficiency in the current implementation.
This packs both values into a single u128 before encoding. Even for small values like {1,1}, the packed value is positioned far in the number space due to the bit shifting, requiring more bytes.
I've updated the code. Now it encodes each value separately, allowing each to use the minimum number of bytes needed.
Continued from: #41
Solves: https://github.com/freeverseio/laos-bitcoin/issues/19