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

Axelar Cork #209

Closed
wants to merge 69 commits into from
Closed

Axelar Cork #209

wants to merge 69 commits into from

Conversation

mvid
Copy link
Contributor

@mvid mvid commented Apr 4, 2023

Closes: #XXX

Description

@mvid mvid changed the base branch from main to bolten/v6-rc1 April 4, 2023 23:50
@mvid mvid temporarily deployed to CI April 4, 2023 23:56 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI April 4, 2023 23:56 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI April 4, 2023 23:56 — with GitHub Actions Inactive

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?
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

@cbrit cbrit left a 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
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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).
Copy link
Member

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?

Copy link
Contributor Author

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

message ChainConfiguration {
string name = 1;
uint64 id = 2;
string vote_threshold = 3 [
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

proto/axelar-cork/v1/event.proto Outdated Show resolved Hide resolved
proto/axelar-cork/v1/query.proto Outdated Show resolved Hide resolved
x/axelarcork/keeper/proposal_handler.go Show resolved Hide resolved
x/axelarcork/keeper/proposal_handler.go Outdated Show resolved Hide resolved
proto/axelar-cork/v1/cork.proto Outdated Show resolved Hide resolved
x/axelarcork/handler.go Outdated Show resolved Hide resolved
x/axelarcork/handler.go Outdated Show resolved Hide resolved
@mvid mvid temporarily deployed to CI July 26, 2023 17:38 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 26, 2023 17:38 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 26, 2023 17:38 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 26, 2023 17:43 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 26, 2023 17:43 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 26, 2023 17:43 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 28, 2023 18:41 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 28, 2023 18:41 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 28, 2023 18:41 — with GitHub Actions Inactive
Copy link
Contributor

@EricBolten EricBolten left a 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.


k.SetScheduledAxelarCork(ctx, config.Id, scheduledCork.BlockHeight, valAddr, *scheduledCork.Cork)
for _, scheduledCork := range gs.ScheduledCorks.ScheduledCorks {
valAddr, err := sdk.ValAddressFromHex(scheduledCork.Validator)
Copy link
Contributor

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?

Copy link
Contributor Author

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),
Copy link
Contributor

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]",
Copy link
Contributor

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]",
Copy link
Contributor

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]",
Copy link
Contributor

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.

"height", fmt.Sprintf("%d", ctx.BlockHeight()),
"chain id", config.Id)

timeoutHeight := k.GetParamSet(ctx).CorkTimeoutBlocks + uint64(ctx.BlockHeight())
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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))
Copy link
Contributor

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?

GmpAccount: "",
ExecutorAccount: "",
TimeoutDuration: 0,
CorkTimeoutBlocks: 100,
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@mvid mvid temporarily deployed to CI July 31, 2023 18:26 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 31, 2023 18:26 — with GitHub Actions Inactive
@mvid mvid temporarily deployed to CI July 31, 2023 18:26 — with GitHub Actions Inactive
@github-actions
Copy link

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.

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label Oct 31, 2023
@github-actions github-actions bot closed this Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants