Skip to content

Commit

Permalink
Merge branch 'main' into 3565-eip712
Browse files Browse the repository at this point in the history
  • Loading branch information
firelizzard18 committed Jul 11, 2024
2 parents 56e7894 + 576d3c6 commit 27ac2c1
Show file tree
Hide file tree
Showing 70 changed files with 6,805 additions and 6,113 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ issues:
- goheader
- gosimple

- path: ^test/util/goroutine_leaks\.go|exp/tendermint/http.go$
- path: ^(test/util/goroutine_leaks\.go|exp/tendermint/http\.go|exp/telemetry/translate\.go)$
linters:
- goheader
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,19 @@
"${workspaceFolder}/.genesis/fozzie/network.json",
]
},
{
"name": "Run bootstrap node",
"presentation": {
"group": "20-Run"
},
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/accumulated",
"args": [
"${workspaceFolder}/.nodes/devnet/bootstrap",
]
},
// Services
{
"name": "API (mainnet)",
Expand Down
5 changes: 2 additions & 3 deletions cmd/accumulated-bootstrap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/spf13/cobra"
. "gitlab.com/accumulatenetwork/accumulate/cmd/accumulated/run"
. "gitlab.com/accumulatenetwork/accumulate/internal/util/cmd"
cmdutil "gitlab.com/accumulatenetwork/accumulate/internal/util/cmd"
)

func main() {
Expand All @@ -35,7 +34,7 @@ var flag = struct {
Peers []multiaddr.Multiaddr
External multiaddr.Multiaddr
}{
Key: cmdutil.PrivateKeyFlag{Value: &TransientPrivateKey{}},
Key: PrivateKeyFlag{Value: &TransientPrivateKey{}},
PromListen: []multiaddr.Multiaddr{
multiaddr.StringCast("/ip4/0.0.0.0/tcp/8081/http"),
},
Expand Down Expand Up @@ -65,7 +64,7 @@ func run(*cobra.Command, []string) {
},
}

ctx := cmdutil.ContextForMainProcess(context.Background())
ctx := ContextForMainProcess(context.Background())
inst, err := Start(ctx, cfg)
Check(err)

Expand Down
3 changes: 2 additions & 1 deletion cmd/accumulated-http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "gitlab.com/accumulatenetwork/accumulate/internal/util/cmd"
cmdutil "gitlab.com/accumulatenetwork/accumulate/internal/util/cmd"
"gitlab.com/accumulatenetwork/accumulate/pkg/accumulate"
"gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding"
)

func main() {
Expand Down Expand Up @@ -116,7 +117,7 @@ func run(cmd *cobra.Command, args []string) {
HttpListener: HttpListener{
Listen: flag.HttpListen,
ConnectionLimit: &flag.ConnLimit,
ReadHeaderTimeout: &flag.Timeout,
ReadHeaderTimeout: (*encoding.Duration)(&flag.Timeout),
TlsCertPath: flag.TlsCert,
TlsKeyPath: flag.TlsKey,
},
Expand Down
22 changes: 19 additions & 3 deletions cmd/accumulated/cmd_init_devnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
package main

import (
"bufio"
"crypto/ed25519"
"crypto/rand"
"fmt"
"os"
"path/filepath"
"strings"

"github.com/multiformats/go-multiaddr"
"github.com/spf13/cobra"
"gitlab.com/accumulatenetwork/accumulate/cmd/accumulated/run"
"gitlab.com/accumulatenetwork/accumulate/pkg/types/address"
"golang.org/x/exp/slices"
"golang.org/x/term"
)

func initDevNet(cmd *cobra.Command) *run.Config {
Expand Down Expand Up @@ -56,7 +59,20 @@ func initDevNet(cmd *cobra.Command) *run.Config {
cmd.Flag("followers").Changed && dev.Followers != uint64(flagRunDevnet.NumFollowers) ||
cmd.Flag("globals").Changed && !flagRunDevnet.Globals.Equal(dev.Globals)
if wantReset && !flagMain.Reset {
fatalf("the configuration and flags do not match; use --reset if you wish to override (and reset) the existing configuration")
if !term.IsTerminal(int(os.Stdout.Fd())) || !term.IsTerminal(int(os.Stderr.Fd())) {
fatalf("the configuration and flags do not match; use --reset if you wish to override (and reset) the existing configuration")
}
fmt.Fprint(os.Stderr, "Configuration and flags do not match. Reset? [yN] ")
s, err := bufio.NewReader(os.Stdin).ReadString('\n')
check(err)
s = strings.TrimSpace(s)
s = strings.ToLower(s)
switch s {
case "y", "yes":
flagMain.Reset = true
default:
os.Exit(0)
}
}

applyDevNetFlags(cmd, cfg, dev, true)
Expand All @@ -77,8 +93,8 @@ func applyDevNetFlags(cmd *cobra.Command, cfg *run.Config, dev *run.DevnetConfig
}

if cmd.Flag("database").Changed {
typ, ok := run.StorageTypeByName(flagRunDevnet.Database)
if !ok {
var typ run.StorageType
if !typ.SetByName(flagRunDevnet.Database) {
fatalf("--database: %q is not a valid storage type", flagRunDevnet.Database)
}
dev.StorageType = &typ
Expand Down
Loading

0 comments on commit 27ac2c1

Please sign in to comment.