Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge sidecar for arcadia work. #24

Merged
merged 9 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion actions/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ package actions
const (
TransferID uint8 = 0
MsgID uint8 = 1
ExitID uint8 = 2
)

const (
// TODO: tune this
TransferComputeUnits = 1
TransferComputeUnits = 1
EpochExitComputeUnits = 1

MsgComputeUnits = 15

Expand Down
134 changes: 134 additions & 0 deletions actions/epoch_exit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package actions

import (
"bytes"
"context"
"fmt"
"slices"

"github.com/AnomalyFi/hypersdk/chain"
"github.com/AnomalyFi/hypersdk/codec"
"github.com/AnomalyFi/hypersdk/consts"
"github.com/AnomalyFi/hypersdk/state"
"github.com/AnomalyFi/nodekit-seq/storage"
"github.com/ava-labs/avalanchego/ids"
)

var _ chain.Action = (*EpochExit)(nil)

const (
CreateExit = iota
DeleteExit
)

type EpochExit struct {
Info storage.EpochInfo `json:"info"`
Epoch uint64 `json:"epoch"`
OpCode int `json:"opcode"`
}

func (*EpochExit) GetTypeID() uint8 {
return ExitID
}

func (t *EpochExit) StateKeys(actor codec.Address, _ ids.ID) state.Keys {

Check failure on line 34 in actions/epoch_exit.go

View workflow job for this annotation

GitHub Actions / Lint

unused-parameter: parameter 'actor' seems to be unused, consider removing or renaming it as _ (revive)
return state.Keys{
string(storage.EpochExitKey(t.Epoch)): state.All,
string(storage.EpochExitRegistryKey()): state.All,
}
}

func (*EpochExit) StateKeysMaxChunks() []uint16 {
return []uint16{storage.EpochExitChunks, storage.EpochExitChunks}
}

func (*EpochExit) OutputsWarpMessage() bool {
return false
}

func (t *EpochExit) Execute(
ctx context.Context,
_ chain.Rules,
mu state.Mutable,
_ int64,
actor codec.Address,

Check failure on line 54 in actions/epoch_exit.go

View workflow job for this annotation

GitHub Actions / Lint

unused-parameter: parameter 'actor' seems to be unused, consider removing or renaming it as _ (revive)
_ ids.ID,
) ([][]byte, error) {
if t.Epoch != t.Info.Epoch {
return nil, fmt.Errorf("Epoch is not equal to what's in the meta, expected: %d, actual: %d", t.Epoch, t.Info.Epoch)
}

epochExit, err := storage.GetEpochExit(ctx, mu, t.Epoch)

// namespaces, _, err := storage.GetAnchors(ctx, mu)
if err != nil {
return nil, err
}

switch t.OpCode {
case CreateExit:
epochExit.Exits = append(epochExit.Exits, t.Info)
if err := storage.SetEpochExit(ctx, mu, t.Epoch, epochExit); err != nil {
return nil, err
}
case DeleteExit:
idx := -1
for i, e := range epochExit.Exits {
if t.Epoch == e.Epoch && bytes.Equal(t.Info.Namespace, e.Namespace) {
idx = i
break
}
}
epochExit.Exits = slices.Delete(epochExit.Exits, idx, idx+1)
if err := storage.SetEpochExit(ctx, mu, t.Epoch, epochExit); err != nil {
return nil, err
}
default:
return nil, fmt.Errorf("op code(%d) not supported", t.OpCode)
}

// if err := storage.SetAnchors(ctx, mu, namespaces); err != nil {
// return nil, err
// }

return nil, nil
}

func (*EpochExit) ComputeUnits(codec.Address, chain.Rules) uint64 {
return EpochExitComputeUnits
}

func (t *EpochExit) Size() int {
return codec.BytesLen(t.Info.Namespace) + consts.Uint64Len + consts.BoolLen
}

func (t *EpochExit) Marshal(p *codec.Packer) {
t.Info.Marshal(p)

Check failure on line 106 in actions/epoch_exit.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value of `t.Info.Marshal` is not checked (errcheck)
p.PackUint64(t.Epoch)
p.PackInt(t.OpCode)
}

func UnmarshalEpochExit(p *codec.Packer) (chain.Action, error) {
var epoch EpochExit
info, err := storage.UnmarshalEpochInfo(p)
if err != nil {
return nil, err
}
epoch.Info = *info
epoch.Epoch = p.UnpackUint64(true)
epoch.OpCode = p.UnpackInt(false)
return &epoch, nil
}

func (*EpochExit) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*EpochExit) NMTNamespace() []byte {
return DefaultNMTNamespace // TODO: mark this the same to registering namespace?
}

func (*EpochExit) UseFeeMarket() bool {
return false
}
2 changes: 1 addition & 1 deletion actions/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
var _ chain.Action = (*SequencerMsg)(nil)

type SequencerMsg struct {
ChainID []byte `json:"chain_id"`
ChainID []byte `json:"chain_id"` // little endian encoded uint64
Data []byte `json:"data"`
FromAddress codec.Address `json:"from_address"`
RelayerID int `json:"relayer_id"`
Expand Down
7 changes: 6 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ type Config struct {
ArchiverConfig archiver.ORMArchiverConfig `json:"archiverConfig"`

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

loaded bool
nodeID ids.NodeID
Expand Down Expand Up @@ -138,6 +139,7 @@ func (c *Config) setDefault() {
c.ETHRPCAddr = c.Config.GetETHL1RPC()
c.ETHWSAddr = c.Config.GetETHL1WS()
c.AnchorURL = c.Config.GetAnchorURL()
c.AnchorManager = c.Config.GetAnchorManager()
}

func (c *Config) GetLogLevel() logging.Level { return c.LogLevel }
Expand Down Expand Up @@ -180,3 +182,6 @@ 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 }
func (c *Config) GetAnchorManager() string {
return c.AnchorManager
} // default bls pubkey for anchor manager
7 changes: 7 additions & 0 deletions controller/resolutions.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ func (c *Controller) GetRegisteredAnchorsFromState(
return storage.GetAnchorsFromState(ctx, c.inner.ReadState)
}

func (c *Controller) GetEpochExitsFromState(
ctx context.Context,
epoch uint64,
) (*storage.EpochExitInfo, error) {
return storage.GetEpochExitsFromState(ctx, c.inner.ReadState, epoch)
}

func (c *Controller) GetAcceptedBlockWindow() int {
return c.config.GetAcceptedBlockWindow()
}
Expand Down
15 changes: 7 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/AnomalyFi/nodekit-seq
go 1.21.12

require (
github.com/AnomalyFi/hypersdk v0.9.6
github.com/AnomalyFi/hypersdk v0.9.6-anchor.4
github.com/ava-labs/avalanche-network-runner v1.7.4-rc.0
github.com/ava-labs/avalanchego v1.11.10
github.com/ethereum/go-ethereum v1.13.10
github.com/ethereum/go-ethereum v1.13.14
github.com/fatih/color v1.16.0
github.com/onsi/ginkgo/v2 v2.13.1
github.com/prometheus/client_golang v1.16.0
Expand Down Expand Up @@ -51,17 +51,18 @@ require (
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flashbots/go-boost-utils v1.8.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/goccy/go-yaml v1.9.2 // indirect
github.com/goccy/go-yaml v1.11.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
Expand All @@ -78,7 +79,7 @@ require (
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 // indirect
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/huin/goupnp v1.3.0 // indirect
Expand Down Expand Up @@ -181,5 +182,3 @@ require (
// replace github.com/ava-labs/coreth => github.com/AnomalyFi/coreth v0.12.5-rc.6.1

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

replace github.com/AnomalyFi/hypersdk => ../hypersdk
32 changes: 17 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ 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.6-anchor.4 h1:xV1cEQGjuRs60PEQVGvScJb2oc6p9kqvVnyjZjb6aiY=
github.com/AnomalyFi/hypersdk v0.9.6-anchor.4/go.mod h1:4vquPvlEBs4i3uApYzE73Ghv/hB2GdFybf0m8fnU3DU=
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 Expand Up @@ -186,17 +188,18 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-ethereum v1.13.10 h1:Ppdil79nN+Vc+mXfge0AuUgmKWuVv4eMqzoIVSdqZek=
github.com/ethereum/go-ethereum v1.13.10/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA=
github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ=
github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo=
github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flashbots/go-boost-utils v1.8.1 h1:AD+1+4oCbBjXLK8IqWHYznD95K6/MmqXhozv5fFOCkU=
github.com/flashbots/go-boost-utils v1.8.1/go.mod h1:jFi2H1el7jGPr2ShkWpYPfKsY9vwsFNmBPJRCO7IPg8=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down Expand Up @@ -227,16 +230,13 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ=
github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU=
Expand All @@ -247,8 +247,8 @@ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/goccy/go-yaml v1.9.2 h1:2Njwzw+0+pjU2gb805ZC1B/uBuAs2VcZ3K+ZgHwDs7w=
github.com/goccy/go-yaml v1.9.2/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA=
github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ=
github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU=
github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
Expand Down Expand Up @@ -366,8 +366,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU=
github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo=
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw=
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc=
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4=
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU=
Expand Down Expand Up @@ -448,7 +448,6 @@ github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awS
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
Expand Down Expand Up @@ -639,6 +638,8 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/trailofbits/go-fuzz-utils v0.0.0-20210901195358-9657fcfd256c h1:4WU+p200eLYtBsx3M5CKXvkjVdf5SC3W9nMg37y0TFI=
github.com/trailofbits/go-fuzz-utils v0.0.0-20210901195358-9657fcfd256c/go.mod h1:f3jBhpWvuZmue0HZK52GzRHJOYHYSILs/c8+K2S/J+o=
github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=
github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
Expand Down Expand Up @@ -895,6 +896,7 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
2 changes: 2 additions & 0 deletions rpc/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/AnomalyFi/hypersdk/fees"
"github.com/AnomalyFi/nodekit-seq/archiver"
"github.com/AnomalyFi/nodekit-seq/genesis"
"github.com/AnomalyFi/nodekit-seq/storage"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/trace"
"github.com/ava-labs/avalanchego/utils/logging"
Expand All @@ -25,6 +26,7 @@ type Controller interface {
GetTransaction(context.Context, ids.ID) (bool, int64, bool, fees.Dimensions, uint64, error)
GetBalanceFromState(context.Context, codec.Address) (uint64, error)
GetRegisteredAnchorsFromState(context.Context) ([][]byte, []*hactions.AnchorInfo, error)
GetEpochExitsFromState(ctx context.Context, epoch uint64) (*storage.EpochExitInfo, error)
UnitPrices(ctx context.Context) (fees.Dimensions, error)
NameSpacesPrice(ctx context.Context, namespaces []string) ([]uint64, error)
GetAcceptedBlockWindow() int
Expand Down
14 changes: 13 additions & 1 deletion rpc/jsonrpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/AnomalyFi/nodekit-seq/consts"
"github.com/AnomalyFi/nodekit-seq/genesis"
_ "github.com/AnomalyFi/nodekit-seq/registry" // ensure registry populated
"github.com/AnomalyFi/nodekit-seq/storage"
"github.com/AnomalyFi/nodekit-seq/types"
)

Expand Down Expand Up @@ -267,7 +268,7 @@ func (cli *JSONRPCClient) WaitForTransaction(ctx context.Context, txID ids.ID) (
}

func (cli *JSONRPCClient) RegisteredAnchors(ctx context.Context) ([][]byte, []*hactions.AnchorInfo, error) {
resp := new(RegisteredAnchorReply)
resp := new(types.RegisteredAnchorReply)
err := cli.requester.SendRequest(
ctx,
"registeredAnchors",
Expand All @@ -277,6 +278,17 @@ func (cli *JSONRPCClient) RegisteredAnchors(ctx context.Context) ([][]byte, []*h
return resp.Namespaces, resp.Anchors, err
}

func (cli *JSONRPCClient) GetEpochExits(ctx context.Context, epoch uint64) (*storage.EpochExitInfo, error) {
resp := new(types.EpochExitsReply)
err := cli.requester.SendRequest(
ctx,
"getEpochExits",
epoch,
resp,
)
return resp.Info, err
}

var _ chain.Parser = (*Parser)(nil)

type Parser struct {
Expand Down
Loading
Loading