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

Сoins_per_utxo_byte param to pparams #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final case class ProtocolParams(
poolPledgeInfluence: Double,
monetaryExpansion: Double,
treasuryCut: Double,
coinsPerUtxoByte: Option[Long],
utxoCostPerWord: Option[Long],
costModels: Map[String, Map[String, Long]],
executionUnitPrices: ExecutionUnitPrices,
Expand All @@ -39,31 +40,33 @@ object ProtocolParams {

implicit val schema: Schema[ProtocolParams] = Schema.derived[ProtocolParams]

def fromEpochParams(epochParams: EpochParams, costModelsMap: Map[String, Map[String, Long]]): ProtocolParams = ProtocolParams(
protocolVersion = ProtocolVersion(epochParams.majorVersion, epochParams.minorVersion),
decentralization = epochParams.decentralization,
extraPraosEntropy = epochParams.extraEntropy,
maxBlockHeaderSize = epochParams.maxBlockHeaderSize,
maxBlockBodySize = epochParams.maxBlockSize,
maxTxSize = epochParams.maxTxSize,
txFeeFixed = epochParams.txFeeFixed,
txFeePerByte = epochParams.txFeePerByte,
minUTxOValue = epochParams.minUtxoValue,
stakeAddressDeposit = epochParams.keyDeposit,
stakePoolDeposit = epochParams.poolDeposit,
minPoolCost = epochParams.minPoolCost,
poolRetireMaxEpoch = epochParams.maxEpoch,
stakePoolTargetNum = epochParams.optimalPoolCount,
poolPledgeInfluence = epochParams.influence,
monetaryExpansion = epochParams.monetaryExpansion,
treasuryCut = epochParams.treasuryGrowthRate,
utxoCostPerWord = epochParams.costPerSize,
costModels = costModelsMap,
executionUnitPrices = ExecutionUnitPrices(epochParams.priceStep, epochParams.priceMemory),
maxTxExecutionUnits = ExecutionUnits(epochParams.maxTxExSteps, epochParams.maxTxExMem),
maxBlockExecutionUnits = ExecutionUnits(epochParams.maxBlockExSteps, epochParams.maxBlockExMem),
maxValueSize = epochParams.maxValSize,
collateralPercentage = epochParams.collateralPercent,
maxCollateralInputs = epochParams.maxCollateralInputs
)
def fromEpochParams(epochParams: EpochParams, costModelsMap: Map[String, Map[String, Long]]): ProtocolParams =
ProtocolParams(
protocolVersion = ProtocolVersion(epochParams.majorVersion, epochParams.minorVersion),
decentralization = epochParams.decentralization,
extraPraosEntropy = epochParams.extraEntropy,
maxBlockHeaderSize = epochParams.maxBlockHeaderSize,
maxBlockBodySize = epochParams.maxBlockSize,
maxTxSize = epochParams.maxTxSize,
txFeeFixed = epochParams.txFeeFixed,
txFeePerByte = epochParams.txFeePerByte,
minUTxOValue = epochParams.minUtxoValue,
stakeAddressDeposit = epochParams.keyDeposit,
stakePoolDeposit = epochParams.poolDeposit,
minPoolCost = epochParams.minPoolCost,
poolRetireMaxEpoch = epochParams.maxEpoch,
stakePoolTargetNum = epochParams.optimalPoolCount,
poolPledgeInfluence = epochParams.influence,
monetaryExpansion = epochParams.monetaryExpansion,
treasuryCut = epochParams.treasuryGrowthRate,
coinsPerUtxoByte = epochParams.coinsPerUtxoByte,
utxoCostPerWord = epochParams.coinsPerUtxoByte,
costModels = costModelsMap,
executionUnitPrices = ExecutionUnitPrices(epochParams.priceStep, epochParams.priceMemory),
maxTxExecutionUnits = ExecutionUnits(epochParams.maxTxExSteps, epochParams.maxTxExMem),
maxBlockExecutionUnits = ExecutionUnits(epochParams.maxBlockExSteps, epochParams.maxBlockExMem),
maxValueSize = epochParams.maxValSize,
collateralPercentage = epochParams.collateralPercent,
maxCollateralInputs = epochParams.maxCollateralInputs
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final case class EpochParams(
influence: Double,
monetaryExpansion: Double,
treasuryGrowthRate: Double,
costPerSize: Option[Long],
coinsPerUtxoByte: Option[Long],
costModelId: Int,
priceStep: Option[Double],
priceMemory: Option[Double],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ final class OutputsSql(implicit lh: LogHandler) {
| o.value,
| encode(o.data_hash, 'hex'),
| d.value,
| else encode(d.bytes, 'hex'),
| encode(d.bytes, 'hex'),
| i.id,
| encode(ti.hash, 'hex'),
| encode(s.hash, 'hex')
Expand Down
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ object Dependencies {
)
}
}