You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contractFoo {
struct S {
uint[] arr;
}
function main(S storagev) private {
S storage v1 = v;
}
}
Running scribble (up to version 0.5.5) on this produces the following crash:
/home/dimo/work/consensys/scribble-clean/dist/instrumenter/state_vars.js:321
throw new Error(`Unexpected RHS element ${__1.print(rhs)} in assignment to state var pointer`);
^
Error: Unexpected RHS element v in assignment to state var pointer
at gatherRHSVars (/home/dimo/work/consensys/scribble-clean/dist/instrumenter/state_vars.js:321:15)
at Object.findAliasedStateVars (/home/dimo/work/consensys/scribble-clean/dist/instrumenter/state_vars.js:350:26)
at new InstrumentationContext (/home/dimo/work/consensys/scribble-clean/dist/instrumenter/instrumentation_context.js:231:38)
at Object.<anonymous> (/home/dimo/work/consensys/scribble-clean/dist/bin/scribble.js:487:26)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
The issue is that the logic of this does not account for the case where the RHS of an assignment to a storage pointer is an Identifier, but its not a direct reference to a state var. This happens when the RHS is another storage pointer. (see code below):
/** * Given a potentially complex RHS expression, return the list of * state variable declarations that it may alias */constgatherRHSVars=(rhs: Expression): VariableDeclaration[]=>{if(isStateVarRef(rhs)){// <-- This check needs to handle all Identifiersreturn[rhs.vReferencedDeclarationasVariableDeclaration];}
...
thrownewError(`Unexpected RHS element ${print(rhs)} in assignment to state var pointer`);};
The text was updated successfully, but these errors were encountered:
Consider the following sample:
Running scribble (up to version 0.5.5) on this produces the following crash:
The issue is that the logic of this does not account for the case where the RHS of an assignment to a storage pointer is an Identifier, but its not a direct reference to a state var. This happens when the RHS is another storage pointer. (see code below):
The text was updated successfully, but these errors were encountered: