Skip to content
Closed
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
20 changes: 15 additions & 5 deletions app/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"context"
"time"

"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/sei-protocol/sei-chain/utils/metrics"
abci "github.com/tendermint/tendermint/abci/types"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)

func (app *App) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) {
Expand All @@ -34,11 +36,19 @@ func (app *App) CheckTx(ctx context.Context, req *abci.RequestCheckTx) (*abci.Re

func (app *App) DeliverTx(ctx sdk.Context, req abci.RequestDeliverTx) abci.ResponseDeliverTx {
defer metrics.MeasureDeliverTxDuration(time.Now())
tracectx, span := (*app.tracingInfo.Tracer).Start(app.tracingInfo.TracerContext, "DeliverTx")
oldCtx := app.tracingInfo.TracerContext
app.tracingInfo.TracerContext = tracectx
defer span.End()
defer func() { app.tracingInfo.TracerContext = oldCtx }()
var span trace.Span
ctx = ctx.WithContext(
context.WithValue(
context.WithValue(
ctx.Context(), baseapp.RunTxPreHookKey, func() {
_, span = (*app.tracingInfo.Tracer).Start(app.tracingInfo.TracerContext, "DeliverTx")
},
),
baseapp.RunTxPostHookKey, func() {
span.End()
},
),
)
return app.BaseApp.DeliverTx(ctx, req)
}

Expand Down
6 changes: 2 additions & 4 deletions app/antedecorators/depdecorators/signers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
utils "github.com/sei-protocol/sei-chain/aclmapping/utils"
)

type SignerDepDecorator struct {
Expand All @@ -27,8 +25,8 @@ func (d SignerDepDecorator) AnteDeps(txDeps []sdkacltypes.AccessOperation, tx sd
for _, signer := range sigTx.GetSigners() {
txDeps = append(txDeps, sdkacltypes.AccessOperation{
AccessType: accessType,
ResourceType: sdkacltypes.ResourceType_KV,
IdentifierTemplate: utils.GetPrefixedIdentifierTemplatePerModule(utils.ACCOUNT, signer.String(), string(authtypes.AddressStoreKeyPrefix)),
ResourceType: sdkacltypes.ResourceType_KV_ACC,
IdentifierTemplate: signer.String(),
})
}
return next(txDeps, tx)
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,5 +1318,5 @@ func (app *App) decorateContextWithDexMemState(base context.Context) context.Con

func init() {
// override max wasm size to 1MB
wasmtypes.MaxWasmSize = 1024 * 1024
wasmtypes.MaxWasmSize = 2048 * 1024
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.176
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.191
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sei-protocol/sei-cosmos v0.1.176 h1:6UgAcryRx6C+UlouHDjxuY7T7hj3nck91QoeppyPdLc=
github.com/sei-protocol/sei-cosmos v0.1.176/go.mod h1:8ccWQxpBkWbpvBos/T4QO9K9gQxFs0duTqKRnagKo+0=
github.com/sei-protocol/sei-cosmos v0.1.191 h1:VMFNA/vxI2HZBLinop0Y/Xq6wSd5NCae7UtdoR5LCQk=
github.com/sei-protocol/sei-cosmos v0.1.191/go.mod h1:8ccWQxpBkWbpvBos/T4QO9K9gQxFs0duTqKRnagKo+0=
github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y=
github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
Expand Down
24 changes: 6 additions & 18 deletions loadtest/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"batch_size": 10,
"chain_id": "sei-loadtest-testnet",
"orders_per_block": 400,
"batch_size": 1,
"chain_id": "sei-chain",
"orders_per_block": 16,
"rounds": 5,
"price_distribution": {
"min": "45",
Expand All @@ -17,23 +17,11 @@
"limit_order_percentage": "0.2",
"market_order_percentage": "0.8"
},
"message_type": "basic",
"message_type": "wasm",
"contract_distribution": [
{
"contract_address": "sei1yw4xvtc43me9scqfr2jr2gzvcxd3a9y4eq7gaukreugw2yd2f8tsy4qgdm",
"percentage": "0.25"
},
{
"contract_address": "sei1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtq05fpn3",
"percentage": "0.25"
},
{
"contract_address": "sei1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3scwfwpd",
"percentage": "0.25"
},
{
"contract_address": "sei1zwv6feuzhy6a9wekh96cd57lsarmqlwxdypdsplw6zhfncqw6ftqr428wx",
"percentage": "0.25"
"contract_address": "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m",
"percentage": "1"
}
]
}
58 changes: 58 additions & 0 deletions loadtest/contracts/deploy_simple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
echo -n Admin Key Name:
read keyname
echo
echo -n Chain ID:
read chainid
echo
echo -n seid binary:
read seidbin
echo
echo -n sei-chain directory:
read seihome
echo
echo -n contract count:
read count
echo

# Build all contracts
echo "Building contracts..."

cd $seihome/loadtest/contracts/simpleexec && cargo build --release --target wasm32-unknown-unknown

# Deploy all contracts
echo "Deploying contracts..."

cd $seihome/loadtest/contracts

valaddr=$(printf "12345678\n" | $seidbin keys show $(printf "12345678\n" | $seidbin keys show node_admin --output json | jq -r .address) --bech=val --output json | jq -r '.address')
sres=$(printf "12345678\n" | $seidbin tx staking delegate $valaddr 1000000000usei --from=$keyname --chain-id=$chainid -b block -y --fees 2000usei)

echo '{"title":"enable wasm","description":"enable wasm","message_dependency_mapping":[{"message_key":"cosmwasm.wasm.v1.MsgExecuteContract","access_ops":[{"access_type":"UNKNOWN","resource_type":"ANY","identifier_template":"*"},{"access_type":"COMMIT","resource_type":"ANY","identifier_template":"*"}],"dynamic_enabled": true}]}' > resource.json
res=$(printf "12345678\n" | $seidbin tx accesscontrol update-resource-dependency-mapping resource.json -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block --output=json)
proposalid=$(python3 parser.py proposal_id $res)
dres=$(printf "12345678\n" | $seidbin tx gov deposit $proposalid 10000000usei -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block)
vres=$(printf "12345678\n" | $seidbin tx gov vote $proposalid yes -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block)
for (( c=1; c<=$count; c++ ))
do
# store
storeres=$(printf "12345678\n" | $seidbin tx wasm store simpleexec/target/wasm32-unknown-unknown/release/simpleexec.wasm -y --from=$keyname --chain-id=$chainid --gas=50000000 --fees=1000000usei --broadcast-mode=block --output=json)
id=$(python3 parser.py code_id $storeres)

# instantiate
insres=$(printf "12345678\n" | $seidbin tx wasm instantiate $id '{}' -y --no-admin --from=$keyname --chain-id=$chainid --gas=5000000 --fees=1000000usei --broadcast-mode=block --label=dex --output=json)
addr=$(python3 parser.py contract_address $insres)

rm -f wasm.json
echo '{"title":"enable wasm '$addr'","description":"enable wasm '$addr'","contract_address":"'$addr'","wasm_dependency_mapping":{"enabled":true,"access_ops":[{"access_type":"WRITE","resource_type":"KV_WASM","identifier_template":"'$addr'"},{"access_type":"COMMIT","resource_type":"ANY","identifier_template":"*"}]}}' > wasm.json
res=$(printf "12345678\n" | $seidbin tx accesscontrol update-wasm-dependency-mapping wasm.json -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block --output=json)
proposalid=$(python3 parser.py proposal_id $res)
dres=$(printf "12345678\n" | $seidbin tx gov deposit $proposalid 10000000usei -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block)
vres=$(printf "12345678\n" | $seidbin tx gov vote $proposalid yes -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block)

echo $addr
done

sleep 90

ures=$(printf "12345678\n" | $seidbin tx staking unbond $valaddr 1000000000usei --from=$keyname --chain-id=$chainid -b block -y --fees 2000usei)
Loading