Skip to content

Commit

Permalink
chores: bump deps (#156)
Browse files Browse the repository at this point in the history
* update deps

* update swagger docs

* add forwarding pubkey to sigverify
  • Loading branch information
beer-1 authored Feb 4, 2025
1 parent 07e80e0 commit a84d9df
Show file tree
Hide file tree
Showing 23 changed files with 1,080 additions and 355 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-darwin-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
go-version: "1.23"

- name: Set environment variables
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-darwin-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
go-version: "1.23"
- name: Set environment variables
run: |
MINIWASM_NETWORK_NAME="minievm-1"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-linux-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
go-version: "1.23"

- name: Set environment variables
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.22
go-version: 1.23
- name: Install openssl
run: sudo apt-get install libssl-dev
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ update-swagger-docs: statik
### Protobuf ###
###############################################################################

protoVer=0.15.3
protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MiniEVM is an optimistic rollup consumer chain powered by EVM, designed to simpl

## Prerequisites

- Go v1.22.7+
- Go v1.23.3+
- (optional) [solc-select](https://github.com/crytic/solc-select) v1.0.4+ (used in contractsgen.sh)

## Getting Started
Expand Down
5 changes: 5 additions & 0 deletions app/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (

"github.com/initia-labs/initia/crypto/ethsecp256k1"
evmkeeper "github.com/initia-labs/minievm/x/evm/keeper"

forwardingtypes "github.com/noble-assets/forwarding/v2/types"
)

// SigVerificationDecorator verifies all signatures for a tx and return an error if any are invalid. Note,
Expand Down Expand Up @@ -176,6 +178,9 @@ func DefaultSigVerificationGasConsumer(
}
return nil

case *forwardingtypes.ForwardingPubKey:
return nil

default:
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey)
}
Expand Down
10 changes: 7 additions & 3 deletions app/blocksdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,20 @@ func setupBlockSDK(
app.BaseApp.CheckTx,
)
checkTxHandler := blockchecktx.NewMempoolParityCheckTx(
app.Logger(), mempool,
app.txConfig.TxDecoder(), mevCheckTx.CheckTx(),
app.Logger(),
mempool,
app.txConfig.TxDecoder(),
mevCheckTx.CheckTx(),
app.BaseApp,
)
checkTx := checkTxHandler.CheckTx()

proposalHandler := blockabci.NewProposalHandler(
proposalHandler := blockabci.New(
app.Logger(),
app.txConfig.TxDecoder(),
app.txConfig.TxEncoder(),
mempool,
true,
)

prepareProposalHandler := proposalHandler.PrepareProposalHandler()
Expand Down
6 changes: 3 additions & 3 deletions app/ibc-hooks/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (h EVMHooks) OnRecvPacketOverride(im ibchooks.IBCMiddleware, ctx sdk.Contex
return h.onRecvIcs20Packet(ctx, im, packet, relayer, ics20Data)
}

if isIcs721, ics721Data := isIcs721Packet(packet.GetData(), packet.GetSourcePort()); isIcs721 {
if isIcs721, ics721Data := isIcs721Packet(packet.GetData()); isIcs721 {
return h.onRecvIcs721Packet(ctx, im, packet, relayer, ics721Data)
}

Expand All @@ -58,7 +58,7 @@ func (h EVMHooks) OnAcknowledgementPacketOverride(im ibchooks.IBCMiddleware, ctx
return h.onAckIcs20Packet(ctx, im, packet, acknowledgement, relayer, ics20Data)
}

if isIcs721, ics721Data := isIcs721Packet(packet.GetData(), packet.GetDestPort()); isIcs721 {
if isIcs721, ics721Data := isIcs721Packet(packet.GetData()); isIcs721 {
return h.onAckIcs721Packet(ctx, im, packet, acknowledgement, relayer, ics721Data)
}

Expand All @@ -70,7 +70,7 @@ func (h EVMHooks) OnTimeoutPacketOverride(im ibchooks.IBCMiddleware, ctx sdk.Con
return h.onTimeoutIcs20Packet(ctx, im, packet, relayer, ics20Data)
}

if isIcs721, ics721Data := isIcs721Packet(packet.GetData(), packet.GetDestPort()); isIcs721 {
if isIcs721, ics721Data := isIcs721Packet(packet.GetData()); isIcs721 {
return h.onTimeoutIcs721Packet(ctx, im, packet, relayer, ics721Data)
}

Expand Down
2 changes: 1 addition & 1 deletion app/ibc-hooks/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (h EVMHooks) onRecvIcs721Packet(
//
// If that succeeds, we make the contract call
data.Receiver = intermediateSender
packet.Data = data.GetBytes(packet.SourcePort)
packet.Data = data.GetBytes()

ack := im.App.OnRecvPacket(ctx, packet, relayer)
if !ack.Success() {
Expand Down
94 changes: 0 additions & 94 deletions app/ibc-hooks/receive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,97 +238,3 @@ func Test_onReceivePacket_memo_ICS721(t *testing.T) {
require.NoError(t, err)
require.Equal(t, contractAddr.Bytes(), common.HexToAddress(hexutil.Encode(queryRes)).Bytes())
}

func Test_onReceivePacket_memo_ICS721_Wasm(t *testing.T) {
ctx, input := createDefaultTestInput(t)
_, _, addr := keyPubAddr()

evmAddr := common.BytesToAddress(addr.Bytes())

codeBz, err := hexutil.Decode(counter.CounterBin)
require.NoError(t, err)

_, contractAddr, _, err := input.EVMKeeper.EVMCreate(ctx, evmAddr, codeBz, nil, nil)
require.NoError(t, err)

abi, err := counter.CounterMetaData.GetAbi()
require.NoError(t, err)

inputBz, err := abi.Pack("increase")
require.NoError(t, err)

data := nfttransfertypes.NonFungibleTokenPacketDataWasm{
ClassId: "classId",
ClassUri: "classUri",
ClassData: "classData",
TokenIds: []string{"tokenId"},
TokenUris: []string{"tokenUri"},
TokenData: []string{"tokenData"},
Sender: addr.String(),
Receiver: contractAddr.Hex(),
Memo: fmt.Sprintf(`{
"evm": {
"message": {
"contract_addr": "%s",
"input": "%s"
}
}
}`, contractAddr.Hex(), hexutil.Encode(inputBz)),
}

dataBz, err := json.Marshal(&data)
require.NoError(t, err)

pk := channeltypes.Packet{
SourcePort: "wasm.contract_address",
Data: dataBz,
DestinationPort: "nfttransfer-1",
DestinationChannel: "channel-1",
}

// mint for approval test
localClassId := evm_hooks.LocalClassId(pk, data.ClassId)
intermediateSender := sdk.MustAccAddressFromBech32(evm_hooks.DeriveIntermediateSender(pk.DestinationChannel, data.Sender))
err = input.EVMKeeper.ERC721Keeper().CreateOrUpdateClass(ctx, localClassId, data.ClassUri, data.ClassData)
require.NoError(t, err)
err = input.EVMKeeper.ERC721Keeper().Mints(
ctx,
intermediateSender,
localClassId,
[]string{"tokenId"},
[]string{"tokenUri"},
[]string{"tokenData"},
)
require.NoError(t, err)

// failed to due to acl
ack := input.IBCHooksMiddleware.OnRecvPacket(ctx, pk, addr)
require.False(t, ack.Success())

// set acl
require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr[:], true))

// success
ack = input.IBCHooksMiddleware.OnRecvPacket(ctx, pk, addr)
require.True(t, ack.Success())

queryInputBz, err := abi.Pack("count")
require.NoError(t, err)

// check the contract state
queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil)
require.NoError(t, err)
require.Equal(t, uint256.NewInt(1).Bytes32(), [32]byte(queryRes))
require.Empty(t, logs)

// check allowance
tokenId, ok := evmtypes.TokenIdToBigInt(localClassId, data.TokenIds[0])
require.True(t, ok)
erc721Addr, err := input.EVMKeeper.GetContractAddrByClassId(ctx, localClassId)
require.NoError(t, err)
queryInputBz, err = input.EVMKeeper.ERC721Keeper().GetERC721ABI().Pack("getApproved", tokenId)
require.NoError(t, err)
queryRes, err = input.EVMKeeper.EVMStaticCall(ctx, evmtypes.StdAddress, erc721Addr, queryInputBz, nil)
require.NoError(t, err)
require.Equal(t, contractAddr.Bytes(), common.HexToAddress(hexutil.Encode(queryRes)).Bytes())
}
4 changes: 2 additions & 2 deletions app/ibc-hooks/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func isIcs20Packet(packetData []byte) (isIcs20 bool, ics20data transfertypes.Fun
return true, data
}

func isIcs721Packet(packetData []byte, counterPartyPort string) (isIcs721 bool, ics721data nfttransfertypes.NonFungibleTokenPacketData) {
if data, err := nfttransfertypes.DecodePacketData(packetData, counterPartyPort); err != nil {
func isIcs721Packet(packetData []byte) (isIcs721 bool, ics721data nfttransfertypes.NonFungibleTokenPacketData) {
if data, err := nfttransfertypes.DecodePacketData(packetData); err != nil {
return false, data
} else {
return true, data
Expand Down
8 changes: 4 additions & 4 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ import (
evmtypes "github.com/initia-labs/minievm/x/evm/types"

// noble forwarding keeper
forwarding "github.com/noble-assets/forwarding/v2/x/forwarding"
forwardingkeeper "github.com/noble-assets/forwarding/v2/x/forwarding/keeper"
forwardingtypes "github.com/noble-assets/forwarding/v2/x/forwarding/types"
forwarding "github.com/noble-assets/forwarding/v2"
forwardingkeeper "github.com/noble-assets/forwarding/v2/keeper"
forwardingtypes "github.com/noble-assets/forwarding/v2/types"
)

type AppKeepers struct {
Expand Down Expand Up @@ -309,7 +309,7 @@ func NewAppKeeper(
)

// Set IBC post handler to receive validator set updates
appKeepers.IBCKeeper.ClientKeeper.WithPostUpdateHandler(
appKeepers.IBCKeeper.ClientKeeper.SetPostUpdateHandler(
appKeepers.OPChildKeeper.UpdateHostValidatorSet,
)

Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

// noble forwarding keeper
forwardingtypes "github.com/noble-assets/forwarding/v2/x/forwarding/types"
forwardingtypes "github.com/noble-assets/forwarding/v2/types"

// local imports
evmtypes "github.com/initia-labs/minievm/x/evm/types"
Expand Down
4 changes: 2 additions & 2 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ import (
evmtypes "github.com/initia-labs/minievm/x/evm/types"

// noble forwarding keeper
forwarding "github.com/noble-assets/forwarding/v2/x/forwarding"
forwardingtypes "github.com/noble-assets/forwarding/v2/x/forwarding/types"
forwarding "github.com/noble-assets/forwarding/v2"
forwardingtypes "github.com/noble-assets/forwarding/v2/types"
)

// module account permissions
Expand Down
2 changes: 1 addition & 1 deletion app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
opchildtypes "github.com/initia-labs/OPinit/x/opchild/types"
)

const upgradeName = "0.6.10"
const upgradeName = "0.7.0"

// RegisterUpgradeHandlers returns upgrade handlers
func (app *MinitiaApp) RegisterUpgradeHandlers(cfg module.Configurator) {
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit a84d9df

Please sign in to comment.