Open xJonathanLEI opened 4 weeks ago
The appropriate fix here seems to add a cla
field to APDUCommand
. That would be a breaking change though. What do you think? @prestwich
can you provide some citation? I have used this library with bitcoin a number of times
Yep. So it looks like all the OG apps use 0xE0
, including app-ethereum
and app-bitcoin
.
So first for app-ethereum
you can see here it's using CLA
of 0xE0
.
Then for legacy app-bitcoin
here shows it's also using that. This explains why you've been able to use it with the Bitcoin app as well.
Apparently the new Bitcoin app (i.e. app-bitcoin-new
) uses 0xE1
instead, as shown here. What this means is that using this library even for the new Bitcoin app wouldn't work.
Then now you have the Starknet app which uses 0x5A
.
Hopefully this shows how CLA should be configurable instead of hard-coded :)
In the implementation of
APDUCommand
'swrite_to()
method, the first serialized byte (CLA
) is hard-coded to be0xE0
, the application identifier forapp-ethereum
:https://github.com/summa-tx/coins/blob/51c72c14cb1c0d55bb78b292b80846dd1c1d7a2c/crates/ledger/src/common.rs#L104
This has resulted in the
coins-ledger
app not being functional with anything other than the Ethereum Ledger app. It seems to me that this crate contains otherwise nothing Ethereum-specific. So I guess this should be considered a bug.