I would like to know what curly brackets mean in that case ?
uint64 configCount = s_configCount;
{
s_hotVars.latestConfigDigest = configDigestFromConfigData(
address(this),
configCount,
_signers,
_transmitters,
_threshold,
_encodedConfigVersion,
_encoded
);
s_hotVars.latestEpochAndRound = 0;
}```
Why did they use {} ? why they didn't wrote the code like this :
uint64 configCount = s_configCount;
s_hotVars.latestConfigDigest = configDigestFromConfigData(address(this),configCount,_signers,_transmitters,_threshold,_encodedConfigVersion,_encoded);
s_hotVars.latestEpochAndRound = 0;
Curly braces are for the scoping rules.
They also allocate a new stack frame. Because the small stack is a pain for developers in EVM. Scoping is needed with deep call structures to avoid stack too deep error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With