diff --git a/docs/developer/e2e-tests.md b/docs/developer/e2e-tests.md index 481423cfe..aeac47680 100755 --- a/docs/developer/e2e-tests.md +++ b/docs/developer/e2e-tests.md @@ -86,7 +86,7 @@ BLOCK_TO_SEARCH=100 cargo run -p gbt -- --home /root/.gbt/ --address-prefix orai In side the Gravity test network, run: ```bash -gravity tx gravity send-to-eth 0xc9B6f87d637d4774EEB54f8aC2b89dBC3D38226b 9goerli-testnet0xf48007ea0F3AA4d2A59DFb4473dd30f90488c8Ef 1goerli-testnet0xf48007ea0F3AA4d2A59DFb4473dd30f90488c8Ef goerli-testnet --home data/validator1 -y --from validator1 +gravity tx gravity send-to-eth 0xc9B6f87d637d4774EEB54f8aC2b89dBC3D38226b 1foobar0xf48007ea0F3AA4d2A59DFb4473dd30f90488c8Ef 1foobar0xf48007ea0F3AA4d2A59DFb4473dd30f90488c8Ef 1foobar0xf48007ea0F3AA4d2A59DFb4473dd30f90488c8Ef foobar --home upgrade-tests/data/validator1 -y --from validator1 --keyring-backend test --chain-id gravity-test ``` # Useful commands @@ -106,7 +106,7 @@ npx ts-node scripts/get-dummy-balance.ts # Add new evm chain gravity tx gravity add-evm-chain "goerli network 2nd" "foobar" "421" "defaultgravityid" "add goerli network 2nd" 100000000uoraib "foobar" --from validator1 --home e2e/data/validator1/ -y --keyring-backend test --chain-id gravity-test -b block --gas 2000000 -gravity tx gov vote 1 yes --from validator1 --home e2e/data/validator1/ -y +gravity tx gov vote 1 yes --from validator1 --home e2e/data/validator1/ -y --keyring-backend test --chain-id gravity-test -b block ``` \ No newline at end of file diff --git a/module/Makefile b/module/Makefile index 546d156f6..2b3f8adcb 100644 --- a/module/Makefile +++ b/module/Makefile @@ -1,7 +1,7 @@ #!/usr/bin/make -f PACKAGES=$(shell go list ./... | grep -v '/simulation') -VERSION := $(shell git describe --abbrev=6 --dirty --always --tags) +VERSION := $(shell git describe --abbrev=30 --dirty --always --tags) COMMIT := $(shell git log -1 --format='%H') DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf diff --git a/module/app/upgrades/pleiades/handler.go b/module/app/upgrades/pleiades/handler.go index 22a1dede1..29b124562 100644 --- a/module/app/upgrades/pleiades/handler.go +++ b/module/app/upgrades/pleiades/handler.go @@ -27,7 +27,7 @@ func GetPleiadesUpgradeHandler( { EvmChainPrefix: EthereumChainPrefix, EvmChainName: "Binance Smart Chain", - EvmChainNetVersion: 5, + EvmChainNetVersion: 56, }, } diff --git a/module/proto/gravity/v1/types.proto b/module/proto/gravity/v1/types.proto index 594553978..94a4192ad 100755 --- a/module/proto/gravity/v1/types.proto +++ b/module/proto/gravity/v1/types.proto @@ -114,6 +114,7 @@ message AddEvmChainProposal { string evm_chain_prefix = 4; uint64 evm_chain_net_version = 5; string gravity_id = 6; + string bridge_ethereum_address = 7; } // PendingIbcAutoForward represents a SendToCosmos transaction with a foreign CosmosReceiver which will be added to the diff --git a/module/x/gravity/client/cli/tx.go b/module/x/gravity/client/cli/tx.go index 83d87d66b..0d572d3d4 100755 --- a/module/x/gravity/client/cli/tx.go +++ b/module/x/gravity/client/cli/tx.go @@ -306,9 +306,9 @@ func CmdGovUnhaltBridgeProposal() *cobra.Command { func CmdAddEvmChainProposal() *cobra.Command { // nolint: exhaustruct cmd := &cobra.Command{ - Use: "add-evm-chain [evm-chain-name] [evm-chain-prefix] [evm-chain-net-version] [evm-chain-gravity-id] [title] [initial-deposit] [description]", + Use: "add-evm-chain [evm-chain-name] [evm-chain-prefix] [evm-chain-net-version] [evm-chain-gravity-id] [evm-chain-bridge-eth-address] [title] [initial-deposit] [description]", Short: "Creates a governance proposal to support a new EVM chain on the network", - Args: cobra.ExactArgs(7), + Args: cobra.ExactArgs(8), RunE: func(cmd *cobra.Command, args []string) error { cliCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -316,7 +316,7 @@ func CmdAddEvmChainProposal() *cobra.Command { } cosmosAddr := cliCtx.GetFromAddress() - initialDeposit, err := sdk.ParseCoinsNormalized(args[5]) + initialDeposit, err := sdk.ParseCoinsNormalized(args[6]) if err != nil { return sdkerrors.Wrap(err, "bad initial deposit amount") } @@ -332,8 +332,9 @@ func CmdAddEvmChainProposal() *cobra.Command { return fmt.Errorf("EVM chain net version should be an unsigned integer") } gravityId := args[3] + bridgeEthAddress := args[4] - proposal := &types.AddEvmChainProposal{EvmChainName: evmChainName, EvmChainPrefix: evmChainPrefix, EvmChainNetVersion: evmChainNetVersion, GravityId: gravityId, Title: args[4], Description: args[6]} + proposal := &types.AddEvmChainProposal{EvmChainName: evmChainName, EvmChainPrefix: evmChainPrefix, EvmChainNetVersion: evmChainNetVersion, GravityId: gravityId, BridgeEthereumAddress: bridgeEthAddress, Title: args[5], Description: args[7]} proposalAny, err := codectypes.NewAnyWithValue(proposal) if err != nil { return sdkerrors.Wrap(err, "invalid metadata or proposal details!") @@ -399,7 +400,7 @@ func CmdSendToEth() *cobra.Command { Amount: amount[0], BridgeFee: bridgeFee[0], ChainFee: chainFee[0], - EvmChainPrefix: args[3], + EvmChainPrefix: args[4], } if err := msg.ValidateBasic(); err != nil { return err diff --git a/module/x/gravity/keeper/attestation.go b/module/x/gravity/keeper/attestation.go index 327641636..9bbba7e8c 100644 --- a/module/x/gravity/keeper/attestation.go +++ b/module/x/gravity/keeper/attestation.go @@ -441,9 +441,9 @@ func (k Keeper) SetLastEventNonceByValidator(ctx sdk.Context, evmChainPrefix str } // IterateValidatorLastEventNonces iterates through all batch confirmations -func (k Keeper) IterateValidatorLastEventNonces(ctx sdk.Context, cb func(key []byte, nonce uint64) (stop bool)) { +func (k Keeper) IterateValidatorLastEventNonces(ctx sdk.Context, evmChainPrefix string, cb func(key []byte, nonce uint64) (stop bool)) { store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.LastEventNonceByValidatorKey) + prefixStore := prefix.NewStore(store, types.AppendChainPrefix(types.LastEventNonceByValidatorKey, evmChainPrefix)) iter := prefixStore.Iterator(nil, nil) defer iter.Close() diff --git a/module/x/gravity/keeper/cosmos-originated.go b/module/x/gravity/keeper/cosmos-originated.go index 1f9e444bf..dab5473ea 100644 --- a/module/x/gravity/keeper/cosmos-originated.go +++ b/module/x/gravity/keeper/cosmos-originated.go @@ -36,9 +36,9 @@ func (k Keeper) GetCosmosOriginatedERC20(ctx sdk.Context, evmChainPrefix string, // IterateCosmosOriginatedERC20s iterates through every erc20 under DenomToERC20Key, passing it to the given callback. // cb should return true to stop iteration, false to continue -func (k Keeper) IterateCosmosOriginatedERC20s(ctx sdk.Context, cb func(key []byte, erc20 *types.EthAddress) (stop bool)) { +func (k Keeper) IterateCosmosOriginatedERC20s(ctx sdk.Context, evmChainPrefix string, cb func(key []byte, erc20 *types.EthAddress) (stop bool)) { store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.DenomToERC20Key) + prefixStore := prefix.NewStore(store, types.AppendChainPrefix(types.DenomToERC20Key, evmChainPrefix)) iter := prefixStore.Iterator(nil, nil) defer iter.Close() diff --git a/module/x/gravity/keeper/evidence.go b/module/x/gravity/keeper/evidence.go index 9489d6945..42ecbf97b 100644 --- a/module/x/gravity/keeper/evidence.go +++ b/module/x/gravity/keeper/evidence.go @@ -24,13 +24,8 @@ func (k Keeper) CheckBadSignatureEvidence( } switch subject := subject.(type) { - case *types.OutgoingTxBatch: + case *types.OutgoingTxBatch, *types.Valset, *types.OutgoingLogicCall: return k.checkBadSignatureEvidenceInternal(ctx, msg.EvmChainPrefix, subject, msg.Signature) - case *types.Valset: - return k.checkBadSignatureEvidenceInternal(ctx, msg.EvmChainPrefix, subject, msg.Signature) - case *types.OutgoingLogicCall: - return k.checkBadSignatureEvidenceInternal(ctx, msg.EvmChainPrefix, subject, msg.Signature) - default: return sdkerrors.Wrap(types.ErrInvalid, fmt.Sprintf("Bad signature must be over a batch, valset, or logic call got %s", subject)) } @@ -95,15 +90,11 @@ func (k Keeper) SetPastEthSignatureCheckpoint(ctx sdk.Context, evmChainPrefix st // GetPastEthSignatureCheckpoint tells you whether a given checkpoint has ever existed func (k Keeper) GetPastEthSignatureCheckpoint(ctx sdk.Context, evmChainPrefix string, checkpoint []byte) (found bool) { store := ctx.KVStore(k.storeKey) - if bytes.Equal(store.Get(types.GetPastEvmSignatureCheckpointKey(evmChainPrefix, checkpoint)), []byte{0x1}) { - return true - } else { - return false - } + return bytes.Equal(store.Get(types.GetPastEvmSignatureCheckpointKey(evmChainPrefix, checkpoint)), []byte{0x1}) } -func (k Keeper) IteratePastEthSignatureCheckpoints(ctx sdk.Context, cb func(key []byte, value []byte) (stop bool)) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.PastEthSignatureCheckpointKey) +func (k Keeper) IteratePastEthSignatureCheckpoints(ctx sdk.Context, evmChainPrefix string, cb func(key []byte, value []byte) (stop bool)) { + prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.AppendChainPrefix(types.PastEvmSignatureCheckpointKey, evmChainPrefix)) iter := prefixStore.Iterator(nil, nil) defer iter.Close() diff --git a/module/x/gravity/keeper/genesis.go b/module/x/gravity/keeper/genesis.go index 70fc510d9..9faf58c67 100644 --- a/module/x/gravity/keeper/genesis.go +++ b/module/x/gravity/keeper/genesis.go @@ -72,12 +72,18 @@ func initBridgeDataFromGenesis(ctx sdk.Context, k Keeper, data types.EvmChainDat panic("couldn't cast to claim") } - // TODO: block height? + // block height? + if claim.GetEthBlockHeight() == 0 { + panic("eth block height can not be zero") + } hash, err := claim.ClaimHash() if err != nil { panic(fmt.Errorf("error when computing ClaimHash for %v", hash)) } - k.SetAttestation(ctx, evmChainPrefix, claim.GetEventNonce(), hash, &att) + // these claims always have the same evmChainPrefix even not set + claim.SetEvmChainPrefix(evmChainPrefix) + + k.SetAttestation(ctx, claim.GetEvmChainPrefix(), claim.GetEventNonce(), hash, &att) } // reset attestation state of specific validators @@ -254,8 +260,9 @@ func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState { evmChains[ci] = types.EvmChainData{ EvmChain: types.EvmChain{ - EvmChainPrefix: evmChain.EvmChainPrefix, - EvmChainName: evmChain.EvmChainName, + EvmChainNetVersion: evmChain.EvmChainNetVersion, + EvmChainPrefix: evmChain.EvmChainPrefix, + EvmChainName: evmChain.EvmChainName, }, GravityNonces: types.GravityNonces{ LatestValsetNonce: k.GetLatestValsetNonce(ctx, evmChain.EvmChainPrefix), diff --git a/module/x/gravity/keeper/governance_proposals.go b/module/x/gravity/keeper/governance_proposals.go index 8d2ac81f5..eac41e6a6 100755 --- a/module/x/gravity/keeper/governance_proposals.go +++ b/module/x/gravity/keeper/governance_proposals.go @@ -116,13 +116,20 @@ func (k Keeper) HandleAddEvmChainProposal(ctx sdk.Context, p *types.AddEvmChainP initBridgeDataFromGenesis(ctx, k, evmChain) + // check bridge address, if invalid then we set default to 0x0 + finalEthAddress := p.BridgeEthereumAddress + err := types.ValidateEthAddress(p.BridgeEthereumAddress) + if err != nil { + finalEthAddress = "0x0000000000000000000000000000000000000000" + } + // update param to match with the new evm chain params := k.GetParams(ctx) evmChainParam := &types.EvmChainParam{ EvmChainPrefix: p.EvmChainPrefix, GravityId: p.GravityId, ContractSourceHash: "", - BridgeEthereumAddress: "0x0000000000000000000000000000000000000000", + BridgeEthereumAddress: finalEthAddress, BridgeChainId: p.EvmChainNetVersion, AverageEthereumBlockTime: 15000, BridgeActive: true, diff --git a/module/x/gravity/keeper/invariants.go b/module/x/gravity/keeper/invariants.go index 9d81e42f6..ace05b5b7 100644 --- a/module/x/gravity/keeper/invariants.go +++ b/module/x/gravity/keeper/invariants.go @@ -286,7 +286,7 @@ func ValidateStore(ctx sdk.Context, evmChainPrefix string, k Keeper) error { } // OutgoingTXPoolKey - k.IterateUnbatchedTransactions(ctx, func(key []byte, tx *types.InternalOutgoingTransferTx) (stop bool) { + k.IterateUnbatchedTransactions(ctx, evmChainPrefix, func(key []byte, tx *types.InternalOutgoingTransferTx) (stop bool) { err = tx.ValidateBasic() if err != nil { err = fmt.Errorf("Invalid unbatched transaction %v under key %v in IterateUnbatchedTransactions: %v", tx, key, err) @@ -325,7 +325,7 @@ func ValidateStore(ctx sdk.Context, evmChainPrefix string, k Keeper) error { } // LastEventNonceByValidatorKey (type checked when fetching) - k.IterateValidatorLastEventNonces(ctx, func(key []byte, nonce uint64) (stop bool) { + k.IterateValidatorLastEventNonces(ctx, evmChainPrefix, func(key []byte, nonce uint64) (stop bool) { return false }) if err != nil { @@ -364,7 +364,7 @@ func ValidateStore(ctx sdk.Context, evmChainPrefix string, k Keeper) error { } // KeyOutgoingLogicConfirm - k.IterateLogicConfirms(ctx, func(key []byte, confirm *types.MsgConfirmLogicCall) (stop bool) { + k.IterateLogicConfirms(ctx, evmChainPrefix, func(key []byte, confirm *types.MsgConfirmLogicCall) (stop bool) { err = confirm.ValidateBasic() if err != nil { err = fmt.Errorf("Invalid logic call confirm %v under key %v in IterateLogicConfirms: %v", confirm, key, err) @@ -389,7 +389,7 @@ func ValidateStore(ctx sdk.Context, evmChainPrefix string, k Keeper) error { } // DenomToERC20Key - k.IterateCosmosOriginatedERC20s(ctx, func(key []byte, erc20 *types.EthAddress) (stop bool) { + k.IterateCosmosOriginatedERC20s(ctx, evmChainPrefix, func(key []byte, erc20 *types.EthAddress) (stop bool) { if err = erc20.ValidateBasic(); err != nil { err = fmt.Errorf("Discovered invalid cosmos originated erc20 %v under key %v: %v", erc20, key, err) return true @@ -444,7 +444,7 @@ func ValidateStore(ctx sdk.Context, evmChainPrefix string, k Keeper) error { return fmt.Errorf("Discovered invalid last observed valset %v: %v", valset, err) } // PastEthSignatureCheckpointKey - k.IteratePastEthSignatureCheckpoints(ctx, func(key []byte, value []byte) (stop bool) { + k.IteratePastEthSignatureCheckpoints(ctx, evmChainPrefix, func(key []byte, value []byte) (stop bool) { // Check is performed in the iterator function return false }) diff --git a/module/x/gravity/keeper/keeper_logic_call.go b/module/x/gravity/keeper/keeper_logic_call.go index 4643e7e9e..04795152a 100644 --- a/module/x/gravity/keeper/keeper_logic_call.go +++ b/module/x/gravity/keeper/keeper_logic_call.go @@ -166,8 +166,8 @@ func (k Keeper) IterateLogicConfirmsByInvalidationIDAndNonce( // IterateLogicConfirmsByInvalidationIDAndNonce iterates over all logic confirms in the store applying the given // callback on each discovered confirm. // cb should return true to stop iteration, false to continue -func (k Keeper) IterateLogicConfirms(ctx sdk.Context, cb func(key []byte, confirm *types.MsgConfirmLogicCall) (stop bool)) { - prefix := types.KeyOutgoingLogicConfirm +func (k Keeper) IterateLogicConfirms(ctx sdk.Context, evmChainPrefix string, cb func(key []byte, confirm *types.MsgConfirmLogicCall) (stop bool)) { + prefix := types.AppendChainPrefix(types.KeyOutgoingLogicConfirm, evmChainPrefix) k.iterateLogicConfirmsByPrefix(ctx, prefix, cb) } diff --git a/module/x/gravity/keeper/pool.go b/module/x/gravity/keeper/pool.go index 6dd1b2425..8c84342ee 100644 --- a/module/x/gravity/keeper/pool.go +++ b/module/x/gravity/keeper/pool.go @@ -256,8 +256,8 @@ func (k Keeper) IterateUnbatchedTransactionsByContract(ctx sdk.Context, evmChain // IterateUnbatchedTransactions iterates through all unbatched transactions in DESC order, executing the given callback // on each discovered Tx. Return true in cb to stop iteration, false to continue. // For finer grained control, use filterAndIterateUnbatchedTransactions or one of the above methods -func (k Keeper) IterateUnbatchedTransactions(ctx sdk.Context, cb func(key []byte, tx *types.InternalOutgoingTransferTx) (stop bool)) { - k.filterAndIterateUnbatchedTransactions(ctx, types.OutgoingTXPoolKey, cb) +func (k Keeper) IterateUnbatchedTransactions(ctx sdk.Context, evmChainPrefix string, cb func(key []byte, tx *types.InternalOutgoingTransferTx) (stop bool)) { + k.filterAndIterateUnbatchedTransactions(ctx, types.AppendChainPrefix(types.OutgoingTXPoolKey, evmChainPrefix), cb) } // filterAndIterateUnbatchedTransactions iterates through all unbatched transactions whose keys begin with prefixKey in DESC order diff --git a/module/x/gravity/keeper/test_common.go b/module/x/gravity/keeper/test_common.go index 2e1231147..dc93d4946 100644 --- a/module/x/gravity/keeper/test_common.go +++ b/module/x/gravity/keeper/test_common.go @@ -230,7 +230,7 @@ var ( EvmChains = []types.EvmChain{ {EvmChainPrefix: EthChainPrefix, EvmChainName: "Ethereum Mainnet", EvmChainNetVersion: 1}, - {EvmChainPrefix: BscChainPrefix, EvmChainName: "BSC Mainnet", EvmChainNetVersion: 2}, + {EvmChainPrefix: BscChainPrefix, EvmChainName: "BSC Mainnet", EvmChainNetVersion: 56}, } ) diff --git a/module/x/gravity/migrations/v3/store.go b/module/x/gravity/migrations/v3/store.go index 37ab202e4..4cd9477a8 100644 --- a/module/x/gravity/migrations/v3/store.go +++ b/module/x/gravity/migrations/v3/store.go @@ -235,7 +235,6 @@ func migrateLastObservedEvmBlockHeight(ctx sdk.Context, store sdk.KVStore, cdc c } if len(bytes) > 0 { - println("bytes", string(bytes)) cdc.MustUnmarshal(bytes, &height) } if observed && claimHeight > height.EthereumBlockHeight { diff --git a/module/x/gravity/migrations/v4/migrate.go b/module/x/gravity/migrations/v4/migrate.go index d66859795..fefccc399 100644 --- a/module/x/gravity/migrations/v4/migrate.go +++ b/module/x/gravity/migrations/v4/migrate.go @@ -1,8 +1,6 @@ package v4 import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -17,14 +15,15 @@ import ( // // - Set the MonitoredTokenAddresses param to an empty slice func MigrateParams(ctx sdk.Context, paramSpace paramstypes.Subspace, legacySubspace exported.Subspace) types.Params { - ctx.Logger().Info("Pleiades Upgrade part 2: Beginning the migrations for the gravity module") + log := ctx.Logger() + log.Info("Pleiades Upgrade part 2: Beginning the migrations for the gravity module") v3Params := GetParams(ctx, legacySubspace) - fmt.Printf("v3 params: %v\n", v3Params) + log.Info("v3 params:", v3Params) v4Params := V3ToV4Params(v3Params) - fmt.Printf("v4 params: %v\n", v4Params) + log.Info("v4 params:", v4Params) paramSpace.SetParamSet(ctx, &v4Params) - ctx.Logger().Info("Pleiades Upgrade part 2: Finished the migrations for the gravity module successfully!") + log.Info("Pleiades Upgrade part 2: Finished the migrations for the gravity module successfully!") return v4Params } @@ -61,7 +60,7 @@ func V3ToV4Params(v3Params v3.Params) types.Params { EvmChainPrefix: v3.EthereumChainPrefix, GravityId: v3Params.GravityId, ContractSourceHash: v3Params.ContractSourceHash, - BridgeEthereumAddress: v3Params.BridgeEthereumAddress, + BridgeEthereumAddress: "0xb40C364e70bbD98E8aaab707A41a52A2eAF5733f", BridgeChainId: v3Params.BridgeChainId, AverageEthereumBlockTime: v3Params.AverageEthereumBlockTime, BridgeActive: v3Params.BridgeActive, diff --git a/module/x/gravity/migrations/v4/migrate_test.go b/module/x/gravity/migrations/v4/migrate_test.go index f1aaa3517..27c21b9ac 100644 --- a/module/x/gravity/migrations/v4/migrate_test.go +++ b/module/x/gravity/migrations/v4/migrate_test.go @@ -105,7 +105,7 @@ func TestMigrateParams(t *testing.T) { v4Subspace.GetParamSet(ctx, &v4Params) fmt.Printf("v4 params in testing: %v\n", v4Params) - evmChainParam := v4Params.EvmChainParams[0] + evmChainParam := v4Params.GetEvmChain(types.GravityDenomPrefix) require.Equal(t, types.GravityDenomPrefix, evmChainParam.EvmChainPrefix) require.Equal(t, params.AverageEthereumBlockTime, evmChainParam.AverageEthereumBlockTime) require.Equal(t, params.GravityId, evmChainParam.GravityId) diff --git a/module/x/gravity/types/msgs.go b/module/x/gravity/types/msgs.go index dbeffbd10..31058bbca 100644 --- a/module/x/gravity/types/msgs.go +++ b/module/x/gravity/types/msgs.go @@ -497,9 +497,6 @@ func (e *MsgBatchSendToEthClaim) ValidateBasic() error { if e.BatchNonce == 0 { return fmt.Errorf("batch_nonce == 0") } - if e.EvmChainPrefix == "" { - return fmt.Errorf("evm_chain_prefix is empty") - } if err := ValidateEthAddress(e.TokenContract); err != nil { return sdkerrors.Wrap(err, "erc20 token") } @@ -572,9 +569,6 @@ func (e *MsgERC20DeployedClaim) ValidateBasic() error { if e.EventNonce == 0 { return fmt.Errorf("nonce == 0") } - if e.EvmChainPrefix == "" { - return fmt.Errorf("evm_chain_prefix is empty") - } return nil } @@ -639,9 +633,6 @@ func (e *MsgLogicCallExecutedClaim) ValidateBasic() error { if e.EventNonce == 0 { return fmt.Errorf("nonce == 0") } - if e.EvmChainPrefix == "" { - return fmt.Errorf("evm_chain_prefix is empty") - } return nil } @@ -706,9 +697,6 @@ func (e *MsgValsetUpdatedClaim) ValidateBasic() error { if e.EventNonce == 0 { return fmt.Errorf("nonce == 0") } - if e.EvmChainPrefix == "" { - return fmt.Errorf("evm_chain_prefix is empty") - } err := ValidateEthAddress(e.RewardToken) if err != nil { return err diff --git a/module/x/gravity/types/types.pb.go b/module/x/gravity/types/types.pb.go index 8066be1fe..7d2a20d06 100644 --- a/module/x/gravity/types/types.pb.go +++ b/module/x/gravity/types/types.pb.go @@ -409,12 +409,13 @@ var xxx_messageInfo_IBCMetadataProposal proto.InternalMessageInfo // AddEvmChainProposal // this types allows users to add new EVM chain through gov proposal type AddEvmChainProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - EvmChainName string `protobuf:"bytes,3,opt,name=evm_chain_name,json=evmChainName,proto3" json:"evm_chain_name,omitempty"` - EvmChainPrefix string `protobuf:"bytes,4,opt,name=evm_chain_prefix,json=evmChainPrefix,proto3" json:"evm_chain_prefix,omitempty"` - EvmChainNetVersion uint64 `protobuf:"varint,5,opt,name=evm_chain_net_version,json=evmChainNetVersion,proto3" json:"evm_chain_net_version,omitempty"` - GravityId string `protobuf:"bytes,6,opt,name=gravity_id,json=gravityId,proto3" json:"gravity_id,omitempty"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + EvmChainName string `protobuf:"bytes,3,opt,name=evm_chain_name,json=evmChainName,proto3" json:"evm_chain_name,omitempty"` + EvmChainPrefix string `protobuf:"bytes,4,opt,name=evm_chain_prefix,json=evmChainPrefix,proto3" json:"evm_chain_prefix,omitempty"` + EvmChainNetVersion uint64 `protobuf:"varint,5,opt,name=evm_chain_net_version,json=evmChainNetVersion,proto3" json:"evm_chain_net_version,omitempty"` + GravityId string `protobuf:"bytes,6,opt,name=gravity_id,json=gravityId,proto3" json:"gravity_id,omitempty"` + BridgeEthereumAddress string `protobuf:"bytes,7,opt,name=bridge_ethereum_address,json=bridgeEthereumAddress,proto3" json:"bridge_ethereum_address,omitempty"` } func (m *AddEvmChainProposal) Reset() { *m = AddEvmChainProposal{} } @@ -534,61 +535,62 @@ func init() { func init() { proto.RegisterFile("gravity/v1/types.proto", fileDescriptor_163831c23fcc179f) } var fileDescriptor_163831c23fcc179f = []byte{ - // 849 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xf6, 0x26, 0x76, 0x5a, 0xbf, 0x36, 0x4d, 0xd9, 0x24, 0x95, 0xa1, 0xaa, 0x1d, 0x2c, 0x84, - 0xcc, 0xa1, 0xbb, 0xb5, 0xb9, 0x95, 0x43, 0x65, 0x9b, 0x00, 0x91, 0xa0, 0x44, 0x4b, 0x89, 0x04, - 0x97, 0xd5, 0xec, 0xce, 0xdb, 0xf5, 0x28, 0xde, 0x19, 0x6b, 0x76, 0xbc, 0x6d, 0x7f, 0x00, 0x12, - 0x47, 0x8e, 0x1c, 0x73, 0x43, 0xfc, 0x00, 0xfe, 0x43, 0x8f, 0x3d, 0x22, 0x0e, 0x15, 0x4a, 0x2e, - 0x48, 0xfc, 0x06, 0x24, 0x34, 0x1f, 0xeb, 0xb8, 0x21, 0xa7, 0xe6, 0x64, 0xbf, 0xcf, 0xcc, 0x3c, - 0xf3, 0xcc, 0xf3, 0x7e, 0x2c, 0xdc, 0xc9, 0x24, 0x29, 0x99, 0x7a, 0x11, 0x96, 0xc3, 0x50, 0xbd, - 0x58,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0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x15, 0xe8, 0x83, 0xd7, 0x06, 0x00, - 0x00, + // 870 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0x26, 0x4e, 0x52, 0x3f, 0x9b, 0xa6, 0x6c, 0x92, 0x62, 0xa8, 0x6a, 0x07, 0x0b, 0x21, + 0x73, 0xe8, 0x6e, 0x6d, 0x24, 0x0e, 0xe5, 0x50, 0xd9, 0x26, 0x40, 0x24, 0x28, 0xd1, 0x52, 0x22, + 0xc1, 0x65, 0x35, 0xbb, 0xf3, 0xba, 0x1e, 0xc5, 0x3b, 0x63, 0xcd, 0x8e, 0xb7, 0xed, 0x07, 0x40, + 0xe2, 0xc8, 0x91, 0x63, 0x6e, 0x88, 0x0f, 0xd0, 0xef, 0xd0, 0x63, 0x8f, 0x88, 0x43, 0x85, 0x92, + 0x0b, 0x12, 0x5f, 0x02, 0xcd, 0x9f, 0x75, 0x9c, 0xb4, 0x27, 0x72, 0xb2, 0xdf, 0x6f, 0xde, 0xfc, + 0xe6, 0x37, 0xbf, 0x79, 0xef, 0x2d, 0xdc, 0xce, 0x24, 0x29, 0x99, 0x7a, 0x1e, 0x96, 0x83, 0x50, + 0x3d, 0x9f, 0x63, 0x11, 0xcc, 0xa5, 0x50, 0xc2, 0x07, 0x87, 0x07, 0xe5, 0xe0, 0x83, 0x4e, 0x2a, + 0x8a, 0x5c, 0x14, 0x61, 0x42, 0x0a, 0x0c, 0xcb, 0x41, 0x82, 0x8a, 0x0c, 0xc2, 0x54, 0x30, 0x6e, + 0x73, 0x57, 0xd6, 0xf9, 0xc9, 0x72, 0x5d, 0x07, 0x6e, 0x7d, 0x37, 0x13, 0x99, 0x30, 0x7f, 0x43, + 0xfd, 0xcf, 0xa2, 0xbd, 0x08, 0xb6, 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, 0xcb, 0x07, 0x97, 0xe7, 0xe2, 0x95, 0xea, 0x78, 0xe1, 0xc1, 0xde, 0x11, 0x72, 0xca, + 0x78, 0x76, 0x98, 0xa4, 0xa3, 0x85, 0x12, 0x5f, 0x0a, 0xa9, 0xc7, 0x8a, 0x1e, 0xb5, 0x4f, 0x84, + 0x44, 0x96, 0xf1, 0x58, 0x62, 0x8a, 0xac, 0x74, 0xb3, 0xb8, 0x11, 0x6d, 0x3b, 0x3c, 0x72, 0xb0, + 0x1f, 0xc2, 0x86, 0x1d, 0x4c, 0x6b, 0xa6, 0x1e, 0xde, 0xbf, 0xa8, 0x87, 0x02, 0x97, 0xf5, 0x30, + 0x11, 0x8c, 0x47, 0x36, 0xcf, 0xef, 0x42, 0x53, 0x97, 0x40, 0x3a, 0x25, 0x9c, 0xe3, 0xcc, 0x59, + 0x0b, 0x2c, 0x49, 0x27, 0x16, 0xd1, 0x09, 0x58, 0x22, 0xbf, 0xdc, 0xb8, 0x60, 0x20, 0xd3, 0xb7, + 0xe3, 0x1f, 0x5f, 0x9e, 0x75, 0xbc, 0x57, 0x67, 0x1d, 0xef, 0xef, 0xb3, 0x8e, 0xf7, 0xeb, 0x79, + 0xa7, 0xf6, 0xea, 0xbc, 0x53, 0xfb, 0xf3, 0xbc, 0x53, 0xfb, 0xe9, 0xe1, 0xca, 0x88, 0xfd, 0xca, + 0xba, 0x75, 0xcf, 0xce, 0x93, 0xab, 0x61, 0x2e, 0xe8, 0x62, 0x86, 0xe1, 0xb3, 0xb0, 0xfa, 0xee, + 0x99, 0xf9, 0x9b, 0x6c, 0x9a, 0x6f, 0xd2, 0xa7, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x9f, + 0x19, 0xc5, 0x0f, 0x07, 0x00, 0x00, } func (this *UnhaltBridgeProposal) Equal(that interface{}) bool { @@ -702,6 +704,9 @@ func (this *AddEvmChainProposal) Equal(that interface{}) bool { if this.GravityId != that1.GravityId { return false } + if this.BridgeEthereumAddress != that1.BridgeEthereumAddress { + return false + } return true } func (m *BridgeValidator) Marshal() (dAtA []byte, err error) { @@ -1072,6 +1077,13 @@ func (m *AddEvmChainProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BridgeEthereumAddress) > 0 { + i -= len(m.BridgeEthereumAddress) + copy(dAtA[i:], m.BridgeEthereumAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BridgeEthereumAddress))) + i-- + dAtA[i] = 0x3a + } if len(m.GravityId) > 0 { i -= len(m.GravityId) copy(dAtA[i:], m.GravityId) @@ -1367,6 +1379,10 @@ func (m *AddEvmChainProposal) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + l = len(m.BridgeEthereumAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -2731,6 +2747,38 @@ func (m *AddEvmChainProposal) Unmarshal(dAtA []byte) error { } m.GravityId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BridgeEthereumAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BridgeEthereumAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/orchestrator/Dockerfile b/orchestrator/Dockerfile index a69056531..83304b62c 100644 --- a/orchestrator/Dockerfile +++ b/orchestrator/Dockerfile @@ -6,11 +6,6 @@ WORKDIR /workspace COPY . /workspace/ RUN rustup default stable -RUN rustup update && rustup component add clippy rustfmt - -RUN cargo install sccache -# Use sccache. Users can override this variable to disable caching. https://doc.rust-lang.org/cargo/guide/build-cache.html#shared-cache -ENV RUSTC_WRAPPER=sccache RUN cargo build --all CMD [ "cargo run -p gbt -V" ] \ No newline at end of file diff --git a/param-upgrade.json b/param-upgrade.json new file mode 100644 index 000000000..2d9b91ade --- /dev/null +++ b/param-upgrade.json @@ -0,0 +1,33 @@ +{ + "title": "Change evm chain params", + "description": "Change evm chain params", + "changes": [ + { + "subspace": "gravityv2", + "key": "EvmChainParams", + "value": [ + { + "gravity_id": "defaultgravityid", + "bridge_active": true, + "contract_source_hash": "", + "bridge_ethereum_address": "0x0000000000000000000000000000000000000000", + "bridge_chain_id": "0", + "average_ethereum_block_time": "15000", + "ethereum_blacklist": [], + "evm_chain_prefix": "oraib" + }, + { + "gravity_id": "xyzid", + "bridge_active": true, + "contract_source_hash": "", + "bridge_ethereum_address": "0x0000000000000000000000000000000000000000", + "bridge_chain_id": "421", + "average_ethereum_block_time": "15000", + "ethereum_blacklist": [], + "evm_chain_prefix": "foobar" + } + ] + } + ], + "deposit": "10000000uoraib" +} \ No newline at end of file diff --git a/upgrade-tests/docker-compose.yml b/upgrade-tests/docker-compose.yml index 9d61c3a80..cb13bfb1b 100755 --- a/upgrade-tests/docker-compose.yml +++ b/upgrade-tests/docker-compose.yml @@ -8,12 +8,12 @@ services: - VALIDATOR=validator1 - CHAIN_ID=oraibridge-test - GRAVITY_HOME=/workspace/data - - GRAVITY_CONTRACT=0xb40C364e70bbD98E8aaab707A41a52A2eAF5733f # new gravity contract with admin - - ETH_NODE=https://blue-floral-dream.bsc.quiknode.pro/0f52c70efc506a5883efa28d560f944efbbd83d2/ - - TOKEN_CONTRACT=0xA325Ad6D9c92B55A3Fc5aD7e412B1518F96441C0 - ADDRESS_PREFIX=oraib working_dir: /workspace volumes: - ./:/workspace # map first node data to .workspace folder + ports: + - 26657:26657 + - 9090:9090 tty: true diff --git a/upgrade-tests/setup-test.sh b/upgrade-tests/setup-test.sh new file mode 100755 index 000000000..95aff1089 --- /dev/null +++ b/upgrade-tests/setup-test.sh @@ -0,0 +1,92 @@ +#!/bin/bash +set -eux +# your gaiad binary name +BIN=gravity + +CHAIN_ID=${CHAIN_ID:-"gravity-test"} + +ALLOCATION="10000000000uoraib,10000000000000000000000000uairi" + +# first we start a genesis.json with validator 1 +# validator 1 will also collect the gentx's once gnerated +VALIDATOR=${VALIDATOR:-validator1} +ORCHESTRATOR=${ORCHESTRATOR:-orchestrator1} +STARTING_VALIDATOR_HOME="--home $GRAVITY_HOME/$VALIDATOR" + + +# clear previous setup +rm -rf $GRAVITY_HOME/$VALIDATOR/ + +# todo add git hash to chain name +$BIN init $STARTING_VALIDATOR_HOME --chain-id=$CHAIN_ID $VALIDATOR + + +## Modify generated genesis.json to our liking by editing fields using jq +## we could keep a hardcoded genesis file around but that would prevent us from +## testing the generated one with the default values provided by the module. + +# add in denom metadata for both native tokens +jq '.app_state.bank.denom_metadata += [{"name": "ORAIB Token", "symbol": "ORAIB", "base": "oraib", display: "oraib", "description": "A native staking & minting token", "denom_units": [{"denom": "oraib", "exponent": 0}, {"denom": "uoraib", "exponent": 6}, {"denom": "uairi", "exponent": 18}]}]' $GRAVITY_HOME/$VALIDATOR/config/genesis.json > /genesis.json + +# Sets up an arbitrary number of validators on a single machine by manipulating +# the --home parameter on gaiad +NODE_HOME="--home $GRAVITY_HOME/$VALIDATOR" +GENTX_HOME="--home-client $GRAVITY_HOME/$VALIDATOR" +ARGS="$NODE_HOME --keyring-backend test" + +# Generate a validator key, orchestrator key, and eth key for each validator +# it means that data is not empty and there is already keyring-test to run +# can do manually via --recover flags +if ! [ -f "$GRAVITY_HOME/validator-phrases" ]; then + $BIN keys add $ARGS $VALIDATOR 2>> $GRAVITY_HOME/validator-phrases +else + PASS=$(tail -1 $GRAVITY_HOME/validator-phrases) + (echo $PASS; echo $PASS) | $BIN keys add $ARGS $VALIDATOR --recover +fi +if ! [ -f "$GRAVITY_HOME/orchestrator-phrases" ]; then + $BIN keys add $ARGS $ORCHESTRATOR 2>> $GRAVITY_HOME/orchestrator-phrases +else + PASS=$(tail -1 $GRAVITY_HOME/orchestrator-phrases) + (echo $PASS; echo $PASS) | $BIN keys add $ARGS $ORCHESTRATOR --recover +fi +# eth keys maybe existed +if ! [ -f "$GRAVITY_HOME/validator-eth-keys" ]; then + $BIN eth_keys add $ARGS >> $GRAVITY_HOME/validator-eth-keys +else + $BIN eth_keys add $ARGS $(head -1 $GRAVITY_HOME/validator-eth-keys | awk -F': ' 'NR=2{gsub(/^[ \t]+| [ \t]+$/,"");print $2}') +fi + +VALIDATOR_KEY=$($BIN keys show $VALIDATOR -a $ARGS) +ORCHESTRATOR_KEY=$($BIN keys show $ORCHESTRATOR -a $ARGS) +# move the genesis in +mkdir -p $GRAVITY_HOME/$VALIDATOR/config/ +mv /genesis.json $GRAVITY_HOME/$VALIDATOR/config/genesis.json +$BIN add-genesis-account $ARGS $VALIDATOR_KEY $ALLOCATION +$BIN add-genesis-account $ARGS $ORCHESTRATOR_KEY $ALLOCATION +# move the genesis back out +mv $GRAVITY_HOME/$VALIDATOR/config/genesis.json /genesis.json + + +cp /genesis.json $GRAVITY_HOME/$VALIDATOR/config/genesis.json +NODE_HOME="--home $GRAVITY_HOME/$VALIDATOR" +ARGS="$NODE_HOME --keyring-backend test" +ORCHESTRATOR_KEY=$($BIN keys show $ORCHESTRATOR -a $ARGS) +ETHEREUM_KEY=$(grep address $GRAVITY_HOME/validator-eth-keys | sed -n 1p | sed 's/.*://') +# the /8 containing 7.7.7.7 is assigned to the DOD and never routable on the public internet +# we're using it in private to prevent gaia from blacklisting it as unroutable +# and allow local pex +$BIN gentx $ARGS $NODE_HOME --moniker $VALIDATOR --chain-id=$CHAIN_ID --ip 7.7.7.1 $VALIDATOR 500000000uoraib $ETHEREUM_KEY $ORCHESTRATOR_KEY + +$BIN collect-gentxs $STARTING_VALIDATOR_HOME +GENTXS=$(ls $GRAVITY_HOME/$VALIDATOR/config/gentx | wc -l) +cp $GRAVITY_HOME/$VALIDATOR/config/genesis.json /genesis.json +echo "Collected $GENTXS gentx" + +# put the now final genesis.json into the correct folders +cp /genesis.json $GRAVITY_HOME/$VALIDATOR/config/genesis.json + +sed -i "s/enabled-unsafe-cors *= *.*/enabled-unsafe-cors = true/g" $GRAVITY_HOME/$VALIDATOR/config/app.toml +sed -i "s/cors_allowed_origins *= *.*/cors_allowed_origins = \[\"*\"\]/g" $GRAVITY_HOME/$VALIDATOR/config/config.toml +sed -i "1,/\/{s/\ *= *.*/laddr = \"tcp:\/\/0.0.0.0:26657\"/g}" $GRAVITY_HOME/$VALIDATOR/config/config.toml # replace exactly the string laddr with\< and \> + +# gravity tx ibc-transfer transfer transfer channel-0 orai18hr8jggl3xnrutfujy2jwpeu0l76azprlvgrwt 10000000000000000000000uairi --from validator1 --keyring-backend test --chain-id gravity-test -y --home /gravity/data/validator1 \ No newline at end of file