-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treat syscalls as nodes #112
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know we have 0.13.2.1 on mainnet now xD
#[arg(long)] | ||
versioned_constants_path: Option<Utf8PathBuf>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document it, it is not obvious that it is a file with costs . Also we should state that if not provided the default will be used which is constants for 0.13.2.1.
I also wonder if the name is not misleading, since we don't need all the constants, just the costs
@@ -72,10 +76,14 @@ fn main() -> Result<()> { | |||
); | |||
} | |||
|
|||
let os_resources_map = read_and_parse_versioned_constants_file(&cli.versioned_constants_path) | |||
.expect("Failed to parse versioned constants file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.expect("Failed to parse versioned constants file"); | |
.context("Failed to parse versioned constants file")?; |
This shouldn't panic as it is user error
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct OsResources { | ||
pub execute_syscalls: HashMap<DeprecatedSyscallSelector, VmExecutionResources>, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is profiler specific, shouldn't be in this crate especially since we will migrate to use cairo-annotations
crate
let parsed_resources = json_value | ||
.get("os_resources") | ||
.expect("Field 'os_resources' not found in versioned constants file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let parsed_resources = json_value | |
.get("os_resources") | |
.expect("Field 'os_resources' not found in versioned constants file"); | |
let parsed_resources = json_value | |
.get("os_resources") | |
.context("Field 'os_resources' not found in versioned constants file")?; |
This is a user error, shouldn't panic
let os_resources_map = read_and_parse_versioned_constants_file(&cli.versioned_constants_path) | ||
.expect("Failed to parse versioned constants file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] imo should be in line 65 so reading from files is close to each other
"validated": "VALID" | ||
}, | ||
"os_resources": { | ||
"execute_syscalls": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove everything else and just leave what's needed
{
"CallContract": {
"n_steps": 827,
"builtin_instance_counter": {
"range_check_builtin": 15
},
"n_memory_holes": 0
},
// ....
then we can have
pub type SyscallResourcesMap = HashMap<DeprecatedSyscallSelector, VmExecutionResources>;
} | ||
} | ||
|
||
pub fn read_and_parse_versioned_constants_file(path: &Option<Utf8PathBuf>) -> Result<OsResources> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function being here mixes abstraction layers. It just reads from the file, while the trace_reader
module ([nit] should be name trace_builder
or sth like that now that I think about it, but not relevant here) is about logic related to trace building.
It should be in a separate file I think
Closes #88
Introduced changes
Checklist
CHANGELOG.md
Minimal example: