diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0e543a3f316..77a6456215e8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: run: go run ./build/ci.go lint - name: Test - run: SKIP_ANDROID=true go run ./build/ci.go test + run: SKIP_ANDROID=true SKIP_FACEBOOK_TEST=true SKIP_GOLANG_BINDINGS_TEST=true go run ./build/ci.go test build: strategy: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b696041e3311..bc97d68df824 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: matrix: go-version: [ 1.16 ] # Add additional platforms here if we need more - platform: [ ubuntu-latest ] + platform: [ ubuntu-18.04 ] runs-on: ${{ matrix.platform }} steps: diff --git a/Dockerfile-faucet b/Dockerfile-faucet new file mode 100644 index 000000000000..b6df22a25c3c --- /dev/null +++ b/Dockerfile-faucet @@ -0,0 +1,12 @@ +# Build Geth in a stock Go builder container +FROM golang:1.16-stretch as builder + +ADD . /go-ethereum +RUN cd /go-ethereum && go build -o ./faucet ./cmd/faucet + +FROM golang:1.16-stretch + +WORKDIR /go/src/app +COPY --from=builder /go-ethereum/faucet /usr/local/bin/ + +CMD ["faucet"] \ No newline at end of file diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index d0958cb62f9a..d2276b0eb3b8 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -1790,6 +1790,12 @@ var bindTests = []struct { // Tests that packages generated by the binder can be successfully compiled and // the requested tester run against it. func TestGolangBindings(t *testing.T) { + if os.Getenv("SKIP_GOLANG_BINDINGS_TEST") != "" { + t.Skip() + + return + } + // Skip the test if no Go command can be found gocmd := runtime.GOROOT() + "/bin/go" if !common.FileExist(gocmd) { diff --git a/cmd/devp2p/dns_cloudflare.go b/cmd/devp2p/dns_cloudflare.go index a4d10dcfdd3c..45786bd9128f 100644 --- a/cmd/devp2p/dns_cloudflare.go +++ b/cmd/devp2p/dns_cloudflare.go @@ -17,6 +17,7 @@ package main import ( + "context" "fmt" "strings" @@ -79,7 +80,7 @@ func (c *cloudflareClient) checkZone(name string) error { c.zoneID = id } log.Info(fmt.Sprintf("Checking Permissions on zone %s", c.zoneID)) - zone, err := c.ZoneDetails(c.zoneID) + zone, err := c.ZoneDetails(context.Background(), c.zoneID) if err != nil { return err } @@ -112,7 +113,7 @@ func (c *cloudflareClient) uploadRecords(name string, records map[string]string) records = lrecords log.Info(fmt.Sprintf("Retrieving existing TXT records on %s", name)) - entries, err := c.DNSRecords(c.zoneID, cloudflare.DNSRecord{Type: "TXT"}) + entries, err := c.DNSRecords(context.Background(), c.zoneID, cloudflare.DNSRecord{Type: "TXT"}) if err != nil { return err } @@ -134,12 +135,12 @@ func (c *cloudflareClient) uploadRecords(name string, records map[string]string) if path != name { ttl = treeNodeTTL // Max TTL permitted by Cloudflare } - _, err = c.CreateDNSRecord(c.zoneID, cloudflare.DNSRecord{Type: "TXT", Name: path, Content: val, TTL: ttl}) + _, err = c.CreateDNSRecord(context.Background(), c.zoneID, cloudflare.DNSRecord{Type: "TXT", Name: path, Content: val, TTL: ttl}) } else if old.Content != val { // Entry already exists, only change its content. log.Info(fmt.Sprintf("Updating %s from %q to %q", path, old.Content, val)) old.Content = val - err = c.UpdateDNSRecord(c.zoneID, old.ID, old) + err = c.UpdateDNSRecord(context.Background(), c.zoneID, old.ID, old) } else { log.Info(fmt.Sprintf("Skipping %s = %q", path, val)) } @@ -155,7 +156,7 @@ func (c *cloudflareClient) uploadRecords(name string, records map[string]string) } // Stale entry, nuke it. log.Info(fmt.Sprintf("Deleting %s = %q", path, entry.Content)) - if err := c.DeleteDNSRecord(c.zoneID, entry.ID); err != nil { + if err := c.DeleteDNSRecord(context.Background(), c.zoneID, entry.ID); err != nil { return fmt.Errorf("failed to delete %s: %v", path, err) } } diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index e839f1c886d1..6aee88333e06 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -41,6 +41,8 @@ import ( "sync" "time" + "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/cmd/utils" @@ -51,7 +53,6 @@ import ( "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethstats" - "github.com/ethereum/go-ethereum/les" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" @@ -85,6 +86,7 @@ var ( 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") + notifyFlag = flag.String("pandora.notify", "", "Comma separated URLs for Pandora engine") ) var ( @@ -107,7 +109,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 Ethers", strconv.FormatFloat(amount, 'f', -1, 64)) + amounts[i] = fmt.Sprintf("%s LYXt", strconv.FormatFloat(amount, 'f', -1, 64)) if amount == 1 { amounts[i] = strings.TrimSuffix(amounts[i], "s") } @@ -153,7 +155,9 @@ func main() { log.Crit("Failed to parse genesis block json", "err", err) } // Convert the bootnodes to internal enode representations - var enodes []*enode.Node + var ( + enodes []*enode.Node + ) for _, boot := range strings.Split(*bootFlag, ",") { if url, err := enode.Parse(enode.ValidSchemes, boot); err == nil { enodes = append(enodes, url) @@ -161,6 +165,7 @@ func main() { log.Error("Failed to parse bootnode URL", "url", boot, "err", err) } } + // Load up the account key and decrypt its password if blob, err = ioutil.ReadFile(*accPassFlag); err != nil { log.Crit("Failed to read account password contents", "file", *accPassFlag, "err", err) @@ -229,10 +234,18 @@ type wsConn struct { func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network uint64, stats string, ks *keystore.KeyStore, index []byte) (*faucet, error) { // Assemble the raw devp2p protocol stack + notifyUrls := strings.Split(*notifyFlag, ",") + cfg := ethconfig.Defaults + + if len(notifyUrls) > 0 { + cfg.Miner.Notify = notifyUrls + } + stack, err := node.New(&node.Config{ Name: "geth", Version: params.VersionWithCommit(gitCommit, gitDate), DataDir: filepath.Join(os.Getenv("HOME"), ".faucet"), + IPCPath: filepath.Join(os.Getenv("HOME"), ".faucet/geth/geth.ipc"), P2P: p2p.Config{ NAT: nat.Any(), NoDiscovery: true, @@ -247,20 +260,19 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network ui } // Assemble the Ethereum light client protocol - cfg := ethconfig.Defaults - cfg.SyncMode = downloader.LightSync + cfg.SyncMode = downloader.FullSync cfg.NetworkId = network cfg.Genesis = genesis utils.SetDNSDiscoveryDefaults(&cfg, genesis.ToBlock(nil).Hash()) + backend, err := eth.New(stack, &cfg) - lesBackend, err := les.New(stack, &cfg) if err != nil { return nil, fmt.Errorf("Failed to register the Ethereum service: %w", err) } // Assemble the ethstats monitoring and reporting service' if stats != "" { - if err := ethstats.New(stack, lesBackend.ApiBackend, lesBackend.Engine(), stats); err != nil { + if err := ethstats.New(stack, backend.APIBackend, backend.Engine(), stats); err != nil { return nil, err } } @@ -397,7 +409,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) { if err = conn.ReadJSON(&msg); err != nil { return } - if !*noauthFlag && !strings.HasPrefix(msg.URL, "https://twitter.com/") && !strings.HasPrefix(msg.URL, "https://www.facebook.com/") { + if !*noauthFlag && !strings.HasPrefix(msg.URL, "https://twitter.com/") { if err = sendError(wsconn, errors.New("URL doesn't link to supported services")); err != nil { log.Warn("Failed to send URL error to client", "err", err) return @@ -558,6 +570,7 @@ func (f *faucet) refresh(head *types.Header) error { return err } } + log.Warn("This is head", "head", head) // Retrieve the balance, nonce and gas price from the current head var ( balance *big.Int @@ -599,6 +612,12 @@ func (f *faucet) loop() { // Start a goroutine to update the state from head notifications in the background update := make(chan *types.Header) + err = f.refresh(nil) + if nil != err { + log.Error(err.Error()) + err = nil + } + go func() { for head := range update { // New chain head arrived, query the current stats and stream to clients diff --git a/cmd/faucet/faucet.html b/cmd/faucet/faucet.html index dad5ad84f210..3418d0cc1182 100644 --- a/cmd/faucet/faucet.html +++ b/cmd/faucet/faucet.html @@ -5,7 +5,7 @@ - {{.Network}}: Authenticated Faucet + LUKSO L15 Testnet Faucet @@ -16,6 +16,9 @@