neo-project / neo-debugger

Neo Smart Contract Debugger for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ngd-seattle.neo-contract-debug
MIT License
24 stars 17 forks source link

Errant warning in signers.scopes + signers.allowedcontracts should support specifying contract name #165

Closed RawichK closed 2 years ago

RawichK commented 2 years ago

Location: signers object in launch.json

"signers": [
  {
    "account": "@owner",
    "scopes": "CalledByEntry, CustomContracts",
    "allowedcontracts": ["0xd2a4cff31913016155e38e474a2c06d08be276cf"] // GAS contract hash
  }
]

The scopes can be specified as "CalledByEntry, CustomContracts" and works well but it shows a warning Value is not accepted. Valid values: "None", "CalledByEntry", "CustomContracts", "CustomGroups", "Global".(1)

The allowedcontracts accept only contract hash, but contract hash changes every time re-build / re-deploy, so #contractName notation should be added (the same format as invoke files).

devhawk commented 2 years ago

We already parse contract names elsewhere, so it's fairly straightforward to enable something like

"signers": [
  {
    "account": "@owner",
    "scopes": "CalledByEntry, CustomContracts",
    "allowedcontracts": ["GasToken"] 
  }
]

Also, the Value is not accepted warning can be safely ignored. The json schema for scopes property is wrong, but that doesn't affect the actual value parsing of the property by the debugger. But that should ALSO get fixed

devhawk commented 2 years ago

labeled bug and feature. warning is a bug, specifying allowed contract by name is a feature. But they are both small enough there's no point in splitting them into separate issues.