Skip to content

Commit

Permalink
Merge branch 'feat/govv1' into charly/issue#3673-add-message-and-rpc-…
Browse files Browse the repository at this point in the history
…handler-to-upgrade-clients-using-v1-governance-proposals
  • Loading branch information
charleenfei committed Aug 29, 2023
2 parents efa5e43 + 85821bd commit dbbf6b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/callbacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: golangci/[email protected]
with:
version: v1.53.3
version: v1.54.2
args: --timeout 5m
working-directory: modules/apps/callbacks

Expand Down
6 changes: 3 additions & 3 deletions modules/apps/callbacks/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ func (s *CallbacksTestSuite) TestProcessCallback() {
func() {
executionGas := callbackData.ExecutionGasLimit
expGasConsumed = executionGas
callbackExecutor = func(cachedCtx sdk.Context) error {
callbackExecutor = func(cachedCtx sdk.Context) error { //nolint:unparam
cachedCtx.GasMeter().ConsumeGas(expGasConsumed+1, "callbackExecutor gas consumption")
return nil
}
Expand Down Expand Up @@ -811,7 +811,7 @@ func (s *CallbacksTestSuite) TestProcessCallback() {
executionGas := callbackData.ExecutionGasLimit
callbackData.CommitGasLimit = executionGas + 1
expGasConsumed = executionGas
callbackExecutor = func(cachedCtx sdk.Context) error {
callbackExecutor = func(cachedCtx sdk.Context) error { //nolint:unparam
cachedCtx.GasMeter().ConsumeGas(executionGas+1, "callbackExecutor oog panic")
return nil
}
Expand Down Expand Up @@ -843,7 +843,7 @@ func (s *CallbacksTestSuite) TestProcessCallback() {
ctx = s.chainB.GetContext()

// set a callback executor that will always succeed after consuming expGasConsumed
callbackExecutor = func(cachedCtx sdk.Context) error {
callbackExecutor = func(cachedCtx sdk.Context) error { //nolint:unparam
cachedCtx.GasMeter().ConsumeGas(expGasConsumed, "callbackExecutor gas consumption")
return nil
}
Expand Down
15 changes: 15 additions & 0 deletions modules/apps/callbacks/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type ContractKeeper interface {
// gas limit, and handle any errors, or panics gracefully.
// If an error is returned, the transaction will be reverted by the callbacks middleware, and the
// packet will not be sent.
//
// Implementations are provided with the packetSenderAddress and MAY choose to use this to perform
// validation on the origin of a given packet. It is recommended to perform the same validation
// on all source chain callbacks (SendPacket, AcknowledgementPacket, TimeoutPacket). This
// defensively guards against exploits due to incorrectly wired SendPacket ordering in IBC stacks.
IBCSendPacketCallback(
ctx sdk.Context,
sourcePort string,
Expand All @@ -31,6 +36,11 @@ type ContractKeeper interface {
// the sender is unknown or undefined. The contract is expected to handle the callback within the
// user defined gas limit, and handle any errors, or panics gracefully.
// If an error is returned, state will be reverted by the callbacks middleware.
//
// Implementations are provided with the packetSenderAddress and MAY choose to use this to perform
// validation on the origin of a given packet. It is recommended to perform the same validation
// on all source chain callbacks (SendPacket, AcknowledgementPacket, TimeoutPacket). This
// defensively guards against exploits due to incorrectly wired SendPacket ordering in IBC stacks.
IBCOnAcknowledgementPacketCallback(
ctx sdk.Context,
packet channeltypes.Packet,
Expand All @@ -44,6 +54,11 @@ type ContractKeeper interface {
// empty if the sender is unknown or undefined. The contract is expected to handle the callback
// within the user defined gas limit, and handle any error, out of gas, or panics gracefully.
// If an error is returned, state will be reverted by the callbacks middleware.
//
// Implementations are provided with the packetSenderAddress and MAY choose to use this to perform
// validation on the origin of a given packet. It is recommended to perform the same validation
// on all source chain callbacks (SendPacket, AcknowledgementPacket, TimeoutPacket). This
// defensively guards against exploits due to incorrectly wired SendPacket ordering in IBC stacks.
IBCOnTimeoutPacketCallback(
ctx sdk.Context,
packet channeltypes.Packet,
Expand Down

0 comments on commit dbbf6b9

Please sign in to comment.