Error: Base 58 requirement is violated
I got this error:
> gcli vault list all
DatabaseError(Custom("Base 58 requirement is violated"))
> gcli --version
gcli 0.4.0
My db was created with import and I do not know when it was corrupted.
@Nicolas80 you might be interested that this case is reached.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Developer
Can you open the database with DBeaver or another client and check the content of the table ?
I suspect that the
address
orparent
value of one of the rows is incorrect... ?Also, since the message mentions "Base 58" could it be the conversion to G1v1 key format ?
- Developer
@HugoTrentesaux Otherwise; if it's possible for you to make a copy of the DB where you override all the
encrypted_suri
by a dummy value and make it available; I could try to debug locally. Collapse replies - Author Maintainer
$ sqlite3 ~/.local/share/gcli/gcli.sqlite SQLite version 3.49.1 2025-02-18 13:38:58 Enter ".help" for usage hints. sqlite> PRAGMA table_info(vault_account); 0|address|json_text|1||1 1|name|varchar|0||0 2|path|varchar|0||0 3|crypto_scheme|varchar|0||0 4|encrypted_suri|varbinary_blob|0||0 5|parent|json_text|0||0 sqlite> select address,name,path,crypto_scheme,parent from vault_account; "5CiGCfbk4X9wtJHguwUCFBmZaywZYo1e9ewtTzhExGL5P5gK"|||Sr25519| "5Dq8xjvkmbz7q4g2LbZgyExD26VSCutfEc6n4W4AfQeVHZqz"|HugoGdev||Sr25519| "5ELZh8YQ7PqDLBKjYNyLWWMCRpaQw1Rm6HT4LcuUCkNVNcxL"|||Sr25519| "5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV"|Dev||Sr25519| "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"|Alice|//Alice||"5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV" "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"|Bob|//Bob||"5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV" "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y"||//Charlie||"5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV"
très étrange, je vois pas ce qui cloche...
[edit] bah si !! les guillemets ><
on y voit plus clair comme ça :
sqlite> .mode table sqlite> select address,name,path,crypto_scheme,parent from vault_account; +----------------------------------------------------+----------+-----------+---------------+----------------------------------------------------+ | address | name | path | crypto_scheme | parent | +----------------------------------------------------+----------+-----------+---------------+----------------------------------------------------+ | "5CiGCfbk4X9wtJHguwUCFBmZaywZYo1e9ewtTzhExGL5P5gK" | | | Sr25519 | | | "5Dq8xjvkmbz7q4g2LbZgyExD26VSCutfEc6n4W4AfQeVHZqz" | HugoGdev | | Sr25519 | | | "5ELZh8YQ7PqDLBKjYNyLWWMCRpaQw1Rm6HT4LcuUCkNVNcxL" | | | Sr25519 | | | "5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV" | Dev | | Sr25519 | | | "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" | Alice | //Alice | | "5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV" | | "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty" | Bob | //Bob | | "5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV" | | "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y" | | //Charlie | | "5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV" | +----------------------------------------------------+----------+-----------+---------------+----------------------------------------------------+
Edited by Hugo Trentesaux - Developer
Je ne comprend pas, j'ai jamais eu les guillemets de mon côté...
Est-ce qu'une version différente de sqlite serait utilisée ?
Ou un autre soucis lié à la Locale de la machine ?
- Developer
Est-ce que tu sais afficher le DDL de la table ?
Je suis curieux de voir si c'est bien "VARCHAR" pour address, parent et path (on voit que tu n'as pas eu le soucis pour PATH)
La différence avec ces 2 colonnes c'est qu'on utilise DbAccountId en interne et que l'on à normalement implémenté ce qu'il faut pour faire les conversions String <-> DbAccountId en DB...
- Developer
Ce que je peux faire, même si c'est un peu moche, c'est ajouter un trim des double-quotes quand on fait la conversion String <-> DbAccountId ...
- Developer
Ok, j'ai un "fix" qui fonctionne; mais c'est un peu moche; surtout le dernier commit ou on doit matcher de 2 manières dans la recherche des children.
Est-ce que tu peux tester la branche mise à jour dans la MR !43
Et faire un review si ça te semble acceptable ?
Ou si on préfère ne pas faire le changement et tenter de trouver la cause initiale et voir si on pourrait arriver à l'empêcher...
- Developer
Pour tenter de trouver la cause...
Normalement le code qui sérialise vers String pour la DB est ceci:
impl From<DbAccountId> for Value { fn from(account_id: DbAccountId) -> Self { Value::String(Some(Box::new(account_id.0.to_string()))) } }
et le
.0
de DbAccountId est un AccountId qui est un type pour AccountId32Et dans le code de AccountId32, ce qui devrait être utilisé quand on fait
to_string()
est:impl core::fmt::Display for AccountId32 { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "{}", self.to_ss58check()) } }
Est-ce que tu pourrais vérifier si dans ton cas; le AccountId.to_string() donnerais des guillemets en plus dans la string retournée ???
- Author Maintainer
I found an other way to reproduce the bug without db:
gcli vault derive -a 5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV, error: invalid value '5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV,' for '-a <ADDRESS>': Base 58 requirement is violated
No time to send more info at the moment
[edit] just after publishing, I saw the comma at the end of the address, so I suspect the problem is the same in the previous bug
[edit] opening the file with
sqlite3 gcli.sqlite
I have no response for.tables
.Edited by Hugo Trentesaux Collapse replies - Developer
Well, this '-a' argument directly parses to an AccountId; so it makes sense that it does it's internal validation and fails with that message when we add an invalid character like ",".
But the thing I don't understand is how could we generate a wrong address AccountId value from an actual substrate key Ed25519 or Sr25519 and still be able to persist it ?
Because in the application; we never manually generate an address AccountId and we should not modify them.
- Developer
(On the plus side; if I do manually edit in DB one of the address and add a "," I come to the same error you had in the first message.)
- Nicolas80 created branch
48-error-base-58-requirement-is-violated
to address this issuecreated branch
48-error-base-58-requirement-is-violated
to address this issue