From 86d9edb46a3857c31b1f4f2fb0a08e9153bcd2b5 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 12 Jul 2022 10:46:21 +0200 Subject: [PATCH 1/2] Fix cooldown value --- CHANGELOG.md | 4 ++++ packages/faucet/src/api/webserver.ts | 5 +++-- packages/faucet/src/constants.ts | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df5f88343..f0d8636ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to ## [Unreleased] +### Fixed + +- @cosmjs/faucet: Fix cooldown value from 86 seconds to 24 hours. + ## [0.28.10] - 2022-06-29 ### Fixed diff --git a/packages/faucet/src/api/webserver.ts b/packages/faucet/src/api/webserver.ts index ae17951f1f..335bd1185f 100644 --- a/packages/faucet/src/api/webserver.ts +++ b/packages/faucet/src/api/webserver.ts @@ -67,10 +67,11 @@ export class Webserver { const entry = this.addressCounter.get(address); if (entry !== undefined) { - if (entry.getTime() + 24 * 3600 > Date.now()) { + const cooldownMs = constants.cooldown * 3600 * 1000; + if (entry.getTime() + cooldownMs > Date.now()) { throw new HttpError( 405, - "Too many request from the same address. Blocked to prevent draining. Please wait 24h and try it again!", + `Too many request for the same address. Blocked to prevent draining. Please wait ${constants.cooldown}h and try it again!`, ); } } diff --git a/packages/faucet/src/constants.ts b/packages/faucet/src/constants.ts index a6f5350513..40ca9d9f1b 100644 --- a/packages/faucet/src/constants.ts +++ b/packages/faucet/src/constants.ts @@ -17,3 +17,4 @@ export const pathPattern = process.env.FAUCET_PATH_PATTERN || "m/44'/118'/0'/0/a export const tokenConfig: TokenConfiguration = { bankTokens: parseBankTokens(process.env.FAUCET_TOKENS || "ucosm, ustake"), }; +export const cooldown = 24; // hours From 59ce76eb20264cfa3a998c3b31d98ee08650f2b2 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 13 Jul 2022 15:55:39 +0200 Subject: [PATCH 2/2] Set version 0.28.11 --- CHANGELOG.md | 5 ++++- packages/amino/package.json | 2 +- packages/cli/package.json | 2 +- packages/cosmwasm-stargate/package.json | 2 +- packages/crypto/package.json | 2 +- packages/encoding/package.json | 2 +- packages/faucet-client/package.json | 2 +- packages/faucet/package.json | 2 +- packages/json-rpc/package.json | 2 +- packages/ledger-amino/package.json | 2 +- packages/math/package.json | 2 +- packages/proto-signing/package.json | 2 +- packages/socket/package.json | 2 +- packages/stargate/package.json | 2 +- packages/stream/package.json | 2 +- packages/tendermint-rpc/package.json | 2 +- packages/utils/package.json | 2 +- 17 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d8636ae0..d9abfb1144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to ## [Unreleased] +## [0.28.11] - 2022-07-13 + ### Fixed - @cosmjs/faucet: Fix cooldown value from 86 seconds to 24 hours. @@ -935,7 +937,8 @@ CHANGELOG entries missing. Please see [the diff][0.24.1]. `FeeTable`. @cosmjs/cosmwasm has its own `FeeTable` with those properties. - @cosmjs/sdk38: Rename package to @cosmjs/launchpad. -[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.28.10...HEAD +[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.28.11...HEAD +[0.28.11]: https://github.com/cosmos/cosmjs/compare/v0.28.10...v0.28.11 [0.28.10]: https://github.com/cosmos/cosmjs/compare/v0.28.9...v0.28.10 [0.28.9]: https://github.com/cosmos/cosmjs/compare/v0.28.8...v0.28.9 [0.28.8]: https://github.com/cosmos/cosmjs/compare/v0.28.7...v0.28.8 diff --git a/packages/amino/package.json b/packages/amino/package.json index 4571fac8f4..f005ea1e41 100644 --- a/packages/amino/package.json +++ b/packages/amino/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/amino", - "version": "0.28.10", + "version": "0.28.11", "description": "Helpers for Amino based signing.", "contributors": [ "Simon Warta " diff --git a/packages/cli/package.json b/packages/cli/package.json index 88abce1297..356788a28b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/cli", - "version": "0.28.10", + "version": "0.28.11", "description": "Command line interface", "contributors": [ "IOV SAS ", diff --git a/packages/cosmwasm-stargate/package.json b/packages/cosmwasm-stargate/package.json index 188d03cb6a..78790f3ef2 100644 --- a/packages/cosmwasm-stargate/package.json +++ b/packages/cosmwasm-stargate/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/cosmwasm-stargate", - "version": "0.28.10", + "version": "0.28.11", "description": "CosmWasm SDK", "contributors": [ "Will Clark " diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 9b5e6091cf..7e533ae9e8 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/crypto", - "version": "0.28.10", + "version": "0.28.11", "description": "Cryptography resources for blockchain projects", "contributors": [ "IOV SAS ", diff --git a/packages/encoding/package.json b/packages/encoding/package.json index 0f69d1196c..42d64ee603 100644 --- a/packages/encoding/package.json +++ b/packages/encoding/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/encoding", - "version": "0.28.10", + "version": "0.28.11", "description": "Encoding helpers for blockchain projects", "contributors": [ "IOV SAS " diff --git a/packages/faucet-client/package.json b/packages/faucet-client/package.json index 09149b06f2..9704c897f9 100644 --- a/packages/faucet-client/package.json +++ b/packages/faucet-client/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/faucet-client", - "version": "0.28.10", + "version": "0.28.11", "description": "The faucet client", "contributors": [ "Will Clark " diff --git a/packages/faucet/package.json b/packages/faucet/package.json index 8133b624b3..b35ce31209 100644 --- a/packages/faucet/package.json +++ b/packages/faucet/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/faucet", - "version": "0.28.10", + "version": "0.28.11", "description": "The faucet", "contributors": [ "Ethan Frey ", diff --git a/packages/json-rpc/package.json b/packages/json-rpc/package.json index 0552e60112..1bb7954256 100644 --- a/packages/json-rpc/package.json +++ b/packages/json-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/json-rpc", - "version": "0.28.10", + "version": "0.28.11", "description": "Framework for implementing a JSON-RPC 2.0 API", "contributors": [ "IOV SAS ", diff --git a/packages/ledger-amino/package.json b/packages/ledger-amino/package.json index 5ebc9b07ba..ca6d673fd0 100644 --- a/packages/ledger-amino/package.json +++ b/packages/ledger-amino/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/ledger-amino", - "version": "0.28.10", + "version": "0.28.11", "description": "A library for signing Amino-encoded transactions using Ledger devices", "contributors": [ "Will Clark " diff --git a/packages/math/package.json b/packages/math/package.json index 060d46eaf0..c512a3251d 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/math", - "version": "0.28.10", + "version": "0.28.11", "description": "Math helpers for blockchain projects", "contributors": [ "IOV SAS " diff --git a/packages/proto-signing/package.json b/packages/proto-signing/package.json index 223d3ec211..fe7c1fdcad 100644 --- a/packages/proto-signing/package.json +++ b/packages/proto-signing/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/proto-signing", - "version": "0.28.10", + "version": "0.28.11", "description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)", "contributors": [ "Will Clark ", diff --git a/packages/socket/package.json b/packages/socket/package.json index e5affa2763..d7087f562d 100644 --- a/packages/socket/package.json +++ b/packages/socket/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/socket", - "version": "0.28.10", + "version": "0.28.11", "description": "Utility functions for working with WebSockets", "contributors": [ "IOV SAS ", diff --git a/packages/stargate/package.json b/packages/stargate/package.json index 29d696ad46..2ff380b21c 100644 --- a/packages/stargate/package.json +++ b/packages/stargate/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/stargate", - "version": "0.28.10", + "version": "0.28.11", "description": "Utilities for Cosmos SDK 0.40", "contributors": [ "Simon Warta " diff --git a/packages/stream/package.json b/packages/stream/package.json index 2de2249152..1178f9819f 100644 --- a/packages/stream/package.json +++ b/packages/stream/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/stream", - "version": "0.28.10", + "version": "0.28.11", "description": "Utility functions for producing and consuming streams", "contributors": [ "IOV SAS ", diff --git a/packages/tendermint-rpc/package.json b/packages/tendermint-rpc/package.json index f796b40884..9fbad8c8e5 100644 --- a/packages/tendermint-rpc/package.json +++ b/packages/tendermint-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/tendermint-rpc", - "version": "0.28.10", + "version": "0.28.11", "description": "Tendermint RPC clients", "contributors": [ "IOV SAS ", diff --git a/packages/utils/package.json b/packages/utils/package.json index 343310cbdd..2d251bc1a9 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/utils", - "version": "0.28.10", + "version": "0.28.11", "description": "Utility tools, primarily for testing code", "contributors": [ "IOV SAS "