Skip to content

Commit

Permalink
tested anchor chunk flow
Browse files Browse the repository at this point in the history
  • Loading branch information
bianyuanop committed Aug 26, 2024
1 parent db23610 commit e8935c1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 4 deletions.
26 changes: 26 additions & 0 deletions cmd/token-cli/cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,29 @@ var anchorsCmd = &cobra.Command{
return nil
},
}

var replaceAnchorCmd = &cobra.Command{
Use: "replace-anchor",
RunE: func(_ *cobra.Command, args []string) error {
anchorURL, err := handler.Root().PromptString("anchor addr", 0, 500)
if err != nil {
return err
}

ctx := context.Background()
_, _, _, hcli, _, _, err := handler.DefaultActor()
if err != nil {
return err
}
replaced, err := hcli.ReplaceAnchor(ctx, anchorURL)
if err != nil {
return err
}
if replaced {
fmt.Printf("replaced anchor to %s", anchorURL)
} else {
fmt.Println("unable to replace anchor")
}
return nil
},
}
1 change: 1 addition & 0 deletions cmd/token-cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func init() {
watchChainCmd,
testHeaderCmd,
anchorsCmd,
replaceAnchorCmd,
)

// actions
Expand Down
5 changes: 5 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ type Config struct {
// Archiver
ArchiverConfig archiver.ORMArchiverConfig `json:"archiverConfig"`

// Anchor
AnchorURL string `json:"anchorURL"`

loaded bool
nodeID ids.NodeID
parsedExemptSponsors []codec.Address
Expand Down Expand Up @@ -134,6 +137,7 @@ func (c *Config) setDefault() {
c.MaxOrdersPerPair = defaultMaxOrdersPerPair
c.ETHRPCAddr = c.Config.GetETHL1RPC()
c.ETHWSAddr = c.Config.GetETHL1WS()
c.AnchorURL = c.Config.GetAnchorURL()
}

func (c *Config) GetLogLevel() logging.Level { return c.LogLevel }
Expand Down Expand Up @@ -175,3 +179,4 @@ func (c *Config) GetStoreTransactions() bool { return c.StoreTransactions }
func (c *Config) Loaded() bool { return c.loaded }
func (c *Config) GetETHL1RPC() string { return c.ETHRPCAddr }
func (c *Config) GetETHL1WS() string { return c.ETHWSAddr }
func (c *Config) GetAnchorURL() string { return c.AnchorURL }
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ require (

// replace github.com/AnomalyFi/hypersdk => ../hypersdk

// replace github.com/AnomalyFi/hypersdk => ../hypersdk
replace github.com/AnomalyFi/hypersdk => ../hypersdk
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AnomalyFi/hypersdk v0.9.5-beta.1 h1:zBGKNFw9exGuZ1fGIjXVAxUv+ctjHJ54L0PO4nKEoVo=
github.com/AnomalyFi/hypersdk v0.9.5-beta.1/go.mod h1:4tbY+3/IAesa2DWEPEMl7rMHWcxqjblp14v4kvQ302w=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
Expand Down
2 changes: 1 addition & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi
VERSION=v1.11.10
MAX_UINT64=18446744073709551615
MODE=${MODE:-run}
LOG_LEVEL=${LOG_LEVEL:-DEBUG}
LOG_LEVEL=${LOG_LEVEL:-INFO}
AGO_LOG_LEVEL=${AGO_LOG_LEVEL:-INFO}
AGO_LOG_DISPLAY_LEVEL=${AGO_LOG_DISPLAY_LEVEL:-INFO}
STATESYNC_DELAY=${STATESYNC_DELAY:-0}
Expand Down
Binary file modified tests/e2e/e2e.test
Binary file not shown.

0 comments on commit e8935c1

Please sign in to comment.