-
Notifications
You must be signed in to change notification settings - Fork 42
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
Enforce DepthLimiter
in the Host
to avoid stack overflow
#904
Conversation
Generally speaking this looks great, I'm glad the rough idea looks like it holds together! A couple suggestions:
|
re: make this a config setting. Right now we have a few of these limits hard coded in the XDR (like number of signers), and it's probably fine for now as it allows clients everywhere to also implement it without connecting to the network and it's just less work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, a few questions and nits.
… stack-limit-test
… stack-limit-test
DepthLimiter
on Env
to avoid stack overflow
DepthLimiter
on Env
to avoid stack overflowDepthLimiter
in the Host
to avoid stack overflow
What
The env side changes to resolve #861
Based on rs-stellar-xdr changes in stellar/rs-stellar-xdr#281
Xdrgen side changes: stellar/xdrgen#158
This is ready for review. I will rebase and update the rs-stellar-xdr hash once the above PR is merged.
DepthLimiter
forEnvBase
, which applies to allEnv
s, host, guest, etc. It's added to the EnvBase to avoid unnecessary noises (avoidE: Env
->E: Env + DepthLimiter
everywhere).DepthGuard
type is added as the RAII guard for the depth counter.env
: Val convertion to/from ScVal, comparison, deep clone. (ser/deser will be covered by rs-stellar-xdr'sReadXdr
,WriteXdr
, which are already depth-limited).pub const DEFAULT_HOST_DEPTH_LIMIT: u32 = 100
in the host and we can later choose to make this a network config parameter.Why
[TODO: Why this change is being made. Include any context required to understand the why.]
Known limitations
[TODO or N/A]