Skip to content

Commit df366d1

Browse files
authoredJul 7, 2022
Attestation step 1 (#34)
1 parent 6be5b1e commit df366d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5113
-2596
lines changed
 

‎app/app.go

+8-41
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
sdk "github.com/cosmos/cosmos-sdk/types"
88
"github.com/gogo/protobuf/proto"
9-
"github.com/palomachain/pigeon/attest"
109
"github.com/palomachain/pigeon/chain"
1110
"github.com/palomachain/pigeon/chain/evm"
1211
"github.com/palomachain/pigeon/chain/paloma"
@@ -28,10 +27,7 @@ var (
2827

2928
_palomaClient *paloma.Client
3029

31-
_evmClients map[string]evm.Client
32-
_evmProcessors map[string]chain.Processor
33-
34-
_attestRegistry *attest.Registry
30+
_evmFactory *evm.Factory
3531
)
3632

3733
func Relayer() *relayer.Relayer {
@@ -40,8 +36,7 @@ func Relayer() *relayer.Relayer {
4036
_relayer = relayer.New(
4137
*Config(),
4238
*PalomaClient(),
43-
AttestRegistry(),
44-
GetEvmProcessors(),
39+
EvmFactory(),
4540
)
4641
}
4742
return _relayer
@@ -63,35 +58,12 @@ func SetConfigPath(path string) {
6358
_configPath = path
6459
}
6560

66-
func GetEvmProcessors() map[string]chain.Processor {
67-
if _evmProcessors == nil {
68-
_evmProcessors = make(map[string]chain.Processor)
69-
}
70-
71-
for chainID, client := range GetEvmClients() {
72-
_evmProcessors[chainID] = evm.NewProcessor(client, chainID)
61+
func EvmFactory() *evm.Factory {
62+
if _evmFactory == nil {
63+
_evmFactory = evm.NewFactory(PalomaClient())
7364
}
7465

75-
return _evmProcessors
76-
}
77-
78-
func GetEvmClients() map[string]evm.Client {
79-
if _evmClients == nil {
80-
_evmClients = make(map[string]evm.Client)
81-
}
82-
83-
config := Config()
84-
for chainName, evmConfig := range config.EVM {
85-
if _, ok := _evmClients[chainName]; ok {
86-
log.WithFields(log.Fields{
87-
"chainName": chainName,
88-
}).Fatal("chain with chainName already registered")
89-
}
90-
91-
_evmClients[chainName] = evm.NewClient(evmConfig, PalomaClient(), chainName)
92-
}
93-
94-
return _evmClients
66+
return _evmFactory
9567
}
9668

9769
func Config() *config.Root {
@@ -145,13 +117,6 @@ func PalomaClient() *paloma.Client {
145117
return _palomaClient
146118
}
147119

148-
func AttestRegistry() *attest.Registry {
149-
if _attestRegistry == nil {
150-
_attestRegistry = attest.NewRegistry()
151-
}
152-
return _attestRegistry
153-
}
154-
155120
func defaultValue[T comparable](proposedVal T, defaultVal T) T {
156121
var zero T
157122
if proposedVal == zero {
@@ -173,6 +138,8 @@ func palomaLensClientConfig(palomaConfig config.Paloma) *lens.ChainClientConfig
173138
&consensustypes.MsgAddMessagesSignatures{},
174139
&valsettypes.MsgAddExternalChainInfoForValidator{},
175140
&consensustypes.MsgDeleteJob{},
141+
&consensustypes.MsgAddEvidence{},
142+
&consensustypes.MsgSetPublicAccessData{},
176143
},
177144
},
178145
},

‎attest/attest.go

-35
This file was deleted.

0 commit comments

Comments
 (0)