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
I'm trying to use slither on a project that makes use of user defined value types. Basically the example from this post.
I'm using the latest slither release at the time (0.8.2).
Example contract that triggers the issue:
//SPDX-License-Identifier: Unlicensepragma solidity^0.8.8;
// Represent a 18 decimal, 256 bit wide fixed point type// using a user defined value type.type UFixedisuint256;
/// A minimal library to do fixed point operations on UFixed.libraryFixedMath {
uintconstant multiplier =10**18;
/// Adds two UFixed numbers. Reverts on overflow, /// relying on checked arithmetic on uint256.function add(UFixed a, UFixed b) internalpurereturns (UFixed) {
return UFixed.wrap(UFixed.unwrap(a) + UFixed.unwrap(b));
}
/// Multiplies UFixed and uint256. Reverts on overflow,/// relying on checked arithmetic on uint256.function mul(UFixed a, uint256b) internalpurereturns (UFixed) {
return UFixed.wrap(UFixed.unwrap(a) * b);
}
/// Take the floor of a UFixed number./// @return the largest integer that does not exceed `a`.function floor(UFixed a) internalpurereturns (uint256) {
return UFixed.unwrap(a) / multiplier;
}
/// Turns a uint256 into a UFixed of the same value./// Reverts if the integer is too large.function toUFixed(uint256a) internalpurereturns (UFixed) {
return UFixed.wrap(a * multiplier);
}
}
contractGreeter {
using FixedMathfor UFixed;
UFixed public someValue;
constructor(stringmemory_greeting) {
}
}
The output of slither . is
Traceback (most recent call last):
File "/home/xxx/.local/lib/python3.10/site-packages/slither/__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/home/xxx/.local/lib/python3.10/site-packages/slither/__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/home/xxx/.local/lib/python3.10/site-packages/slither/__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/home/xxx/.local/lib/python3.10/site-packages/slither/slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "/home/xxx/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 270, in parse_top_level_from_loaded_json
raise SlitherException(f"Top level {top_level_data[self.get_key()]} not supported")
slither.exceptions.SlitherException: Top level UserDefinedValueTypeDefinition not supported
Error:
Top level UserDefinedValueTypeDefinition not supported
Please report an issue to https://github.com/crytic/slither/issues
The text was updated successfully, but these errors were encountered:
I'm trying to use slither on a project that makes use of user defined value types. Basically the example from this post.
I'm using the latest slither release at the time (0.8.2).
Example contract that triggers the issue:
The output of
slither .
isThe text was updated successfully, but these errors were encountered: