-
Notifications
You must be signed in to change notification settings - Fork 198
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
Implement new invariant for dev and acc fees with scheduled execution #3697
Implement new invariant for dev and acc fees with scheduled execution #3697
Conversation
SebastianMarian
commented
Jan 12, 2022
•
edited
edited
- Implemented a new invariant for developers and accumulated fees, taking into account also the scheduled transactions executed
- Refactored gasConsumed in gasProvided
…king into account also the scheduled transactions executed
…nt-for-dev-and-acc-fees # Conflicts: # genesis/process/disabled/scheduledTxsExecutionHandler.go # process/block/baseProcess.go # process/block/postprocess/feeHandler_test.go # process/block/preprocess/scheduledTxsExecution.go # process/block/preprocess/transactionsV2_test.go # process/coordinator/process.go # process/interface.go # process/sync/baseSync.go # process/sync/storageBootstrap/baseStorageBootstrapper.go # testscommon/scheduledTxsExecutionStub.go
process/block/baseProcess.go
Outdated
"final accumulatedFees", finalMetrics.AccumulatedFees.String(), | ||
log.Error("gasAndFeesDelta", | ||
"initial accumulatedFees", initialGasAndFees.AccumulatedFees.String(), | ||
"final accumulatedFees", initialGasAndFees.AccumulatedFees.String(), |
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.
finalGasAndFees
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.
done
process/block/baseProcess.go
Outdated
"final devFees", finalMetrics.DeveloperFees.String(), | ||
log.Error("gasAndFeesDelta", | ||
"initial devFees", initialGasAndFees.DeveloperFees.String(), | ||
"final devFees", initialGasAndFees.DeveloperFees.String(), |
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.
finalGasAndFees
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.
done
process/block/baseProcess.go
Outdated
"final gasProvided", finalMetrics.GasProvided, | ||
log.Error("gasAndFeesDelta", | ||
"initial gasProvided", initialGasAndFees.GasProvided, | ||
"final gasProvided", initialGasAndFees.GasProvided, |
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.
finalGasAndFees
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.
done
process/block/baseProcess.go
Outdated
"error", process.ErrNegativeValue) | ||
return result | ||
} | ||
|
||
deltaDevFees := big.NewInt(0).Sub(finalMetrics.DeveloperFees, initialMetrics.DeveloperFees) | ||
deltaDevFees := big.NewInt(0).Sub(initialGasAndFees.DeveloperFees, initialGasAndFees.DeveloperFees) |
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.
sub(final, initial)
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.
👍 done
process/block/baseProcess.go
Outdated
"error", process.ErrNegativeValue) | ||
return result | ||
} | ||
|
||
deltaGasProvided := int64(finalMetrics.GasProvided) - int64(initialMetrics.GasProvided) | ||
deltaGasProvided := int64(initialGasAndFees.GasProvided) - int64(initialGasAndFees.GasProvided) |
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.
final - initial
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.
👍 done
process/block/baseProcess.go
Outdated
"error", process.ErrNegativeValue) | ||
return result | ||
} | ||
|
||
deltaGasPenalized := int64(finalMetrics.GasPenalized) - int64(initialMetrics.GasPenalized) | ||
deltaGasPenalized := int64(initialGasAndFees.GasPenalized) - int64(initialGasAndFees.GasPenalized) |
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.
final - initial
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.
👍 done
process/block/baseProcess.go
Outdated
"final gasPenalized", finalMetrics.GasPenalized, | ||
log.Error("gasAndFeesDelta", | ||
"initial gasPenalized", initialGasAndFees.GasPenalized, | ||
"final gasPenalized", initialGasAndFees.GasPenalized, |
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.
finalGasAndFees
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.
done
process/block/baseProcess.go
Outdated
"error", process.ErrNegativeValue) | ||
return result | ||
} | ||
deltaGasRefunded := int64(finalMetrics.GasRefunded) - int64(initialMetrics.GasRefunded) | ||
deltaGasRefunded := int64(initialGasAndFees.GasRefunded) - int64(initialGasAndFees.GasRefunded) |
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.
final - initial
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.
👍 done
process/block/baseProcess.go
Outdated
"final GasRefunded", finalMetrics.GasRefunded, | ||
log.Error("gasAndFeesDelta", | ||
"initial gasRefunded", initialGasAndFees.GasRefunded, | ||
"final gasRefunded", initialGasAndFees.GasRefunded, |
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.
finalGasAndFees
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.
done
@@ -384,14 +384,14 @@ func (bpp *basePreProcess) requestMissingTxsForShard( | |||
return requestedTxs | |||
} | |||
|
|||
func (bpp *basePreProcess) computeGasConsumedByTx( | |||
func (bpp *basePreProcess) computeGasProvidedByTx( |
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 method can be completely removed as it is anyway overshadowed by the one in gasTracker.
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.
done
…nt-for-dev-and-acc-fees # Conflicts: # genesis/process/disabled/scheduledTxsExecutionHandler.go
@@ -3,6 +3,7 @@ package coordinator | |||
import ( | |||
"bytes" | |||
"fmt" | |||
"github.com/ElrondNetwork/elrond-go-core/core/atomic" |
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.
imports are not sorted