celo-org / celo-bls-go

Go module for https://github.com/celo-org/bls-zexe/
Apache License 2.0
14 stars 8 forks source link

facing GeneralError when deserializing public keys (DeserializePublicKey, DeserializePublicKeyCached) #13

Closed alirezaly closed 3 years ago

alirezaly commented 4 years ago

when trying to deserializeing public keys which i copied from a test case inside bls_test. there's absoluetly no context about underlyaing cause and just a general error if you could clarify in which conditions this case happens that'd be helpful.

    var publicKeys []blscrypto.SerializedPublicKey
    for _, validator := range v.validators {
        publicKeys = append(publicKeys, validator.BLSPublicKey)
    }

    publicKeyObjs := []*bls.PublicKey{}
    for _, publicKey := range publicKeys {
        publicKeyObj, err := bls.DeserializePublicKeyCached(publicKey[:])
        if err != nil {
            return nil, err
        }
        defer publicKeyObj.Destroy()
        publicKeyObjs = append(publicKeyObjs, publicKeyObj)
    }
    apk, err := bls.AggregatePublicKeys(publicKeyObjs)
    if err != nil {
        return nil, err
    }
    defer apk.Destroy()
kobigurk commented 4 years ago

Can you post a compilable snippet? That will help me debug. If not, can you share where the original public keys originated from? They are supposed to be originated from an Serialize call.

This error usually happens when the byte array is not in the right format (e.g., too many bytes).

alirezaly commented 4 years ago

here's the branch with the test cases https://github.com/ChainSafe/chainbridge-celo/tree/feature/apk

kobigurk commented 3 years ago

Hi @alirezaly, is this still relevant?

kobigurk commented 3 years ago

Closing meanwhile! Feel free to re-open.