Skip to content

Commit 5c2d622

Browse files
committed
feat: added changes of rpc, server
1 parent 4286e8a commit 5c2d622

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+18906
-12
lines changed

app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ import (
110110
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
111111
"github.com/spf13/cast"
112112

113-
// srvflags "github.com/zeta-chain/node/server/flags"
113+
srvflags "pushchain/server/flags"
114114

115115
evmante "github.com/zeta-chain/ethermint/app/ante"
116116
ethermint "github.com/zeta-chain/ethermint/types"
@@ -439,7 +439,7 @@ func New(
439439
)
440440

441441
// Create Ethermint keepers
442-
tracer := "evm.tracer"
442+
tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer))
443443
feeSs := app.GetSubspace(feemarkettypes.ModuleName)
444444
app.FeeMarketKeeper = feemarketkeeper.NewKeeper(
445445
appCodec,

go.mod

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,31 @@ go 1.23
44

55
require (
66
cosmossdk.io/api v0.3.1
7+
cosmossdk.io/errors v1.0.1
8+
cosmossdk.io/math v1.3.0
79
github.com/cometbft/cometbft v0.37.5
810
github.com/cometbft/cometbft-db v0.8.0
911
github.com/cosmos/cosmos-sdk v0.47.14
1012
github.com/cosmos/gogoproto v1.7.0
1113
github.com/cosmos/ibc-go/v7 v7.2.0
14+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
1215
github.com/ethereum/go-ethereum v1.13.15
1316
github.com/golang/protobuf v1.5.4
1417
github.com/gorilla/mux v1.8.0
18+
github.com/gorilla/websocket v1.5.0
1519
github.com/grpc-ecosystem/grpc-gateway v1.16.0
1620
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2
21+
github.com/improbable-eng/grpc-web v0.15.0
22+
github.com/pkg/errors v0.9.1
23+
github.com/rs/cors v1.8.3
1724
github.com/spf13/cast v1.6.0
1825
github.com/spf13/cobra v1.8.0
1926
github.com/spf13/pflag v1.0.5
27+
github.com/spf13/viper v1.18.2
2028
github.com/stretchr/testify v1.9.0
2129
github.com/zeta-chain/ethermint v0.0.0-20241105191054-1ebf85a354a0
30+
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
31+
golang.org/x/net v0.23.0
2232
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80
2333
google.golang.org/grpc v1.62.1
2434
gopkg.in/yaml.v2 v2.4.0
@@ -32,9 +42,7 @@ require (
3242
cloud.google.com/go/storage v1.36.0 // indirect
3343
cosmossdk.io/core v0.5.1 // indirect
3444
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
35-
cosmossdk.io/errors v1.0.1 // indirect
3645
cosmossdk.io/log v1.4.1 // indirect
37-
cosmossdk.io/math v1.3.0 // indirect
3846
cosmossdk.io/tools/rosetta v0.2.1 // indirect
3947
filippo.io/edwards25519 v1.0.0 // indirect
4048
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
@@ -77,7 +85,6 @@ require (
7785
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
7886
github.com/creachadair/taskgroup v0.4.2 // indirect
7987
github.com/danieljoos/wincred v1.1.2 // indirect
80-
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
8188
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
8289
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
8390
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
@@ -119,7 +126,6 @@ require (
119126
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
120127
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
121128
github.com/gorilla/handlers v1.5.1 // indirect
122-
github.com/gorilla/websocket v1.5.0 // indirect
123129
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
124130
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
125131
github.com/gtank/merlin v0.1.1 // indirect
@@ -136,7 +142,6 @@ require (
136142
github.com/holiman/uint256 v1.2.4 // indirect
137143
github.com/huandu/skiplist v1.2.0 // indirect
138144
github.com/huin/goupnp v1.3.0 // indirect
139-
github.com/improbable-eng/grpc-web v0.15.0 // indirect
140145
github.com/inconshreveable/mousetrap v1.1.0 // indirect
141146
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
142147
github.com/jmespath/go-jmespath v0.4.0 // indirect
@@ -163,7 +168,6 @@ require (
163168
github.com/olekukonko/tablewriter v0.0.5 // indirect
164169
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
165170
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
166-
github.com/pkg/errors v0.9.1 // indirect
167171
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
168172
github.com/prometheus/client_golang v1.14.0 // indirect
169173
github.com/prometheus/client_model v0.3.0 // indirect
@@ -173,16 +177,15 @@ require (
173177
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
174178
github.com/rivo/uniseg v0.2.0 // indirect
175179
github.com/rogpeppe/go-internal v1.11.0 // indirect
176-
github.com/rs/cors v1.8.3 // indirect
177180
github.com/rs/zerolog v1.33.0 // indirect
178181
github.com/sagikazarmark/locafero v0.4.0 // indirect
179182
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
180183
github.com/sasha-s/go-deadlock v0.3.1 // indirect
181184
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
182185
github.com/sourcegraph/conc v0.3.0 // indirect
183186
github.com/spf13/afero v1.11.0 // indirect
184-
github.com/spf13/viper v1.18.2 // indirect
185187
github.com/status-im/keycard-go v0.2.0 // indirect
188+
github.com/stretchr/objx v0.5.2 // indirect
186189
github.com/subosito/gotenv v1.6.0 // indirect
187190
github.com/supranational/blst v0.3.11 // indirect
188191
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
@@ -208,9 +211,7 @@ require (
208211
go.uber.org/atomic v1.10.0 // indirect
209212
go.uber.org/multierr v1.9.0 // indirect
210213
golang.org/x/crypto v0.21.0 // indirect
211-
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
212214
golang.org/x/mod v0.14.0 // indirect
213-
golang.org/x/net v0.23.0 // indirect
214215
golang.org/x/oauth2 v0.16.0 // indirect
215216
golang.org/x/sync v0.6.0 // indirect
216217
golang.org/x/sys v0.22.0 // indirect

pkg/constant/constant.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package constant
2+
3+
import "time"
4+
5+
const (
6+
// ZetaBlockTime is the block time of the ZetaChain network
7+
// It's a rough estimate that can be used in non-critical path to estimate the time of a block
8+
ZetaBlockTime = 6000 * time.Millisecond
9+
10+
// DonationMessage is the message for donation transactions
11+
// Transaction sent to the TSS or ERC20 Custody address containing this message are considered as a donation
12+
DonationMessage = "I am rich!"
13+
14+
// CmdWhitelistERC20 is used for CCTX of type cmd to give the instruction to the TSS to whitelist an ERC20 on an exeternal chain
15+
CmdWhitelistERC20 = "cmd_whitelist_erc20"
16+
17+
// CmdMigrateERC20CustodyFunds is used for CCTX of type cmd to give the instruction to the TSS to transfer its funds on a new address
18+
CmdMigrateERC20CustodyFunds = "cmd_migrate_erc20_custody_funds"
19+
20+
// CmdUpdateERC20CustodyPauseStatus is used for CCTX of type cmd to give the instruction to the TSS to update the pause status of the ERC20 custody contract
21+
CmdUpdateERC20CustodyPauseStatus = "cmd_update_erc20_custody_pause_status"
22+
23+
// CmdMigrateTssFunds is used for CCTX of type cmd to give the instruction to the TSS to transfer its funds on a new address
24+
CmdMigrateTssFunds = "cmd_migrate_tss_funds"
25+
26+
// BTCWithdrawalDustAmount is the minimum satoshis that can be withdrawn from zEVM to avoid outbound dust output
27+
// The Bitcoin protocol sets a minimum output value to 546 satoshis (dust limit) but we set it to 1000 satoshis
28+
BTCWithdrawalDustAmount = 1000
29+
30+
// SolanaWalletRentExempt is the minimum balance for a Solana wallet account to become rent exempt
31+
// The Solana protocol sets minimum rent exempt to 890880 lamports but we set it to 1_000_000 lamports (0.001 SOL)
32+
// The number 890880 comes from CLI command `solana rent 0` and has been verified on devnet gateway program
33+
SolanaWalletRentExempt = 1_000_000
34+
35+
// EVMZeroAddress is the zero address for EVM address format
36+
EVMZeroAddress = "0x0000000000000000000000000000000000000000"
37+
38+
// OptionPause is the argument used in CmdUpdateERC20CustodyPauseStatus to pause the ERC20 custody contract
39+
OptionPause = "pause"
40+
41+
// OptionUnpause is the argument used in CmdUpdateERC20CustodyPauseStatus to unpause the ERC20 custody contract
42+
OptionUnpause = "unpause"
43+
)

pkg/constant/version.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package constant
2+
3+
var (
4+
Name = ""
5+
Version = ""
6+
CommitHash = ""
7+
BuildTime = ""
8+
)

pkg/os/console.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package os
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"os"
7+
"strings"
8+
)
9+
10+
// PromptPassword prompts the user for a password with the given title
11+
func PromptPassword(passwordTitle string) (string, error) {
12+
reader := bufio.NewReader(os.Stdin)
13+
14+
return readPassword(reader, passwordTitle)
15+
}
16+
17+
// PromptPasswords is a convenience function that prompts the user for multiple passwords
18+
func PromptPasswords(passwordTitles []string) ([]string, error) {
19+
reader := bufio.NewReader(os.Stdin)
20+
passwords := make([]string, len(passwordTitles))
21+
22+
// iterate over password titles and prompt for each
23+
for i, title := range passwordTitles {
24+
password, err := readPassword(reader, title)
25+
if err != nil {
26+
return nil, err
27+
}
28+
passwords[i] = password
29+
}
30+
31+
return passwords, nil
32+
}
33+
34+
// readPassword is a helper function that reads a password from bufio.Reader
35+
func readPassword(reader *bufio.Reader, passwordTitle string) (string, error) {
36+
const delimiter = '\n'
37+
38+
// prompt for password
39+
fmt.Printf("%s Password: ", passwordTitle)
40+
password, err := reader.ReadString(delimiter)
41+
if err != nil {
42+
return "", err
43+
}
44+
45+
// trim leading and trailing spaces
46+
return strings.TrimSpace(password), nil
47+
}

pkg/os/path.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package os
2+
3+
import (
4+
"os"
5+
"os/user"
6+
"path/filepath"
7+
"strings"
8+
)
9+
10+
// ExpandHomeDir expands a leading tilde in the path to the home directory of the current user.
11+
// ~someuser/tmp will not be expanded.
12+
func ExpandHomeDir(p string) (string, error) {
13+
if p == "~" ||
14+
strings.HasPrefix(p, "~/") ||
15+
strings.HasPrefix(p, "~\\") {
16+
usr, err := user.Current()
17+
if err != nil {
18+
return p, err
19+
}
20+
21+
p = filepath.Join(usr.HomeDir, p[1:])
22+
}
23+
return filepath.Clean(p), nil
24+
}
25+
26+
// FileExists checks if a file exists.
27+
func FileExists(filePath string) bool {
28+
_, err := os.Stat(filePath)
29+
if os.IsNotExist(err) {
30+
return false
31+
}
32+
return err == nil
33+
}

0 commit comments

Comments
 (0)