Skip to content
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

Test Fwk: Add ScVal validation trait and fns (U63, Bitset, Symbol) #106

Closed
leighmcculloch opened this issue Jul 15, 2022 · 4 comments · Fixed by #111
Closed

Test Fwk: Add ScVal validation trait and fns (U63, Bitset, Symbol) #106

leighmcculloch opened this issue Jul 15, 2022 · 4 comments · Fixed by #111
Assignees

Comments

@leighmcculloch
Copy link
Member

No description provided.

@leighmcculloch leighmcculloch changed the title Add ScVal validation trait and fns (u63, bitset, symbol, ScMap) Test Fwk: Add ScVal validation trait and fns (u63, bitset, symbol, ScMap) Jul 15, 2022
@leighmcculloch
Copy link
Member Author

from @graydon

SCV_U63 has to fit in 63 bits.
SCV_BITSET has to fit in 60 bits.
obj has to be non-None
the chars in symbol have to be [a-zA-Z0-9_]

@leighmcculloch
Copy link
Member Author

@graydon @jonjove Do you folks have opinions on whether we should run through this validation when parsing XDR, or just offer it as additional functions that a developer can call if they wish? I'm thinking the latter since there could be cases where we introduce new constraints in the future and refusing to deserialize any XDR with validations not satisfied could be too blunt. Wdyt?

@graydon
Copy link
Contributor

graydon commented Jul 18, 2022

Yeah I think from a version-safety perspective it's best to do this in core or some part of the host that can be told which version it's expecting to look at.

@leighmcculloch
Copy link
Member Author

leighmcculloch commented Jul 18, 2022

It sounds like from what you're saying that validation needs to occur independently of deserializing. That makes sense and was where I was leaning, I'll continue down that path.

I've implemented this as an extension function behind a trait in this crate, but that doesn't prevent us from either adding a parameter to the validation function that contains a Stellar protocol version, or by creating a new trait for each protocol where validation changes and having types implement each.

@leighmcculloch leighmcculloch changed the title Test Fwk: Add ScVal validation trait and fns (u63, bitset, symbol, ScMap) Test Fwk: Add ScVal validation trait and fns (u63, bitset, symbol) Jul 19, 2022
@leighmcculloch leighmcculloch changed the title Test Fwk: Add ScVal validation trait and fns (u63, bitset, symbol) Test Fwk: Add ScVal validation trait and fns (U63, Bitset, Symbol) Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants