Skip to content

Commit

Permalink
Revert "Prerelease v1.0.3 (#18)"
Browse files Browse the repository at this point in the history
This reverts commit 8aae936.
  • Loading branch information
charles2023wood committed Sep 14, 2023
1 parent 8aae936 commit b27d8e0
Show file tree
Hide file tree
Showing 73 changed files with 766 additions and 4,785 deletions.
2 changes: 1 addition & 1 deletion .github/commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ module.exports = {
],
},
helpUrl:
'https://github.com/coredao-org/core-chain/tree/master/docs/lint/commit.md',
'https://github.com/bnb-chain/bsc/tree/develop/docs/lint/commit.md',
}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.52.2
version: v1.50
working-directory: ./
skip-pkg-cache: true
skip-cache: true
Expand Down
13 changes: 0 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
# Changelog
## v1.0.3

Improvements
* [#1](https://github.com/coredao-org/core-genesis-contract/commit/220efb36b89ca354686e2fff6dfae9ca920dea39) Improve staking experiences
* [#2](https://github.com/coredao-org/core-genesis-contract/commit/a5b6f29b3c979a09a06ff07aacdeeda119bd53e2) Relayer anti MEV
* [#3](https://github.com/coredao-org/core-chain/compare/branch_v1.0.2...branch_v1.0.3) BEP-172: Network Stability Enhancement On Slash Occur

BUGFIX
* [#4](https://github.com/coredao-org/core-genesis-contract/commit/5656c27433069470a011b89118b8f77e3fc6abab) Gnosis gas issue
* [#5](https://github.com/coredao-org/core-genesis-contract/commit/6526ca8389dc11c6628e0b7d1f3fba73528f58b7) Potential turnround failure caused by relayer offline
* [#6](https://github.com/coredao-org/core-genesis-contract/commit/62a81d5ac686d04b24fcd05920ef9bff5cea78bc) Enable validator set to accept CORE transfer
* [#7](https://github.com/coredao-org/core-genesis-contract/commit/b7f5427aa7e78a12cee3e0add52300c832b10289) Fix bug that modify commissions beyond the limited range

## v1.0.2

IMPROVEMENT
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth

# Pull Geth into a second stage deploy alpine container
FROM alpine:3.17
FROM alpine:3.16.0

ARG CORE_USER=core
ARG CORE_USER_UID=1000
Expand All @@ -26,9 +26,9 @@ ENV CORE_HOME=/core
ENV HOME=${CORE_HOME}
ENV DATA_DIR=/data

ENV PACKAGES ca-certificates jq \
bash bind-tools tini \
grep curl sed
ENV PACKAGES ca-certificates~=20220614-r0 jq~=1.6 \
bash~=5.1.16-r2 bind-tools~=9.16.37 tini~=0.19.0 \
grep~=3.7 curl~=7.83.1 sed~=4.8-r0

RUN apk add --no-cache $PACKAGES \
&& rm -rf /var/cache/apk/* \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ clean:

devtools:
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
env GOBIN= go install github.com/kevinburke/go-bindata@latest
env GOBIN= go install github.com/kevinburke/go-bindata/go-bindata@latest
env GOBIN= go install github.com/fjl/gencodec@latest
env GOBIN= go install github.com/golang/protobuf/protoc-gen-go@latest
env GOBIN= go install ./cmd/abigen
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ func TestGolangBindings(t *testing.T) {
if out, err := replacer.CombinedOutput(); err != nil {
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out)
}
tidier := exec.Command(gocmd, "mod", "tidy", "-compat=1.19")
tidier := exec.Command(gocmd, "mod", "tidy")
tidier.Dir = pkg
if out, err := tidier.CombinedOutput(); err != nil {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
Expand Down
90 changes: 41 additions & 49 deletions build/checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,44 @@ e4032e7c52ebc48bad5c58ba8de0759b6091d9b1e59581a8a521c8c9d88dbe93 go1.19.5.linux-
764871cbca841a99a24e239b63c68a4aaff4104658e3165e9ca450cac1fcbea3 go1.19.5.linux-s390x.tar.gz
85a75555e82d8aa6f486d8d29491c593389682acce9f0c270090d5938eee30ef go1.19.5.windows-arm64.zip

000d4d58f1e25323aaf0da20b337d059d401c8c1fb31cef92ce50ef35c05e877 golangci-lint-1.52.2-linux-ppc64le.deb
0970b2e3ecc20003a0fc78b078623ab27c61f0f809a44288e2cc438bfbbf5616 golangci-lint-1.52.2-linux-s390x.deb
0bfe9b51f68a33cc4e43139151d8032b57b15e61a19f5a7554b687a3fa166ab8 golangci-lint-1.52.2-netbsd-armv7.tar.gz
0e4e24085d364f4e03752c060d5f37b5ead52acd62f07392f4c9022515e0ecd8 golangci-lint-1.52.2-linux-armv7.rpm
0f19ad6c037d45867f4978287a7a6d78bc761daf8e6cb3a5e6af86d5714b0258 golangci-lint-1.52.2-linux-armv6.tar.gz
1506b19f3f0410f6d85d1e339a47fcc84646d552516c0f429dc8cd7f34b4069a golangci-lint-1.52.2-windows-armv6.zip
1cc68baa226e186c15c5514a6e93b1cc8d47ff06aaf1a395b8266434cb01df29 golangci-lint-1.52.2-linux-386.rpm
1d23661087ae686563e40d3b1e33f309dd3b4ba7d1c7e571ca7723f77a52a9e4 golangci-lint-1.52.2-linux-s390x.rpm
227673a18d21b428f1768bb8ee46e38c36a0f002960bc6211ef6137b85d03f52 golangci-lint-1.52.2-freebsd-armv7.tar.gz
24f0272e5741c05c59e7162b7ff0258cfa6beb0d9265bd87c386fe80ac25135d golangci-lint-1.52.2-linux-mips64.deb
3abc8ad30b336ccbe3c5e3c65fa146f5b12d8e81e644345fa8d51cdbaa8cb570 golangci-lint-1.52.2-netbsd-amd64.tar.gz
40a2645b4c7bd94c16618eb0f12b32cd54c17e5620f761cf477b256d3622f299 golangci-lint-1.52.2-windows-386.zip
40b40002e07db81628d94108265525052c58fc9ce358bef26a36d27f0aea3d87 golangci-lint-1.52.2-windows-amd64.zip
41e936b62ba4fc66c02daf6fa9cf74213bc2220745c7a796acbe197c05ed26bb golangci-lint-1.52.2-netbsd-armv6.tar.gz
4bcbb4cf34bf3c8ae1ca880d12516a999499189326621599f8362ededd6e4229 golangci-lint-1.52.2-linux-riscv64.tar.gz
4edb83f1433f7c57f06f79a7fc30bf3f920c1f86c334e481661ac6627d80293f golangci-lint-1.52.2-linux-arm64.deb
50d662e86d094dbad6634d086eca4f670ffa8ea7142508d8da357a2d750ac21a golangci-lint-1.52.2-linux-armv7.tar.gz
6891597bedbcd7e530d08ed198bab7eeb9b23f3f8161dc6e87505b783cb11593 golangci-lint-1.52.2-windows-arm64.zip
6d79f4f3448b70e83952e746fcb9e251c6ba94ec2790a912806cc1704ade4d64 golangci-lint-1.52.2-linux-mips64.rpm
6de51ae05d39002421caf6049e0dd0014a2f10961471c5547c905d33d8e6adf1 golangci-lint-1.52.2-linux-armv6.deb
715dc0f0cf3538c3b2c75f084dde8dcdc3485b3494f42a6d0d9c0dc61e62b5a8 golangci-lint-1.52.2-linux-s390x.tar.gz
7c559332a97ee49b80427aba5a7122e17cac18c57e700f48e6db5ffcbbb61b2b golangci-lint-1.52.2-linux-arm64.rpm
81201bb5f19897fefb4380af2e187a0133dc5efda22254698c063cc36a601f43 golangci-lint-1.52.2-linux-386.deb
89e523d45883903cfc472ab65621073f850abd4ffbb7720bbdd7ba66ee490bc8 golangci-lint-1.52.2-darwin-arm64.tar.gz
8d60d63eee38f8de679e57b1a781de32987152f004f852f20cd47baa4c582209 golangci-lint-1.52.2-linux-mips64le.rpm
9e22df0516cbd847910f353d92245e58eab2b6edacc669646bfa06eb032a65a3 golangci-lint-1.52.2-linux-riscv64.deb
a1a74747a196d4ccd2394ea8a461508eb2edf1eb5a88010611debf572991961d golangci-lint-1.52.2-linux-loong64.tar.gz
a7f076d0fb50e0f5bc24d0f3b2567f2cfe864441e6ad20323189b7fde7cc065d golangci-lint-1.52.2-freebsd-386.tar.gz
abc100851a59cbcea2a7e9ff5ad2974a43270135520aeac9a302ca6c712a41e1 golangci-lint-1.52.2-linux-loong64.rpm
adf11a1f7f43b5a431c19cccea260e6205e2e2b42a2d2d450e31c287fec199f2 golangci-lint-1.52.2-linux-amd64.rpm
b2249e43e1624486398f41700dbe4094a4222bf50b2b1b3a740323adb9a1b66f golangci-lint-1.52.2-linux-386.tar.gz
b8e81bf979dc8bf226cb592eb78c1792f1018c3dea1bbeb11517efc4cc3301bb golangci-lint-1.52.2-windows-armv7.zip
bb9a6a0aabe39fb3d581cc200c639ce6598821a53b4d16ec59366c65f4cc2960 golangci-lint-1.52.2-source.tar.gz
c152280b2e61c202614c1c476cf4458922cda0d2781e4492be2c22d45655cae0 golangci-lint-1.52.2-freebsd-armv6.tar.gz
c8bf25c0bca142638ce4bfc921bf23d23038818d57658d69aa4a9947d514d48f golangci-lint-1.52.2-linux-ppc64le.rpm
c9cf72d12058a131746edd409ed94ccd578fbd178899d1ed41ceae3ce5f54501 golangci-lint-1.52.2-linux-amd64.tar.gz
d03f2b331b5139eddea5db2b49066d10a90094747b08d72d7b2d61cf91c79a27 golangci-lint-1.52.2-linux-mips64le.tar.gz
d609c1d49591d714148e1f8c8b5ae9f9565c601aeabc44a5a53ba44b0eb99f36 golangci-lint-1.52.2-linux-riscv64.rpm
d679adad29603ed7549372b64077cccad784e404deffe5c1e9495a06659cff33 golangci-lint-1.52.2-linux-mips64.tar.gz
d91e8cb60920cf0e46958ed917fcdd059738c00d162189c2e878424ffc8ada75 golangci-lint-1.52.2-linux-ppc64le.tar.gz
d9b5820b491e317fb1360775441d68bd3dc2f303439da5b6d536df23977e28c9 golangci-lint-1.52.2-freebsd-amd64.tar.gz
ddeae781cf07c016898efd80eaed6853a91bfaf1f22c08fbbf5cf08a573b98c4 golangci-lint-1.52.2-linux-loong64.deb
dfc5e755cfa95381f61f736780ff736a5b6c9cbccc88140348986c166d484f85 golangci-lint-1.52.2-linux-amd64.deb
e57f2599de73c4da1d36d5255b9baec63f448b3d7fb726ebd3cd64dabbd3ee4a golangci-lint-1.52.2-darwin-amd64.tar.gz
ebfb5b643ba73ef6007236b90f863ae49fc34fd366682c971b7d1308ab28f642 golangci-lint-1.52.2-netbsd-386.tar.gz
f46b60a90fab5916a7de899ad9a3a4b3d77278c2e1737d070719d3ea27919557 golangci-lint-1.52.2-linux-armv7.deb
f6e39d0ac4691c2b9f49d6d5819594f48bb03e18692fd6d100e7114077f710e6 golangci-lint-1.52.2-linux-armv6.rpm
fa5da589075143628a49a0c123ccd76a8717bb6308fb3bdb6bf1df59435d921b golangci-lint-1.52.2-linux-mips64le.deb
fc09a97f8888809fab83a316f7da70c8ed74d4863b7eed7d872cec41911a55e8 golangci-lint-1.52.2-linux-arm64.tar.gz
06456f980c7dfddfa6a30bf37a839843ee6564a2f9c4c9a8c1319dcdfeae0748 golangci-lint-1.50.1-linux-mips64le.tar.gz
0f615fb8c364f6e4a213f2ed2ff7aa1fc2b208addf29511e89c03534067bbf57 golangci-lint-1.50.1-darwin-amd64.tar.gz
10200bdf2a22d63a3b7f51d3b28e8b919b638b449b6d7867b26af008e33190b6 golangci-lint-1.50.1-linux-ppc64le.deb
131a339395aedd1e32672d9b6243abfeef91adff493bd4fb8d3edcd38e7d7498 golangci-lint-1.50.1-linux-arm64.rpm
162667015519495c2ae35955ff7804d2170ee94a24497cbe0ddf163d5ce10dd4 golangci-lint-1.50.1-linux-ppc64le.tar.gz
193fcf9b72345a8a0d27c330d8433eb6c9bce249bb2e1edea7143d4dbc1acaf4 golangci-lint-1.50.1-linux-mips64le.rpm
1dfeff81f222ec776bee2b8ddf36d727b0300b71e672e80096b2897be296f825 golangci-lint-1.50.1-windows-armv6.zip
26daf55ff7ab4d858058d666ed08ba7c1757d3eb47b24c071955d2bd30fc368a golangci-lint-1.50.1-linux-mips64.deb
3c6ff7318c574cf6096014fd527b36430721cc7a484819a7569478e20a478e1c golangci-lint-1.50.1-freebsd-amd64.tar.gz
3ca9753d7804b34f9165427fbe339dbea69bd80be8a10e3f02c6037393b2e1c4 golangci-lint-1.50.1-darwin-arm64.tar.gz
3ea0a6d5946340f6831646e2c67a317dd9b35bdc4e09b2df953a86f09ba05d74 golangci-lint-1.50.1-linux-arm64.tar.gz
4ba1dc9dbdf05b7bdc6f0e04bdfe6f63aa70576f51817be1b2540bbce017b69a golangci-lint-1.50.1-linux-amd64.tar.gz
4ed8e23077e2466350a100b988cde79750d9ef03498aa4f05d72dbd2e4b28233 golangci-lint-1.50.1-linux-s390x.rpm
50d05c2932a8ea567882fe0586f6b5c1bbfb2a2e944dafaa8f649606ad92105f golangci-lint-1.50.1-linux-ppc64le.rpm
5af2ab7c6d389dde240f7f0d661742cfce615b4b8f8f879c7c36b398f7000db1 golangci-lint-1.50.1-linux-s390x.deb
656ea0215985dfd02ed14018cee868f518d34e2274b14ec675b01aea0d305e28 golangci-lint-1.50.1-freebsd-386.tar.gz
6c371d9a37cad2d3719c45d113a07c9619e52406ca2381d247c217a41c6f5d57 golangci-lint-1.50.1-linux-armv7.deb
6d11fb6ed91ba3aecbf2ea8e1a95dce16cf0449d54aa77c607ac4e75cc43213a golangci-lint-1.50.1-windows-386.zip
73ad2af342e00e59f0a5fbd71cfb17c5dc0f765d2cf4391d5a69c79a7a8b24af golangci-lint-1.50.1-linux-mips64.rpm
757d4f17177c6eff01974e2c8e3122b85d542d1a375c416d2a870ef785ad188b golangci-lint-1.50.1-linux-arm64.deb
7fd52d1da270fa8448c975d2500b6ef2d19db143b6cfc205de16612d6f4effa9 golangci-lint-1.50.1-windows-arm64.zip
81f3136bc111bfe51da293fafcee7642dbf998e2d25bf83d24a2ff18f8d1fc14 golangci-lint-1.50.1-linux-armv7.tar.gz
8965c4327e742444bd4359bd952d42ebc645eba929d3826dd12adb8a14cc6248 golangci-lint-1.50.1-linux-386.tar.gz
8c2da214884db02fb7f3d929672c515ae3b9d10defad4dd661c4ab365a316d68 golangci-lint-1.50.1-windows-amd64.zip
96ae5ef97fec1487bcfd298e9341855ed6bf2f7d6a0bd9dfa758d2c1e4da96ec golangci-lint-1.50.1-linux-mips64.tar.gz
96ce5d9e7ae8134342e8c671ca357d92096b76673b61caf5524bfd6d772ee714 golangci-lint-1.50.1-linux-riscv64.deb
980832f12fbdd0a8e636666839b168c2bbf0ca573ff50b042d3977f65c4987d7 golangci-lint-1.50.1-linux-armv6.tar.gz
999126cbd30f08b41b9eb3cef0bb72686eace82d9cb388e8e24a910ff7a8be51 golangci-lint-1.50.1-linux-386.rpm
a2f2da85622630ff2d0aecac1acc1b3b62c4853594e49fc5a266d6ddbe1a692e golangci-lint-1.50.1-freebsd-armv7.tar.gz
a8af864c92743243ae986f20afdcc58b2cb15b0063e2821c519dcc3c8efc669d golangci-lint-1.50.1-linux-386.deb
aaa3e42de0a57c7c1f64991e3c6d0f9a97aa06455a1cde5a55c59a7fa76e2045 golangci-lint-1.50.1-linux-riscv64.tar.gz
bcdcd7a8068aa91bba432a20909babc911269504325aeff15171f29ecc72b9f0 golangci-lint-1.50.1-linux-mips64le.deb
c1d3abf0d873c7e1f123bf468f940b152526aa5af72aa5f1f5acc1733012293c golangci-lint-1.50.1-linux-armv7.rpm
c2955d6b10ce005ee20b4ad03e5cd805076971a5335a215a757d1ab72db499f9 golangci-lint-1.50.1-linux-amd64.deb
c79ec2884ff743dd965bace09f4f22d5412ccfc3fbd4aec719c8edc48fb455a0 golangci-lint-1.50.1-linux-s390x.tar.gz
c946f6ecb87ddc4f32a98baad0aa9b59f3066b04b2dc822d085c184f85764c7b golangci-lint-1.50.1-windows-armv7.zip
c9c4856e01166e835888c82af02c3952a3b55b75d5c02b674501c03f5ea1e107 golangci-lint-1.50.1-linux-amd64.rpm
dfe91654cbc5c12245c608b0fad44772ce90938c483ff945a0059442f5f3722f golangci-lint-1.50.1-freebsd-armv6.tar.gz
e140169da4ec3d1132277f2109d7202638a6032326bdeada547ffcd9d8cbedbc golangci-lint-1.50.1-linux-armv6.rpm
ecbbc8c35787aea093ef5c639972612a2300bbdc75b21466f4674f8c0d2e38ed golangci-lint-1.50.1-linux-armv6.deb
f42db20276811d7e6002d237985e658a0d1bca36586642bc071e9df9454fb4fc golangci-lint-1.50.1-linux-riscv64.rpm
2 changes: 1 addition & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func doLint(cmdline []string) {

// downloadLinter downloads and unpacks golangci-lint.
func downloadLinter(cachedir string) string {
const version = "1.52.2"
const version = "1.50.1"

csdb := build.MustLoadChecksums("build/checksums.txt")
arch := runtime.GOARCH
Expand Down
1 change: 0 additions & 1 deletion cmd/bootnode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func main() {
if err != nil {
utils.Fatalf("-ListenUDP: %v", err)
}
defer conn.Close()

realaddr := conn.LocalAddr().(*net.UDPAddr)
if natm != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/devp2p/discv4cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func listen(ln *enode.LocalNode, addr string) *net.UDPConn {
}

func parseBootnodes(ctx *cli.Context) ([]*enode.Node, error) {
s := params.MainnetBootnodes
s := params.RinkebyBootnodes
if ctx.IsSet(bootnodesFlag.Name) {
input := ctx.String(bootnodesFlag.Name)
if input == "" {
Expand Down
8 changes: 8 additions & 0 deletions cmd/devp2p/nodesetcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ func ethFilter(args []string) (nodeFilter, error) {
switch args[0] {
case "mainnet":
filter = forkid.NewStaticFilter(params.MainnetChainConfig, params.MainnetGenesisHash)
case "rinkeby":
filter = forkid.NewStaticFilter(params.RinkebyChainConfig, params.RinkebyGenesisHash)
case "goerli":
filter = forkid.NewStaticFilter(params.GoerliChainConfig, params.GoerliGenesisHash)
case "ropsten":
filter = forkid.NewStaticFilter(params.RopstenChainConfig, params.RopstenGenesisHash)
case "sepolia":
filter = forkid.NewStaticFilter(params.SepoliaChainConfig, params.SepoliaGenesisHash)
default:
return nil, fmt.Errorf("unknown network %q", args[0])
}
Expand Down
63 changes: 25 additions & 38 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ var (
fixGasPrice = flag.Int64("faucet.fixedprice", 0, "Will use fixed gas price if specified")
twitterTokenFlag = flag.String("twitter.token", "", "Bearer token to authenticate with the v2 Twitter API")
twitterTokenV1Flag = flag.String("twitter.token.v1", "", "Bearer token to authenticate with the v1.1 Twitter API")

goerliFlag = flag.Bool("goerli", false, "Initializes the faucet with Görli network config")
rinkebyFlag = flag.Bool("rinkeby", false, "Initializes the faucet with Rinkeby network config")
)

var (
Expand All @@ -108,7 +111,7 @@ func main() {
for i := 0; i < *tiersFlag; i++ {
// Calculate the amount for the next tier and format it
amount := float64(*payoutFlag) * math.Pow(2.5, float64(i))
amounts[i] = fmt.Sprintf("%s tCORE", strconv.FormatFloat(amount, 'f', -1, 64))
amounts[i] = fmt.Sprintf("%s BTCs", strconv.FormatFloat(amount, 'f', -1, 64))
if amount == 1 {
amounts[i] = strings.TrimSuffix(amounts[i], "s")
}
Expand Down Expand Up @@ -146,13 +149,9 @@ func main() {
log.Crit("Failed to render the faucet template", "err", err)
}
// Load and parse the genesis block requested by the user
blob, err := ioutil.ReadFile(*genesisFlag)
genesis, err := getGenesis(genesisFlag, *goerliFlag, *rinkebyFlag)
if err != nil {
log.Crit("Failed to read genesis block contents", "genesis", *genesisFlag, "err", err)
}
genesis := new(core.Genesis)
if err = json.Unmarshal(blob, genesis); err != nil {
log.Crit("Failed to parse genesis block json", "err", err)
log.Crit("Failed to parse genesis config", "err", err)
}
// Convert the bootnodes to internal enode representations
var enodes []*enode.Node
Expand All @@ -164,13 +163,13 @@ func main() {
}
}
// Load up the account key and decrypt its password
blob, err = ioutil.ReadFile(*accPassFlag)
blob, err := ioutil.ReadFile(*accPassFlag)
if err != nil {
log.Crit("Failed to read account password contents", "file", *accPassFlag, "err", err)
}
pass := strings.TrimSuffix(string(blob), "\n")

ks := keystore.NewKeyStore(filepath.Join(os.Getenv("HOME"), ".faucet", "keys_2"), keystore.StandardScryptN, keystore.StandardScryptP)
ks := keystore.NewKeyStore(filepath.Join(os.Getenv("HOME"), ".faucet", "keys"), keystore.StandardScryptN, keystore.StandardScryptP)
if blob, err = ioutil.ReadFile(*accJSONFlag); err != nil {
log.Crit("Failed to read account key contents", "file", *accJSONFlag, "err", err)
}
Expand Down Expand Up @@ -328,11 +327,6 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {

// Start tracking the connection and drop at the end
defer conn.Close()
ipsStr := r.Header.Get("X-Forwarded-For")
ips := strings.Split(ipsStr, ",")
if len(ips) < 2 {
return
}

f.lock.Lock()
wsconn := &wsConn{conn: conn}
Expand Down Expand Up @@ -428,7 +422,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
form.Add("secret", *captchaSecret)
form.Add("response", msg.Captcha)

res, err := http.PostForm("https://hcaptcha.com/siteverify", form)
res, err := http.PostForm("https://www.google.com/recaptcha/api/siteverify", form)
if err != nil {
if err = sendError(wsconn, err); err != nil {
log.Warn("Failed to send captcha post error to client", "err", err)
Expand Down Expand Up @@ -467,19 +461,6 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
address common.Address
)
switch {
case strings.HasPrefix(msg.URL, "https://gist.github.com/"):
if err = sendError(wsconn, errors.New("GitHub authentication discontinued at the official request of GitHub")); err != nil {
log.Warn("Failed to send GitHub deprecation to client", "err", err)
return
}
continue
case strings.HasPrefix(msg.URL, "https://plus.google.com/"):
//lint:ignore ST1005 Google is a company name and should be capitalized.
if err = sendError(wsconn, errors.New("Google+ authentication discontinued as the service was sunset")); err != nil {
log.Warn("Failed to send Google+ deprecation to client", "err", err)
return
}
continue
case strings.HasPrefix(msg.URL, "https://twitter.com/"):
id, username, avatar, address, err = authTwitter(msg.URL, *twitterTokenV1Flag, *twitterTokenFlag)
case strings.HasPrefix(msg.URL, "https://www.facebook.com/"):
Expand Down Expand Up @@ -507,15 +488,6 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
fund bool
timeout time.Time
)

if ipTimeout := f.timeouts[ips[len(ips)-2]]; time.Now().Before(ipTimeout) {
if err = sendError(wsconn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(time.Until(ipTimeout)))); err != nil { // nolint: gosimple
log.Warn("Failed to send funding error to client", "err", err)
}
f.lock.Unlock()
continue
}

if timeout = f.timeouts[id]; time.Now().After(timeout) {
// User wasn't funded recently, create the funding transaction
amount := new(big.Int).Mul(big.NewInt(int64(*payoutFlag)), ether)
Expand Down Expand Up @@ -552,7 +524,6 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
grace := timeout / 288 // 24h timeout => 5m grace

f.timeouts[id] = time.Now().Add(timeout - grace)
f.timeouts[ips[len(ips)-2]] = time.Now().Add(timeout - grace)
fund = true
}
f.lock.Unlock()
Expand Down Expand Up @@ -920,3 +891,19 @@ func authNoAuth(url string) (string, string, common.Address, error) {
}
return address.Hex() + "@noauth", "", address, nil
}

// getGenesis returns a genesis based on input args
func getGenesis(genesisFlag *string, goerliFlag bool, rinkebyFlag bool) (*core.Genesis, error) {
switch {
case genesisFlag != nil:
var genesis core.Genesis
err := common.LoadJSON(*genesisFlag, &genesis)
return &genesis, err
case goerliFlag:
return core.DefaultGoerliGenesisBlock(), nil
case rinkebyFlag:
return core.DefaultRinkebyGenesisBlock(), nil
default:
return nil, fmt.Errorf("no genesis flag provided")
}
}
Loading

0 comments on commit b27d8e0

Please sign in to comment.