From fff05d83302f6c168409e9e614cd9da7d43bc94a Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Tue, 19 Mar 2019 15:02:06 +0800 Subject: core: vm: add extra checks to prevent DKG spamming (#272) Add two maps to check the uniqueness of DKGMasterPublicKey and DKGComplaints to prevent malicious actors from spamming it. --- dex/governance.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'dex') diff --git a/dex/governance.go b/dex/governance.go index 35c5b4174..c2f2918b1 100644 --- a/dex/governance.go +++ b/dex/governance.go @@ -85,11 +85,16 @@ func (d *DexconGovernance) sendGovTx(ctx context.Context, data []byte) error { // be included in time. gasPrice = new(big.Int).Mul(gasPrice, big.NewInt(10)) + gasLimit, err := core.IntrinsicGas(data, false, false) + if err != nil { + return err + } + tx := types.NewTransaction( nonce, vm.GovernanceContractAddress, big.NewInt(0), - uint64(10000000), + gasLimit+vm.GovernanceActionGasCost, gasPrice, data) -- cgit v1.2.3