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 from relayer #169

Draft
wants to merge 162 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
15317d7
Flush query should include begin and end block events (#1125)
agouin Mar 20, 2023
665ab90
pre_init messages (#1131)
agouin Mar 20, 2023
f0f977d
fix default coin type (#1134)
agouin Mar 22, 2023
1cd441e
build: bump to Go 1.20 + bump deps (#1132)
jtieri Mar 23, 2023
0af487e
Fix flushing acks (#1139)
agouin Mar 23, 2023
14b03e5
Fix ordered channel closure (#1142)
agouin Mar 24, 2023
1206b44
Fix flush termination condition (#1141)
agouin Mar 24, 2023
88acf21
bump to main sha (#1143)
agouin Mar 24, 2023
048dfa4
Pre-filter flush channels (#1146)
agouin Mar 27, 2023
f29a2c7
Add channel close correlation (#1145)
agouin Mar 27, 2023
dcc6060
Fix flush on ordered channels (#1150)
agouin Mar 27, 2023
9c7e897
Now that we have periodic flushing, skip blocks if they can't be quer…
agouin Mar 29, 2023
8dcf4c1
Lock config file for all write operations (#1156)
agouin Mar 31, 2023
c687408
Penumbra support v2 (#1144)
hdevalence Mar 31, 2023
d57648a
--time-threshold example use cases (#1155)
boojamya Apr 3, 2023
d7219fc
Make ICA waits more explicit (#1157)
agouin Apr 4, 2023
deab34e
Bump github.com/docker/docker in /interchaintest (#1160)
dependabot[bot] Apr 4, 2023
2cf2952
bump version in docs (#1158)
agouin Apr 4, 2023
f9aaf3d
Bump github.com/opencontainers/runc in /interchaintest (#1153)
dependabot[bot] Apr 5, 2023
d619c89
Fix QueryConnectionsUsingClient for cosmos (#1162)
agouin Apr 6, 2023
ba8f442
Make min query loop duration configurable (#1164)
agouin Apr 7, 2023
26aa346
penumbra provider: update generated protos (#1168)
avahowell Apr 11, 2023
deef5eb
Add sr25519 support (#1120)
agouin Apr 11, 2023
314056b
penumbra: update protos (#1170)
conorsch Apr 14, 2023
e594d2a
chore: add path name to logs in message processor (#1171)
jtieri Apr 18, 2023
4aa0d3c
Fix multiple conn open init (#1173)
agouin Apr 18, 2023
591c136
allow register with extra_codecs (#1175)
mmsqe Apr 21, 2023
3a14f8c
Harry/fee middleware (#1174)
Cosmos-Harry Apr 25, 2023
1ee79e5
fix: nil receiver initiate for path (#1177)
mmsqe Apr 26, 2023
d36dd5d
feat: add max-gas-amount parameter in chain configs (#1178)
mmsqe May 2, 2023
04e7f3a
dep: bump sdk from v0.47.0 to v0.47.2 (#1180)
mmsqe May 3, 2023
45f478b
Harry/rly tx channel (#1183)
Cosmos-Harry May 12, 2023
af8d0f7
Harry/rly tx transfer (#1184)
Cosmos-Harry May 18, 2023
d5e3882
Better Error Messaging when failing to query the Block Height (#1189)
keefertaylor May 18, 2023
debdee7
penumbra: update protos (#1181)
conorsch May 19, 2023
23d1e5c
Neutron launch fixes and optimizations (#1185)
agouin May 24, 2023
736e48b
Problem: fixes in ibc-go v7.0.1 are not included (#1205)
mmsqe May 31, 2023
de95076
Harry/rly address (#1204)
Cosmos-Harry Jun 1, 2023
e95dd80
deps: update to ibc-go v7.1.0-rc0 (#1207)
jtieri Jun 7, 2023
0981e67
Export wallet address for Prometheus metrics (#1206)
boojamya Jun 8, 2023
4ec767a
chore: replace gogo/protobuf to cosmos/gogoproto (#1208)
mmsqe Jun 28, 2023
049b5b4
feat: add extension_options parameter in chain configs (#1179)
mmsqe Jun 29, 2023
b4653dd
feat: support localhost ibc (#1191)
jtieri Jun 29, 2023
253a641
dep: bump cometbft and ibc-go (#1221)
mmsqe Jul 5, 2023
d0a4010
add missing stop relayer to avoid log after test complete (#1229)
mmsqe Jul 5, 2023
ea035d5
fix: avoid invalid Bech32 prefix in scenario test (#1226)
mmsqe Jul 6, 2023
1bfe06c
wait more blks for ack (#1222)
mmsqe Jul 6, 2023
91f9105
penumbra provider: update proof spec (#1232)
avahowell Jul 7, 2023
4a3237d
fix: flag accessed but not defined: flush-interval (#1238)
mindcarver Jul 12, 2023
af73416
penumbra provider: update protos (#1245)
avahowell Jul 22, 2023
73d338a
fix: Suppressing scary SDK error on redundant packets (#1214)
joeabbey Jul 22, 2023
7ae1596
catch error if type is missing (#1234)
murataniloener Jul 25, 2023
22bce42
Export client expiration metric to prometheus (#1235)
boojamya Jul 25, 2023
55084bd
Export configured gas prices to prometheus wallet balance metric (#1236)
boojamya Jul 25, 2023
107d3f5
Exports block query errors to prometheus metrics (counter) (#1239)
boojamya Jul 25, 2023
3c78287
Export TX failures to prometheus metrics (counter) (#1240)
boojamya Jul 25, 2023
993c21b
use the name given by the user to generate the fetch URL (#1233)
murataniloener Jul 26, 2023
cdd7661
feegrant PR (#1140)
KyleMoser Jul 27, 2023
5236f6f
Export Client Trusting Period to Prometheus metrics (#1246)
boojamya Jul 27, 2023
f054ac4
separate feegrant test to avoid no space left on device (#1250)
mmsqe Jul 29, 2023
1301e1d
Add extra client info when querying client expiration (#1247)
boojamya Jul 29, 2023
ab1c4fc
next seq ack handling (#1244)
agouin Jul 31, 2023
d878a55
chore: update penumbra protos to v0.57.0 (#1249)
conorsch Jul 31, 2023
2138221
fix: reduce get bech32 prefix when get signer (#1231)
mmsqe Aug 1, 2023
a63cd79
update setup-go action (#1251)
boojamya Aug 2, 2023
4598b0e
fix for feegrants (#1256)
KyleMoser Aug 15, 2023
811004c
chore: update penumbra protos (#1260)
conorsch Aug 15, 2023
b7e185e
Change 2.3.0 to 2.4.0 (#1253)
Sr20dem Aug 16, 2023
3415e6a
rename path to path_name for consistency (#1262)
danbryan Aug 17, 2023
c3f07c6
Use unique names for relayer images & cleanup when purpose served (#1…
vimystic Aug 29, 2023
dcd6d37
use ibc-go capability module (#1277)
faddat Sep 1, 2023
2fadd37
fix: use resp.Events to parse events instead of logs (#1271)
colin-axner Sep 5, 2023
7b073b3
working correctly with 7.3 and 0.47.5 (#1280)
faddat Sep 6, 2023
a3bd5b0
chore: icon module setup
viveksharmapoudel Feb 16, 2023
62433ea
chore: icon module required interface setup
viveksharmapoudel Feb 17, 2023
77b9039
chore: refractor required icon module interface to implement
viveksharmapoudel Feb 20, 2023
6fa7cbf
chore: icon client rpc implemnation
viveksharmapoudel Feb 20, 2023
34aa62b
feat: Add BTP info in icon client
izyak Feb 20, 2023
6be91d6
chore: define types.go
izyak Feb 20, 2023
aaf293f
feat: Parse a SendPacket event
izyak Feb 21, 2023
b454a65
feat: Use *zap.Logger
Feb 27, 2023
dfcee22
feat: Event Parser
Feb 27, 2023
e243a39
client test
viveksharmapoudel Feb 27, 2023
0abc168
feat: icon querier initiate
viveksharmapoudel Feb 27, 2023
8f7364a
feat: Keystore added to icon client (#3)
izyak Mar 13, 2023
1e0d3c8
Feat/iibc 44 icon chain provider (#9)
izyak Mar 15, 2023
3cdee0d
Feat/icon-chain-processor (#10)
viveksharmapoudel Mar 15, 2023
b68e059
feat: Parse event of bytes format
Mar 16, 2023
e2c0406
fix: Order of Height
Mar 16, 2023
b69e259
fix: renaming imports after old commit cherry-pick
viveksharmapoudel Mar 17, 2023
9a3aa0e
Icon Message Handler (#38)
viveksharmapoudel Mar 28, 2023
f10fab3
fix: minor (#45)
viveksharmapoudel Apr 4, 2023
0ef77e1
Feat/icon channel connection method impl (#39)
izyak Apr 17, 2023
d1d956f
chore: import icon types from ibc-integration (#47)
viveksharmapoudel Apr 17, 2023
6ae6318
chore: refractor codec implementation (#49)
viveksharmapoudel Apr 17, 2023
3657449
Feat: Packet Acknowledgement Transaction (#50)
izyak Apr 18, 2023
5f33102
Update provider config after successful handshake (#51)
viveksharmapoudel Apr 18, 2023
76f2c72
feature/ archway module setup (#57)
viveksharmapoudel Apr 20, 2023
e4e0623
feat: Add icon proofs (#56)
izyak Apr 24, 2023
ce504e9
ci: setup codecov and pr-lint (#60)
DeepakBomjan Apr 27, 2023
230e3bf
feat: archway keyring implementation (#62)
viveksharmapoudel May 3, 2023
8d72899
feat: Archway event parser (#63)
viveksharmapoudel May 4, 2023
47aec8b
feat: archway chain processor (#64)
viveksharmapoudel May 4, 2023
701eed4
feat: Archway provider client (#65)
izyak May 4, 2023
7bf3679
feat: Query methods for archway (#67)
izyak May 5, 2023
43ed589
feat: Transaction methods (#68)
izyak May 14, 2023
b5dd9b8
feat: Implement update client feature of icon module with reference t…
viveksharmapoudel May 15, 2023
a23c98e
feat: archway proofs (#70)
izyak May 18, 2023
33b532d
feat: Archway client integration (#72)
viveksharmapoudel May 22, 2023
427edc2
fix: Dockerfile (#71)
debendraoli May 22, 2023
7f2686a
feat: txn result (#73)
izyak May 24, 2023
166693b
feat: connection channel integration (#76)
viveksharmapoudel Jun 7, 2023
af85ede
feat: Add method to get ports (#77)
izyak Jun 11, 2023
4f316dd
fix: delay one block when assembling archway proof (#79)
viveksharmapoudel Jun 12, 2023
0d167ad
fix: handle no icon start height (#80)
viveksharmapoudel Jun 14, 2023
8893f5e
feat: icon txn result (#78)
izyak Jun 14, 2023
dc5891a
feat: handle for unordered channel (#81)
viveksharmapoudel Jun 15, 2023
fe2063c
fix: address restoration (#83)
debendraoli Jun 16, 2023
ae04ee1
feat: adjust commitment prefix (#84)
viveksharmapoudel Jun 20, 2023
863acbb
fix: adding network ids in clientState (#85)
viveksharmapoudel Jun 20, 2023
d0c5d34
feat: handle for packet timeout (#86)
viveksharmapoudel Jun 28, 2023
bbbde50
feat: merge relayer (#94)
izyak Jun 30, 2023
4fe98e1
fix: channel close (#96)
izyak Jul 3, 2023
c9a7f82
fix: handle case when query channel is empty (#102)
viveksharmapoudel Jul 4, 2023
9bda4f6
fix: remove commitmentprefix from icon (#98)
viveksharmapoudel Jul 4, 2023
6864056
fix: fetch proof from msg height not from latest height (#100)
viveksharmapoudel Jul 4, 2023
26e15af
fix: packet delayed ack (#103)
viveksharmapoudel Jul 13, 2023
a33a152
ci: add workflow to test deployment of relay locally (#92)
DeepakBomjan Jul 17, 2023
fc7b273
fix: first block try after issue (#106)
viveksharmapoudel Jul 17, 2023
44a2a9d
feat: add verifier for icon. (#105)
viveksharmapoudel Jul 19, 2023
dae32e6
feat: implement verifier archway (#110)
viveksharmapoudel Jul 19, 2023
03963fa
fix: archway module key add not working (#113)
viveksharmapoudel Jul 19, 2023
eb73ea8
fix: add log rolling (#107)
viveksharmapoudel Jul 19, 2023
16b98ee
fix: non adjacent light client (#109)
viveksharmapoudel Jul 24, 2023
53f03db
chore: TODOs for reviews (#115)
izyak Jul 25, 2023
9e0dd22
feat: save snapshot of serviced height in relay (#114)
izyak Jul 25, 2023
0f004b0
fix: generalize archway module as wasm (#112)
viveksharmapoudel Jul 25, 2023
63de3f8
fix: filter contract address wasm (#117)
viveksharmapoudel Jul 27, 2023
4b8eb4b
fix: packet retention not clear (#116)
viveksharmapoudel Jul 27, 2023
68c333d
fix: params for packet receipt and acknowledgement (#121)
izyak Aug 1, 2023
7df301a
feat: better logging for tx, provider, query, processor (#120)
izyak Aug 9, 2023
c5cd978
docs: deviation from cosmos relay (#129)
izyak Aug 9, 2023
4555d47
fix: icon update client retry issue (#127)
viveksharmapoudel Aug 9, 2023
4512450
feat: log height every hour simulateneously (#126)
izyak Aug 9, 2023
01a43b0
fix: timeout not being called on cosmos because of requestTimeout on …
izyak Aug 11, 2023
d87bfe3
feat: icon key refactor (#140)
izyak Aug 14, 2023
6be1cde
docs: update readme for ibc-icon-integration (#141)
izyak Aug 14, 2023
bccc1ca
fix: sdk prefix change handle for neutron and archway (#119)
viveksharmapoudel Aug 15, 2023
766c70b
docs: add local relay deployment guide (#139)
DeepakBomjan Aug 15, 2023
502fb75
test: fix test for icon keys (#143)
izyak Aug 16, 2023
69817d4
ci: add release workflow (#142)
DeepakBomjan Aug 16, 2023
f655074
fix: add missing mutex lock. (#145)
viveksharmapoudel Sep 1, 2023
505c2bb
ci: update local relay deployment test workflow (#146)
DeepakBomjan Sep 4, 2023
e55188a
fix: btp block missing issue fix (#150)
viveksharmapoudel Sep 4, 2023
3785abe
fix: icon module validate packet revision_number from chainId revert …
viveksharmapoudel Sep 4, 2023
a021c4a
feat: add step estimation for icon (#155)
izyak Sep 5, 2023
4addf92
fix: fix start height greater than latest height issue (#151)
viveksharmapoudel Sep 6, 2023
122d9bf
fix: sending packet fail issue (#161)
viveksharmapoudel Sep 6, 2023
829d29e
fix: use get packet receipt for has query receipt (#163)
izyak Sep 6, 2023
730d1a1
merge all from cosmos relayer
Sep 8, 2023
1a29419
chore: getMessagesToSend
Sep 8, 2023
de2e576
chore: fix build conflicts
Sep 8, 2023
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
Prev Previous commit
Next Next commit
feature/ archway module setup (#57)
* feat: archway app_module and codec

* feat: archway setup

* feat: scaffold methods for archway provider

* feat: scaffold archway_chain_processor

* feat: archway scaffold finalize

* feat: archway provider and processor added to strategies

* chore: fix failed test
viveksharmapoudel authored and izyak committed Sep 7, 2023
commit 76f2c72f44bb15309b3e49bb3f5d2cae7baa59a6
4 changes: 4 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ import (
"time"

"github.com/icon-project/ibc-relayer/relayer"
archway "github.com/cosmos/relayer/v2/relayer/chains/archway"
"github.com/icon-project/ibc-relayer/relayer/chains/cosmos"
"github.com/icon-project/ibc-relayer/relayer/chains/icon"
"github.com/icon-project/ibc-relayer/relayer/chains/penumbra"
@@ -379,6 +380,7 @@ func (pcw *ProviderConfigWrapper) UnmarshalJSON(data []byte) error {
"icon": reflect.TypeOf(icon.IconProviderConfig{}),
"cosmos": reflect.TypeOf(cosmos.CosmosProviderConfig{}),
"penumbra": reflect.TypeOf(penumbra.PenumbraProviderConfig{}),
"archway": reflect.TypeOf(archway.ArchwayProviderConfig{}),
}
val, err := UnmarshalJSONProviderConfig(data, customTypes)
if err != nil {
@@ -439,6 +441,8 @@ func (iw *ProviderConfigYAMLWrapper) UnmarshalYAML(n *yaml.Node) error {
iw.Value = new(icon.IconProviderConfig)
case "penumbra":
iw.Value = new(penumbra.PenumbraProviderConfig)
case "archway":
iw.Value = new(archway.ArchwayProviderConfig)
default:
return fmt.Errorf("%s is an invalid chain type, check your config file", iw.Type)
}
75 changes: 75 additions & 0 deletions relayer/chains/archway/archway_chain_processor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package archway

import (
"context"

"github.com/cosmos/relayer/v2/relayer/processor"
"github.com/cosmos/relayer/v2/relayer/provider"
"go.uber.org/zap"
)

type ArchwayChainProcessor struct {
log *zap.Logger

chainProvider *ArchwayProvider

pathProcessors processor.PathProcessors

// indicates whether queries are in sync with latest height of the chain
inSync bool

// highest block
latestBlock provider.LatestBlock

// holds highest consensus height and header for all clients
latestClientState

// holds open state for known connections
connectionStateCache processor.ConnectionStateCache

// holds open state for known channels
channelStateCache processor.ChannelStateCache

// map of connection ID to client ID
connectionClients map[string]string

// map of channel ID to connection ID
channelConnections map[string]string

// metrics to monitor lifetime of processor
metrics *processor.PrometheusMetrics
}

func NewArchwayChainProcessor(log *zap.Logger, provider *ArchwayProvider, metrics *processor.PrometheusMetrics) *ArchwayChainProcessor {
return &ArchwayChainProcessor{
log: log.With(zap.String("chain_name", provider.ChainName()), zap.String("chain_id", provider.ChainId())),
chainProvider: provider,
latestClientState: make(latestClientState),
connectionStateCache: make(processor.ConnectionStateCache),
channelStateCache: make(processor.ChannelStateCache),
connectionClients: make(map[string]string),
channelConnections: make(map[string]string),
metrics: metrics,
}
}

type latestClientState map[string]provider.ClientState

func (l latestClientState) update(ctx context.Context, clientInfo clientInfo, ccp *ArchwayChainProcessor) {
// TODO:
}

// Provider returns the ChainProvider, which provides the methods for querying, assembling IBC messages, and sending transactions.
func (ccp *ArchwayChainProcessor) Provider() provider.ChainProvider {
return ccp.chainProvider
}

// Set the PathProcessors that this ChainProcessor should publish relevant IBC events to.
// ChainProcessors need reference to their PathProcessors and vice-versa, handled by EventProcessorBuilder.Build().
func (ccp *ArchwayChainProcessor) SetPathProcessors(pathProcessors processor.PathProcessors) {
ccp.pathProcessors = pathProcessors
}

func (ccp *ArchwayChainProcessor) Run(ctx context.Context, initialBlockHistory uint64) error {
return nil
}
37 changes: 37 additions & 0 deletions relayer/chains/archway/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package archway

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/types/module"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
archway_module "github.com/cosmos/relayer/v2/relayer/chains/archway/module"
)

var ModuleBasics = []module.AppModuleBasic{
ibc.AppModuleBasic{},
archway_module.AppModuleBasic{},
}

type Codec struct {
InterfaceRegistry types.InterfaceRegistry
Marshaler codec.Codec
}

func MakeCodec(moduleBasics []module.AppModuleBasic, extraCodecs []string) Codec {
modBasic := module.NewBasicManager(moduleBasics...)
encodingConfig := MakeCodecConfig()
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
modBasic.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}

func MakeCodecConfig() Codec {
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
return Codec{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
}
}
23 changes: 23 additions & 0 deletions relayer/chains/archway/event_parser.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package archway

import (
"time"

clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/cosmos/relayer/v2/relayer/provider"
)

type clientInfo struct {
clientID string
consensusHeight clienttypes.Height
header []byte
}

func (c clientInfo) ClientState(trustingPeriod time.Duration) provider.ClientState {
return provider.ClientState{
ClientID: c.clientID,
ConsensusHeight: c.consensusHeight,
TrustingPeriod: trustingPeriod,
Header: c.header,
}
}
201 changes: 201 additions & 0 deletions relayer/chains/archway/keys.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
package archway

import (
// "errors"
// "os"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/relayer/v2/relayer/provider"
// "github.com/cosmos/go-bip39"
// "github.com/cosmos/relayer/v2/relayer/codecs/ethermint"
// "github.com/cosmos/relayer/v2/relayer/codecs/injective"
// "github.com/cosmos/relayer/v2/relayer/provider"
)

// const ethereumCoinType = uint32(60)

// var (
// // SupportedAlgorithms defines the list of signing algorithms used on Evmos:
// // - secp256k1 (Cosmos)
// // - eth_secp256k1 (Ethereum)
// SupportedAlgorithms = keyring.SigningAlgoList{hd.Secp256k1, ethermint.EthSecp256k1, injective.EthSecp256k1}
// // SupportedAlgorithmsLedger defines the list of signing algorithms used on Evmos for the Ledger device:
// // - secp256k1 (Cosmos)
// // - eth_secp256k1 (Ethereum)
// SupportedAlgorithmsLedger = keyring.SigningAlgoList{hd.Secp256k1, ethermint.EthSecp256k1, injective.EthSecp256k1}
// )

// // KeyringAlgoOptions defines a function keys options for the ethereum Secp256k1 curve.
// // It supports secp256k1 and eth_secp256k1 keys for accounts.
// func KeyringAlgoOptions() keyring.Option {
// return func(options *keyring.Options) {
// options.SupportedAlgos = SupportedAlgorithms
// options.SupportedAlgosLedger = SupportedAlgorithmsLedger
// }
// }

// // CreateKeystore initializes a new instance of a keyring at the specified path in the local filesystem.
func (cc *ArchwayProvider) CreateKeystore(path string) error {
// keybase, err := keyring.New(cc.PCfg.ChainID, cc.PCfg.KeyringBackend, cc.PCfg.KeyDirectory, cc.Input, cc.Cdc.Marshaler, KeyringAlgoOptions())
// if err != nil {
// return err
// }
// cc.Keybase = keybase
return nil
}

// // KeystoreCreated returns true if there is an existing keystore instance at the specified path, it returns false otherwise.
func (cc *ArchwayProvider) KeystoreCreated(path string) bool {
// if _, err := os.Stat(cc.PCfg.KeyDirectory); errors.Is(err, os.ErrNotExist) {
// return false
// } else if cc.Keybase == nil {
// return false
// }
return true
}

// // AddKey generates a new mnemonic which is then converted to a private key and BIP-39 HD Path and persists it to the keystore.
// // It fails if there is an existing key with the same address.
func (cc *ArchwayProvider) AddKey(name string, coinType uint32) (output *provider.KeyOutput, err error) {
// ko, err := cc.KeyAddOrRestore(name, coinType)
// if err != nil {
// return nil, err
// }
return nil, nil
}

// // RestoreKey converts a mnemonic to a private key and BIP-39 HD Path and persists it to the keystore.
// // It fails if there is an existing key with the same address.
func (cc *ArchwayProvider) RestoreKey(name, mnemonic string, coinType uint32) (address string, err error) {
// ko, err := cc.KeyAddOrRestore(name, coinType, mnemonic)
// if err != nil {
// return "", err
// }
return "", nil
}

// // KeyAddOrRestore either generates a new mnemonic or uses the specified mnemonic and converts it to a private key
// // and BIP-39 HD Path which is then persisted to the keystore. It fails if there is an existing key with the same address.
// func (cc *ArchwayProvider) KeyAddOrRestore(keyName string, coinType uint32, mnemonic ...string) (*provider.KeyOutput, error) {
// var mnemonicStr string
// var err error
// algo := keyring.SignatureAlgo(hd.Secp256k1)

// if len(mnemonic) > 0 {
// mnemonicStr = mnemonic[0]
// } else {
// mnemonicStr, err = CreateMnemonic()
// if err != nil {
// return nil, err
// }
// }

// info, err := cc.Keybase.NewAccount(keyName, mnemonicStr, "", hd.CreateHDPath(coinType, 0, 0).String(), algo)
// if err != nil {
// return nil, err
// }

// acc, err := info.GetAddress()
// if err != nil {
// return nil, err
// }

// out, err := cc.EncodeBech32AccAddr(acc)
// if err != nil {
// return nil, err
// }
// return &provider.KeyOutput{Mnemonic: mnemonicStr, Address: out}, nil
// }

// // ShowAddress retrieves a key by name from the keystore and returns the bech32 encoded string representation of that key.
func (cc *ArchwayProvider) ShowAddress(name string) (address string, err error) {
// info, err := cc.Keybase.Key(name)
// if err != nil {
// return "", err
// }
// acc, err := info.GetAddress()
// if err != nil {
// return "", nil
// }
// out, err := cc.EncodeBech32AccAddr(acc)
// if err != nil {
// return "", err
// }
return "", nil
}

// // ListAddresses returns a map of bech32 encoded strings representing all keys currently in the keystore.
func (cc *ArchwayProvider) ListAddresses() (map[string]string, error) {
out := map[string]string{}
// info, err := cc.Keybase.List()
// if err != nil {
// return nil, err
// }
// for _, k := range info {
// acc, err := k.GetAddress()
// if err != nil {
// return nil, err
// }
// addr, err := cc.EncodeBech32AccAddr(acc)
// if err != nil {
// return nil, err
// }
// out[k.Name] = addr
// }
return out, nil
}

// // DeleteKey removes a key from the keystore for the specified name.
func (cc *ArchwayProvider) DeleteKey(name string) error {
// if err := cc.Keybase.Delete(name); err != nil {
// return err
// }
return nil
}

// // KeyExists returns true if a key with the specified name exists in the keystore, it returns false otherwise.
func (cc *ArchwayProvider) KeyExists(name string) bool {
// k, err := cc.Keybase.Key(name)
// if err != nil {
// return false
// }

// return k.Name == name
return false
}

// // ExportPrivKeyArmor returns a private key in ASCII armored format.
// // It returns an error if the key does not exist or a wrong encryption passphrase is supplied.
func (cc *ArchwayProvider) ExportPrivKeyArmor(keyName string) (armor string, err error) {
// return cc.Keybase.ExportPrivKeyArmor(keyName, ckeys.DefaultKeyPass)
return "", nil
}

// // GetKeyAddress returns the account address representation for the currently configured key.
// func (cc *ArchwayProvider) GetKeyAddress() (sdk.AccAddress, error) {
// info, err := cc.Keybase.Key(cc.PCfg.Key)
// if err != nil {
// return nil, err
// }
// return info.GetAddress()
// }

// // CreateMnemonic generates a new mnemonic.
// func CreateMnemonic() (string, error) {
// entropySeed, err := bip39.NewEntropy(256)
// if err != nil {
// return "", err
// }
// mnemonic, err := bip39.NewMnemonic(entropySeed)
// if err != nil {
// return "", err
// }
// return mnemonic, nil
// }

// EncodeBech32AccAddr returns the string bech32 representation for the specified account address.
// It returns an empty sting if the byte slice is 0-length.
// It returns an error if the bech32 conversion fails or the prefix is empty.
func (cc *ArchwayProvider) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error) {
return sdk.Bech32ifyAddressBytes(cc.PCfg.AccountPrefix, addr)
}
1 change: 1 addition & 0 deletions relayer/chains/archway/message_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package archway
Loading