aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-19 15:02:06 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:58 +0800
commitfff05d83302f6c168409e9e614cd9da7d43bc94a (patch)
tree0acb4bd090edd475ffe75bfcd2c7e95dd7ed7fa7 /dex
parentfa793b8d7eeb3601c9b028544f2033228aa95b33 (diff)
downloaddexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.tar
dexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.tar.gz
dexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.tar.bz2
dexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.tar.lz
dexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.tar.xz
dexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.tar.zst
dexon-fff05d83302f6c168409e9e614cd9da7d43bc94a.zip
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.
Diffstat (limited to 'dex')
-rw-r--r--dex/governance.go7
1 files changed, 6 insertions, 1 deletions
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)