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

feat(x/ecocredit): add bridge receive event and update bridge event #1224

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat(x/ecocredit): add bridge receive event and update bridge event
  • Loading branch information
ryanchristo committed Jun 28, 2022
commit 4cbac655a3a24721fa3f1024f5a2103ccdf7badb
669 changes: 647 additions & 22 deletions api/regen/ecocredit/v1/events.pulsar.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions api/regen/ecocredit/v1/tx_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
nhooyr.io/websocket v1.8.6 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,4 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
10 changes: 4 additions & 6 deletions proto/regen/ecocredit/basket/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ service Query {
option (google.api.http) = {
get : "/regen/ecocredit/basket/v1/basket-balance/{basket_denom}/"
"{batch_denom}"
additional_bindings : [
{
get : "/regen/ecocredit/basket/v1/baskets/{basket_denom}/balances/"
"{batch_denom}"
}
]
additional_bindings : [ {
get : "/regen/ecocredit/basket/v1/baskets/{basket_denom}/balances/"
"{batch_denom}"
} ]
};
}
}
Expand Down
20 changes: 18 additions & 2 deletions proto/regen/ecocredit/v1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ message EventAddCreditType {
string abbreviation = 1;
}

// EventBridge is emitted emitted when credits are bridged to another chain.
// EventBridge is emitted when credits are bridged to another chain.
message EventBridge {

// target is the target chain.
string target = 1;

Expand All @@ -193,4 +194,19 @@ message EventBridge {

// contract is the contract address.
string contract = 3;
}

// amount is the amount of credits.
string amount = 4;
}

// EventBridgeReceive is emitted when credits are bridged from another chain.
message EventBridgeReceive {
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 use case for this event? I'm wondering if we should also add amount here too?

Copy link
Member Author

@ryanchristo ryanchristo Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amount is redundant with EventMint, which will be emitted from Msg/CreateBatch or Msg/MintBatchCredits.

In general, we are taking a lean approach to event fields based on how events are written in the sdk. EventBridge is a special case because we want to make all necessary information easily accessible to the bridge service.

We would ideally include an event specific to each message so that we can track the execution of each message and the two fields here (project id and batch denom) seem to be the most relevant to Msg/BridgeReceive.

See #1035 and #1086 for reference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anything, we could probably remove project id but it still seems relevant.


// project_id is the unique identifier of the project that was either created
// or the existing project within which the credit batch exists.
string project_id = 1;

// batch_denom is the unique identifier of the credit batch either created
// or within which the credits were dynamically minted.
string batch_denom = 2;
}
4 changes: 2 additions & 2 deletions proto/regen/ecocredit/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ service Msg {
// bridge event handled by an external bridge service.
rpc Bridge(MsgBridge) returns (MsgBridgeResponse);

// BridgeReceive processes credits being sent from an external registry or network to
// Regen Ledger.
// BridgeReceive processes credits being sent from an external registry or
// network to Regen Ledger.
rpc BridgeReceive(MsgBridgeReceive) returns (MsgBridgeReceiveResponse);
}

Expand Down
Loading