aboutsummaryrefslogtreecommitdiffstats
path: root/dex/app_test.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-01-13 16:21:17 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commit56680e215e7e27ab8896d782876ee64881cae6ff (patch)
tree40daa411b7f1ee239b702ccc7987b6130892d7e6 /dex/app_test.go
parentf82a81c6fa36c8ee6ba6a55e0662930c8f0d2658 (diff)
downloadgo-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.gz
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.bz2
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.lz
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.xz
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.zst
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.zip
consensus: implement DEXON cryptoeconomics v4.0 (#145)
Diffstat (limited to 'dex/app_test.go')
-rw-r--r--dex/app_test.go22
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 {