From 9cefa0d8b88d0e413cd678f57922bb0fe9221301 Mon Sep 17 00:00:00 2001 From: CHAMI Rachid Date: Wed, 18 Oct 2023 10:55:15 +0200 Subject: [PATCH] chore!: rename qgb to blobstream (#2639) ## Overview Closes https://github.com/celestiaorg/celestia-app/issues/2613 ## Checklist - [ ] New and updated code has appropriate documentation - [ ] New and updated code has new and/or updated testing - [ ] Required CI checks are passing - [ ] Visual proof for any user facing features like CLI or documentation updates - [ ] Linked issues closed with keywords --------- Co-authored-by: Josh Stein <46639943+jcstein@users.noreply.github.com> Co-authored-by: Sanaz Taheri <35961250+staheri14@users.noreply.github.com> --- .github/CODEOWNERS | 2 +- Makefile | 2 +- README.md | 2 +- app/app.go | 34 ++--- app/test/qgb_rpc_test.go | 6 +- app/version.go | 4 +- cmd/celestia-appd/cmd/root.go | 4 +- proto/celestia/qgb/v1/genesis.proto | 6 +- proto/celestia/qgb/v1/query.proto | 4 +- proto/celestia/qgb/v1/tx.proto | 4 +- proto/celestia/qgb/v1/types.proto | 4 +- scripts/protocgen.sh | 2 +- specs/src/README.md | 2 +- specs/src/SUMMARY.md | 2 +- specs/src/specs/params.md | 2 +- specs/src/specs/state_machine_modules.md | 2 +- test/util/common.go | 119 +++++++++--------- test/util/genesis/modifier.go | 6 +- x/{qgb => blobstream}/README.md | 74 +++++------ x/{qgb => blobstream}/abci.go | 8 +- x/{qgb => blobstream}/abci_test.go | 93 +++++++------- x/{qgb => blobstream}/client/config.go | 2 +- x/{qgb => blobstream}/client/query.go | 8 +- x/{qgb => blobstream}/client/query_test.go | 2 +- x/{qgb => blobstream}/client/suite_test.go | 8 +- x/{qgb => blobstream}/client/tx.go | 4 +- x/{qgb => blobstream}/client/verify.go | 40 +++--- x/{qgb => blobstream}/genesis.go | 6 +- x/{qgb => blobstream}/integration_test.go | 24 ++-- x/{qgb => blobstream}/keeper/hooks.go | 6 +- x/{qgb => blobstream}/keeper/keeper.go | 6 +- .../keeper/keeper_attestation.go | 2 +- .../keeper/keeper_attestation_test.go | 41 ++++++ .../keeper/keeper_data_commitment.go | 2 +- .../keeper/keeper_data_commitment_test.go | 18 +-- x/{qgb => blobstream}/keeper/keeper_valset.go | 2 +- .../keeper/keeper_valset_test.go | 20 +-- x/{qgb => blobstream}/keeper/msg_server.go | 4 +- .../keeper/msg_server_test.go | 4 +- .../keeper/query_attestation.go | 2 +- .../keeper/query_data_commitment.go | 2 +- x/{qgb => blobstream}/keeper/query_general.go | 2 +- x/{qgb => blobstream}/keeper/query_valset.go | 2 +- x/{qgb => blobstream}/module.go | 12 +- x/blobstream/overview.md | 116 +++++++++++++++++ x/{qgb => blobstream}/types/abi_consts.go | 18 +-- x/{qgb => blobstream}/types/attestation.go | 0 x/{qgb => blobstream}/types/codec.go | 0 .../types/data_commitment.go | 0 x/{qgb => blobstream}/types/errors.go | 0 x/{qgb => blobstream}/types/events.go | 0 x/{qgb => blobstream}/types/genesis.go | 6 +- x/{qgb => blobstream}/types/genesis.pb.go | 16 +-- x/{qgb => blobstream}/types/genesis_test.go | 2 +- x/{qgb => blobstream}/types/keys.go | 0 x/{qgb => blobstream}/types/msgs.go | 0 x/{qgb => blobstream}/types/msgs_test.go | 0 x/{qgb => blobstream}/types/query.pb.go | 113 ++++++++--------- x/{qgb => blobstream}/types/query.pb.gw.go | 0 x/{qgb => blobstream}/types/tx.pb.go | 44 +++---- x/{qgb => blobstream}/types/tx.pb.gw.go | 0 x/{qgb => blobstream}/types/types.go | 0 x/{qgb => blobstream}/types/types.pb.go | 58 ++++----- x/{qgb => blobstream}/types/types_test.go | 2 +- x/{qgb => blobstream}/types/validator.go | 10 +- x/{qgb => blobstream}/types/valset.go | 6 +- x/qgb/keeper/keeper_attestation_test.go | 41 ------ x/qgb/overview.md | 116 ----------------- 68 files changed, 576 insertions(+), 573 deletions(-) rename x/{qgb => blobstream}/README.md (75%) rename x/{qgb => blobstream}/abci.go (97%) rename x/{qgb => blobstream}/abci_test.go (85%) rename x/{qgb => blobstream}/client/config.go (98%) rename x/{qgb => blobstream}/client/query.go (94%) rename x/{qgb => blobstream}/client/query_test.go (95%) rename x/{qgb => blobstream}/client/suite_test.go (83%) rename x/{qgb => blobstream}/client/tx.go (91%) rename x/{qgb => blobstream}/client/verify.go (88%) rename x/{qgb => blobstream}/genesis.go (90%) rename x/{qgb => blobstream}/integration_test.go (74%) rename x/{qgb => blobstream}/keeper/hooks.go (94%) rename x/{qgb => blobstream}/keeper/keeper.go (93%) rename x/{qgb => blobstream}/keeper/keeper_attestation.go (98%) create mode 100644 x/blobstream/keeper/keeper_attestation_test.go rename x/{qgb => blobstream}/keeper/keeper_data_commitment.go (98%) rename x/{qgb => blobstream}/keeper/keeper_data_commitment_test.go (93%) rename x/{qgb => blobstream}/keeper/keeper_valset.go (99%) rename x/{qgb => blobstream}/keeper/keeper_valset_test.go (92%) rename x/{qgb => blobstream}/keeper/msg_server.go (89%) rename x/{qgb => blobstream}/keeper/msg_server_test.go (93%) rename x/{qgb => blobstream}/keeper/query_attestation.go (95%) rename x/{qgb => blobstream}/keeper/query_data_commitment.go (93%) rename x/{qgb => blobstream}/keeper/query_general.go (95%) rename x/{qgb => blobstream}/keeper/query_valset.go (91%) rename x/{qgb => blobstream}/module.go (95%) create mode 100644 x/blobstream/overview.md rename x/{qgb => blobstream}/types/abi_consts.go (86%) rename x/{qgb => blobstream}/types/attestation.go (100%) rename x/{qgb => blobstream}/types/codec.go (100%) rename x/{qgb => blobstream}/types/data_commitment.go (100%) rename x/{qgb => blobstream}/types/errors.go (100%) rename x/{qgb => blobstream}/types/events.go (100%) rename x/{qgb => blobstream}/types/genesis.go (93%) rename x/{qgb => blobstream}/types/genesis.pb.go (96%) rename x/{qgb => blobstream}/types/genesis_test.go (96%) rename x/{qgb => blobstream}/types/keys.go (100%) rename x/{qgb => blobstream}/types/msgs.go (100%) rename x/{qgb => blobstream}/types/msgs_test.go (100%) rename x/{qgb => blobstream}/types/query.pb.go (94%) rename x/{qgb => blobstream}/types/query.pb.gw.go (100%) rename x/{qgb => blobstream}/types/tx.pb.go (88%) rename x/{qgb => blobstream}/types/tx.pb.gw.go (100%) rename x/{qgb => blobstream}/types/types.go (100%) rename x/{qgb => blobstream}/types/types.pb.go (89%) rename x/{qgb => blobstream}/types/types_test.go (99%) rename x/{qgb => blobstream}/types/validator.go (94%) rename x/{qgb => blobstream}/types/valset.go (91%) delete mode 100644 x/qgb/keeper/keeper_attestation_test.go delete mode 100644 x/qgb/overview.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dc5a946948..982f6b94e8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,4 +15,4 @@ # owner is fully deferring ownership to the directory owner docs @liamsi @adlerjohn @evan-forbes @rootulp @cmwaters specs @liamsi @adlerjohn @evan-forbes @rootulp @cmwaters -x/qgb @SweeXordious @evan-forbes +x/blobstream @SweeXordious @evan-forbes diff --git a/Makefile b/Makefile index 8ce978b864..ea12d8a2d6 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ test-race: # TODO: Remove the -skip flag once the following tests no longer contain data races. # https://github.com/celestiaorg/celestia-app/issues/1369 @echo "--> Running tests in race mode" - @go test ./... -v -race -skip "TestPrepareProposalConsistency|TestIntegrationTestSuite|TestQGBRPCQueries|TestSquareSizeIntegrationTest|TestStandardSDKIntegrationTestSuite|TestTxsimCommandFlags|TestTxsimCommandEnvVar|TestMintIntegrationTestSuite|TestQGBCLI|TestUpgrade|TestMaliciousTestNode|TestMaxTotalBlobSizeSuite|TestQGBIntegrationSuite|TestSignerTestSuite|TestPriorityTestSuite|TestTimeInPrepareProposalContext" + @go test ./... -v -race -skip "TestPrepareProposalConsistency|TestIntegrationTestSuite|TestBlobstreamRPCQueries|TestSquareSizeIntegrationTest|TestStandardSDKIntegrationTestSuite|TestTxsimCommandFlags|TestTxsimCommandEnvVar|TestMintIntegrationTestSuite|TestBlobstreamCLI|TestUpgrade|TestMaliciousTestNode|TestMaxTotalBlobSizeSuite|TestQGBIntegrationSuite|TestSignerTestSuite|TestPriorityTestSuite|TestTimeInPrepareProposalContext|TestBlobstream" .PHONY: test-race ## test-bench: Run unit tests in bench mode. diff --git a/README.md b/README.md index ce69c96a9b..42486472aa 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Package-specific READMEs aim to explain implementation details for developers th - [pkg/shares](./pkg/shares/README.md) - [pkg/wrapper](./pkg/wrapper/README.md) - [x/blob](./x/blob/README.md) -- [x/qgb](./x/qgb/README.md) +- [x/blobstream](./x/blobstream/README.md) ## Audits diff --git a/app/app.go b/app/app.go index 7a6ab7acdb..85ef4dddfd 100644 --- a/app/app.go +++ b/app/app.go @@ -92,9 +92,9 @@ import ( "github.com/celestiaorg/celestia-app/x/paramfilter" "github.com/celestiaorg/celestia-app/x/tokenfilter" - qgbmodule "github.com/celestiaorg/celestia-app/x/qgb" - qgbmodulekeeper "github.com/celestiaorg/celestia-app/x/qgb/keeper" - qgbmoduletypes "github.com/celestiaorg/celestia-app/x/qgb/types" + bsmodule "github.com/celestiaorg/celestia-app/x/blobstream" + bsmodulekeeper "github.com/celestiaorg/celestia-app/x/blobstream/keeper" + bsmoduletypes "github.com/celestiaorg/celestia-app/x/blobstream/types" ibctestingtypes "github.com/cosmos/ibc-go/v6/testing/types" ) @@ -153,7 +153,7 @@ var ( transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, blobmodule.AppModuleBasic{}, - qgbmodule.AppModuleBasic{}, + bsmodule.AppModuleBasic{}, ) // ModuleEncodingRegisters keeps track of all the module methods needed to @@ -228,8 +228,8 @@ type App struct { ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper - BlobKeeper blobmodulekeeper.Keeper - QgbKeeper qgbmodulekeeper.Keeper + BlobKeeper blobmodulekeeper.Keeper + BlobstreamKeeper bsmodulekeeper.Keeper // the module manager mm *module.Manager @@ -271,7 +271,7 @@ func New( govtypes.StoreKey, paramstypes.StoreKey, upgrade.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, capabilitytypes.StoreKey, blobmoduletypes.StoreKey, - qgbmoduletypes.StoreKey, + bsmoduletypes.StoreKey, ibctransfertypes.StoreKey, ibchost.StoreKey, ) @@ -336,20 +336,20 @@ func New( app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) app.UpgradeKeeper = upgrade.NewKeeper(keys[upgrade.StoreKey], upgradeSchedule) - app.QgbKeeper = *qgbmodulekeeper.NewKeeper( + app.BlobstreamKeeper = *bsmodulekeeper.NewKeeper( appCodec, - keys[qgbmoduletypes.StoreKey], - app.GetSubspace(qgbmoduletypes.ModuleName), + keys[bsmoduletypes.StoreKey], + app.GetSubspace(bsmoduletypes.ModuleName), &stakingKeeper, ) - qgbmod := qgbmodule.NewAppModule(appCodec, app.QgbKeeper) + bsmod := bsmodule.NewAppModule(appCodec, app.BlobstreamKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks app.StakingKeeper = *stakingKeeper.SetHooks( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), - app.QgbKeeper.Hooks(), + app.BlobstreamKeeper.Hooks(), ), ) @@ -442,7 +442,7 @@ func New( params.NewAppModule(app.ParamsKeeper), transferModule, blobmod, - qgbmod, + bsmod, ) // During begin block slashing happens after distr.BeginBlocker so that @@ -465,7 +465,7 @@ func New( govtypes.ModuleName, genutiltypes.ModuleName, blobmoduletypes.ModuleName, - qgbmoduletypes.ModuleName, + bsmoduletypes.ModuleName, paramstypes.ModuleName, authz.ModuleName, vestingtypes.ModuleName, @@ -488,7 +488,7 @@ func New( banktypes.ModuleName, genutiltypes.ModuleName, blobmoduletypes.ModuleName, - qgbmoduletypes.ModuleName, + bsmoduletypes.ModuleName, paramstypes.ModuleName, authz.ModuleName, vestingtypes.ModuleName, @@ -515,7 +515,7 @@ func New( evidencetypes.ModuleName, ibctransfertypes.ModuleName, blobmoduletypes.ModuleName, - qgbmoduletypes.ModuleName, + bsmoduletypes.ModuleName, vestingtypes.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, @@ -759,7 +759,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(blobmoduletypes.ModuleName) - paramsKeeper.Subspace(qgbmoduletypes.ModuleName) + paramsKeeper.Subspace(bsmoduletypes.ModuleName) return paramsKeeper } diff --git a/app/test/qgb_rpc_test.go b/app/test/qgb_rpc_test.go index 13f1816567..f3b822de1d 100644 --- a/app/test/qgb_rpc_test.go +++ b/app/test/qgb_rpc_test.go @@ -9,14 +9,14 @@ import ( "github.com/celestiaorg/celestia-app/app/encoding" "github.com/celestiaorg/celestia-app/test/util/genesis" "github.com/celestiaorg/celestia-app/test/util/testnode" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func TestQGBRPCQueries(t *testing.T) { +func TestBlobstreamRPCQueries(t *testing.T) { if testing.Short() { - t.Skip("skipping QGB integration test in short mode.") + t.Skip("skipping blobstream integration test in short mode.") } ecfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) cfg := testnode.DefaultConfig().WithModifiers(genesis.SetDataCommitmentWindow(ecfg.Codec, 100)) diff --git a/app/version.go b/app/version.go index 7b711abdaf..3d05ee87cf 100644 --- a/app/version.go +++ b/app/version.go @@ -6,8 +6,8 @@ import ( v1 "github.com/celestiaorg/celestia-app/pkg/appconsts/v1" v2 "github.com/celestiaorg/celestia-app/pkg/appconsts/v2" "github.com/celestiaorg/celestia-app/x/blob" + "github.com/celestiaorg/celestia-app/x/blobstream" "github.com/celestiaorg/celestia-app/x/mint" - "github.com/celestiaorg/celestia-app/x/qgb" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/vesting" @@ -48,7 +48,7 @@ var ( "genutil": genutil.AppModule{}.ConsensusVersion(), "capability": capability.AppModule{}.ConsensusVersion(), "blob": blob.AppModule{}.ConsensusVersion(), - "qgb": qgb.AppModule{}.ConsensusVersion(), + "qgb": blobstream.AppModule{}.ConsensusVersion(), "ibc": ibc.AppModule{}.ConsensusVersion(), "transfer": transfer.AppModule{}.ConsensusVersion(), } diff --git a/cmd/celestia-appd/cmd/root.go b/cmd/celestia-appd/cmd/root.go index 4e48f24dd4..63584c279c 100644 --- a/cmd/celestia-appd/cmd/root.go +++ b/cmd/celestia-appd/cmd/root.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - qgbcmd "github.com/celestiaorg/celestia-app/x/qgb/client" + bscmd "github.com/celestiaorg/celestia-app/x/blobstream/client" "github.com/celestiaorg/celestia-app/app" "github.com/celestiaorg/celestia-app/app/encoding" @@ -145,7 +145,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig encoding.Config) { queryCommand(), txCommand(), keys.Commands(app.DefaultNodeHome), - qgbcmd.VerifyCmd(), + bscmd.VerifyCmd(), ) } diff --git a/proto/celestia/qgb/v1/genesis.proto b/proto/celestia/qgb/v1/genesis.proto index 623c5e71b0..f574d88e4b 100644 --- a/proto/celestia/qgb/v1/genesis.proto +++ b/proto/celestia/qgb/v1/genesis.proto @@ -4,15 +4,15 @@ package celestia.qgb.v1; import "gogoproto/gogo.proto"; import "celestia/qgb/v1/types.proto"; -option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; +option go_package = "github.com/celestiaorg/celestia-app/x/blobstream/types"; -// Params represent the Quantum Gravity Bridge genesis and store parameters. +// Params represent Blobstream genesis and store parameters. message Params { option (gogoproto.stringer) = false; uint64 data_commitment_window = 1; } -// GenesisState struct, containing all persistent data required by the QGB +// GenesisState struct, containing all persistent data required by Blobstream // module message GenesisState { Params params = 1; } diff --git a/proto/celestia/qgb/v1/query.proto b/proto/celestia/qgb/v1/query.proto index d09d5ee80f..bfb19047c5 100644 --- a/proto/celestia/qgb/v1/query.proto +++ b/proto/celestia/qgb/v1/query.proto @@ -8,11 +8,11 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; -option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; +option go_package = "github.com/celestiaorg/celestia-app/x/blobstream/types"; // Query defines the gRPC querier service. service Query { - // Params queries the current parameters for the qgb module + // Params queries the current parameters for the blobstream module rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/qgb/v1/params"; } diff --git a/proto/celestia/qgb/v1/tx.proto b/proto/celestia/qgb/v1/tx.proto index 62c808ba63..b9c4fe1e58 100644 --- a/proto/celestia/qgb/v1/tx.proto +++ b/proto/celestia/qgb/v1/tx.proto @@ -5,9 +5,9 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; +option go_package = "github.com/celestiaorg/celestia-app/x/blobstream/types"; -// Msg is the message server for receiving qgb transactions +// Msg is the message server for receiving Blobstream transactions service Msg { // RegisterEVMAddress records an evm address for the validator which is used // by the relayer to aggregate signatures. A validator can only register a diff --git a/proto/celestia/qgb/v1/types.proto b/proto/celestia/qgb/v1/types.proto index 386c278eae..266788e2ab 100644 --- a/proto/celestia/qgb/v1/types.proto +++ b/proto/celestia/qgb/v1/types.proto @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; +option go_package = "github.com/celestiaorg/celestia-app/x/blobstream/types"; // BridgeValidator represents a validator's ETH address and its power message BridgeValidator { @@ -15,7 +15,7 @@ message BridgeValidator { string evm_address = 2; } -// Valset is the EVM Bridge Multsig Set, each qgb validator also +// Valset is the EVM Bridge Multsig Set, each Blobstream validator also // maintains an ETH key to sign messages, these are used to check signatures on // ETH because of the significant gas savings message Valset { diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 3d2f937082..670da62783 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -26,7 +26,7 @@ cd .. # temporary import hack to use cosmos-sdk implementation of Any type. # check https://github.com/celestiaorg/celestia-app/issues/507 for more information. sed -i 's/types "github.com\/celestiaorg\/celestia-app\/codec\/types"/types "github.com\/cosmos\/cosmos-sdk\/codec\/types"/g' \ - github.com/celestiaorg/celestia-app/x/qgb/types/query.pb.go + github.com/celestiaorg/celestia-app/x/blobstream/types/query.pb.go # move proto files to the right places cp -r github.com/celestiaorg/celestia-app/* ./ diff --git a/specs/src/README.md b/specs/src/README.md index 9b2a20f47d..13a04c2c25 100644 --- a/specs/src/README.md +++ b/specs/src/README.md @@ -16,7 +16,7 @@ - [Resource Pricing](./specs/resource_pricing.md) - [State Machine Modules](./specs/state_machine_modules.md) - [blob](https://github.com/celestiaorg/celestia-app/blob/main/x/blob/README.md) - - [qgb](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/README.md) + - [blobstream](https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/README.md) - [mint](https://github.com/celestiaorg/celestia-app/blob/main/x/mint/README.md) - [paramfilter](https://github.com/celestiaorg/celestia-app/blob/main/x/paramfilter/README.md) - [upgrade](https://github.com/celestiaorg/celestia-app/blob/main/x/upgrade/README.md) diff --git a/specs/src/SUMMARY.md b/specs/src/SUMMARY.md index 1f11797ed1..655f7509c6 100644 --- a/specs/src/SUMMARY.md +++ b/specs/src/SUMMARY.md @@ -18,7 +18,7 @@ - [Resource Pricing](./specs/resource_pricing.md) - [State Machine Modules](./specs/state_machine_modules.md) - [blob](https://github.com/celestiaorg/celestia-app/blob/main/x/blob/README.md) - - [qgb](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/README.md) + - [blobstream](https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/README.md) - [mint](https://github.com/celestiaorg/celestia-app/blob/main/x/mint/README.md) - [paramfilter](https://github.com/celestiaorg/celestia-app/blob/main/x/paramfilter/README.md) - [upgrade](https://github.com/celestiaorg/celestia-app/blob/main/x/upgrade/README.md) diff --git a/specs/src/specs/params.md b/specs/src/specs/params.md index 4282eecdb7..17ab719485 100644 --- a/specs/src/specs/params.md +++ b/specs/src/specs/params.md @@ -56,4 +56,4 @@ are blocked by the `x/paramfilter` module. | mint.InitialInflationRate | 0.08 (8%) | The inflation rate the network starts at. | False | | mint.DisinflationRate | 0.10 (10%) | The rate at which the inflation rate decreases each year. | False | | mint.TargetInflationRate | 0.015 (1.5%) | The inflation rate that the network aims to stabalize at. | False | -| qgb.DataCommitmentWindow | 400 | Number of blocks that are included in a signed batch (DataCommitment). | True | +| blobstream.DataCommitmentWindow | 400 | Number of blocks that are included in a signed batch (DataCommitment). | True | diff --git a/specs/src/specs/state_machine_modules.md b/specs/src/specs/state_machine_modules.md index d42f844cb9..8f81cca0f8 100644 --- a/specs/src/specs/state_machine_modules.md +++ b/specs/src/specs/state_machine_modules.md @@ -5,7 +5,7 @@ Celestia app is built using the cosmos-sdk, and follows standard cosmos-sdk modu ## `celestia-app` Specific Modules - [blob](https://github.com/celestiaorg/celestia-app/blob/main/x/blob/README.md) -- [qgb](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/README.md) +- [blobstream](https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/README.md) - [mint](https://github.com/celestiaorg/celestia-app/blob/main/x/mint/README.md) - [paramfilter](https://github.com/celestiaorg/celestia-app/blob/main/x/paramfilter/README.md) - [upgrade](https://github.com/celestiaorg/celestia-app/blob/main/x/upgrade/README.md) diff --git a/test/util/common.go b/test/util/common.go index fcd657744d..202370e0d9 100644 --- a/test/util/common.go +++ b/test/util/common.go @@ -5,11 +5,12 @@ import ( "testing" "time" + "github.com/celestiaorg/celestia-app/x/blobstream" + cosmosmath "cosmossdk.io/math" "github.com/celestiaorg/celestia-app/app" - "github.com/celestiaorg/celestia-app/x/qgb" - "github.com/celestiaorg/celestia-app/x/qgb/keeper" - qgbtypes "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/keeper" + bstypes "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" ccodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -134,25 +135,25 @@ func initEVMAddrs(count int) []gethcommon.Address { return addresses } -// TestInput stores the various keepers required to test the QGB +// TestInput stores the various keepers required to test Blobstream type TestInput struct { - QgbKeeper keeper.Keeper - AccountKeeper authkeeper.AccountKeeper - StakingKeeper stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - DistKeeper distrkeeper.Keeper - BankKeeper bankkeeper.BaseKeeper - Context sdk.Context - Marshaler codec.Codec - LegacyAmino *codec.LegacyAmino + BlobstreamKeeper keeper.Keeper + AccountKeeper authkeeper.AccountKeeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + DistKeeper distrkeeper.Keeper + BankKeeper bankkeeper.BaseKeeper + Context sdk.Context + Marshaler codec.Codec + LegacyAmino *codec.LegacyAmino } -// CreateTestEnvWithoutQGBKeysInit creates the keeper testing environment for the QGB -func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { +// CreateTestEnvWithoutBlobstreamKeysInit creates the keeper testing environment for Blobstream +func CreateTestEnvWithoutBlobstreamKeysInit(t *testing.T) TestInput { t.Helper() // Initialize store keys - qgbKey := sdk.NewKVStoreKey(qgbtypes.StoreKey) + bsKey := sdk.NewKVStoreKey(bstypes.StoreKey) keyAcc := sdk.NewKVStoreKey(authtypes.StoreKey) keyStaking := sdk.NewKVStoreKey(stakingtypes.StoreKey) keyBank := sdk.NewKVStoreKey(banktypes.StoreKey) @@ -164,7 +165,7 @@ func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { // Initialize memory database and mount stores on it db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(qgbKey, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(bsKey, storetypes.StoreTypeIAVL, db) ms.MountStoreWithDB(keyAcc, storetypes.StoreTypeIAVL, db) ms.MountStoreWithDB(keyParams, storetypes.StoreTypeIAVL, db) ms.MountStoreWithDB(keyStaking, storetypes.StoreTypeIAVL, db) @@ -210,7 +211,7 @@ func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { paramsKeeper.Subspace(banktypes.ModuleName) paramsKeeper.Subspace(stakingtypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(qgbtypes.DefaultParamspace) + paramsKeeper.Subspace(bstypes.DefaultParamspace) paramsKeeper.Subspace(slashingtypes.ModuleName) // this is also used to initialize module accounts for all the map keys @@ -219,7 +220,7 @@ func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { distrtypes.ModuleName: nil, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - qgbtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + bstypes.ModuleName: {authtypes.Minter, authtypes.Burner}, } accountKeeper := authkeeper.NewAccountKeeper( @@ -266,16 +267,16 @@ func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { for name, perms := range maccPerms { mod := authtypes.NewEmptyModuleAccount(name, perms...) if name == stakingtypes.NotBondedPoolName { - err = bankKeeper.MintCoins(ctx, qgbtypes.ModuleName, totalSupply) + err = bankKeeper.MintCoins(ctx, bstypes.ModuleName, totalSupply) require.NoError(t, err) - err = bankKeeper.SendCoinsFromModuleToModule(ctx, qgbtypes.ModuleName, mod.Name, totalSupply) + err = bankKeeper.SendCoinsFromModuleToModule(ctx, bstypes.ModuleName, mod.Name, totalSupply) require.NoError(t, err) } else if name == distrtypes.ModuleName { // some big pot to pay out amt := sdk.NewCoins(sdk.NewInt64Coin("stake", 500000)) - err = bankKeeper.MintCoins(ctx, qgbtypes.ModuleName, amt) + err = bankKeeper.MintCoins(ctx, bstypes.ModuleName, amt) require.NoError(t, err) - err = bankKeeper.SendCoinsFromModuleToModule(ctx, qgbtypes.ModuleName, mod.Name, amt) + err = bankKeeper.SendCoinsFromModuleToModule(ctx, bstypes.ModuleName, mod.Name, amt) require.NoError(t, err) } accountKeeper.SetModuleAccount(ctx, mod) @@ -292,9 +293,9 @@ func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { getSubspace(paramsKeeper, slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()), ) - k := keeper.NewKeeper(marshaler, qgbKey, getSubspace(paramsKeeper, qgbtypes.DefaultParamspace), &stakingKeeper) - testQGBParams := qgbtypes.DefaultGenesis().Params - k.SetParams(ctx, *testQGBParams) + k := keeper.NewKeeper(marshaler, bsKey, getSubspace(paramsKeeper, bstypes.DefaultParamspace), &stakingKeeper) + testBlobstreamParams := bstypes.DefaultGenesis().Params + k.SetParams(ctx, *testBlobstreamParams) stakingKeeper = *stakingKeeper.SetHooks( stakingtypes.NewMultiStakingHooks( @@ -304,23 +305,23 @@ func CreateTestEnvWithoutQGBKeysInit(t *testing.T) TestInput { ), ) return TestInput{ - QgbKeeper: *k, - AccountKeeper: accountKeeper, - BankKeeper: bankKeeper, - StakingKeeper: stakingKeeper, - SlashingKeeper: slashingKeeper, - DistKeeper: distKeeper, - Context: ctx, - Marshaler: marshaler, - LegacyAmino: cdc, + BlobstreamKeeper: *k, + AccountKeeper: accountKeeper, + BankKeeper: bankKeeper, + StakingKeeper: stakingKeeper, + SlashingKeeper: slashingKeeper, + DistKeeper: distKeeper, + Context: ctx, + Marshaler: marshaler, + LegacyAmino: cdc, } } -// CreateTestEnv creates the keeper testing environment for QGB +// CreateTestEnv creates the keeper testing environment for Blobstream func CreateTestEnv(t *testing.T) TestInput { - input := CreateTestEnvWithoutQGBKeysInit(t) - input.QgbKeeper.SetLatestAttestationNonce(input.Context, qgb.InitialLatestAttestationNonce) - input.QgbKeeper.SetEarliestAvailableAttestationNonce(input.Context, qgb.InitialEarliestAvailableAttestationNonce) + input := CreateTestEnvWithoutBlobstreamKeysInit(t) + input.BlobstreamKeeper.SetLatestAttestationNonce(input.Context, blobstream.InitialLatestAttestationNonce) + input.BlobstreamKeeper.SetEarliestAvailableAttestationNonce(input.Context, blobstream.InitialEarliestAvailableAttestationNonce) return input } @@ -334,7 +335,7 @@ func MakeTestCodec() *codec.LegacyAmino { sdk.RegisterLegacyAminoCodec(cdc) ccodec.RegisterCrypto(cdc) params.AppModuleBasic{}.RegisterLegacyAminoCodec(cdc) - qgbtypes.RegisterLegacyAminoCodec(cdc) + bstypes.RegisterLegacyAminoCodec(cdc) return cdc } @@ -349,7 +350,7 @@ func MakeTestMarshaler() codec.Codec { interfaceRegistry := codectypes.NewInterfaceRegistry() std.RegisterInterfaces(interfaceRegistry) ModuleBasics.RegisterInterfaces(interfaceRegistry) - qgbtypes.RegisterInterfaces(interfaceRegistry) + bstypes.RegisterInterfaces(interfaceRegistry) return codec.NewProtoCodec(interfaceRegistry) } @@ -391,8 +392,8 @@ func CreateValidator( ) // Set the balance for the account - require.NoError(t, input.BankKeeper.MintCoins(input.Context, qgbtypes.ModuleName, InitCoins)) - err := input.BankKeeper.SendCoinsFromModuleToAccount(input.Context, qgbtypes.ModuleName, acc.GetAddress(), InitCoins) + require.NoError(t, input.BankKeeper.MintCoins(input.Context, bstypes.ModuleName, InitCoins)) + err := input.BankKeeper.SendCoinsFromModuleToAccount(input.Context, bstypes.ModuleName, acc.GetAddress(), InitCoins) require.NoError(t, err) // Set the account in state @@ -411,9 +412,9 @@ func RegisterEVMAddress( valAddr sdk.ValAddress, evmAddr gethcommon.Address, ) { - qgbMsgServer := keeper.NewMsgServerImpl(input.QgbKeeper) - registerMsg := qgbtypes.NewMsgRegisterEVMAddress(valAddr, evmAddr) - _, err := qgbMsgServer.RegisterEVMAddress(input.Context, registerMsg) + bsMsgServer := keeper.NewMsgServerImpl(input.BlobstreamKeeper) + registerMsg := bstypes.NewMsgRegisterEVMAddress(valAddr, evmAddr) + _, err := bsMsgServer.RegisterEVMAddress(input.Context, registerMsg) require.NoError(t, err) } @@ -450,7 +451,7 @@ func SetupTestChain(t *testing.T, weights []uint64) (TestInput, sdk.Context) { // Initialize each of the validators stakingMsgServer := stakingkeeper.NewMsgServerImpl(input.StakingKeeper) - qgbMsgServer := keeper.NewMsgServerImpl(input.QgbKeeper) + bsMsgServer := keeper.NewMsgServerImpl(input.BlobstreamKeeper) for i, weight := range weights { consPrivKey := ed25519.GenPrivKey() consPubKey := consPrivKey.PubKey() @@ -467,8 +468,8 @@ func SetupTestChain(t *testing.T, weights []uint64) (TestInput, sdk.Context) { // Set the balance for the account weightCoins := sdk.NewCoins(sdk.NewInt64Coin(TestingStakeParams.BondDenom, int64(weight))) - require.NoError(t, input.BankKeeper.MintCoins(input.Context, qgbtypes.ModuleName, weightCoins)) - require.NoError(t, input.BankKeeper.SendCoinsFromModuleToAccount(input.Context, qgbtypes.ModuleName, accAddr, weightCoins)) + require.NoError(t, input.BankKeeper.MintCoins(input.Context, bstypes.ModuleName, weightCoins)) + require.NoError(t, input.BankKeeper.SendCoinsFromModuleToAccount(input.Context, bstypes.ModuleName, accAddr, weightCoins)) // Set the account in state input.AccountKeeper.SetAccount(input.Context, acc) @@ -481,8 +482,8 @@ func SetupTestChain(t *testing.T, weights []uint64) (TestInput, sdk.Context) { ) require.NoError(t, err) - registerMsg := qgbtypes.NewMsgRegisterEVMAddress(valAddr, EVMAddrs[i]) - _, err = qgbMsgServer.RegisterEVMAddress(input.Context, registerMsg) + registerMsg := bstypes.NewMsgRegisterEVMAddress(valAddr, EVMAddrs[i]) + _, err = bsMsgServer.RegisterEVMAddress(input.Context, registerMsg) require.NoError(t, err) // Run the staking endblocker to ensure valset is correct in state @@ -503,25 +504,25 @@ func NewTestMsgUnDelegateValidator(address sdk.ValAddress, amt cosmosmath.Int) * return msg } -// ExecuteQGBHeights executes the end exclusive range of heights specified by beginHeight and endHeight -// along with the QGB abci.EndBlocker on each one of them. +// ExecuteBlobstreamHeights executes the end exclusive range of heights specified by beginHeight and endHeight +// along with the Blobstream abci.EndBlocker on each one of them. // Returns the updated context with block height advanced to endHeight. -func ExecuteQGBHeights(ctx sdk.Context, qgbKeeper keeper.Keeper, beginHeight int64, endHeight int64) sdk.Context { +func ExecuteBlobstreamHeights(ctx sdk.Context, bsKeeper keeper.Keeper, beginHeight int64, endHeight int64) sdk.Context { for i := beginHeight; i < endHeight; i++ { ctx = ctx.WithBlockHeight(i) - qgb.EndBlocker(ctx, qgbKeeper) + blobstream.EndBlocker(ctx, bsKeeper) } return ctx } -// ExecuteQGBHeightsWithTime executes the end exclusive range of heights specified by beginHeight and endHeight -// along with the QGB abci.EndBlocker on each one of them. +// ExecuteBlobstreamHeightsWithTime executes the end exclusive range of heights specified by beginHeight and endHeight +// along with the Blobstream abci.EndBlocker on each one of them. // Uses the interval to calculate the block header time. -func ExecuteQGBHeightsWithTime(ctx sdk.Context, qgbKeeper keeper.Keeper, beginHeight int64, endHeight int64, blockInterval time.Duration) sdk.Context { +func ExecuteBlobstreamHeightsWithTime(ctx sdk.Context, bsKeeper keeper.Keeper, beginHeight int64, endHeight int64, blockInterval time.Duration) sdk.Context { blockTime := ctx.BlockTime() for i := beginHeight; i < endHeight; i++ { ctx = ctx.WithBlockHeight(i).WithBlockTime(blockTime) - qgb.EndBlocker(ctx, qgbKeeper) + blobstream.EndBlocker(ctx, bsKeeper) blockTime = blockTime.Add(blockInterval) } return ctx diff --git a/test/util/genesis/modifier.go b/test/util/genesis/modifier.go index 9ffe274d11..234b17bf49 100644 --- a/test/util/genesis/modifier.go +++ b/test/util/genesis/modifier.go @@ -6,7 +6,7 @@ import ( "github.com/celestiaorg/celestia-app/app" blobtypes "github.com/celestiaorg/celestia-app/x/blob/types" - qgbtypes "github.com/celestiaorg/celestia-app/x/qgb/types" + bstypes "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -49,9 +49,9 @@ func ImmediateProposals(codec codec.Codec) Modifier { // qgb module's genesis state. func SetDataCommitmentWindow(codec codec.Codec, window uint64) Modifier { return func(state map[string]json.RawMessage) map[string]json.RawMessage { - qgbGenState := qgbtypes.DefaultGenesis() + qgbGenState := bstypes.DefaultGenesis() qgbGenState.Params.DataCommitmentWindow = window - state[qgbtypes.ModuleName] = codec.MustMarshalJSON(qgbGenState) + state[bstypes.ModuleName] = codec.MustMarshalJSON(qgbGenState) return state } } diff --git a/x/qgb/README.md b/x/blobstream/README.md similarity index 75% rename from x/qgb/README.md rename to x/blobstream/README.md index 8cf791c16f..f040e3a0ba 100644 --- a/x/qgb/README.md +++ b/x/blobstream/README.md @@ -1,14 +1,14 @@ -# `x/qgb` +# `x/blobstream` ## Concepts -This module contains the [Quantum Gravity Bridge](https://blog.celestia.org/celestiums/) (QGB) state machine implementation. +This module contains the [Blobstream](https://blog.celestia.org/celestiums/) state machine implementation. -The QGB state machine is responsible for creating attestations which are signed by [orchestrators](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md), and submitted to EVM chains by [relayers](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md). +The Blobstream state machine is responsible for creating attestations which are signed by [orchestrators](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md), and submitted to EVM chains by [relayers](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md). ### Attestations types -[Attestations](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/types/attestation.go#L10-L18) are requests for signatures generated by the state machine during the `EndBlock` phase. They facilitate alignment between orchestrators and relayers on which data to sign, and when to relay it. +[Attestations](https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/types/attestation.go#L10-L18) are requests for signatures generated by the state machine during the `EndBlock` phase. They facilitate alignment between orchestrators and relayers on which data to sign, and when to relay it. There are two types of attestations, [valsets](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/proto/celestia/qgb/v1/types.proto#L18-L33) and [data commitments](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/proto/celestia/qgb/v1/types.proto#L35-L55). @@ -16,12 +16,12 @@ There are two types of attestations, [valsets](https://github.com/celestiaorg/ce A valset is an attestation type representing a validator set change. It allows for the validator set to change over heights which in turn defines which orchestrator should sign the attestations. -When an orchestrator sees a newly generated valset published by the Celestia state machine, it queries the previous valset and checks whether it's part of its validator set. Then, the orchestrator signs the new valset and submits that signature to the [QGB P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66). Otherwise, it ignores it and waits for new attestations. +When an orchestrator sees a newly generated valset published by the Celestia state machine, it queries the previous valset and checks whether it's part of its validator set. Then, the orchestrator signs the new valset and submits that signature to the [Blobstream P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66). Otherwise, it ignores it and waits for new attestations. A valset is comprised of the following fields: ```protobuf -// Valset is the EVM Bridge Multsig Set, each qgb validator also +// Valset is the EVM Bridge Multsig Set, each blobstream validator also // maintains an ETH key to sign messages, these are used to check signatures on // ETH because of the significant gas savings message Valset { @@ -51,16 +51,16 @@ message BridgeValidator { } ``` -1. `nonce`: is the universal nonce of the attestation. It is used to prevent front running attacks in the QGB smart contract. More details can be found in [ADR-004](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md). +1. `nonce`: is the universal nonce of the attestation. It is used to prevent front running attacks in the Blobstream smart contract. More details can be found in [ADR-004](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md). 2. `members`: contains the current validator set. 3. `height`: is the height at which the valset was created. 4. `time`: is the timestamp of the height at which the valset was created. #### Validator power normalization -The [QGB bridge power](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/proto/celestia/qgb/v1/types.proto#L12-L13) is obtained by [normalizing](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/x/qgb/keeper/keeper_valset.go#L125-L150) the validators' voting power using the [min-max normalization](https://en.wikipedia.org/wiki/Feature_scaling) formula. This formula takes into account the ratio of each validator's voting power to the total voting power in the block and scales it to a value between `0` and `2^32`. +The [Blobstream bridge power](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/proto/celestia/qgb/v1/types.proto#L12-L13) is obtained by [normalizing](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/x/qgb/keeper/keeper_valset.go#L125-L150) the validators' voting power using the [min-max normalization](https://en.wikipedia.org/wiki/Feature_scaling) formula. This formula takes into account the ratio of each validator's voting power to the total voting power in the block and scales it to a value between `0` and `2^32`. -By normalizing the voting power, we can significantly reduce the frequency of generating new validator set updates. For example, if there is a small increase in the total on-chain voting power due to inflation, there is no need to create a new validator set. This is because the relative proportions of the validators remain the same, and the normalized QGB power doesn't show any significant difference. +By normalizing the voting power, we can significantly reduce the frequency of generating new validator set updates. For example, if there is a small increase in the total on-chain voting power due to inflation, there is no need to create a new validator set. This is because the relative proportions of the validators remain the same, and the normalized Blobstream power doesn't show any significant difference. To ensure that the normalization process doesn't encounter overflow errors, the function normalizeValidatorPower uses [`BigInt`](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/x/qgb/keeper/keeper_valset.go#LL142C1-L142C1) operations. It scales the raw power value with respect to the total validator power, making sure the result falls within the range of 0 to `2^32`. @@ -68,13 +68,13 @@ This mechanism allows to increase/decrease the frequency at which validator set #### Power diff -[`PowerDiff(...)`](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/x/qgb/types/validator.go#L100-L141) is a function that calculates the difference in power between two sets of bridge validators. It's important to note that the power being compared is not the regular voting power in the Celestia consensus network, but a specific type called QGB bridge power (explained above). +[`PowerDiff(...)`](https://github.com/celestiaorg/celestia-app/blob/6243f26fc419c32940d5dc4eb60b0e0aaf08eaa7/x/qgb/types/validator.go#L100-L141) is a function that calculates the difference in power between two sets of bridge validators. It's important to note that the power being compared is not the regular voting power in the Celestia consensus network, but a specific type called Blobstream bridge power (explained above). ### Data commitments -A data commitment is an attestation type representing a request to commit over a set of blocks. It provides an end exclusive range of blocks for orchestrators to sign over and propagate in the QGB P2P network. The range is defined by the param [`DataCommitmentWindow`](https://github.com/celestiaorg/celestia-app/blob/fc83b04c3a5638ac8d415770e38a4046b84fa128/x/qgb/keeper/keeper_data_commitment.go#L44-L50), more on this below. +A data commitment is an attestation type representing a request to commit over a set of blocks. It provides an end exclusive range of blocks for orchestrators to sign over and propagate in the Blobstream P2P network. The range is defined by the param [`DataCommitmentWindow`](https://github.com/celestiaorg/celestia-app/blob/fc83b04c3a5638ac8d415770e38a4046b84fa128/x/qgb/keeper/keeper_data_commitment.go#L44-L50), more on this below. -When an orchestrator sees a newly generated data commitment, it queries the previous valset and checks whether it's part of its validator set. Then, the orchestrator signs the new data commitment and submits that signature to the [QGB P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66). Otherwise, it ignores it and waits for new attestations. +When an orchestrator sees a newly generated data commitment, it queries the previous valset and checks whether it's part of its validator set. Then, the orchestrator signs the new data commitment and submits that signature to the [Blobstream P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66). Otherwise, it ignores it and waits for new attestations. A data commitment is comprised of the following fields: @@ -102,7 +102,7 @@ message DataCommitment { } ``` -1. `nonce`: is the universal nonce of the attestation. It is used to prevent front running attacks in the QGB smart contract. More details can be found in [ADR-004](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md). +1. `nonce`: is the universal nonce of the attestation. It is used to prevent front running attacks in the Blobstream smart contract. More details can be found in [ADR-004](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md). 2. `begin_block`: the data commitment range first block. 3. `end_block`: the data commitment range last block. The range is end exclusive. Thus, the commitment will be over the set of blocks defined by `[begin_block, end_block)`. 4. `time`: is the timestamp of the height at which the data commitment was created. @@ -132,7 +132,7 @@ struct DataRootTuple { 2. `dataRoot`: the data root, aka data hash, of the block. 3. `squareSize`: the [square](https://celestiaorg.github.io/celestia-app/specs/data_structures.html#arranging-available-data-into-shares) size of the block. -These commitments are queried by orchestrators from [Celestia-core](https://github.com/celestiaorg/celestia-core/blob/d280f37a8376ed54ae03b10896fa25a4cbbc6d5b/rpc/core/blocks.go#L178-L195), signed, then submitted to the QGB P2P network as described [here](https://github.com/celestiaorg/orchestrator-relayer/blob/35b5df94c1602eb5e93a32d1bc6e5c8a4b5861e5/orchestrator/orchestrator.go#L331-L357). +These commitments are queried by orchestrators from [Celestia-core](https://github.com/celestiaorg/celestia-core/blob/d280f37a8376ed54ae03b10896fa25a4cbbc6d5b/rpc/core/blocks.go#L178-L195), signed, then submitted to the Blobstream P2P network as described [here](https://github.com/celestiaorg/orchestrator-relayer/blob/35b5df94c1602eb5e93a32d1bc6e5c8a4b5861e5/orchestrator/orchestrator.go#L331-L357). ## State @@ -147,13 +147,13 @@ Both types of attestations are set using the [`SetAttestationRequest(...)`](http ### Latest attestation nonce -The latest attestation nonce represents the most recently generated nonce in the QGB state machine store. It is [initialized to 0](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/genesis.go#L12) in genesis, and gets incremented at block 1. +The latest attestation nonce represents the most recently generated nonce in the Blobstream state machine store. It is [initialized to 0](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/genesis.go#L12) in genesis, and gets incremented at block 1. | Name | Key | |------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| | LatestAttestationNonce | [`[LatestAttestationNonce]`](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/types/keys.go#L32-L33) | -The latest attestation nonce can be set to the QGB state machine store using the [`SetLatestAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/keeper/keeper_attestation.go#L44-L57) method and retrieved using the [`GetLatestAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/keeper/keeper_attestation.go#L67-L79). +The latest attestation nonce can be set to the Blobstream state machine store using the [`SetLatestAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/keeper/keeper_attestation.go#L44-L57) method and retrieved using the [`GetLatestAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/keeper/keeper_attestation.go#L67-L79). To check if the latest attestation nonce is defined in store, use the [`CheckLatestAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/x/qgb/keeper/keeper_attestation.go#L59-L65) method. @@ -166,17 +166,17 @@ The latest unbonding height indicates the most recent height at which some valid |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| | LatestUnBondingBlockHeight | [`[LatestUnBondingBlockHeight]`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/types/keys.go#L28-L30) | -The latest unbonding height can be set to the QGB state machine store using the [`SetLatestUnBondingBlockHeight(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_valset.go#L58-L64) method, and it is called in a `hook` when a validator starts unbonding. More details on hooks are below. +The latest unbonding height can be set to the Blobstream state machine store using the [`SetLatestUnBondingBlockHeight(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_valset.go#L58-L64) method, and it is called in a `hook` when a validator starts unbonding. More details on hooks are below. ### Earliest attestation nonce -The earliest attestation nonce corresponds to the nonce of the earliest generated attestation in the QGB state machine store. It is [initialized to 1](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/genesis.go#L13-L17) in genesis, and gets incremented updated when [pruning](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/abci.go#L184-L185). +The earliest attestation nonce corresponds to the nonce of the earliest generated attestation in the Blobstream state machine store. It is [initialized to 1](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/genesis.go#L13-L17) in genesis, and gets incremented updated when [pruning](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/abci.go#L184-L185). | Name | Key | |------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| | EarliestAvailableAttestationNonce | [`[EarliestAvailableAttestationNonce]`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/types/keys.go#L35-L37) | -The earliest attestation nonce can be set to the QGB state machine store using the [`SetEarliestAvailableAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_attestation.go#L104-L110) method, and retrieved using the [`GetEarliestAvailableAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_attestation.go#L89-L102). +The earliest attestation nonce can be set to the Blobstream state machine store using the [`SetEarliestAvailableAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_attestation.go#L104-L110) method, and retrieved using the [`GetEarliestAvailableAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_attestation.go#L89-L102). To check if the earliest attestation nonce is defined in store, use the [`CheckEarliestAvailableAttestationNonce(...)`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/keeper/keeper_attestation.go#L81-L87) method. @@ -216,13 +216,13 @@ After a range update, the [`handler`](https://github.com/celestiaorg/celestia-ap ### Pruning -The third action done during the QGB [`EndBlock`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/abci.go#L28-L35) step is pruning. +The third action done during the Blobstream [`EndBlock`](https://github.com/celestiaorg/celestia-app/blob/9bf0cf1dd9ce31a3fecb51310c3913820b21a8c2/x/qgb/abci.go#L28-L35) step is pruning. -The QGB state machine prunes old attestations up to the specified [`AttestationExpiryTime`](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L22-L25), which is currently set to 3 weeks, matching the consensus unbonding time. +The Blobstream state machine prunes old attestations up to the specified [`AttestationExpiryTime`](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L22-L25), which is currently set to 3 weeks, matching the consensus unbonding time. So, on every block height, the state machine [checks](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L140-L157) whether there are any [`expired`](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L22-L25) attestations. Then, it starts [pruning](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L161-L182) via calling the [`DeleteAttestation(...)`](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/keeper/keeper_attestation.go#L128-L139) method. Then, it [`prints`](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L186-L194) a log message specifying the number of pruned attestations. -If the all the attestations in store are expired, which is an edge case that should never occur, the QGB state machine [doesn't prune](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L161) the latest attestation. +If the all the attestations in store are expired, which is an edge case that should never occur, the Blobstream state machine [doesn't prune](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/abci.go#L161) the latest attestation. ### Hooks @@ -234,20 +234,20 @@ When a validator starts unbonding, a [hook](https://github.com/celestiaorg/celes ### New attestation event -After creating a new attestation, and adding it to the QGB store, an event is [emitted](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/keeper/keeper_attestation.go#L16-L22) containing its nonce. +After creating a new attestation, and adding it to the Blobstream store, an event is [emitted](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/keeper/keeper_attestation.go#L16-L22) containing its nonce. ## Client ### Query attestation command -The QGB query attestation command is part of the `celestia-appd` binary. It allows the user to query specific attestations by their corresponding nonce. +The Blobstream query attestation command is part of the `celestia-appd` binary. It allows the user to query specific attestations by their corresponding nonce. ```shell -$ celestia-appd query qgb attestation --help +$ celestia-appd query blobstream attestation --help query an attestation by nonce Usage: - celestia-appd query qgb attestation [flags] + celestia-appd query blobstream attestation [flags] Aliases: attestation, att @@ -255,20 +255,20 @@ Aliases: ### Verification command -The QGB verification command is part of the `celestia-appd` binary. It allows the user to verify that a set of shares has been posted to a specific QGB contract. +The Blobstream verification command is part of the `celestia-appd` binary. It allows the user to verify that a set of shares has been posted to a specific Blobstream contract. ```shell $ celestia-appd verify --help -Verifies that a transaction hash, a range of shares, or a blob referenced by its transaction hash were committed to by the QGB contract +Verifies that a transaction hash, a range of shares, or a blob referenced by its transaction hash were committed to by the Blobstream contract Usage: celestia-appd verify [command] Available Commands: - blob Verifies that a blob, referenced by its transaction hash, in hex format, has been committed to by the QGB contract. - shares Verifies that a range of shares has been committed to by the QGB contract - tx Verifies that a transaction hash, in hex format, has been committed to by the QGB contract + blob Verifies that a blob, referenced by its transaction hash, in hex format, has been committed to by the Blobstream contract. + shares Verifies that a range of shares has been committed to by the Blobstream contract + tx Verifies that a transaction hash, in hex format, has been committed to by the Blobstream contract Flags: -h, --help help for verify @@ -278,9 +278,9 @@ Use "celestia-appd verify [command] --help" for more information about a command It currently supports three sub-commands: -- `blob`: Takes a transaction hash, in hex format, and verifies that the blob paid for by the transaction has been committed to by the QGB contract. It only supports one blob for now. -- `shares`: Takes a range of shares and a height, and verifies that these shares have been committed to by the QGB contract. -- `tx`: Takes a transaction hash, in hex format, and verifies that it has been committed to by the QGB contract. +- `blob`: Takes a transaction hash, in hex format, and verifies that the blob paid for by the transaction has been committed to by the Blobstream contract. It only supports one blob for now. +- `shares`: Takes a range of shares and a height, and verifies that these shares have been committed to by the Blobstream contract. +- `tx`: Takes a transaction hash, in hex format, and verifies that it has been committed to by the Blobstream contract. ## Params @@ -370,13 +370,13 @@ if k.CheckLatestAttestationNonce(ctx) && k.GetLatestAttestationNonce(ctx)+1 != n ### Hooks initialization panic -When initializing the QGB hooks, if the QGB store key is not setup correctly, the state machine will [panic](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/keeper/hooks.go#L14-L19): +When initializing the Blobstream hooks, if the Blobstream store key is not setup correctly, the state machine will [panic](https://github.com/celestiaorg/celestia-app/blob/0629c757ef35a24187a8d7a4c706c7cdc894c8b6/x/qgb/keeper/hooks.go#L14-L19): ```golang // if startup is mis-ordered in app.go this hook will halt the chain when // called. Keep this check to make such a mistake obvious if k.storeKey == nil { - panic("hooks initialized before QGBKeeper") + panic("hooks initialized before BlobstreamKeeper") } ``` @@ -386,4 +386,4 @@ The smart contract implementation is in [quantum-gravity-bridge](https://github. The orchestrator and relayer implementations are in the [orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer) repo. -QGB ADRs are in the [docs](https://github.com/celestiaorg/celestia-app/tree/main/docs/architecture). +Blobstream ADRs are in the [docs](https://github.com/celestiaorg/celestia-app/tree/main/docs/architecture). diff --git a/x/qgb/abci.go b/x/blobstream/abci.go similarity index 97% rename from x/qgb/abci.go rename to x/blobstream/abci.go index b37457a446..f537e19fd9 100644 --- a/x/qgb/abci.go +++ b/x/blobstream/abci.go @@ -1,4 +1,4 @@ -package qgb +package blobstream import ( "errors" @@ -6,8 +6,8 @@ import ( sdkerrors "cosmossdk.io/errors" - "github.com/celestiaorg/celestia-app/x/qgb/keeper" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/keeper" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -184,7 +184,7 @@ func pruneAttestations(ctx sdk.Context, k keeper.Keeper) { // some attestations were pruned and we need to update the state for it k.SetEarliestAvailableAttestationNonce(ctx, newEarliestAvailableNonce) ctx.Logger().Debug( - "pruned attestations from QGB store", + "pruned attestations from Blobstream store", "count", newEarliestAvailableNonce-earliestAttestation.GetNonce(), "new_earliest_available_nonce", diff --git a/x/qgb/abci_test.go b/x/blobstream/abci_test.go similarity index 85% rename from x/qgb/abci_test.go rename to x/blobstream/abci_test.go index 4ff2e21efb..8eca1e05d6 100644 --- a/x/qgb/abci_test.go +++ b/x/blobstream/abci_test.go @@ -1,15 +1,16 @@ -package qgb_test +package blobstream_test import ( "testing" "time" - "github.com/celestiaorg/celestia-app/x/qgb/keeper" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream" + + "github.com/celestiaorg/celestia-app/x/blobstream/keeper" + "github.com/celestiaorg/celestia-app/x/blobstream/types" testutil "github.com/celestiaorg/celestia-app/test/util" "github.com/celestiaorg/celestia-app/test/util/testfactory" - "github.com/celestiaorg/celestia-app/x/qgb" "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/stretchr/testify/assert" @@ -18,12 +19,12 @@ import ( func TestFirstAttestationIsValset(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - pk := input.QgbKeeper + pk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(1) expectedTime := ctx.BlockTime() // EndBlocker should set a new validator set - qgb.EndBlocker(ctx, pk) + blobstream.EndBlocker(ctx, pk) require.Equal(t, uint64(1), pk.GetLatestAttestationNonce(ctx)) attestation, found, err := pk.GetAttestationByNonce(ctx, 1) @@ -41,12 +42,12 @@ func TestFirstAttestationIsValset(t *testing.T) { func TestValsetCreationWhenValidatorUnbonds(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - pk := input.QgbKeeper + pk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(1) // run abci methods after chain init staking.EndBlocker(ctx, input.StakingKeeper) - qgb.EndBlocker(ctx, pk) + blobstream.EndBlocker(ctx, pk) // current attestation expectedNonce should be 1 because a valset has been emitted upon chain init. currentAttestationNonce := pk.GetLatestAttestationNonce(ctx) @@ -59,7 +60,7 @@ func TestValsetCreationWhenValidatorUnbonds(t *testing.T) { _, err := msgServer.Undelegate(ctx, undelegateMsg) require.NoError(t, err) staking.EndBlocker(ctx, input.StakingKeeper) - qgb.EndBlocker(ctx, pk) + blobstream.EndBlocker(ctx, pk) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 10) assert.Equal(t, currentAttestationNonce+1, pk.GetLatestAttestationNonce(ctx)) @@ -67,20 +68,20 @@ func TestValsetCreationWhenValidatorUnbonds(t *testing.T) { func TestValsetCreationWhenEditingEVMAddr(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - pk := input.QgbKeeper + pk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(1) // run abci methods after chain init staking.EndBlocker(ctx, input.StakingKeeper) - qgb.EndBlocker(ctx, pk) + blobstream.EndBlocker(ctx, pk) // current attestation expectedNonce should be 1 because a valset has been emitted upon chain init. currentAttestationNonce := pk.GetLatestAttestationNonce(ctx) require.Equal(t, uint64(1), currentAttestationNonce) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - msgServer := keeper.NewMsgServerImpl(input.QgbKeeper) + msgServer := keeper.NewMsgServerImpl(input.BlobstreamKeeper) newEVMAddr := testfactory.RandomEVMAddress() registerMsg := types.NewMsgRegisterEVMAddress( @@ -90,7 +91,7 @@ func TestValsetCreationWhenEditingEVMAddr(t *testing.T) { _, err := msgServer.RegisterEVMAddress(ctx, registerMsg) require.NoError(t, err) staking.EndBlocker(ctx, input.StakingKeeper) - qgb.EndBlocker(ctx, pk) + blobstream.EndBlocker(ctx, pk) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 10) assert.Equal(t, currentAttestationNonce+1, pk.GetLatestAttestationNonce(ctx)) @@ -98,7 +99,7 @@ func TestValsetCreationWhenEditingEVMAddr(t *testing.T) { func TestSetValset(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - pk := input.QgbKeeper + pk := input.BlobstreamKeeper vs, err := pk.GetCurrentValset(ctx) require.Nil(t, err) @@ -110,7 +111,7 @@ func TestSetValset(t *testing.T) { func TestSetDataCommitment(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qk := input.QgbKeeper + qk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(int64(qk.GetDataCommitmentWindowParam(ctx))) expectedTime := ctx.BlockTime() @@ -148,7 +149,7 @@ func TestSetDataCommitment(t *testing.T) { // table structure is to make it easy to understand the test flow. func TestGetDataCommitment(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qk := input.QgbKeeper + qk := input.BlobstreamKeeper tests := []struct { name string @@ -223,13 +224,13 @@ func TestGetDataCommitment(t *testing.T) { func TestDataCommitmentCreation(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qk := input.QgbKeeper + qk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(1) // run abci methods after chain init staking.EndBlocker(ctx, input.StakingKeeper) - qgb.EndBlocker(ctx, qk) + blobstream.EndBlocker(ctx, qk) // current attestation nonce should be 1 because a valset has been emitted // upon chain init. @@ -239,7 +240,7 @@ func TestDataCommitmentCreation(t *testing.T) { // increment height to be the same as the data commitment window newHeight := int64(qk.GetDataCommitmentWindowParam(ctx)) ctx = ctx.WithBlockHeight(newHeight) - qgb.EndBlocker(ctx, qk) + blobstream.EndBlocker(ctx, qk) require.LessOrEqual(t, newHeight, ctx.BlockHeight()) assert.Equal(t, uint64(2), qk.GetLatestAttestationNonce(ctx)) @@ -247,12 +248,12 @@ func TestDataCommitmentCreation(t *testing.T) { func TestDataCommitmentRange(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qk := input.QgbKeeper + qk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(1) // run abci methods after chain init staking.EndBlocker(ctx, input.StakingKeeper) - qgb.EndBlocker(ctx, qk) + blobstream.EndBlocker(ctx, qk) // current attestation nonce should be 1 because a valset has been emitted // upon chain init. @@ -262,7 +263,7 @@ func TestDataCommitmentRange(t *testing.T) { // increment height to be the same as the data commitment window newHeight := int64(qk.GetDataCommitmentWindowParam(ctx)) + 1 ctx = ctx.WithBlockHeight(newHeight) - qgb.EndBlocker(ctx, qk) + blobstream.EndBlocker(ctx, qk) require.LessOrEqual(t, newHeight, ctx.BlockHeight()) assert.Equal(t, uint64(2), qk.GetLatestAttestationNonce(ctx)) @@ -279,7 +280,7 @@ func TestDataCommitmentRange(t *testing.T) { // increment height to 2*data commitment window newHeight = int64(qk.GetDataCommitmentWindowParam(ctx))*2 + 1 ctx = ctx.WithBlockHeight(newHeight) - qgb.EndBlocker(ctx, qk) + blobstream.EndBlocker(ctx, qk) att2, found, err := qk.GetAttestationByNonce(ctx, 3) require.NoError(t, err) @@ -293,7 +294,7 @@ func TestDataCommitmentRange(t *testing.T) { func TestHasDataCommitmentInStore(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qk := input.QgbKeeper + qk := input.BlobstreamKeeper // set the data commitment window qk.SetParams(ctx, types.Params{DataCommitmentWindow: 400}) require.Equal(t, uint64(400), qk.GetDataCommitmentWindowParam(ctx)) @@ -356,24 +357,24 @@ func TestHasDataCommitmentInStore(t *testing.T) { // end of the test, the data commitments cover all the needed ranges. func TestDataCommitmentCreationCatchup(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qk := input.QgbKeeper + qk := input.BlobstreamKeeper ctx = ctx.WithBlockHeight(1) // from height 1 to 1500 with a window of 400 qk.SetParams(ctx, types.Params{DataCommitmentWindow: 400}) - ctx = testutil.ExecuteQGBHeights(ctx, qk, 1, 1501) + ctx = testutil.ExecuteBlobstreamHeights(ctx, qk, 1, 1501) // change window to 100 and execute up to 1920 qk.SetParams(ctx, types.Params{DataCommitmentWindow: 100}) - ctx = testutil.ExecuteQGBHeights(ctx, qk, 1501, 1921) + ctx = testutil.ExecuteBlobstreamHeights(ctx, qk, 1501, 1921) // change window to 1000 and execute up to 3500 qk.SetParams(ctx, types.Params{DataCommitmentWindow: 1000}) - ctx = testutil.ExecuteQGBHeights(ctx, qk, 1921, 3501) + ctx = testutil.ExecuteBlobstreamHeights(ctx, qk, 1921, 3501) // change window to 111 and execute up to 3800 qk.SetParams(ctx, types.Params{DataCommitmentWindow: 111}) - ctx = testutil.ExecuteQGBHeights(ctx, qk, 3501, 3801) + ctx = testutil.ExecuteBlobstreamHeights(ctx, qk, 3501, 3801) // check if a data commitment was created hasDataCommitment, err := qk.HasDataCommitmentInStore(ctx) @@ -516,53 +517,53 @@ func TestDataCommitmentCreationCatchup(t *testing.T) { } // TestPruning tests the pruning mechanism by: 1. Generating a set of -// attestations 2. Running the QGB EndBlocker 3. Verifying that the expired +// attestations 2. Running the Blobstream EndBlocker 3. Verifying that the expired // attestations are pruned func TestPruning(t *testing.T) { input, ctx := testutil.SetupFiveValChain(t) - qgbKeeper := input.QgbKeeper + bsKeeper := input.BlobstreamKeeper // set the data commitment window window := uint64(101) - qgbKeeper.SetParams(ctx, types.Params{DataCommitmentWindow: window}) + bsKeeper.SetParams(ctx, types.Params{DataCommitmentWindow: window}) initialBlockTime := ctx.BlockTime() blockInterval := 10 * time.Minute - ctx = testutil.ExecuteQGBHeightsWithTime(ctx, qgbKeeper, 1, 1626, blockInterval) + ctx = testutil.ExecuteBlobstreamHeightsWithTime(ctx, bsKeeper, 1, 1626, blockInterval) // check that we created a number of attestations - assert.Equal(t, uint64(17), qgbKeeper.GetLatestAttestationNonce(ctx)) + assert.Equal(t, uint64(17), bsKeeper.GetLatestAttestationNonce(ctx)) // check that no pruning occurs if no attestations expired - for nonce := uint64(1); nonce <= qgbKeeper.GetLatestAttestationNonce(ctx); nonce++ { - _, found, err := qgbKeeper.GetAttestationByNonce(ctx, nonce) + for nonce := uint64(1); nonce <= bsKeeper.GetLatestAttestationNonce(ctx); nonce++ { + _, found, err := bsKeeper.GetAttestationByNonce(ctx, nonce) assert.NoError(t, err) assert.True(t, found) } // continue executing heights - ctx = testutil.ExecuteQGBHeightsWithTime(ctx, qgbKeeper, 1626, 5000, blockInterval) + ctx = testutil.ExecuteBlobstreamHeightsWithTime(ctx, bsKeeper, 1626, 5000, blockInterval) - earliestAttestationNonce := qgbKeeper.GetEarliestAvailableAttestationNonce(ctx) + earliestAttestationNonce := bsKeeper.GetEarliestAvailableAttestationNonce(ctx) assert.Equal(t, uint64(21), earliestAttestationNonce) // check that the first attestations were pruned for nonce := uint64(1); nonce < earliestAttestationNonce; nonce++ { - _, found, err := qgbKeeper.GetAttestationByNonce(ctx, nonce) + _, found, err := bsKeeper.GetAttestationByNonce(ctx, nonce) assert.NoError(t, err) assert.False(t, found) } // check that the attestations after those still exist - for nonce := qgbKeeper.GetEarliestAvailableAttestationNonce(ctx); nonce <= qgbKeeper.GetLatestAttestationNonce(ctx); nonce++ { - at, found, err := qgbKeeper.GetAttestationByNonce(ctx, nonce) + for nonce := bsKeeper.GetEarliestAvailableAttestationNonce(ctx); nonce <= bsKeeper.GetLatestAttestationNonce(ctx); nonce++ { + at, found, err := bsKeeper.GetAttestationByNonce(ctx, nonce) assert.NoError(t, err) assert.True(t, found) // make sure the remaining attestations have not expired yet - assert.True(t, initialBlockTime.Before(at.BlockTime().Add(qgb.AttestationExpiryTime))) + assert.True(t, initialBlockTime.Before(at.BlockTime().Add(blobstream.AttestationExpiryTime))) } // check that no valset exists in store - for nonce := qgbKeeper.GetEarliestAvailableAttestationNonce(ctx); nonce <= qgbKeeper.GetLatestAttestationNonce(ctx); nonce++ { - at, found, err := qgbKeeper.GetAttestationByNonce(ctx, nonce) + for nonce := bsKeeper.GetEarliestAvailableAttestationNonce(ctx); nonce <= bsKeeper.GetLatestAttestationNonce(ctx); nonce++ { + at, found, err := bsKeeper.GetAttestationByNonce(ctx, nonce) assert.NoError(t, err) assert.True(t, found) _, ok := at.(*types.DataCommitment) @@ -570,11 +571,11 @@ func TestPruning(t *testing.T) { } // check that we still can get a valset even after pruning all of them - vs, err := qgbKeeper.GetLatestValset(ctx) + vs, err := bsKeeper.GetLatestValset(ctx) assert.NoError(t, err) assert.NotNil(t, vs) // continue running the chain for a few more blocks to be sure no // inconsistency happens after pruning - testutil.ExecuteQGBHeightsWithTime(ctx, qgbKeeper, 5000, 6000, blockInterval) + testutil.ExecuteBlobstreamHeightsWithTime(ctx, bsKeeper, 5000, 6000, blockInterval) } diff --git a/x/qgb/client/config.go b/x/blobstream/client/config.go similarity index 98% rename from x/qgb/client/config.go rename to x/blobstream/client/config.go index d8fd26cfc0..c5b9c088b5 100644 --- a/x/qgb/client/config.go +++ b/x/blobstream/client/config.go @@ -21,7 +21,7 @@ func addVerifyFlags(cmd *cobra.Command) *cobra.Command { cmd.Flags().Uint64P(evmChainIDFlag, "z", 5, "The EVM chain ID") cmd.Flags().StringP(flags.FlagNode, "t", "http://localhost:26657", ": to Tendermint RPC interface for this chain") cmd.Flags().StringP(evmRPCFlag, "e", "http://localhost:8545", "The EVM RPC address") - cmd.Flags().StringP(contractAddressFlag, "a", "", "The contract address at which the QGB is deployed") + cmd.Flags().StringP(contractAddressFlag, "a", "", "The contract address at which Blobstream is deployed") cmd.Flags().StringP(celesGRPCFlag, "c", "localhost:9090", ": To Celestia GRPC address") return cmd diff --git a/x/qgb/client/query.go b/x/blobstream/client/query.go similarity index 94% rename from x/qgb/client/query.go rename to x/blobstream/client/query.go index 5a45b6d1b7..9e696f3eb6 100644 --- a/x/qgb/client/query.go +++ b/x/blobstream/client/query.go @@ -5,7 +5,7 @@ import ( "fmt" "strconv" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -15,7 +15,7 @@ import ( // GetQueryCmd returns the CLI query commands for this module func GetQueryCmd() *cobra.Command { - // Group qgb queries under a subcommand + // Group Blobstream queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), @@ -115,7 +115,7 @@ func unmarshallAttestation(attestation *codectypes.Any) (types.AttestationReques return unmarshalledAttestation, nil } -// makeInterfaceRegistry creates the interface registry containing the QGB interfaces +// makeInterfaceRegistry creates the interface registry containing the Blobstream interfaces func makeInterfaceRegistry() codectypes.InterfaceRegistry { // create the codec interfaceRegistry := codectypes.NewInterfaceRegistry() @@ -123,7 +123,7 @@ func makeInterfaceRegistry() codectypes.InterfaceRegistry { // register the standard types from the sdk std.RegisterInterfaces(interfaceRegistry) - // register the qgb module interfaces + // register the blobstream module interfaces types.RegisterInterfaces(interfaceRegistry) return interfaceRegistry diff --git a/x/qgb/client/query_test.go b/x/blobstream/client/query_test.go similarity index 95% rename from x/qgb/client/query_test.go rename to x/blobstream/client/query_test.go index 65789ba989..8f9d87a7b8 100644 --- a/x/qgb/client/query_test.go +++ b/x/blobstream/client/query_test.go @@ -3,7 +3,7 @@ package client_test import ( "testing" - "github.com/celestiaorg/celestia-app/x/qgb/client" + "github.com/celestiaorg/celestia-app/x/blobstream/client" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" ) diff --git a/x/qgb/client/suite_test.go b/x/blobstream/client/suite_test.go similarity index 83% rename from x/qgb/client/suite_test.go rename to x/blobstream/client/suite_test.go index d504908174..327a2ce440 100644 --- a/x/qgb/client/suite_test.go +++ b/x/blobstream/client/suite_test.go @@ -20,9 +20,9 @@ type CLITestSuite struct { func (s *CLITestSuite) SetupSuite() { if testing.Short() { - s.T().Skip("skipping QGB CLI tests in short mode.") + s.T().Skip("skipping Blobstream CLI tests in short mode.") } - s.T().Log("setting up QGB CLI test suite") + s.T().Log("setting up Blobstream CLI test suite") cfg := network.DefaultConfig() cfg.EnableTMLogging = false @@ -46,10 +46,10 @@ func (s *CLITestSuite) SetupSuite() { } func (s *CLITestSuite) TearDownSuite() { - s.T().Log("tearing down QGB CLI test suite") + s.T().Log("tearing down Blobstream CLI test suite") s.network.Cleanup() } -func TestQGBCLI(t *testing.T) { +func TestBlobstreamCLI(t *testing.T) { suite.Run(t, new(CLITestSuite)) } diff --git a/x/qgb/client/tx.go b/x/blobstream/client/tx.go similarity index 91% rename from x/qgb/client/tx.go rename to x/blobstream/client/tx.go index 585b737910..c0d116a4d4 100644 --- a/x/qgb/client/tx.go +++ b/x/blobstream/client/tx.go @@ -3,7 +3,7 @@ package client import ( "fmt" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -30,7 +30,7 @@ func CmdRegisterEVMAddress() *cobra.Command { Use: "register [valAddress] [evmAddress]", Short: "Register an EVM address for a validator", Long: `Registers an EVM address for a validator. This address will be used to -sign attestations as part of the QGB protocol. Only the validator, as the signer, +sign attestations as part of the Blobstream protocol. Only the validator, as the signer, can register an EVM address. To change the EVM address, the validator can simply send a new message overriding the previous one. `, diff --git a/x/qgb/client/verify.go b/x/blobstream/client/verify.go similarity index 88% rename from x/qgb/client/verify.go rename to x/blobstream/client/verify.go index ea31793fcf..9baa9b4d19 100644 --- a/x/qgb/client/verify.go +++ b/x/blobstream/client/verify.go @@ -11,7 +11,7 @@ import ( "github.com/tendermint/tendermint/crypto/merkle" "github.com/celestiaorg/celestia-app/pkg/square" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" wrapper "github.com/celestiaorg/quantum-gravity-bridge/v2/wrappers/QuantumGravityBridge.sol" "github.com/ethereum/go-ethereum/ethclient" "github.com/spf13/cobra" @@ -24,7 +24,7 @@ import ( func VerifyCmd() *cobra.Command { command := &cobra.Command{ Use: "verify", - Short: "Verifies that a transaction hash, a range of shares, or a blob referenced by its transaction hash were committed to by the QGB contract", + Short: "Verifies that a transaction hash, a range of shares, or a blob referenced by its transaction hash were committed to by the Blobstream contract", } command.AddCommand( txCmd(), @@ -38,7 +38,7 @@ func txCmd() *cobra.Command { command := &cobra.Command{ Use: "tx ", Args: cobra.ExactArgs(1), - Short: "Verifies that a transaction hash, in hex format, has been committed to by the QGB contract", + Short: "Verifies that a transaction hash, in hex format, has been committed to by the Blobstream contract", RunE: func(cmd *cobra.Command, args []string) error { txHash, err := hex.DecodeString(args[0]) if err != nil { @@ -72,7 +72,7 @@ func txCmd() *cobra.Command { return err } - logger.Info("verifying that the transaction was committed to by the QGB", "tx_hash", args[0], "height", tx.Height) + logger.Info("verifying that the transaction was committed to by the Blobstream", "tx_hash", args[0], "height", tx.Height) blockRes, err := trpc.Block(cmd.Context(), &tx.Height) if err != nil { @@ -95,7 +95,7 @@ func blobCmd() *cobra.Command { command := &cobra.Command{ Use: "blob ", Args: cobra.ExactArgs(2), - Short: "Verifies that a blob, referenced by its transaction hash, in hex format, has been committed to by the QGB contract", + Short: "Verifies that a blob, referenced by its transaction hash, in hex format, has been committed to by the Blobstream contract", RunE: func(cmd *cobra.Command, args []string) error { txHash, err := hex.DecodeString(args[0]) if err != nil { @@ -134,7 +134,7 @@ func blobCmd() *cobra.Command { return err } - logger.Info("verifying that the blob was committed to by the QGB", "tx_hash", args[0], "height", tx.Height) + logger.Info("verifying that the blob was committed to by the Blobstream", "tx_hash", args[0], "height", tx.Height) blockRes, err := trpc.Block(cmd.Context(), &tx.Height) if err != nil { @@ -157,7 +157,7 @@ func sharesCmd() *cobra.Command { command := &cobra.Command{ Use: "shares ", Args: cobra.ExactArgs(3), - Short: "Verifies that a range of shares has been committed to by the QGB contract. The range should be end exclusive.", + Short: "Verifies that a range of shares has been committed to by the Blobstream contract. The range should be end exclusive.", RunE: func(cmd *cobra.Command, args []string) error { height, err := strconv.ParseUint(args[0], 10, 0) if err != nil { @@ -229,18 +229,18 @@ func VerifyShares(ctx context.Context, logger tmlog.Logger, config VerifyConfig, logger.Info("proofs from shares to data root are valid") - qgbGRPC, err := grpc.Dial(config.CelesGRPC, grpc.WithTransportCredentials(insecure.NewCredentials())) + bsGRPC, err := grpc.Dial(config.CelesGRPC, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return false, err } - defer func(qgbGRPC *grpc.ClientConn) { - err := qgbGRPC.Close() + defer func(bsGRPC *grpc.ClientConn) { + err := bsGRPC.Close() if err != nil { logger.Debug("error closing connection", "err", err.Error()) } - }(qgbGRPC) + }(bsGRPC) - queryClient := types.NewQueryClient(qgbGRPC) + queryClient := types.NewQueryClient(bsGRPC) resp, err := queryClient.DataCommitmentRangeForHeight( ctx, @@ -251,7 +251,7 @@ func VerifyShares(ctx context.Context, logger tmlog.Logger, config VerifyConfig, } logger.Info( - "proving that the data root was committed to in the QGB contract", + "proving that the data root was committed to in the Blobstream contract", "contract_address", config.ContractAddr, "fist_block", @@ -280,15 +280,15 @@ func VerifyShares(ctx context.Context, logger tmlog.Logger, config VerifyConfig, } defer ethClient.Close() - qgbWrapper, err := wrapper.NewWrappers(config.ContractAddr, ethClient) + bsWrapper, err := wrapper.NewWrappers(config.ContractAddr, ethClient) if err != nil { return false, err } - logger.Info("verifying that the data root was committed to in the QGB contract") + logger.Info("verifying that the data root was committed to in the Blobstream contract") isCommittedTo, err = VerifyDataRootInclusion( ctx, - qgbWrapper, + bsWrapper, resp.DataCommitment.Nonce, height, block.Block.DataHash, @@ -299,9 +299,9 @@ func VerifyShares(ctx context.Context, logger tmlog.Logger, config VerifyConfig, } if isCommittedTo { - logger.Info("the QGB contract has committed to the provided shares") + logger.Info("the Blobstream contract has committed to the provided shares") } else { - logger.Info("the QGB contract didn't commit to the provided shares") + logger.Info("the Blobstream contract didn't commit to the provided shares") } return isCommittedTo, nil @@ -309,7 +309,7 @@ func VerifyShares(ctx context.Context, logger tmlog.Logger, config VerifyConfig, func VerifyDataRootInclusion( _ context.Context, - qgbWrapper *wrapper.Wrappers, + bsWrapper *wrapper.Wrappers, nonce uint64, height uint64, dataRoot []byte, @@ -330,7 +330,7 @@ func VerifyDataRootInclusion( NumLeaves: big.NewInt(proof.Total), } - valid, err := qgbWrapper.VerifyAttestation( + valid, err := bsWrapper.VerifyAttestation( &bind.CallOpts{}, big.NewInt(int64(nonce)), tuple, diff --git a/x/qgb/genesis.go b/x/blobstream/genesis.go similarity index 90% rename from x/qgb/genesis.go rename to x/blobstream/genesis.go index 4d0e67f607..c44798f4dd 100644 --- a/x/qgb/genesis.go +++ b/x/blobstream/genesis.go @@ -1,8 +1,8 @@ -package qgb +package blobstream import ( - "github.com/celestiaorg/celestia-app/x/qgb/keeper" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/keeper" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/qgb/integration_test.go b/x/blobstream/integration_test.go similarity index 74% rename from x/qgb/integration_test.go rename to x/blobstream/integration_test.go index 834d1cc713..6457f37b99 100644 --- a/x/qgb/integration_test.go +++ b/x/blobstream/integration_test.go @@ -1,4 +1,4 @@ -package qgb_test +package blobstream_test import ( "testing" @@ -9,7 +9,7 @@ import ( "github.com/celestiaorg/celestia-app/test/util/blobfactory" "github.com/celestiaorg/celestia-app/test/util/testfactory" "github.com/celestiaorg/celestia-app/test/util/testnode" - qgbtypes "github.com/celestiaorg/celestia-app/x/qgb/types" + blobstreamtypes "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" staking "github.com/cosmos/cosmos-sdk/x/staking/types" gethcommon "github.com/ethereum/go-ethereum/common" @@ -18,14 +18,14 @@ import ( abci "github.com/tendermint/tendermint/abci/types" ) -func TestQGBIntegrationSuite(t *testing.T) { +func TestBlobstreamIntegrationSuite(t *testing.T) { if testing.Short() { - t.Skip("skipping QGB integration test in short mode.") + t.Skip("skipping Blobstream integration test in short mode.") } - suite.Run(t, new(QGBIntegrationSuite)) + suite.Run(t, new(BlobstreamIntegrationSuite)) } -type QGBIntegrationSuite struct { +type BlobstreamIntegrationSuite struct { suite.Suite accounts []string @@ -33,7 +33,7 @@ type QGBIntegrationSuite struct { ecfg encoding.Config } -func (s *QGBIntegrationSuite) SetupSuite() { +func (s *BlobstreamIntegrationSuite) SetupSuite() { t := s.T() t.Log("setting up integration test suite") @@ -45,7 +45,7 @@ func (s *QGBIntegrationSuite) SetupSuite() { s.cctx = cctx } -func (s *QGBIntegrationSuite) TestQGB() { +func (s *BlobstreamIntegrationSuite) TestBlobstream() { t := s.T() type test struct { name string @@ -54,21 +54,21 @@ func (s *QGBIntegrationSuite) TestQGB() { } tests := []test{ { - name: "edit a qgb validator address", + name: "edit a blobstream validator address", msgFunc: func() ([]sdk.Msg, sdk.AccAddress) { addr := testfactory.GetAddress(s.cctx.Keyring, "validator") valAddr := sdk.ValAddress(addr) - msg := qgbtypes.NewMsgRegisterEVMAddress(valAddr, gethcommon.HexToAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) + msg := blobstreamtypes.NewMsgRegisterEVMAddress(valAddr, gethcommon.HexToAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) return []sdk.Msg{msg}, addr }, expectedTxCode: abci.CodeTypeOK, }, { - name: "edit a non qgb validator address", + name: "edit a non blobstream validator address", msgFunc: func() ([]sdk.Msg, sdk.AccAddress) { addr := testfactory.GetAddress(s.cctx.Keyring, s.accounts[0]) valAddr := sdk.ValAddress(addr) - msg := qgbtypes.NewMsgRegisterEVMAddress(valAddr, gethcommon.HexToAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) + msg := blobstreamtypes.NewMsgRegisterEVMAddress(valAddr, gethcommon.HexToAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) return []sdk.Msg{msg}, addr }, expectedTxCode: staking.ErrNoValidatorFound.ABCICode(), diff --git a/x/qgb/keeper/hooks.go b/x/blobstream/keeper/hooks.go similarity index 94% rename from x/qgb/keeper/hooks.go rename to x/blobstream/keeper/hooks.go index 4ab6872598..2bd1776c7a 100644 --- a/x/qgb/keeper/hooks.go +++ b/x/blobstream/keeper/hooks.go @@ -2,7 +2,7 @@ package keeper import ( "cosmossdk.io/errors" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -11,12 +11,12 @@ type Hooks struct { k Keeper } -// Create new QGB hooks +// Hooks Create new Blobstream hooks func (k Keeper) Hooks() Hooks { // if startup is mis-ordered in app.go this hook will halt the chain when // called. Keep this check to make such a mistake obvious if k.storeKey == nil { - panic("hooks initialized before QGBKeeper") + panic("hooks initialized before BlobstreamKeeper") } return Hooks{k} } diff --git a/x/qgb/keeper/keeper.go b/x/blobstream/keeper/keeper.go similarity index 93% rename from x/qgb/keeper/keeper.go rename to x/blobstream/keeper/keeper.go index bf4dab86ec..0e75caf6e4 100644 --- a/x/qgb/keeper/keeper.go +++ b/x/blobstream/keeper/keeper.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "fmt" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -47,7 +47,7 @@ func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) { } // DeserializeValidatorIterator returns validators from the validator iterator. -// Adding here in QGB keeper as cdc is not available inside endblocker. +// Adding here in Blobstream keeper as cdc is not available inside endblocker. func (k Keeper) DeserializeValidatorIterator(vals []byte) stakingtypes.ValAddresses { validators := stakingtypes.ValAddresses{ Addresses: []string{}, @@ -56,7 +56,7 @@ func (k Keeper) DeserializeValidatorIterator(vals []byte) stakingtypes.ValAddres return validators } -// StakingKeeper restricts the functionality of the bank keeper used in the qgb +// StakingKeeper restricts the functionality of the bank keeper used in the blobstream // keeper type StakingKeeper interface { GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) diff --git a/x/qgb/keeper/keeper_attestation.go b/x/blobstream/keeper/keeper_attestation.go similarity index 98% rename from x/qgb/keeper/keeper_attestation.go rename to x/blobstream/keeper/keeper_attestation.go index f48f1d1470..ca27e640a1 100644 --- a/x/qgb/keeper/keeper_attestation.go +++ b/x/blobstream/keeper/keeper_attestation.go @@ -3,7 +3,7 @@ package keeper import ( "fmt" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/blobstream/keeper/keeper_attestation_test.go b/x/blobstream/keeper/keeper_attestation_test.go new file mode 100644 index 0000000000..56f5cecd3a --- /dev/null +++ b/x/blobstream/keeper/keeper_attestation_test.go @@ -0,0 +1,41 @@ +package keeper_test + +import ( + "testing" + + testutil "github.com/celestiaorg/celestia-app/test/util" + "github.com/celestiaorg/celestia-app/x/blobstream" + "github.com/stretchr/testify/assert" +) + +func TestCheckLatestAttestationNonce(t *testing.T) { + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper + + // check if the latest attestation nonce is init + exists := k.CheckLatestAttestationNonce(input.Context) + assert.False(t, exists) + + // init the latest attestation nonce + input.BlobstreamKeeper.SetLatestAttestationNonce(input.Context, blobstream.InitialLatestAttestationNonce) + + // check if the latest attestation nonce value was initialized correctly + input.BlobstreamKeeper.CheckLatestAttestationNonce(input.Context) + assert.Equal(t, blobstream.InitialLatestAttestationNonce, input.BlobstreamKeeper.GetLatestAttestationNonce(input.Context)) +} + +func TestCheckEarliestAvailableAttestationNonce(t *testing.T) { + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper + + // check if the earliest available attestation nonce is init + exists := k.CheckEarliestAvailableAttestationNonce(input.Context) + assert.False(t, exists) + + // init the earliest available attestation nonce + input.BlobstreamKeeper.SetEarliestAvailableAttestationNonce(input.Context, blobstream.InitialEarliestAvailableAttestationNonce) + + // check if the earliest attestation nonce value was initialized correctly + input.BlobstreamKeeper.CheckEarliestAvailableAttestationNonce(input.Context) + assert.Equal(t, blobstream.InitialEarliestAvailableAttestationNonce, input.BlobstreamKeeper.GetEarliestAvailableAttestationNonce(input.Context)) +} diff --git a/x/qgb/keeper/keeper_data_commitment.go b/x/blobstream/keeper/keeper_data_commitment.go similarity index 98% rename from x/qgb/keeper/keeper_data_commitment.go rename to x/blobstream/keeper/keeper_data_commitment.go index 541fad51b4..2348106928 100644 --- a/x/qgb/keeper/keeper_data_commitment.go +++ b/x/blobstream/keeper/keeper_data_commitment.go @@ -4,7 +4,7 @@ import ( "fmt" "cosmossdk.io/errors" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/qgb/keeper/keeper_data_commitment_test.go b/x/blobstream/keeper/keeper_data_commitment_test.go similarity index 93% rename from x/qgb/keeper/keeper_data_commitment_test.go rename to x/blobstream/keeper/keeper_data_commitment_test.go index a46489f61e..7bcfa135aa 100644 --- a/x/qgb/keeper/keeper_data_commitment_test.go +++ b/x/blobstream/keeper/keeper_data_commitment_test.go @@ -3,17 +3,17 @@ package keeper_test import ( "testing" - "github.com/celestiaorg/celestia-app/x/qgb" + "github.com/celestiaorg/celestia-app/x/blobstream" testutil "github.com/celestiaorg/celestia-app/test/util" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestGetDataCommitmentForHeight(t *testing.T) { input, sdkCtx := testutil.SetupFiveValChain(t) - k := input.QgbKeeper + k := input.BlobstreamKeeper initialValset, err := k.GetCurrentValset(sdkCtx) require.NoError(t, err) @@ -111,7 +111,7 @@ func TestGetDataCommitmentForHeight(t *testing.T) { func TestLatestDataCommitment(t *testing.T) { input, sdkCtx := testutil.SetupFiveValChain(t) - k := input.QgbKeeper + k := input.BlobstreamKeeper initialValset, err := k.GetCurrentValset(sdkCtx) require.NoError(t, err) @@ -148,8 +148,8 @@ func TestLatestDataCommitment(t *testing.T) { } func TestCheckingLatestAttestationNonceInDataCommitments(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper tests := []struct { name string @@ -190,11 +190,11 @@ func TestCheckingLatestAttestationNonceInDataCommitments(t *testing.T) { } func TestCheckingEarliestAvailableAttestationNonceInDataCommitments(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper // init the latest attestation nonce - input.QgbKeeper.SetLatestAttestationNonce(input.Context, qgb.InitialLatestAttestationNonce) + input.BlobstreamKeeper.SetLatestAttestationNonce(input.Context, blobstream.InitialLatestAttestationNonce) tests := []struct { name string diff --git a/x/qgb/keeper/keeper_valset.go b/x/blobstream/keeper/keeper_valset.go similarity index 99% rename from x/qgb/keeper/keeper_valset.go rename to x/blobstream/keeper/keeper_valset.go index a98159da4c..bdb8506ee8 100644 --- a/x/qgb/keeper/keeper_valset.go +++ b/x/blobstream/keeper/keeper_valset.go @@ -7,7 +7,7 @@ import ( "cosmossdk.io/errors" cosmosmath "cosmossdk.io/math" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" gethcommon "github.com/ethereum/go-ethereum/common" diff --git a/x/qgb/keeper/keeper_valset_test.go b/x/blobstream/keeper/keeper_valset_test.go similarity index 92% rename from x/qgb/keeper/keeper_valset_test.go rename to x/blobstream/keeper/keeper_valset_test.go index 6408033d90..0cb0c42c7f 100644 --- a/x/qgb/keeper/keeper_valset_test.go +++ b/x/blobstream/keeper/keeper_valset_test.go @@ -5,10 +5,10 @@ import ( "errors" "testing" - "github.com/celestiaorg/celestia-app/x/qgb" + "github.com/celestiaorg/celestia-app/x/blobstream" testutil "github.com/celestiaorg/celestia-app/test/util" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" gethcommon "github.com/ethereum/go-ethereum/common" @@ -60,7 +60,7 @@ func TestCurrentValsetNormalization(t *testing.T) { spec := spec t.Run(msg, func(t *testing.T) { input, ctx := testutil.SetupTestChain(t, spec.srcPowers) - r, err := input.QgbKeeper.GetCurrentValset(ctx) + r, err := input.BlobstreamKeeper.GetCurrentValset(ctx) require.NoError(t, err) rMembers, err := types.BridgeValidators(r.Members).ToInternal() require.NoError(t, err) @@ -70,8 +70,8 @@ func TestCurrentValsetNormalization(t *testing.T) { } func TestCheckingEarliestAvailableAttestationNonceInValsets(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper // create a validator to have a realistic scenario testutil.CreateValidator( t, @@ -87,7 +87,7 @@ func TestCheckingEarliestAvailableAttestationNonceInValsets(t *testing.T) { staking.EndBlocker(input.Context, input.StakingKeeper) // init the latest attestation nonce - input.QgbKeeper.SetLatestAttestationNonce(input.Context, qgb.InitialLatestAttestationNonce) + input.BlobstreamKeeper.SetLatestAttestationNonce(input.Context, blobstream.InitialLatestAttestationNonce) tests := []struct { name string @@ -120,8 +120,8 @@ func TestCheckingEarliestAvailableAttestationNonceInValsets(t *testing.T) { } func TestCheckingAttestationNonceInValsets(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper // create a validator to have a realistic scenario testutil.CreateValidator( t, @@ -174,8 +174,8 @@ func TestCheckingAttestationNonceInValsets(t *testing.T) { } func TestEVMAddresses(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper + input := testutil.CreateTestEnvWithoutBlobstreamKeysInit(t) + k := input.BlobstreamKeeper _, exists := k.GetEVMAddress(input.Context, testutil.ValAddrs[0]) require.False(t, exists) diff --git a/x/qgb/keeper/msg_server.go b/x/blobstream/keeper/msg_server.go similarity index 89% rename from x/qgb/keeper/msg_server.go rename to x/blobstream/keeper/msg_server.go index 6e11a6125e..a9ecab5253 100644 --- a/x/qgb/keeper/msg_server.go +++ b/x/blobstream/keeper/msg_server.go @@ -4,7 +4,7 @@ import ( "context" "cosmossdk.io/errors" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" staking "github.com/cosmos/cosmos-sdk/x/staking/types" gethcommon "github.com/ethereum/go-ethereum/common" @@ -16,7 +16,7 @@ type msgServer struct { Keeper } -// NewMsgServerImpl returns an implementation of the QGB MsgServer interface +// NewMsgServerImpl returns an implementation of the Blobstream MsgServer interface // for the provided Keeper. func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} diff --git a/x/qgb/keeper/msg_server_test.go b/x/blobstream/keeper/msg_server_test.go similarity index 93% rename from x/qgb/keeper/msg_server_test.go rename to x/blobstream/keeper/msg_server_test.go index b927e6f7af..a345ebc3cd 100644 --- a/x/qgb/keeper/msg_server_test.go +++ b/x/blobstream/keeper/msg_server_test.go @@ -4,7 +4,7 @@ import ( "testing" testutil "github.com/celestiaorg/celestia-app/test/util" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" @@ -12,7 +12,7 @@ import ( func TestRegisterEVMAddress(t *testing.T) { input, sdkCtx := testutil.SetupFiveValChain(t) - k := input.QgbKeeper + k := input.BlobstreamKeeper vals := input.StakingKeeper.GetValidators(sdkCtx, 100) require.GreaterOrEqual(t, len(vals), 1) val := vals[0] diff --git a/x/qgb/keeper/query_attestation.go b/x/blobstream/keeper/query_attestation.go similarity index 95% rename from x/qgb/keeper/query_attestation.go rename to x/blobstream/keeper/query_attestation.go index 8d7939fac3..ddabf0435c 100644 --- a/x/qgb/keeper/query_attestation.go +++ b/x/blobstream/keeper/query_attestation.go @@ -5,7 +5,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/qgb/keeper/query_data_commitment.go b/x/blobstream/keeper/query_data_commitment.go similarity index 93% rename from x/qgb/keeper/query_data_commitment.go rename to x/blobstream/keeper/query_data_commitment.go index 53f0d3b147..531869f94b 100644 --- a/x/qgb/keeper/query_data_commitment.go +++ b/x/blobstream/keeper/query_data_commitment.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/qgb/keeper/query_general.go b/x/blobstream/keeper/query_general.go similarity index 95% rename from x/qgb/keeper/query_general.go rename to x/blobstream/keeper/query_general.go index 9dc4378822..f035153f07 100644 --- a/x/qgb/keeper/query_general.go +++ b/x/blobstream/keeper/query_general.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/qgb/keeper/query_valset.go b/x/blobstream/keeper/query_valset.go similarity index 91% rename from x/qgb/keeper/query_valset.go rename to x/blobstream/keeper/query_valset.go index 2ad58998f9..fc58ea9f04 100644 --- a/x/qgb/keeper/query_valset.go +++ b/x/blobstream/keeper/query_valset.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/qgb/module.go b/x/blobstream/module.go similarity index 95% rename from x/qgb/module.go rename to x/blobstream/module.go index 8d2035d13e..0a18fc8ede 100644 --- a/x/qgb/module.go +++ b/x/blobstream/module.go @@ -1,10 +1,10 @@ -package qgb +package blobstream import ( "encoding/json" "fmt" - qgbcmd "github.com/celestiaorg/celestia-app/x/qgb/client" + bscmd "github.com/celestiaorg/celestia-app/x/blobstream/client" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -12,8 +12,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" - "github.com/celestiaorg/celestia-app/x/qgb/keeper" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/keeper" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -81,12 +81,12 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.Ser // GetTxCmd returns the capability module's root tx command. func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return qgbcmd.GetTxCmd() + return bscmd.GetTxCmd() } // GetQueryCmd returns the capability module's root query command. func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return qgbcmd.GetQueryCmd() + return bscmd.GetQueryCmd() } // ---------------------------------------------------------------------------- diff --git a/x/blobstream/overview.md b/x/blobstream/overview.md new file mode 100644 index 0000000000..4b8666a255 --- /dev/null +++ b/x/blobstream/overview.md @@ -0,0 +1,116 @@ +# Overview + +Blobstream is a one way bridge from Celestia to EVM chains. It provides a way for rollups using Celestia for Data Availability (DA), and an EVM chain as a settlement layer, to prove on-chain that the rollup data was correctly posted to Celestia and verify fraud proofs otherwise. These types of rollups are discussed in the [Quantum Gravity Bridge: Secure Off-Chain Data Availability for Ethereum L2s with Celestia](https://blog.celestia.org/celestiums) blog post. + +Blobstream implementation consists of three components: The [state machine](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream), the [orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer), and the [Blobstream smart contract](https://github.com/celestiaorg/blobstream-contracts). + +## [State machine](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream) + +The state machine is the `blobstream` module implementation. It is responsible for creating [attestations](https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/types/attestation.go#L10-L18) which are signed by [orchestrators](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md). Each Celestia validator is expected to also run an orchestrator. [Relayers](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) periodically query the Celestia state for attestations and submit them to the Blobstream smart contract deployed on some EVM chain. + +There are two types of [attestations](https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/types/attestation.go#L10-L18): [valsets](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/proto/celestia/qgb/v1/types.proto#L18-L33) and [data commitments](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/proto/celestia/qgb/v1/types.proto#L35-L55). + +All attestations have a [`nonce`](https://github.com/celestiaorg/celestia-app/blob/8ae6a84b2c99e55625bbe99f70db1e5a985c9675/x/qgb/types/attestation.go#L16) field that defines the order in which the attestations are generated. This nonce is stored in the Blobstream smart contract as per [ADR-004](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md#decision), and is used to order attestation submissions on the EVM chain. + +### [Valsets](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream#valsets) + +A [valset](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream#valsets) represents a validator set snapshot. It contains a list of validators' EVM addresses along with their [Blobstream staking power](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#validator-power-normalization). It enables the Blobstream smart contract to track the state of the Celestia validator set. This is necessary so that the Blobstream smart contract can determine when a 2/3 threshold has signed that a particular data hash has been made available on Celestia. + +A valset is [generated](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream#valset-handler) inside the state machine. It is then queried, signed, and submitted to the [Blobstream P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66) by orchestrators. After more than 2/3rds of the Celestia validator set have submitted their signatures, [relayers](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) relay the attestation to the Blobstream smart contract along with the signatures to be [verified](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L172-L211) and eventually [stored](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L266-L268). + +The Blobstream smart contract keeps track of the [last validator set hash](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L44-L45) and its corresponding [power threshold](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L46-L47). This way, the contract will always be able to verify if attestations were signed using the correct Celestia validator set, and if the provided signatures represent a majority. + +### [Data commitments](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream#data-commitments) + +A [data commitment](https://github.com/celestiaorg/celestia-app/tree/main/x/blobstream#data-commitments) is an attestation type representing a request to commit over a set of blocks. It provides an end exclusive range of blocks for orchestrators to sign over and propagate in the Blobstream P2P network. The range is defined by the param [`DataCommitmentWindow`](https://github.com/celestiaorg/celestia-app/blob/fc83b04c3a5638ac8d415770e38a4046b84fa128/x/qgb/keeper/keeper_data_commitment.go#L44-L50). + +The data commitment is a Merkle tree over a sequential set of blocks. These blocks are represented as a tuple of the [data root](https://github.com/celestiaorg/celestia-core/blob/6933af1ead0ddf4a8c7516690e3674c6cdfa7bd8/rpc/core/blocks.go#L549), and the [height](https://github.com/celestiaorg/celestia-core/blob/6933af1ead0ddf4a8c7516690e3674c6cdfa7bd8/rpc/core/blocks.go#L548). This commitment can be queried from core using the [`DataCommitment`](https://github.com/celestiaorg/celestia-core/blob/6933af1ead0ddf4a8c7516690e3674c6cdfa7bd8/rpc/core/blocks.go#L210-L227) query and allows generating Merkle inclusion proofs for any blob in any block in the set. + +When an orchestrator sees a newly generated data commitment, it queries the previous valset and checks whether it's part of its validator set. Then, the orchestrator signs the new data commitment and submits that signature to the [Blobstream P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66). Otherwise, it ignores it and waits for new attestations. + +After the relayer finds more than 2/3rd signatures of that data commitment, it relays the commitment along with the signatures to the Blobstream smart contract where they get [verified](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L172-L211). Then, the smart contract [saves](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L331-L332) the commitment to the [state](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L50-L51) thus allowing for Merkle-based inclusion proof verification for any blob posted to any committed block. + +## [Orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer) + +The [orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer) contains the implementation of the Blobstream orchestrator and relayer. + +### [Orchestrator](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md) + +An [orchestrator](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md) is the software responsible for querying the state machine for new attestations, signs them, and then submits them to the Blobstream P2P network. + +At startup, it [loads](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md#evm-key) the EVM private key corresponding to the address used when creating the validator. Then, it uses it to sign the attestations digests before submitting them to the P2P network. + +An attestation digest is a bytes array containing a digest of the attestation relevant information. More on this in the [hashes format](#hashes-format) section. + +The orchestrator generally needs access to the validator's RPC/gRPC endpoints. However, it still can use public ones if needed. Its only hard requirement is having access to the specific private key for the target validator. Otherwise, the signatures will be invalid and the validator could get slashed in future versions. + +### [Relayer](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) + +A [relayer](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) is the software responsible for querying the signatures of a validator set from the P2P network and aggregating them into a format that the [Blobstream smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) understands. + +It uses the previous valset to that attestation to know which validators should sign. Then, it looks for all of those signatures. + +When the relayer finds more than 2/3rds of the signatures, it immediately relays them to the Blobstream smart contract to be persisted, and starts again. + +For a [Blobstream smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) to not halt, it needs at least one relayer relaying signatures to it regularly. Otherwise, the Blobstream contract will be out of sync and will not be able to commit to new data. + +## [Blobstream smart contract](https://github.com/celestiaorg/blobstream-contracts) + +The [Blobstream smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) is the source of truth for the rollups using Celestia as DA. It allows proving/verifying that data was posted to the Celestia blockchain. + +In order to reflect the Celestia chain data, the [Blobstream smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) keeps track of the validator set changes, via valset updates, and commits to batches of block information, via data commitments. + +### Validator set changes + +In order to submit a validator set change, the Blobstream smart contract provides the [`updateValidatorSet()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L213-L273) `external` method that takes the previous valset nonce, the new one's nonce, its power threshold and its hash, along with the actual validator set and the corresponding signatures, as `calldata` to be verified. Then, it [persists](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L266-L268) the nonce, the valset hash and the threshold in state so they can be used for future valset and data commitment updates. + +### Batches + +The batches in the Blobstream smart contract refer to the `data root tuple root`s described above. These are submitted using the [`submitDataRootTupleRoot()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L275-L337) `external` method. This latter takes the new batch nonce, its corresponding valset, the `data root tuple root`, along with the actual validator set and their corresponding signatures as `calldata`. Then, it verifies the signature and [persists](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L331-L332) the new data root tuple root to the state along with the new nonce. + +### Hashes format + +The digest created/verified in the Blobstream smart contract follow the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) standard for hashing data. + +#### Valset digest + +A valset digest is created inside the [`domainSeparateValidatorSetHash()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L137-L154) method. It is the `keccak256` hash of the concatenation of the following fields: + +- `VALIDATOR_SET_HASH_DOMAIN_SEPARATOR`: which is defined as a [constant](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/Constants.sol#L4-L6). +- The valset nonce: the [universal nonce](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md#decision) of the attestation representing that validator set change. +- The power threshold: the threshold defining 2/3rds of the validator set. +- The validator set hash: The keccak256 hash of the validator set which is calculated using the [`computeValidatorSetHash()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L131-L135) method. + +#### Data commitment digest + +A data commitment digest is created inside the [`domainSeparateDataRootTupleRoot()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L156-L170) method. It is the `keccak256` hash of the concatenation of the following fields: + +- `DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR`: which is defined as a [constant](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/Constants.sol#L8-L10). +- The data commitment nonce: the [universal nonce](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md#decision) of the attestation representing that data commitment. +- The data root tuple root: which is the commitment over the set of blocks defined [above](#data-commitments). + +### Signatures + +The signature scheme used for signing the above hashes follow the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) signing standard. It uses the `ECDSA` algorithm with the `secp256k1` curve. So, the orchestrator uses the keystore to [generate](https://github.com/celestiaorg/orchestrator-relayer/blob/09ebfdc312c0d9e08856fb98cfd089e956ab7f3a/evm/ethereum_signature.go#L18-L28) these signatures. + +The output signature is in the `[R || S || V]` format where `V` is `0` or `1`. This is defined in the Blobstream smart contract using the [Signature](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L17-L21) struct. + +These signatures are then verified in the smart contract using the [`verifySig()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L124-L129) method. + +## Security assumptions + +The security of the Blobstream relies on an honest majority of the Celestia validator set. This assumption indicates that more than 2/3s of the voting power follows each [block validity rule](../../specs/src/specs/block_validity_rules.md). Additionally, over 2/3s of the voting power sign valid validator set updates and data commitments, as outlined above. + +If more than 1/3rd of the validator set stops running their orchestrators, then the Blobstream halts. And, if more than 2/3rds sign invalid data, then the Blobstream contract will commit to invalid data. The only recovery from such a state is to revert to social consensus, potentially slashing the guilty validators and redeploying the smart contracts. + +## Slashing + +We still don't support slashing for equivocation, liveness or invalid signatures. However, if anything were to happen to the bridge, we would be able to social slash the corrupt validators and redeploy the contract. + +Future versions of the Blobstream will support slashing. It will be enforced via the use of [vote extensions](https://github.com/cometbft/cometbft/blob/v0.38.0/spec/abci/abci%2B%2B_methods.md#extendvote). + +## Proofs + +To prove that data was posted to an EVM chain, we have the following method: [`verifyAttestation()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L339-L358). This allows to verify that a data root tuple was committed to by the Blobstream smart contract. + +For the remaining proofs, i.e. shares to data root tuples proofs, the app is currently able to generate and verify them. However, these are still not supported at the smart contract level. Future works will focus on this. diff --git a/x/qgb/types/abi_consts.go b/x/blobstream/types/abi_consts.go similarity index 86% rename from x/qgb/types/abi_consts.go rename to x/blobstream/types/abi_consts.go index d1e3171480..a5bbc6638e 100644 --- a/x/qgb/types/abi_consts.go +++ b/x/blobstream/types/abi_consts.go @@ -10,10 +10,10 @@ import ( ) const ( - // InternalQGBabiJSON is the json encoded abi for private functions in the - // qgb contract. This is needed to encode data that is signed over in a way + // InternalBlobstreamABIJSON is the json encoded abi for private functions in the + // Blobstream contract. This is needed to encode data that is signed over in a way // that the contracts can easily verify. - InternalQGBabiJSON = `[ + InternalBlobstreamABIJSON = `[ { "inputs": [ { @@ -116,9 +116,9 @@ const ( ) var ( - ExternalQGBabi abi.ABI - InternalQGBabi abi.ABI - BridgeValidatorAbi abi.Arguments + ExternalBlobstreamABI abi.ABI + InternalBlobstreamABI abi.ABI + BridgeValidatorAbi abi.Arguments VsDomainSeparator ethcmn.Hash DcDomainSeparator ethcmn.Hash @@ -129,13 +129,13 @@ func init() { if err != nil { log.Fatalln("bad ABI constant", err) } - ExternalQGBabi = contractAbi + ExternalBlobstreamABI = contractAbi - internalABI, err := abi.JSON(strings.NewReader(InternalQGBabiJSON)) + internalABI, err := abi.JSON(strings.NewReader(InternalBlobstreamABIJSON)) if err != nil { log.Fatalln("bad internal ABI constant", err) } - InternalQGBabi = internalABI + InternalBlobstreamABI = internalABI solValidatorType, err := abi.NewType("tuple", "validator", []abi.ArgumentMarshaling{ {Name: "Addr", Type: "address"}, diff --git a/x/qgb/types/attestation.go b/x/blobstream/types/attestation.go similarity index 100% rename from x/qgb/types/attestation.go rename to x/blobstream/types/attestation.go diff --git a/x/qgb/types/codec.go b/x/blobstream/types/codec.go similarity index 100% rename from x/qgb/types/codec.go rename to x/blobstream/types/codec.go diff --git a/x/qgb/types/data_commitment.go b/x/blobstream/types/data_commitment.go similarity index 100% rename from x/qgb/types/data_commitment.go rename to x/blobstream/types/data_commitment.go diff --git a/x/qgb/types/errors.go b/x/blobstream/types/errors.go similarity index 100% rename from x/qgb/types/errors.go rename to x/blobstream/types/errors.go diff --git a/x/qgb/types/events.go b/x/blobstream/types/events.go similarity index 100% rename from x/qgb/types/events.go rename to x/blobstream/types/events.go diff --git a/x/qgb/types/genesis.go b/x/blobstream/types/genesis.go similarity index 93% rename from x/qgb/types/genesis.go rename to x/blobstream/types/genesis.go index 945856f58e..6d8f5cc334 100644 --- a/x/qgb/types/genesis.go +++ b/x/blobstream/types/genesis.go @@ -9,12 +9,12 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -// DefaultParamspace defines the default qgb module parameter subspace +// DefaultParamspace defines the default blobstream module parameter subspace const ( DefaultParamspace = ModuleName // MinimumDataCommitmentWindow is a constant that defines the minimum - // allowable window for the QGB data commitments. + // allowable window for the Blobstream data commitments. MinimumDataCommitmentWindow = 100 ) @@ -41,7 +41,7 @@ func (gs GenesisState) Validate() error { return nil } -// ParamKeyTable for qgb module +// ParamKeyTable for blobstream module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } diff --git a/x/qgb/types/genesis.pb.go b/x/blobstream/types/genesis.pb.go similarity index 96% rename from x/qgb/types/genesis.pb.go rename to x/blobstream/types/genesis.pb.go index 0a831973b5..58d29c7ccd 100644 --- a/x/qgb/types/genesis.pb.go +++ b/x/blobstream/types/genesis.pb.go @@ -23,7 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params represent the Quantum Gravity Bridge genesis and store parameters. +// Params represent Blobstream genesis and store parameters. type Params struct { DataCommitmentWindow uint64 `protobuf:"varint,1,opt,name=data_commitment_window,json=dataCommitmentWindow,proto3" json:"data_commitment_window,omitempty"` } @@ -68,7 +68,7 @@ func (m *Params) GetDataCommitmentWindow() uint64 { return 0 } -// GenesisState struct, containing all persistent data required by the QGB +// GenesisState struct, containing all persistent data required by Blobstream // module type GenesisState struct { Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` @@ -122,7 +122,7 @@ func init() { func init() { proto.RegisterFile("celestia/qgb/v1/genesis.proto", fileDescriptor_10da5f8e88ce2856) } var fileDescriptor_10da5f8e88ce2856 = []byte{ - // 244 bytes of a gzipped FileDescriptorProto + // 252 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x4e, 0xcd, 0x49, 0x2d, 0x2e, 0xc9, 0x4c, 0xd4, 0x2f, 0x4c, 0x4f, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0x49, 0xeb, 0x15, 0xa6, @@ -133,12 +133,12 @@ var fileDescriptor_10da5f8e88ce2856 = []byte{ 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0x89, 0x80, 0x64, 0x9d, 0xe1, 0x92, 0xe1, 0x60, 0x39, 0x2b, 0x96, 0x86, 0x3b, 0x0a, 0x0c, 0x4a, 0xf6, 0x5c, 0x3c, 0xee, 0x10, 0xa7, 0x05, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0xe9, 0x73, 0xb1, 0x15, 0x80, 0x4d, 0x05, 0xeb, 0xe5, 0x36, 0x12, 0xd7, 0x43, 0x73, - 0xaa, 0x1e, 0xc4, 0xd2, 0x20, 0xa8, 0x32, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, + 0xaa, 0x1e, 0xc4, 0xd2, 0x20, 0xa8, 0x32, 0xa7, 0x80, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, - 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, - 0x19, 0x92, 0x5f, 0x94, 0x0e, 0x67, 0xeb, 0x26, 0x16, 0x14, 0xe8, 0x57, 0x80, 0xbd, 0x06, 0xf6, - 0x57, 0x12, 0x1b, 0xd8, 0x63, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x65, 0x44, 0x29, - 0x3d, 0x01, 0x00, 0x00, + 0x96, 0x63, 0x88, 0x32, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, + 0x19, 0x92, 0x5f, 0x94, 0x0e, 0x67, 0xeb, 0x26, 0x16, 0x14, 0xe8, 0x57, 0xe8, 0x27, 0xe5, 0xe4, + 0x27, 0x15, 0x97, 0x14, 0xa5, 0x26, 0xe6, 0x42, 0xbc, 0x97, 0xc4, 0x06, 0xf6, 0x9f, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0x11, 0x19, 0x03, 0x69, 0x44, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/qgb/types/genesis_test.go b/x/blobstream/types/genesis_test.go similarity index 96% rename from x/qgb/types/genesis_test.go rename to x/blobstream/types/genesis_test.go index 7dd262f939..478c787a0f 100644 --- a/x/qgb/types/genesis_test.go +++ b/x/blobstream/types/genesis_test.go @@ -5,7 +5,7 @@ import ( "github.com/celestiaorg/celestia-app/pkg/appconsts" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" "github.com/stretchr/testify/require" ) diff --git a/x/qgb/types/keys.go b/x/blobstream/types/keys.go similarity index 100% rename from x/qgb/types/keys.go rename to x/blobstream/types/keys.go diff --git a/x/qgb/types/msgs.go b/x/blobstream/types/msgs.go similarity index 100% rename from x/qgb/types/msgs.go rename to x/blobstream/types/msgs.go diff --git a/x/qgb/types/msgs_test.go b/x/blobstream/types/msgs_test.go similarity index 100% rename from x/qgb/types/msgs_test.go rename to x/blobstream/types/msgs_test.go diff --git a/x/qgb/types/query.pb.go b/x/blobstream/types/query.pb.go similarity index 94% rename from x/qgb/types/query.pb.go rename to x/blobstream/types/query.pb.go index ed7df634a6..3917870f41 100644 --- a/x/qgb/types/query.pb.go +++ b/x/blobstream/types/query.pb.go @@ -762,60 +762,61 @@ func init() { func init() { proto.RegisterFile("celestia/qgb/v1/query.proto", fileDescriptor_c8535c57355a2b91) } var fileDescriptor_c8535c57355a2b91 = []byte{ - // 848 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcb, 0x4f, 0xeb, 0x46, - 0x14, 0xc6, 0xe3, 0x0a, 0x22, 0xf5, 0x20, 0xf1, 0x98, 0x84, 0x50, 0x0c, 0x35, 0xe0, 0xf0, 0x2c, - 0xc5, 0x23, 0x42, 0x1f, 0x2a, 0xd0, 0x05, 0x69, 0xa9, 0x40, 0xa2, 0xaf, 0x48, 0x65, 0xd1, 0x45, - 0xd1, 0x24, 0x19, 0x8c, 0xd5, 0xd8, 0x93, 0xd8, 0x4e, 0xd4, 0xa8, 0xed, 0xa6, 0x7f, 0x41, 0xa5, - 0x2e, 0xbb, 0xee, 0xb6, 0xab, 0xae, 0xda, 0x65, 0x37, 0x88, 0x15, 0x52, 0x37, 0x5d, 0x55, 0x15, - 0xdc, 0x3f, 0xe4, 0x2a, 0xe3, 0x99,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x98, - 0x6b, 0x76, 0x9f, 0xf7, 0x48, 0xbd, 0x8e, 0xbf, 0xe3, 0x9e, 0xfc, 0x83, 0xb2, 0x9c, 0xe6, 0x9f, - 0x3d, 0x07, 0x2f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x58, 0x42, 0xec, 0x98, 0xbd, 0x0a, 0x00, 0x00, + // 855 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x4f, 0x33, 0x45, + 0x18, 0xc7, 0xbb, 0xe6, 0x7d, 0x9b, 0xf8, 0x90, 0xbc, 0x2f, 0x4c, 0x4b, 0x91, 0x05, 0x17, 0xd8, + 0xf2, 0x53, 0x64, 0x27, 0x14, 0xc5, 0x08, 0x78, 0xa0, 0x8a, 0xc1, 0x04, 0x15, 0x9b, 0xc8, 0xc1, + 0x83, 0x64, 0xb6, 0x1d, 0x96, 0x8d, 0xdd, 0x9d, 0x76, 0x77, 0xdb, 0xd8, 0xa8, 0x17, 0xff, 0x02, + 0x13, 0x8f, 0x9e, 0xbd, 0x7a, 0xf2, 0xa4, 0x47, 0x2f, 0x84, 0x13, 0x89, 0x17, 0x4f, 0xc6, 0x80, + 0x7f, 0x88, 0xe9, 0xec, 0x4c, 0xd9, 0x76, 0xb7, 0xdb, 0x96, 0x78, 0xdb, 0x99, 0x79, 0xbe, 0xdf, + 0xe7, 0xf3, 0x0c, 0xec, 0xb7, 0x0b, 0x0b, 0x55, 0x5a, 0xa7, 0x7e, 0x60, 0x13, 0xdc, 0xb4, 0x4c, + 0xdc, 0xde, 0xc5, 0xcd, 0x16, 0xf5, 0x3a, 0x46, 0xc3, 0x63, 0x01, 0x43, 0x2f, 0xe5, 0xa1, 0xd1, + 0xb4, 0x4c, 0xa3, 0xbd, 0xab, 0xbe, 0x3e, 0x58, 0x6d, 0x51, 0x97, 0xfa, 0xb6, 0x1f, 0xd6, 0xab, + 0x31, 0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e, 0x50, 0x60, 0x31, 0x2d, 0x46, 0xd0, 0xbb, 0xc9, 0x0d, 0xc7, 0x88, 0x2f, + 0xf5, 0xe0, 0x29, 0x52, 0x81, 0xfc, 0x26, 0x47, 0x5e, 0x47, 0xab, 0x12, 0x79, 0x20, 0xc3, 0xb0, + 0xd7, 0xd5, 0xe1, 0x30, 0x10, 0xd1, 0xcf, 0x0a, 0xe4, 0x93, 0xf2, 0x1b, 0xed, 0xa6, 0x5d, 0x57, + 0xe2, 0xef, 0x81, 0x5a, 0x9a, 0x44, 0x22, 0x68, 0xd7, 0x39, 0xed, 0x32, 0xd2, 0x86, 0xd1, 0x8a, + 0x7f, 0xec, 0x6f, 0x01, 0x1e, 0x53, 0x0f, 0x6d, 0x24, 0x77, 0x8a, 0xc5, 0xab, 0xba, 0x39, 0xba, + 0x50, 0x80, 0x2c, 0x70, 0x90, 0x59, 0x94, 0x93, 0x20, 0x91, 0x38, 0x2d, 0x9f, 0xdf, 0xdc, 0x6b, + 0xca, 0xdd, 0xbd, 0xa6, 0xfc, 0x73, 0xaf, 0x29, 0x3f, 0x3c, 0x68, 0x99, 0xbb, 0x07, 0x2d, 0xf3, + 0xd7, 0x83, 0x96, 0xf9, 0x62, 0xdf, 0xb2, 0x83, 0xeb, 0x96, 0x69, 0x54, 0x99, 0x83, 0x65, 0x2b, + 0xe6, 0x59, 0xbd, 0xe7, 0x1d, 0xd2, 0x68, 0xe0, 0xaf, 0xb1, 0x59, 0x67, 0xa6, 0x1f, 0x78, 0x94, + 0x38, 0xe1, 0x77, 0xa5, 0x99, 0xe5, 0x5f, 0x3f, 0x7b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x1d, + 0x22, 0x0e, 0x84, 0xc4, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -830,7 +831,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Params queries the current parameters for the qgb module + // Params queries the current parameters for the blobstream module Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // AttestationRequestByNonce queries attestation request by nonce. // Returns nil if not found. @@ -937,7 +938,7 @@ func (c *queryClient) EVMAddress(ctx context.Context, in *QueryEVMAddressRequest // QueryServer is the server API for Query service. type QueryServer interface { - // Params queries the current parameters for the qgb module + // Params queries the current parameters for the blobstream module Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // AttestationRequestByNonce queries attestation request by nonce. // Returns nil if not found. diff --git a/x/qgb/types/query.pb.gw.go b/x/blobstream/types/query.pb.gw.go similarity index 100% rename from x/qgb/types/query.pb.gw.go rename to x/blobstream/types/query.pb.gw.go diff --git a/x/qgb/types/tx.pb.go b/x/blobstream/types/tx.pb.go similarity index 88% rename from x/qgb/types/tx.pb.go rename to x/blobstream/types/tx.pb.go index 156e6da216..0c6482f9e1 100644 --- a/x/qgb/types/tx.pb.go +++ b/x/blobstream/types/tx.pb.go @@ -130,28 +130,28 @@ func init() { func init() { proto.RegisterFile("celestia/qgb/v1/tx.proto", fileDescriptor_85ed1095628e2204) } var fileDescriptor_85ed1095628e2204 = []byte{ - // 330 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0x4e, 0xcd, 0x49, - 0x2d, 0x2e, 0xc9, 0x4c, 0xd4, 0x2f, 0x4c, 0x4f, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xc9, 0xe8, 0x15, 0xa6, 0x27, 0xe9, 0x95, 0x19, 0x4a, - 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xe5, 0xf4, 0x41, 0x2c, 0x88, 0x32, 0x29, 0xc9, 0xe4, 0xfc, - 0xe2, 0xdc, 0xfc, 0xe2, 0x78, 0x88, 0x04, 0x84, 0x03, 0x95, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, - 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, - 0x83, 0xca, 0x2a, 0xd5, 0x73, 0x89, 0xfa, 0x16, 0xa7, 0x07, 0xa5, 0xa6, 0x67, 0x16, 0x97, 0xa4, - 0x16, 0xb9, 0x86, 0xf9, 0x3a, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x0b, 0xb9, 0x72, 0x09, 0x96, - 0x25, 0xe6, 0x64, 0xa6, 0x24, 0x96, 0xe4, 0x17, 0xc5, 0x27, 0x42, 0x04, 0x25, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x9d, 0x24, 0x2e, 0x6d, 0xd1, 0x15, 0x81, 0xda, 0x01, 0x55, 0x1e, 0x5c, 0x52, 0x94, - 0x99, 0x97, 0x1e, 0x24, 0x00, 0xd7, 0x02, 0x33, 0x46, 0x9e, 0x8b, 0x3b, 0xb5, 0x2c, 0x17, 0x6e, - 0x00, 0x13, 0xc8, 0x80, 0x20, 0xae, 0xd4, 0xb2, 0x5c, 0xa8, 0x02, 0x25, 0x79, 0x2e, 0x59, 0xac, - 0x0e, 0x08, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x35, 0x9a, 0xc5, 0xc8, 0xc5, 0xec, 0x5b, - 0x9c, 0x2e, 0x34, 0x89, 0x91, 0x4b, 0x08, 0x8b, 0x3b, 0xd5, 0xf4, 0xd0, 0x42, 0x48, 0x0f, 0xab, - 0x71, 0x52, 0x7a, 0xc4, 0xa9, 0x83, 0x59, 0xab, 0xa4, 0xd2, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x39, - 0x21, 0x19, 0x58, 0x94, 0x14, 0x41, 0xd5, 0xc6, 0x23, 0xf9, 0xc7, 0xc9, 0xf3, 0xc4, 0x23, 0x39, - 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, - 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, - 0xf3, 0x73, 0xf5, 0x61, 0x36, 0xe7, 0x17, 0xa5, 0xc3, 0xd9, 0xba, 0x89, 0x05, 0x05, 0xfa, 0x15, - 0x60, 0xc3, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x11, 0x62, 0x0c, 0x08, 0x00, 0x00, - 0xff, 0xff, 0x45, 0x99, 0xbb, 0x9f, 0x0c, 0x02, 0x00, 0x00, + // 335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0x03, 0x31, + 0x10, 0x86, 0x9b, 0x0a, 0x82, 0xf1, 0xa0, 0x2e, 0x15, 0x6a, 0xa9, 0xa9, 0x14, 0x11, 0x2f, 0x4d, + 0xa8, 0x82, 0x77, 0x0b, 0x3d, 0x16, 0x64, 0x05, 0x0f, 0x5e, 0x4a, 0xb6, 0x0d, 0x31, 0xb0, 0xbb, + 0xb3, 0xcd, 0xc4, 0xa5, 0x9e, 0x04, 0x9f, 0x40, 0xf4, 0xe6, 0x73, 0xf8, 0x10, 0x1e, 0x8b, 0x5e, + 0x3c, 0x4a, 0xeb, 0x83, 0x48, 0xbb, 0xbb, 0x45, 0xa4, 0x07, 0x6f, 0x93, 0xfc, 0x5f, 0xfe, 0x7f, + 0x32, 0x43, 0xab, 0x03, 0x15, 0x2a, 0x74, 0x46, 0x8a, 0x91, 0x0e, 0x44, 0xda, 0x16, 0x6e, 0xcc, + 0x13,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 0x69, 0x32, 0x63, 0xa5, 0xcf, 0x19, 0x2b, 0x5d, 0x9f, 0x69, + 0xe3, 0x6e, 0x6e, 0x03, 0x3e, 0x80, 0x48, 0x14, 0xc9, 0x60, 0xf5, 0xb2, 0x6e, 0xc9, 0x24, 0x11, + 0x63, 0x11, 0x84, 0x10, 0xa0, 0xb3, 0x4a, 0x46, 0xc2, 0xdd, 0x25, 0x0a, 0x83, 0xf5, 0xc5, 0x5e, + 0x4e, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x18, 0x1a, 0xed, 0x13, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/qgb/types/tx.pb.gw.go b/x/blobstream/types/tx.pb.gw.go similarity index 100% rename from x/qgb/types/tx.pb.gw.go rename to x/blobstream/types/tx.pb.gw.go diff --git a/x/qgb/types/types.go b/x/blobstream/types/types.go similarity index 100% rename from x/qgb/types/types.go rename to x/blobstream/types/types.go diff --git a/x/qgb/types/types.pb.go b/x/blobstream/types/types.pb.go similarity index 89% rename from x/qgb/types/types.pb.go rename to x/blobstream/types/types.pb.go index 294f63b15c..34078b961b 100644 --- a/x/qgb/types/types.pb.go +++ b/x/blobstream/types/types.pb.go @@ -83,7 +83,7 @@ func (m *BridgeValidator) GetEvmAddress() string { return "" } -// Valset is the EVM Bridge Multsig Set, each qgb validator also +// Valset is the EVM Bridge Multsig Set, each Blobstream validator also // maintains an ETH key to sign messages, these are used to check signatures on // ETH because of the significant gas savings type Valset struct { @@ -249,34 +249,34 @@ func init() { func init() { proto.RegisterFile("celestia/qgb/v1/types.proto", fileDescriptor_5db0e6d49b998544) } var fileDescriptor_5db0e6d49b998544 = []byte{ - // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xcd, 0x52, 0x13, 0xda, 0x8d, 0x44, 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c, 0x5b, 0x9f, 0x89, 0xba, 0xe6, 0x9f, 0xdc, 0x23, 0xba, 0x2f, 0xcc, 0x86, - 0xce, 0xc7, 0xb3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x9d, 0xfb, 0xb5, 0xa5, 0x02, 0x00, - 0x00, + // 424 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x6f, 0xd3, 0x30, + 0x18, 0x86, 0x6b, 0x16, 0xca, 0xe6, 0x4a, 0x4c, 0x0a, 0x13, 0x94, 0x4e, 0x4a, 0xaa, 0x9e, 0x7a, + 0x99, 0xad, 0x0d, 0x09, 0x21, 0x4e, 0x2c, 0x70, 0x80, 0x1b, 0x8a, 0xd0, 0x0e, 0x5c, 0x2a, 0x3b, + 0xf9, 0x70, 0x2d, 0xe2, 0x7c, 0x69, 0xec, 0x06, 0xf8, 0x17, 0xfb, 0x31, 0x48, 0xfc, 0x85, 0x09, + 0x2e, 0x3b, 0x72, 0x02, 0xd4, 0xfe, 0x11, 0x94, 0xb8, 0xe1, 0x30, 0x89, 0xdb, 0x6e, 0x7e, 0xbf, + 0xc7, 0xdf, 0xab, 0xf7, 0xb5, 0x4c, 0x8f, 0x33, 0x28, 0xc0, 0x3a, 0x2d, 0xf8, 0x4a, 0x49, 0xde, + 0x9c, 0x72, 0xf7, 0xa5, 0x02, 0xcb, 0xaa, 0x1a, 0x1d, 0x86, 0x87, 0x3d, 0x64, 0x2b, 0x25, 0x59, + 0x73, 0x3a, 0x39, 0x52, 0xa8, 0xb0, 0x63, 0xbc, 0x3d, 0xf9, 0x6b, 0x93, 0xc7, 0x19, 0x5a, 0x83, + 0x76, 0xe1, 0x81, 0x17, 0x3b, 0x14, 0x2b, 0x44, 0x55, 0x00, 0xef, 0x94, 0x5c, 0x7f, 0xe0, 0x4e, + 0x1b, 0xb0, 0x4e, 0x98, 0xca, 0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 0x04, 0x29, 0xed, 0x46, + 0x49, 0x3b, 0x09, 0x8f, 0xe9, 0x01, 0x94, 0xf9, 0x0e, 0xfb, 0xdc, 0xfb, 0x50, 0xe6, 0x1e, 0xde, + 0x7e, 0xf2, 0xe4, 0xed, 0xd5, 0x26, 0x22, 0xd7, 0x9b, 0x88, 0xfc, 0xd9, 0x44, 0xe4, 0x72, 0x1b, + 0x0d, 0xae, 0xb7, 0xd1, 0xe0, 0xe7, 0x36, 0x1a, 0xbc, 0x7f, 0xaa, 0xb4, 0x5b, 0xae, 0x25, 0xcb, + 0xd0, 0xf0, 0xfe, 0xe5, 0xb1, 0x56, 0xff, 0xce, 0x27, 0xa2, 0xaa, 0xf8, 0x67, 0x2e, 0x0b, 0x94, + 0xd6, 0xd5, 0x20, 0x8c, 0xff, 0x8c, 0x72, 0xd8, 0xc5, 0x79, 0xf2, 0x37, 0x00, 0x00, 0xff, 0xff, + 0x43, 0xb6, 0x7e, 0xfe, 0xac, 0x02, 0x00, 0x00, } func (m *BridgeValidator) Marshal() (dAtA []byte, err error) { diff --git a/x/qgb/types/types_test.go b/x/blobstream/types/types_test.go similarity index 99% rename from x/qgb/types/types_test.go rename to x/blobstream/types/types_test.go index d0b4bd80fb..8520ca0233 100644 --- a/x/qgb/types/types_test.go +++ b/x/blobstream/types/types_test.go @@ -5,7 +5,7 @@ import ( mrand "math/rand" "testing" - "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/celestiaorg/celestia-app/x/blobstream/types" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" ) diff --git a/x/qgb/types/validator.go b/x/blobstream/types/validator.go similarity index 94% rename from x/qgb/types/validator.go rename to x/blobstream/types/validator.go index 18d4971f1f..ece35f70c7 100644 --- a/x/qgb/types/validator.go +++ b/x/blobstream/types/validator.go @@ -96,22 +96,22 @@ func EVMAddrLessThan(e common.Address, o common.Address) bool { } // PowerDiff returns the difference in power between two bridge validator sets. -// Note this is QGB bridge power *not* Cosmos voting power. +// Note this is Blobstream bridge power *not* Cosmos voting power. // Cosmos voting power is based on the absolute number of tokens in the staking // pool at any given time. -// QGB bridge power is normalized using the equation. +// Blobstream bridge power is normalized using the equation. // // validators cosmos voting power / total cosmos voting power in this block = -// QGB bridge power / u32_max +// Blobstream bridge power / u32_max // // As an example if someone has 52% of the Cosmos voting power when a validator -// set is created their QGB bridge voting power is u32_max * .52 +// set is created their Blobstream bridge voting power is u32_max * .52 // // Normalized voting power dramatically reduces how often we have to produce new // validator set updates. For example if the total on chain voting power // increases by 1% due to inflation, we shouldn't have to generate a new // validator set, after all the validators retained their relative percentages -// during inflation and normalized QGB power shows no difference. +// during inflation and normalized Blobstream power shows no difference. func (ibv InternalBridgeValidators) PowerDiff(c InternalBridgeValidators) float64 { powers := map[string]int64{} // loop over ibv and initialize the map with their powers diff --git a/x/qgb/types/valset.go b/x/blobstream/types/valset.go similarity index 91% rename from x/qgb/types/valset.go rename to x/blobstream/types/valset.go index 4dfdf4b26e..649f309ceb 100644 --- a/x/qgb/types/valset.go +++ b/x/blobstream/types/valset.go @@ -39,7 +39,7 @@ func (v *Valset) SignBytes() (ethcmn.Hash, error) { // checkpointAbiJson but other than that it's a constant that has no impact // on the output. This is because it gets encoded as a function name which // we must then discard. - bytes, err := InternalQGBabi.Pack( + bytes, err := InternalBlobstreamABI.Pack( "domainSeparateValidatorSetHash", VsDomainSeparator, big.NewInt(int64(v.Nonce)), @@ -56,7 +56,7 @@ func (v *Valset) SignBytes() (ethcmn.Hash, error) { return hash, nil } -// Hash mimics the 'computeValsetHash' function used by the qgb contracts by +// Hash mimics the 'computeValsetHash' function used by the Blobstream contracts by // using a Valset to compute the hash of the abi encoded validator set. func (v *Valset) Hash() (ethcmn.Hash, error) { ethVals := make([]wrapper.Validator, len(v.Members)) @@ -67,7 +67,7 @@ func (v *Valset) Hash() (ethcmn.Hash, error) { } } - encodedVals, err := InternalQGBabi.Pack("computeValidatorSetHash", ethVals) + encodedVals, err := InternalBlobstreamABI.Pack("computeValidatorSetHash", ethVals) if err != nil { return ethcmn.Hash{}, err } diff --git a/x/qgb/keeper/keeper_attestation_test.go b/x/qgb/keeper/keeper_attestation_test.go deleted file mode 100644 index c83eae833a..0000000000 --- a/x/qgb/keeper/keeper_attestation_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package keeper_test - -import ( - "testing" - - testutil "github.com/celestiaorg/celestia-app/test/util" - "github.com/celestiaorg/celestia-app/x/qgb" - "github.com/stretchr/testify/assert" -) - -func TestCheckLatestAttestationNonce(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper - - // check if the latest attestation nonce is init - exists := k.CheckLatestAttestationNonce(input.Context) - assert.False(t, exists) - - // init the latest attestation nonce - input.QgbKeeper.SetLatestAttestationNonce(input.Context, qgb.InitialLatestAttestationNonce) - - // check if the latest attestation nonce value was initialized correctly - input.QgbKeeper.CheckLatestAttestationNonce(input.Context) - assert.Equal(t, qgb.InitialLatestAttestationNonce, input.QgbKeeper.GetLatestAttestationNonce(input.Context)) -} - -func TestCheckEarliestAvailableAttestationNonce(t *testing.T) { - input := testutil.CreateTestEnvWithoutQGBKeysInit(t) - k := input.QgbKeeper - - // check if the earliest available attestation nonce is init - exists := k.CheckEarliestAvailableAttestationNonce(input.Context) - assert.False(t, exists) - - // init the earliest available attestation nonce - input.QgbKeeper.SetEarliestAvailableAttestationNonce(input.Context, qgb.InitialEarliestAvailableAttestationNonce) - - // check if the earliest attestation nonce value was initialized correctly - input.QgbKeeper.CheckEarliestAvailableAttestationNonce(input.Context) - assert.Equal(t, qgb.InitialEarliestAvailableAttestationNonce, input.QgbKeeper.GetEarliestAvailableAttestationNonce(input.Context)) -} diff --git a/x/qgb/overview.md b/x/qgb/overview.md deleted file mode 100644 index 0958c4818b..0000000000 --- a/x/qgb/overview.md +++ /dev/null @@ -1,116 +0,0 @@ -# Overview - -The Quantum Gravity Bridge (QGB) is a one way bridge from Celestia to EVM chains. It provides a way for rollups using Celestia for Data Availability (DA), and an EVM chain as a settlement layer, to prove on-chain that the rollup data was correctly posted to Celestia and verify fraud proofs otherwise. These types of rollups are called Celestiums and are discussed in the [Quantum Gravity Bridge: Secure Off-Chain Data Availability for Ethereum L2s with Celestia](https://blog.celestia.org/celestiums) blog post. - -The QGB implementation consists of three components: The [state machine](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb), the [orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer), and the [QGB smart contract](https://github.com/celestiaorg/quantum-gravity-bridge). - -## [State machine](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb) - -The state machine is the `qgb` module implementation. It is responsible for creating [attestations](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/types/attestation.go#L10-L18) which are signed by [orchestrators](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md). Each Celestia validator is expected to also run an orchestrator. [Relayers](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) periodically query the Celestia state for attestations and submit them to the QGB smart contract deployed on some EVM chain. - -There are two types of [attestations](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/types/attestation.go#L10-L18): [valsets](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/proto/celestia/qgb/v1/types.proto#L18-L33) and [data commitments](https://github.com/celestiaorg/celestia-app/blob/376a1d4c0f321f12ba78279d2bd34fc6cb5e6dc2/proto/celestia/qgb/v1/types.proto#L35-L55). - -All attestations have a [`nonce`](https://github.com/celestiaorg/celestia-app/blob/8ae6a84b2c99e55625bbe99f70db1e5a985c9675/x/qgb/types/attestation.go#L16) field that defines the order in which the attestations are generated. This nonce is stored in the QGB smart contract as per [ADR-004](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md#decision), and is used to order attestation submissions on the EVM chain. - -### [Valsets](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#valsets) - -A [valset](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#valsets) represents a validator set snapshot. It contains a list of validators' EVM addresses along with their [QGB staking power](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#validator-power-normalization). It enables the QGB smart contract to track the state of the Celestia validator set. This is necessary so that the QGB smart contract can determine when a 2/3 threshold has signed that a particular data hash has been made available on Celestia. - -A valset is [generated](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#valset-handler) inside the state machine. It is then queried, signed, and submitted to the [QGB P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66) by orchestrators. After more than 2/3rds of the Celestia validator set have submitted their signatures, [relayers](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) relay the attestation to the QGB smart contract along with the signatures to be [verified](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L172-L211) and eventually [stored](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L266-L268). - -The QGB smart contract keeps track of the [last validator set hash](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L44-L45) and its corresponding [power threshold](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L46-L47). This way, the contract will always be able to verify if attestations were signed using the correct Celestia validator set, and if the provided signatures represent a majority. - -### [Data commitments](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#data-commitments) - -A [data commitment](https://github.com/celestiaorg/celestia-app/tree/main/x/qgb#data-commitments) is an attestation type representing a request to commit over a set of blocks. It provides an end exclusive range of blocks for orchestrators to sign over and propagate in the QGB P2P network. The range is defined by the param [`DataCommitmentWindow`](https://github.com/celestiaorg/celestia-app/blob/fc83b04c3a5638ac8d415770e38a4046b84fa128/x/qgb/keeper/keeper_data_commitment.go#L44-L50). - -The data commitment is a Merkle tree over a sequential set of blocks. These blocks are represented as a tuple of the [data root](https://github.com/celestiaorg/celestia-core/blob/6933af1ead0ddf4a8c7516690e3674c6cdfa7bd8/rpc/core/blocks.go#L549), and the [height](https://github.com/celestiaorg/celestia-core/blob/6933af1ead0ddf4a8c7516690e3674c6cdfa7bd8/rpc/core/blocks.go#L548). This commitment can be queried from core using the [`DataCommitment`](https://github.com/celestiaorg/celestia-core/blob/6933af1ead0ddf4a8c7516690e3674c6cdfa7bd8/rpc/core/blocks.go#L210-L227) query and allows generating Merkle inclusion proofs for any blob in any block in the set. - -When an orchestrator sees a newly generated data commitment, it queries the previous valset and checks whether it's part of its validator set. Then, the orchestrator signs the new data commitment and submits that signature to the [QGB P2P network](https://github.com/celestiaorg/orchestrator-relayer/pull/66). Otherwise, it ignores it and waits for new attestations. - -After the relayer finds more than 2/3rd signatures of that data commitment, it relays the commitment along with the signatures to the QGB smart contract where they get [verified](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L172-L211). Then, the smart contract [saves](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L331-L332) the commitment to the [state](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L50-L51) thus allowing for Merkle-based inclusion proof verification for any blob posted to any committed block. - -## [Orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer) - -The [orchestrator-relayer](https://github.com/celestiaorg/orchestrator-relayer) contains the implementation of the QGB orchestrator and relayer. - -### [Orchestrator](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md) - -An [orchestrator](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md) is the software responsible for querying the state machine for new attestations, signs them, and then submits them to the QGB P2P network. - -At startup, it [loads](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/orchestrator.md#evm-key) the EVM private key corresponding to the address used when creating the validator. Then, it uses it to sign the attestations digests before submitting them to the P2P network. - -An attestation digest is a bytes array containing a digest of the attestation relevant information. More on this in the [hashes format](#hashes-format) section. - -The orchestrator generally needs access to the validator's RPC/gRPC endpoints. However, it still can use public ones if needed. Its only hard requirement is having access to the specific private key for the target validator. Otherwise, the signatures will be invalid and the validator could get slashed in future versions. - -### [Relayer](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) - -A [relayer](https://github.com/celestiaorg/orchestrator-relayer/blob/main/docs/relayer.md) is the software responsible for querying the signatures of a validator set from the P2P network and aggregating them into a format that the [QGB smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) understands. - -It uses the previous valset to that attestation to know which validators should sign. Then, it looks for all of those signatures. - -When the relayer finds more than 2/3rds of the signatures, it immediately relays them to the QGB smart contract to be persisted, and starts again. - -For a [QGB smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) to not halt, it needs at least one relayer relaying signatures to it regularly. Otherwise, the QGB contract will be out of sync and will not be able to commit to new data. - -## [QGB smart contract](https://github.com/celestiaorg/quantum-gravity-bridge) - -The [QGB smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) is the source of truth for Celestiums. It allows proving/verifying that data was posted to the Celestia blockchain. - -In order to reflect the Celestia chain data, the [QGB smart contract](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol) keeps track of the validator set changes, via valset updates, and commits to batches of block information, via data commitments. - -### Validator set changes - -In order to submit a validator set change, the QGB smart contract provides the [`updateValidatorSet()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L213-L273) `external` method that takes the previous valset nonce, the new one's nonce, its power threshold and its hash, along with the actual validator set and the corresponding signatures, as `calldata` to be verified. Then, it [persists](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L266-L268) the nonce, the valset hash and the threshold in state so they can be used for future valset and data commitment updates. - -### Batches - -The batches in the QGB smart contract refer to the `data root tuple root`s described above. These are submitted using the [`submitDataRootTupleRoot()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L275-L337) `external` method. This latter takes the new batch nonce, its corresponding valset, the `data root tuple root`, along with the actual validator set and their corresponding signatures as `calldata`. Then, it verifies the signature and [persists](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L331-L332) the new data root tuple root to the state along with the new nonce. - -### Hashes format - -The digest created/verified in the QGB smart contract follow the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) standard for hashing data. - -#### Valset digest - -A valset digest is created inside the [`domainSeparateValidatorSetHash()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L137-L154) method. It is the `keccak256` hash of the concatenation of the following fields: - -- `VALIDATOR_SET_HASH_DOMAIN_SEPARATOR`: which is defined as a [constant](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/Constants.sol#L4-L6). -- The valset nonce: the [universal nonce](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md#decision) of the attestation representing that validator set change. -- The power threshold: the threshold defining 2/3rds of the validator set. -- The validator set hash: The keccak256 hash of the validator set which is calculated using the [`computeValidatorSetHash()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L131-L135) method. - -#### Data commitment digest - -A data commitment digest is created inside the [`domainSeparateDataRootTupleRoot()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L156-L170) method. It is the `keccak256` hash of the concatenation of the following fields: - -- `DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR`: which is defined as a [constant](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/Constants.sol#L8-L10). -- The data commitment nonce: the [universal nonce](https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-004-qgb-relayer-security.md#decision) of the attestation representing that data commitment. -- The data root tuple root: which is the commitment over the set of blocks defined [above](#data-commitments). - -### Signatures - -The signature scheme used for signing the above hashes follow the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) signing standard. It uses the `ECDSA` algorithm with the `secp256k1` curve. So, the orchestrator uses the keystore to [generate](https://github.com/celestiaorg/orchestrator-relayer/blob/09ebfdc312c0d9e08856fb98cfd089e956ab7f3a/evm/ethereum_signature.go#L18-L28) these signatures. - -The output signature is in the `[R || S || V]` format where `V` is `0` or `1`. This is defined in the QGB smart contract using the [Signature](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L17-L21) struct. - -These signatures are then verified in the smart contract using the [`verifySig()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L124-L129) method. - -## Security assumptions - -The security of the QGB relies on an honest majority of the Celestia validator set. This assumption indicates that more than 2/3s of the voting power follows each [block validity rule](../../specs/src/specs/block_validity_rules.md). Additionally, over 2/3s of the voting power sign valid validator set updates and data commitments, as outlined above. - -If more than 1/3rd of the validator set stops running their orchestrators, then the QGB halts. And, if more than 2/3rds sign invalid data, then the QGB contract will commit to invalid data. The only recovery from such a state is to revert to social consensus, potentially slashing the guilty validators and redeploying the smart contracts. - -## Slashing - -We still don't support slashing for equivocation, liveness or invalid signatures. However, if anything were to happen to the bridge, we would be able to social slash the corrupt validators and redeploy the contract. - -Future versions of the QGB will support slashing. It will be enforced via the use of [vote extensions](https://github.com/cometbft/cometbft/blob/v0.38.0/spec/abci/abci%2B%2B_methods.md#extendvote). - -## Proofs - -To prove that data was posted to an EVM chain, we have the following method: [`verifyAttestation()`](https://github.com/celestiaorg/quantum-gravity-bridge/blob/3cef3f5dfd37c3086fa40a6324f144595726dc16/src/QuantumGravityBridge.sol#L339-L358). This allows to verify that a data root tuple was committed to by the QGB smart contract. - -For the remaining proofs, i.e. shares to data root tuples proofs, the app is currently able to generate and verify them. However, these are still not supported at the smart contract level. Future works will focus on this.