Skip to content

Commit

Permalink
Merge pull request #646 from bnb-chain/master
Browse files Browse the repository at this point in the history
chore: sync master to develop
  • Loading branch information
unclezoro authored Nov 5, 2024
2 parents d85ef37 + eb6e32a commit e490ec7
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 11 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## V1.9.1
This release introduces the Altai upgrade.

* [#645] https://github.com/bnb-chain/greenfield/pull/645 feat: fix the EIP712 signing issue and introduce a new hardfork Altai

## V1.9.0
This release introduces the Mongolian upgrade.

Features:
* [#639] https://github.com/bnb-chain/greenfield/pull/639 feat: Support msg to create policy by cross chain

Fixes:
* [#638] https://github.com/bnb-chain/greenfield/pull/638 fix: initial val for min value comparison should be large enough
* [#640] https://github.com/bnb-chain/greenfield/pull/640 fix: broken links reroute from local repo to bnbchain docs

Docs:
* [#633] https://github.com/bnb-chain/greenfield/pull/633 docs: replace docs link

## V1.8.0
This release introduces the Veld upgrade.

Expand Down
11 changes: 10 additions & 1 deletion app/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import (
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
"github.com/stretchr/testify/suite"

"github.com/bnb-chain/greenfield/app"
Expand Down Expand Up @@ -251,7 +253,14 @@ func (suite *AnteTestSuite) CreateTestEIP712CosmosTxBuilder(
msgTypes, signDoc, err := tx.GetMsgTypes(signerData, txBuilder.GetTx(), big.NewInt(9000))
suite.Require().NoError(err)

typedData, err := tx.WrapTxToTypedData(9000, signDoc, msgTypes)
typedDataDomain := apitypes.TypedDataDomain{
Name: "Greenfield Tx",
Version: "1.0.0",
ChainId: math.NewHexOrDecimal256(int64(9000)),
VerifyingContract: "0x71e835aff094655dEF897fbc85534186DbeaB75d",
Salt: "0",
}
typedData, err := tx.WrapTxToTypedData(signDoc, msgTypes, typedDataDomain)
suite.Require().NoError(err)

typedDataJson, _ := json.MarshalIndent(typedData, "", " ")
Expand Down
19 changes: 18 additions & 1 deletion app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (app *App) RegisterUpgradeHandlers(chainID string, serverCfg *serverconfig.
app.registerErdosUpgradeHandler()
app.registerVeldUpgradeHandler()
app.registerMongolianUpgradeHandler()
app.registerAltaiUpgradeHandler()
// app.register...()
// ...
return nil
Expand Down Expand Up @@ -292,7 +293,23 @@ func (app *App) registerMongolianUpgradeHandler() {
// Register the upgrade initializer
app.UpgradeKeeper.SetUpgradeInitializer(upgradetypes.Mongolian,
func() error {
app.Logger().Info("Init Veld upgrade")
app.Logger().Info("Init Mongolian upgrade")
return nil
})
}

func (app *App) registerAltaiUpgradeHandler() {
// Register the upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(upgradetypes.Altai,
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
app.Logger().Info("upgrade to ", plan.Name)
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

// Register the upgrade initializer
app.UpgradeKeeper.SetUpgradeInitializer(upgradetypes.Altai,
func() error {
app.Logger().Info("Init Altai upgrade")
return nil
})
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ replace (
github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.3.0
github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.8.1-0.20240711041516-7fd2f478ff35
github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.9.2
github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/wercker/journalhook => github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ github.com/bnb-chain/greenfield-cometbft v1.3.0 h1:v3nZ16ledTZGF5Csys7fTQGZcEV78
github.com/bnb-chain/greenfield-cometbft v1.3.0/go.mod h1:0D+VPivZTeBldjtGGi9LKbBnKEO/RtMRJikie92LkYI=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI=
github.com/bnb-chain/greenfield-cosmos-sdk v1.8.1-0.20240711041516-7fd2f478ff35 h1:9VZdnAqCBFCGzNxzV7jnxqSpUwIDwH7UcUMl1nfCEY4=
github.com/bnb-chain/greenfield-cosmos-sdk v1.8.1-0.20240711041516-7fd2f478ff35/go.mod h1:2bwmwdXYBISnQoMwgAcZTVGt21lMsHZSeeeMByTvDlQ=
github.com/bnb-chain/greenfield-cosmos-sdk v1.9.2 h1:hqZ4v4M3nkBNs1dXbAQkMBrNQuP9maQOSU+rBwzAemQ=
github.com/bnb-chain/greenfield-cosmos-sdk v1.9.2/go.mod h1:2bwmwdXYBISnQoMwgAcZTVGt21lMsHZSeeeMByTvDlQ=
github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210 h1:GHPbV2bC+gmuO6/sG0Tm8oGal3KKSRlyE+zPscDjlA8=
github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210/go.mod h1:vhsZxXE9tYJeYB5JR4hPhd6Pc/uPf7j1T8IJ7p9FdeM=
github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230816082903-b48770f5e210 h1:FLVOn4+OVbsKi2+YJX5kmD27/4dRu4FW7xCXFhzDO5s=
Expand Down
2 changes: 1 addition & 1 deletion x/bridge/types/message_transfer_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (msg *MsgTransferOut) ValidateBasic() error {
}

if !msg.Amount.IsValid() {
return errors.Wrapf(sdkerrors.ErrInvalidCoins, msg.Amount.String())
return errors.Wrapf(sdkerrors.ErrInvalidCoins, "%v%s", msg.Amount.Amount, msg.Amount.Denom)
}

if !msg.Amount.IsPositive() {
Expand Down
8 changes: 3 additions & 5 deletions x/challenge/keeper/bls_signed_msg.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"fmt"

"cosmossdk.io/errors"
"github.com/bits-and-blooms/bitset"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -41,18 +39,18 @@ func (k Keeper) verifySignature(ctx sdk.Context, signedMsg BlsSignedMsg, validat
signedChallengers = append(signedChallengers, val.ChallengerAddress)
votePubKey, err := bls.PublicKeyFromBytes(val.BlsKey)
if err != nil {
return nil, errors.Wrapf(types.ErrInvalidBlsPubKey, fmt.Sprintf("BLS public key converts failed: %v", err))
return nil, errors.Wrapf(types.ErrInvalidBlsPubKey, "BLS public key converts failed: %v", err)
}
votedPubKeys = append(votedPubKeys, votePubKey)
}

if len(votedPubKeys) <= len(validators)*2/3 {
return nil, errors.Wrapf(types.ErrNotEnoughVotes, fmt.Sprintf("Not enough validators voted, need: %d, voted: %d", len(validators)*2/3, len(votedPubKeys)))
return nil, errors.Wrapf(types.ErrNotEnoughVotes, "Not enough validators voted, need: %d, voted: %d", len(validators)*2/3, len(votedPubKeys))
}

aggSig, err := bls.SignatureFromBytes(signedMsg.GetVoteAggSignature())
if err != nil {
return nil, errors.Wrapf(types.ErrInvalidVoteAggSignature, fmt.Sprintf("BLS signature converts failed: %v", err))
return nil, errors.Wrapf(types.ErrInvalidVoteAggSignature, "BLS signature converts failed: %v", err)
}

if !aggSig.FastAggregateVerify(votedPubKeys, signedMsg.GetBlsSignBytes(ctx.ChainID())) {
Expand Down

0 comments on commit e490ec7

Please sign in to comment.