From 7b99d20f4307294318ccc8baeb1283aa2cf48457 Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Sat, 7 Oct 2023 10:01:02 +0800 Subject: [PATCH 1/3] feat: add Nagqu fork to mainnet (#317) * feat: add Nagqu fork to mainnet * fix: default mainnet hardfork config --- x/upgrade/keeper/keeper.go | 2 ++ x/upgrade/types/upgrade_config.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 2f492123ff..e4aa18f03b 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -462,6 +462,8 @@ func (keeper *Keeper) RegisterUpgradePlan(chianID string, plans []serverconfig.U // getExistChainConfig returns the exist chain config func getExistChainConfig(chainID string) *types.UpgradeConfig { switch chainID { + case types.MainnetChainID: + return types.MainnetConfig case types.TestnetChainID: return types.TestnetConfig default: diff --git a/x/upgrade/types/upgrade_config.go b/x/upgrade/types/upgrade_config.go index 659e1c72c1..eba8205025 100644 --- a/x/upgrade/types/upgrade_config.go +++ b/x/upgrade/types/upgrade_config.go @@ -16,6 +16,13 @@ const ( // The default upgrade config for networks var ( + MainnetChainID = "greenfield_1017-1" + MainnetConfig = NewUpgradeConfig().SetPlan(&Plan{ + Name: Nagqu, + Height: 1, + Info: "Nagqu hardfork", + }) + TestnetChainID = "greenfield_5600-1" TestnetConfig = NewUpgradeConfig().SetPlan(&Plan{ Name: Nagqu, From df82cce664956291fc18ae782100ac4db2575604 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Sat, 7 Oct 2023 10:09:26 +0800 Subject: [PATCH 2/3] release: draft release for v1.0.0 (#324) --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26cd8f5803..2093003901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v1.0.0 +This release includes 1 new feature. + +* [#317](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/317) feat: add Nagqu fork to mainnet + ## v0.2.6 This release caps the pagination limit for queries at 100 records if it exceeds the default pagination limit. From baea80e880fed3c969830f4a0faa7e1d980937f2 Mon Sep 17 00:00:00 2001 From: Roshan <48975233+Pythonberg1997@users.noreply.github.com> Date: Fri, 6 Oct 2023 21:40:10 -0500 Subject: [PATCH 3/3] feat: support multi msg for `PrintEIP712MsgType` flag (#323) --- CHANGELOG.md | 3 ++- client/tx/factory.go | 21 ++++----------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2093003901..115746a460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Changelog ## v1.0.0 -This release includes 1 new feature. +This release includes 2 new features. * [#317](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/317) feat: add Nagqu fork to mainnet +* [#323](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/323) feat: support multi msg for `PrintEIP712MsgType` flag ## v0.2.6 This release caps the pagination limit for queries at 100 records if it exceeds the default pagination limit. diff --git a/client/tx/factory.go b/client/tx/factory.go index 80bda86574..0aa92bc478 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -410,10 +410,6 @@ func (f Factory) PrintUnsignedTx(clientCtx client.Context, msgs ...sdk.Msg) erro } func (f Factory) PrintEIP712MsgType(clientCtx client.Context, msgs ...sdk.Msg) error { - if len(msgs) != 1 { - return errors.New("only one message is supported") - } - unsignedTx, err := f.BuildUnsignedTx(msgs...) if err != nil { return err @@ -443,28 +439,19 @@ func (f Factory) PrintEIP712MsgType(clientCtx client.Context, msgs ...sdk.Msg) e return fmt.Errorf("failed to wrap tx to typedData: %s", err) } - eip712MsgTypes := typedData.Types - delete(eip712MsgTypes, "Tx") - delete(eip712MsgTypes, "Fee") - delete(eip712MsgTypes, "Coin") - delete(eip712MsgTypes, "EIP712Domain") - - msgData := typedData.Message["msg1"].(map[string]interface{}) - if msgData == nil { - return fmt.Errorf("failed to get msg data") + msgData := make(map[string]interface{}) + for i := 1; i <= len(msgs); i++ { + msgData[fmt.Sprintf("msg%d", i)] = typedData.Message[fmt.Sprintf("msg%d", i)] } - msgTypeUrl := msgData["type"].(string) type EIP712TypedData struct { - MsgTypeUrl string `json:"MsgTypeUrl"` EIP712MessageType apitypes.Types `json:"EIP712MessageType"` MessageData map[string]interface{} `json:"MessageData"` TxRawBytes string `json:"TxRawBytes"` } eip712TypedData := EIP712TypedData{ - MsgTypeUrl: msgTypeUrl, - EIP712MessageType: eip712MsgTypes, + EIP712MessageType: typedData.Types, MessageData: msgData, TxRawBytes: txRawBytesHex, }