@@ -16,7 +16,6 @@ import (
16
16
"time"
17
17
18
18
"github.com/ava-labs/avalanchego/vms/platformvm/reward"
19
- "github.com/ethereum/go-ethereum/log"
20
19
21
20
"github.com/ava-labs/avalanchego/vms/avm"
22
21
"github.com/ava-labs/avalanchego/vms/components/avax"
@@ -97,6 +96,17 @@ func (ln *localNetwork) getNode() node.Node {
97
96
return node
98
97
}
99
98
99
+ func (ln * localNetwork ) getValidatorWeight () uint64 {
100
+ switch ln .networkID {
101
+ case avagoConstants .FujiID :
102
+ return genesis .FujiParams .MinValidatorStake
103
+ case avagoConstants .MainnetID :
104
+ return genesis .MainnetParams .MinValidatorStake
105
+ default :
106
+ return genesis .LocalParams .MinValidatorStake
107
+ }
108
+ }
109
+
100
110
// get node client URI for an arbitrary node in the network
101
111
func (ln * localNetwork ) getClientURI () (string , error ) {
102
112
clientURI := ""
@@ -115,30 +125,6 @@ func (ln *localNetwork) getClientURI() (string, error) {
115
125
return clientURI , nil
116
126
}
117
127
118
- /*
119
- func (ln *localNetwork) getClientURI() (string, error) {
120
- node := ln.getNode()
121
- clientURI := fmt.Sprintf("http://%s:%d", node.GetURL(), node.GetAPIPort())
122
- ln.log.Info("getClientURI",
123
- zap.String("nodeName", node.GetName()),
124
- zap.String("uri", clientURI))
125
- return clientURI, nil
126
- }
127
- */
128
- /*
129
- // get network URI for wallet
130
- func (ln *localNetwork) GetNetworkURI() (string, error) {
131
- switch ln.networkID {
132
- case avagoConstants.MainnetID:
133
- return "", fmt.Errorf("not supported")
134
- case avagoConstants.FujiID:
135
- return constants.FujiAPIEndpoint, nil
136
- default:
137
- return ln.getClientURI()
138
- }
139
- }
140
- */
141
-
142
128
func (ln * localNetwork ) CreateBlockchains (
143
129
ctx context.Context ,
144
130
chainSpecs []network.BlockchainSpec , // VM name + genesis bytes
@@ -318,12 +304,10 @@ func (ln *localNetwork) installCustomChains(
318
304
preloadTXs = append (preloadTXs , subnetID )
319
305
}
320
306
}
321
- ln .log .Info (logging .Blue .Wrap (logging .Bold .Wrap ("create wallet" )))
322
307
w , err := newWallet (ctx , clientURI , preloadTXs , ln .walletPrivateKey )
323
308
if err != nil {
324
309
return nil , err
325
310
}
326
- ln .log .Info (logging .Blue .Wrap (logging .Bold .Wrap (" wallet is ready" )))
327
311
// get subnet specs for all new subnets to create
328
312
// for the list of requested blockchains, we take those that have undefined subnet id
329
313
// and use the provided subnet spec. if not given, use an empty default subnet spec
@@ -880,15 +864,12 @@ func newWallet(
880
864
}
881
865
}
882
866
kc := secp256k1fx .NewKeychain (privateKey )
883
- log .Info ("aboout to fetch state" , uri , kc .Addresses ())
884
867
primaryAVAXState , err := primary .FetchState (ctx , uri , kc .Addresses ())
885
868
if err != nil {
886
869
return nil , err
887
870
}
888
- log .Info ("primaryAVAXState" , primaryAVAXState )
889
871
pCTX , xCTX , utxos := primaryAVAXState .PCTX , primaryAVAXState .XCTX , primaryAVAXState .UTXOs
890
872
pClient := platformvm .NewClient (uri )
891
- log .Info ("pClient using uri" , uri )
892
873
pTXs := make (map [ids.ID ]* txs.Tx )
893
874
for _ , id := range preloadTXs {
894
875
txBytes , err := pClient .GetTx (ctx , id )
@@ -911,7 +892,6 @@ func newWallet(
911
892
w .pSigner = psigner .New (kc , w .pBackend )
912
893
w .pWallet = p .NewWallet (w .pBuilder , w .pSigner , pClient , w .pBackend )
913
894
914
- log .Info ("pWallet" , w .pWallet )
915
895
xBackend := x .NewBackend (xCTX , xUTXOs )
916
896
xBuilder := xbuilder .New (kc .Addresses (), xCTX , xBackend )
917
897
xSigner := xsigner .New (kc , xBackend )
@@ -972,7 +952,7 @@ func (ln *localNetwork) addPrimaryValidators(
972
952
NodeID : nodeID ,
973
953
Start : uint64 (time .Now ().Add (validationStartOffset ).Unix ()),
974
954
End : uint64 (time .Now ().Add (validationDuration ).Unix ()),
975
- Wght : genesis . LocalParams . MinValidatorStake ,
955
+ Wght : ln . getValidatorWeight () ,
976
956
},
977
957
Subnet : ids .Empty ,
978
958
},
0 commit comments