-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: disable x/blobstream in v2 (#3310)
Closes #3305 ## Testing <details> <summary>Manually verified on a local devnet that a user can register an EVM address if the chain is on app version 1.</summary> ```shell $ celestia-appd tx qgb register \ "$(celestia-appd keys show validator --home ${CELESTIA_APP_HOME} --bech val -a)" \ 0x966e6f22781EF6a6A82BBB4DB3df8E225DfD9485 \ --from ${KEY_NAME} \ --home ${CELESTIA_APP_HOME} \ --fees 30000utia \ --broadcast-mode block \ --yes code: 0 codespace: "" data: 12300A2E2F63656C65737469612E7167622E76312E4D7367526567697374657245564D41646472657373526573706F6E7365 events: - attributes: - index: true key: c3BlbmRlcg== value: Y2VsZXN0aWExc3B6YWU4MzNnM2E4dDQwdXN3NTAyZXR4dHo2c2czaG5meDg4OHc= - index: true key: YW1vdW50 value: MzAwMDB1dGlh type: coin_spent - attributes: - index: true key: cmVjZWl2ZXI= value: Y2VsZXN0aWExN3hwZnZha20yYW1nOTYyeWxzNmY4NHoza2VsbDhjNWxwbmpzM3M= - index: true key: YW1vdW50 value: MzAwMDB1dGlh type: coin_received - attributes: - index: true key: cmVjaXBpZW50 value: Y2VsZXN0aWExN3hwZnZha20yYW1nOTYyeWxzNmY4NHoza2VsbDhjNWxwbmpzM3M= - index: true key: c2VuZGVy value: Y2VsZXN0aWExc3B6YWU4MzNnM2E4dDQwdXN3NTAyZXR4dHo2c2czaG5meDg4OHc= - index: true key: YW1vdW50 value: MzAwMDB1dGlh type: transfer - attributes: - index: true key: c2VuZGVy value: Y2VsZXN0aWExc3B6YWU4MzNnM2E4dDQwdXN3NTAyZXR4dHo2c2czaG5meDg4OHc= type: message - attributes: - index: true key: ZmVl value: MzAwMDB1dGlh - index: true key: ZmVlX3BheWVy value: Y2VsZXN0aWExc3B6YWU4MzNnM2E4dDQwdXN3NTAyZXR4dHo2c2czaG5meDg4OHc= type: tx - attributes: - index: true key: YWNjX3NlcQ== value: Y2VsZXN0aWExc3B6YWU4MzNnM2E4dDQwdXN3NTAyZXR4dHo2c2czaG5meDg4OHcvMQ== type: tx - attributes: - index: true key: c2lnbmF0dXJl value: U1lIMjZsRHN4V2JEMzRQdVBMaFl0eXB5NTh6TzhJVHFxc09qYm5Kb0RyVUJSQlFCTEpIdHNuRXY0YXVoaUpCK0ppUExZVVJMc1lESDZ5ZUdKQ3EwaEE9PQ== type: tx - attributes: - index: true key: YWN0aW9u value: L2NlbGVzdGlhLnFnYi52MS5Nc2dSZWdpc3RlckVWTUFkZHJlc3M= type: message gas_used: "66959" gas_wanted: "210000" height: "2" info: "" logs: - events: - attributes: - key: action value: /celestia.qgb.v1.MsgRegisterEVMAddress type: message log: "" msg_index: 0 raw_log: '[{"msg_index":0,"events":[{"type":"message","attributes":[{"key":"action","value":"/celestia.qgb.v1.MsgRegisterEVMAddress"}]}]}]' timestamp: "" tx: null txhash: 60FD4A8507E95637FE97178FBB3F4E202F679D81A59E509C5E72A6815C221085 ``` </details> <details> <summary> Manually verify on a local devnet that a user can't register an EVM address if the chain is on app version 2. </summary> ```shell $ celestia-appd tx qgb register \ "$(celestia-appd keys show validator --home ${CELESTIA_APP_HOME} --bech val -a)" \ 0x966e6f22781EF6a6A82BBB4DB3df8E225DfD9485 \ --from ${KEY_NAME} \ --home ${CELESTIA_APP_HOME} \ --fees 30000utia \ --broadcast-mode block \ --yes code: 37 codespace: sdk data: "" events: [] gas_used: "8786" gas_wanted: "-1" height: "0" info: "" logs: [] raw_log: 'message type /celestia.qgb.v1.MsgRegisterEVMAddress is not supported in version 2: feature not supported' timestamp: "" tx: null txhash: E378761B61CA6D29C36957DBCAE65E4CED82788735BC3CF21A86B677970BCBD9 ``` </details> <details> <summary> Manually verified that tx and query CLI commands don't work. </summary> ```shell $ celestia-appd tx qgb Error: unknown command "qgb" for "tx" $ celestia-appd query qgb Error: unknown command "qgb" for "query" ``` </details> Manually verified that gRPC queries don't work ![Screenshot 2024-04-24 at 2 04 23 PM](https://github.com/celestiaorg/celestia-app/assets/3699047/8ff771a7-1f9e-4ffb-9fa1-7f688b816a09) --------- Co-authored-by: CHAMI Rachid <[email protected]>
- Loading branch information
Showing
9 changed files
with
93 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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,58 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/celestiaorg/celestia-app/v2/test/util" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/stretchr/testify/assert" | ||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types" | ||
version "github.com/tendermint/tendermint/proto/tendermint/version" | ||
) | ||
|
||
func TestAfterValidatorBeginUnbonding(t *testing.T) { | ||
testEnv := util.CreateTestEnv(t) | ||
height := int64(1) | ||
|
||
t.Run("should be a no-op if app version is 2", func(t *testing.T) { | ||
ctx := testEnv.Context.WithBlockHeader(tmproto.Header{Version: version.Consensus{App: 2}, Height: height}) | ||
err := testEnv.BlobstreamKeeper.Hooks().AfterValidatorBeginUnbonding(ctx, sdk.ConsAddress{}, sdk.ValAddress{}) | ||
assert.NoError(t, err) | ||
|
||
got := testEnv.BlobstreamKeeper.GetLatestUnBondingBlockHeight(ctx) | ||
assert.Equal(t, uint64(0), got) | ||
}) | ||
t.Run("should set latest unboding height if app version is 1", func(t *testing.T) { | ||
ctx := testEnv.Context.WithBlockHeader(tmproto.Header{Version: version.Consensus{App: 1}, Height: height}) | ||
err := testEnv.BlobstreamKeeper.Hooks().AfterValidatorBeginUnbonding(ctx, sdk.ConsAddress{}, sdk.ValAddress{}) | ||
assert.NoError(t, err) | ||
|
||
got := testEnv.BlobstreamKeeper.GetLatestUnBondingBlockHeight(ctx) | ||
assert.Equal(t, uint64(height), got) | ||
}) | ||
} | ||
|
||
func TestAfterValidatorCreated(t *testing.T) { | ||
testEnv := util.CreateTestEnv(t) | ||
height := int64(1) | ||
valAddress := sdk.ValAddress([]byte("valAddress")) | ||
t.Run("should be a no-op if app version is 2", func(t *testing.T) { | ||
ctx := testEnv.Context.WithBlockHeader(tmproto.Header{Version: version.Consensus{App: 2}, Height: height}) | ||
err := testEnv.BlobstreamKeeper.Hooks().AfterValidatorCreated(ctx, valAddress) | ||
assert.NoError(t, err) | ||
|
||
address, ok := testEnv.BlobstreamKeeper.GetEVMAddress(ctx, valAddress) | ||
assert.False(t, ok) | ||
assert.Empty(t, address) | ||
}) | ||
t.Run("should set EVM address if app version is 1", func(t *testing.T) { | ||
ctx := testEnv.Context.WithBlockHeader(tmproto.Header{Version: version.Consensus{App: 1}, Height: height}) | ||
err := testEnv.BlobstreamKeeper.Hooks().AfterValidatorCreated(ctx, valAddress) | ||
assert.NoError(t, err) | ||
|
||
address, ok := testEnv.BlobstreamKeeper.GetEVMAddress(ctx, valAddress) | ||
assert.True(t, ok) | ||
assert.Equal(t, common.HexToAddress("0x0000000000000000000076616C41646472657373"), address) | ||
}) | ||
} |
This file contains 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