-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix finalize print statement #2976
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
base: staging
Are you sure you want to change the base?
Conversation
synthesizer/process/src/finalize.rs
Outdated
| let constructor_types = stack.get_constructor_types()?.clone(); | ||
|
|
||
| // Set the FinalizeRegisters function name for constructors. | ||
| // Before ConsensusVersion::V12, this was wrongly using the program id as function name. |
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.
Why is it "wrong" to use the program ID name vs. hard-coding constructor? Is there a security issue or is this purely for logging?
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.
Wrong was maybe strongly worded, but we are setting a program_id into a variable called function_name, which is semantically wrong. It's a piece of the code few people looked at, so added some documentation: f644a54
synthesizer/process/src/finalize.rs
Outdated
| // Set the FinalizeRegisters function name for constructors. | ||
| // Before ConsensusVersion::V12, this was wrongly using the program id as function name. | ||
| let consensus_version = N::CONSENSUS_VERSION(state.block_height())?; | ||
| let identifier = if consensus_version >= ConsensusVersion::V12 { |
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.
If the purpose of this change is to improve the log message, can you pass in a flag to finalize_command_expect_await and set the message accordingly?
This avoids the permanent "overhead" of tracking this to a ConsensusVersion
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.
Agreed, it adds complexity and risks a fork. Changed it to just a logging adjustment: 7d92c1e
895b850 to
7d92c1e
Compare
Motivation
When investigating the reasons for a rejected transaction, I surfaced these logs:
Based on the respective commands which failed, it is clear these are 'transfer_public' and 'fee_public' calls which fail due to insufficient balance. Instead of logging these as constructor calls, they should be logged as the respective function call.
Test Plan
Manually reviewed all instances of
registers.function_nameto catch potential issues.