diff --git a/Makefile b/Makefile index 7b09c74d9..d55ccfce9 100644 --- a/Makefile +++ b/Makefile @@ -201,9 +201,10 @@ init-golang-rly: kill-dev install @echo "Initializing relayer..." ./network/relayer/interchain-acc-config/rly.sh -start: - @echo "Starting up test network" - ./network/start.sh +start: kill-dev install + @echo "Starting up neutrond alone..." + BINARY=neutrond CHAINID=test-1 P2PPORT=26656 RPCPORT=26657 RESTPORT=1317 ROSETTA=8080 GRPCPORT=8090 GRPCWEB=8091 STAKEDENOM=untrn \ + ./network/init.sh && ./network/init-neutrond.sh && ./network/start.sh start-rly: ./network/hermes/start.sh diff --git a/contracts/cwd_core.wasm b/contracts/cwd_core.wasm index 9c17fcec0..2410b53c1 100644 Binary files a/contracts/cwd_core.wasm and b/contracts/cwd_core.wasm differ diff --git a/contracts/cwd_pre_propose_multiple.wasm b/contracts/cwd_pre_propose_multiple.wasm index 815a08594..3d19cb3bc 100644 Binary files a/contracts/cwd_pre_propose_multiple.wasm and b/contracts/cwd_pre_propose_multiple.wasm differ diff --git a/contracts/cwd_pre_propose_overrule.wasm b/contracts/cwd_pre_propose_overrule.wasm index 14acbc9c7..c1e48d638 100644 Binary files a/contracts/cwd_pre_propose_overrule.wasm and b/contracts/cwd_pre_propose_overrule.wasm differ diff --git a/contracts/cwd_pre_propose_single.wasm b/contracts/cwd_pre_propose_single.wasm index c26e45851..08f6b7e07 100644 Binary files a/contracts/cwd_pre_propose_single.wasm and b/contracts/cwd_pre_propose_single.wasm differ diff --git a/contracts/cwd_proposal_multiple.wasm b/contracts/cwd_proposal_multiple.wasm old mode 100644 new mode 100755 index efdc0e332..95849bc30 Binary files a/contracts/cwd_proposal_multiple.wasm and b/contracts/cwd_proposal_multiple.wasm differ diff --git a/contracts/cwd_proposal_single.wasm b/contracts/cwd_proposal_single.wasm index 5e586b146..2dfc53d15 100644 Binary files a/contracts/cwd_proposal_single.wasm and b/contracts/cwd_proposal_single.wasm differ diff --git a/contracts/cwd_subdao_core.wasm b/contracts/cwd_subdao_core.wasm index 7dd3dedf6..ad92e965e 100644 Binary files a/contracts/cwd_subdao_core.wasm and b/contracts/cwd_subdao_core.wasm differ diff --git a/contracts/cwd_subdao_pre_propose_single.wasm b/contracts/cwd_subdao_pre_propose_single.wasm index 2eee11227..6e5ea5458 100644 Binary files a/contracts/cwd_subdao_pre_propose_single.wasm and b/contracts/cwd_subdao_pre_propose_single.wasm differ diff --git a/contracts/cwd_subdao_proposal_single.wasm b/contracts/cwd_subdao_proposal_single.wasm index 263d8edb7..fa62c5520 100644 Binary files a/contracts/cwd_subdao_proposal_single.wasm and b/contracts/cwd_subdao_proposal_single.wasm differ diff --git a/contracts/cwd_subdao_timelock_single.wasm b/contracts/cwd_subdao_timelock_single.wasm index 109e46165..95cf71452 100644 Binary files a/contracts/cwd_subdao_timelock_single.wasm and b/contracts/cwd_subdao_timelock_single.wasm differ diff --git a/contracts/lockdrop_vault.wasm b/contracts/lockdrop_vault.wasm index 09bca3809..641755b1e 100644 Binary files a/contracts/lockdrop_vault.wasm and b/contracts/lockdrop_vault.wasm differ diff --git a/contracts/neutron_reserve.wasm b/contracts/neutron_reserve.wasm index a39c49d57..2e853ef82 100644 Binary files a/contracts/neutron_reserve.wasm and b/contracts/neutron_reserve.wasm differ diff --git a/contracts/neutron_vault.wasm b/contracts/neutron_vault.wasm index 3a591df32..7220d240f 100644 Binary files a/contracts/neutron_vault.wasm and b/contracts/neutron_vault.wasm differ diff --git a/contracts/neutron_voting_registry.wasm b/contracts/neutron_voting_registry.wasm index 1a5966d92..bcbfdcfc5 100644 Binary files a/contracts/neutron_voting_registry.wasm and b/contracts/neutron_voting_registry.wasm differ diff --git a/go.mod b/go.mod index 8e980a1b8..676406d08 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/neutron-org/neutron go 1.18 require ( - github.com/CosmWasm/wasmd v0.30.0 - github.com/CosmWasm/wasmvm v1.1.1 + github.com/CosmWasm/wasmd v0.31.0 + github.com/CosmWasm/wasmvm v1.2.1 github.com/armon/go-metrics v0.4.1 github.com/confio/ics23/go v0.9.0 github.com/cosmos/admin-module v0.0.0-00010101000000-000000000000 @@ -155,7 +155,7 @@ require ( ) replace ( - github.com/CosmWasm/wasmd v0.30.0 => github.com/neutron-org/wasmd v0.30.0-ics-removed-genesis-checks + github.com/CosmWasm/wasmd v0.31.0 => github.com/neutron-org/wasmd v0.31.0-neutron-fixes github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.2 github.com/cosmos/admin-module => github.com/Ethernal-Tech/admin-module v0.0.0-20221102105340-e693f4d379c3 github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.45.15-ics diff --git a/go.sum b/go.sum index 80590fa1c..832e28c92 100644 --- a/go.sum +++ b/go.sum @@ -504,8 +504,8 @@ github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3 github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= -github.com/CosmWasm/wasmvm v1.1.1 h1:0xtdrmmsP9fibe+x42WcMkp5aQ738BICgcH3FNVLzm4= -github.com/CosmWasm/wasmvm v1.1.1/go.mod h1:ei0xpvomwSdONsxDuONzV7bL1jSET1M8brEx0FCXc+A= +github.com/CosmWasm/wasmvm v1.2.1 h1:si0tRsRDdUShV0k51Wn6zRKlmj3/WWP9Yr4cLmDTf+8= +github.com/CosmWasm/wasmvm v1.2.1/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -998,7 +998,7 @@ github.com/cosmos/ibc-go v1.2.2/go.mod h1:XmYjsRFOs6Q9Cz+CSsX21icNoH27vQKb3squgn github.com/cosmos/ibc-go/v3 v3.0.0/go.mod h1:Mb+1NXiPOLd+CPFlOC6BKeAUaxXlhuWenMmRiUiSmwY= github.com/cosmos/ibc-go/v4 v4.3.0 h1:yOzVsyZzsv4XPBux8gq+D0LhZn45yGWKjvT+6Vyo5no= github.com/cosmos/ibc-go/v4 v4.3.0/go.mod h1:CcLvIoi9NNtIbNsxs4KjBGjYhlwqtsmXy1AKARKiMzQ= -github.com/cosmos/interchain-accounts v0.2.4 h1:7UrroFQsCRSp17980mk6anx4YteveIJVkU+a0wlsHQI= +github.com/cosmos/interchain-accounts v0.2.6 h1:TV2M2g1/Rb9MCNw1YePdBKE0rcEczNj1RGHT+2iRYas= github.com/cosmos/interchain-security v1.2.0 h1:DHC00F3diTXDBgTgLSB+O8qbs1p7DtTfUeO8XBEXsZo= github.com/cosmos/interchain-security v1.2.0/go.mod h1:Y4onDsQuqkemGS7UqfyohahlBLt5gh1i8OVbPeMcuhA= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= @@ -2145,8 +2145,8 @@ github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/networkplumbing/go-nft v0.2.0/go.mod h1:HnnM+tYvlGAsMU7yoYwXEVLLiDW9gdMmb5HoGcwpuQs= -github.com/neutron-org/wasmd v0.30.0-ics-removed-genesis-checks h1:YWDWEHobuZMMipP0rTItE/uN4Xs75GLQK1CKrgfn6ss= -github.com/neutron-org/wasmd v0.30.0-ics-removed-genesis-checks/go.mod h1:umLGeYyowAMMEdOYfDOf8jsDrQ75Qkm1+ogBXT/w01c= +github.com/neutron-org/wasmd v0.31.0-neutron-fixes h1:XvxPbxdtfWl/uH6eeZkN6FmfZbySjsToM6lIR/umNUE= +github.com/neutron-org/wasmd v0.31.0-neutron-fixes/go.mod h1:VcyDGk/ISVlMUeW+1GGL0zdHWBS2FPwLEV2qZ86l7l8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/exhaustive v0.8.3/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= diff --git a/network/init-neutrond.sh b/network/init-neutrond.sh index 352fb0d1e..b8400499c 100755 --- a/network/init-neutrond.sh +++ b/network/init-neutrond.sh @@ -21,7 +21,6 @@ PROPOSAL_MULTIPLE_CONTRACT=$CONTRACTS_BINARIES_DIR/cwd_proposal_multiple.wasm VOTING_REGISTRY_CONTRACT=$CONTRACTS_BINARIES_DIR/neutron_voting_registry.wasm # VAULTS NEUTRON_VAULT_CONTRACT=$CONTRACTS_BINARIES_DIR/neutron_vault.wasm -LOCKDROP_VAULT_CONTRACT=$CONTRACTS_BINARIES_DIR/lockdrop_vault.wasm # TREASURY RESERVE_CONTRACT=$CONTRACTS_BINARIES_DIR/neutron_reserve.wasm DISTRIBUTION_CONTRACT=$CONTRACTS_BINARIES_DIR/neutron_distribution.wasm @@ -105,11 +104,6 @@ DAO_VOTING_REGISTRY_LABEL="neutron voting registry" NEUTRON_VAULT_NAME="voting vault" NEUTRON_VAULT_DESCRIPTION="simple voting vault for testing purposes" - -## Lockdrop vault -LOCKDROP_VAULT_NAME="lockdrop vault" -LOCKDROP_VAULT_DESCRIPTION="simple voting vault for testing purposes" - ## Basic vault NEUTRON_VAULT_NAME="voting vault" NEUTRON_VAULT_DESCRIPTION="simple voting vault for testing purposes" @@ -128,12 +122,11 @@ GRANTS_SUBDAO_VOTING_MODULE_LABEL="grants voting module" GRANTS_SUBDAO_PROPOSAL_LABEL="grants single proposal" ## Timelock -GRANTS_SUBDAO_TIMELOCK_DURATION=1200 GRANTS_SUBDAO_TIMELOCK_LABEL="subDAO timelock contract" ## Security subdao -SECURITY_SUBDAO_CORE_LABEL="neutron grants subdao" -SECURITY_SUBDAO_CORE_NAME="GRANTS" +SECURITY_SUBDAO_CORE_LABEL="neutron security subdao" +SECURITY_SUBDAO_CORE_NAME="SECURITY" SECURITY_SUBDAO_CORE_DESCRIPTION="subdao that secures neutron" SECURITY_SUBDAO_PROPOSAL_LABEL="security subdao single proposal" SECURITY_SUBDAO_PREPROPOSAL_LABEL="security prerpopose" @@ -160,7 +153,6 @@ PROPOSAL_MULTIPLE_CONTRACT_BINARY_ID=$(store_binary "$PROPOSAL_MULTIPLE_CONT VOTING_REGISTRY_CONTRACT_BINARY_ID=$(store_binary "$VOTING_REGISTRY_CONTRACT") # VAULTS NEUTRON_VAULT_CONTRACT_BINARY_ID=$(store_binary "$NEUTRON_VAULT_CONTRACT") -LOCKDROP_VAULT_CONTRACT_BINARY_ID=$(store_binary "$LOCKDROP_VAULT_CONTRACT") # TREASURY & RESERVE TREASURY_CONTRACT_BINARY_ID=$(store_binary "$TREASURY_CONTRACT") DISTRIBUTION_CONTRACT_BINARY_ID=$(store_binary "$DISTRIBUTION_CONTRACT") @@ -184,7 +176,6 @@ INSTANCE_ID_COUNTER=1 # VAULTS NEUTRON_VAULT_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$NEUTRON_VAULT_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) -LOCKDROP_VAULT_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$LOCKDROP_VAULT_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) # MAIN_DAO DAO_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$DAO_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) @@ -202,8 +193,8 @@ DISTRIBUTION_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTAN TREASURY_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$TREASURY_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) # SUBDAOS SECURITY_SUBDAO_CORE_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$SUBDAO_CORE_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) -SECURITY_SUBDAO_PRE_PROPOSE_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$PRE_PROPOSAL_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) SECURITY_SUBDAO_PROPOSAL_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$SUBDAO_PROPOSAL_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) +SECURITY_SUBDAO_PRE_PROPOSE_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$SUBDAO_PROPOSAL_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) SECURITY_SUBDAO_VOTING_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$CW4_VOTING_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) SECURITY_SUBDAO_GROUP_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$CW4_GROUP_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) GRANTS_SUBDAO_CORE_CONTRACT_ADDRESS=$($BINARY debug generate-contract-address "$INSTANCE_ID_COUNTER" "$SUBDAO_CORE_BINARY_ID") && (( INSTANCE_ID_COUNTER++ )) @@ -341,8 +332,7 @@ VOTING_REGISTRY_INIT_MSG='{ } }, "voting_vaults": [ - "'"$NEUTRON_VAULT_CONTRACT_ADDRESS"'", - "'"$LOCKDROP_VAULT_CONTRACT_ADDRESS"'" + "'"$NEUTRON_VAULT_CONTRACT_ADDRESS"'" ] }' VOTING_REGISTRY_INIT_MSG_BASE64=$(echo "$VOTING_REGISTRY_INIT_MSG" | base64 | tr -d "\n") @@ -423,18 +413,6 @@ NEUTRON_VAULT_INIT='{ "description": "'"$NEUTRON_VAULT_DESCRIPTION"'" }' -# since the lockdrop_contract is still a mock, the address is a random valid one just to pass instantiation TODO: get rid of mock -LOCKDROP_VAULT_INIT='{ - "owner": { - "address": { - "addr": "'"$ADMIN_ADDRESS"'" - } - }, - "name": "'"$LOCKDROP_VAULT_NAME"'", - "description": "'"$LOCKDROP_VAULT_DESCRIPTION"'", - "lockdrop_contract": "neutron17zayzl5d0daqa89csvv8kqayxzke6jd6zh00tq" -}' - # CW4 MODULES FOR SUBDAOS CW4_VOTE_INIT_MSG='{ @@ -519,7 +497,7 @@ SECURITY_SUBDAO_CORE_INIT_MSG='{ # GRANTS_SUBDAO GRANTS_SUBDAO_TIMELOCK_INIT_MSG='{ - "timelock_duration": '"$GRANTS_SUBDAO_TIMELOCK_DURATION"' + "overrule_pre_propose": "'"$PROPOSAL_OVERRULE_CONTRACT_ADDRESS"'" }' GRANTS_SUBDAO_TIMELOCK_INIT_MSG_BASE64=$(echo "$GRANTS_SUBDAO_TIMELOCK_INIT_MSG" | base64 | tr -d "\n") @@ -603,7 +581,6 @@ echo "Instantiate contracts" # It affects the section of predicting contracts addresses at the beginning of the script # If you're to do any changes, please do it consistently in both sections $BINARY add-wasm-message instantiate-contract "$NEUTRON_VAULT_CONTRACT_BINARY_ID" "$NEUTRON_VAULT_INIT" --label "DAO_Neutron_voting_vault" --run-as "$ADMIN_ADDRESS" --admin "$DAO_CONTRACT_ADDRESS" --home "$CHAIN_DIR" -$BINARY add-wasm-message instantiate-contract "$LOCKDROP_VAULT_CONTRACT_BINARY_ID" "$LOCKDROP_VAULT_INIT" --label "DAO_Neutron_lockdrop_vault" --run-as "$ADMIN_ADDRESS" --admin "$DAO_CONTRACT_ADDRESS" --home "$CHAIN_DIR" $BINARY add-wasm-message instantiate-contract "$DAO_CONTRACT_BINARY_ID" "$DAO_INIT" --label "DAO" --run-as "$ADMIN_ADDRESS" --admin "$DAO_CONTRACT_ADDRESS" --home "$CHAIN_DIR" $BINARY add-wasm-message instantiate-contract "$RESERVE_CONTRACT_BINARY_ID" "$RESERVE_INIT" --label "Reserve" --run-as "$ADMIN_ADDRESS" --admin "$DAO_CONTRACT_ADDRESS" --home "$CHAIN_DIR" $BINARY add-wasm-message instantiate-contract "$DISTRIBUTION_CONTRACT_BINARY_ID" "$DISTRIBUTION_INIT" --label "Distribution" --run-as "$ADMIN_ADDRESS" --admin "$DAO_CONTRACT_ADDRESS" --home "$CHAIN_DIR" diff --git a/x/interchaintxs/keeper/ibc_handlers.go b/x/interchaintxs/keeper/ibc_handlers.go index a3c680d20..7644b0447 100644 --- a/x/interchaintxs/keeper/ibc_handlers.go +++ b/x/interchaintxs/keeper/ibc_handlers.go @@ -78,6 +78,8 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack cacheCtx, writeFn, newGasMeter := k.createCachedContext(ctx) defer k.outOfGasRecovery(ctx, newGasMeter, icaOwner.GetContract(), packet, "ack") + k.feeKeeper.DistributeAcknowledgementFee(ctx, relayer, feetypes.NewPacketID(packet.SourcePort, packet.SourceChannel, packet.Sequence)) + // Actually we have only one kind of error returned from acknowledgement // maybe later we'll retrieve actual errors from events errorText := ack.GetError() @@ -87,8 +89,6 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack _, err = k.contractManagerKeeper.SudoResponse(cacheCtx, icaOwner.GetContract(), packet, ack.GetResult()) } - k.feeKeeper.DistributeAcknowledgementFee(ctx, relayer, feetypes.NewPacketID(packet.SourcePort, packet.SourceChannel, packet.Sequence)) - if err != nil { k.contractManagerKeeper.AddContractFailure(ctx, packet.SourceChannel, icaOwner.GetContract().String(), packet.GetSequence(), "ack") k.Logger(ctx).Debug("HandleAcknowledgement: failed to Sudo contract on packet acknowledgement", "error", err) @@ -117,6 +117,8 @@ func (k *Keeper) HandleTimeout(ctx sdk.Context, packet channeltypes.Packet, rela cacheCtx, writeFn, newGasMeter := k.createCachedContext(ctx) defer k.outOfGasRecovery(ctx, newGasMeter, icaOwner.GetContract(), packet, "timeout") + k.feeKeeper.DistributeTimeoutFee(ctx, relayer, feetypes.NewPacketID(packet.SourcePort, packet.SourceChannel, packet.Sequence)) + _, err = k.contractManagerKeeper.SudoTimeout(cacheCtx, icaOwner.GetContract(), packet) if err != nil { k.contractManagerKeeper.AddContractFailure(ctx, packet.SourceChannel, icaOwner.GetContract().String(), packet.GetSequence(), "timeout") @@ -125,7 +127,6 @@ func (k *Keeper) HandleTimeout(ctx sdk.Context, packet channeltypes.Packet, rela writeFn() } - k.feeKeeper.DistributeTimeoutFee(ctx, relayer, feetypes.NewPacketID(packet.SourcePort, packet.SourceChannel, packet.Sequence)) ctx.GasMeter().ConsumeGas(newGasMeter.GasConsumed(), "consume from cached context") return nil diff --git a/x/interchaintxs/keeper/ibc_handlers_test.go b/x/interchaintxs/keeper/ibc_handlers_test.go index d755a8b30..8781189c1 100644 --- a/x/interchaintxs/keeper/ibc_handlers_test.go +++ b/x/interchaintxs/keeper/ibc_handlers_test.go @@ -8,13 +8,14 @@ import ( icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/neutron-org/neutron/testutil" testkeeper "github.com/neutron-org/neutron/testutil/interchaintxs/keeper" mock_types "github.com/neutron-org/neutron/testutil/mocks/interchaintxs/types" "github.com/neutron-org/neutron/x/contractmanager/types" feetypes "github.com/neutron-org/neutron/x/feerefunder/types" "github.com/neutron-org/neutron/x/interchaintxs/keeper" - "github.com/stretchr/testify/require" ) func TestHandleAcknowledgement(t *testing.T) { @@ -78,7 +79,7 @@ func TestHandleAcknowledgement(t *testing.T) { ctx.GasMeter().ConsumeGas(ctx.GasMeter().Limit()+1, "out of gas test") }).Return(nil, fmt.Errorf("SudoError error")) cmKeeper.EXPECT().AddContractFailure(ctx, "channel-0", contractAddress.String(), p.GetSequence(), "ack") - // feeKeeper.EXPECT().DistributeAcknowledgementFee(ctx, relayerAddress, feetypes.NewPacketID(p.SourcePort, p.SourceChannel, p.Sequence)) + feeKeeper.EXPECT().DistributeAcknowledgementFee(ctx, relayerAddress, feetypes.NewPacketID(p.SourcePort, p.SourceChannel, p.Sequence)) err = icak.HandleAcknowledgement(ctx, p, errAckData, relayerAddress) require.NoError(t, err) @@ -104,7 +105,7 @@ func TestHandleAcknowledgement(t *testing.T) { cmKeeper.EXPECT().SudoResponse(gomock.AssignableToTypeOf(lowGasCtx), contractAddress, p, resACK.GetResult()).Do(func(cachedCtx sdk.Context, senderAddress sdk.AccAddress, request channeltypes.Packet, msg []byte) { cachedCtx.GasMeter().ConsumeGas(1, "Sudo response consumption") }).Return(nil, nil) - // feeKeeper.EXPECT().DistributeAcknowledgementFee(lowGasCtx, relayerAddress, feetypes.NewPacketID(p.SourcePort, p.SourceChannel, p.Sequence)) + feeKeeper.EXPECT().DistributeAcknowledgementFee(lowGasCtx, relayerAddress, feetypes.NewPacketID(p.SourcePort, p.SourceChannel, p.Sequence)) cmKeeper.EXPECT().AddContractFailure(lowGasCtx, "channel-0", contractAddress.String(), p.GetSequence(), "ack").Do(func(ctx sdk.Context, channelId string, address string, ackID uint64, ackType string) { ctx.GasMeter().ConsumeGas(keeper.GasReserve, "out of gas") }) @@ -157,7 +158,7 @@ func TestHandleTimeout(t *testing.T) { ctx.GasMeter().ConsumeGas(ctx.GasMeter().Limit()+1, "out of gas test") }).Return(nil, fmt.Errorf("SudoTimeout error")) cmKeeper.EXPECT().AddContractFailure(ctx, "channel-0", contractAddress.String(), p.GetSequence(), "timeout") - // feeKeeper.EXPECT().DistributeTimeoutFee(ctx, relayerAddress, feetypes.NewPacketID(p.SourcePort, p.SourceChannel, p.Sequence)) + feeKeeper.EXPECT().DistributeTimeoutFee(ctx, relayerAddress, feetypes.NewPacketID(p.SourcePort, p.SourceChannel, p.Sequence)) err = icak.HandleTimeout(ctx, p, relayerAddress) require.NoError(t, err) }