-
Notifications
You must be signed in to change notification settings - Fork 5
[Bug]: Colliding state keys are not detected #335
Copy link
Copy link
Description
Description
I have a contract where I accidentally defined two global state values with the same key via inheritance. The compiler let this compile which lead to unexpected bugs in contract behavior.
Steps to Reproduce
Compile contracts with the following state
export class MimcMerkle extends Contract {
rootCounter = GlobalState<uint64>({ key: "c" });export class Mithras extends MimcMerkle {
creationRound = GlobalState<uint64>({ key: "c" });Expected Behavior
The compiler throws an error when keys collide. In TEALScript there was a check for colliding keys but also a check for potential collision between keys, prefixes, and dynamic types. We don't need all of that to fix this specific issue, but it may be nice to have in the future.
https://github.com/algorandfoundation/tealscript/blob/dev/src/lib/compiler.ts#L5648
Screenshots
No response
Device Info
version: 1.1.0(tslib@2.8.1)
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels