Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker ics20 hooks #1678

Merged
merged 83 commits into from
Oct 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
dd0caa8
Add Osmosis IBC-Hooks Initial port
iramiller Aug 23, 2023
9c55d4e
ibchooks lint fixes
iramiller Aug 23, 2023
4026d29
lint fixes and depguard config for golang-ci lint
iramiller Aug 23, 2023
f5d73fa
Remove import comments
iramiller Aug 23, 2023
a57bd20
wip/adding testing system
iramiller Aug 25, 2023
a0c416a
clean up tests
iramiller Aug 25, 2023
660414e
fix wasm keeper hooks wiring
iramiller Aug 25, 2023
85b72ba
add basic simulation wiring to ibchooks
iramiller Aug 25, 2023
8062e3e
set default ibchooks params in upgrade
iramiller Aug 25, 2023
5f6a150
remove unused golangci-lint linters
iramiller Aug 25, 2023
c16c977
lint work
iramiller Aug 25, 2023
157e795
protection for quotes in quoted json
iramiller Aug 25, 2023
bdbe9c8
changelog
iramiller Aug 25, 2023
a3dc938
temporary fix for invalid simulation handling for staking denom
iramiller Aug 28, 2023
7a3ce3b
Merge branch 'main' into add-ibc-hooks
iramiller Aug 28, 2023
2855900
restore supply increase proposal simulation for valid markers
iramiller Aug 28, 2023
4457e50
use calculated temporary supply increase
iramiller Aug 28, 2023
fc22b2d
wip: build fix
iramiller Aug 28, 2023
a36cae8
Further proposal disabling for marker supply tests
iramiller Aug 28, 2023
d3596e6
switch to reference contracts from embedded wasm
iramiller Aug 29, 2023
bbdc065
Merge branch 'main' into add-ibc-hooks
iramiller Sep 7, 2023
7f9ce7d
Merge remote-tracking branch 'origin/add-ibc-hooks' into nullpointer0…
nullpointer0x00 Sep 11, 2023
3627379
start hook entry point file, start marker hooks file
nullpointer0x00 Sep 11, 2023
73349df
refactor structure to allow for ics20 marker hook calls
nullpointer0x00 Sep 11, 2023
3c2a722
do lint-fix
nullpointer0x00 Sep 11, 2023
ceaa2e0
fix mock's lint
nullpointer0x00 Sep 11, 2023
2fda225
fix more lint issues
nullpointer0x00 Sep 11, 2023
e672c29
add marker send packet override
nullpointer0x00 Sep 12, 2023
b4b1567
update marker hooks logic
nullpointer0x00 Sep 12, 2023
f2377c3
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
nullpointer0x00 Sep 12, 2023
59089cc
add some more logic flow
nullpointer0x00 Sep 12, 2023
fc3c96b
check if denom is not from source chain to do marker mutations
nullpointer0x00 Sep 12, 2023
b515822
do not try and create marker if denom is from source
nullpointer0x00 Sep 12, 2023
98fdfe1
fix lint issues with imports
nullpointer0x00 Sep 12, 2023
2cbdb6b
update test
nullpointer0x00 Sep 12, 2023
aec1d73
test fix json
nullpointer0x00 Sep 13, 2023
203654b
test json change
nullpointer0x00 Sep 13, 2023
d2645b8
move marker memo struct to types
nullpointer0x00 Sep 13, 2023
be12a87
move wasm structs to type... still needs some reworking to correct json
nullpointer0x00 Sep 13, 2023
ab59ed2
refactor json structs, add tests, add constructors
nullpointer0x00 Sep 13, 2023
467d753
comment one test case for now. Test needs fixing not implementation
nullpointer0x00 Sep 13, 2023
a080f7e
add send packet functions
nullpointer0x00 Sep 14, 2023
ca120a9
add map for processing after SendPacket
nullpointer0x00 Sep 14, 2023
43e693a
move memo processing on the receiver, process transfer auths in memo
nullpointer0x00 Sep 14, 2023
506d357
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
nullpointer0x00 Sep 15, 2023
9e2bd03
finalize creating remote marker and transfer permissions, decided if …
nullpointer0x00 Sep 15, 2023
107a7bf
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
nullpointer0x00 Sep 15, 2023
709fe2b
add chain id and denom meta data
nullpointer0x00 Sep 15, 2023
fc0bd2a
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
nullpointer0x00 Sep 27, 2023
45c8bef
add callback data to post send processing, refactor packet bytes orde…
nullpointer0x00 Sep 27, 2023
5d762e4
add new marker error type, emit error on acknowledgement if error pro…
nullpointer0x00 Sep 28, 2023
e0819ff
add error handling for reset marker access grants
nullpointer0x00 Sep 28, 2023
0e73b49
remove unused bank keeper from constructor of maker hooks
nullpointer0x00 Sep 28, 2023
5a72f4d
remove unused parameter from get chain id
nullpointer0x00 Sep 28, 2023
8bcfdba
rename variables
nullpointer0x00 Sep 28, 2023
1d92901
remove unused variable from memo processing
nullpointer0x00 Sep 28, 2023
43e4d96
refactor send processing fn parameters
nullpointer0x00 Sep 28, 2023
a7382b2
add call back validation checks in wasm processing function, various …
nullpointer0x00 Sep 28, 2023
acee23c
add start to maker hooks tests, remove todo comment
nullpointer0x00 Sep 28, 2023
71ed550
add happy path test for ProcessMarkerMemo
nullpointer0x00 Sep 28, 2023
7adca36
refactor way memo creation and processing works, refactor method name…
nullpointer0x00 Oct 4, 2023
dea432c
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
nullpointer0x00 Oct 4, 2023
027eb71
complete process marker memo tests
nullpointer0x00 Oct 4, 2023
bdbe888
finish reset permissions tests
nullpointer0x00 Oct 4, 2023
9d55659
add more tests
nullpointer0x00 Oct 5, 2023
df21e7a
rename pre send data processing functions
nullpointer0x00 Oct 5, 2023
067405d
add pre send packet data processing test for marker hooks
nullpointer0x00 Oct 5, 2023
584d94f
refactor processing loop
nullpointer0x00 Oct 5, 2023
175712e
review PR and add updates to method comments and refactor function name
nullpointer0x00 Oct 6, 2023
3d666ce
more refactors
nullpointer0x00 Oct 6, 2023
c6311b0
add change log
nullpointer0x00 Oct 6, 2023
c3b1bb9
fix method comments
nullpointer0x00 Oct 9, 2023
69a3c1c
add test
nullpointer0x00 Oct 9, 2023
e561486
change logic flow
nullpointer0x00 Oct 9, 2023
673eb20
refactor AddUpdateMarker flow
nullpointer0x00 Oct 9, 2023
26dec33
fix lint
nullpointer0x00 Oct 9, 2023
423a1da
rename method
nullpointer0x00 Oct 10, 2023
65331a3
update tests
nullpointer0x00 Oct 10, 2023
f282b90
change codeID
nullpointer0x00 Oct 10, 2023
dea154d
add allow force transfer flag
nullpointer0x00 Oct 10, 2023
abf05bc
extract updating of auth-transfers and allow force transfer into own …
nullpointer0x00 Oct 10, 2023
f72c362
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
nullpointer0x00 Oct 10, 2023
e37ddef
Merge branch 'main' into nullpointer0x00/1127-marker-ibs20-hooks
iramiller Oct 10, 2023
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
Prev Previous commit
Next Next commit
lint work
iramiller committed Aug 25, 2023
commit c16c977acab855da2a7e711da2bf2f1ae6220a4c
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -112,6 +112,7 @@ linters-settings:
- github.com/spf13/viper

- github.com/stretchr/testify/require # used by the test-utils shared toolkit
- github.com/stretchr/testify/suite

- github.com/tendermint/tendermint
- github.com/tendermint/tm-db
8 changes: 3 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -102,7 +102,6 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ica "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper"
@@ -118,11 +117,7 @@ import (
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"

ibctestingtypes "github.com/cosmos/ibc-go/v6/testing/types"
ibchooks "github.com/provenance-io/provenance/x/ibchooks"
ibchookskeeper "github.com/provenance-io/provenance/x/ibchooks/keeper"
ibchookstypes "github.com/provenance-io/provenance/x/ibchooks/types"

appparams "github.com/provenance-io/provenance/app/params"
"github.com/provenance-io/provenance/internal/antewrapper"
@@ -134,6 +129,9 @@ import (
attributekeeper "github.com/provenance-io/provenance/x/attribute/keeper"
attributetypes "github.com/provenance-io/provenance/x/attribute/types"
attributewasm "github.com/provenance-io/provenance/x/attribute/wasm"
ibchooks "github.com/provenance-io/provenance/x/ibchooks"
ibchookskeeper "github.com/provenance-io/provenance/x/ibchooks/keeper"
ibchookstypes "github.com/provenance-io/provenance/x/ibchooks/types"
"github.com/provenance-io/provenance/x/marker"
markerkeeper "github.com/provenance-io/provenance/x/marker/keeper"
markertypes "github.com/provenance-io/provenance/x/marker/types"
10 changes: 3 additions & 7 deletions testutil/ibctesting.go
Original file line number Diff line number Diff line change
@@ -3,23 +3,19 @@ package testutil
import (
"encoding/json"
"testing"
"time"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
ibctesting "github.com/cosmos/ibc-go/v6/testing"
"github.com/cosmos/ibc-go/v6/testing/simapp/helpers"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

provenanceapp "github.com/provenance-io/provenance/app"
)

var (
globalStartTime = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)
)

type TestChain struct {
*ibctesting.TestChain
}
@@ -65,7 +61,7 @@ func (chain *TestChain) SendMsgsNoCheck(msgs ...sdk.Msg) (*sdk.Result, error) {
// SignAndDeliver signs and delivers a transaction without asserting the results. This overrides the function
// from ibctesting
func SignAndDeliver(
txCfg client.TxConfig, app *baseapp.BaseApp, header tmproto.Header, msgs []sdk.Msg,
txCfg client.TxConfig, app *baseapp.BaseApp, _ tmproto.Header, msgs []sdk.Msg,
chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {
tx, _ := helpers.GenTx(
4 changes: 2 additions & 2 deletions testutil/wasm.go
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ import (

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/stretchr/testify/suite"

sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/stretchr/testify/suite"
)

func (chain *TestChain) StoreContractCodeDirect(suite *suite.Suite, path string) uint64 {
6 changes: 3 additions & 3 deletions x/ibchooks/module.go
Original file line number Diff line number Diff line change
@@ -170,15 +170,15 @@ func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.Weight
}

// RandomizedParams creates randomized name param changes for the simulator.
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{}
}

// RegisterStoreDecoder registers a decoder for name module's types
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {}

// WeightedOperations returns the all the gov module operations with their respective weights.
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
return []simtypes.WeightedOperation{}
}

1 change: 0 additions & 1 deletion x/ibchooks/simulation/genesis.go
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ import (

// RandomizedGenState generates a random GenesisState for ibchooks
func RandomizedGenState(simState *module.SimulationState) {

ibcHooksGenesis := types.DefaultGenesis()

bz, err := json.MarshalIndent(ibcHooksGenesis, "", " ")
7 changes: 3 additions & 4 deletions x/ibchooks/wasm_hook.go
Original file line number Diff line number Diff line change
@@ -247,7 +247,7 @@ func (h WasmHooks) SendPacketOverride(
timeoutHeight clienttypes.Height,
timeoutTimestamp uint64,
data []byte,
) (sequence uint64, err error) {
) (uint64, error) {
var ics20Packet transfertypes.FungibleTokenPacketData
if err := json.Unmarshal(data, &ics20Packet); err != nil {
return i.channel.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) // continue
@@ -292,8 +292,7 @@ func (h WasmHooks) SendPacketOverride(
return seq, nil
}

_, err = sdktypes.AccAddressFromBech32(contract)
if err != nil {
if _, err := sdktypes.AccAddressFromBech32(contract); err != nil {
return seq, nil
}

@@ -336,7 +335,7 @@ func (h WasmHooks) OnAcknowledgementPacketOverride(im IBCMiddleware, ctx sdktype
}

sudoMsg := []byte(fmt.Sprintf(
`{"ibc_lifecycle_complete": {"ibc_ack": {"channel": "%s", "sequence": %d, "ack": %s, "success": %s}}}`,
`{"ibc_lifecycle_complete": {"ibc_ack": {"channel": "%q", "sequence": %d, "ack": %s, "success": %s}}}`,
packet.SourceChannel, packet.Sequence, ack, success))
_, err = h.ContractKeeper.Sudo(ctx, contractAddr, sudoMsg)
if err != nil {