-
Notifications
You must be signed in to change notification settings - Fork 141
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
fix(genesis): separate genesis param and chain param #1458
Closed
Closed
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e5e713f
fix(genesis): sparate genesis params and chain params
kehiy 5ee7d91
Merge branch 'main' into params
kehiy 38eaf62
fix(genesis,params): moving genesis params to genesis module
kehiy 3bb1f5e
fix(genesis,params): making genesis params private
kehiy 83fe68b
refactor: removing json and cbor tags from chain params
kehiy c2f5533
fix: failing tests on transaction test and state test
kehiy 06e91b5
Merge branch 'main' into params
kehiy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package genesis | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/pactus-project/pactus/types/amount" | ||
) | ||
|
||
type GenParams struct { | ||
BlockVersion uint8 `cbor:"1,keyasint" json:"block_version"` | ||
BlockIntervalInSecond int `cbor:"2,keyasint" json:"block_interval_in_second"` | ||
CommitteeSize int `cbor:"3,keyasint" json:"committee_size"` | ||
BlockReward amount.Amount `cbor:"4,keyasint" json:"block_reward"` | ||
TransactionToLiveInterval uint32 `cbor:"5,keyasint" json:"transaction_to_live_interval"` | ||
BondInterval uint32 `cbor:"6,keyasint" json:"bond_interval"` | ||
UnbondInterval uint32 `cbor:"7,keyasint" json:"unbond_interval"` | ||
SortitionInterval uint32 `cbor:"8,keyasint" json:"sortition_interval"` | ||
FeeFraction float64 `cbor:"9,keyasint" json:"fee_fraction"` // Deprecated | ||
MinimumFee amount.Amount `cbor:"10,keyasint" json:"minimum_fee"` // Deprecated | ||
MaximumFee amount.Amount `cbor:"11,keyasint" json:"maximum_fee"` // Deprecated | ||
MinimumStake amount.Amount `cobr:"12,keyasint" json:"minimum_stake"` | ||
MaximumStake amount.Amount `cbor:"13,keyasint" json:"maximum_stake"` | ||
} | ||
|
||
func DefaultGenParams() *GenParams { | ||
return &GenParams{ | ||
BlockVersion: 1, | ||
BlockIntervalInSecond: 10, | ||
CommitteeSize: 51, | ||
BlockReward: 1000000000, | ||
TransactionToLiveInterval: 8640, // one day | ||
BondInterval: 360, // one hour | ||
UnbondInterval: 181440, // 21 days | ||
SortitionInterval: 17, | ||
FeeFraction: 0.0, | ||
MinimumFee: 0, | ||
MaximumFee: 0, | ||
MinimumStake: 1000000000, | ||
MaximumStake: 1000000000000, | ||
} | ||
} | ||
|
||
func (p *GenParams) BlockInterval() time.Duration { | ||
return time.Duration(p.BlockIntervalInSecond) * time.Second | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why did you pass params when you can get it from genesis?