Open MonsieurNicolas opened 8 months ago
@leighmcculloch I imagine that we're consistently using "C" strings with tooling outside of core?
Yup, we're consistently using C strkeys in the soroban-env-* crates and all tooling. There was a bug in env where we still used hashes in one place and it was just fixed.
The Rust implementation is here: https://github.com/stellar/rs-stellar-strkey/blob/c5a374eb10dd97492340f8cda72a4a96562e55c2/src/strkey.rs#L175-L225
good -- we want people to use strkeys to avoid sad typos, so only this issue should be left then
I think I found more occurences of this.
When decoding TransactionMeta
using the print-xdr
command, I get contractID
in hex:
"sorobanMeta": {
"ext": {
"v": 0
},
"events": [
{
"ext": {
"v": 0
},
"contractID": "9a1c07d063c8cff8ba513ca036633251658ef3297dfa1acef951e7e5f5ee0c78",
"type": "CONTRACT",
"body": {
This is when decoding
AAAAAwAAAAAAAAACAAAAAwATRCIAAAAAAAAAAJrxsoyNwlOxn1SvTaq4az+yDOErBq47ezvx8YNLvl2YAAAAAK/bo9wABOelAAABEQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAABNEIQAAAABmzgUAAAAAAAAAAAEAE0QiAAAAAAAAAACa8bKMjcJTsZ9Ur02quGs/sgzhKwauO3s78fGDS75dmAAAAACv26PcAATnpQAAARIAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAATRCIAAAAAZs4FBQAAAAAAAAABAAAAHgAAAAAAE0QiAAAACXkMsXSkMB7YudB79Bw0jUGKT1bK8p6GY90RnWoxCnxjADLoIQAAAAAAAAAAABNEIgAAAAYAAAAAAAAAAdO4GjbQ/5XIOxrdY/FmiAJvg39WqDql5A102xPK8n59AAAAFAAAAAEAAAATAAAAANmJ1zygMll5UFfgwljl2ukoZkuHdndRDoo7GBOcylO2AAAAAAAAAAAAAAAAABNEIgAAAAk7hyWgcJfdtMPrO8kugadxc7lvqdv6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ContractEvent
{
// We can use this to add more fields, or because it
// is first, to change ContractEvent into a union.
ExtensionPoint ext;
Hash* contractID;
ContractEventType type;
union switch (int v)
{
case 0:
struct
{
SCVal topics<>;
SCVal data;
} v0;
}
body;
};
The Hash*
should be a SCAddress*
, like: https://github.com/stellar/stellar-xdr/blob/4ec28d95dd84b109253e22b151314478d6f00522/Stellar-ledger-entries.x#L505.
mmm that would be a breaking change as contractID is type 1 not 0. This is annoying: it is plausible that we would want accounts to emit events at some point (as part of unifying data models between classic and Soroban)
mmm that would be a breaking change as contractID is type 1 not 0.
We can't use the extension point as the ScAddress discriminant, but we could use the extension point to change the Hash to a ScAddress in the next release.
That's backwards compatible, but not forwards compatible. I don't see a way to make the change in a way that's forwards compatible.
It looks like https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0023.md is not implemented in core.
When converting an
SCAddress
into a string, it just displays them as hex instead of aC...
address.For example, operations (when logging) are stringified as:
where it should be something like:
This also impacts other places where we display addresses:
print-xdr
andcommand-xdr
dump-ledger
command with filtersstellar-core --conf testnet.cfg --console dump-ledger --output-file my-contract.json --filter-query "data.type == 'CONTRACT_DATA' && data.contractData.contract.contractId == '34db11ed17823ea88b32475b5a77a13e090d536c1abf0dbb99835b1496956a66'"
(should use a "C" string here)