Skip to content
Merged
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
7 changes: 4 additions & 3 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Unit tests + lints

on:
push:
pull_request:
types: [opened]

name: Unit tests + lints

jobs:
test:
name: Test Suite
Expand All @@ -27,6 +27,7 @@ jobs:
with:
command: test


lints:
name: Lints
runs-on: ubuntu-latest
Expand All @@ -52,4 +53,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests -- -D warnings
args: --tests -- -D warnings
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ packages/injective-test-tube/libinjectivetesttube/injective-test-tube

.idea

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

members = [ "packages/*" ]
resolver = "2"

[workspace.dependencies]
ed25519-zebra = { version = "4.1.0", features = ["alloc"] }
23 changes: 14 additions & 9 deletions packages/injective-test-tube/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@ edition = "2021"
license = "MIT OR Apache-2.0"
name = "injective-test-tube"
repository = "https://github.com/InjectiveLabs/test-tube"
version = "1.16.0-beta.3"
version = "1.16.3-1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

exclude = [ "injective-core", "test_artifacts" ]

[dependencies]
cosmrs = { version = "0.20.0", features = [ "cosmwasm", "rpc" ] }
cosmwasm-std = { version = "2.1.0", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] }
injective-cosmwasm = { version = "0.3.0" }
injective-std = { version = "=1.16.0-beta.2" }
prost = { version = "0.13.4", features = [ "prost-derive" ] }
cosmrs = { version = "0.22.0", features = [ "cosmwasm", "rpc" ] }
cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] }
injective-cosmwasm = { version = "0.3.4-1" }
injective-std = { version = "=1.16.3-1" }
prost = { version = "0.13.5", features = [ "derive" ] }
serde = "1.0.144"
serde_json = "1.0.85"
test-tube-inj = { version = "2.0.6" }
serde_json = "1.0.140"
test-tube-inj = { version = "2.0.8-1", path = "../test-tube" }



[build-dependencies]
ed25519-zebra = { workspace = true }
bindgen = "0.60.1"



[dev-dependencies]
cw1-whitelist = "1.1.2"
cw1-whitelist = "2.0.0"
50 changes: 25 additions & 25 deletions packages/injective-test-tube/libinjectivetesttube/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,7 @@ require (
cloud.google.com/go/iam v1.2.2 // indirect
cloud.google.com/go/monitoring v1.21.2 // indirect
cloud.google.com/go/storage v1.49.0 // indirect
cosmossdk.io/api v0.7.6 // indirect
cosmossdk.io/client/v2 v2.0.0-beta.3 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 // indirect
cosmossdk.io/depinject v1.1.0 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/store v1.1.1 // indirect
cosmossdk.io/x/evidence v0.1.1 // indirect
cosmossdk.io/x/feegrant v0.1.1 // indirect
cosmossdk.io/x/tx v0.13.8 // indirect
cosmossdk.io/x/upgrade v0.1.4 // indirect
github.com/CosmWasm/wasmvm/v2 v2.1.5 // indirect
github.com/DataDog/appsec-internal-go v1.5.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 // indirect
Expand All @@ -75,14 +64,12 @@ require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 // indirect
github.com/InjectiveLabs/metrics v0.0.10 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bits-and-blooms/bitset v1.22.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
github.com/cockroachdb/pebble v1.1.4 // indirect
Expand All @@ -93,9 +80,6 @@ require (
github.com/consensys/bavard v0.1.30 // indirect
github.com/consensys/gnark-crypto v0.17.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 // indirect
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20240116210548-bd2492192d72 // indirect
github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
Expand Down Expand Up @@ -131,8 +115,6 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.5 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
Expand Down Expand Up @@ -162,15 +144,13 @@ require (
github.com/pion/transport/v2 v2.2.1 // indirect
github.com/pion/transport/v3 v3.0.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/prometheus/client_golang v1.21.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
github.com/shamaton/msgpack/v2 v2.2.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/skip-mev/block-sdk/v2 v2.0.0-00010101000000-000000000000 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
Expand All @@ -194,33 +174,45 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/api v0.220.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
gopkg.in/DataDog/dd-trace-go.v1 v1.62.0 // indirect
gotest.tools/v3 v3.5.1 // indirect
pgregory.net/rapid v1.1.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

require (
cosmossdk.io/api v0.7.6 // indirect
cosmossdk.io/client/v2 v2.0.0-beta.3 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/store v1.1.1 // indirect
cosmossdk.io/x/evidence v0.1.1 // indirect
cosmossdk.io/x/feegrant v0.1.1 // indirect
cosmossdk.io/x/tx v0.13.8 // indirect
cosmossdk.io/x/upgrade v0.1.4 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/CosmWasm/wasmvm/v2 v2.1.5 // indirect
github.com/DataDog/datadog-go/v5 v5.3.0 // indirect
github.com/InjectiveLabs/metrics v0.0.10 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/alexcesaro/statsd v2.0.0+incompatible // indirect
github.com/aws/aws-sdk-go v1.44.327 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/iavl v1.2.2 // indirect
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 // indirect
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20240116210548-bd2492192d72 // indirect
github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect
github.com/cosmos/ledger-cosmos-go v0.14.0 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand All @@ -244,6 +236,8 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
Expand All @@ -264,23 +258,29 @@ require (
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.21.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/skip-mev/block-sdk/v2 v2.0.0-00010101000000-000000000000 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6v0d // indirect
github.com/zondax/hid v0.9.2 // indirect
go.etcd.io/bbolt v1.4.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
gopkg.in/DataDog/dd-trace-go.v1 v1.62.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace (
Expand All @@ -297,7 +297,7 @@ replace (

github.com/CosmWasm/wasmd => github.com/InjectiveLabs/wasmd v0.53.3-evm-comet1-inj

github.com/InjectiveLabs/injective-core => github.com/InjectiveFoundation/injective-core v1.16.0-beta.3
github.com/InjectiveLabs/injective-core => github.com/InjectiveFoundation/injective-core v1.16.3
github.com/bandprotocol/bandchain-packet => github.com/InjectiveLabs/bandchain-packet v0.0.4-inj-1
github.com/coder/websocket => github.com/InjectiveLabs/websocket v1.8.13

Expand Down
4 changes: 2 additions & 2 deletions packages/injective-test-tube/libinjectivetesttube/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.1/go.mod h1:0wEl7vrAD8mehJyohS9HZy+WyEOaQO2mJx86Cvh93kM=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 h1:8nn+rsCvTq9axyEh382S0PFLBeaFwNsT43IrPWzctRU=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1/go.mod h1:viRWSEhtMZqz1rhwmOVKkWl6SwmVowfL9O2YR5gI2PE=
github.com/InjectiveFoundation/injective-core v1.16.0-beta.3 h1:qbtKCAOxROoxMz6+GL6oXDM+nxMedzagqzZ3ZaY9m8w=
github.com/InjectiveFoundation/injective-core v1.16.0-beta.3/go.mod h1:crcXyBcea0FNONjKgoB8uOn/380GSgIG8AuaqpHAnn8=
github.com/InjectiveFoundation/injective-core v1.16.3 h1:2wPgixa9v+0083fgKzj0a6AUFuGDef9NjVWlf71ohew=
github.com/InjectiveFoundation/injective-core v1.16.3/go.mod h1:efxLTquSZZOUyTY2uBBALp4v/IPMMDshE1n5NWxeKAU=
github.com/InjectiveLabs/bandchain-packet v0.0.4-inj-1 h1:ZnvCV/lzjWmBwuGbkAz+okucfJEyEzkU9GYK3tKU9cU=
github.com/InjectiveLabs/bandchain-packet v0.0.4-inj-1/go.mod h1:QELTDYiwnbAqIgTF9zeKr+hVlK6eVyt6Nxmh6/1mmzQ=
github.com/InjectiveLabs/block-sdk/v2 v2.5.1-evm-comet1-inj h1:Xuj3uLi8bwghHC7ydo8BhZBf6wZcM/rt569xIRXGod4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,20 @@ func InitChain(appInstance *app.InjectiveApp) (sdk.Context, secp256k1.PrivKey) {
// replace sdk.DefaultDenom with "inj", a bit of a hack, needs improvement
stateBytes = []byte(strings.Replace(string(stateBytes), "\"stake\"", "\"inj\"", -1))

now := time.Now().UTC()

_, err = appInstance.InitChain(
&abci.InitChainRequest{
ChainId: "injective-777",
Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes,
Time: now,
},
)
requireNoErr(err)

ctx := appInstance.NewUncachedContext(false, cmtproto.Header{Height: 0, ChainID: "injective-777", Time: time.Now().UTC()})
ctx := appInstance.NewUncachedContext(false, cmtproto.Header{Height: 0, ChainID: "injective-777", Time:now})

return ctx, valPriv
}
Expand Down
63 changes: 60 additions & 3 deletions packages/injective-test-tube/src/module/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ where

#[cfg(test)]
mod tests {
use crate::{Auction, InjectiveTestApp};
use injective_std::types::{
cosmos::base::v1beta1::Coin as BaseCoin,
injective::auction::v1beta1::{
LastAuctionResult, Params, QueryAuctionParamsRequest, QueryLastAuctionResultRequest,
LastAuctionResult, Params, QueryAuctionParamsRequest, QueryCurrentAuctionBasketRequest,
QueryLastAuctionResultRequest,
},
};

use crate::{Auction, InjectiveTestApp};
use test_tube_inj::Module;

#[test]
Expand Down Expand Up @@ -83,5 +83,62 @@ mod tests {
round: 0u64,
}
);

let block_time_sec = app.get_block_time_seconds() as u64;

let basket_res = auction
.query_current_auction_basket(&QueryCurrentAuctionBasketRequest {})
.expect("query_current_auction_basket should succeed");

let closing_time = basket_res.auction_closing_time;
let round = basket_res.auction_round;
let highest_bid = basket_res.highest_bid_amount.clone();
let highest_bidder = basket_res.highest_bidder.clone();

assert_eq!(round, 0, "Round should be 0");
println!(
"[check] round={}, closing_time={}, highest_bidder={}, highest_bid_amount={}",
round, closing_time, highest_bidder, highest_bid
);

assert!(closing_time > 0, "closing_time should be positive");
assert!(
closing_time > block_time_sec,
"closing_time ({}) should be bigger than block_time_sec ({})",
closing_time,
block_time_sec
);

app.increase_time(1);

let basket_response_after_increase = auction
.query_current_auction_basket(&QueryCurrentAuctionBasketRequest {})
.expect("query_current_auction_basket should succeed (after)");

assert_eq!(
basket_response_after_increase.auction_round, round,
"Round should not change"
);

assert_eq!(
basket_response_after_increase.auction_closing_time,
closing_time,
);

app.increase_time(closing_time - block_time_sec + 1);

let basket_response_after_increase = auction
.query_current_auction_basket(&QueryCurrentAuctionBasketRequest {})
.expect("query_current_auction_basket should succeed (after)");

assert!(
basket_response_after_increase.auction_round > round,
"Round should increase"
);

assert!(
basket_response_after_increase.auction_closing_time > closing_time,
"Closing time should increase"
);
}
}
18 changes: 8 additions & 10 deletions packages/test-tube/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ edition = "2021"
license = "MIT OR Apache-2.0"
name = "test-tube-inj"
repository = "https://github.com/InjectiveLabs/test-tube"
version = "2.0.7"
version = "2.0.8-1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = "0.21.5"
cosmrs = { version = "0.20.0", features = [ "cosmwasm", "rpc" ] }
cosmwasm-std = { version = "2.1.0", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] }
prost = "0.13.4"
serde_json = "1.0.85"
thiserror = "1.0.34"
ed25519-zebra = { version = "4.1.0", features = ["alloc"] }
base64 = { version = "0.21.7" }
cosmrs = { version = "0.22.0", features = ["cosmwasm", "rpc"] }
cosmwasm-std = { version = "2.2.2", features = ["abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate"] }
prost = { version = "0.13.5", features = ["derive"] }
serde_json = { version = "1.0.140" }
thiserror = { version = "1.0.69" }

[dev-dependencies]
cw1-whitelist = "0.15.0"
rayon = "1.5.3"
Loading