-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from notional-labs/transfer_middleware
Transfer middleware
- Loading branch information
Showing
88 changed files
with
12,689 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Interchain Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-start-cosmos-chain: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.19 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- run: make ictest-start-cosmos | ||
|
||
test-start-polkadot-chain: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.19 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- run: make ictest-start-polkadot | ||
|
||
test-ibc-transfer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.19 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- run: make ictest-ibc | ||
|
||
test-push-wasm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.19 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- run: make ictest-push-wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package helpers | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
dbm "github.com/cometbft/cometbft-db" | ||
abci "github.com/cometbft/cometbft/abci/types" | ||
"github.com/cometbft/cometbft/libs/log" | ||
tmrand "github.com/cometbft/cometbft/libs/rand" | ||
abcitypes1 "github.com/cometbft/cometbft/proto/tendermint/types" | ||
tmproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
tmtypes "github.com/cometbft/cometbft/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
banksy "github.com/notional-labs/banksy/v2/app" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// SimAppChainID hardcoded chainID for simulation | ||
const ( | ||
SimAppChainID = "fee-app" | ||
) | ||
|
||
// DefaultConsensusParams defines the default Tendermint consensus params used | ||
// in feeapp testing. | ||
var DefaultConsensusParams = &abcitypes1.ConsensusParams{ | ||
Block: &abcitypes1.BlockParams{ | ||
MaxBytes: 200000, | ||
MaxGas: 2000000, | ||
}, | ||
Evidence: &tmproto.EvidenceParams{ | ||
MaxAgeNumBlocks: 302400, | ||
MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration | ||
MaxBytes: 10000, | ||
}, | ||
Validator: &tmproto.ValidatorParams{ | ||
PubKeyTypes: []string{ | ||
tmtypes.ABCIPubKeyTypeEd25519, | ||
}, | ||
}, | ||
} | ||
|
||
type EmptyAppOptions struct{} | ||
|
||
func (EmptyAppOptions) Get(o string) interface{} { return nil } | ||
|
||
func NewContextForApp(app banksy.BanksyApp) sdk.Context { | ||
ctx := app.BaseApp.NewContext(false, tmproto.Header{ | ||
ChainID: fmt.Sprintf("test-chain-%s", tmrand.Str(4)), | ||
Height: 1, | ||
}) | ||
return ctx | ||
} | ||
|
||
func Setup(t *testing.T, isCheckTx bool, invCheckPeriod uint) *banksy.BanksyApp { | ||
t.Helper() | ||
|
||
app, genesisState := setup(!isCheckTx, invCheckPeriod) | ||
if !isCheckTx { | ||
// InitChain must be called to stop deliverState from being nil | ||
stateBytes, err := json.MarshalIndent(genesisState, "", " ") | ||
require.NoError(t, err) | ||
|
||
// Initialize the chain | ||
app.InitChain( | ||
abci.RequestInitChain{ | ||
Validators: []abci.ValidatorUpdate{}, | ||
ConsensusParams: DefaultConsensusParams, | ||
AppStateBytes: stateBytes, | ||
}, | ||
) | ||
} | ||
|
||
return app | ||
} | ||
|
||
func setup(withGenesis bool, invCheckPeriod uint) (*banksy.BanksyApp, banksy.GenesisState) { | ||
db := dbm.NewMemDB() | ||
encCdc := banksy.MakeEncodingConfig() | ||
app := banksy.NewBanksyApp( | ||
log.NewNopLogger(), | ||
db, | ||
nil, | ||
true, | ||
map[int64]bool{}, | ||
banksy.DefaultNodeHome, | ||
invCheckPeriod, | ||
encCdc, | ||
EmptyAppOptions{}, | ||
) | ||
if withGenesis { | ||
return app, banksy.NewDefaultGenesisState() | ||
} | ||
|
||
return app, banksy.GenesisState{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# testing package for ibc | ||
Customized version of cosmos-sdk x/ibc/testing and CosmWasm wasmd x/wasm/ibctesting |
Oops, something went wrong.