-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add BLSToExecutionEhange signature feature #23
Conversation
genesis_validators_root: &Node, | ||
) -> Result<Domain, MerkleizationError> { | ||
if domain_type.len() != 4 { | ||
//todo |
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.
这个 todo 是什么意思?
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.
这个本来是想加一个长度校验呢,后来看了一下没必要,所以删掉就行。
fn it_works() { | ||
assert_eq!(2 + 2, 4); | ||
} | ||
pub fn hex_to_bytes(value: &str) -> Result<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.
这个其实最好放在共用的library中
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.
token-core中目前没有一个公共使用的工具库,后续根据需要再加上吧。
@@ -22,7 +22,7 @@ tiny-bip39 = "0.7.3" | |||
ed25519-bip32 = "0.3.2" | |||
blake2b_simd = "1.0.0" | |||
iop-keyvault = "0.0.5" | |||
bls-signatures = "0.13.0" | |||
bls-signatures = { git = "https://github.com/XuNeal/bls-signatures.git", branch = "feat/pop_dst" } |
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.
blst 库支持 自定义 cipher suite https://github.com/supranational/blst
示例代码参见
use blst::{min_pk, min_sig, PublicKey, SecretKey};
fn main() {
// 生成密钥对
let sk = SecretKey::key_gen(&[42; 32]).unwrap();
let pk = PublicKey::from(&sk);
// 签名
let msg = b"Hello, BLS!";
let dst = b"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
let sig = min_sig::sign(msg, &sk, dst).unwrap();
// 验证签名
let result = min_pk::verify(&sig, msg, &pk, dst);
assert!(result.is_ok());
}
可以尝试把这个fork的 bls-signatures 替换一下
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.
已使用blst库替换。
另外blst sign函数传入参数的正确顺序为:
let sig = min_sig::sign(msg, dst, aug).unwrap();
build |
LABS-1429