-
Notifications
You must be signed in to change notification settings - Fork 369
feat: kas bridge #1883
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
Merged
Merged
feat: kas bridge #1883
Changes from 37 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
69b9482
use local hyperlane
danwt 3a75d99
go sum
danwt e0d08c5
add a copy of some sequencer proto files to a kas module dir
danwt 83b495a
rename paths
danwt 4aa25e1
strip down
danwt 127196b
generate some foo kas types (query events genesis tx)
danwt 84db222
adds more module files, copied from sequencer
danwt 6a43da1
strip down (not building)
danwt 875788c
regen protos
danwt ffaf84e
strips down - confirms builds. module still unregistered
danwt 556d903
add module registry, including to upgrade new store
danwt 470b0d4
add TransactionOutpoint proto
danwt 82610ee
add protos and pb go for withdrawal status query
danwt bb5da2b
add query for withdrawal status
danwt 38ae1e5
add indicate progress rpc proto def
danwt 62b73d7
broken - start implementing progress indication
danwt 152dffc
doing more logic for the update
danwt 3c0afec
untested - simplify and finish the update method
danwt 24d36f7
builds
danwt 1ad958a
start to add the bootstrap stuff
danwt 32e011c
working on the bootstrap tx
danwt 37dff03
build passes
danwt 1769dc2
build passes
danwt 47793dd
add tx outpoint to query
danwt af18eec
cp
danwt 74d835e
doc
danwt 8db8a02
add genesis protos
danwt 252aa39
add genesis - test fails, something about store reg
danwt c992bee
add a query for outpoint
danwt 660e735
add events
danwt 32cc086
add store key
danwt 47a8fdc
go mod tidy
danwt 9bc593b
codec
danwt 2fcaab2
fmt
danwt 93ceae7
proto fmt and regen
danwt 7e357d9
buggy: adds a sanity check for token bridged supply on second bootstr…
danwt 119a7b6
revert sanity check for token bridges supply on second bootstrap: its…
danwt 957e4f8
use hyperlane cosmos fork main-dym
danwt d44c9b9
merge main, fix module reg conflicts
danwt 2a4197e
merge main with manual go mod conflict resolution
danwt ddc2b27
progress checkpoint: code might be broken
danwt dbabff6
Update proto/dymensionxyz/dymension/kas/d.proto
danwt 059c326
simplify module
danwt 6f61217
remove unused
danwt fa4cf82
todo in genesis test
danwt bd51049
comments
danwt 51ad747
fix comments, tests pass
danwt 0f64f2b
proto fmt
danwt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
syntax = "proto3"; | ||
|
||
package dymensionxyz.dymension.kas; | ||
|
||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/kas/types"; | ||
|
||
// Kaspa transaction outpoint | ||
// https://github.com/kaspanet/rusty-kaspa/blob/1adeae8e5e2bdf7b65265420d294a356edc6d9e6/consensus/client/src/outpoint.rs#L91 | ||
message TransactionOutpoint { | ||
// 32 byte hash | ||
bytes transaction_id = 1; | ||
// pointer to the output in the transaction | ||
uint32 index = 2; | ||
} | ||
|
||
// an index into a set of a dispatched Hyperlane withdrawal messages | ||
// see | ||
// https://github.com/dymensionxyz/hyperlane-cosmos/blob/5b73e596185ce009f7d9d412e26294c52e3108a8/x/core/keeper/query_server.go#L39 | ||
// and | ||
// https://github.com/dymensionxyz/hyperlane-cosmos/blob/5b73e596185ce009f7d9d412e26294c52e3108a8/proto/hyperlane/core/v1/query.proto#L88-L92 | ||
message WithdrawalID { | ||
// in stringified hex address format | ||
string message_id = 2; | ||
danwt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
enum WithdrawalStatus { | ||
WITHDRAWAL_STATUS_UNSPECIFIED = 0; | ||
WITHDRAWAL_STATUS_UNPROCESSED = 1; | ||
WITHDRAWAL_STATUS_PROCESSED = 2; | ||
} | ||
|
||
// signed by validators to attest to successfully relayed withdrawals | ||
message ProgressIndication { | ||
// current/'old' outpoint the validator sees on the hub | ||
TransactionOutpoint old_outpoint = 1; | ||
danwt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// new outpoint after processing withdrawals | ||
TransactionOutpoint new_outpoint = 2; | ||
// the processed withdrawals | ||
repeated WithdrawalID processed_withdrawals = 3; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
syntax = "proto3"; | ||
|
||
package dymensionxyz.dymension.kas; | ||
|
||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "dymensionxyz/dymension/kas/d.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/kas/types"; | ||
|
||
message EventBootstrap {} | ||
|
||
message EventUpdate { ProgressIndication update = 1; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.kas; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "dymensionxyz/dymension/kas/d.proto"; | ||
option go_package = "github.com/dymensionxyz/dymension/v3/x/kas/types"; | ||
|
||
message GenesisState { | ||
bool bootstrapped = 1; | ||
string mailbox = 2; | ||
string ism = 3; | ||
TransactionOutpoint outpoint = 4; | ||
repeated WithdrawalID processed_withdrawals = 5; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.kas; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
import "dymensionxyz/dymension/kas/d.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/kas/types"; | ||
|
||
service Query { | ||
|
||
rpc WithdrawalStatus(QueryWithdrawalStatusRequest) | ||
returns (QueryWithdrawalStatusResponse) { | ||
option (google.api.http).get = | ||
"/dymensionxyz/dymension/kas/withdrawal_status"; | ||
} | ||
|
||
rpc Outpoint(QueryOutpointRequest) returns (QueryOutpointResponse) { | ||
option (google.api.http).get = "/dymensionxyz/dymension/kas/outpoint"; | ||
} | ||
} | ||
|
||
message QueryWithdrawalStatusRequest { | ||
repeated WithdrawalID withdrawal_id = 1; | ||
} | ||
|
||
message QueryWithdrawalStatusResponse { | ||
repeated WithdrawalStatus status = 1; | ||
danwt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TransactionOutpoint outpoint = 2; | ||
} | ||
|
||
message QueryOutpointRequest {} | ||
|
||
message QueryOutpointResponse { TransactionOutpoint outpoint = 1; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.kas; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/kas/types"; | ||
|
||
import "google/protobuf/any.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "cosmos/msg/v1/msg.proto"; | ||
import "dymensionxyz/dymension/kas/d.proto"; | ||
|
||
service Msg { | ||
option (cosmos.msg.v1.service) = true; | ||
|
||
rpc Bootstrap(MsgBootstrap) returns (MsgBootstrapResponse); | ||
|
||
rpc IndicateProgress(MsgIndicateProgress) | ||
returns (MsgIndicateProgressResponse); | ||
} | ||
|
||
message MsgBootstrap { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
|
||
// Authority is the address that controls the module (defaults to x/gov unless | ||
// overwritten). | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// the kaspa escrow mailbox | ||
string mailbox = 2; | ||
|
||
// the kaspa escrow ism | ||
string ism = 3; | ||
|
||
// the seed kaspa escrow outpoint | ||
TransactionOutpoint outpoint = 4; | ||
danwt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message MsgBootstrapResponse {} | ||
|
||
message MsgIndicateProgress { | ||
danwt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
option (cosmos.msg.v1.signer) = "signer"; | ||
string signer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// sig verification info | ||
// https://github.com/dymensionxyz/hyperlane-cosmos/blob/89bed40d16e362c92c12166aa0f86f3db42b3db7/x/core/01_interchain_security/types/message_id_multisig_raw.go#L48 | ||
bytes metadata = 2; | ||
|
||
// what is signed by validators | ||
ProgressIndication payload = 3; | ||
} | ||
|
||
message MsgIndicateProgressResponse {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/dymensionxyz/dymension/v3/x/kas/types" | ||
) | ||
|
||
func GetQueryCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
return cmd | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/dymensionxyz/dymension/v3/x/kas/types" | ||
) | ||
|
||
func GetTxCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
return cmd | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Package kas does bookkeeping for the Kaspa<->Dymension Hyperlane-esque bridge. | ||
// https://www.notion.so/dymension/ADR-Kaspa-Bridge-Implementation-206a4a51f86a803980aec7099c826fb4 | ||
package kas |
danwt marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package kas_test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestInitGenesis(t *testing.T) { | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.