diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-04-04 10:33:55 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-15 22:09:55 +0800 |
commit | 8bb384eb28d4aceba63b8077f664381fb3c06444 (patch) | |
tree | e0608b62d06234df27786c7e2de78c6758463a6a /dex/governance.go | |
parent | 83967112258e35425dae4aa943404ee76a36f591 (diff) | |
download | go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.tar go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.tar.gz go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.tar.bz2 go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.tar.lz go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.tar.xz go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.tar.zst go-tangerine-8bb384eb28d4aceba63b8077f664381fb3c06444.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/governance.go')
-rw-r--r-- | dex/governance.go | 32 |
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) } } |