Node/Gateway: Wormconn chainID wrong for testnet (#3316)
This commit is contained in:
parent
782111e528
commit
e4fc44771a
|
@ -998,6 +998,11 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
// Redirect ipfs logs to plain zap
|
||||
ipfslog.SetPrimaryCore(logger.Core())
|
||||
|
||||
wormchainId := "wormchain"
|
||||
if *testnetMode {
|
||||
wormchainId = "wormchain-testnet-0"
|
||||
}
|
||||
|
||||
var accountantWormchainConn *wormconn.ClientConn
|
||||
if *accountantContract != "" {
|
||||
// TODO: wormchainKeyPath and wormchainKeyPassPhrase are being replaced by accountantKeyPath and accountantKeyPassPhrase.
|
||||
|
@ -1040,7 +1045,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
|
||||
// Connect to wormchain.
|
||||
logger.Info("Connecting to wormchain", zap.String("wormchainURL", *wormchainURL), zap.String("keyPath", keyPathName), zap.String("component", "gacct"))
|
||||
accountantWormchainConn, err = wormconn.NewConn(rootCtx, *wormchainURL, wormchainKey)
|
||||
accountantWormchainConn, err = wormconn.NewConn(rootCtx, *wormchainURL, wormchainKey, wormchainId)
|
||||
if err != nil {
|
||||
logger.Fatal("failed to connect to wormchain", zap.Error(err), zap.String("component", "gacct"))
|
||||
}
|
||||
|
@ -1074,7 +1079,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
|
||||
logger.Info("Connecting to wormchain", zap.String("wormchainURL", *wormchainURL), zap.String("keyPath", wormchainKeyPathName), zap.String("component", "gwrelayer"))
|
||||
gatewayRelayerWormchainConn, err = wormconn.NewConn(rootCtx, *wormchainURL, wormchainKey)
|
||||
gatewayRelayerWormchainConn, err = wormconn.NewConn(rootCtx, *wormchainURL, wormchainKey, wormchainId)
|
||||
if err != nil {
|
||||
logger.Fatal("failed to connect to wormchain", zap.Error(err), zap.String("component", "gwrelayer"))
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ func main() {
|
|||
logger.Fatal("failed to load devnet wormchain private key", zap.Error(err))
|
||||
}
|
||||
|
||||
wormchainConn, err := wormconn.NewConn(ctx, wormchainURL, wormchainKey)
|
||||
wormchainConn, err := wormconn.NewConn(ctx, wormchainURL, wormchainKey, "wormchain")
|
||||
if err != nil {
|
||||
logger.Fatal("failed to connect to wormchain", zap.Error(err))
|
||||
}
|
||||
|
|
|
@ -29,11 +29,12 @@ type ClientConn struct {
|
|||
encCfg EncodingConfig
|
||||
privateKey cryptotypes.PrivKey
|
||||
senderAddress string
|
||||
chainId string
|
||||
mutex sync.Mutex // Protects the account / sequence number
|
||||
}
|
||||
|
||||
// NewConn creates a new connection to the wormhole-chain instance at `target`.
|
||||
func NewConn(ctx context.Context, target string, privateKey cryptotypes.PrivKey) (*ClientConn, error) {
|
||||
func NewConn(ctx context.Context, target string, privateKey cryptotypes.PrivKey, chainId string) (*ClientConn, error) {
|
||||
c, err := grpc.DialContext(
|
||||
ctx,
|
||||
target,
|
||||
|
@ -50,7 +51,7 @@ func NewConn(ctx context.Context, target string, privateKey cryptotypes.PrivKey)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return &ClientConn{c: c, encCfg: encCfg, privateKey: privateKey, senderAddress: senderAddress}, nil
|
||||
return &ClientConn{c: c, encCfg: encCfg, privateKey: privateKey, senderAddress: senderAddress, chainId: chainId}, nil
|
||||
}
|
||||
|
||||
func (c *ClientConn) SenderAddress() string {
|
||||
|
|
|
@ -53,7 +53,7 @@ func (c *ClientConn) SignAndBroadcastTx(ctx context.Context, msg sdktypes.Msg) (
|
|||
}
|
||||
|
||||
signerData := authsigning.SignerData{
|
||||
ChainID: "wormchain",
|
||||
ChainID: c.chainId,
|
||||
AccountNumber: account.GetAccountNumber(),
|
||||
Sequence: sequence,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue