Skip to content

Commit

Permalink
Fix "SUI" -> "Sui"
Browse files Browse the repository at this point in the history
  • Loading branch information
swift1337 committed Feb 12, 2025
1 parent e39953a commit 27440d1
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 69 deletions.
4 changes: 2 additions & 2 deletions pkg/chains/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ func IsSolanaChain(chainID int64, additionalChains []Chain) bool {
return ChainIDInChainList(chainID, ChainListByNetwork(Network_solana, additionalChains))
}

// IsSUIChain returns true if the chain is SUI chain.
func IsSUIChain(chainID int64, additionalChains []Chain) bool {
// IsSuiChain returns true if the chain is Sui chain.
func IsSuiChain(chainID int64, additionalChains []Chain) bool {
return ChainIDInChainList(chainID, ChainListByNetwork(Network_sui, additionalChains))
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/contracts/sui/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var gatewayBinary []byte
// ErrParseEvent event parse error
var ErrParseEvent = errors.New("event parse error")

// NewGateway creates a new SUI gateway
// NewGateway creates a new Sui gateway
// Note: packageID is the equivalent for gateway address or program ID on Solana
// It's what will be set in gateway chain params
func NewGateway(client RPC, packageID string) *Gateway {
Expand Down
6 changes: 3 additions & 3 deletions pkg/contracts/sui/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestLiveGateway_ReadInbounds(t *testing.T) {
}

func TestGateway_QueryDepositInbounds(t *testing.T) {
clientMock := mocks.NewSUIClient(t)
clientMock := mocks.NewSuiClient(t)
gateway := NewGateway(clientMock, "packageID")
ctx := context.Background()

Expand Down Expand Up @@ -266,7 +266,7 @@ func TestGateway_QueryDepositInbounds(t *testing.T) {
}

func TestGateway_QueryDepositAndCallInbounds(t *testing.T) {
clientMock := mocks.NewSUIClient(t)
clientMock := mocks.NewSuiClient(t)
gateway := NewGateway(clientMock, "packageID")
ctx := context.Background()

Expand Down Expand Up @@ -416,6 +416,6 @@ func TestGateway_QueryDepositAndCallInbounds(t *testing.T) {
}
}

func onQueryEvent(m *mocks.SUIClient, res models.PaginatedEventsResponse, err error) {
func onQueryEvent(m *mocks.SuiClient, res models.PaginatedEventsResponse, err error) {
m.On("SuiXQueryEvents", mock.Anything, mock.Anything).Return(res, err).Once()
}
2 changes: 1 addition & 1 deletion pkg/contracts/sui/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (d *Inbound) IsGasDeposit() bool {
return d.CoinType == SUI
}

// parseInbound parses an inbound from a JSON read in the SUI event
// parseInbound parses an inbound from a JSON read in the Sui event
// depositAndCall is a flag to indicate if the event is a depositAndCall event otherwise deposit event
// TODO: add specific error that can be handled when the event data is invalid
// https://github.com/zeta-chain/node/issues/3502
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/chains/sui/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/pkg/errors"
)

// Client SUI client.
// Client Sui client.
type Client struct {
sui.ISuiAPI
}
Expand Down
12 changes: 6 additions & 6 deletions zetaclient/chains/sui/observer/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"github.com/zeta-chain/node/zetaclient/chains/base"
)

// Observer SUI observer
// Observer Sui observer
type Observer struct {
*base.Observer
client RPC
}

// RPC represents subset of SUI RPC methods.
// RPC represents subset of Sui RPC methods.
type RPC interface {
HealthCheck(ctx context.Context) (time.Time, error)
GetLatestCheckpoint(ctx context.Context) (models.CheckpointResponse, error)
Expand All @@ -40,14 +40,14 @@ func (ob *Observer) CheckRPCStatus(ctx context.Context) error {
return errors.Wrap(err, "unable to check rpc health")
}

// It's not a "real" block latency as SUI uses concept of "checkpoints"
// It's not a "real" block latency as Sui uses concept of "checkpoints"
ob.ReportBlockLatency(blockTime)

return nil
}

// PostGasPrice posts SUI gas price to zetacore.
// Note (1) that SUI changes gas per EPOCH (not block)
// PostGasPrice posts Sui gas price to zetacore.
// Note (1) that Sui changes gas per EPOCH (not block)
// Note (2) that SuiXGetCurrentEpoch() is deprecated.
//
// See https://docs.sui.io/concepts/tokenomics/gas-pricing
Expand Down Expand Up @@ -76,7 +76,7 @@ func (ob *Observer) PostGasPrice(ctx context.Context) error {
return errors.Wrap(err, "unable to get ref gas price")
}

// no priority fee for SUI
// no priority fee for Sui
const priorityFee = 0

_, err = ob.ZetacoreClient().PostVoteGasPrice(ctx, ob.Chain(), gasPrice, priorityFee, epochNum)
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/chains/sui/observer/observer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type testSuite struct {
t *testing.T
ctx context.Context
zetaMock *mocks.ZetacoreClient
suiMock *mocks.SUIClient
suiMock *mocks.SuiClient
*Observer
}

Expand Down Expand Up @@ -83,7 +83,7 @@ func newTestSuite(t *testing.T) *testSuite {
baseObserver, err := base.NewObserver(chain, chainParams, zetacore, tss, 1000, nil, database, logger)
require.NoError(t, err)

suiMock := mocks.NewSUIClient(t)
suiMock := mocks.NewSuiClient(t)

observer := New(baseObserver, suiMock)

Expand Down
2 changes: 1 addition & 1 deletion zetaclient/chains/sui/signer/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package signer

import "github.com/zeta-chain/node/zetaclient/chains/base"

// Signer SUI outbound transaction signer.
// Signer Sui outbound transaction signer.
type Signer struct {
*base.Signer
}
Expand Down
20 changes: 10 additions & 10 deletions zetaclient/chains/sui/sui.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ import (
zctx "github.com/zeta-chain/node/zetaclient/context"
)

// SUI observer-signer.
type SUI struct {
// Sui observer-signer.
type Sui struct {
scheduler *scheduler.Scheduler
observer *observer.Observer
signer *signer.Signer
}

// New SUI observer-signer constructor.
func New(scheduler *scheduler.Scheduler, observer *observer.Observer, signer *signer.Signer) *SUI {
return &SUI{scheduler, observer, signer}
// New Sui observer-signer constructor.
func New(scheduler *scheduler.Scheduler, observer *observer.Observer, signer *signer.Signer) *Sui {
return &Sui{scheduler, observer, signer}
}

// Chain returns chain
func (s *SUI) Chain() chains.Chain {
func (s *Sui) Chain() chains.Chain {
return s.observer.Chain()
}

// Start starts observer-signer for processing inbound & outbound cross-chain transactions.
func (s *SUI) Start(ctx context.Context) error {
func (s *Sui) Start(ctx context.Context) error {
if ok := s.observer.Observer.Start(); !ok {
return errors.New("observer is already started")
}
Expand Down Expand Up @@ -85,17 +85,17 @@ func (s *SUI) Start(ctx context.Context) error {
}

// Stop stops all relevant tasks.
func (s *SUI) Stop() {
func (s *Sui) Stop() {
s.observer.Logger().Chain.Info().Msg("stopping observer-signer")
s.scheduler.StopGroup(s.group())
}

func (s *SUI) group() scheduler.Group {
func (s *Sui) group() scheduler.Group {
return scheduler.Group(fmt.Sprintf("sui:%d", s.Chain().ChainId))
}

// scheduleCCTX schedules outbound cross-chain transactions.
func (s *SUI) scheduleCCTX(_ context.Context) error {
func (s *Sui) scheduleCCTX(_ context.Context) error {
// todo
return nil
}
6 changes: 3 additions & 3 deletions zetaclient/config/config_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func New(setDefaults bool) Config {
cfg.EVMChainConfigs = evmChainsConfigs()
cfg.BTCChainConfigs = btcChainsConfigs()
cfg.SolanaConfig = solanaConfigLocalnet()
cfg.SUIConfig = suiConfigLocalnet()
cfg.SuiConfig = suiConfigLocalnet()
cfg.TONConfig = tonConfigLocalnet()
}

Expand All @@ -50,8 +50,8 @@ func solanaConfigLocalnet() SolanaConfig {
}
}

func suiConfigLocalnet() SUIConfig {
return SUIConfig{
func suiConfigLocalnet() SuiConfig {
return SuiConfig{
Endpoint: "http://sui:9000",
}
}
Expand Down
12 changes: 6 additions & 6 deletions zetaclient/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ type SolanaConfig struct {
Endpoint string `mask:"filled"`
}

// SUIConfig is the config for SUI chain
type SUIConfig struct {
// SuiConfig is the config for Sui chain
type SuiConfig struct {
Endpoint string `mask:"filled"`
}

Expand Down Expand Up @@ -101,7 +101,7 @@ type Config struct {
// Deprecated: the 'BitcoinConfig' will be removed once the 'BTCChainConfigs' is fully adopted
BitcoinConfig BTCConfig `json:"BitcoinConfig"`
SolanaConfig SolanaConfig `json:"SolanaConfig"`
SUIConfig SUIConfig `json:"SUIConfig"`
SuiConfig SuiConfig `json:"SuiConfig"`
TONConfig TONConfig `json:"TONConfig"`

// compliance config
Expand Down Expand Up @@ -155,12 +155,12 @@ func (c Config) GetSolanaConfig() (SolanaConfig, bool) {
return c.SolanaConfig, c.SolanaConfig != (SolanaConfig{})
}

// GetSUIConfig returns the SUI config
func (c Config) GetSUIConfig() (SUIConfig, bool) {
// GetSuiConfig returns the Sui config
func (c Config) GetSuiConfig() (SuiConfig, bool) {
c.mu.RLock()
defer c.mu.RUnlock()

return c.SUIConfig, c.SUIConfig != (SUIConfig{})
return c.SuiConfig, c.SuiConfig != (SuiConfig{})
}

// GetTONConfig returns the TONConfig and a bool indicating if it's present.
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/context/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func (c Chain) IsSolana() bool {
return chains.IsSolanaChain(c.ID(), c.registry.additionalChains)
}

func (c Chain) IsSUI() bool {
return chains.IsSUIChain(c.ID(), c.registry.additionalChains)
func (c Chain) IsSui() bool {
return chains.IsSuiChain(c.ID(), c.registry.additionalChains)
}

func (c Chain) IsTON() bool {
Expand Down
8 changes: 4 additions & 4 deletions zetaclient/orchestrator/v2_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ func (oc *V2) bootstrapSolana(ctx context.Context, chain zctx.Chain) (*solana.So
return solana.New(oc.scheduler, observer, signer), nil
}

func (oc *V2) bootstrapSUI(ctx context.Context, chain zctx.Chain) (*sui.SUI, error) {
func (oc *V2) bootstrapSui(ctx context.Context, chain zctx.Chain) (*sui.Sui, error) {
// should not happen
if !chain.IsSUI() {
return nil, errors.New("chain is not SUI")
if !chain.IsSui() {
return nil, errors.New("chain is not sui")
}

app, err := zctx.FromContext(ctx)
if err != nil {
return nil, err
}

cfg, found := app.Config().GetSUIConfig()
cfg, found := app.Config().GetSuiConfig()
if !found {
return nil, errors.Wrap(errSkipChain, "unable to find sui config")
}
Expand Down
10 changes: 5 additions & 5 deletions zetaclient/orchestrator/v2_bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ func TestBootstrap(t *testing.T) {
assert.Contains(t, ts.Log.String(), `"chain":900,"chain_network":"solana","message":"Added observer-signer"`)
})

t.Run("SUI", func(t *testing.T) {
t.Run("Sui", func(t *testing.T) {
t.Parallel()

// ARRANGE
// Given orchestrator
ts := newTestSuite(t)

suiServer, suiConfig := testrpc.NewSUIServer(t)
suiServer, suiConfig := testrpc.NewSuiServer(t)
mockSuiCalls(ts, suiServer)

// Disable other chains
ts.UpdateConfig(func(cfg *config.Config) {
cfg.SUIConfig = suiConfig
cfg.SuiConfig = suiConfig
cfg.BTCChainConfigs = nil
cfg.EVMChainConfigs = nil
cfg.SolanaConfig.Endpoint = ""
Expand All @@ -179,7 +179,7 @@ func TestBootstrap(t *testing.T) {
mockZetacoreCalls(ts)

// ACT
// Start the orchestrator and wait for SUI observerSigner to bootstrap
// Start the orchestrator and wait for Sui observerSigner to bootstrap
require.NoError(t, ts.Start(ts.ctx))

// ASSERT
Expand Down Expand Up @@ -308,7 +308,7 @@ func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {
// todo
}

func mockSuiCalls(_ *testSuite, _ *testrpc.SUIServer) {
func mockSuiCalls(_ *testSuite, _ *testrpc.SuiServer) {
// todo
}

Expand Down
4 changes: 2 additions & 2 deletions zetaclient/orchestrator/v2_orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ func (oc *V2) SyncChains(ctx context.Context) error {
observerSigner, err = oc.bootstrapEVM(ctx, chain)
case chain.IsSolana():
observerSigner, err = oc.bootstrapSolana(ctx, chain)
case chain.IsSUI():
observerSigner, err = oc.bootstrapSUI(ctx, chain)
case chain.IsSui():
observerSigner, err = oc.bootstrapSui(ctx, chain)
case chain.IsTON():
observerSigner, err = oc.bootstrapTON(ctx, chain)
}
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/orchestrator/v2_orchestrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ func newAppContext(
cfg.SolanaConfig = config.SolanaConfig{Endpoint: "localhost"}
case chains.IsTONChain(c.ChainId, nil):
cfg.TONConfig = config.TONConfig{LiteClientConfigURL: "localhost"}
case chains.IsSUIChain(c.ChainId, nil):
// todo config
case chains.IsSuiChain(c.ChainId, nil):
cfg.SuiConfig = config.SuiConfig{Endpoint: "localhost"}
default:
t.Fatalf("create app context: unsupported chain %d", c.ChainId)
}
Expand Down
Loading

0 comments on commit 27440d1

Please sign in to comment.