- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1k
 
Exec Factor with decimals #4202
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: dev
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.
Much cleaner now. But I'd also adjust BurnGas() since it's documented to use datoshis and for its users (if there are any) that should be sufficient.
| 
           I think it could be more clear if we multiply inside AddFee method, otherwise, AddFee it's in picoDatoshi and BurnFee it's in datoshi, what do you think @roman-khimov @AnnaShaleva?  | 
    
| 
           AddFee is an internal thing, BurnFee is only used by contracts. To me it's not a problem.  | 
    
| 
           Please @neo-project/core review this PR, as we agree in Centre Point it's important for the community. Important changes areas: 
  | 
    
          
 picoGAS! It's 8+4, so 1^-12. picoDatoshi would be 1^-20.  | 
    
| 
           Please @neo-project/core review this PR  | 
    
| 
           Without the current state of dev I can not completely test.  | 
    
          
 Block 0.  | 
    
| 
           In genesis block This one: 
  | 
    
| 
           The  The   | 
    
…t/neo into exec-fee-two-decimals
| 
           Thanks @superboyiii ! please check it again, it should be fixed  | 
    
          
 should not be changed outside the   | 
    
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 me check it with NeoGo implementation.
Co-authored-by: Anna Shaleva <[email protected]>
| 
           I tried some blocks, no incompatible data found. Let me make a full sync to check all.  | 
    
| ExecFeeFactor = NativeContract.Policy.GetExecFeeFactor(snapshotCache); | ||
| if (settings == null || !settings.IsHardforkEnabled(Hardfork.HF_Faun, persistingBlock?.Index ?? NativeContract.Ledger.CurrentIndex(snapshotCache))) | ||
| { | ||
| // The values doesn't have the decimals stored | ||
| _execFeeFactor = NativeContract.Policy.GetExecFeeFactor(this) * FeeFactor; | ||
| } | ||
| else | ||
| { | ||
| // The values have the decimals stored | ||
| _execFeeFactor = NativeContract.Policy.GetExecPicoFeeFactor(this); | ||
| } | ||
| 
               | 
          
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.
@shargon it seems that this logic doesn't work correctly in the following situation (I discovered it while porting this logic to NeoGo and it looks like it works the same way in C#, but I need you to recheck that):
- Consider this 
ApplicationEngineconstructor is called before processing OnPersist trigger of Faun's block. settings.IsHardforkEnabled(Hardfork.HF_Faun, ...)at line 232 returnstrue, because Faun is already enabled at persisting block.- However, Policy's OnPersist wasn't yet executed, hence there's old 
1ExecFeeFactor value stored in the Policy's storage. 
So we end up in a situation when the else branch is executed at line 240, as a result _execFeeFactor will be set to 1 instead of 10000.
So I think we need a special condition for OnPersist trigger of Faun block here. Please, check it.
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 can use a different key, if is not stored, make another query
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.
I think we don't need a different key, the old one works fine after migration, we just need to properly handle the situation when migration isn't done yet.
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.
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.
@AnnaShaleva Could you propose the required changes?
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.
Ping @AnnaShaleva
| 
           Storage is compatible now.  | 
    


Description
Please @neo-project/core review this PR, as we agree in Centre Point it's important for the community.
Was decided in Centre Point to have two decimals in
ExecutionFactorthis PR tries to address itType of change
How Has This Been Tested?
Test Configuration:
Checklist: