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

Fee calculation unit #41

Merged
merged 3 commits into from
Jul 23, 2018
Merged

Fee calculation unit #41

merged 3 commits into from
Jul 23, 2018

Conversation

ncying
Copy link
Contributor

@ncying ncying commented Jul 19, 2018

  1. add fee calculation unit data/data field
  2. set the unit to 0 in block
  3. add fee calculation unit to block head

current block information in API:

{
  "version": 2,
  "timestamp": 1531983355004866800,
  "reference": "3jopEY9eGvAMjcipuucC3747RmHCnX6wQCHSjx5sXKvgA3GU58iAcBZrL2RhhwUXMJkaCHCXgwB15KgsMh6bJe2o",
  "spos-consensus": {
    "mint-time": 1531983355000000000,
    "mint-balance": 5555173895,
    "generation-signature": "J8BotjQYQ8TmAYiQBSvNySqdRH3p7sXeNGTM1er36UXz"
  },
  "fee-calculation-unit": {
    "computational-unit": 0,
    "storage-unit": 0,
    "memory-storage-unit": 0,
    "random-io-unit": 0,
    "sequential-io-unit": 0
  },
  "TransactionMerkleRoot": "9xcEnZHzhnLDHqowmqpqDFnPm67V7mZVxfv3dsQGWgHv",
  "transactions": [
    {
      "type": 11,
      "id": "9aLuqWHocjWBGxDJySmqmQMfn7zaJ5yYQrMGX6yS2fWy",
      "sender": "3N4SMepbKXPRADdjfUwNYKdcZdMoVJGXQP5",
      "senderPublicKey": "F2kBqJzCHut3k1EWqMb51CLYiUio9C6JSAkeExHo8hKs",
      "fee": 100000,
      "timestamp": 1531983355004866800,
      "signature": "326BkmqR7tQnRbZ4HcwfSTruCJAHD9D7FHWVZzUSRe5KeNoReTVNhYFyY49ZLjy9M57PEkwNq1L75Q6zJpRV2sng",
      "minterPublicKey": "F2kBqJzCHut3k1EWqMb51CLYiUio9C6JSAkeExHo8hKs",
      "minterAddress": "3N4SMepbKXPRADdjfUwNYKdcZdMoVJGXQP5",
      "amount": 100000000,
      "currentBlockHeight": 10,
      "status": "Success",
      "feeCharged": 0
    }
  ],
  "generator": "3N4SMepbKXPRADdjfUwNYKdcZdMoVJGXQP5",
  "signature": "sj6gJ1HsAWfQwUd3gVBgBPvDHpmSDRyd6v2MMNbEbdQQptFE41JRwUDzB2ew6JFgdbKUj6XL9ZcsATs7HJDor1K",
  "fee": 100000,
  "blocksize": 440,
  "height": 10
}

@ncying ncying requested a review from sunnyking July 19, 2018 07:01
@ncying ncying mentioned this pull request Jul 19, 2018
@virtualeconomy
Copy link
Contributor

@sunnyking what's the long term plan for these fields? do we only need it at block level (vs. txn level)?

@ncying
Copy link
Contributor Author

ncying commented Jul 19, 2018

minters can decide these units in each block. all tx fee in block can be calculated by these units. based on the real cost (linear combination of these unit), different txs will be charged in different tx fee. all tx fee will be destroyed (shared by the whole community). tx sender need to set the upper-bound tx fee of each tx (similar as gas)

@sunnyking
Copy link
Contributor

sunnyking commented Jul 20, 2018

These names would look better imo:
"resourcePricingData": {
"computation": 0,
"storage": 0,
"memory": 0,
"randomIO": 0,
"sequentialIO": 0
},
BTW I think the consensusData dump should also be printed in similar style so the block dump looks consistent stylewise. Although that should be cleaned up later in a separate request.

@@ -0,0 +1,7 @@
package vee.fee

case class FeeCalculationUnitBlockData(computationalUnit: Long, storageUnit: Long, memoryStorageUnit: Long, randomIOUnit: Long, sequentialIOUnit: Long)
Copy link
Contributor

Choose a reason for hiding this comment

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

Imo it's better called ResourcePricingBlockData

Copy link
Contributor

@sunnyking sunnyking Jul 20, 2018

Choose a reason for hiding this comment

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

computationUnitCost
storageUnitCost
memoryUnitCost
randomIOUnitCost
sequentialIOUnitCost

@ncying
Copy link
Contributor Author

ncying commented Jul 20, 2018

fixed

current block info:

{
  "version": 2,
  "timestamp": 1532058710000014000,
  "reference": "347kpi3T4aLf6NrZW5BgAyRntf4Qy3kDNZVu9vgaYC5kopatMNzvzk9Euk2AU9daSm4PHmkcoVQ1sKabDL3KVnMg",
  "SPOSConsensus": {
    "mintTime": 1532058710000000000,
    "mintBalance": 2995895498777,
    "generationSignature": "7CUU2KmZuNVPpqWDNnrzKAr5cMTBAZxLQbY8nELPByuL"
  },
  "resourcePricingData": {
    "computation": 0,
    "storage": 0,
    "memory": 0,
    "randomIO": 0,
    "sequentialIO": 0
  },
  "TransactionMerkleRoot": "GGj9oNfgq1VetUCx9t2kw5G3nQy3o4TP9b453ph1FS2B",
  "transactions": [
    {
      "type": 11,
      "id": "7YNVF3J8G8g4CK43gbT5eedBYvvmGwyAmQX4eWDGBDB7",
      "sender": "3N4SMepbKXPRADdjfUwNYKdcZdMoVJGXQP5",
      "senderPublicKey": "F2kBqJzCHut3k1EWqMb51CLYiUio9C6JSAkeExHo8hKs",
      "fee": 100000,
      "timestamp": 1532058710000014000,
      "signature": "59pJN5FeMjZi4WS3MCKJznS5xsZ6EAWpxEgWJ6RJ9iS39vEfe5i3gAc6Yh7vudccsKdhBoYi6yeS8XKq1WTApDLV",
      "minterPublicKey": "F2kBqJzCHut3k1EWqMb51CLYiUio9C6JSAkeExHo8hKs",
      "minterAddress": "3N4SMepbKXPRADdjfUwNYKdcZdMoVJGXQP5",
      "amount": 100000000,
      "currentBlockHeight": 4411,
      "status": "Success",
      "feeCharged": 0
    }
  ],
  "generator": "3N4SMepbKXPRADdjfUwNYKdcZdMoVJGXQP5",
  "signature": "h1Cz2v771zR6SZEfK5HKPmhwem9uMJyrvrbckmiuFyXuB1BL4jA3wkUfmCuP62o9PrZYXXsPsNpw2mTkBELQKYB",
  "fee": 100000,
  "blocksize": 440,
  "height": 4411
}

@sunnyking sunnyking merged commit 9ac00d3 into master Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants