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

bump starknet relayer #12575

Merged
merged 14 commits into from
Mar 27, 2024
5 changes: 5 additions & 0 deletions .changeset/silly-weeks-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

update starknet relayer to fix nonce issue. introduces optional api-key for starknet toml config.
55 changes: 31 additions & 24 deletions core/cmd/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/urfave/cli"

commoncfg "github.com/smartcontractkit/chainlink-common/pkg/config"
"github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"
Expand Down Expand Up @@ -474,33 +475,37 @@ func TestSetupStarkNetRelayer(t *testing.T) {
tConfig := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
c.Starknet = stkcfg.TOMLConfigs{
&stkcfg.TOMLConfig{
ChainID: ptr[string]("starknet-id-1"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
ChainID: ptr[string]("starknet-id-1"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
&stkcfg.TOMLConfig{
ChainID: ptr[string]("starknet-id-2"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
ChainID: ptr[string]("starknet-id-2"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
&stkcfg.TOMLConfig{
ChainID: ptr[string]("disabled-starknet-id-1"),
Enabled: ptr(false),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
ChainID: ptr[string]("disabled-starknet-id-1"),
Enabled: ptr(false),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
}
})

t2Config := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
c.Starknet = stkcfg.TOMLConfigs{
&stkcfg.TOMLConfig{
ChainID: ptr[string]("starknet-id-3"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
ChainID: ptr[string]("starknet-id-3"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
}
})
Expand Down Expand Up @@ -534,16 +539,18 @@ func TestSetupStarkNetRelayer(t *testing.T) {
duplicateConfig := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
c.Starknet = stkcfg.TOMLConfigs{
&stkcfg.TOMLConfig{
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
&stkcfg.TOMLConfig{
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
}
})
Expand Down
4 changes: 4 additions & 0 deletions core/config/docs/chains-starknet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[[Starknet]]
# ChainID is the Starknet chain ID.
ChainID = 'foobar' # Example
# FeederURL is required to get tx metadata (that the RPC can't)
FeederURL = 'http://feeder.url' # Example
# Enabled enables this chain.
Enabled = true # Default
# OCR2CachePollPeriod is the rate to poll for the OCR2 state cache.
Expand All @@ -19,3 +21,5 @@ ConfirmationPoll = '5s' # Default
Name = 'primary' # Example
# URL is the base HTTP(S) endpoint for this node.
URL = 'http://stark.node' # Example
# APIKey Header is optional and only required for Nethermind RPCs
APIKey = 'key' # Example
7 changes: 4 additions & 3 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ require (
github.com/Depado/ginprom v1.8.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/NethermindEth/juno v0.3.1 // indirect
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/XSAM/otelsql v0.27.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
Expand Down Expand Up @@ -152,7 +154,6 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/go-tpm v0.9.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
Expand Down Expand Up @@ -254,13 +255,12 @@ require (
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.23.11 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect
github.com/smartcontractkit/chain-selectors v1.0.10 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240216142700-c5869534c19e // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240213121419-1272736c2ac0 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect
github.com/smartcontractkit/wsrpc v0.7.2 // indirect
Expand All @@ -275,6 +275,7 @@ require (
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect
github.com/test-go/testify v1.1.4 // indirect
github.com/theodesp/go-heaps v0.0.0-20190520121037-88e35354fe0a // indirect
github.com/tidwall/btree v1.6.0 // indirect
github.com/tidwall/gjson v1.17.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/NethermindEth/juno v0.3.1 h1:AW72LiAm9gqUeCVJWvepnZcTnpU4Vkl0KzPMxS+42FA=
github.com/NethermindEth/juno v0.3.1/go.mod h1:SGbTpgGaCsxhFsKOid7Ylnz//WZ8swtILk+NbHGsk/Q=
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 h1:9SBvy3eZut1X+wEyAFqfb7ADGj8IQw7ZnlkMwz0YOTY=
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down Expand Up @@ -603,8 +607,6 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/go-tpm v0.9.0 h1:sQF6YqWMi+SCXpsmS3fd21oPy/vSddwZry4JnmltHVk=
github.com/google/go-tpm v0.9.0/go.mod h1:FkNVkc6C+IsvDI9Jw1OveJmxGZUUaKxtrpOS47QWKfU=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
Expand Down Expand Up @@ -1181,8 +1183,6 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumvbfM1u/etVq42Afwq/jtNSBSOA8n5jntnNPo=
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M=
github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCqR1LNS7aI3jT0V+xGrg=
github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240311111125-22812a072c35 h1:GNhRKD3izyzAoGMXDvVUAwEuzz4Atdj3U3RH7eak5Is=
Expand All @@ -1197,8 +1197,8 @@ github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240216142700-c5869534c19e h1:k8HS3GsAFZnxXIW3141VsQP2+EL1XrTtOi/HDt7sdBE=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240216142700-c5869534c19e/go.mod h1:JiykN+8W5TA4UD2ClrzQCVvcH3NcyLEVv7RwY0busrw=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240213121419-1272736c2ac0 h1:7m9PVtccb8/pvKTXMaGuyceFno1icRyC2SFH7KG7+70=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240213121419-1272736c2ac0/go.mod h1:SZ899lZYQ0maUulWbZg+SWqabHQ1wTbyk3jT8wJfyo8=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595 h1:y6ks0HsSOhPUueOmTcoxDQ50RCS1XINlRDTemZyHjFw=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595/go.mod h1:vV6WfnVIbK5Q1JsIru4YcTG0T1uRpLJm6t2BgCnCSsg=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs=
github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo=
Expand Down
10 changes: 8 additions & 2 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ var (
Chain: stkcfg.Chain{
ConfirmationPoll: commoncfg.MustNewDuration(time.Hour),
},
FeederURL: commoncfg.MustParseURL("http://feeder.url"),
Nodes: []*stkcfg.Node{
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://stark.node")},
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://stark.node"), APIKey: ptr("key")},
},
},
},
Expand Down Expand Up @@ -654,8 +655,9 @@ func TestConfig_Marshal(t *testing.T) {
TxTimeout: commoncfg.MustNewDuration(13 * time.Second),
ConfirmationPoll: commoncfg.MustNewDuration(42 * time.Second),
},
FeederURL: commoncfg.MustParseURL("http://feeder.url"),
Nodes: []*stkcfg.Node{
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://stark.node")},
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://stark.node"), APIKey: ptr("key")},
},
},
}
Expand Down Expand Up @@ -1110,6 +1112,7 @@ URL = 'http://solana.bar'
`},
{"Starknet", Config{Starknet: full.Starknet}, `[[Starknet]]
ChainID = 'foobar'
FeederURL = 'http://feeder.url'
Enabled = true
OCR2CachePollPeriod = '6h0m0s'
OCR2CacheTTL = '3m0s'
Expand All @@ -1120,6 +1123,7 @@ ConfirmationPoll = '42s'
[[Starknet.Nodes]]
Name = 'primary'
URL = 'http://stark.node'
APIKey = 'key'
`},
{"Mercury", Config{Core: toml.Core{Mercury: full.Mercury}}, `[Mercury]
[Mercury.Cache]
Expand All @@ -1142,6 +1146,7 @@ CertFile = '/path/to/cert.pem'

require.NoError(t, config.DecodeTOML(strings.NewReader(s), &got))
ts, err := got.TOMLString()

require.NoError(t, err)
assert.Equal(t, tt.config, got, diff.Diff(s, ts))
})
Expand Down Expand Up @@ -1547,6 +1552,7 @@ func TestConfig_SetFrom(t *testing.T) {
require.NoError(t, c.SetFrom(&f))
}
ts, err := c.TOMLString()

require.NoError(t, err)
assert.Equal(t, tt.exp, ts)
})
Expand Down
34 changes: 20 additions & 14 deletions core/services/chainlink/relayer_chain_interoperators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,32 +100,38 @@ func TestCoreRelayerChainInteroperators(t *testing.T) {

c.Starknet = stkcfg.TOMLConfigs{
&stkcfg.TOMLConfig{
ChainID: &starknetChainID1,
Enabled: ptr(true),
Chain: stkcfg.Chain{},
ChainID: &starknetChainID1,
Enabled: ptr(true),
Chain: stkcfg.Chain{},
FeederURL: commonconfig.MustParseURL("http://feeder.url"),
Nodes: []*stkcfg.Node{
{
Name: ptr("starknet chain 1 node 1"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8547").URL())),
Name: ptr("starknet chain 1 node 1"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8547").URL())),
APIKey: ptr("key"),
},
{
Name: ptr("starknet chain 1 node 2"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8548").URL())),
Name: ptr("starknet chain 1 node 2"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8548").URL())),
APIKey: ptr("key"),
},
{
Name: ptr("starknet chain 1 node 3"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8549").URL())),
Name: ptr("starknet chain 1 node 3"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8549").URL())),
APIKey: ptr("key"),
},
},
},
&stkcfg.TOMLConfig{
ChainID: &starknetChainID2,
Enabled: ptr(true),
Chain: stkcfg.Chain{},
ChainID: &starknetChainID2,
Enabled: ptr(true),
Chain: stkcfg.Chain{},
FeederURL: commonconfig.MustParseURL("http://feeder.url"),
Nodes: []*stkcfg.Node{
{
Name: ptr("starknet chain 2 node 1"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:3547").URL())),
Name: ptr("starknet chain 2 node 1"),
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:3547").URL())),
APIKey: ptr("key"),
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ URL = 'http://solana.bar'

[[Starknet]]
ChainID = 'foobar'
FeederURL = 'http://feeder.url'
Enabled = true
OCR2CachePollPeriod = '6h0m0s'
OCR2CacheTTL = '3m0s'
Expand All @@ -441,3 +442,4 @@ ConfirmationPoll = '42s'
[[Starknet.Nodes]]
Name = 'primary'
URL = 'http://stark.node'
APIKey = 'key'
2 changes: 2 additions & 0 deletions core/services/chainlink/testdata/config-invalid.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ Name = 'bar'
[[Starknet.Nodes]]
Name = 'primary'
URL = 'http://stark.node'
APIKey = 'key'

[[Starknet.Nodes]]
Name = 'primary'
URL = 'http://second.stark.node'
APIKey = 'key'

[[Starknet]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ URL = 'http://testnet.solana.com'

[[Starknet]]
ChainID = 'foobar'
FeederURL = 'http://feeder.url'
OCR2CachePollPeriod = '5s'
OCR2CacheTTL = '1m0s'
RequestTimeout = '10s'
Expand All @@ -598,3 +599,4 @@ ConfirmationPoll = '1h0m0s'
[[Starknet.Nodes]]
Name = 'primary'
URL = 'http://stark.node'
APIKey = 'key'
2 changes: 2 additions & 0 deletions core/services/chainlink/testdata/config-multi-chain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ URL = 'http://testnet.solana.com'

[[Starknet]]
ChainID = 'foobar'
FeederURL = 'http://feeder.url'
ConfirmationPoll = '1h0m0s'

[[Starknet.Nodes]]
Name = 'primary'
URL = 'http://stark.node'
APIKey = 'key'
8 changes: 4 additions & 4 deletions core/services/keystore/keys/starkkey/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"io"
"math/big"

"github.com/smartcontractkit/caigo"
caigotypes "github.com/smartcontractkit/caigo/types"
"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/starknet.go/curve"
)

// Raw represents the Stark private key
Expand All @@ -19,7 +19,7 @@ func (raw Raw) Key() Key {
var err error

k.priv = new(big.Int).SetBytes(raw)
k.pub.X, k.pub.Y, err = caigo.Curve.PrivateToPoint(k.priv)
k.pub.X, k.pub.Y, err = curve.Curve.PrivateToPoint(k.priv)
if err != nil {
panic(err) // key not generated
}
Expand Down Expand Up @@ -75,7 +75,7 @@ func (key Key) ID() string {
// it is the X component of the ECDSA pubkey and used in the deployment of the account contract
// this func is used in exporting it via CLI and API
func (key Key) StarkKeyStr() string {
return caigotypes.BigToFelt(key.pub.X).String()
return new(felt.Felt).SetBytes(key.pub.X.Bytes()).String()
}

// Raw from private key
Expand Down
Loading
Loading