aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-04-04 10:33:55 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:59 +0800
commitd52097c148c5247be8e346c8eca3c3cfc8fdd770 (patch)
tree577e129ddc2ee59676bbc890316d7501e7388e42 /dex
parentb8eb11fc1ecba52c05ea150cf77217e61bb16c55 (diff)
downloaddexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.tar
dexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.tar.gz
dexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.tar.bz2
dexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.tar.lz
dexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.tar.xz
dexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.tar.zst
dexon-d52097c148c5247be8e346c8eca3c3cfc8fdd770.zip
core: vm: cache GPK to prevent DoS (#335)
Cache GPK so one can not slow the chain down with the ProposeCRS method call.
Diffstat (limited to 'dex')
-rw-r--r--dex/governance.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/dex/governance.go b/dex/governance.go
index 0614ae910..b8dcf1589 100644
--- a/dex/governance.go
+++ b/dex/governance.go
@@ -111,13 +111,13 @@ func (d *DexconGovernance) Round() uint64 {
func (d *DexconGovernance) ProposeCRS(round uint64, signedCRS []byte) {
data, err := vm.PackProposeCRS(round, signedCRS)
if err != nil {
- log.Error("failed to pack proposeCRS input", "err", err)
+ log.Error("Failed to pack proposeCRS input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send proposeCRS tx", "err", err)
+ log.Error("Failed to send proposeCRS tx", "err", err)
}
}
@@ -125,13 +125,13 @@ func (d *DexconGovernance) ProposeCRS(round uint64, signedCRS []byte) {
func (d *DexconGovernance) AddDKGComplaint(complaint *dkgTypes.Complaint) {
data, err := vm.PackAddDKGComplaint(complaint)
if err != nil {
- log.Error("failed to pack addDKGComplaint input", "err", err)
+ log.Error("Failed to pack addDKGComplaint input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send addDKGComplaint tx", "err", err)
+ log.Error("Failed to send addDKGComplaint tx", "err", err)
}
}
@@ -139,13 +139,13 @@ func (d *DexconGovernance) AddDKGComplaint(complaint *dkgTypes.Complaint) {
func (d *DexconGovernance) AddDKGMasterPublicKey(masterPublicKey *dkgTypes.MasterPublicKey) {
data, err := vm.PackAddDKGMasterPublicKey(masterPublicKey)
if err != nil {
- log.Error("failed to pack addDKGMasterPublicKey input", "err", err)
+ log.Error("Failed to pack addDKGMasterPublicKey input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send addDKGMasterPublicKey tx", "err", err)
+ log.Error("Failed to send addDKGMasterPublicKey tx", "err", err)
}
}
@@ -153,13 +153,13 @@ func (d *DexconGovernance) AddDKGMasterPublicKey(masterPublicKey *dkgTypes.Maste
func (d *DexconGovernance) AddDKGMPKReady(ready *dkgTypes.MPKReady) {
data, err := vm.PackAddDKGMPKReady(ready)
if err != nil {
- log.Error("failed to pack addDKGMPKReady input", "err", err)
+ log.Error("Failed to pack addDKGMPKReady input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send addDKGMPKReady tx", "err", err)
+ log.Error("Failed to send addDKGMPKReady tx", "err", err)
}
}
@@ -167,13 +167,13 @@ func (d *DexconGovernance) AddDKGMPKReady(ready *dkgTypes.MPKReady) {
func (d *DexconGovernance) AddDKGFinalize(final *dkgTypes.Finalize) {
data, err := vm.PackAddDKGFinalize(final)
if err != nil {
- log.Error("failed to pack addDKGFinalize input", "err", err)
+ log.Error("Failed to pack addDKGFinalize input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send addDKGFinalize tx", "err", err)
+ log.Error("Failed to send addDKGFinalize tx", "err", err)
}
}
@@ -181,13 +181,13 @@ func (d *DexconGovernance) AddDKGFinalize(final *dkgTypes.Finalize) {
func (d *DexconGovernance) ReportForkVote(vote1, vote2 *coreTypes.Vote) {
data, err := vm.PackReportForkVote(vote1, vote2)
if err != nil {
- log.Error("failed to pack report fork vote input", "err", err)
+ log.Error("Failed to pack report fork vote input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send report fork vote tx", "err", err)
+ log.Error("Failed to send report fork vote tx", "err", err)
}
}
@@ -195,25 +195,25 @@ func (d *DexconGovernance) ReportForkVote(vote1, vote2 *coreTypes.Vote) {
func (d *DexconGovernance) ReportForkBlock(block1, block2 *coreTypes.Block) {
data, err := vm.PackReportForkBlock(block1, block2)
if err != nil {
- log.Error("failed to pack report fork block input", "err", err)
+ log.Error("Failed to pack report fork block input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send report fork block tx", "err", err)
+ log.Error("Failed to send report fork block tx", "err", err)
}
}
func (d *DexconGovernance) ResetDKG(newSignedCRS []byte) {
data, err := vm.PackResetDKG(newSignedCRS)
if err != nil {
- log.Error("failed to pack resetDKG input", "err", err)
+ log.Error("Failed to pack resetDKG input", "err", err)
return
}
err = d.sendGovTx(context.Background(), data)
if err != nil {
- log.Error("failed to send resetDKG tx", "err", err)
+ log.Error("Failed to send resetDKG tx", "err", err)
}
}