Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
all:

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.91 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.17.0-beta --depth 1 --single-branch

clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.16.4 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.17.0-beta.3 --depth 1 --single-branch

copy-exchange-client: clone-injective-indexer
rm -rf exchange/*
Expand Down Expand Up @@ -166,9 +166,9 @@ copy-chain-types: clone-injective-core
make extract-message-names

extract-message-names:
@echo "Extracting message names from tx.pb.go files..."
@echo "Extracting message names from tx.pb.go and msgs.pb.go files..."
@mkdir -p injective_data
@find ./chain -name "tx.pb.go" -exec grep -h "proto\.RegisterType" {} \; | \
@find ./chain \( -name "tx.pb.go" -o -name "msgs.pb.go" \) -exec grep -h "proto\.RegisterType" {} \; | \
sed -n 's/.*proto\.RegisterType([^"]*"\([^"]*\)".*/\1/p' | \
grep -v 'Response$$' | \
sort -u | \
Expand Down
4 changes: 2 additions & 2 deletions chain/evm/precompiles/bank/fixed_supply_bank_erc20.abigen.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chain/evm/precompiles/bank/i_bank_module.abigen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chain/evm/precompiles/bank/mint_burn_bank_erc20.abigen.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chain/evm/precompiles/staking/i_staking_module.abigen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions chain/evm/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

errorsmod "cosmossdk.io/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand Down Expand Up @@ -111,6 +112,11 @@ var (
ErrConfigOverrides = errorsmod.Register(ModuleName, codeErrConfigOverrides, "failed to apply state override")
)

var (
// RevertSelector is selector of ErrExecutionReverted
RevertSelector = crypto.Keccak256([]byte("Error(string)"))[:4]
)

// VMError is an interface that represents a reverted or failed EVM execution.
// The Ret() method returns the revert reason bytes associated with the error, if any.
// The Cause() method returns the unwrapped error. For ABCIInfo integration.
Expand Down Expand Up @@ -289,3 +295,19 @@ func (e *RevertError) ErrorCode() int {
func (e *RevertError) ErrorData() interface{} {
return e.reason
}

// RevertReasonBytes converts a message to ABI-encoded revert bytes.
func RevertReasonBytes(reason string) ([]byte, error) {
typ, err := abi.NewType("string", "", nil)
if err != nil {
return nil, err
}
packed, err := (abi.Arguments{{Type: typ}}).Pack(reason)
if err != nil {
return nil, err
}
bz := make([]byte, 0, len(RevertSelector)+len(packed))
bz = append(bz, RevertSelector...)
bz = append(bz, packed...)
return bz, nil
}
4 changes: 4 additions & 0 deletions chain/exchange/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgDeposit{}, "exchange/MsgDeposit", nil)
cdc.RegisterConcrete(&MsgWithdraw{}, "exchange/MsgWithdraw", nil)
cdc.RegisterConcrete(&MsgInstantSpotMarketLaunch{}, "exchange/MsgInstantSpotMarketLaunch", nil)
cdc.RegisterConcrete(&MsgInstantPerpetualMarketLaunch{}, "exchange/MsgInstantPerpetualMarketLaunch", nil)
cdc.RegisterConcrete(&MsgInstantExpiryFuturesMarketLaunch{}, "exchange/MsgInstantExpiryFuturesMarketLaunch", nil)
cdc.RegisterConcrete(&MsgCreateSpotLimitOrder{}, "exchange/MsgCreateSpotLimitOrder", nil)
cdc.RegisterConcrete(&MsgBatchCreateSpotLimitOrders{}, "exchange/MsgBatchCreateSpotLimitOrders", nil)
cdc.RegisterConcrete(&MsgCreateSpotMarketOrder{}, "exchange/MsgCreateSpotMarketOrder", nil)
Expand Down Expand Up @@ -85,6 +87,8 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgDeposit{},
&MsgWithdraw{},
&MsgInstantSpotMarketLaunch{},
&MsgInstantPerpetualMarketLaunch{},
&MsgInstantExpiryFuturesMarketLaunch{},
&MsgCreateSpotLimitOrder{},
&MsgBatchCreateSpotLimitOrders{},
&MsgCreateSpotMarketOrder{},
Expand Down
Loading