diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-13 16:21:17 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:56 +0800 |
commit | 7c664ca090d90815db23644c209d4f5cdf0ff594 (patch) | |
tree | 79f192501314c5ae37f8cb6c45ac3ef759d01945 /dex/app_test.go | |
parent | 7bf5e2205a49a500672ff7415921aa6659c46611 (diff) | |
download | dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.tar dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.tar.gz dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.tar.bz2 dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.tar.lz dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.tar.xz dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.tar.zst dexon-7c664ca090d90815db23644c209d4f5cdf0ff594.zip |
consensus: implement DEXON cryptoeconomics v4.0 (#145)
Diffstat (limited to 'dex/app_test.go')
-rw-r--r-- | dex/app_test.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/dex/app_test.go b/dex/app_test.go index f4cc2fd9a..c79dbc42c 100644 --- a/dex/app_test.go +++ b/dex/app_test.go @@ -494,9 +494,21 @@ func TestNumChainsChange(t *testing.T) { // Update config in round 1 and height 1. // Config will affect in round 3. input, err := abiObject.Pack("updateConfiguration", - new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)), big.NewInt(2000), - big.NewInt(1e17), big.NewInt(9000000), big.NewInt(3), big.NewInt(500), big.NewInt(5000), - big.NewInt(1), big.NewInt(700000), big.NewInt(5), big.NewInt(5), big.NewInt(700000), big.NewInt(1000), + new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)), + big.NewInt(2000), + big.NewInt(0.1875*1e8), + big.NewInt(1e18), + big.NewInt(1e18), + big.NewInt(9000000), + big.NewInt(3), + big.NewInt(500), + big.NewInt(5000), + big.NewInt(1), + big.NewInt(700000), + big.NewInt(5), + big.NewInt(5), + big.NewInt(700000), + big.NewInt(1000), []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)}) if err != nil { t.Errorf("updateConfiguration abiObject pack error: %v", err) @@ -686,7 +698,7 @@ func newTestDexonWithGenesis(allocKey *ecdsa.PrivateKey) (*Dexon, error) { dex.APIBackend = &DexAPIBackend{dex, nil} dex.governance = NewDexconGovernance(dex.APIBackend, dex.chainConfig, config.PrivateKey) - engine.SetConfigFetcher(dex.governance) + engine.SetGovStateFetcher(dex.governance) dex.app = NewDexconApp(dex.txPool, dex.blockchain, dex.governance, db, &config) return dex, nil @@ -748,7 +760,7 @@ func prepareData(dex *Dexon, key *ecdsa.PrivateKey, startNonce, txNum int) ( func prepareConfirmedBlockWithTxAndData(dex *Dexon, key *ecdsa.PrivateKey, data [][]byte, round uint64) ( Block *coreTypes.Block, err error) { address := crypto.PubkeyToAddress(key.PublicKey) - numChains := dex.governance.GetConfigHelper(round).Configuration().NumChains + numChains := dex.governance.GetGovStateHelperAtRound(round).Configuration().NumChains chainID := new(big.Int).Mod(address.Big(), big.NewInt(int64(numChains))) for _, d := range data { |