diff --git a/cmd/cmd.go b/cmd/cmd.go index e1cf0fbf9..76427b2cb 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -24,7 +24,6 @@ import ( "github.com/pactus-project/pactus/genesis" "github.com/pactus-project/pactus/node" "github.com/pactus-project/pactus/types/account" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util" "github.com/pactus-project/pactus/wallet" @@ -440,7 +439,7 @@ func makeLocalGenesis(w wallet.Wallet) *genesis.Genesis { } // create genesis - params := param.DefaultParams() + params := genesis.DefaultGenesisParams() params.BlockVersion = 0 gen := genesis.MakeGenesis(util.RoundNow(60), accs, vals, params) diff --git a/consensus/consensus_test.go b/consensus/consensus_test.go index 416c40ce2..795d2d12d 100644 --- a/consensus/consensus_test.go +++ b/consensus/consensus_test.go @@ -16,7 +16,6 @@ import ( "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/block" "github.com/pactus-project/pactus/types/certificate" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/proposal" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/validator" @@ -86,7 +85,7 @@ func setupWithSeed(t *testing.T, seed int64) *testData { acc := account.NewAccount(0) acc.AddToBalance(21 * 1e14) accs := map[crypto.Address]*account.Account{crypto.TreasuryAddress: acc} - params := param.DefaultParams() + params := genesis.DefaultGenesisParams() params.CommitteeSize = 4 // To prevent triggering timers before starting the tests and diff --git a/genesis/genesis.go b/genesis/genesis.go index a3d017489..9890d30a8 100644 --- a/genesis/genesis.go +++ b/genesis/genesis.go @@ -11,7 +11,6 @@ import ( "github.com/pactus-project/pactus/crypto/hash" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util" ) @@ -57,7 +56,7 @@ type Genesis struct { type genesisData struct { GenesisTime time.Time `cbor:"1,keyasint" json:"genesis_time"` - Params *param.Params `cbor:"2,keyasint" json:"params"` + Params *GenesisParams `cbor:"2,keyasint" json:"params"` Accounts []genAccount `cbor:"3,keyasint" json:"accounts"` Validators []genValidator `cbor:"4,keyasint" json:"validators"` } @@ -72,7 +71,7 @@ func (gen *Genesis) GenesisTime() time.Time { return gen.data.GenesisTime } -func (gen *Genesis) Params() *param.Params { +func (gen *Genesis) Params() *GenesisParams { return gen.data.Params } @@ -124,7 +123,7 @@ func makeGenesisValidator(val *validator.Validator) genValidator { } func MakeGenesis(genesisTime time.Time, accounts map[crypto.Address]*account.Account, - validators []*validator.Validator, params *param.Params, + validators []*validator.Validator, params *GenesisParams, ) *Genesis { genAccs := make([]genAccount, len(accounts)) for addr, acc := range accounts { diff --git a/types/param/param.go b/genesis/genesis_params.go similarity index 86% rename from types/param/param.go rename to genesis/genesis_params.go index f4f319212..ed04f0d8f 100644 --- a/types/param/param.go +++ b/genesis/genesis_params.go @@ -1,4 +1,4 @@ -package param +package genesis import ( "time" @@ -6,7 +6,7 @@ import ( "github.com/pactus-project/pactus/types/amount" ) -type Params struct { +type GenesisParams 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"` @@ -22,8 +22,8 @@ type Params struct { MaximumStake amount.Amount `cbor:"13,keyasint" json:"maximum_stake"` } -func DefaultParams() *Params { - return &Params{ +func DefaultGenesisParams() *GenesisParams { + return &GenesisParams{ BlockVersion: 1, BlockIntervalInSecond: 10, CommitteeSize: 51, @@ -32,14 +32,16 @@ func DefaultParams() *Params { BondInterval: 360, // one hour UnbondInterval: 181440, // 21 days SortitionInterval: 17, - FeeFraction: 0.0001, - MinimumFee: 1000, - MaximumFee: 1000000, MinimumStake: 1000000000, MaximumStake: 1000000000000, + + // Deprecated: Replaced by fix fee + FeeFraction: 0.0, + MinimumFee: 0, + MaximumFee: 0, } } -func (p *Params) BlockInterval() time.Duration { +func (p *GenesisParams) BlockInterval() time.Duration { return time.Duration(p.BlockIntervalInSecond) * time.Second } diff --git a/genesis/genesis_test.go b/genesis/genesis_test.go index 56e3284fc..0b8bedcff 100644 --- a/genesis/genesis_test.go +++ b/genesis/genesis_test.go @@ -10,7 +10,6 @@ import ( "github.com/pactus-project/pactus/genesis" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util" "github.com/pactus-project/pactus/util/testsuite" @@ -26,7 +25,7 @@ func TestMarshaling(t *testing.T) { val, _ := ts.GenerateTestValidator(0) gen1 := genesis.MakeGenesis(util.RoundNow(10), map[crypto.Address]*account.Account{prv: acc}, - []*validator.Validator{val}, param.DefaultParams()) + []*validator.Validator{val}, genesis.DefaultGenesisParams()) gen2 := new(genesis.Genesis) assert.Equal(t, 10, gen1.Params().BlockIntervalInSecond) @@ -95,7 +94,7 @@ func TestCheckGenesisAccountAndValidator(t *testing.T) { accs[pub.AccountAddress()] = acc vals = append(vals, val) } - gen := genesis.MakeGenesis(time.Now(), accs, vals, param.DefaultParams()) + gen := genesis.MakeGenesis(time.Now(), accs, vals, genesis.DefaultGenesisParams()) for addr, acc := range gen.Accounts() { assert.Equal(t, accs[addr], acc) diff --git a/genesis/testnet.json b/genesis/testnet.json index 3275ea629..2f5d73a51 100644 --- a/genesis/testnet.json +++ b/genesis/testnet.json @@ -51,4 +51,4 @@ "public_key": "tpublic1pjy7z27zm6795xhj8rln65cve88dtqjkg7gca6scxzwwfxpncnmkhg35n2rw3fa9e04cqcc8c9fyqvpm7y39wj0x2e5qrl0he60ms6v79vga3le2uvgn566p7x9exjnyhh3klycqddstj7339afnm73k09v8k52uy" } ] -} +} \ No newline at end of file diff --git a/node/node_test.go b/node/node_test.go index 2cfc4f107..04c4520ab 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -10,7 +10,6 @@ import ( "github.com/pactus-project/pactus/crypto/hash" "github.com/pactus-project/pactus/genesis" "github.com/pactus-project/pactus/types/account" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util" "github.com/pactus-project/pactus/util/logger" @@ -30,7 +29,7 @@ func TestRunningNode(t *testing.T) { val := validator.NewValidator(pub, 0) gen := genesis.MakeGenesis(time.Now(), map[crypto.Address]*account.Account{crypto.TreasuryAddress: acc}, - []*validator.Validator{val}, param.DefaultParams()) + []*validator.Validator{val}, genesis.DefaultGenesisParams()) conf := config.DefaultConfigMainnet() conf.GRPC.Enable = true conf.GRPC.Listen = "0.0.0.0:0" diff --git a/sandbox/interface.go b/sandbox/interface.go index 8e4da284c..a25355335 100644 --- a/sandbox/interface.go +++ b/sandbox/interface.go @@ -5,9 +5,9 @@ import ( "github.com/pactus-project/pactus/crypto" "github.com/pactus-project/pactus/crypto/bls" "github.com/pactus-project/pactus/sortition" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/validator" ) diff --git a/sandbox/mock.go b/sandbox/mock.go index 9b82e2112..dde44cdc6 100644 --- a/sandbox/mock.go +++ b/sandbox/mock.go @@ -4,11 +4,12 @@ import ( "github.com/pactus-project/pactus/committee" "github.com/pactus-project/pactus/crypto" "github.com/pactus-project/pactus/crypto/bls" + "github.com/pactus-project/pactus/genesis" "github.com/pactus-project/pactus/sortition" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util/testsuite" @@ -34,7 +35,7 @@ func MockingSandbox(ts *testsuite.TestSuite) *MockSandbox { sb := &MockSandbox{ ts: ts, - TestParams: param.DefaultParams(), + TestParams: param.FromGenesis(genesis.DefaultGenesisParams()), TestStore: store.MockingStore(ts), TestCommittee: cmt, TestJoinedValidators: make(map[crypto.Address]bool), diff --git a/sandbox/sandbox.go b/sandbox/sandbox.go index 29e92987a..87331471e 100644 --- a/sandbox/sandbox.go +++ b/sandbox/sandbox.go @@ -7,10 +7,10 @@ import ( "github.com/pactus-project/pactus/crypto" "github.com/pactus-project/pactus/crypto/bls" "github.com/pactus-project/pactus/sortition" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util/logger" diff --git a/sandbox/sandbox_test.go b/sandbox/sandbox_test.go index 414a5c4fe..42f0d84c0 100644 --- a/sandbox/sandbox_test.go +++ b/sandbox/sandbox_test.go @@ -5,11 +5,12 @@ import ( "github.com/pactus-project/pactus/crypto" "github.com/pactus-project/pactus/crypto/bls" + "github.com/pactus-project/pactus/genesis" "github.com/pactus-project/pactus/sortition" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util/testsuite" "github.com/stretchr/testify/assert" @@ -28,7 +29,7 @@ func setup(t *testing.T) *testData { ts := testsuite.NewTestSuite(t) mockStore := store.MockingStore(ts) - params := param.DefaultParams() + params := genesis.DefaultGenesisParams() params.TransactionToLiveInterval = 64 cmt, valKeys := ts.GenerateTestCommittee(21) @@ -54,9 +55,9 @@ func setup(t *testing.T) *testData { mockStore.SaveBlock(blk, cert) } sandbox := NewSandbox(mockStore.LastHeight, - mockStore, params, cmt, totalPower).(*sandbox) + mockStore, param.FromGenesis(params), cmt, totalPower).(*sandbox) assert.Equal(t, lastHeight, sandbox.CurrentHeight()) - assert.Equal(t, params, sandbox.Params()) + assert.Equal(t, param.FromGenesis(params), sandbox.Params()) return &testData{ TestSuite: ts, diff --git a/state/facade.go b/state/facade.go index a7bb09399..6b3bfb633 100644 --- a/state/facade.go +++ b/state/facade.go @@ -7,12 +7,12 @@ import ( "github.com/pactus-project/pactus/crypto/bls" "github.com/pactus-project/pactus/crypto/hash" "github.com/pactus-project/pactus/genesis" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" "github.com/pactus-project/pactus/types/block" "github.com/pactus-project/pactus/types/certificate" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/tx/payload" "github.com/pactus-project/pactus/types/validator" diff --git a/state/mock.go b/state/mock.go index 4a2849edf..3d9d51d5e 100644 --- a/state/mock.go +++ b/state/mock.go @@ -10,13 +10,13 @@ import ( "github.com/pactus-project/pactus/crypto/bls" "github.com/pactus-project/pactus/crypto/hash" "github.com/pactus-project/pactus/genesis" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/txpool" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" "github.com/pactus-project/pactus/types/block" "github.com/pactus-project/pactus/types/certificate" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/tx/payload" "github.com/pactus-project/pactus/types/validator" @@ -51,7 +51,7 @@ func MockingState(ts *testsuite.TestSuite) *MockState { TestPool: txpool.MockingTxPool(), TestCommittee: cmt, TestValKeys: valKeys, - TestParams: genDoc.Params(), + TestParams: param.FromGenesis(genDoc.Params()), } } diff --git a/state/param/param.go b/state/param/param.go new file mode 100644 index 000000000..1ac2694b8 --- /dev/null +++ b/state/param/param.go @@ -0,0 +1,45 @@ +package param + +import ( + "time" + + "github.com/pactus-project/pactus/genesis" + "github.com/pactus-project/pactus/types/amount" +) + +type Params struct { + BlockVersion uint8 + BlockIntervalInSecond int + MaxTransactionsPerBlock int + CommitteeSize int + BlockReward amount.Amount + TransactionToLiveInterval uint32 + BondInterval uint32 + UnbondInterval uint32 + SortitionInterval uint32 + MinimumStake amount.Amount + MaximumStake amount.Amount +} + +func FromGenesis(genDoc *genesis.GenesisParams) *Params { + return &Params{ + // genesis parameters + BlockVersion: genDoc.BlockVersion, + BlockIntervalInSecond: genDoc.BlockIntervalInSecond, + CommitteeSize: genDoc.CommitteeSize, + BlockReward: genDoc.BlockReward, + TransactionToLiveInterval: genDoc.TransactionToLiveInterval, + BondInterval: genDoc.BondInterval, + UnbondInterval: genDoc.UnbondInterval, + SortitionInterval: genDoc.SortitionInterval, + MaximumStake: genDoc.MaximumStake, + MinimumStake: genDoc.MinimumStake, + + // chain parameters + MaxTransactionsPerBlock: 1000, + } +} + +func (p *Params) BlockInterval() time.Duration { + return time.Duration(p.BlockIntervalInSecond) * time.Second +} diff --git a/state/state.go b/state/state.go index e9ab9ad46..97f590c5c 100644 --- a/state/state.go +++ b/state/state.go @@ -15,6 +15,7 @@ import ( "github.com/pactus-project/pactus/sandbox" "github.com/pactus-project/pactus/sortition" "github.com/pactus-project/pactus/state/lastinfo" + "github.com/pactus-project/pactus/state/param" "github.com/pactus-project/pactus/state/score" "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/txpool" @@ -22,7 +23,6 @@ import ( "github.com/pactus-project/pactus/types/amount" "github.com/pactus-project/pactus/types/block" "github.com/pactus-project/pactus/types/certificate" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/tx/payload" "github.com/pactus-project/pactus/types/validator" @@ -35,8 +35,6 @@ import ( "github.com/pactus-project/pactus/www/nanomsg/event" ) -var maxTransactionsPerBlock = 1000 - type state struct { lk sync.RWMutex @@ -65,7 +63,7 @@ func LoadOrNewState( valKeys: valKeys, genDoc: genDoc, txPool: txPool, - params: genDoc.Params(), + params: param.FromGenesis(genDoc.Params()), store: str, lastInfo: lastinfo.NewLastInfo(), accountMerkle: persistentmerkle.New(), @@ -323,7 +321,7 @@ func (st *state) ProposeBlock(valKey *bls.ValidatorKey, rewardAddr crypto.Addres // Re-check all transactions strictly and remove invalid ones txs := st.txPool.PrepareBlockTransactions() - txs = util.Trim(txs, maxTransactionsPerBlock-1) + txs = util.Trim(txs, st.params.MaxTransactionsPerBlock-1) for i := 0; i < txs.Len(); i++ { // Only one subsidy transaction per blk if txs[i].IsSubsidyTx() { diff --git a/state/state_test.go b/state/state_test.go index 2ea3fbcc2..2905fa560 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -13,7 +13,6 @@ import ( "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/block" "github.com/pactus-project/pactus/types/certificate" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/tx" "github.com/pactus-project/pactus/types/tx/payload" "github.com/pactus-project/pactus/types/validator" @@ -55,9 +54,9 @@ func setup(t *testing.T) *testData { genTime := util.RoundNow(10).Add(-8640 * time.Second) - params := param.DefaultParams() - params.CommitteeSize = 7 - params.BondInterval = 10 + genParams := genesis.DefaultGenesisParams() + genParams.CommitteeSize = 7 + genParams.BondInterval = 10 genAcc1 := account.NewAccount(0) genAcc1.AddToBalance(21 * 1e15) // 21,000,000.000,000,000 @@ -70,7 +69,7 @@ func setup(t *testing.T) *testData { genAccPubKey.AccountAddress(): genAcc2, } - gnDoc := genesis.MakeGenesis(genTime, genAccs, genVals, params) + gnDoc := genesis.MakeGenesis(genTime, genAccs, genVals, genParams) // First validator is in the committee valKeys := []*bls.ValidatorKey{genValKeys[0], ts.RandValKey()} @@ -585,10 +584,10 @@ func TestCalculateFee(t *testing.T) { func TestCheckMaximumTransactionPerBlock(t *testing.T) { td := setup(t) - maxTransactionsPerBlock = 10 + td.state.params.MaxTransactionsPerBlock = 10 lockTime := td.state.LastBlockHeight() senderAddr := td.genAccKey.PublicKeyNative().AccountAddress() - for i := 0; i < maxTransactionsPerBlock+2; i++ { + for i := 0; i < td.state.params.MaxTransactionsPerBlock+2; i++ { amt := td.RandAmount() fee := td.state.CalculateFee(amt, payload.TypeTransfer) trx := tx.NewTransferTx(lockTime, senderAddr, td.RandAccAddress(), amt, fee) @@ -598,7 +597,7 @@ func TestCheckMaximumTransactionPerBlock(t *testing.T) { blk, err := td.state.ProposeBlock(td.state.valKeys[0], td.RandAccAddress()) assert.NoError(t, err) - assert.Equal(t, maxTransactionsPerBlock, blk.Transactions().Len()) + assert.Equal(t, td.state.params.MaxTransactionsPerBlock, blk.Transactions().Len()) } func TestCommittedBlock(t *testing.T) { diff --git a/sync/firewall/firewall_test.go b/sync/firewall/firewall_test.go index 4c25a7e55..6e2a53697 100644 --- a/sync/firewall/firewall_test.go +++ b/sync/firewall/firewall_test.go @@ -354,7 +354,7 @@ func TestNetworkFlagsTestnet(t *testing.T) { func TestNetworkFlagsLocalnet(t *testing.T) { td := setup(t, nil) - td.state.TestParams.BlockVersion = 0x3f // changing genesis hash + td.state.Genesis().Params().BlockVersion = 0x3f // changing genesis hash bdl := bundle.NewBundle(message.NewQueryVoteMessage(td.RandHeight(), td.RandRound(), td.RandValAddress())) bdl.Flags = util.SetFlag(bdl.Flags, bundle.BundleFlagNetworkTestnet) diff --git a/tests/main_test.go b/tests/main_test.go index 5578a48d6..947383ecd 100644 --- a/tests/main_test.go +++ b/tests/main_test.go @@ -16,7 +16,6 @@ import ( "github.com/pactus-project/pactus/store" "github.com/pactus-project/pactus/types/account" "github.com/pactus-project/pactus/types/amount" - "github.com/pactus-project/pactus/types/param" "github.com/pactus-project/pactus/types/validator" "github.com/pactus-project/pactus/util" "github.com/pactus-project/pactus/util/logger" @@ -119,13 +118,14 @@ func TestMain(m *testing.M) { vals[1] = validator.NewValidator(tValKeys[tNodeIdx2][0].PublicKey(), 1) vals[2] = validator.NewValidator(tValKeys[tNodeIdx3][0].PublicKey(), 2) vals[3] = validator.NewValidator(tValKeys[tNodeIdx4][0].PublicKey(), 3) - params := param.DefaultParams() - params.MinimumStake = 1000 - params.BlockIntervalInSecond = 2 - params.BondInterval = 8 - params.CommitteeSize = tCommitteeSize - params.TransactionToLiveInterval = 8 - tGenDoc = genesis.MakeGenesis(time.Now(), accs, vals, params) + + genParams := genesis.DefaultGenesisParams() + genParams.MinimumStake = 1000 + genParams.BlockIntervalInSecond = 2 + genParams.BondInterval = 8 + genParams.CommitteeSize = tCommitteeSize + genParams.TransactionToLiveInterval = 8 + tGenDoc = genesis.MakeGenesis(time.Now(), accs, vals, genParams) for i := 0; i < tTotalNodes; i++ { tNodes[i], _ = node.NewNode(