Skip to content
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

Conversation

SebastianMarian
Copy link
Contributor

@SebastianMarian SebastianMarian commented Jan 12, 2022

  • 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
@SebastianMarian SebastianMarian self-assigned this Jan 12, 2022
@SebastianMarian SebastianMarian added the type:feature New feature or request label Jan 12, 2022
@SebastianMarian SebastianMarian changed the title [WIP] Implement new invariant for dev and acc fees with scheduled execution Implement new invariant for dev and acc fees with scheduled execution Jan 13, 2022
Base automatically changed from fix-gas-tracking-scheduled-sc to feat/scheduled-sc-execution January 14, 2022 15:43
…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
@raduchis raduchis self-requested a review January 17, 2022 11:29
"final accumulatedFees", finalMetrics.AccumulatedFees.String(),
log.Error("gasAndFeesDelta",
"initial accumulatedFees", initialGasAndFees.AccumulatedFees.String(),
"final accumulatedFees", initialGasAndFees.AccumulatedFees.String(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finalGasAndFees

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"final devFees", finalMetrics.DeveloperFees.String(),
log.Error("gasAndFeesDelta",
"initial devFees", initialGasAndFees.DeveloperFees.String(),
"final devFees", initialGasAndFees.DeveloperFees.String(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finalGasAndFees

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"final gasProvided", finalMetrics.GasProvided,
log.Error("gasAndFeesDelta",
"initial gasProvided", initialGasAndFees.GasProvided,
"final gasProvided", initialGasAndFees.GasProvided,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finalGasAndFees

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"error", process.ErrNegativeValue)
return result
}

deltaDevFees := big.NewInt(0).Sub(finalMetrics.DeveloperFees, initialMetrics.DeveloperFees)
deltaDevFees := big.NewInt(0).Sub(initialGasAndFees.DeveloperFees, initialGasAndFees.DeveloperFees)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sub(final, initial)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done

"error", process.ErrNegativeValue)
return result
}

deltaGasProvided := int64(finalMetrics.GasProvided) - int64(initialMetrics.GasProvided)
deltaGasProvided := int64(initialGasAndFees.GasProvided) - int64(initialGasAndFees.GasProvided)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final - initial

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done

"error", process.ErrNegativeValue)
return result
}

deltaGasPenalized := int64(finalMetrics.GasPenalized) - int64(initialMetrics.GasPenalized)
deltaGasPenalized := int64(initialGasAndFees.GasPenalized) - int64(initialGasAndFees.GasPenalized)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final - initial

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done

"final gasPenalized", finalMetrics.GasPenalized,
log.Error("gasAndFeesDelta",
"initial gasPenalized", initialGasAndFees.GasPenalized,
"final gasPenalized", initialGasAndFees.GasPenalized,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finalGasAndFees

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"error", process.ErrNegativeValue)
return result
}
deltaGasRefunded := int64(finalMetrics.GasRefunded) - int64(initialMetrics.GasRefunded)
deltaGasRefunded := int64(initialGasAndFees.GasRefunded) - int64(initialGasAndFees.GasRefunded)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final - initial

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done

"final GasRefunded", finalMetrics.GasRefunded,
log.Error("gasAndFeesDelta",
"initial gasRefunded", initialGasAndFees.GasRefunded,
"final gasRefunded", initialGasAndFees.GasRefunded,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finalGasAndFees

Copy link
Contributor Author

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(
Copy link
Contributor

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.

Copy link
Contributor Author

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports are not sorted

@AdoAdoAdo AdoAdoAdo merged commit 8fc7e3e into feat/scheduled-sc-execution Jan 17, 2022
@AdoAdoAdo AdoAdoAdo deleted the implement-new-invariant-for-dev-and-acc-fees branch January 17, 2022 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants