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

fix for feegrants #1256

Merged
merged 54 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
1c42b99
Feegrant support
KyleMoser Mar 8, 2023
48af330
Test case for address caching bugfix
KyleMoser Mar 9, 2023
106bfb5
Bugfix for SDK account prefix. Feegrant test passing.
KyleMoser Mar 9, 2023
d0602c6
Mutex for signer expanded to include feegrantees
KyleMoser Mar 16, 2023
7acfe7d
Cleaned up feegrant test case
KyleMoser Mar 22, 2023
2f29f09
Cleaned up feegrant test case
KyleMoser Mar 22, 2023
78ee03f
Cleaned up feegrant test case
KyleMoser Mar 22, 2023
aeb19b5
merge feegrant test cases with v0.47.0-rc3 changes
KyleMoser Mar 23, 2023
99f45c4
check round robin feegrant behavior by counting number of TXs each gr…
KyleMoser Mar 23, 2023
181487b
merge latest with feegrant changes
KyleMoser Mar 23, 2023
8cddf85
module updates from merge
KyleMoser Mar 23, 2023
b64c4c2
Merge branch 'main' of ssh://github.com/cosmos/relayer
KyleMoser Mar 25, 2023
b18575d
v0.47.0 with bech32 address cache fix
KyleMoser Mar 25, 2023
06faa54
Move SetAddrCacheEnabled to NewRelayer func for full coverage
KyleMoser Mar 27, 2023
c3953b9
Merge remote-tracking branch 'upstream/main'
KyleMoser Mar 27, 2023
85c30e7
Do not hardcode chain id in feegrant test case
KyleMoser Mar 27, 2023
edf2225
Wait more blocks for ibc transfers
KyleMoser Mar 27, 2023
99fa49e
Merge branch 'main' into main
KyleMoser Mar 28, 2023
7a86b77
disable cosmos SDK bech32 address cache for rly start command
KyleMoser Mar 28, 2023
92a2e68
Merge branch 'main' of ssh://github.com/KyleMoser/relayer-1
KyleMoser Mar 28, 2023
d0978dd
Fix sloppy comments/remove unnecessary code
KyleMoser Mar 30, 2023
16528e0
Faster acc caching unit test
KyleMoser Mar 30, 2023
6a2174d
Merge branch 'main' into main
agouin Mar 31, 2023
00e0b67
Merge remote-tracking branch 'upstream/main'
KyleMoser Apr 5, 2023
0da87e8
Penumbra provider feegrant support
KyleMoser Apr 5, 2023
d27d78a
Merge upstream
KyleMoser Apr 10, 2023
eeaea62
Merge upstream
KyleMoser Apr 10, 2023
b4cda04
Fixed merge issue where feegrant config wasn't being written to file
KyleMoser Apr 11, 2023
ea0d30f
merging updates from main
KyleMoser Apr 11, 2023
9932b8f
feegrant patch for cosmos-sdk v0.47.1
KyleMoser Apr 12, 2023
38024a7
Merge branch 'main' into main
agouin Apr 18, 2023
3f4d30a
Merge remote-tracking branch 'upstream/main'
KyleMoser May 1, 2023
0756463
Merge branch 'main' of ssh://github.com/KyleMoser/relayer-1
KyleMoser May 1, 2023
ee14a21
merge from main
KyleMoser May 1, 2023
da3746b
Update to cosmos-sdk v0.47.2
KyleMoser May 1, 2023
f09dc7d
Increase test case blocks to wait
KyleMoser May 1, 2023
b59f98a
Merging from upstream
KyleMoser Jun 19, 2023
cc86dd2
Merge branch 'main' into main
KyleMoser Jun 28, 2023
15e292f
merged main branch. feegrant tests passing, scenario tests failing
KyleMoser Jul 6, 2023
2de6911
Merge remote-tracking branch 'upstream/main'
KyleMoser Jul 11, 2023
eeb8724
Fixed data race by moving test parallelization after relayer wallet b…
KyleMoser Jul 11, 2023
62485a6
Increased TestScenarioICAChannelClose timeout height
KyleMoser Jul 11, 2023
6057498
Cleanup feegrant test case
KyleMoser Jul 11, 2023
2bdc5ae
Fixed race condition in sequence guard w/ mutex
KyleMoser Jul 12, 2023
3febd1b
Automatic retry for TX lookup in feegrant test case
KyleMoser Jul 12, 2023
e6f6475
Merge branch 'main' into main
agouin Jul 25, 2023
b22f408
Merge branch 'main' into main
agouin Jul 27, 2023
90b82e3
Merge remote-tracking branch 'upstream/main'
Aug 8, 2023
d0b627d
Disable cosmos SDK address cache on app initialization via main packa…
Aug 8, 2023
2225ec7
Added docs for feegrant in the advanced usage guide
Aug 10, 2023
9e9d2a3
Removed commented out code
Aug 10, 2023
17fb063
Removed commented out code
Aug 10, 2023
9a11a6b
Added detail to feegrant docs, fixed minor issue with test case
Aug 14, 2023
e099d29
Added detail to feegrant docs, fixed minor issue with test case
Aug 14, 2023
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: 18 additions & 2 deletions cmd/feegrant.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func feegrantConfigureBaseCmd(a *appState) *cobra.Command {
func feegrantConfigureBasicCmd(a *appState) *cobra.Command {
var numGrantees int
var update bool
var delete bool
var updateGrantees bool
var grantees []string

Expand Down Expand Up @@ -61,6 +62,19 @@ func feegrantConfigureBasicCmd(a *appState) *cobra.Command {
return fmt.Errorf("could not get granter key from '%s'", granterKeyOrAddr)
}

if delete {
fmt.Printf("Deleting %s feegrant configuration\n", chain)

cfgErr := a.performConfigLockingOperation(cmd.Context(), func() error {
chain := a.config.Chains[chain]
oldProv := chain.ChainProvider.(*cosmos.CosmosProvider)
oldProv.PCfg.FeeGrants = nil
return nil
})
cobra.CheckErr(cfgErr)
return nil
}

if prov.PCfg.FeeGrants != nil && granterKey != prov.PCfg.FeeGrants.GranterKey && !update {
return fmt.Errorf("you specified granter '%s' which is different than configured feegranter '%s', but you did not specify the --overwrite-granter flag", granterKeyOrAddr, prov.PCfg.FeeGrants.GranterKey)
} else if prov.PCfg.FeeGrants != nil && granterKey != prov.PCfg.FeeGrants.GranterKey && update {
Expand Down Expand Up @@ -126,11 +140,13 @@ func feegrantConfigureBasicCmd(a *appState) *cobra.Command {
return nil
},
}

cmd.Flags().BoolVar(&delete, "delete", false, "delete the feegrant configuration")
cmd.Flags().BoolVar(&update, "overwrite-granter", false, "allow overwriting the existing granter")
cmd.Flags().BoolVar(&updateGrantees, "overwrite-grantees", false, "allow overwriting existing grantees")
cmd.Flags().IntVar(&numGrantees, "num-grantees", 10, "number of grantees that will be feegranted with basic allowances")
cmd.Flags().StringSliceVar(&grantees, "grantees", []string{}, "comma separated list of grantee key names (keys are created if they do not exist)")
cmd.MarkFlagsMutuallyExclusive("num-grantees", "grantees")
cmd.Flags().StringSliceVar(&grantees, "grantees", nil, "comma separated list of grantee key names (keys are created if they do not exist)")
cmd.MarkFlagsMutuallyExclusive("num-grantees", "grantees", "delete")

memoFlag(a.viper, cmd)
return cmd
Expand Down
28 changes: 27 additions & 1 deletion docs/advanced_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,33 @@ Use cases for configuring the `--time-threshold` flag:

\* It is not mandatory for relayers to include the `MsgUpdateClient` when relaying packets, however most, if not all relayers currently do.

---
## Feegrants

Feegrant configurations can be applied to each chain in the relayer. Note that Osmosis does not support Feegrants.

- When feegrants are enabled, TXs will be signed in round robin by the grantees.
- Feegrants reduce sequencing error rates by using many signing addresses instead of a single signer, especially when broadcast-mode is set to single.
- Feegrants are especially useful when relaying on multiple paths with the same wallet.
- Funds are held on a single address, the "granter".

For example, configure feegrants for Kujira:
- `rly chains configure feegrant basicallowance kujira default --num-grantees 10`
- Note: above, `default` is the key that will need to contain funds (the granter)
- 10 grantees will be configured, so those 10 address will sign TXs in round robin order.


You may also choose to specify the exact names of your grantees:
- `rly chains configure feegrant basicallowance kujira default --grantees "kuji1,kuji2,kuji3"`

Rerunning the feegrant command will simply confirm your configuration is correct, e.g. "Valid grant found for granter `addr` and grantee `addr2`" but will not create additional TXs on chain. Rerunning the feegrant command can therefore be a good way to check what addresses exist.


To remove the feegrant configuration:
- `rly chains configure feegrant basicallowance kujira --delete`




---

[<-- Create Path Across Chains](create-path-across-chain.md) - [Troubleshooting -->](./troubleshooting.md)
3 changes: 1 addition & 2 deletions interchaintest/acc_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

"github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cosmos/cosmos-sdk/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
)
Expand All @@ -14,7 +13,7 @@ import (
// This will cause the AccAddress.String() to print out unexpected prefixes.
// If this function fails you are on an unsafe SDK version that should NOT be used with the relayer.
func TestAccCacheBugfix(t *testing.T) {
types.SetAddrCacheEnabled(false)
sdk.SetAddrCacheEnabled(false)

// Use a random key
priv := ed25519.GenPrivKey()
Expand Down
Loading
Loading