-
Notifications
You must be signed in to change notification settings - Fork 41
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
Axelar Cork #209
Axelar Cork #209
Conversation
proto/axelar-cork/v1/cork.proto
Outdated
|
||
option go_package = "github.com/peggyjv/sommelier/x/axelarcork/types"; | ||
|
||
// todo: do we need Axelar in the name or should we depend on the namespace? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan of the specificity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
axelarcorktypes.AxelarCork.AxelarTargetContractAddress
Ashes to ashes, java to java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete pass
proto/buf.yaml
Outdated
name: buf.build/cosmwasm/xiond | ||
deps: | ||
- buf.build/cosmos/cosmos-proto | ||
- buf.build/cosmos/cosmos-sdk:v0.47.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is using the 0.47.0 buf image while we're using 0.45 going to cause issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. It seems to be fine so far? I don't know of any breaking changes in proto definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumping this so we follow up on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new file, that the current protoc-gen.sh does not use. It was part of my attempt to update proto generation to use the new docker method, which seems like it won't be pursued. The correct option is likely to delete all of these proto/buf* files. Should I do that?
proto/buf.md
Outdated
@@ -0,0 +1,3 @@ | |||
# Protobufs | |||
|
|||
This is the public protocol buffers API for [Wasmd](https://github.com/CosmWasm/wasmd). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know, but I changed it to Sommelier
proto/axelar-cork/v1/cork.proto
Outdated
message ChainConfiguration { | ||
string name = 1; | ||
uint64 id = 2; | ||
string vote_threshold = 3 [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the rationale behind chain-specific thresholds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear. It's a carryover from Axelar v1, where we had a vote threshold for Ethereum. It could be moved to a Param, but @EricBolten and I couldn't really think of a reason to go in either direction, so left it here. More configuration seems better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our conversations around fixes in the original cork module, we may want to drop this as a parameter and stick with a hardcoded vote threshold value of consensus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more pass of questions and comments.
x/axelarcork/keeper/genesis.go
Outdated
|
||
k.SetScheduledAxelarCork(ctx, config.Id, scheduledCork.BlockHeight, valAddr, *scheduledCork.Cork) | ||
for _, scheduledCork := range gs.ScheduledCorks.ScheduledCorks { | ||
valAddr, err := sdk.ValAddressFromHex(scheduledCork.Validator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think the validator address in a scheduled cork would be bech32 and not hex, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched
@@ -150,7 +151,7 @@ func (k Keeper) GetScheduledAxelarCorks(ctx sdk.Context, chainID uint64) []*type | |||
Validator: val.String(), | |||
Cork: &cork, | |||
BlockHeight: blockHeight, | |||
Id: id, | |||
Id: hex.EncodeToString(id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this commit, we've updated the output encoding, but are there any queries that rely on the ID as input which were expecting bytes before and now need to convert from a hex string into bytes?
|
||
return cmd | ||
} | ||
|
||
func queryScheduledBlockHeights() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "scheduled-block-heights", | ||
Use: "scheduled-block-heights [chain-id]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at some of these commands (beyond just this one) and wondering if they wouldn't be better with chain-id
as an optional argument and if it's missing, returning a list with all chain IDs included. I guess the only thing that could make that kind of ugly is if the return values don't have embedded chain IDs, making the response object unclear.
|
||
return cmd | ||
} | ||
|
||
func queryScheduledCorksByID() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "scheduled-corks-by-id", | ||
Use: "scheduled-corks-by-id [chain-id]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chain ID is part of the cork ID hash now. They should be unique regardless of the chain ID, so for queries using cork IDs we shouldn't need the chain ID.
|
||
return cmd | ||
} | ||
|
||
func queryCorkResult() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "cork-result", | ||
Use: "cork-result [chain-id] [cork-id]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well re: cork ID.
x/axelarcork/keeper/abci.go
Outdated
"height", fmt.Sprintf("%d", ctx.BlockHeight()), | ||
"chain id", config.Id) | ||
|
||
timeoutHeight := k.GetParamSet(ctx).CorkTimeoutBlocks + uint64(ctx.BlockHeight()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be current block height subtracting the timeout param? Adding it to the current block height will always produce one in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, fixed
func (k Keeper) DeleteWinningAxelarCork(ctx sdk.Context, chainID uint64, c types.AxelarCork) { | ||
|
||
k.IterateWinningAxelarCorks(ctx, chainID, func(contract common.Address, blockHeight uint64, cork types.AxelarCork) (stop bool) { | ||
if c.Equals(cork) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be concerned with also checking the contract address here?
keyPair := bytes.NewBuffer(iter.Key()) | ||
keyPair.Next(1) // trim prefix byte | ||
keyPair.Next(8) // trim chain ID | ||
blockHeight := binary.BigEndian.Uint64(keyPair.Next(8)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this design was to not change the storage type, but given that we've landed on one enqueued call per contract address, is there a reason we couldn't switch this to an AxelarScheduledCork
type and just have the block height stored with it, and do the lookup based on the chain ID and contract address?
x/axelarcork/types/params.go
Outdated
GmpAccount: "", | ||
ExecutorAccount: "", | ||
TimeoutDuration: 0, | ||
CorkTimeoutBlocks: 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to set this to a larger value, but I can check in with Seven Seas to get their opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, switching it to 10000
@@ -8,7 +8,7 @@ linters: | |||
enable: | |||
- bodyclose | |||
- deadcode | |||
- depguard | |||
# - depguard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we wanted this commented out of the linter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes it easier for me to lint locally. For some reason, this line isn't enforced on CI, and I am not sure why we enforce it in the local lint config
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closes: #XXX
Description