-
Notifications
You must be signed in to change notification settings - Fork 57
New guide: Use Hyperlane TIA as gas token #390
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
Changes from all commits
cdcfbe3
24466e1
be20109
74fa448
83263e9
156eca3
c9e9d5e
858c18e
1926617
618d8b1
bd9d324
21f1849
490e23c
c83407c
a7d62d2
2081b77
7d4bea0
6bea20e
57bbca5
4409030
6cd1b0a
0b64a70
5281aa7
2304fac
6eb4d4e
6abd3da
37dae50
d1dba44
361f0d2
d10b656
e02cc63
19e6314
2595b31
433895e
f11f5a8
703c5bd
378cac1
ba59eb1
9a24e04
ae005cb
1475c63
f16675c
8b56608
a32d907
7fe15dc
f147201
fc838fa
5563886
c949a26
409d6b8
0faa152
17225e4
ed43b1e
f30f71e
028592e
d5b5109
193b455
d1aee89
cc83b42
b84123e
066c60e
d36eef3
9d18118
3a3e45a
3c8cf75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
diff --git a/app/app.go b/app/app.go | ||
index 44934ea..8e8c829 100644 | ||
--- a/app/app.go | ||
+++ b/app/app.go | ||
@@ -10,6 +10,9 @@ import ( | ||
"strings" | ||
"sync" | ||
|
||
+ "github.com/Stride-Labs/tokenfactory/tokenfactory" | ||
+ tokenfactorykeeper "github.com/Stride-Labs/tokenfactory/tokenfactory/keeper" | ||
+ tokenfactorytypes "github.com/Stride-Labs/tokenfactory/tokenfactory/types" | ||
abci "github.com/cometbft/cometbft/abci/types" | ||
tmproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
dbm "github.com/cosmos/cosmos-db" | ||
@@ -176,10 +179,11 @@ var maccPerms = map[string][]string{ | ||
govtypes.ModuleName: {authtypes.Burner}, | ||
nft.ModuleName: nil, | ||
// non sdk modules | ||
- ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, | ||
- ibcfeetypes.ModuleName: nil, | ||
- icatypes.ModuleName: nil, | ||
- wasmtypes.ModuleName: {authtypes.Burner}, | ||
+ ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, | ||
+ ibcfeetypes.ModuleName: nil, | ||
+ icatypes.ModuleName: nil, | ||
+ wasmtypes.ModuleName: {authtypes.Burner}, | ||
+ tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, | ||
} | ||
|
||
var ( | ||
@@ -226,6 +230,7 @@ type WasmApp struct { | ||
ICAHostKeeper icahostkeeper.Keeper | ||
TransferKeeper ibctransferkeeper.Keeper | ||
WasmKeeper wasmkeeper.Keeper | ||
+ TokenFactoryKeeper tokenfactorykeeper.Keeper | ||
|
||
ScopedIBCKeeper capabilitykeeper.ScopedKeeper | ||
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper | ||
@@ -326,6 +331,7 @@ func NewWasmApp( | ||
capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, | ||
wasmtypes.StoreKey, icahosttypes.StoreKey, | ||
icacontrollertypes.StoreKey, | ||
+ tokenfactorytypes.StoreKey, | ||
) | ||
|
||
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) | ||
@@ -563,6 +569,16 @@ func NewWasmApp( | ||
app.BankKeeper, | ||
) | ||
|
||
+ // Token factory keeper | ||
+ app.TokenFactoryKeeper = tokenfactorykeeper.NewKeeper( | ||
+ keys[tokenfactorytypes.StoreKey], | ||
+ app.GetSubspace(tokenfactorytypes.ModuleName), | ||
+ maccPerms, | ||
+ app.AccountKeeper, | ||
+ app.BankKeeper, | ||
+ app.DistrKeeper, | ||
+ ) | ||
+ | ||
// create evidence keeper with router | ||
evidenceKeeper := evidencekeeper.NewKeeper( | ||
appCodec, | ||
@@ -725,6 +741,7 @@ func NewWasmApp( | ||
ibcfee.NewAppModule(app.IBCFeeKeeper), | ||
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), | ||
ibctm.AppModule{}, | ||
+ tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), | ||
// sdk | ||
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them | ||
) | ||
@@ -770,6 +787,7 @@ func NewWasmApp( | ||
icatypes.ModuleName, | ||
ibcfeetypes.ModuleName, | ||
wasmtypes.ModuleName, | ||
+ tokenfactorytypes.ModuleName, | ||
) | ||
|
||
app.ModuleManager.SetOrderEndBlockers( | ||
@@ -786,6 +804,7 @@ func NewWasmApp( | ||
icatypes.ModuleName, | ||
ibcfeetypes.ModuleName, | ||
wasmtypes.ModuleName, | ||
+ tokenfactorytypes.ModuleName, | ||
) | ||
|
||
// NOTE: The genutils module must occur after staking so that pools are | ||
@@ -811,6 +830,7 @@ func NewWasmApp( | ||
ibcfeetypes.ModuleName, | ||
// wasm after ibc transfer | ||
wasmtypes.ModuleName, | ||
+ tokenfactorytypes.ModuleName, | ||
} | ||
app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) | ||
app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) | ||
@@ -899,9 +919,6 @@ func NewWasmApp( | ||
// At startup, after all modules have been registered, check that all proto | ||
// annotations are correct. | ||
protoFiles, err := proto.MergedRegistry() | ||
- if err != nil { | ||
- panic(err) | ||
- } | ||
err = msgservice.ValidateProtoAnnotations(protoFiles) | ||
if err != nil { | ||
// Once we switch to using protoreflect-based antehandlers, we might | ||
@@ -1209,5 +1226,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino | ||
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) | ||
|
||
paramsKeeper.Subspace(wasmtypes.ModuleName) | ||
+ paramsKeeper.Subspace(tokenfactorytypes.ModuleName) | ||
return paramsKeeper | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
services: | ||
da: | ||
image: golang:1.22-alpine | ||
container_name: da | ||
entrypoint: ["sh", "-c"] | ||
command: | ||
- | | ||
apk add curl perl jq bash git make | ||
curl -sSL https://rollkit.dev/install-local-da.sh -o start.sh | ||
perl -i -pe 's;./build/local-da;./build/local-da -listen-all;' start.sh | ||
sh start.sh | ||
ports: | ||
- 7980:7980 | ||
localwasm: | ||
image: localwasm | ||
container_name: localwasm | ||
build: | ||
context: ../../wasmd | ||
dockerfile: Dockerfile | ||
entrypoint: ["sh", "-c"] | ||
command: | ||
- | | ||
if [ -f /opt/restart-wasm.sh ]; then | ||
bash /opt/restart-wasm.sh | ||
else | ||
apt-get update && apt-get install -y curl perl jq netcat | ||
until nc -z -v da 7980; do | ||
echo "Waiting for the DA layer to start..." | ||
sleep 2 | ||
done | ||
curl -sSL https://rollkit.dev/cosmwasm/init.sh | | ||
perl -pe 's;127.0.0.1;0.0.0.0;g' | | ||
perl -pe 's;http://localhost:7980;http://da:7980;g' | | ||
perl -pe 's;--rollkit.aggregator;--rollkit.aggregator --api.address tcp://0.0.0.0:1317;g' | | ||
bash | ||
fi | ||
ports: | ||
- 36657:36657 | ||
- 1317:1317 | ||
- 9290:9290 | ||
relayer: | ||
container_name: hpl-relayer | ||
image: gcr.io/abacus-labs-dev/hyperlane-agent:8a66544-20240530-111322 | ||
platform: linux/amd64 | ||
user: root | ||
# restart: always | ||
entrypoint: ["sh", "-c"] | ||
command: | ||
- | | ||
rm -rf /app/config/* && \ | ||
cp "/etc/hyperlane/agent-config.docker.json" "/app/config/agent-config.json" && \ | ||
CONFIG_FILES="/etc/hyperlane/relayer.json" \ | ||
./relayer | ||
ports: | ||
- 9110:9090 | ||
volumes: | ||
- ./hyperlane:/etc/hyperlane | ||
- ./relayer:/etc/data | ||
- ./validator:/etc/validator | ||
|
||
validator-localwasm: | ||
container_name: hpl-validator-localwasm | ||
image: gcr.io/abacus-labs-dev/hyperlane-agent:8a66544-20240530-111322 | ||
platform: linux/amd64 | ||
user: root | ||
# restart: always | ||
entrypoint: ["sh", "-c"] | ||
command: | ||
- | | ||
rm -rf /app/config/* && \ | ||
cp "/etc/hyperlane/agent-config.docker.json" "/app/config/agent-config.json" && \ | ||
CONFIG_FILES="/etc/hyperlane/validator.localwasm.json" \ | ||
./validator | ||
ports: | ||
- 9120:9090 | ||
volumes: | ||
- ./hyperlane:/etc/hyperlane | ||
- ./validator:/etc/validator | ||
- ./validator/localwasm:/etc/data | ||
|
||
validator-strideinternal1: | ||
container_name: hpl-validator-strideinternal1 | ||
image: gcr.io/abacus-labs-dev/hyperlane-agent:8a66544-20240530-111322 | ||
platform: linux/amd64 | ||
user: root | ||
# restart: always | ||
entrypoint: ["sh", "-c"] | ||
command: | ||
- | | ||
rm -rf /app/config/* && \ | ||
cp "/etc/hyperlane/agent-config.docker.json" "/app/config/agent-config.json" && \ | ||
CONFIG_FILES="/etc/hyperlane/validator.strideinternal1.json" \ | ||
./validator | ||
ports: | ||
- 9121:9090 | ||
volumes: | ||
- ./hyperlane:/etc/hyperlane | ||
- ./validator:/etc/validator | ||
- ./validator/strideinternal1:/etc/data |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
networks: | ||
- id: "localwasm" | ||
hrp: "wasm" | ||
endpoint: | ||
rpc: "http://127.0.0.1:36657" | ||
rest: "http://127.0.0.1:1317" | ||
grpc: "http://127.0.0.1:9290" | ||
gas: | ||
price: "0.025" | ||
denom: "uwasm" | ||
domain: 963 | ||
signer: "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" # wasm133xh839fjn9wxzg6vhc0370lcem8939zr8uu45 | ||
- id: "stride-internal-1" | ||
hrp: "stride" | ||
endpoint: | ||
rpc: "https://stride-testnet-rpc.polkachu.com" | ||
rest: "https://stride-testnet-api.polkachu.com" | ||
grpc: "http://stride-testnet-grpc.polkachu.com:12290" | ||
gas: | ||
price: "0.01" | ||
denom: "ustrd" | ||
domain: 1651 | ||
signer: "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" # stride133xh839fjn9wxzg6vhc0370lcem8939z2sd4gn | ||
assafmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# wasm133xh839fjn9wxzg6vhc0370lcem8939zr8uu45 | ||
# stride133xh839fjn9wxzg6vhc0370lcem8939z2sd4gn | ||
signer: "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" | ||
Comment on lines
+25
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove exposed mnemonic and consider using environment variables. Exposing the full mnemonic in the configuration file is a severe security risk. Additionally, repeating the mnemonic from the network configurations is redundant and could lead to maintenance issues. Consider the following improvements:
Example: signer: ${HYPERLANE_SIGNER_MNEMONIC} |
||
|
||
deploy: | ||
ism: | ||
type: multisig | ||
owner: <signer> | ||
validators: | ||
963: | ||
addrs: | ||
- <signer> | ||
threshold: 1 | ||
assafmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hooks: | ||
default: | ||
type: aggregate | ||
owner: <signer> | ||
hooks: | ||
- type: merkle | ||
|
||
- type: igp | ||
owner: <signer> | ||
token: "ibc/1A7653323C1A9E267FF7BEBF40B3EEA8065E8F069F47F2493ABC3E0B621BF793" | ||
configs: | ||
963: | ||
exchange_rate: 1000 | ||
gas_price: 10000 | ||
default_gas_usage: 100000 | ||
|
||
required: | ||
type: aggregate | ||
owner: <signer> | ||
hooks: | ||
- type: pausable | ||
owner: <signer> | ||
paused: false | ||
|
||
- type: fee | ||
owner: <signer> | ||
fee: | ||
denom: "ibc/1A7653323C1A9E267FF7BEBF40B3EEA8065E8F069F47F2493ABC3E0B621BF793" | ||
amount: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
networks: | ||
- id: "localwasm" | ||
hrp: "wasm" | ||
endpoint: | ||
rpc: "http://127.0.0.1:36657" | ||
rest: "http://127.0.0.1:1317" | ||
grpc: "http://127.0.0.1:9290" | ||
gas: | ||
price: "0.025" | ||
denom: "uwasm" | ||
domain: 963 | ||
signer: "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" # wasm133xh839fjn9wxzg6vhc0370lcem8939zr8uu45 | ||
- id: "stride-internal-1" | ||
hrp: "stride" | ||
endpoint: | ||
rpc: "https://stride-testnet-rpc.polkachu.com" | ||
rest: "https://stride-testnet-api.polkachu.com" | ||
grpc: "http://stride-testnet-grpc.polkachu.com:12290" | ||
gas: | ||
price: "0.01" | ||
denom: "ustrd" | ||
domain: 1651 | ||
signer: "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" # stride133xh839fjn9wxzg6vhc0370lcem8939z2sd4gn | ||
assafmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# wasm133xh839fjn9wxzg6vhc0370lcem8939zr8uu45 | ||
# stride133xh839fjn9wxzg6vhc0370lcem8939z2sd4gn | ||
signer: "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" | ||
assafmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
deploy: | ||
ism: | ||
type: multisig | ||
owner: <signer> | ||
validators: | ||
1651: | ||
addrs: | ||
- <signer> | ||
threshold: 1 | ||
assafmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hooks: | ||
default: | ||
type: aggregate | ||
owner: <signer> | ||
hooks: | ||
- type: merkle | ||
|
||
- type: igp | ||
owner: <signer> | ||
configs: | ||
1651: | ||
exchange_rate: 1000 | ||
gas_price: 10000 | ||
default_gas_usage: 100000 | ||
|
||
required: | ||
type: aggregate | ||
owner: <signer> | ||
hooks: | ||
- type: pausable | ||
owner: <signer> | ||
paused: false | ||
|
||
- type: fee | ||
owner: <signer> | ||
fee: | ||
denom: uwasm | ||
amount: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"db": "/etc/data/db", | ||
"relayChains": "localwasm,strideinternal1", | ||
"allowLocalCheckpointSyncers": "true", | ||
"gasPaymentEnforcement": [{ "type": "none" }], | ||
assafmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"whitelist": [ | ||
{ | ||
"origindomain": [963], | ||
"destinationDomain": [1651] | ||
}, | ||
{ | ||
"origindomain": [1651], | ||
"destinationDomain": [963] | ||
} | ||
], | ||
"chains": { | ||
"localwasm": { | ||
"signer": { | ||
"type": "cosmosKey", | ||
"key": "0xf0517040b5669e2d93ffac3a3616187b14a19ad7a0657657e0f655d5eced9e31", | ||
"prefix": "wasm" | ||
} | ||
}, | ||
"strideinternal1": { | ||
"signer": { | ||
"type": "cosmosKey", | ||
"key": "0xf0517040b5669e2d93ffac3a3616187b14a19ad7a0657657e0f655d5eced9e31", | ||
"prefix": "stride" | ||
} | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.