Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:bnb-chain/greenfield-cosmos-sdk …
Browse files Browse the repository at this point in the history
…into msg-reject-migrate
  • Loading branch information
alexgao001 committed Oct 9, 2023
2 parents 16e523d + baea80e commit 9c03f7d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.0.0
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.

Expand Down
21 changes: 4 additions & 17 deletions client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 2 additions & 0 deletions x/upgrade/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions x/upgrade/types/upgrade_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9c03f7d

Please sign in to comment.