diff --git a/.mockery.yaml b/.mockery.yaml index e50235991..329e8b37c 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -10,10 +10,10 @@ packages: github.com/dymensionxyz/dymint/settlement/dymension: interfaces: CosmosClient: - github.com/dymensionxyz/dymension/v3/x/sequencer/types: + github.com/dymensionxyz/dymint/third_party/dymension/sequencer/types: interfaces: QueryClient: - github.com/dymensionxyz/dymension/v3/x/rollapp/types: + github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types: interfaces: QueryClient: github.com/tendermint/tendermint/abci/types: @@ -32,5 +32,10 @@ packages: github.com/dymensionxyz/dymint/da: interfaces: DataAvailabilityLayerClient: + github.com/dymensionxyz/dymint/p2p: + interfaces: + GetProposerI: + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 361b6bc34..adaafa3a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,110 +1,65 @@ -# [](https://github.com/dymensionxyz/dymint/compare/v1.1.0-rc02...v) (2024-05-23) - - -### Bug Fixes - -* **code standards:** remove `someone is behaving badly` part of the log message upon app hash mismatch [#917](https://github.com/dymensionxyz/dymint/issues/917) ([d5eece4](https://github.com/dymensionxyz/dymint/commit/d5eece4d1e161829dfc8e63a4b6313cc30dd2ed2)) -* **bug:** memory leak in websocket handler ([#892](https://github.com/dymensionxyz/dymint/issues/892)) ([02fcbde](https://github.com/dymensionxyz/dymint/commit/48c263fbde71594ec34e0f731d9febc0702fcbde)) -* **bug:** sync from da and p2p when starting a node ([#763](https://github.com/dymensionxyz/dymint/issues/763)) ([68ffd05](https://github.com/dymensionxyz/dymint/commit/68ffd05794949ddc42df1c132d1fde5f21b505f4)) -* **celestia test:** fix race in test ([#755](https://github.com/dymensionxyz/dymint/issues/755)) ([0b36781](https://github.com/dymensionxyz/dymint/commit/0b367818bf6aa8da4a4fd8e4e5c78223b60b44e0)) -* **celestia:** impl retry on submit ([#748](https://github.com/dymensionxyz/dymint/issues/748)) ([61630eb](https://github.com/dymensionxyz/dymint/commit/61630eb458197abe2440a81426210000dff25d40)) -* **celestia:** use fixed delay in repeat attempts ([#753](https://github.com/dymensionxyz/dymint/issues/753)) ([53002b0](https://github.com/dymensionxyz/dymint/commit/53002b0a070743811295a98580ba038cac40cc7d)) -* **code standards:** bring over more linters and the github integration from hub repo ([#865](https://github.com/dymensionxyz/dymint/issues/865)) ([8c94983](https://github.com/dymensionxyz/dymint/commit/8c9498377948184be6651f012c171947eecdfc30)) -* **code standards:** inline NextValSetFromResponses ([#870](https://github.com/dymensionxyz/dymint/issues/870)) ([5a491ac](https://github.com/dymensionxyz/dymint/commit/5a491ac9436fcc7dd0da92fdb7ceb03bbdacaeab)) -* **code standards:** remove a few lines in manager start ([#866](https://github.com/dymensionxyz/dymint/issues/866)) ([c66afbb](https://github.com/dymensionxyz/dymint/commit/c66afbbeb3222ed92c965099f264fa70910e351e)) -* **code standards:** renames error -> err in celestia ([#768](https://github.com/dymensionxyz/dymint/issues/768)) ([1189384](https://github.com/dymensionxyz/dymint/commit/1189384d1225b3dd65481c9dedbae423e4f8ac04)) -* **code standards:** renames sync target file to sync file ([#877](https://github.com/dymensionxyz/dymint/issues/877)) ([6d2ecff](https://github.com/dymensionxyz/dymint/commit/6d2ecff2f202f61fec913c98800197cddaf60324)) -* **code standards:** use 'sequencer' instead of 'aggregator' ([#849](https://github.com/dymensionxyz/dymint/issues/849)) ([bd3c97d](https://github.com/dymensionxyz/dymint/commit/bd3c97d074c695876016834d64b4729bbdc46bbd)) -* **code standards:** use gerr err not found ([#878](https://github.com/dymensionxyz/dymint/issues/878)) ([60e221f](https://github.com/dymensionxyz/dymint/commit/60e221f372497906ca22b80b30389fb159bb859c)) -* **code standards:** use kv naming in store where appropriate ([#879](https://github.com/dymensionxyz/dymint/issues/879)) ([a10ad36](https://github.com/dymensionxyz/dymint/commit/a10ad365bda7b8483c2fa09cf3ae0cc02465331b)) -* **config:** pass through mempool config ([#820](https://github.com/dymensionxyz/dymint/issues/820)) ([ca012e9](https://github.com/dymensionxyz/dymint/commit/ca012e941ce267c7e7a03c9c698297d6dbdd6c02)) -* **da:** celestia height not updated when syncing ([#851](https://github.com/dymensionxyz/dymint/issues/851)) ([491f16d](https://github.com/dymensionxyz/dymint/commit/491f16d4bdf193d1f5e9c3a719eac7b9a46cde49)) -* **da:** fixed da path seperator and encoding issue ([#731](https://github.com/dymensionxyz/dymint/issues/731)) ([3a3b219](https://github.com/dymensionxyz/dymint/commit/3a3b21932750fee7eaaa9c186f78e36e3e597746)) -* **da:** full-nodes can sync from p2p while DA light client is down or out of sync ([#857](https://github.com/dymensionxyz/dymint/issues/857)) ([2b5eb07](https://github.com/dymensionxyz/dymint/commit/2b5eb07147142b91e13c2c483238e356e6c5871c)) -* **DA:** use expo backoff in retries ([#739](https://github.com/dymensionxyz/dymint/issues/739)) ([848085f](https://github.com/dymensionxyz/dymint/commit/848085f70bcaae81fb80da3ab78c4d8b399e13b1)) -* **dead code:** removes last submission time from manager ([#825](https://github.com/dymensionxyz/dymint/issues/825)) ([80b0324](https://github.com/dymensionxyz/dymint/commit/80b03241e2f2b46010dadca7cf3fa0b12486ea68)) -* **doc:** manager cache comment ([#767](https://github.com/dymensionxyz/dymint/issues/767)) ([b88bf6e](https://github.com/dymensionxyz/dymint/commit/b88bf6e72820c944b290147724255cc8466ada50)) -* **docs:** make submit loop comment more accurate re batch size ([#852](https://github.com/dymensionxyz/dymint/issues/852)) ([4f94340](https://github.com/dymensionxyz/dymint/commit/4f94340a857cf3485d800848d6371ed47f6ea732)) -* **linter:** gofumpt and fix golangcilint config ([#867](https://github.com/dymensionxyz/dymint/issues/867)) ([8777520](https://github.com/dymensionxyz/dymint/commit/8777520d8a4faaf6bad169aebded539c7e8123d3)) -* **local pub sub:** use error for subscription cancelled (instead of info) ([#853](https://github.com/dymensionxyz/dymint/issues/853)) ([1886e18](https://github.com/dymensionxyz/dymint/commit/1886e18d788b9b2745b1989a472084985578a147)) -* **logging:** added reason for websocket closed debug msg ([#746](https://github.com/dymensionxyz/dymint/issues/746)) ([3aa7d80](https://github.com/dymensionxyz/dymint/commit/3aa7d80ace92b3b0f79e4f338f10bb94c96ab6dd)) -* **logs:** make logs more readable in a couple places, fix race cond ([#749](https://github.com/dymensionxyz/dymint/issues/749)) ([f05ef39](https://github.com/dymensionxyz/dymint/commit/f05ef3957b754c05fbc90aa39eabce80bbe65933)) -* **manager:** get fresh height in loop ([#781](https://github.com/dymensionxyz/dymint/issues/781)) ([e4df480](https://github.com/dymensionxyz/dymint/commit/e4df48037a78965dbac9e747dd296f39360e396c)) -* **manager:** removes outdated syncTarget field ([#854](https://github.com/dymensionxyz/dymint/issues/854)) ([04b13a0](https://github.com/dymensionxyz/dymint/commit/04b13a0b78feda56a2ac16f8fdc49f1e0d5f1560)) -* **metrics:** pass metrics to mempool init ([#846](https://github.com/dymensionxyz/dymint/issues/846)) ([94267ae](https://github.com/dymensionxyz/dymint/commit/94267ae551de46bda60898c23f5092125e60aca6)) -* **p2p:** avoid receiving duplicated blocks ([#818](https://github.com/dymensionxyz/dymint/issues/818)) ([feb40f2](https://github.com/dymensionxyz/dymint/commit/feb40f2ca9eead8ecd9a8da2c5772c29a13ac5e5)) -* **p2p:** validate block before applying and not before caching in p2p gossiping ([#723](https://github.com/dymensionxyz/dymint/issues/723)) ([98371b5](https://github.com/dymensionxyz/dymint/commit/98371b5220613e70f3274fab5593e02ba532f7db)) -* **p2p:** validating gossiped block is created by the proposer ([#737](https://github.com/dymensionxyz/dymint/issues/737)) ([851b312](https://github.com/dymensionxyz/dymint/commit/851b312620233a9fb1abe55214a678322e7b0c68)) -* **produce loop:** handle unauthenticated error in settlement layer ([#726](https://github.com/dymensionxyz/dymint/issues/726)) ([33e78d1](https://github.com/dymensionxyz/dymint/commit/33e78d116b5f14b91b8b3bda2b6cbfee9040e2d3)) -* **rpc:** nil panic in rpc/json/handler.go WriteError ([#750](https://github.com/dymensionxyz/dymint/issues/750)) ([e09709b](https://github.com/dymensionxyz/dymint/commit/e09709b428a33da002defb9f13178fa19b81a69b)) -* **rpc:** remove unnecessary `:` in the json health response ([#876](https://github.com/dymensionxyz/dymint/issues/876)) ([55dd894](https://github.com/dymensionxyz/dymint/commit/55dd894e07aacd5983a055ec2a25676804c278ca)) -* **settlement:** filter by pending status in batch event ([#845](https://github.com/dymensionxyz/dymint/issues/845)) ([841056d](https://github.com/dymensionxyz/dymint/commit/841056d52d4b9bda2e2e806ec5a9c8559a43eeaf)) -* **settlement:** fixed submission bug where multiple events would cancel subscription ([#842](https://github.com/dymensionxyz/dymint/issues/842)) ([f7b9383](https://github.com/dymensionxyz/dymint/commit/f7b9383cf55976f3f55780055df7a6517e189034)) -* **settlement:** remove state index from proto ([#777](https://github.com/dymensionxyz/dymint/issues/777)) ([767b8fd](https://github.com/dymensionxyz/dymint/commit/767b8fdb490c37deee43ac023688410bbb98ccb0)) -* **sync:** make sure we use a latest state index as a start point ([#760](https://github.com/dymensionxyz/dymint/issues/760)) ([43e2d96](https://github.com/dymensionxyz/dymint/commit/43e2d965f2b505751f8e5260549e909c976141ee)) -* **sync:** removing height condition for applying cached blocks from p2p ([#787](https://github.com/dymensionxyz/dymint/issues/787)) ([b97299c](https://github.com/dymensionxyz/dymint/commit/b97299ce7f78168863c5e1c2d7fc479aed2ae6da)) -* **tests:** fix unit tests, mocks, cleanup/dry hub queries ([#782](https://github.com/dymensionxyz/dymint/issues/782)) ([c276aea](https://github.com/dymensionxyz/dymint/commit/c276aea12c9cd37f62fcf9d684c4efe901a510bf)) - - -### Features - -* **blockManager:** refactor and use state as single source of truth for height ([#847](https://github.com/dymensionxyz/dymint/issues/847)) ([73aae62](https://github.com/dymensionxyz/dymint/commit/73aae62f30acdc56816ad65550438d8830ac83db)) -* **ci:** new changelog workflow ([#858](https://github.com/dymensionxyz/dymint/issues/858)) ([5a562ad](https://github.com/dymensionxyz/dymint/commit/5a562ad818469495daeca4d403fb007a7f1e5b2d)) -* **DA:** expose configuration options for retry loop backoff ([#757](https://github.com/dymensionxyz/dymint/issues/757)) ([0cd09f3](https://github.com/dymensionxyz/dymint/commit/0cd09f3d0a8430c1e9f34814930c168553c143bc)) -* **da:** improve logging ([#871](https://github.com/dymensionxyz/dymint/issues/871)) ([7bcc837](https://github.com/dymensionxyz/dymint/commit/7bcc837e78ce41645a09dc773a419d8a1aa153f5)) -* **da:** remove availability checks from retriever ([#835](https://github.com/dymensionxyz/dymint/issues/835)) ([b16cfb6](https://github.com/dymensionxyz/dymint/commit/b16cfb61f64507deb51f740284b3d24d6e3d4b32)) -* **p2p:** add p2p advertising option ([#862](https://github.com/dymensionxyz/dymint/issues/862)) ([977019f](https://github.com/dymensionxyz/dymint/commit/977019f7c87a0d81e432a88bd4fa19e17bee5a06)) -* **p2p:** header gossiper removed ([#813](https://github.com/dymensionxyz/dymint/issues/813)) ([737b412](https://github.com/dymensionxyz/dymint/commit/737b4126c59846a2be57049a249843de5648dde8)) -* **p2p:** improving logs ([#872](https://github.com/dymensionxyz/dymint/issues/872)) ([c8d116e](https://github.com/dymensionxyz/dymint/commit/c8d116e36bce4811fb26ecbeac78cfcc8470579f)) -* **p2p:** moving gossiped blocks reception from validator to p2p client ([#811](https://github.com/dymensionxyz/dymint/issues/811)) ([0215717](https://github.com/dymensionxyz/dymint/commit/0215717e8baca6072ad28d067286d0b963d43015)) -* **p2p:** refactor p2p config options ([#861](https://github.com/dymensionxyz/dymint/issues/861)) ([70d9460](https://github.com/dymensionxyz/dymint/commit/70d946045d94bac9cff5e31d68e3dae14c1f82c1)) -* **produce:** limiting block size by maxBatchSize ([#784](https://github.com/dymensionxyz/dymint/issues/784)) ([f90042c](https://github.com/dymensionxyz/dymint/commit/f90042cd61fc6b60093478cd65491f8aa1106457)) -* set sequencer mode by hub and not by a flag ([#821](https://github.com/dymensionxyz/dymint/issues/821)) ([5848812](https://github.com/dymensionxyz/dymint/commit/58488123a6969b2977f541279e12f3a50341ea6e)) -* **settlement:** expose hub retry params to config ([#863](https://github.com/dymensionxyz/dymint/issues/863)) ([10c6ee9](https://github.com/dymensionxyz/dymint/commit/10c6ee99189afb1206e5cfeb606874f28aa4eeff)) +# [](https://github.com/dymensionxyz/dymint/compare/v1.2.0-rc01...v) (2024-07-30) -# [](https://github.com/dymensionxyz/dymint/compare/v1.1.0-rc02...v) (2024-05-23) +# [1.2.0-rc01](https://github.com/dymensionxyz/dymint/compare/v1.1.0-rc02...v1.2.0-rc01) (2024-07-28) ### Bug Fixes +* **block manage:** reducing batch overhead size when reaping Txs from mempool ([#886](https://github.com/dymensionxyz/dymint/issues/886)) ([5ff49c7](https://github.com/dymensionxyz/dymint/commit/5ff49c73bc962a704a619955586564a3a060e579)) +* **blockManager:** multiple accumulateddata trigger ([#960](https://github.com/dymensionxyz/dymint/issues/960)) ([6a33534](https://github.com/dymensionxyz/dymint/commit/6a3353405e6de87b0e85aab63ae12cc2629a6781)) * **bug:** sync from da and p2p when starting a node ([#763](https://github.com/dymensionxyz/dymint/issues/763)) ([68ffd05](https://github.com/dymensionxyz/dymint/commit/68ffd05794949ddc42df1c132d1fde5f21b505f4)) +* **build:** fix build with version baked in ([#909](https://github.com/dymensionxyz/dymint/issues/909)) ([15414d0](https://github.com/dymensionxyz/dymint/commit/15414d0a7bf16a614b24a4895be166e2c423107b)) * **celestia test:** fix race in test ([#755](https://github.com/dymensionxyz/dymint/issues/755)) ([0b36781](https://github.com/dymensionxyz/dymint/commit/0b367818bf6aa8da4a4fd8e4e5c78223b60b44e0)) * **celestia:** impl retry on submit ([#748](https://github.com/dymensionxyz/dymint/issues/748)) ([61630eb](https://github.com/dymensionxyz/dymint/commit/61630eb458197abe2440a81426210000dff25d40)) * **celestia:** use fixed delay in repeat attempts ([#753](https://github.com/dymensionxyz/dymint/issues/753)) ([53002b0](https://github.com/dymensionxyz/dymint/commit/53002b0a070743811295a98580ba038cac40cc7d)) * **code standards:** bring over more linters and the github integration from hub repo ([#865](https://github.com/dymensionxyz/dymint/issues/865)) ([8c94983](https://github.com/dymensionxyz/dymint/commit/8c9498377948184be6651f012c171947eecdfc30)) * **code standards:** inline NextValSetFromResponses ([#870](https://github.com/dymensionxyz/dymint/issues/870)) ([5a491ac](https://github.com/dymensionxyz/dymint/commit/5a491ac9436fcc7dd0da92fdb7ceb03bbdacaeab)) * **code standards:** remove a few lines in manager start ([#866](https://github.com/dymensionxyz/dymint/issues/866)) ([c66afbb](https://github.com/dymensionxyz/dymint/commit/c66afbbeb3222ed92c965099f264fa70910e351e)) +* **code standards:** remove misleading part of log message upon app hash mismatch ([#928](https://github.com/dymensionxyz/dymint/issues/928)) ([10068f8](https://github.com/dymensionxyz/dymint/commit/10068f86a7b1dc8a4c9e18a20f6523f9e2b19375)) * **code standards:** renames error -> err in celestia ([#768](https://github.com/dymensionxyz/dymint/issues/768)) ([1189384](https://github.com/dymensionxyz/dymint/commit/1189384d1225b3dd65481c9dedbae423e4f8ac04)) * **code standards:** renames sync target file to sync file ([#877](https://github.com/dymensionxyz/dymint/issues/877)) ([6d2ecff](https://github.com/dymensionxyz/dymint/commit/6d2ecff2f202f61fec913c98800197cddaf60324)) * **code standards:** use 'sequencer' instead of 'aggregator' ([#849](https://github.com/dymensionxyz/dymint/issues/849)) ([bd3c97d](https://github.com/dymensionxyz/dymint/commit/bd3c97d074c695876016834d64b4729bbdc46bbd)) +* **code standards:** use dymensionxyz/gerrc instead of gerr ([#925](https://github.com/dymensionxyz/dymint/issues/925)) ([a825c28](https://github.com/dymensionxyz/dymint/commit/a825c286f2d1fea7b9339b8cf227b81319dbe603)) * **code standards:** use gerr err not found ([#878](https://github.com/dymensionxyz/dymint/issues/878)) ([60e221f](https://github.com/dymensionxyz/dymint/commit/60e221f372497906ca22b80b30389fb159bb859c)) * **code standards:** use kv naming in store where appropriate ([#879](https://github.com/dymensionxyz/dymint/issues/879)) ([a10ad36](https://github.com/dymensionxyz/dymint/commit/a10ad365bda7b8483c2fa09cf3ae0cc02465331b)) * **config:** pass through mempool config ([#820](https://github.com/dymensionxyz/dymint/issues/820)) ([ca012e9](https://github.com/dymensionxyz/dymint/commit/ca012e941ce267c7e7a03c9c698297d6dbdd6c02)) * **da:** celestia height not updated when syncing ([#851](https://github.com/dymensionxyz/dymint/issues/851)) ([491f16d](https://github.com/dymensionxyz/dymint/commit/491f16d4bdf193d1f5e9c3a719eac7b9a46cde49)) * **da:** fixed da path seperator and encoding issue ([#731](https://github.com/dymensionxyz/dymint/issues/731)) ([3a3b219](https://github.com/dymensionxyz/dymint/commit/3a3b21932750fee7eaaa9c186f78e36e3e597746)) * **da:** full-nodes can sync from p2p while DA light client is down or out of sync ([#857](https://github.com/dymensionxyz/dymint/issues/857)) ([2b5eb07](https://github.com/dymensionxyz/dymint/commit/2b5eb07147142b91e13c2c483238e356e6c5871c)) +* **da:** grpc da type fix ([#911](https://github.com/dymensionxyz/dymint/issues/911)) ([2b5d21b](https://github.com/dymensionxyz/dymint/commit/2b5d21b32ca48bb075f175fce9580e30d77cc212)) +* **da:** submission retry function removed ([#920](https://github.com/dymensionxyz/dymint/issues/920)) ([5a3478b](https://github.com/dymensionxyz/dymint/commit/5a3478bddfe5196eae53d0830035020398f440dc)) * **DA:** use expo backoff in retries ([#739](https://github.com/dymensionxyz/dymint/issues/739)) ([848085f](https://github.com/dymensionxyz/dymint/commit/848085f70bcaae81fb80da3ab78c4d8b399e13b1)) * **dead code:** removes last submission time from manager ([#825](https://github.com/dymensionxyz/dymint/issues/825)) ([80b0324](https://github.com/dymensionxyz/dymint/commit/80b03241e2f2b46010dadca7cf3fa0b12486ea68)) +* **doc:** app hash corresponds to h-1 ([#926](https://github.com/dymensionxyz/dymint/issues/926)) ([edcfd10](https://github.com/dymensionxyz/dymint/commit/edcfd103df8917d31a3b5dc64ede0be35d4d7d32)) * **doc:** manager cache comment ([#767](https://github.com/dymensionxyz/dymint/issues/767)) ([b88bf6e](https://github.com/dymensionxyz/dymint/commit/b88bf6e72820c944b290147724255cc8466ada50)) +* **doc:** remove misleading comment on last submitted height field ([#967](https://github.com/dymensionxyz/dymint/issues/967)) ([cce7cd3](https://github.com/dymensionxyz/dymint/commit/cce7cd3d894c32e37efd25327d9012a0d170b837)) * **docs:** make submit loop comment more accurate re batch size ([#852](https://github.com/dymensionxyz/dymint/issues/852)) ([4f94340](https://github.com/dymensionxyz/dymint/commit/4f94340a857cf3485d800848d6371ed47f6ea732)) * **linter:** gofumpt and fix golangcilint config ([#867](https://github.com/dymensionxyz/dymint/issues/867)) ([8777520](https://github.com/dymensionxyz/dymint/commit/8777520d8a4faaf6bad169aebded539c7e8123d3)) * **local pub sub:** use error for subscription cancelled (instead of info) ([#853](https://github.com/dymensionxyz/dymint/issues/853)) ([1886e18](https://github.com/dymensionxyz/dymint/commit/1886e18d788b9b2745b1989a472084985578a147)) * **logging:** added reason for websocket closed debug msg ([#746](https://github.com/dymensionxyz/dymint/issues/746)) ([3aa7d80](https://github.com/dymensionxyz/dymint/commit/3aa7d80ace92b3b0f79e4f338f10bb94c96ab6dd)) * **logs:** make logs more readable in a couple places, fix race cond ([#749](https://github.com/dymensionxyz/dymint/issues/749)) ([f05ef39](https://github.com/dymensionxyz/dymint/commit/f05ef3957b754c05fbc90aa39eabce80bbe65933)) +* **manager:** Add start height to Submit batch to SL log message ([#964](https://github.com/dymensionxyz/dymint/issues/964)) ([41d6053](https://github.com/dymensionxyz/dymint/commit/41d6053509d7c1297d86bc52a66fdefb9c565b1a)) * **manager:** get fresh height in loop ([#781](https://github.com/dymensionxyz/dymint/issues/781)) ([e4df480](https://github.com/dymensionxyz/dymint/commit/e4df48037a78965dbac9e747dd296f39360e396c)) * **manager:** removes outdated syncTarget field ([#854](https://github.com/dymensionxyz/dymint/issues/854)) ([04b13a0](https://github.com/dymensionxyz/dymint/commit/04b13a0b78feda56a2ac16f8fdc49f1e0d5f1560)) * **metrics:** pass metrics to mempool init ([#846](https://github.com/dymensionxyz/dymint/issues/846)) ([94267ae](https://github.com/dymensionxyz/dymint/commit/94267ae551de46bda60898c23f5092125e60aca6)) * **p2p:** avoid receiving duplicated blocks ([#818](https://github.com/dymensionxyz/dymint/issues/818)) ([feb40f2](https://github.com/dymensionxyz/dymint/commit/feb40f2ca9eead8ecd9a8da2c5772c29a13ac5e5)) +* **p2p:** set gossipsub buffersize to avoid missed blocks ([#975](https://github.com/dymensionxyz/dymint/issues/975)) ([0d3be11](https://github.com/dymensionxyz/dymint/commit/0d3be112beb75bb0c5ea9aad5ac954d4a5370b4e)) * **p2p:** validate block before applying and not before caching in p2p gossiping ([#723](https://github.com/dymensionxyz/dymint/issues/723)) ([98371b5](https://github.com/dymensionxyz/dymint/commit/98371b5220613e70f3274fab5593e02ba532f7db)) * **p2p:** validating gossiped block is created by the proposer ([#737](https://github.com/dymensionxyz/dymint/issues/737)) ([851b312](https://github.com/dymensionxyz/dymint/commit/851b312620233a9fb1abe55214a678322e7b0c68)) * **produce loop:** handle unauthenticated error in settlement layer ([#726](https://github.com/dymensionxyz/dymint/issues/726)) ([33e78d1](https://github.com/dymensionxyz/dymint/commit/33e78d116b5f14b91b8b3bda2b6cbfee9040e2d3)) +* **prune:** fix guard for sequencer ([#966](https://github.com/dymensionxyz/dymint/issues/966)) ([9fa4109](https://github.com/dymensionxyz/dymint/commit/9fa4109d1ca0a5acdc986c65e6f7a0f0edf3ea76)) * **rpc:** nil panic in rpc/json/handler.go WriteError ([#750](https://github.com/dymensionxyz/dymint/issues/750)) ([e09709b](https://github.com/dymensionxyz/dymint/commit/e09709b428a33da002defb9f13178fa19b81a69b)) +* **rpc:** panic and publish health event only on create batch error ([#907](https://github.com/dymensionxyz/dymint/issues/907)) ([b09c75a](https://github.com/dymensionxyz/dymint/commit/b09c75a4c37b549a39acf5bf56b91295bb987d00)) * **rpc:** remove unnecessary `:` in the json health response ([#876](https://github.com/dymensionxyz/dymint/issues/876)) ([55dd894](https://github.com/dymensionxyz/dymint/commit/55dd894e07aacd5983a055ec2a25676804c278ca)) +* **rpc:** Websocket memory leak ([#893](https://github.com/dymensionxyz/dymint/issues/893)) ([ee249d4](https://github.com/dymensionxyz/dymint/commit/ee249d47e132486d8177bb90fcb711c07bb31263)) * **settlement:** filter by pending status in batch event ([#845](https://github.com/dymensionxyz/dymint/issues/845)) ([841056d](https://github.com/dymensionxyz/dymint/commit/841056d52d4b9bda2e2e806ec5a9c8559a43eeaf)) * **settlement:** fixed submission bug where multiple events would cancel subscription ([#842](https://github.com/dymensionxyz/dymint/issues/842)) ([f7b9383](https://github.com/dymensionxyz/dymint/commit/f7b9383cf55976f3f55780055df7a6517e189034)) +* **settlement:** hub disconnect and reconnect causes sequencer to send wrong batch ([#889](https://github.com/dymensionxyz/dymint/issues/889)) ([d9dec3e](https://github.com/dymensionxyz/dymint/commit/d9dec3e96bd058732186d80bcc3d01f489f71634)) * **settlement:** remove state index from proto ([#777](https://github.com/dymensionxyz/dymint/issues/777)) ([767b8fd](https://github.com/dymensionxyz/dymint/commit/767b8fdb490c37deee43ac023688410bbb98ccb0)) +* **submission:** fix counting and time ([#969](https://github.com/dymensionxyz/dymint/issues/969)) ([242acb7](https://github.com/dymensionxyz/dymint/commit/242acb7f4b167480a11e444e509e34dd5fc22e74)) +* **sync:** adds missing error log ([#965](https://github.com/dymensionxyz/dymint/issues/965)) ([9da82f1](https://github.com/dymensionxyz/dymint/commit/9da82f152851dbe13a8a795971bfa3158b836ed9)) * **sync:** make sure we use a latest state index as a start point ([#760](https://github.com/dymensionxyz/dymint/issues/760)) ([43e2d96](https://github.com/dymensionxyz/dymint/commit/43e2d965f2b505751f8e5260549e909c976141ee)) * **sync:** removing height condition for applying cached blocks from p2p ([#787](https://github.com/dymensionxyz/dymint/issues/787)) ([b97299c](https://github.com/dymensionxyz/dymint/commit/b97299ce7f78168863c5e1c2d7fc479aed2ae6da)) * **tests:** fix unit tests, mocks, cleanup/dry hub queries ([#782](https://github.com/dymensionxyz/dymint/issues/782)) ([c276aea](https://github.com/dymensionxyz/dymint/commit/c276aea12c9cd37f62fcf9d684c4efe901a510bf)) @@ -112,17 +67,25 @@ ### Features +* **block manager:** allows loading blocks from db when syncing ([#898](https://github.com/dymensionxyz/dymint/issues/898)) ([2f49475](https://github.com/dymensionxyz/dymint/commit/2f49475377afd76a2c6441faa296e9b5b71f2920)) +* **block:** adding info log for block applied height in full-node ([#921](https://github.com/dymensionxyz/dymint/issues/921)) ([0c98a66](https://github.com/dymensionxyz/dymint/commit/0c98a6687f0a8aed75e41313946a341da5088914)) * **blockManager:** refactor and use state as single source of truth for height ([#847](https://github.com/dymensionxyz/dymint/issues/847)) ([73aae62](https://github.com/dymensionxyz/dymint/commit/73aae62f30acdc56816ad65550438d8830ac83db)) +* **blockmanager:** removed namespace from blockmanager ([#943](https://github.com/dymensionxyz/dymint/issues/943)) ([2a5992c](https://github.com/dymensionxyz/dymint/commit/2a5992c347746e632e5a058d79349b08bc3af37a)) * **ci:** new changelog workflow ([#858](https://github.com/dymensionxyz/dymint/issues/858)) ([5a562ad](https://github.com/dymensionxyz/dymint/commit/5a562ad818469495daeca4d403fb007a7f1e5b2d)) +* **da:** add default retry value for celestia ([#985](https://github.com/dymensionxyz/dymint/issues/985)) ([d57d5b7](https://github.com/dymensionxyz/dymint/commit/d57d5b773d8204ad5a398ef512b251677372f856)) +* **da:** add metric for consecutive failed da submissions ([#986](https://github.com/dymensionxyz/dymint/issues/986)) ([e922dea](https://github.com/dymensionxyz/dymint/commit/e922deaa63f05b7b50d77b1ac1c9de2a3f37d6ad)) +* **da:** added interchain-da proto contracts ([#932](https://github.com/dymensionxyz/dymint/issues/932)) ([7cb2843](https://github.com/dymensionxyz/dymint/commit/7cb2843f7b83a32fc9aabbcaedf6f0e430fb20f0)) * **DA:** expose configuration options for retry loop backoff ([#757](https://github.com/dymensionxyz/dymint/issues/757)) ([0cd09f3](https://github.com/dymensionxyz/dymint/commit/0cd09f3d0a8430c1e9f34814930c168553c143bc)) * **da:** improve logging ([#871](https://github.com/dymensionxyz/dymint/issues/871)) ([7bcc837](https://github.com/dymensionxyz/dymint/commit/7bcc837e78ce41645a09dc773a419d8a1aa153f5)) * **da:** remove availability checks from retriever ([#835](https://github.com/dymensionxyz/dymint/issues/835)) ([b16cfb6](https://github.com/dymensionxyz/dymint/commit/b16cfb61f64507deb51f740284b3d24d6e3d4b32)) +* **db:** enables `SyncWrites` in badgerdb options ([#927](https://github.com/dymensionxyz/dymint/issues/927)) ([d7e066e](https://github.com/dymensionxyz/dymint/commit/d7e066e4e67b903596579c3a3d8bb8b0d0829bcc)) * **p2p:** add p2p advertising option ([#862](https://github.com/dymensionxyz/dymint/issues/862)) ([977019f](https://github.com/dymensionxyz/dymint/commit/977019f7c87a0d81e432a88bd4fa19e17bee5a06)) * **p2p:** header gossiper removed ([#813](https://github.com/dymensionxyz/dymint/issues/813)) ([737b412](https://github.com/dymensionxyz/dymint/commit/737b4126c59846a2be57049a249843de5648dde8)) * **p2p:** improving logs ([#872](https://github.com/dymensionxyz/dymint/issues/872)) ([c8d116e](https://github.com/dymensionxyz/dymint/commit/c8d116e36bce4811fb26ecbeac78cfcc8470579f)) * **p2p:** moving gossiped blocks reception from validator to p2p client ([#811](https://github.com/dymensionxyz/dymint/issues/811)) ([0215717](https://github.com/dymensionxyz/dymint/commit/0215717e8baca6072ad28d067286d0b963d43015)) * **p2p:** refactor p2p config options ([#861](https://github.com/dymensionxyz/dymint/issues/861)) ([70d9460](https://github.com/dymensionxyz/dymint/commit/70d946045d94bac9cff5e31d68e3dae14c1f82c1)) * **produce:** limiting block size by maxBatchSize ([#784](https://github.com/dymensionxyz/dymint/issues/784)) ([f90042c](https://github.com/dymensionxyz/dymint/commit/f90042cd61fc6b60093478cd65491f8aa1106457)) +* **rpc:** Add sync info metrics ([#979](https://github.com/dymensionxyz/dymint/issues/979)) ([c5f8f07](https://github.com/dymensionxyz/dymint/commit/c5f8f07c96e5d2ffe3cfa092e572bcead2168d6a)) * set sequencer mode by hub and not by a flag ([#821](https://github.com/dymensionxyz/dymint/issues/821)) ([5848812](https://github.com/dymensionxyz/dymint/commit/58488123a6969b2977f541279e12f3a50341ea6e)) * **settlement:** expose hub retry params to config ([#863](https://github.com/dymensionxyz/dymint/issues/863)) ([10c6ee9](https://github.com/dymensionxyz/dymint/commit/10c6ee99189afb1206e5cfeb606874f28aa4eeff)) diff --git a/block/block.go b/block/block.go index e72c6b813..9af9e5c11 100644 --- a/block/block.go +++ b/block/block.go @@ -14,88 +14,110 @@ import ( // As the entire process can't be atomic we need to make sure the following condition apply before // - block height is the expected block height on the store (height + 1). // - block height is the expected block height on the app (last block height + 1). -func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMetaData blockMetaData) error { +func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMetaData types.BlockMetaData) error { + var retainHeight int64 + // TODO: add switch case to have defined behavior for each case. // validate block height if block.Header.Height != m.State.NextHeight() { return types.ErrInvalidBlockHeight } - m.logger.Debug("Applying block", "height", block.Header.Height, "source", blockMetaData.source) + types.SetLastAppliedBlockSource(blockMetaData.Source.String()) + + m.logger.Debug("Applying block", "height", block.Header.Height, "source", blockMetaData.Source.String()) // Check if the app's last block height is the same as the currently produced block height isBlockAlreadyApplied, err := m.isHeightAlreadyApplied(block.Header.Height) if err != nil { return fmt.Errorf("check if block is already applied: %w", err) } - // In case the following true, it means we crashed after the commit and before updating the store height. - // In that case we'll want to align the store with the app state and continue to the next block. + // In case the following true, it means we crashed after the app commit but before updating the state + // In that case we'll want to align the state with the app commit result, as if the block was applied. if isBlockAlreadyApplied { - // In this case, where the app was committed, but the state wasn't updated - // it will update the state from appInfo, saved responses and validators. err := m.UpdateStateFromApp() if err != nil { return fmt.Errorf("update state from app: %w", err) } - m.logger.Debug("Aligned with app state required. Skipping to next block", "height", block.Header.Height) - return nil - } - // Start applying the block assuming no inconsistency was found. - _, err = m.Store.SaveBlock(block, commit, nil) - if err != nil { - return fmt.Errorf("save block: %w", err) - } + m.logger.Info("updated state from app commit", "height", block.Header.Height) + } else { + var appHash []byte + // Start applying the block assuming no inconsistency was found. + _, err = m.Store.SaveBlock(block, commit, nil) + if err != nil { + return fmt.Errorf("save block: %w", err) + } - responses, err := m.Executor.ExecuteBlock(m.State, block) - if err != nil { - return fmt.Errorf("execute block: %w", err) - } + err := m.saveP2PBlockToBlockSync(block, commit) + if err != nil { + m.logger.Error("save block blocksync", "err", err) + } - dbBatch := m.Store.NewBatch() - dbBatch, err = m.Store.SaveBlockResponses(block.Header.Height, responses, dbBatch) - if err != nil { - dbBatch.Discard() - return fmt.Errorf("save block responses: %w", err) - } + responses, err := m.Executor.ExecuteBlock(m.State, block) + if err != nil { + return fmt.Errorf("execute block: %w", err) + } + + _, err = m.Store.SaveBlockResponses(block.Header.Height, responses, nil) + if err != nil { + return fmt.Errorf("save block responses: %w", err) + } - // Get the validator changes from the app - validators := m.State.NextValidators.Copy() // TODO: this will be changed when supporting multiple sequencers from the hub + // Commit block to app + appHash, retainHeight, err = m.Executor.Commit(m.State, block, responses) + if err != nil { + return fmt.Errorf("commit block: %w", err) + } - dbBatch, err = m.Store.SaveValidators(block.Header.Height, validators, dbBatch) - if err != nil { - dbBatch.Discard() - return fmt.Errorf("save validators: %w", err) + // Update the state with the new app hash, and store height from the commit. + // Every one of those, if happens before commit, prevents us from re-executing the block in case failed during commit. + m.Executor.UpdateStateAfterCommit(m.State, responses, appHash, block.Header.Height) } - err = dbBatch.Commit() + // check if the proposer needs to be changed + switchRole := m.Executor.UpdateProposerFromBlock(m.State, block) + + // save sequencers to store to be queried over RPC + batch := m.Store.NewBatch() + batch, err = m.Store.SaveSequencers(block.Header.Height, &m.State.Sequencers, batch) if err != nil { - return fmt.Errorf("commit batch to disk: %w", err) + return fmt.Errorf("save sequencers: %w", err) } - // Commit block to app - appHash, retainHeight, err := m.Executor.Commit(m.State, block, responses) + batch, err = m.Store.SaveState(m.State, batch) if err != nil { - return fmt.Errorf("commit block: %w", err) + return fmt.Errorf("update state: %w", err) } - // If failed here, after the app committed, but before the state is updated, we'll update the state on - // UpdateStateFromApp using the saved responses and validators. - - // Update the state with the new app hash, last validators and store height from the commit. - // Every one of those, if happens before commit, prevents us from re-executing the block in case failed during commit. - m.Executor.UpdateStateAfterCommit(m.State, responses, appHash, block.Header.Height, validators) - _, err = m.Store.SaveState(m.State, nil) + err = batch.Commit() if err != nil { - return fmt.Errorf("update state: %w", err) + return fmt.Errorf("commit state: %w", err) } + types.RollappHeightGauge.Set(float64(block.Header.Height)) + // Prune old heights, if requested by ABCI app. if 0 < retainHeight { - err = m.pruneBlocks(uint64(retainHeight)) + err = m.PruneBlocks(uint64(retainHeight)) if err != nil { m.logger.Error("prune blocks", "retain_height", retainHeight, "err", err) } } + + m.blockCache.Delete(block.Header.Height) + + if switchRole { + // TODO: graceful role change (https://github.com/dymensionxyz/dymint/issues/1008) + m.logger.Info("Node changing to proposer role") + panic("sequencer is no longer the proposer") + } + + // validate whether configuration params and rollapp consensus params keep in line, after rollapp params are updated from the responses received in the block execution + err = m.ValidateConfigWithRollappParams() + if err != nil { + return err + } + return nil } @@ -120,32 +142,28 @@ func (m *Manager) attemptApplyCachedBlocks() error { for { expectedHeight := m.State.NextHeight() - cachedBlock, blockExists := m.blockCache[expectedHeight] + cachedBlock, blockExists := m.blockCache.Get(expectedHeight) if !blockExists { break } - if err := m.validateBlock(cachedBlock.Block, cachedBlock.Commit); err != nil { - delete(m.blockCache, cachedBlock.Block.Header.Height) - /// TODO: can we take an action here such as dropping the peer / reducing their reputation? + if err := m.validateBlockBeforeApply(cachedBlock.Block, cachedBlock.Commit); err != nil { + m.blockCache.Delete(cachedBlock.Block.Header.Height) + // TODO: can we take an action here such as dropping the peer / reducing their reputation? return fmt.Errorf("block not valid at height %d, dropping it: err:%w", cachedBlock.Block.Header.Height, err) } - err := m.applyBlock(cachedBlock.Block, cachedBlock.Commit, blockMetaData{source: gossipedBlock}) + err := m.applyBlock(cachedBlock.Block, cachedBlock.Commit, types.BlockMetaData{Source: cachedBlock.Source}) if err != nil { return fmt.Errorf("apply cached block: expected height: %d: %w", expectedHeight, err) } m.logger.Info("Block applied", "height", expectedHeight) - delete(m.blockCache, cachedBlock.Block.Header.Height) } return nil } -func (m *Manager) validateBlock(block *types.Block, commit *types.Commit) error { - // Currently we're assuming proposer is never nil as it's a pre-condition for - // dymint to start - proposer := m.SLClient.GetProposer() - - return types.ValidateProposedTransition(m.State, block, commit, proposer) +// This function validates the block and commit against the state before applying it. +func (m *Manager) validateBlockBeforeApply(block *types.Block, commit *types.Commit) error { + return types.ValidateProposedTransition(m.State, block, commit, m.GetProposerPubKey()) } diff --git a/block/block_cache.go b/block/block_cache.go new file mode 100644 index 000000000..b224f69fc --- /dev/null +++ b/block/block_cache.go @@ -0,0 +1,34 @@ +package block + +import ( + "github.com/dymensionxyz/dymint/types" +) + +type Cache struct { + // concurrency managed by Manager.retrieverMu mutex + cache map[uint64]types.CachedBlock +} + +func (m *Cache) Add(h uint64, b *types.Block, c *types.Commit, source types.BlockSource) { + m.cache[h] = types.CachedBlock{Block: b, Commit: c, Source: source} + types.BlockCacheSizeGauge.Set(float64(m.Size())) +} + +func (m *Cache) Delete(h uint64) { + delete(m.cache, h) + types.BlockCacheSizeGauge.Set(float64(m.Size())) +} + +func (m *Cache) Get(h uint64) (types.CachedBlock, bool) { + ret, found := m.cache[h] + return ret, found +} + +func (m *Cache) Has(h uint64) bool { + _, found := m.Get(h) + return found +} + +func (m *Cache) Size() int { + return len(m.cache) +} diff --git a/block/errors.go b/block/errors.go index 6a73c8734..18d686391 100644 --- a/block/errors.go +++ b/block/errors.go @@ -5,5 +5,4 @@ import "errors" var ( ErrNonRecoverable = errors.New("non recoverable") ErrRecoverable = errors.New("recoverable") - ErrWrongDA = errors.New("wrong DA") ) diff --git a/block/executor.go b/block/executor.go index cd610841a..28e0fcec4 100644 --- a/block/executor.go +++ b/block/executor.go @@ -1,7 +1,6 @@ package block import ( - "encoding/hex" "errors" "time" @@ -17,10 +16,12 @@ import ( "github.com/dymensionxyz/dymint/types" ) +// default minimum block max size allowed. not specific reason to set it to 10K, but we need to avoid no transactions can be included in a block. +const minBlockMaxBytes = 10000 + // Executor creates and applies blocks and maintains state. type Executor struct { - proposerAddress []byte - namespaceID [8]byte + localAddress []byte chainID string proxyAppConsensusConn proxy.AppConnConsensus proxyAppQueryConn proxy.AppConnQuery @@ -32,15 +33,10 @@ type Executor struct { } // NewExecutor creates new instance of BlockExecutor. -// Proposer address and namespace ID will be used in all newly created blocks. -func NewExecutor(proposerAddress []byte, namespaceID string, chainID string, mempool mempool.Mempool, proxyApp proxy.AppConns, eventBus *tmtypes.EventBus, logger types.Logger) (*Executor, error) { - bytes, err := hex.DecodeString(namespaceID) - if err != nil { - return nil, err - } - +// localAddress will be used in sequencer mode only. +func NewExecutor(localAddress []byte, chainID string, mempool mempool.Mempool, proxyApp proxy.AppConns, eventBus *tmtypes.EventBus, logger types.Logger) (*Executor, error) { be := Executor{ - proposerAddress: proposerAddress, + localAddress: localAddress, chainID: chainID, proxyAppConsensusConn: proxyApp.Consensus(), proxyAppQueryConn: proxyApp.Query(), @@ -48,27 +44,28 @@ func NewExecutor(proposerAddress []byte, namespaceID string, chainID string, mem eventBus: eventBus, logger: logger, } - copy(be.namespaceID[:], bytes) return &be, nil } // InitChain calls InitChainSync using consensus connection to app. -func (e *Executor) InitChain(genesis *tmtypes.GenesisDoc, validators []*tmtypes.Validator) (*abci.ResponseInitChain, error) { - params := genesis.ConsensusParams - valUpates := abci.ValidatorUpdates{} +func (e *Executor) InitChain(genesis *tmtypes.GenesisDoc, valset []*tmtypes.Validator) (*abci.ResponseInitChain, error) { + valUpdates := abci.ValidatorUpdates{} - for _, validator := range validators { + // prepare the validator updates as expected by the ABCI app + for _, validator := range valset { tmkey, err := tmcrypto.PubKeyToProto(validator.PubKey) if err != nil { return nil, err } - valUpates = append(valUpates, abci.ValidatorUpdate{ + valUpdates = append(valUpdates, abci.ValidatorUpdate{ PubKey: tmkey, Power: validator.VotingPower, }) } + params := genesis.ConsensusParams + return e.proxyAppConsensusConn.InitChainSync(abci.RequestInitChain{ Time: genesis.GenesisTime, ChainId: genesis.ChainID, @@ -88,18 +85,15 @@ func (e *Executor) InitChain(genesis *tmtypes.GenesisDoc, validators []*tmtypes. Version: &tmproto.VersionParams{ AppVersion: params.Version.AppVersion, }, - }, - Validators: valUpates, + }, Validators: valUpdates, AppStateBytes: genesis.AppState, InitialHeight: genesis.InitialHeight, }) } // CreateBlock reaps transactions from mempool and builds a block. -func (e *Executor) CreateBlock(height uint64, lastCommit *types.Commit, lastHeaderHash [32]byte, state *types.State, maxBlockDataSizeBytes uint64) *types.Block { - if state.ConsensusParams.Block.MaxBytes > 0 { - maxBlockDataSizeBytes = min(maxBlockDataSizeBytes, uint64(state.ConsensusParams.Block.MaxBytes)) - } +func (e *Executor) CreateBlock(height uint64, lastCommit *types.Commit, lastHeaderHash, nextSeqHash [32]byte, state *types.State, maxBlockDataSizeBytes uint64) *types.Block { + maxBlockDataSizeBytes = min(maxBlockDataSizeBytes, uint64(max(minBlockMaxBytes, state.ConsensusParams.Block.MaxBytes))) mempoolTxs := e.mempool.ReapMaxBytesMaxGas(int64(maxBlockDataSizeBytes), state.ConsensusParams.Block.MaxGas) block := &types.Block{ @@ -109,7 +103,6 @@ func (e *Executor) CreateBlock(height uint64, lastCommit *types.Commit, lastHead App: state.Version.Consensus.App, }, ChainID: e.chainID, - NamespaceID: e.namespaceID, // TODO: used????? Height: height, Time: uint64(time.Now().UTC().UnixNano()), LastHeaderHash: lastHeaderHash, @@ -117,7 +110,7 @@ func (e *Executor) CreateBlock(height uint64, lastCommit *types.Commit, lastHead ConsensusHash: [32]byte{}, AppHash: state.AppHash, LastResultsHash: state.LastResultsHash, - ProposerAddress: e.proposerAddress, + ProposerAddress: e.localAddress, }, Data: types.Data{ Txs: toDymintTxs(mempoolTxs), @@ -126,9 +119,10 @@ func (e *Executor) CreateBlock(height uint64, lastCommit *types.Commit, lastHead }, LastCommit: *lastCommit, } - copy(block.Header.LastCommitHash[:], e.getLastCommitHash(lastCommit, &block.Header)) - copy(block.Header.DataHash[:], e.getDataHash(block)) - copy(block.Header.SequencersHash[:], state.Validators.Hash()) + copy(block.Header.LastCommitHash[:], types.GetLastCommitHash(lastCommit, &block.Header)) + copy(block.Header.DataHash[:], types.GetDataHash(block)) + copy(block.Header.SequencerHash[:], state.Sequencers.ProposerHash()) + copy(block.Header.NextSequencersHash[:], nextSeqHash[:]) return block } @@ -206,8 +200,6 @@ func (e *Executor) ExecuteBlock(state *types.State, block *types.Block) (*tmstat hash := block.Hash() abciHeader := types.ToABCIHeaderPB(&block.Header) - abciHeader.ChainID = e.chainID - abciHeader.ValidatorsHash = state.Validators.Hash() abciResponses.BeginBlock, err = e.proxyAppConsensusConn.BeginBlockSync( abci.RequestBeginBlock{ Hash: hash[:], @@ -237,18 +229,6 @@ func (e *Executor) ExecuteBlock(state *types.State, block *types.Block) (*tmstat return abciResponses, nil } -func (e *Executor) getLastCommitHash(lastCommit *types.Commit, header *types.Header) []byte { - lastABCICommit := types.ToABCICommit(lastCommit, header) - return lastABCICommit.Hash() -} - -func (e *Executor) getDataHash(block *types.Block) []byte { - abciData := tmtypes.Data{ - Txs: types.ToABCIBlockDataTxs(&block.Data), - } - return abciData.Hash() -} - func (e *Executor) publishEvents(resp *tmstate.ABCIResponses, block *types.Block) error { if e.eventBus == nil { return nil diff --git a/block/executor_test.go b/block/executor_test.go index fe675aa98..ffe22754c 100644 --- a/block/executor_test.go +++ b/block/executor_test.go @@ -8,7 +8,9 @@ import ( "github.com/dymensionxyz/dymint/block" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -28,6 +30,7 @@ import ( "github.com/dymensionxyz/dymint/types" ) +// TODO: test UpdateProposerFromBlock func TestCreateBlock(t *testing.T) { assert := assert.New(t) require := require.New(t) @@ -43,21 +46,24 @@ func TestCreateBlock(t *testing.T) { require.NotNil(clientCreator) require.NotNil(abciClient) - nsID := "0102030405060708" - mpool := mempoolv1.NewTxMempool(logger, cfg.DefaultMempoolConfig(), proxy.NewAppConnMempool(abciClient), 0) - executor, err := block.NewExecutor([]byte("test address"), nsID, "test", mpool, proxy.NewAppConns(clientCreator), nil, logger) + executor, err := block.NewExecutor([]byte("test address"), "test", mpool, proxy.NewAppConns(clientCreator), nil, logger) assert.NoError(err) maxBytes := uint64(100) + // Create a valid proposer for the block + proposerKey := ed25519.GenPrivKey() + tmPubKey, err := cryptocodec.ToTmPubKeyInterface(proposerKey.PubKey()) + require.NoError(err) + + // Init state state := &types.State{} + state.Sequencers.SetProposer(types.NewSequencerFromValidator(*tmtypes.NewValidator(tmPubKey, 1))) state.ConsensusParams.Block.MaxBytes = int64(maxBytes) state.ConsensusParams.Block.MaxGas = 100000 - state.Validators = tmtypes.NewValidatorSet(nil) - // empty block - block := executor.CreateBlock(1, &types.Commit{}, [32]byte{}, state, maxBytes) + block := executor.CreateBlock(1, &types.Commit{}, [32]byte{}, [32]byte(state.Sequencers.ProposerHash()[:]), state, maxBytes) require.NotNil(block) assert.Empty(block.Data.Txs) assert.Equal(uint64(1), block.Header.Height) @@ -65,7 +71,7 @@ func TestCreateBlock(t *testing.T) { // one small Tx err = mpool.CheckTx([]byte{1, 2, 3, 4}, func(r *abci.Response) {}, mempool.TxInfo{}) require.NoError(err) - block = executor.CreateBlock(2, &types.Commit{}, [32]byte{}, state, maxBytes) + block = executor.CreateBlock(2, &types.Commit{}, [32]byte{}, [32]byte(state.Sequencers.ProposerHash()), state, maxBytes) require.NotNil(block) assert.Equal(uint64(2), block.Header.Height) assert.Len(block.Data.Txs, 1) @@ -75,7 +81,7 @@ func TestCreateBlock(t *testing.T) { require.NoError(err) err = mpool.CheckTx(make([]byte, 100), func(r *abci.Response) {}, mempool.TxInfo{}) require.NoError(err) - block = executor.CreateBlock(3, &types.Commit{}, [32]byte{}, state, maxBytes) + block = executor.CreateBlock(3, &types.Commit{}, [32]byte{}, [32]byte(state.Sequencers.ProposerHash()), state, maxBytes) require.NotNil(block) assert.Len(block.Data.Txs, 2) } @@ -91,7 +97,18 @@ func TestApplyBlock(t *testing.T) { app.On("CheckTx", mock.Anything).Return(abci.ResponseCheckTx{}) app.On("BeginBlock", mock.Anything).Return(abci.ResponseBeginBlock{}) app.On("DeliverTx", mock.Anything).Return(abci.ResponseDeliverTx{}) - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "celestia", + Version: "abcde", + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 100, + MaxBytes: 100, + }, + }, + }) var mockAppHash [32]byte _, err := rand.Read(mockAppHash[:]) require.NoError(err) @@ -110,7 +127,6 @@ func TestApplyBlock(t *testing.T) { require.NotNil(clientCreator) require.NotNil(abciClient) - nsID := "0102030405060708" chainID := "test" // Init mempool @@ -122,7 +138,7 @@ func TestApplyBlock(t *testing.T) { appConns := &tmmocksproxy.MockAppConns{} appConns.On("Consensus").Return(abciClient) appConns.On("Query").Return(abciClient) - executor, err := block.NewExecutor([]byte("test address"), nsID, chainID, mpool, appConns, eventBus, logger) + executor, err := block.NewExecutor([]byte("test address"), chainID, mpool, appConns, eventBus, logger) assert.NoError(err) // Subscribe to tx events @@ -139,30 +155,29 @@ func TestApplyBlock(t *testing.T) { require.NoError(err) require.NotNil(headerSub) + // Create a valid proposer for the block + proposerKey := ed25519.GenPrivKey() + tmPubKey, err := cryptocodec.ToTmPubKeyInterface(proposerKey.PubKey()) + require.NoError(err) + // Init state - state := &types.State{ - NextValidators: tmtypes.NewValidatorSet(nil), - Validators: tmtypes.NewValidatorSet(nil), - } + state := &types.State{} + state.Sequencers.SetProposer(types.NewSequencerFromValidator(*tmtypes.NewValidator(tmPubKey, 1))) state.InitialHeight = 1 - state.LastBlockHeight.Store(0) - maxBytes := uint64(100) + state.SetHeight(0) + maxBytes := uint64(10000) state.ConsensusParams.Block.MaxBytes = int64(maxBytes) state.ConsensusParams.Block.MaxGas = 100000 + state.RollappParams.Da = "mock" // Create first block with one Tx from mempool _ = mpool.CheckTx([]byte{1, 2, 3, 4}, func(r *abci.Response) {}, mempool.TxInfo{}) require.NoError(err) - block := executor.CreateBlock(1, &types.Commit{Height: 0}, [32]byte{}, state, maxBytes) + block := executor.CreateBlock(1, &types.Commit{Height: 0}, [32]byte{}, [32]byte(state.Sequencers.ProposerHash()), state, maxBytes) require.NotNil(block) assert.Equal(uint64(1), block.Header.Height) assert.Len(block.Data.Txs, 1) - // Create proposer for the block - proposerKey := ed25519.GenPrivKey() - proposer := &types.Sequencer{ - PublicKey: proposerKey.PubKey(), - } // Create commit for the block abciHeaderPb := types.ToABCIHeaderPB(&block.Header) abciHeaderBytes, err := abciHeaderPb.Marshal() @@ -176,14 +191,15 @@ func TestApplyBlock(t *testing.T) { } // Apply the block - err = types.ValidateProposedTransition(state, block, commit, proposer) + err = types.ValidateProposedTransition(state, block, commit, state.Sequencers.GetProposerPubKey()) require.NoError(err) + resp, err := executor.ExecuteBlock(state, block) require.NoError(err) require.NotNil(resp) appHash, _, err := executor.Commit(state, block, resp) require.NoError(err) - executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height, state.Validators) + executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height) assert.Equal(uint64(1), state.Height()) assert.Equal(mockAppHash, state.AppHash) @@ -191,8 +207,8 @@ func TestApplyBlock(t *testing.T) { require.NoError(mpool.CheckTx([]byte{0, 1, 2, 3, 4}, func(r *abci.Response) {}, mempool.TxInfo{})) require.NoError(mpool.CheckTx([]byte{5, 6, 7, 8, 9}, func(r *abci.Response) {}, mempool.TxInfo{})) require.NoError(mpool.CheckTx([]byte{1, 2, 3, 4, 5}, func(r *abci.Response) {}, mempool.TxInfo{})) - require.NoError(mpool.CheckTx(make([]byte, 90), func(r *abci.Response) {}, mempool.TxInfo{})) - block = executor.CreateBlock(2, commit, [32]byte{}, state, maxBytes) + require.NoError(mpool.CheckTx(make([]byte, 9990), func(r *abci.Response) {}, mempool.TxInfo{})) + block = executor.CreateBlock(2, commit, [32]byte{}, [32]byte(state.Sequencers.ProposerHash()), state, maxBytes) require.NotNil(block) assert.Equal(uint64(2), block.Header.Height) assert.Len(block.Data.Txs, 3) @@ -213,8 +229,7 @@ func TestApplyBlock(t *testing.T) { } // Apply the block with an invalid commit - err = types.ValidateProposedTransition(state, block, invalidCommit, proposer) - + err = types.ValidateProposedTransition(state, block, invalidCommit, state.Sequencers.GetProposerPubKey()) require.ErrorIs(err, types.ErrInvalidSignature) // Create a valid commit for the block @@ -227,17 +242,22 @@ func TestApplyBlock(t *testing.T) { } // Apply the block - err = types.ValidateProposedTransition(state, block, commit, proposer) + err = types.ValidateProposedTransition(state, block, commit, state.Sequencers.GetProposerPubKey()) require.NoError(err) resp, err = executor.ExecuteBlock(state, block) require.NoError(err) require.NotNil(resp) - vals := state.NextValidators.Copy() // TODO: this will be changed when supporting multiple sequencers from the hub _, _, err = executor.Commit(state, block, resp) require.NoError(err) - executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height, vals) + executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height) assert.Equal(uint64(2), state.Height()) + // check rollapp params update + assert.Equal(state.RollappParams.Da, "celestia") + assert.Equal(state.RollappParams.Version, "abcde") + assert.Equal(state.ConsensusParams.Block.MaxBytes, int64(100)) + assert.Equal(state.ConsensusParams.Block.MaxGas, int64(100)) + // wait for at least 4 Tx events, for up to 3 second. // 3 seconds is a fail-scenario only timer := time.NewTimer(3 * time.Second) diff --git a/block/gossip.go b/block/gossip.go deleted file mode 100644 index d8c5a71ae..000000000 --- a/block/gossip.go +++ /dev/null @@ -1,54 +0,0 @@ -package block - -import ( - "context" - "fmt" - - "github.com/dymensionxyz/dymint/p2p" - "github.com/dymensionxyz/dymint/types" - "github.com/tendermint/tendermint/libs/pubsub" -) - -// onNewGossipedBlock will take a block and apply it -func (m *Manager) onNewGossipedBlock(event pubsub.Message) { - eventData, _ := event.Data().(p2p.GossipedBlock) - block := eventData.Block - commit := eventData.Commit - m.retrieverMu.Lock() // needed to protect blockCache access - _, found := m.blockCache[block.Header.Height] - // It is not strictly necessary to return early, for correctness, but doing so helps us avoid mutex pressure and unnecessary repeated attempts to apply cached blocks - if found { - m.retrieverMu.Unlock() - return - } - - m.logger.Debug("Received new block via gossip.", "block height", block.Header.Height, "store height", m.State.Height(), "n cachedBlocks", len(m.blockCache)) - - nextHeight := m.State.NextHeight() - if block.Header.Height >= nextHeight { - m.blockCache[block.Header.Height] = CachedBlock{ - Block: &block, - Commit: &commit, - } - } - m.retrieverMu.Unlock() // have to give this up as it's locked again in attempt apply, and we're not re-entrant - - err := m.attemptApplyCachedBlocks() - if err != nil { - m.logger.Error("Applying cached blocks.", "err", err) - } -} - -func (m *Manager) gossipBlock(ctx context.Context, block types.Block, commit types.Commit) error { - gossipedBlock := p2p.GossipedBlock{Block: block, Commit: commit} - gossipedBlockBytes, err := gossipedBlock.MarshalBinary() - if err != nil { - return fmt.Errorf("marshal binary: %w: %w", err, ErrNonRecoverable) - } - if err := m.p2pClient.GossipBlock(ctx, gossipedBlockBytes); err != nil { - // Although this boils down to publishing on a topic, we don't want to speculate too much on what - // could cause that to fail, so we assume recoverable. - return fmt.Errorf("p2p gossip block: %w: %w", err, ErrRecoverable) - } - return nil -} diff --git a/block/initchain.go b/block/initchain.go index c7c694c1f..224ae8cf1 100644 --- a/block/initchain.go +++ b/block/initchain.go @@ -2,32 +2,30 @@ package block import ( "context" + "errors" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" tmtypes "github.com/tendermint/tendermint/types" ) func (m *Manager) RunInitChain(ctx context.Context) error { // get the proposer's consensus pubkey proposer := m.SLClient.GetProposer() - tmPubKey, err := cryptocodec.ToTmPubKeyInterface(proposer.PublicKey) + if proposer == nil { + return errors.New("failed to get proposer") + } + tmProposer, err := proposer.TMValidator() if err != nil { return err } - gensisValSet := []*tmtypes.Validator{tmtypes.NewValidator(tmPubKey, 1)} - - // call initChain with both addresses - res, err := m.Executor.InitChain(m.Genesis, gensisValSet) + res, err := m.Executor.InitChain(m.Genesis, []*tmtypes.Validator{tmProposer}) if err != nil { return err } - // update the state with only the consensus pubkey - m.Executor.UpdateStateAfterInitChain(m.State, res, gensisValSet) + m.Executor.UpdateStateAfterInitChain(m.State, res) m.Executor.UpdateMempoolAfterInitChain(m.State) if _, err := m.Store.SaveState(m.State, nil); err != nil { return err } - return nil } diff --git a/block/manager.go b/block/manager.go index 547c16ad7..eb260fe6e 100644 --- a/block/manager.go +++ b/block/manager.go @@ -1,23 +1,29 @@ package block import ( - "bytes" "context" "errors" "fmt" "sync" "sync/atomic" - "code.cloudfoundry.org/go-diodes" + "github.com/dymensionxyz/gerr-cosmos/gerrc" + "golang.org/x/sync/errgroup" + + "github.com/dymensionxyz/dymint/da/registry" "github.com/dymensionxyz/dymint/store" + uerrors "github.com/dymensionxyz/dymint/utils/errors" uevent "github.com/dymensionxyz/dymint/utils/event" - "github.com/dymensionxyz/gerr-cosmos/gerrc" + "github.com/dymensionxyz/dymint/version" - "github.com/dymensionxyz/dymint/p2p" "github.com/libp2p/go-libp2p/core/crypto" + tmcrypto "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/pubsub" tmtypes "github.com/tendermint/tendermint/types" + "github.com/dymensionxyz/dymint/p2p" + "github.com/tendermint/tendermint/proxy" "github.com/dymensionxyz/dymint/config" @@ -32,9 +38,9 @@ type Manager struct { logger types.Logger // Configuration - Conf config.BlockManagerConfig - Genesis *tmtypes.GenesisDoc - ProposerKey crypto.PrivKey + Conf config.BlockManagerConfig + Genesis *tmtypes.GenesisDoc + LocalKey crypto.PrivKey // Store and execution Store store.Store @@ -43,22 +49,16 @@ type Manager struct { // Clients and servers Pubsub *pubsub.Server - p2pClient *p2p.Client + P2PClient *p2p.Client DAClient da.DataAvailabilityLayerClient SLClient settlement.ClientI - /* - Production - */ - producedSizeCh chan uint64 // for the producer to report the size of the block it produced - /* Submission */ - AccumulatedBatchSize atomic.Uint64 // The last height which was submitted to both sublayers, that we know of. When we produce new batches, we will - // start at this height + 1. Note: only accessed by one thread at a time so doesn't need synchro. - // It is ALSO used by the producer, because the producer needs to check if it can prune blocks and it wont' + // start at this height + 1. + // It is ALSO used by the producer, because the producer needs to check if it can prune blocks and it won't // prune anything that might be submitted in the future. Therefore, it must be atomic. LastSubmittedHeight atomic.Uint64 @@ -68,75 +68,77 @@ type Manager struct { // Protect against processing two blocks at once when there are two routines handling incoming gossiped blocks, // and incoming DA blocks, respectively. retrieverMu sync.Mutex - Retriever da.BatchRetriever - // get the next target height to sync local state to - targetSyncHeight diodes.Diode + // Protect against syncing twice from DA in case new batch is posted but it did not finish to sync yet. + syncFromDaMu sync.Mutex + Retriever da.BatchRetriever // Cached blocks and commits for applying at future heights. The blocks may not be valid, because // we can only do full validation in sequential order. - blockCache map[uint64]CachedBlock + blockCache *Cache + + // TargetHeight holds the value of the current highest block seen from either p2p (probably higher) or the DA + TargetHeight atomic.Uint64 } // NewManager creates new block Manager. func NewManager( - proposerKey crypto.PrivKey, - conf config.BlockManagerConfig, + localKey crypto.PrivKey, + conf config.NodeConfig, genesis *tmtypes.GenesisDoc, store store.Store, mempool mempool.Mempool, proxyApp proxy.AppConns, - dalc da.DataAvailabilityLayerClient, settlementClient settlement.ClientI, eventBus *tmtypes.EventBus, pubsub *pubsub.Server, p2pClient *p2p.Client, - logger types.Logger, + dalcKV *store.PrefixKV, + logger log.Logger, ) (*Manager, error) { - proposerAddress, err := getAddress(proposerKey) + localAddress, err := types.GetAddress(localKey) if err != nil { return nil, err } - - exec, err := NewExecutor(proposerAddress, conf.NamespaceID, genesis.ChainID, mempool, proxyApp, eventBus, logger) + exec, err := NewExecutor(localAddress, genesis.ChainID, mempool, proxyApp, eventBus, logger) if err != nil { return nil, fmt.Errorf("create block executor: %w", err) } - s, err := getInitialState(store, genesis, logger) + + m := &Manager{ + Pubsub: pubsub, + P2PClient: p2pClient, + LocalKey: localKey, + Conf: conf.BlockManagerConfig, + Genesis: genesis, + Store: store, + Executor: exec, + SLClient: settlementClient, + logger: logger.With("module", "block_manager"), + blockCache: &Cache{ + cache: make(map[uint64]types.CachedBlock), + }, + } + + err = m.LoadStateOnInit(store, genesis, logger) if err != nil { return nil, fmt.Errorf("get initial state: %w", err) } - agg := &Manager{ - Pubsub: pubsub, - p2pClient: p2pClient, - ProposerKey: proposerKey, - Conf: conf, - Genesis: genesis, - State: s, - Store: store, - Executor: exec, - DAClient: dalc, - SLClient: settlementClient, - Retriever: dalc.(da.BatchRetriever), - targetSyncHeight: diodes.NewOneToOne(1, nil), - producedSizeCh: make(chan uint64), - logger: logger, - blockCache: make(map[uint64]CachedBlock), - } - - return agg, nil -} - -// Start starts the block manager. -func (m *Manager) Start(ctx context.Context) error { - m.logger.Info("Starting the block manager") + err = m.setDA(conf.DAConfig, dalcKV, logger) + if err != nil { + return nil, err + } - isSequencer, err := m.IsSequencerVerify() + // validate configuration params and rollapp consensus params are in line + err = m.ValidateConfigWithRollappParams() if err != nil { - return err + return nil, err } - m.logger.Info("Starting block manager", "isSequencer", isSequencer) + return m, nil +} +// Start starts the block manager. +func (m *Manager) Start(ctx context.Context) error { // Check if InitChain flow is needed if m.State.IsGenesis() { m.logger.Info("Running InitChain") @@ -147,50 +149,108 @@ func (m *Manager) Start(ctx context.Context) error { } } - if !isSequencer { - // Fullnode loop can start before syncing from DA - go uevent.MustSubscribe(ctx, m.Pubsub, "applyGossipedBlocksLoop", p2p.EventQueryNewNewGossipedBlock, m.onNewGossipedBlock, m.logger) + // Check if the chain is halted + err := m.isChainHalted() + if err != nil { + return err } - // TODO: populate the accumulatedSize on startup + isProposer := m.IsProposer() + m.logger.Info("starting block manager", "proposer", isProposer) - err = m.syncBlockManager() - if err != nil { - return fmt.Errorf("sync block manager: %w", err) - } + /* ----------------------------- full node mode ----------------------------- */ + if !isProposer { + // Full-nodes can sync from DA but it is not necessary to wait for it, since it can sync from P2P as well in parallel. + go func() { + err := m.syncFromSettlement() + if err != nil { + m.logger.Error("sync block manager from settlement", "err", err) + } + // DA Sync. Subscribe to SL next batch events + go uevent.MustSubscribe(ctx, m.Pubsub, "syncTargetLoop", settlement.EventQueryNewSettlementBatchAccepted, m.onNewStateUpdate, m.logger) + }() - if isSequencer { - // Sequencer must wait till DA is synced to start submitting blobs - <-m.DAClient.Synced() - go m.ProduceBlockLoop(ctx) - go m.SubmitLoop(ctx) - } else { - go m.RetrieveLoop(ctx) - go m.SyncToTargetHeightLoop(ctx) + // P2P Sync. Subscribe to P2P received blocks events + go uevent.MustSubscribe(ctx, m.Pubsub, "applyGossipedBlocksLoop", p2p.EventQueryNewGossipedBlock, m.onReceivedBlock, m.logger) + go uevent.MustSubscribe(ctx, m.Pubsub, "applyBlockSyncBlocksLoop", p2p.EventQueryNewBlockSyncBlock, m.onReceivedBlock, m.logger) + return nil } - return nil -} -func (m *Manager) IsSequencerVerify() (bool, error) { - slProposerKey := m.SLClient.GetProposer().PublicKey.Bytes() - localProposerKey, err := m.ProposerKey.GetPublic().Raw() + /* ----------------------------- sequencer mode ----------------------------- */ + // Sequencer must wait till DA is synced to start submitting blobs + <-m.DAClient.Synced() + err = m.syncFromSettlement() if err != nil { - return false, fmt.Errorf("get local node public key: %w", err) + return fmt.Errorf("sync block manager from settlement: %w", err) } - return bytes.Equal(slProposerKey, localProposerKey), nil + // check if sequencer in the middle of rotation + nextSeqAddr, missing, err := m.MissingLastBatch() + if err != nil { + return fmt.Errorf("checking if missing last batch: %w", err) + } + // if sequencer is in the middle of rotation, complete rotation instead of running the main loop + if missing { + m.handleRotationReq(ctx, nextSeqAddr) + return nil + } + + // populate the bytes produced channel + bytesProducedC := make(chan int) + + // channel to signal sequencer rotation started + rotateSequencerC := make(chan string, 1) + + eg, ctx := errgroup.WithContext(ctx) + uerrors.ErrGroupGoLog(eg, m.logger, func() error { + return m.SubmitLoop(ctx, bytesProducedC) + }) + uerrors.ErrGroupGoLog(eg, m.logger, func() error { + bytesProducedC <- m.GetUnsubmittedBytes() // load unsubmitted bytes from previous run + return m.ProduceBlockLoop(ctx, bytesProducedC) + }) + uerrors.ErrGroupGoLog(eg, m.logger, func() error { + return m.MonitorSequencerRotation(ctx, rotateSequencerC) + }) + + go func() { + _ = eg.Wait() + // Check if exited due to sequencer rotation signal + select { + case nextSeqAddr := <-rotateSequencerC: + m.handleRotationReq(ctx, nextSeqAddr) + default: + m.logger.Info("Block manager err group finished.") + } + }() + + return nil } -func (m *Manager) IsSequencer() bool { - ret, _ := m.IsSequencerVerify() - return ret +func (m *Manager) isChainHalted() error { + if m.GetProposerPubKey() == nil { + // if no proposer set in state, try to update it from the hub + err := m.UpdateProposer() + if err != nil { + return fmt.Errorf("update proposer: %w", err) + } + if m.GetProposerPubKey() == nil { + return fmt.Errorf("no proposer pubkey found. chain is halted") + } + } + return nil } func (m *Manager) NextHeightToSubmit() uint64 { return m.LastSubmittedHeight.Load() + 1 } -// syncBlockManager enforces the node to be synced on initial run. -func (m *Manager) syncBlockManager() error { +// syncFromSettlement enforces the node to be synced on initial run from SL and DA. +func (m *Manager) syncFromSettlement() error { + err := m.UpdateSequencerSetFromSL() + if err != nil { + return fmt.Errorf("update bonded sequencer set: %w", err) + } + res, err := m.SLClient.GetLatestBatch() if errors.Is(err, gerrc.ErrNotFound) { // The SL hasn't got any batches for this chain yet. @@ -198,12 +258,14 @@ func (m *Manager) syncBlockManager() error { m.LastSubmittedHeight.Store(uint64(m.Genesis.InitialHeight - 1)) return nil } + if err != nil { // TODO: separate between fresh rollapp and non-registered rollapp return err } m.LastSubmittedHeight.Store(res.EndHeight) err = m.syncToTargetHeight(res.EndHeight) + m.UpdateTargetHeight(res.EndHeight) if err != nil { return err } @@ -211,3 +273,54 @@ func (m *Manager) syncBlockManager() error { m.logger.Info("Synced.", "current height", m.State.Height(), "last submitted height", m.LastSubmittedHeight.Load()) return nil } + +func (m *Manager) GetProposerPubKey() tmcrypto.PubKey { + return m.State.Sequencers.GetProposerPubKey() +} + +func (m *Manager) UpdateTargetHeight(h uint64) { + for { + currentHeight := m.TargetHeight.Load() + if m.TargetHeight.CompareAndSwap(currentHeight, max(currentHeight, h)) { + break + } + } +} + +// ValidateConfigWithRollappParams checks the configuration params are consistent with the params in the dymint state (e.g. DA and version) +func (m *Manager) ValidateConfigWithRollappParams() error { + if version.Commit != m.State.RollappParams.Version { + return fmt.Errorf("binary version mismatch. rollapp param: %s binary used:%s", m.State.RollappParams.Version, version.Commit) + } + + if da.Client(m.State.RollappParams.Da) != m.DAClient.GetClientType() { + return fmt.Errorf("da client mismatch. rollapp param: %s da configured: %s", m.State.RollappParams.Da, m.DAClient.GetClientType()) + } + + if m.Conf.BatchSubmitBytes > uint64(m.DAClient.GetMaxBlobSizeBytes()) { + return fmt.Errorf("batch size above limit: batch size: %d limit: %d: DA %s", m.Conf.BatchSubmitBytes, m.DAClient.GetMaxBlobSizeBytes(), m.DAClient.GetClientType()) + } + + return nil +} + +// setDA initializes DA client in blockmanager according to DA type set in genesis or stored in state +func (m *Manager) setDA(daconfig string, dalcKV store.KV, logger log.Logger) error { + daLayer := m.State.RollappParams.Da + dalc := registry.GetClient(daLayer) + if dalc == nil { + return fmt.Errorf("get data availability client named '%s'", daLayer) + } + + err := dalc.Init([]byte(daconfig), m.Pubsub, dalcKV, logger.With("module", string(dalc.GetClientType()))) + if err != nil { + return fmt.Errorf("data availability layer client initialization: %w", err) + } + m.DAClient = dalc + retriever, ok := dalc.(da.BatchRetriever) + if !ok { + return fmt.Errorf("data availability layer client is not of type BatchRetriever") + } + m.Retriever = retriever + return nil +} diff --git a/block/manager_test.go b/block/manager_test.go index 457b1de05..401a6f86d 100644 --- a/block/manager_test.go +++ b/block/manager_test.go @@ -3,21 +3,27 @@ package block_test import ( "context" "crypto/rand" + "sync/atomic" + "testing" "time" + "github.com/ipfs/go-datastore" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/libp2p/go-libp2p/core/crypto" + "github.com/dymensionxyz/dymint/block" "github.com/dymensionxyz/dymint/p2p" "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/testutil" "github.com/dymensionxyz/dymint/types" - "github.com/libp2p/go-libp2p/core/crypto" + "github.com/dymensionxyz/dymint/version" abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/pubsub" "github.com/tendermint/tendermint/proxy" @@ -29,20 +35,28 @@ import ( "github.com/dymensionxyz/dymint/store" ) +// TODO: test loading sequencer while rotation in progress +// TODO: test sequencer after L2 handover but before last state update submitted +// TODO: test halt scenario func TestInitialState(t *testing.T) { var err error assert := assert.New(t) genesis := testutil.GenerateGenesis(123) - sampleState := testutil.GenerateState(1, 128) key, _, _ := crypto.GenerateEd25519Key(rand.Reader) - conf := testutil.GetManagerConfig() + raw, _ := key.GetPublic().Raw() + pubkey := ed25519.PubKey(raw) + sampleState := testutil.GenerateStateWithSequencer(1, 128, pubkey) + + conf := config.NodeConfig{ + BlockManagerConfig: testutil.GetManagerConfig(), + } logger := log.TestingLogger() pubsubServer := pubsub.NewServer() err = pubsubServer.Start() require.NoError(t, err) proxyApp := testutil.GetABCIProxyAppMock(logger.With("module", "proxy")) settlementlc := slregistry.GetClient(slregistry.Local) - _ = settlementlc.Init(settlement.Config{}, pubsubServer, logger) + _ = settlementlc.Init(settlement.Config{}, genesis.ChainID, pubsubServer, logger) // Init empty store and full store emptyStore := store.New(store.NewDefaultInMemoryKVStore()) @@ -53,10 +67,11 @@ func TestInitialState(t *testing.T) { // Init p2p client privKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) p2pClient, err := p2p.NewClient(config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - }, privKey, "TestChain", pubsubServer, logger) + ListenAddress: config.DefaultListenAddress, + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, + }, privKey, "TestChain", emptyStore, pubsubServer, datastore.NewMapDatastore(), logger) assert.NoError(err) assert.NotNil(p2pClient) @@ -87,21 +102,20 @@ func TestInitialState(t *testing.T) { store: fullStore, genesis: genesis, expectedInitialHeight: sampleState.InitialHeight, - expectedLastBlockHeight: sampleState.LastBlockHeight.Load(), + expectedLastBlockHeight: sampleState.Height(), expectedChainID: sampleState.ChainID, }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { - dalc := testutil.GetMockDALC(logger) - agg, err := block.NewManager(key, conf, c.genesis, c.store, nil, proxyApp, dalc, settlementlc, - nil, pubsubServer, p2pClient, logger) + agg, err := block.NewManager(key, conf, c.genesis, c.store, nil, proxyApp, settlementlc, + nil, pubsubServer, p2pClient, nil, logger) assert.NoError(err) assert.NotNil(agg) assert.Equal(c.expectedChainID, agg.State.ChainID) assert.Equal(c.expectedInitialHeight, agg.State.InitialHeight) - assert.Equal(c.expectedLastBlockHeight, agg.State.LastBlockHeight.Load()) + assert.Equal(c.expectedLastBlockHeight, agg.State.Height()) }) } } @@ -112,23 +126,44 @@ func TestInitialState(t *testing.T) { // 2. Sync the manager // 3. Succeed to produce blocks func TestProduceOnlyAfterSynced(t *testing.T) { - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, nil, nil) + // Init app + app := testutil.GetAppMock(testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) + // Create proxy app + clientCreator := proxy.NewLocalClientCreator(app) + proxyApp := proxy.NewAppConns(clientCreator) + err := proxyApp.Start() + require.NoError(t, err) + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, nil) require.NoError(t, err) require.NotNil(t, manager) t.Log("Taking the manager out of sync by submitting a batch") + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) numBatchesToAdd := 2 nextBatchStartHeight := manager.NextHeightToSubmit() var batch *types.Batch for i := 0; i < numBatchesToAdd; i++ { - batch, err = testutil.GenerateBatch(nextBatchStartHeight, nextBatchStartHeight+uint64(testutil.DefaultTestBatchSize-1), manager.ProposerKey) + batch, err = testutil.GenerateBatch(nextBatchStartHeight, nextBatchStartHeight+uint64(testutil.DefaultTestBatchSize-1), manager.LocalKey) assert.NoError(t, err) daResultSubmitBatch := manager.DAClient.SubmitBatch(batch) assert.Equal(t, daResultSubmitBatch.Code, da.StatusSuccess) err = manager.SLClient.SubmitBatch(batch, manager.DAClient.GetClientType(), &daResultSubmitBatch) require.NoError(t, err) - nextBatchStartHeight = batch.EndHeight + 1 + nextBatchStartHeight = batch.EndHeight() + 1 // Wait until daHeight is updated time.Sleep(time.Millisecond * 500) } @@ -141,22 +176,26 @@ func TestProduceOnlyAfterSynced(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*4) defer cancel() // Capture the error returned by manager.Start. + errChan := make(chan error, 1) go func() { errChan <- manager.Start(ctx) err := <-errChan - assert.NoError(t, err) + require.NoError(t, err) }() <-ctx.Done() - assert.Equal(t, batch.EndHeight, manager.LastSubmittedHeight.Load()) + assert.Equal(t, batch.EndHeight(), manager.LastSubmittedHeight.Load()) // validate that we produced blocks - assert.Greater(t, manager.State.Height(), batch.EndHeight) + assert.Greater(t, manager.State.Height(), batch.EndHeight()) } func TestRetrieveDaBatchesFailed(t *testing.T) { - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, &testutil.DALayerClientRetrieveBatchesError{}, 1, 1, 0, nil, nil) + + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, nil, nil) require.NoError(t, err) require.NotNil(t, manager) + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) daMetaData := &da.DASubmitMetaData{ Client: da.Mock, @@ -169,19 +208,31 @@ func TestRetrieveDaBatchesFailed(t *testing.T) { func TestProduceNewBlock(t *testing.T) { // Init app - app := testutil.GetAppMock(testutil.Commit) + app := testutil.GetAppMock(testutil.Commit, testutil.EndBlock) commitHash := [32]byte{1} app.On("Commit", mock.Anything).Return(abci.ResponseCommit{Data: commitHash[:]}) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) err := proxyApp.Start() require.NoError(t, err) // Init manager - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, proxyApp, nil) + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, nil) require.NoError(t, err) // Produce block - _, _, err = manager.ProduceAndGossipBlock(context.Background(), true) + _, _, err = manager.ProduceApplyGossipBlock(context.Background(), true) require.NoError(t, err) // Validate state is updated with the commit hash assert.Equal(t, uint64(1), manager.State.Height()) @@ -190,27 +241,42 @@ func TestProduceNewBlock(t *testing.T) { func TestProducePendingBlock(t *testing.T) { // Init app - app := testutil.GetAppMock(testutil.Commit) + app := testutil.GetAppMock(testutil.Commit, testutil.EndBlock) commitHash := [32]byte{1} app.On("Commit", mock.Anything).Return(abci.ResponseCommit{Data: commitHash[:]}) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) err := proxyApp.Start() require.NoError(t, err) // Init manager - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, proxyApp, nil) + + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, nil) require.NoError(t, err) // Generate block and commit and save it to the store block := testutil.GetRandomBlock(1, 3) + copy(block.Header.SequencerHash[:], manager.State.Sequencers.ProposerHash()) + copy(block.Header.NextSequencersHash[:], manager.State.Sequencers.ProposerHash()) + _, err = manager.Store.SaveBlock(block, &block.LastCommit, nil) require.NoError(t, err) // Produce block - _, _, err = manager.ProduceAndGossipBlock(context.Background(), true) + _, _, err = manager.ProduceApplyGossipBlock(context.Background(), true) require.NoError(t, err) - // Validate state is updated with the block that was saved in the store - // TODO: fix this test + // Validate state is updated with the block that was saved in the store // hacky way to validate the block was indeed contain txs assert.NotEqual(t, manager.State.LastResultsHash, testutil.GetEmptyLastResultsHash()) } @@ -226,7 +292,7 @@ func TestProduceBlockFailAfterCommit(t *testing.T) { require := require.New(t) assert := assert.New(t) // Setup app - app := testutil.GetAppMock(testutil.Info, testutil.Commit) + app := testutil.GetAppMock(testutil.Info, testutil.Commit, testutil.EndBlock) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) @@ -235,7 +301,7 @@ func TestProduceBlockFailAfterCommit(t *testing.T) { // Create a new mock store which should succeed to save the first block mockStore := testutil.NewMockStore() // Init manager - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, proxyApp, mockStore) + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, mockStore) require.NoError(err) cases := []struct { @@ -292,13 +358,25 @@ func TestProduceBlockFailAfterCommit(t *testing.T) { LastBlockHeight: tc.LastAppBlockHeight, LastBlockAppHash: tc.LastAppCommitHash[:], }) - mockStore.ShoudFailSaveState = tc.shoudFailOnSaveState - _, _, _ = manager.ProduceAndGossipBlock(context.Background(), true) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) + mockStore.ShouldFailUpdateStateWithBatch = tc.shoudFailOnSaveState + _, _, _ = manager.ProduceApplyGossipBlock(context.Background(), true) storeState, err := manager.Store.LoadState() assert.NoError(err) manager.State = storeState - assert.Equal(tc.expectedStoreHeight, storeState.Height(), tc.name) - assert.Equal(tc.expectedStateAppHash, storeState.AppHash, tc.name) + require.Equal(tc.expectedStoreHeight, storeState.Height(), tc.name) + require.Equal(tc.expectedStateAppHash, storeState.AppHash, tc.name) app.On("Commit", mock.Anything).Unset() app.On("Info", mock.Anything).Unset() @@ -311,7 +389,19 @@ func TestCreateNextDABatchWithBytesLimit(t *testing.T) { assert := assert.New(t) require := require.New(t) - app := testutil.GetAppMock() + app := testutil.GetAppMock(testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) @@ -319,8 +409,8 @@ func TestCreateNextDABatchWithBytesLimit(t *testing.T) { require.NoError(err) // Init manager managerConfig := testutil.GetManagerConfig() - managerConfig.BlockBatchMaxSizeBytes = batchLimitBytes // enough for 2 block, not enough for 10 blocks - manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, proxyApp, nil) + managerConfig.BatchSubmitBytes = batchLimitBytes // enough for 2 block, not enough for 10 blocks + manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) ctx, cancel := context.WithCancel(context.Background()) @@ -347,30 +437,30 @@ func TestCreateNextDABatchWithBytesLimit(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // Produce blocks for i := 0; i < tc.blocksToProduce; i++ { - _, _, err := manager.ProduceAndGossipBlock(ctx, true) + _, _, err := manager.ProduceApplyGossipBlock(ctx, true) assert.NoError(err) } // Call createNextDABatch function startHeight := manager.NextHeightToSubmit() endHeight := startHeight + uint64(tc.blocksToProduce) - 1 - batch, err := manager.CreateNextBatchToSubmit(startHeight, endHeight) + batch, err := manager.CreateBatch(manager.Conf.BatchSubmitBytes, startHeight, endHeight) assert.NoError(err) - assert.Equal(batch.StartHeight, startHeight) - assert.LessOrEqual(batch.ToProto().Size(), int(managerConfig.BlockBatchMaxSizeBytes)) + assert.Equal(batch.StartHeight(), startHeight) + assert.LessOrEqual(batch.SizeBytes(), int(managerConfig.BatchSubmitBytes)) if !tc.expectedToBeTruncated { - assert.Equal(batch.EndHeight, endHeight) + assert.Equal(batch.EndHeight(), endHeight) } else { - assert.Equal(batch.EndHeight, batch.StartHeight+uint64(len(batch.Blocks))-1) - assert.Less(batch.EndHeight, endHeight) + assert.Equal(batch.EndHeight(), batch.StartHeight()+batch.NumBlocks()-1) + assert.Less(batch.EndHeight(), endHeight) // validate next added block to batch would have been actually too big - // First relax the byte limit so we could proudce larger batch - manager.Conf.BlockBatchMaxSizeBytes = 10 * manager.Conf.BlockBatchMaxSizeBytes - newBatch, err := manager.CreateNextBatchToSubmit(startHeight, batch.EndHeight+1) - assert.Greater(newBatch.ToProto().Size(), batchLimitBytes) + // First relax the byte limit so we could produce larger batch + manager.Conf.BatchSubmitBytes = 10 * manager.Conf.BatchSubmitBytes + newBatch, err := manager.CreateBatch(manager.Conf.BatchSubmitBytes, startHeight, batch.EndHeight()+1) + assert.Greater(newBatch.SizeBytes(), batchLimitBytes) assert.NoError(err) } @@ -381,7 +471,19 @@ func TestCreateNextDABatchWithBytesLimit(t *testing.T) { func TestDAFetch(t *testing.T) { require := require.New(t) // Setup app - app := testutil.GetAppMock(testutil.Info, testutil.Commit) + app := testutil.GetAppMock(testutil.Info, testutil.Commit, testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) @@ -390,14 +492,17 @@ func TestDAFetch(t *testing.T) { // Create a new mock store which should succeed to save the first block mockStore := testutil.NewMockStore() // Init manager - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, proxyApp, mockStore) + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, mockStore) require.NoError(err) commitHash := [32]byte{1} + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) + app.On("Commit", mock.Anything).Return(abci.ResponseCommit{Data: commitHash[:]}) nextBatchStartHeight := manager.NextHeightToSubmit() - batch, err := testutil.GenerateBatch(nextBatchStartHeight, nextBatchStartHeight+uint64(testutil.DefaultTestBatchSize-1), manager.ProposerKey) + batch, err := testutil.GenerateBatch(nextBatchStartHeight, nextBatchStartHeight+uint64(testutil.DefaultTestBatchSize-1), manager.LocalKey) require.NoError(err) daResultSubmitBatch := manager.DAClient.SubmitBatch(batch) require.Equal(daResultSubmitBatch.Code, da.StatusSuccess) @@ -423,7 +528,7 @@ func TestDAFetch(t *testing.T) { manager: manager, daMetaData: &da.DASubmitMetaData{Client: da.Celestia, Height: daResultSubmitBatch.SubmitMetaData.Height}, batch: batch, - err: block.ErrWrongDA, + err: da.ErrDAMismatch, }, } @@ -431,7 +536,7 @@ func TestDAFetch(t *testing.T) { t.Run(c.name, func(t *testing.T) { app.On("Commit", mock.Anything).Return(abci.ResponseCommit{Data: commitHash[:]}).Once() app.On("Info", mock.Anything).Return(abci.ResponseInfo{ - LastBlockHeight: int64(batch.EndHeight), + LastBlockHeight: int64(batch.EndHeight()), LastBlockAppHash: commitHash[:], }) err := manager.ProcessNextDABatch(c.daMetaData) @@ -439,3 +544,34 @@ func TestDAFetch(t *testing.T) { }) } } + +func TestManager_updateTargetHeight(t *testing.T) { + tests := []struct { + name string + TargetHeight uint64 + h uint64 + expTargetHeight uint64 + }{ + { + name: "no update target height", + TargetHeight: 100, + h: 99, + expTargetHeight: 100, + }, { + name: "update target height", + TargetHeight: 100, + h: 101, + expTargetHeight: 101, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + m := &block.Manager{ + TargetHeight: atomic.Uint64{}, + } + m.TargetHeight.Store(tt.TargetHeight) + m.UpdateTargetHeight(tt.h) + assert.Equal(t, tt.expTargetHeight, m.TargetHeight.Load()) + }) + } +} diff --git a/block/p2p.go b/block/p2p.go new file mode 100644 index 000000000..1fc904bf9 --- /dev/null +++ b/block/p2p.go @@ -0,0 +1,96 @@ +package block + +import ( + "context" + "fmt" + + "github.com/dymensionxyz/dymint/node/events" + "github.com/dymensionxyz/dymint/p2p" + "github.com/dymensionxyz/dymint/types" + uevent "github.com/dymensionxyz/dymint/utils/event" + "github.com/tendermint/tendermint/libs/pubsub" +) + +// onReceivedBlock receives a block received event from P2P, saves the block to a cache and tries to apply the blocks from the cache. +func (m *Manager) onReceivedBlock(event pubsub.Message) { + eventData, ok := event.Data().(p2p.BlockData) + if !ok { + m.logger.Error("onReceivedBlock", "err", "wrong event data received") + return + } + var source types.BlockSource + + if len(event.Events()[p2p.EventTypeKey]) != 1 { + m.logger.Error("onReceivedBlock", "err", "wrong number of event types received with the event", "received", len(event.Events()[p2p.EventTypeKey])) + return + } + + switch event.Events()[p2p.EventTypeKey][0] { + case p2p.EventNewBlockSyncBlock: + source = types.BlockSync + case p2p.EventNewGossipedBlock: + source = types.Gossiped + default: + m.logger.Error("onReceivedBlock", "err", "wrong event type received", "type", event.Events()[p2p.EventTypeKey][0]) + return + } + + block := eventData.Block + commit := eventData.Commit + height := block.Header.Height + m.retrieverMu.Lock() // needed to protect blockCache access + + // It is not strictly necessary to return early, for correctness, but doing so helps us avoid mutex pressure and unnecessary repeated attempts to apply cached blocks + if m.blockCache.Has(height) { + m.retrieverMu.Unlock() + return + } + + m.UpdateTargetHeight(height) + types.LastReceivedP2PHeightGauge.Set(float64(height)) + + m.logger.Debug("Received new block from p2p.", "block height", height, "source", source.String(), "store height", m.State.Height(), "n cachedBlocks", m.blockCache.Size()) + + nextHeight := m.State.NextHeight() + if height >= nextHeight { + m.blockCache.Add(height, &block, &commit, source) + } + m.retrieverMu.Unlock() // have to give this up as it's locked again in attempt apply, and we're not re-entrant + + err := m.attemptApplyCachedBlocks() + if err != nil { + uevent.MustPublish(context.TODO(), m.Pubsub, &events.DataHealthStatus{Error: err}, events.HealthStatusList) + m.logger.Error("Attempt apply cached blocks.", "err", err) + } +} + +// gossipBlock sends created blocks by the sequencer to full-nodes using P2P gossipSub +func (m *Manager) gossipBlock(ctx context.Context, block types.Block, commit types.Commit) error { + m.logger.Info("Gossipping block", "height", block.Header.Height) + gossipedBlock := p2p.BlockData{Block: block, Commit: commit} + gossipedBlockBytes, err := gossipedBlock.MarshalBinary() + if err != nil { + return fmt.Errorf("marshal binary: %w: %w", err, ErrNonRecoverable) + } + if err := m.P2PClient.GossipBlock(ctx, gossipedBlockBytes); err != nil { + // Although this boils down to publishing on a topic, we don't want to speculate too much on what + // could cause that to fail, so we assume recoverable. + return fmt.Errorf("p2p gossip block: %w: %w", err, ErrRecoverable) + } + + return nil +} + +// This function adds the block to blocksync store to enable P2P retrievability +func (m *Manager) saveP2PBlockToBlockSync(block *types.Block, commit *types.Commit) error { + gossipedBlock := p2p.BlockData{Block: *block, Commit: *commit} + gossipedBlockBytes, err := gossipedBlock.MarshalBinary() + if err != nil { + return fmt.Errorf("marshal binary: %w: %w", err, ErrNonRecoverable) + } + err = m.P2PClient.SaveBlock(context.Background(), block.Header.Height, gossipedBlockBytes) + if err != nil { + m.logger.Error("Adding block to blocksync store.", "err", err, "height", gossipedBlock.Block.Header.Height) + } + return nil +} diff --git a/block/produce.go b/block/produce.go index 313e59293..e9c77a909 100644 --- a/block/produce.go +++ b/block/produce.go @@ -6,22 +6,31 @@ import ( "fmt" "time" - "github.com/dymensionxyz/dymint/store" "github.com/dymensionxyz/gerr-cosmos/gerrc" - "github.com/dymensionxyz/dymint/types" + "github.com/dymensionxyz/dymint/node/events" + "github.com/dymensionxyz/dymint/store" + uevent "github.com/dymensionxyz/dymint/utils/event" + tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" cmtproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/dymensionxyz/dymint/types" ) // ProduceBlockLoop is calling publishBlock in a loop as long as we're synced. -func (m *Manager) ProduceBlockLoop(ctx context.Context) { +// A signal will be sent to the bytesProduced channel for each block produced +// In this way it's possible to pause block production by not consuming the channel +func (m *Manager) ProduceBlockLoop(ctx context.Context, bytesProducedC chan int) error { m.logger.Info("Started block producer loop.") ticker := time.NewTicker(m.Conf.BlockTime) - defer ticker.Stop() + defer func() { + ticker.Stop() + m.logger.Info("Stopped block producer loop.") + }() var nextEmptyBlock time.Time firstBlock := true @@ -29,58 +38,84 @@ func (m *Manager) ProduceBlockLoop(ctx context.Context) { for { select { case <-ctx.Done(): - return + return nil case <-ticker.C: // if empty blocks are configured to be enabled, and one is scheduled... - produceEmptyBlock := firstBlock || 0 == m.Conf.MaxIdleTime || nextEmptyBlock.Before(time.Now()) + produceEmptyBlock := firstBlock || m.Conf.MaxIdleTime == 0 || nextEmptyBlock.Before(time.Now()) firstBlock = false - block, commit, err := m.ProduceAndGossipBlock(ctx, produceEmptyBlock) + block, commit, err := m.ProduceApplyGossipBlock(ctx, produceEmptyBlock) if errors.Is(err, context.Canceled) { m.logger.Error("Produce and gossip: context canceled.", "error", err) - return + return nil } - if errors.Is(err, types.ErrSkippedEmptyBlock) { + if errors.Is(err, types.ErrEmptyBlock) { // occurs if the block was empty but we don't want to produce one continue } if errors.Is(err, ErrNonRecoverable) { - m.logger.Error("Produce and gossip: non-recoverable.", "error", err) // TODO: flush? or don't log at all? - panic(fmt.Errorf("produce and gossip block: %w", err)) + uevent.MustPublish(ctx, m.Pubsub, &events.DataHealthStatus{Error: err}, events.HealthStatusList) + return err } + if err != nil { m.logger.Error("Produce and gossip: uncategorized, assuming recoverable.", "error", err) continue } - - // If IBC transactions are present, set proof required to true - // This will set a shorter timer for the next block - // currently we set it for all txs as we don't have a way to determine if an IBC tx is present (https://github.com/dymensionxyz/dymint/issues/709) nextEmptyBlock = time.Now().Add(m.Conf.MaxIdleTime) if 0 < len(block.Data.Txs) { + // the block wasn't empty so we want to make sure we don't wait too long before producing another one, in order to facilitate proofs for ibc + // TODO: optimize to only do this if IBC transactions are present (https://github.com/dymensionxyz/dymint/issues/709) nextEmptyBlock = time.Now().Add(m.Conf.MaxProofTime) } else { m.logger.Info("Produced empty block.") } - // Send the size to the accumulated size channel - // This will block in case the submitter is too slow and it's buffer is full - size := uint64(block.ToProto().Size()) + uint64(commit.ToProto().Size()) + bytesProducedN := block.SizeBytes() + commit.SizeBytes() + m.logger.Info("New block.", "size", uint64(block.ToProto().Size())) select { case <-ctx.Done(): - return - case m.producedSizeCh <- size: + return nil + case bytesProducedC <- bytesProducedN: + default: + evt := &events.DataHealthStatus{Error: fmt.Errorf("bytes produced channel is full: %w", gerrc.ErrResourceExhausted)} + uevent.MustPublish(ctx, m.Pubsub, evt, events.HealthStatusList) + m.logger.Error("Enough bytes to build a batch have been accumulated, but too many batches are pending submission. " + + "Pausing block production until a signal is consumed.") + select { + case <-ctx.Done(): + return nil + case bytesProducedC <- bytesProducedN: + evt := &events.DataHealthStatus{Error: nil} + uevent.MustPublish(ctx, m.Pubsub, evt, events.HealthStatusList) + m.logger.Info("Resumed block production.") + } } + } } } -func (m *Manager) ProduceAndGossipBlock(ctx context.Context, allowEmpty bool) (*types.Block, *types.Commit, error) { - block, commit, err := m.produceBlock(allowEmpty) +// ProduceApplyGossipLastBlock produces and applies a block with the given nextProposerHash. +func (m *Manager) ProduceApplyGossipLastBlock(ctx context.Context, nextProposerHash [32]byte) (err error) { + _, _, err = m.produceApplyGossip(ctx, true, &nextProposerHash) + return err +} + +func (m *Manager) ProduceApplyGossipBlock(ctx context.Context, allowEmpty bool) (block *types.Block, commit *types.Commit, err error) { + return m.produceApplyGossip(ctx, allowEmpty, nil) +} + +func (m *Manager) produceApplyGossip(ctx context.Context, allowEmpty bool, nextProposerHash *[32]byte) (block *types.Block, commit *types.Commit, err error) { + block, commit, err = m.produceBlock(allowEmpty, nextProposerHash) if err != nil { return nil, nil, fmt.Errorf("produce block: %w", err) } + if err := m.applyBlock(block, commit, types.BlockMetaData{Source: types.Produced}); err != nil { + return nil, nil, fmt.Errorf("apply block: %w: %w", err, ErrNonRecoverable) + } + if err := m.gossipBlock(ctx, *block, *commit); err != nil { return nil, nil, fmt.Errorf("gossip block: %w", err) } @@ -88,27 +123,11 @@ func (m *Manager) ProduceAndGossipBlock(ctx context.Context, allowEmpty bool) (* return block, commit, nil } -func loadPrevBlock(store store.Store, height uint64) ([32]byte, *types.Commit, error) { - lastCommit, err := store.LoadCommit(height) - if err != nil { - return [32]byte{}, nil, fmt.Errorf("load commit: height: %d: %w", height, err) - } - lastBlock, err := store.LoadBlock(height) - if err != nil { - return [32]byte{}, nil, fmt.Errorf("load block after load commit: height: %d: %w", height, err) - } - return lastBlock.Header.Hash(), lastCommit, nil -} - -func (m *Manager) produceBlock(allowEmpty bool) (*types.Block, *types.Commit, error) { +func (m *Manager) produceBlock(allowEmpty bool, nextProposerHash *[32]byte) (*types.Block, *types.Commit, error) { newHeight := m.State.NextHeight() - lastHeaderHash, lastCommit, err := loadPrevBlock(m.Store, newHeight-1) + lastHeaderHash, lastCommit, err := m.GetPreviousBlockHashes(newHeight) if err != nil { - if !m.State.IsGenesis() { // allow prevBlock not to be found only on genesis - return nil, nil, fmt.Errorf("load prev block: %w: %w", err, ErrNonRecoverable) - } - lastHeaderHash = [32]byte{} - lastCommit = &types.Commit{} + return nil, nil, fmt.Errorf("load prev block: %w", err) } var block *types.Block @@ -124,55 +143,65 @@ func (m *Manager) produceBlock(allowEmpty bool) (*types.Block, *types.Commit, er return nil, nil, fmt.Errorf("load commit after load block: height: %d: %w: %w", newHeight, err, ErrNonRecoverable) } m.logger.Info("Using pending block.", "height", newHeight) + return block, commit, nil } else if !errors.Is(err, gerrc.ErrNotFound) { return nil, nil, fmt.Errorf("load block: height: %d: %w: %w", newHeight, err, ErrNonRecoverable) - } else { - // limit to the max block data, so we don't create a block that is too big to fit in a batch - maxBlockDataSize := uint64(float64(m.Conf.BlockBatchMaxSizeBytes) * types.MaxBlockSizeAdjustment) - block = m.Executor.CreateBlock(newHeight, lastCommit, lastHeaderHash, m.State, maxBlockDataSize) - if !allowEmpty && len(block.Data.Txs) == 0 { - return nil, nil, fmt.Errorf("%w: %w", types.ErrSkippedEmptyBlock, ErrRecoverable) - } + } - abciHeaderPb := types.ToABCIHeaderPB(&block.Header) - abciHeaderBytes, err := abciHeaderPb.Marshal() - if err != nil { - return nil, nil, fmt.Errorf("marshal abci header: %w: %w", err, ErrNonRecoverable) - } - proposerAddress := block.Header.ProposerAddress - sign, err := m.ProposerKey.Sign(abciHeaderBytes) - if err != nil { - return nil, nil, fmt.Errorf("sign abci header: %w: %w", err, ErrNonRecoverable) - } - voteTimestamp := tmtime.Now() - tmSignature, err := m.createTMSignature(block, proposerAddress, voteTimestamp) - if err != nil { - return nil, nil, fmt.Errorf("create tm signature: %w: %w", err, ErrNonRecoverable) - } - commit = &types.Commit{ - Height: block.Header.Height, - HeaderHash: block.Header.Hash(), - Signatures: []types.Signature{sign}, - TMSignature: tmtypes.CommitSig{ - BlockIDFlag: 2, - ValidatorAddress: proposerAddress, - Timestamp: voteTimestamp, - Signature: tmSignature, - }, - } + maxBlockDataSize := uint64(float64(m.Conf.BatchSubmitBytes) * types.MaxBlockSizeAdjustment) + proposerHashForBlock := [32]byte(m.State.Sequencers.ProposerHash()) + // if nextProposerHash is set, we create a last block + if nextProposerHash != nil { + maxBlockDataSize = 0 + proposerHashForBlock = *nextProposerHash + } + block = m.Executor.CreateBlock(newHeight, lastCommit, lastHeaderHash, proposerHashForBlock, m.State, maxBlockDataSize) + if !allowEmpty && len(block.Data.Txs) == 0 { + return nil, nil, fmt.Errorf("%w: %w", types.ErrEmptyBlock, ErrRecoverable) } - if err := m.applyBlock(block, commit, blockMetaData{source: producedBlock}); err != nil { - return nil, nil, fmt.Errorf("apply block: %w: %w", err, ErrNonRecoverable) + commit, err = m.createCommit(block) + if err != nil { + return nil, nil, fmt.Errorf("create commit: %w: %w", err, ErrNonRecoverable) } m.logger.Info("Block created.", "height", newHeight, "num_tx", len(block.Data.Txs)) types.RollappBlockSizeBytesGauge.Set(float64(len(block.Data.Txs))) types.RollappBlockSizeTxsGauge.Set(float64(len(block.Data.Txs))) - types.RollappHeightGauge.Set(float64(newHeight)) return block, commit, nil } +// create commit for block +func (m *Manager) createCommit(block *types.Block) (*types.Commit, error) { + abciHeaderPb := types.ToABCIHeaderPB(&block.Header) + abciHeaderBytes, err := abciHeaderPb.Marshal() + if err != nil { + return nil, fmt.Errorf("marshal abci header: %w", err) + } + proposerAddress := block.Header.ProposerAddress + sign, err := m.LocalKey.Sign(abciHeaderBytes) + if err != nil { + return nil, fmt.Errorf("sign abci header: %w", err) + } + voteTimestamp := tmtime.Now() + tmSignature, err := m.createTMSignature(block, proposerAddress, voteTimestamp) + if err != nil { + return nil, fmt.Errorf("create tm signature: %w", err) + } + commit := &types.Commit{ + Height: block.Header.Height, + HeaderHash: block.Header.Hash(), + Signatures: []types.Signature{sign}, + TMSignature: tmtypes.CommitSig{ + BlockIDFlag: 2, + ValidatorAddress: proposerAddress, + Timestamp: voteTimestamp, + Signature: tmSignature, + }, + } + return commit, nil +} + func (m *Manager) createTMSignature(block *types.Block, proposerAddress []byte, voteTimestamp time.Time) ([]byte, error) { headerHash := block.Header.Hash() vote := tmtypes.Vote{ @@ -190,8 +219,8 @@ func (m *Manager) createTMSignature(block *types.Block, proposerAddress []byte, v := vote.ToProto() // convert libp2p key to tm key // TODO: move to types - raw_key, _ := m.ProposerKey.Raw() - tmprivkey := tmed25519.PrivKey(raw_key) + rawKey, _ := m.LocalKey.Raw() + tmprivkey := tmed25519.PrivKey(rawKey) tmprivkey.PubKey().Bytes() // Create a mock validator to sign the vote tmvalidator := tmtypes.NewMockPVWithParams(tmprivkey, false, false) @@ -208,3 +237,29 @@ func (m *Manager) createTMSignature(block *types.Block, proposerAddress []byte, } return vote.Signature, nil } + +// GetPreviousBlockHashes returns the hash of the last block and the commit for the last block +// to be used as the previous block hash and commit for the next block +func (m *Manager) GetPreviousBlockHashes(forHeight uint64) (lastHeaderHash [32]byte, lastCommit *types.Commit, err error) { + lastHeaderHash, lastCommit, err = loadPrevBlock(m.Store, forHeight-1) // prev height = forHeight - 1 + if err != nil { + if !m.State.IsGenesis() { // allow prevBlock not to be found only on genesis + return [32]byte{}, nil, fmt.Errorf("load prev block: %w: %w", err, ErrNonRecoverable) + } + lastHeaderHash = [32]byte{} + lastCommit = &types.Commit{} + } + return lastHeaderHash, lastCommit, nil +} + +func loadPrevBlock(store store.Store, height uint64) ([32]byte, *types.Commit, error) { + lastCommit, err := store.LoadCommit(height) + if err != nil { + return [32]byte{}, nil, fmt.Errorf("load commit: height: %d: %w", height, err) + } + lastBlock, err := store.LoadBlock(height) + if err != nil { + return [32]byte{}, nil, fmt.Errorf("load block after load commit: height: %d: %w", height, err) + } + return lastBlock.Header.Hash(), lastCommit, nil +} diff --git a/block/production_test.go b/block/production_test.go index bc7c44a9b..0130cb8f1 100644 --- a/block/production_test.go +++ b/block/production_test.go @@ -8,12 +8,17 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/dymensionxyz/dymint/mempool" + "github.com/dymensionxyz/dymint/version" + mempoolv1 "github.com/dymensionxyz/dymint/mempool/v1" "github.com/dymensionxyz/dymint/node/events" + uchannel "github.com/dymensionxyz/dymint/utils/channel" uevent "github.com/dymensionxyz/dymint/utils/event" + abci "github.com/tendermint/tendermint/abci/types" tmcfg "github.com/tendermint/tendermint/config" "github.com/dymensionxyz/dymint/testutil" @@ -22,6 +27,8 @@ import ( "github.com/tendermint/tendermint/proxy" ) +// TODO: test producing lastBlock +// TODO: test using already produced lastBlock func TestCreateEmptyBlocksEnableDisable(t *testing.T) { const blockTime = 200 * time.Millisecond const MaxIdleTime = blockTime * 10 @@ -29,7 +36,19 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { assert := assert.New(t) require := require.New(t) - app := testutil.GetAppMock() + app := testutil.GetAppMock(testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) @@ -40,7 +59,7 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { managerConfigCreatesEmptyBlocks := testutil.GetManagerConfig() managerConfigCreatesEmptyBlocks.BlockTime = blockTime managerConfigCreatesEmptyBlocks.MaxIdleTime = 0 * time.Second - managerWithEmptyBlocks, err := testutil.GetManager(managerConfigCreatesEmptyBlocks, nil, nil, 1, 1, 0, proxyApp, nil) + managerWithEmptyBlocks, err := testutil.GetManager(managerConfigCreatesEmptyBlocks, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) // Init manager with empty blocks feature enabled @@ -48,7 +67,7 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { managerConfig.BlockTime = blockTime managerConfig.MaxIdleTime = MaxIdleTime managerConfig.MaxProofTime = MaxIdleTime - manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, proxyApp, nil) + manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) // Check initial height @@ -57,13 +76,11 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { mCtx, cancel := context.WithTimeout(context.Background(), runTime) defer cancel() - go manager.ProduceBlockLoop(mCtx) - go managerWithEmptyBlocks.ProduceBlockLoop(mCtx) - - buf1 := make(chan struct{}, 100) // dummy to avoid unhealthy event - buf2 := make(chan struct{}, 100) // dummy to avoid unhealthy event - go manager.AccumulatedDataLoop(mCtx, buf1) - go managerWithEmptyBlocks.AccumulatedDataLoop(mCtx, buf2) + bytesProduced1 := make(chan int) + bytesProduced2 := make(chan int) + go manager.ProduceBlockLoop(mCtx, bytesProduced1) + go managerWithEmptyBlocks.ProduceBlockLoop(mCtx, bytesProduced2) + uchannel.DrainForever(bytesProduced1, bytesProduced2) <-mCtx.Done() require.Greater(manager.State.Height(), initialHeight) @@ -102,7 +119,7 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { func TestCreateEmptyBlocksNew(t *testing.T) { // TODO(https://github.com/dymensionxyz/dymint/issues/352) - t.Skip("FIXME: fails to submit tx to test the empty blocks feature") + t.Skip("TODO: fails to submit tx to test the empty blocks feature") assert := assert.New(t) require := require.New(t) app := testutil.GetAppMock() @@ -115,7 +132,7 @@ func TestCreateEmptyBlocksNew(t *testing.T) { managerConfig := testutil.GetManagerConfig() managerConfig.BlockTime = 200 * time.Millisecond managerConfig.MaxIdleTime = 1 * time.Second - manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, proxyApp, nil) + manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) abciClient, err := clientCreator.NewABCIClient() @@ -143,7 +160,9 @@ func TestCreateEmptyBlocksNew(t *testing.T) { mCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() - go manager.ProduceBlockLoop(mCtx) + bytesProduced := make(chan int) + go manager.ProduceBlockLoop(mCtx, bytesProduced) + uchannel.DrainForever(bytesProduced) <-time.Tick(1 * time.Second) err = mpool.CheckTx([]byte{1, 2, 3, 4}, nil, mempool.TxInfo{}) @@ -181,13 +200,30 @@ func TestStopBlockProduction(t *testing.T) { assert := assert.New(t) require := require.New(t) + app := testutil.GetAppMock(testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) + // Create proxy app + clientCreator := proxy.NewLocalClientCreator(app) + proxyApp := proxy.NewAppConns(clientCreator) + err := proxyApp.Start() + require.NoError(err) + managerConfig := testutil.GetManagerConfig() - managerConfig.BlockBatchMaxSizeBytes = 1000 // small batch size to fill up quickly - manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, nil, nil) + managerConfig.BatchSubmitBytes = 1000 // small batch size to fill up quickly + manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) - // validate initial accumulated is zero - require.Equal(manager.AccumulatedBatchSize.Load(), uint64(0)) assert.Equal(manager.State.Height(), uint64(0)) // subscribe to health status event @@ -203,21 +239,16 @@ func TestStopBlockProduction(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) defer cancel() - go func() { - manager.ProduceBlockLoop(ctx) - wg.Done() // Decrease counter when this goroutine finishes - }() + bytesProducedC := make(chan int) - toSubmit := make(chan struct{}) go func() { - manager.AccumulatedDataLoop(ctx, toSubmit) + manager.ProduceBlockLoop(ctx, bytesProducedC) wg.Done() // Decrease counter when this goroutine finishes }() // validate block production works time.Sleep(400 * time.Millisecond) assert.Greater(manager.State.Height(), uint64(0)) - assert.Greater(manager.AccumulatedBatchSize.Load(), uint64(0)) // we don't read from the submit channel, so we assume it get full // we expect the block production to stop and unhealthy event to be emitted @@ -235,7 +266,7 @@ func TestStopBlockProduction(t *testing.T) { assert.Equal(stoppedHeight, manager.State.Height()) // consume the signal - <-toSubmit + <-bytesProducedC // check for health status event and block production to continue select { diff --git a/block/pruning.go b/block/pruning.go index f194e3585..daa3b3dcf 100644 --- a/block/pruning.go +++ b/block/pruning.go @@ -1,16 +1,24 @@ package block import ( + "context" "fmt" "github.com/dymensionxyz/gerr-cosmos/gerrc" ) -func (m *Manager) pruneBlocks(retainHeight uint64) error { - if m.IsSequencer() && retainHeight <= m.NextHeightToSubmit() { // do not delete anything that we might submit in future - return fmt.Errorf("cannot prune blocks before they have been submitted: %d: %w", retainHeight, gerrc.ErrInvalidArgument) +func (m *Manager) PruneBlocks(retainHeight uint64) error { + if m.IsProposer() && m.NextHeightToSubmit() < retainHeight { // do not delete anything that we might submit in future + return fmt.Errorf("cannot prune blocks before they have been submitted: retain height %d: next height to submit: %d: %w", + retainHeight, + m.NextHeightToSubmit(), + gerrc.ErrInvalidArgument) } + err := m.P2PClient.RemoveBlocks(context.Background(), m.State.BaseHeight, retainHeight) + if err != nil { + m.logger.Error("pruning blocksync store", "retain_height", retainHeight, "err", err) + } pruned, err := m.Store.PruneBlocks(m.State.BaseHeight, retainHeight) if err != nil { return fmt.Errorf("prune block store: %w", err) diff --git a/block/pruning_test.go b/block/pruning_test.go new file mode 100644 index 000000000..3f333f0db --- /dev/null +++ b/block/pruning_test.go @@ -0,0 +1,76 @@ +package block_test + +import ( + "context" + "testing" + + "github.com/dymensionxyz/dymint/da" + "github.com/dymensionxyz/dymint/testutil" + "github.com/dymensionxyz/dymint/version" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tendermint/proxy" +) + +func TestPruningRetainHeight(t *testing.T) { + require := require.New(t) + app := testutil.GetAppMock() + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxBytes: 500000, + MaxGas: 40000000, + }, + }, + }) + ctx := context.Background() + // Create proxy app + clientCreator := proxy.NewLocalClientCreator(app) + proxyApp := proxy.NewAppConns(clientCreator) + err := proxyApp.Start() + require.NoError(err) + + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, nil) + require.NoError(err) + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) + + // Check initial assertions + require.Zero(manager.State.Height()) + require.Zero(manager.LastSubmittedHeight.Load()) + + batchSize := 10 + + // Produce blocks + for i := 0; i < batchSize; i++ { + _, _, err = manager.ProduceApplyGossipBlock(ctx, true) + require.NoError(err) + } + // submit and validate sync target + manager.CreateAndSubmitBatch(100000000, false) + lastSubmitted := manager.LastSubmittedHeight.Load() + assert.EqualValues(t, manager.State.Height(), lastSubmitted) + assert.Equal(t, lastSubmitted, uint64(batchSize)) + + // Produce new blocks + for i := 0; i < batchSize; i++ { + _, _, err = manager.ProduceApplyGossipBlock(ctx, true) + require.NoError(err) + } + + validRetainHeight := lastSubmitted + 1 // the max possible valid retain height + for i := validRetainHeight + 1; i < manager.State.Height(); i++ { + err = manager.PruneBlocks(i) + require.Error(err) // cannot prune blocks before they have been submitted + } + + err = manager.PruneBlocks(validRetainHeight) + require.NoError(err) +} diff --git a/block/retriever.go b/block/retriever.go index eccc3d699..1987012b0 100644 --- a/block/retriever.go +++ b/block/retriever.go @@ -2,29 +2,31 @@ package block import ( "context" + "errors" "fmt" - "code.cloudfoundry.org/go-diodes" + "github.com/dymensionxyz/gerr-cosmos/gerrc" "github.com/dymensionxyz/dymint/da" + "github.com/dymensionxyz/dymint/node/events" + "github.com/dymensionxyz/dymint/settlement" + "github.com/dymensionxyz/dymint/types" + uevent "github.com/dymensionxyz/dymint/utils/event" + "github.com/tendermint/tendermint/libs/pubsub" ) -// RetrieveLoop listens for new target sync heights and then syncs the chain by -// fetching batches from the settlement layer and then fetching the actual blocks -// from the DA. -func (m *Manager) RetrieveLoop(ctx context.Context) { - m.logger.Info("Started retrieve loop.") - p := diodes.NewPoller(m.targetSyncHeight, diodes.WithPollingContext(ctx)) - - for { - targetHeight := p.Next() // We only care about the latest one - if targetHeight == nil { - return - } - err := m.syncToTargetHeight(*(*uint64)(targetHeight)) - if err != nil { - panic(fmt.Errorf("sync until target: %w", err)) - } +// onNewStateUpdate will try to sync to new height, if not already synced +func (m *Manager) onNewStateUpdate(event pubsub.Message) { + eventData, ok := event.Data().(*settlement.EventDataNewBatchAccepted) + if !ok { + m.logger.Error("onReceivedBatch", "err", "wrong event data received") + return + } + h := eventData.EndHeight + m.UpdateTargetHeight(h) + err := m.syncToTargetHeight(h) + if err != nil { + m.logger.Error("sync until target", "err", err) } } @@ -32,23 +34,35 @@ func (m *Manager) RetrieveLoop(ctx context.Context) { // It fetches the batches from the settlement, gets the DA height and gets // the actual blocks from the DA. func (m *Manager) syncToTargetHeight(targetHeight uint64) error { + defer m.syncFromDaMu.Unlock() + m.syncFromDaMu.Lock() for currH := m.State.NextHeight(); currH <= targetHeight; currH = m.State.NextHeight() { // if we have the block locally, we don't need to fetch it from the DA - err := m.processLocalBlock(currH) + err := m.applyLocalBlock(currH) if err == nil { m.logger.Info("Synced from local", "store height", currH, "target height", targetHeight) continue } + if !errors.Is(err, gerrc.ErrNotFound) { + m.logger.Error("Apply local block", "err", err) + } err = m.syncFromDABatch() if err != nil { return fmt.Errorf("process next DA batch: %w", err) } + + // if height havent been updated, we are stuck + if m.State.NextHeight() == currH { + return fmt.Errorf("stuck at height %d", currH) + } m.logger.Info("Synced from DA", "store height", m.State.Height(), "target height", targetHeight) + } err := m.attemptApplyCachedBlocks() if err != nil { + uevent.MustPublish(context.TODO(), m.Pubsub, &events.DataHealthStatus{Error: err}, events.HealthStatusList) m.logger.Error("Attempt apply cached blocks.", "err", err) } @@ -69,9 +83,15 @@ func (m *Manager) syncFromDABatch() error { if err != nil { return fmt.Errorf("retrieve batch: %w", err) } - m.logger.Info("Retrieved batch.", "state_index", stateIndex) + // update the proposer when syncing from the settlement layer + proposer := m.State.Sequencers.GetByAddress(settlementBatch.Batch.Sequencer) + if proposer == nil { + return fmt.Errorf("proposer not found: batch: %d: %s", stateIndex, settlementBatch.Batch.Sequencer) + } + m.State.Sequencers.SetProposer(proposer) + err = m.ProcessNextDABatch(settlementBatch.MetaData.DA) if err != nil { return fmt.Errorf("process next DA batch: %w", err) @@ -79,25 +99,26 @@ func (m *Manager) syncFromDABatch() error { return nil } -func (m *Manager) processLocalBlock(height uint64) error { +func (m *Manager) applyLocalBlock(height uint64) error { + defer m.retrieverMu.Unlock() + m.retrieverMu.Lock() + block, err := m.Store.LoadBlock(height) if err != nil { - return err + return fmt.Errorf("load block: %w", gerrc.ErrNotFound) } commit, err := m.Store.LoadCommit(height) if err != nil { - return err + return fmt.Errorf("load commit: %w", gerrc.ErrNotFound) } - if err := m.validateBlock(block, commit); err != nil { + if err := m.validateBlockBeforeApply(block, commit); err != nil { return fmt.Errorf("validate block from local store: height: %d: %w", height, err) } - m.retrieverMu.Lock() - err = m.applyBlock(block, commit, blockMetaData{source: localDbBlock}) + err = m.applyBlock(block, commit, types.BlockMetaData{Source: types.LocalDb}) if err != nil { return fmt.Errorf("apply block from local store: height: %d: %w", height, err) } - m.retrieverMu.Unlock() return nil } @@ -106,7 +127,6 @@ func (m *Manager) ProcessNextDABatch(daMetaData *da.DASubmitMetaData) error { m.logger.Debug("trying to retrieve batch from DA", "daHeight", daMetaData.Height) batchResp := m.fetchBatch(daMetaData) if batchResp.Code != da.StatusSuccess { - m.logger.Error("fetching batch from DA", batchResp.Message) return batchResp.Error } @@ -115,23 +135,30 @@ func (m *Manager) ProcessNextDABatch(daMetaData *da.DASubmitMetaData) error { m.retrieverMu.Lock() defer m.retrieverMu.Unlock() + var lastAppliedHeight float64 for _, batch := range batchResp.Batches { for i, block := range batch.Blocks { if block.Header.Height != m.State.NextHeight() { continue } - if err := m.validateBlock(block, batch.Commits[i]); err != nil { + if err := m.validateBlockBeforeApply(block, batch.Commits[i]); err != nil { m.logger.Error("validate block from DA", "height", block.Header.Height, "err", err) continue } - err := m.applyBlock(block, batch.Commits[i], blockMetaData{source: daBlock, daHeight: daMetaData.Height}) + + err := m.applyBlock(block, batch.Commits[i], types.BlockMetaData{Source: types.DA, DAHeight: daMetaData.Height}) if err != nil { return fmt.Errorf("apply block: height: %d: %w", block.Header.Height, err) } - delete(m.blockCache, block.Header.Height) + lastAppliedHeight = float64(block.Header.Height) + + m.blockCache.Delete(block.Header.Height) + } } + types.LastReceivedDAHeightGauge.Set(lastAppliedHeight) + return nil } @@ -142,7 +169,7 @@ func (m *Manager) fetchBatch(daMetaData *da.DASubmitMetaData) da.ResultRetrieveB BaseResult: da.BaseResult{ Code: da.StatusError, Message: fmt.Sprintf("DA client for the batch does not match node config: DA client batch: %s: DA client config: %s", daMetaData.Client, m.DAClient.GetClientType()), - Error: ErrWrongDA, + Error: da.ErrDAMismatch, }, } } diff --git a/block/sequencers.go b/block/sequencers.go new file mode 100644 index 000000000..4c98c4f3b --- /dev/null +++ b/block/sequencers.go @@ -0,0 +1,181 @@ +package block + +import ( + "bytes" + "context" + "fmt" + "time" + + "github.com/dymensionxyz/dymint/settlement" + "github.com/dymensionxyz/dymint/types" +) + +func (m *Manager) MonitorSequencerRotation(ctx context.Context, rotateC chan string) error { + sequencerRotationEventClient := "sequencer_rotation" + subscription, err := m.Pubsub.Subscribe(ctx, sequencerRotationEventClient, settlement.EventQueryRotationStarted) + if err != nil { + panic("Error subscribing to events") + } + defer m.Pubsub.UnsubscribeAll(ctx, sequencerRotationEventClient) //nolint:errcheck + + ticker := time.NewTicker(3 * time.Minute) // TODO: make this configurable + defer ticker.Stop() + + var nextSeqAddr string + for { + select { + case <-ctx.Done(): + return nil + case <-ticker.C: + next, err := m.SLClient.CheckRotationInProgress() + if err != nil { + m.logger.Error("Check rotation in progress", "err", err) + continue + } + if next == nil { + continue + } + nextSeqAddr = next.SettlementAddress + case event := <-subscription.Out(): + eventData, _ := event.Data().(*settlement.EventDataRotationStarted) + nextSeqAddr = eventData.NextSeqAddr + } + break // break out of the loop after getting the next sequencer address + } + // we get here once a sequencer rotation signal is received + m.logger.Info("Sequencer rotation started.", "next_seq", nextSeqAddr) + go func() { + rotateC <- nextSeqAddr + }() + return fmt.Errorf("sequencer rotation started. signal to stop production") +} + +// IsProposer checks if the local node is the proposer +// In case of sequencer rotation, there's a phase where proposer rotated on L2 but hasn't yet rotated on hub. +// for this case, the old proposer counts as "sequencer" as well, so he'll be able to submit the last state update. +func (m *Manager) IsProposer() bool { + localProposerKey, _ := m.LocalKey.GetPublic().Raw() + l2Proposer := m.GetProposerPubKey().Bytes() + + var expectedHubProposer []byte + hubProposer := m.SLClient.GetProposer() + if hubProposer != nil { + expectedHubProposer = hubProposer.PubKey().Bytes() + } + + // check if recovering from halt + if l2Proposer == nil && hubProposer != nil { + m.State.Sequencers.SetProposer(hubProposer) + } + + // we run sequencer flow if we're proposer on L2 or hub (can be different during rotation phase, before hub receives the last state update) + return bytes.Equal(l2Proposer, localProposerKey) || bytes.Equal(expectedHubProposer, localProposerKey) +} + +// MissingLastBatch checks if the sequencer is in the middle of rotation (I'm the proposer, but needs to complete rotation) +// returns the next sequencer address and a flag if the sequencer is the old proposer and the hub waits for the last batch +func (m *Manager) MissingLastBatch() (string, bool, error) { + localProposerKey, _ := m.LocalKey.GetPublic().Raw() + next, err := m.SLClient.CheckRotationInProgress() + if err != nil { + return "", false, err + } + if next == nil { + return "", false, nil + } + // rotation in progress, + // check if we're the old proposer and needs to complete rotation + curr := m.SLClient.GetProposer() + isProposer := bytes.Equal(curr.PubKey().Bytes(), localProposerKey) + return next.SettlementAddress, isProposer, nil +} + +// handleRotationReq completes the rotation flow once a signal is received from the SL +// this called after manager shuts down the block producer and submitter +func (m *Manager) handleRotationReq(ctx context.Context, nextSeqAddr string) { + m.logger.Info("Sequencer rotation started. Production stopped on this sequencer", "nextSeqAddr", nextSeqAddr) + err := m.CompleteRotation(ctx, nextSeqAddr) + if err != nil { + panic(err) + } + + // TODO: graceful fallback to full node (https://github.com/dymensionxyz/dymint/issues/1008) + m.logger.Info("Sequencer is no longer the proposer") + panic("sequencer is no longer the proposer") +} + +// CompleteRotation completes the sequencer rotation flow +// the sequencer will create his last block, with the next sequencer's hash, to handover the proposer role +// then it will submit all the data accumulated thus far and mark the last state update +// if nextSeqAddr is empty, the nodes will halt after applying the block produced +func (m *Manager) CompleteRotation(ctx context.Context, nextSeqAddr string) error { + // validate nextSeq is in the bonded set + var nextSeqHash [32]byte + if nextSeqAddr != "" { + seq := m.State.Sequencers.GetByAddress(nextSeqAddr) + if seq == nil { + return types.ErrMissingProposerPubKey + } + copy(nextSeqHash[:], seq.Hash()) + } + + err := m.CreateAndPostLastBatch(ctx, nextSeqHash) + if err != nil { + return fmt.Errorf("create and post last batch: %w", err) + } + + m.logger.Info("Sequencer rotation completed. sequencer is no longer the proposer", "nextSeqAddr", nextSeqAddr) + return nil +} + +// CreateAndPostLastBatch creates and posts the last batch to the hub +// this called after manager shuts down the block producer and submitter +func (m *Manager) CreateAndPostLastBatch(ctx context.Context, nextSeqHash [32]byte) error { + h := m.State.Height() + block, err := m.Store.LoadBlock(h) + if err != nil { + return fmt.Errorf("load block: height: %d: %w", h, err) + } + + // check if the last block already produced with nextProposerHash set + if bytes.Equal(block.Header.NextSequencersHash[:], nextSeqHash[:]) { + m.logger.Debug("Last block already produced and applied.") + } else { + err := m.ProduceApplyGossipLastBlock(ctx, nextSeqHash) + if err != nil { + return fmt.Errorf("produce apply gossip last block: %w", err) + } + } + + // Submit all data accumulated thus far and the last state update + for { + b, err := m.CreateAndSubmitBatch(m.Conf.BatchSubmitBytes, true) + if err != nil { + return fmt.Errorf("CreateAndSubmitBatch last batch: %w", err) + } + + if b.LastBatch { + break + } + } + + return nil +} + +// UpdateSequencerSetFromSL updates the sequencer set from the SL +// proposer is not changed here +func (m *Manager) UpdateSequencerSetFromSL() error { + seqs, err := m.SLClient.GetAllSequencers() + if err != nil { + return err + } + m.State.Sequencers.SetSequencers(seqs) + m.logger.Debug("Updated bonded sequencer set.", "newSet", m.State.Sequencers.String()) + return nil +} + +// UpdateProposer updates the proposer from the hub +func (m *Manager) UpdateProposer() error { + m.State.Sequencers.SetProposer(m.SLClient.GetProposer()) + return nil +} diff --git a/block/state.go b/block/state.go index 5fa53260c..f003f525c 100644 --- a/block/state.go +++ b/block/state.go @@ -1,6 +1,7 @@ package block import ( + "bytes" "errors" "fmt" @@ -9,26 +10,69 @@ import ( "github.com/cometbft/cometbft/crypto/merkle" abci "github.com/tendermint/tendermint/abci/types" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" tmtypes "github.com/tendermint/tendermint/types" + "github.com/tendermint/tendermint/version" "github.com/dymensionxyz/dymint/mempool" "github.com/dymensionxyz/dymint/store" "github.com/dymensionxyz/dymint/types" ) -// getInitialState tries to load lastState from Store, and if it's not available it reads GenesisDoc. -func getInitialState(store store.Store, genesis *tmtypes.GenesisDoc, logger types.Logger) (*types.State, error) { +// LoadStateOnInit tries to load lastState from Store, and if it's not available it reads GenesisDoc. +func (m *Manager) LoadStateOnInit(store store.Store, genesis *tmtypes.GenesisDoc, logger types.Logger) error { s, err := store.LoadState() if errors.Is(err, types.ErrNoStateFound) { logger.Info("failed to find state in the store, creating new state from genesis") - s, err = types.NewStateFromGenesis(genesis) + s, err = NewStateFromGenesis(genesis) } if err != nil { - return nil, fmt.Errorf("get initial state: %w", err) + return fmt.Errorf("get initial state: %w", err) } - return s, nil + m.State = s + return nil +} + +// NewStateFromGenesis reads blockchain State from genesis. +// The active sequencer list will be set on InitChain +func NewStateFromGenesis(genDoc *tmtypes.GenesisDoc) (*types.State, error) { + err := genDoc.ValidateAndComplete() + if err != nil { + return nil, fmt.Errorf("in genesis doc: %w", err) + } + + // InitStateVersion sets the Consensus.Block and Software versions, + // but leaves the Consensus.App version blank. + // The Consensus.App version will be set during the Handshake, once + // we hear from the app what protocol version it is running. + InitStateVersion := tmstate.Version{ + Consensus: tmversion.Consensus{ + Block: version.BlockProtocol, + App: 0, + }, + Software: version.TMCoreSemVer, + } + + s := types.State{ + Version: InitStateVersion, + ChainID: genDoc.ChainID, + + InitialHeight: uint64(genDoc.InitialHeight), + BaseHeight: uint64(genDoc.InitialHeight), + ConsensusParams: *genDoc.ConsensusParams, + LastHeightConsensusParamsChanged: genDoc.InitialHeight, + } + s.SetHeight(0) + copy(s.AppHash[:], genDoc.AppHash) + + err = s.SetRollappParamsFromGenesis(genDoc.AppState) + if err != nil { + return nil, fmt.Errorf("in genesis doc: %w", err) + } + + return &s, nil } // UpdateStateFromApp is responsible for aligning the state of the store from the abci app @@ -43,60 +87,29 @@ func (m *Manager) UpdateStateFromApp() error { if err != nil { return errorsmod.Wrap(err, "load block responses") } - vals, err := m.Store.LoadValidators(appHeight) - if err != nil { - return errorsmod.Wrap(err, "load block responses") - } - // update the state with the hash, last store height and last validators. - m.Executor.UpdateStateAfterCommit(m.State, resp, proxyAppInfo.LastBlockAppHash, appHeight, vals) - _, err = m.Store.SaveState(m.State, nil) - if err != nil { - return errorsmod.Wrap(err, "update state") - } + // update the state with the app hashes created on the app commit + m.Executor.UpdateStateAfterCommit(m.State, resp, proxyAppInfo.LastBlockAppHash, appHeight) + return nil } -func (e *Executor) UpdateStateAfterInitChain(s *types.State, res *abci.ResponseInitChain, validators []*tmtypes.Validator) { +func (e *Executor) UpdateStateAfterInitChain(s *types.State, res *abci.ResponseInitChain) { // If the app did not return an app hash, we keep the one set from the genesis doc in // the state. We don't set appHash since we don't want the genesis doc app hash // recorded in the genesis block. We should probably just remove GenesisDoc.AppHash. if len(res.AppHash) > 0 { copy(s.AppHash[:], res.AppHash) } - - // The validators after initChain must be greater than zero, otherwise this state is not loadable - if len(validators) <= 0 { - panic("Validators must be greater than zero") - } - if res.ConsensusParams != nil { params := res.ConsensusParams if params.Block != nil { s.ConsensusParams.Block.MaxBytes = params.Block.MaxBytes s.ConsensusParams.Block.MaxGas = params.Block.MaxGas } - if params.Evidence != nil { - s.ConsensusParams.Evidence.MaxAgeNumBlocks = params.Evidence.MaxAgeNumBlocks - s.ConsensusParams.Evidence.MaxAgeDuration = params.Evidence.MaxAgeDuration - s.ConsensusParams.Evidence.MaxBytes = params.Evidence.MaxBytes - } - if params.Validator != nil { - // Copy params.Validator.PubkeyTypes, and set result's value to the copy. - // This avoids having to initialize the slice to 0 values, and then write to it again. - s.ConsensusParams.Validator.PubKeyTypes = append([]string{}, params.Validator.PubKeyTypes...) - } - if params.Version != nil { - s.ConsensusParams.Version.AppVersion = params.Version.AppVersion - } - s.Version.Consensus.App = s.ConsensusParams.Version.AppVersion } // We update the last results hash with the empty hash, to conform with RFC-6962. copy(s.LastResultsHash[:], merkle.HashFromByteSlices(nil)) - - // Set the validators in the state - s.Validators = tmtypes.NewValidatorSet(validators).CopyIncrementProposerPriority(1) - s.NextValidators = s.Validators.Copy() } func (e *Executor) UpdateMempoolAfterInitChain(s *types.State) { @@ -104,15 +117,53 @@ func (e *Executor) UpdateMempoolAfterInitChain(s *types.State) { e.mempool.SetPostCheckFn(mempool.PostCheckMaxGas(s.ConsensusParams.Block.MaxGas)) } -// Update state from Commit response -func (e *Executor) UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, height uint64, valSet *tmtypes.ValidatorSet) { +// UpdateStateAfterCommit updates the state with the app hash and last results hash +func (e *Executor) UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, height uint64) { copy(s.AppHash[:], appHash[:]) copy(s.LastResultsHash[:], tmtypes.NewResults(resp.DeliverTxs).Hash()) - // TODO: load consensus params from endblock? + s.SetHeight(height) + + if resp.EndBlock.ConsensusParamUpdates != nil { + s.ConsensusParams.Block.MaxGas = resp.EndBlock.ConsensusParamUpdates.Block.MaxGas + s.ConsensusParams.Block.MaxBytes = resp.EndBlock.ConsensusParamUpdates.Block.MaxBytes + } + if resp.EndBlock.RollappParamUpdates != nil { + s.RollappParams.Da = resp.EndBlock.RollappParamUpdates.Da + s.RollappParams.Version = resp.EndBlock.RollappParamUpdates.Version + } +} + +// UpdateProposerFromBlock updates the proposer from the block +// The next proposer is defined in the block header (NextSequencersHash) +// In case of a node that a becomes the proposer, we return true to mark the role change +// currently the node will rebooted to apply the new role +// TODO: (https://github.com/dymensionxyz/dymint/issues/1008) +func (e *Executor) UpdateProposerFromBlock(s *types.State, block *types.Block) bool { + // no sequencer change + if bytes.Equal(block.Header.SequencerHash[:], block.Header.NextSequencersHash[:]) { + return false + } - s.Validators = s.NextValidators.Copy() - s.NextValidators = valSet.Copy() + if block.Header.NextSequencersHash == [32]byte{} { + // the chain will be halted until proposer is set + // TODO: recover from halt (https://github.com/dymensionxyz/dymint/issues/1021) + e.logger.Info("rollapp left with no proposer. chain is halted") + s.Sequencers.SetProposer(nil) + return false + } - s.SetHeight(height) + // if hash changed, update the active sequencer + err := s.Sequencers.SetProposerByHash(block.Header.NextSequencersHash[:]) + if err != nil { + e.logger.Error("update new proposer", "err", err) + panic(fmt.Sprintf("failed to update new proposer: %v", err)) + } + + localSeq := s.Sequencers.GetByConsAddress(e.localAddress) + if localSeq != nil && bytes.Equal(localSeq.Hash(), block.Header.NextSequencersHash[:]) { + return true + } + + return false } diff --git a/block/submit.go b/block/submit.go index ac5ce1289..cf0fc5280 100644 --- a/block/submit.go +++ b/block/submit.go @@ -2,187 +2,264 @@ package block import ( "context" + "errors" "fmt" + "sync/atomic" "time" + "github.com/dymensionxyz/gerr-cosmos/gerrc" + "golang.org/x/sync/errgroup" + "github.com/dymensionxyz/dymint/da" - "github.com/dymensionxyz/dymint/node/events" "github.com/dymensionxyz/dymint/types" - uevent "github.com/dymensionxyz/dymint/utils/event" - "github.com/dymensionxyz/gerr-cosmos/gerrc" + uatomic "github.com/dymensionxyz/dymint/utils/atomic" + uchannel "github.com/dymensionxyz/dymint/utils/channel" ) // SubmitLoop is the main loop for submitting blocks to the DA and SL layers. // It submits a batch when either // 1) It accumulates enough block data, so it's necessary to submit a batch to avoid exceeding the max size // 2) Enough time passed since the last submitted batch, so it's necessary to submit a batch to avoid exceeding the max time -func (m *Manager) SubmitLoop(ctx context.Context) { - maxTime := time.NewTicker(m.Conf.BatchSubmitMaxTime) - defer maxTime.Stop() - - // get produced size from the block production loop and signal to submit the batch when batch size reached - maxSizeC := make(chan struct{}, m.Conf.MaxSupportedBatchSkew) - go m.AccumulatedDataLoop(ctx, maxSizeC) +// It will back pressure (pause) block production if it falls too far behind. +func (m *Manager) SubmitLoop(ctx context.Context, + bytesProduced chan int, +) (err error) { + return SubmitLoopInner( + ctx, + m.logger, + bytesProduced, + m.Conf.BatchSkew, + m.GetUnsubmittedBlocks, + m.Conf.BatchSubmitTime, + m.Conf.BatchSubmitBytes, + m.CreateAndSubmitBatchGetSizeBlocksCommits, + ) +} - // defer func to clear the channels to release blocked goroutines on shutdown - defer func() { - for { - select { - case <-m.producedSizeCh: - case <-maxSizeC: - default: - return - } - } - }() - - for { - select { - case <-ctx.Done(): - return - case <-maxSizeC: - case <-maxTime.C: - } +// SubmitLoopInner is a unit testable impl of SubmitLoop +func SubmitLoopInner( + ctx context.Context, + logger types.Logger, + bytesProduced chan int, // a channel of block and commit bytes produced + maxBatchSkew uint64, // max number of blocks that submitter is allowed to have pending + unsubmittedBlocks func() uint64, + maxBatchTime time.Duration, // max time to allow between batches + maxBatchBytes uint64, // max size of serialised batch in bytes + createAndSubmitBatch func(maxSizeBytes uint64) (sizeBlocksCommits uint64, err error), +) error { + eg, ctx := errgroup.WithContext(ctx) - /* - Note: since we dont explicitly coordinate changes to the accumulated size with actual batch creation - we don't have a guarantee that the accumulated size is the same as the actual batch size that will be made. - But the batch creation step will also check the size is OK, so it's not a problem. - */ - m.AccumulatedBatchSize.Store(0) + pendingBytes := atomic.Uint64{} - // modular submission methods have own retries mechanism. - // if error returned, we assume it's unrecoverable. - err := m.HandleSubmissionTrigger() - if err != nil { - panic(fmt.Errorf("handle submission trigger: %w", err)) - } - maxTime.Reset(m.Conf.BatchSubmitMaxTime) - } -} + trigger := uchannel.NewNudger() // used to avoid busy waiting (using cpu) on trigger thread + submitter := uchannel.NewNudger() // used to avoid busy waiting (using cpu) on submitter thread -// AccumulatedDataLoop is the main loop for accumulating the produced data size. -// It is triggered by the ProducedSizeCh channel, which is populated by the block production loop when a new block is produced. -// It accumulates the size of the produced data and triggers the submission of the batch when the accumulated size is greater than the max size. -// It also emits a health status event when the submission channel is full. -func (m *Manager) AccumulatedDataLoop(ctx context.Context, toSubmit chan struct{}) { - for { - select { - case <-ctx.Done(): - return - case size := <-m.producedSizeCh: - total := m.AccumulatedBatchSize.Add(size) - if total < m.Conf.BlockBatchMaxSizeBytes { // TODO: allow some tolerance for block size (e.g support for BlockBatchMaxSize +- 10%) - continue + eg.Go(func() error { + // 'trigger': this thread is responsible for waking up the submitter when a new block arrives, and back-pressures the block production loop + // if it gets too far ahead. + for { + if maxBatchSkew*maxBatchBytes < pendingBytes.Load() { + // too much stuff is pending submission + // we block here until we get a progress nudge from the submitter thread + select { + case <-ctx.Done(): + return ctx.Err() + case <-trigger.C: + } + } else { + select { + case <-ctx.Done(): + return ctx.Err() + case n := <-bytesProduced: + pendingBytes.Add(uint64(n)) + logger.Debug("Added bytes produced to bytes pending submission counter.", "bytes added", n, "pending", pendingBytes.Load()) + } } - } - select { - case <-ctx.Done(): - return - case toSubmit <- struct{}{}: - m.logger.Info("New batch accumulated, sent signal to submit the batch.") - default: - m.logger.Error("New batch accumulated, but channel is full, stopping block production until the signal is consumed.") - - evt := &events.DataHealthStatus{Error: fmt.Errorf("submission channel is full: %w", gerrc.ErrResourceExhausted)} - uevent.MustPublish(ctx, m.Pubsub, evt, events.HealthStatusList) + types.RollappPendingSubmissionsSkewBytes.Set(float64(pendingBytes.Load())) + types.RollappPendingSubmissionsSkewBlocks.Set(float64(unsubmittedBlocks())) + submitter.Nudge() + } + }) - /* - Now we stop consuming the produced size channel, so the block production loop will stop producing new blocks. - */ + eg.Go(func() error { + // 'submitter': this thread actually creates and submits batches, and will do it on a timer if he isn't nudged by block production + timeLastSubmission := time.Now() + ticker := time.NewTicker(maxBatchTime / 10) // interval does not need to match max batch time since we keep track anyway, it's just to wakeup + for { select { case <-ctx.Done(): - return - case toSubmit <- struct{}{}: + return ctx.Err() + case <-ticker.C: + case <-submitter.C: } - m.logger.Info("Resumed block production.") + pending := pendingBytes.Load() + types.RollappPendingSubmissionsSkewBytes.Set(float64(pendingBytes.Load())) + types.RollappPendingSubmissionsSkewBlocks.Set(float64(unsubmittedBlocks())) + types.RollappPendingSubmissionsSkewBatches.Set(float64(pendingBytes.Load() / maxBatchBytes)) + + // while there are accumulated blocks, create and submit batches!! + for { + done := ctx.Err() != nil + nothingToSubmit := pending == 0 + lastSubmissionIsRecent := time.Since(timeLastSubmission) < maxBatchTime + maxDataNotExceeded := pending <= maxBatchBytes + if done || nothingToSubmit || (lastSubmissionIsRecent && maxDataNotExceeded) { + break + } - evt = &events.DataHealthStatus{Error: nil} - uevent.MustPublish(ctx, m.Pubsub, evt, events.HealthStatusList) + nConsumed, err := createAndSubmitBatch(min(pending, maxBatchBytes)) + if err != nil { + err = fmt.Errorf("create and submit batch: %w", err) + if errors.Is(err, gerrc.ErrInternal) { + logger.Error("Create and submit batch", "err", err, "pending", pending) + panic(err) + } + return err + } + timeLastSubmission = time.Now() + ticker.Reset(maxBatchTime) + pending = uatomic.Uint64Sub(&pendingBytes, nConsumed) + logger.Info("Submitted a batch to both sub-layers.", "n bytes consumed from pending", nConsumed, "pending after", pending) // TODO: debug level + } + trigger.Nudge() } - } + }) + + return eg.Wait() } -// HandleSubmissionTrigger processes the sublayer submission trigger event. It checks if there are new blocks produced since the last submission. -// If there are, it attempts to submit a batch of blocks. It then attempts to produce an empty block to ensure IBC messages -// pass through during the batch submission process due to proofs requires for ibc messages only exist on the next block. -// Finally, it submits the next batch of blocks and updates the sync target to the height of the last block in the submitted batch. -func (m *Manager) HandleSubmissionTrigger() error { - // Load current sync target and height to determine if new blocks are available for submission. +// CreateAndSubmitBatchGetSizeBlocksCommits creates and submits a batch to the DA and SL. +// Returns size of block and commit bytes +// max size bytes is the maximum size of the serialized batch type +func (m *Manager) CreateAndSubmitBatchGetSizeBlocksCommits(maxSize uint64) (uint64, error) { + b, err := m.CreateAndSubmitBatch(maxSize, false) + if b == nil { + return 0, err + } + return uint64(b.SizeBlockAndCommitBytes()), err +} +// CreateAndSubmitBatch creates and submits a batch to the DA and SL. +// max size bytes is the maximum size of the serialized batch type +func (m *Manager) CreateAndSubmitBatch(maxSizeBytes uint64, lastBatch bool) (*types.Batch, error) { startHeight := m.NextHeightToSubmit() endHeightInclusive := m.State.Height() if endHeightInclusive < startHeight { - return nil // No new blocks have been produced + // TODO: https://github.com/dymensionxyz/dymint/issues/999 + return nil, fmt.Errorf( + "next height to submit is greater than last block height, create and submit batch should not have been called: start height: %d: end height inclusive: %d: %w", + startHeight, + endHeightInclusive, + gerrc.ErrInternal, + ) } - nextBatch, err := m.CreateNextBatchToSubmit(startHeight, endHeightInclusive) + b, err := m.CreateBatch(maxSizeBytes, startHeight, endHeightInclusive) if err != nil { - return fmt.Errorf("create next batch to submit: %w", err) + return nil, fmt.Errorf("create batch: %w", err) } - - resultSubmitToDA := m.DAClient.SubmitBatch(nextBatch) - m.logger.Info("Submitted batch to DA", "start height", nextBatch.StartHeight, "end height", nextBatch.EndHeight) - if resultSubmitToDA.Code != da.StatusSuccess { - return fmt.Errorf("submit next batch to da: %s", resultSubmitToDA.Message) + // This is the last batch, so we need to mark it as such + if lastBatch && b.EndHeight() == endHeightInclusive { + b.LastBatch = true } - actualEndHeight := nextBatch.EndHeight + m.logger.Info("Created batch.", "start height", startHeight, "end height", endHeightInclusive, "size", b.SizeBytes(), "last batch", b.LastBatch) + types.LastBatchSubmittedBytes.Set(float64(b.SizeBytes())) - err = m.SLClient.SubmitBatch(nextBatch, m.DAClient.GetClientType(), &resultSubmitToDA) - if err != nil { - return fmt.Errorf("sl client submit batch: start height: %d: inclusive end height: %d: %w", startHeight, actualEndHeight, err) + if err := m.SubmitBatch(b); err != nil { + return nil, fmt.Errorf("submit batch: %w", err) } - m.logger.Info("Submitted batch to SL.", "start height", resultSubmitToDA, "end height", nextBatch.EndHeight) - - types.RollappHubHeightGauge.Set(float64(actualEndHeight)) - m.LastSubmittedHeight.Store(actualEndHeight) - return nil + return b, nil } -func (m *Manager) CreateNextBatchToSubmit(startHeight uint64, endHeightInclusive uint64) (*types.Batch, error) { +// CreateBatch looks through the store for any unsubmitted blocks and commits and bundles them into a batch +// max size bytes is the maximum size of the serialized batch type +func (m *Manager) CreateBatch(maxBatchSize uint64, startHeight uint64, endHeightInclusive uint64) (*types.Batch, error) { batchSize := endHeightInclusive - startHeight + 1 batch := &types.Batch{ - StartHeight: startHeight, - Blocks: make([]*types.Block, 0, batchSize), - Commits: make([]*types.Commit, 0, batchSize), + Blocks: make([]*types.Block, 0, batchSize), + Commits: make([]*types.Commit, 0, batchSize), } - // Populate the batch - for height := startHeight; height <= endHeightInclusive; height++ { - block, err := m.Store.LoadBlock(height) + for h := startHeight; h <= endHeightInclusive; h++ { + block, err := m.Store.LoadBlock(h) if err != nil { - return nil, fmt.Errorf("load block: height: %d: %w", height, err) + return nil, fmt.Errorf("load block: h: %d: %w", h, err) } - commit, err := m.Store.LoadCommit(height) + commit, err := m.Store.LoadCommit(h) if err != nil { - return nil, fmt.Errorf("load commit: height: %d: %w", height, err) + return nil, fmt.Errorf("load commit: h: %d: %w", h, err) } batch.Blocks = append(batch.Blocks, block) batch.Commits = append(batch.Commits, commit) - // Check if the batch size is too big - totalSize := batch.ToProto().Size() - if totalSize > int(m.Conf.BlockBatchMaxSizeBytes) { - // Nil out the last block and commit - batch.Blocks[len(batch.Blocks)-1] = nil - batch.Commits[len(batch.Commits)-1] = nil + totalSize := batch.SizeBytes() + if int(maxBatchSize) < totalSize { // Remove the last block and commit from the batch batch.Blocks = batch.Blocks[:len(batch.Blocks)-1] batch.Commits = batch.Commits[:len(batch.Commits)-1] - if height == startHeight { - return nil, fmt.Errorf("block size exceeds max batch size: height %d: size: %d", height, totalSize) + if h == startHeight { + return nil, fmt.Errorf("block size exceeds max batch size: h %d: size: %d: %w", h, totalSize, gerrc.ErrOutOfRange) } break } - - batch.EndHeight = height } return batch, nil } + +func (m *Manager) SubmitBatch(batch *types.Batch) error { + resultSubmitToDA := m.DAClient.SubmitBatch(batch) + if resultSubmitToDA.Code != da.StatusSuccess { + return fmt.Errorf("da client submit batch: %s: %w", resultSubmitToDA.Message, resultSubmitToDA.Error) + } + m.logger.Info("Submitted batch to DA.", "start height", batch.StartHeight(), "end height", batch.EndHeight()) + + err := m.SLClient.SubmitBatch(batch, m.DAClient.GetClientType(), &resultSubmitToDA) + if err != nil { + return fmt.Errorf("sl client submit batch: start height: %d: end height: %d: %w", batch.StartHeight(), batch.EndHeight(), err) + } + m.logger.Info("Submitted batch to SL.", "start height", batch.StartHeight(), "end height", batch.EndHeight()) + + types.RollappHubHeightGauge.Set(float64(batch.EndHeight())) + m.LastSubmittedHeight.Store(batch.EndHeight()) + return nil +} + +// GetUnsubmittedBytes returns the total number of unsubmitted bytes produced an element on a channel +// Intended only to be used at startup, before block production and submission loops start +func (m *Manager) GetUnsubmittedBytes() int { + total := 0 + /* + On node start we want to include the count of any blocks which were produced and not submitted in a previous instance + */ + currH := m.State.Height() + + for h := m.NextHeightToSubmit(); h <= currH; h++ { + block, err := m.Store.LoadBlock(h) + if err != nil { + if !errors.Is(err, gerrc.ErrNotFound) { + m.logger.Error("Get unsubmitted bytes load block.", "err", err) + } + break + } + commit, err := m.Store.LoadCommit(h) + if err != nil { + if !errors.Is(err, gerrc.ErrNotFound) { + m.logger.Error("Get unsubmitted bytes load commit.", "err", err) + } + break + } + total += block.SizeBytes() + commit.SizeBytes() + } + return total +} + +func (m *Manager) GetUnsubmittedBlocks() uint64 { + return m.State.Height() - m.LastSubmittedHeight.Load() +} diff --git a/block/submit_loop_test.go b/block/submit_loop_test.go new file mode 100644 index 000000000..403adda52 --- /dev/null +++ b/block/submit_loop_test.go @@ -0,0 +1,158 @@ +package block_test + +import ( + "context" + "math/rand" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/dymensionxyz/dymint/block" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" +) + +type testArgs struct { + nParallel int // number of instances to run in parallel + testDuration time.Duration // how long to run one instance of the test (should be short) + batchSkew uint64 // max number of batches to get ahead + batchBytes uint64 // max number of bytes in a batch + maxTime time.Duration // maximum time to wait before submitting submissions + submitTime time.Duration // how long it takes to submit a batch + produceTime time.Duration // time between producing block + produceBytes int // range of how many bytes each block (+ commit) is + submissionHaltTime time.Duration // how long to simulate batch submission failing/halting + submissionHaltProbability float64 // probability of submission failing and causing a temporary halt +} + +func testSubmitLoop(t *testing.T, + args testArgs, +) { + var wg sync.WaitGroup + for range args.nParallel { + wg.Add(1) + go func() { + testSubmitLoopInner(t, args) + wg.Done() + }() + } + wg.Wait() +} + +func testSubmitLoopInner( + t *testing.T, + args testArgs, +) { + ctx, cancel := context.WithTimeout(context.Background(), args.testDuration) + defer cancel() + + // returns a duration in [0.8,1.2] * d + approx := func(d time.Duration) time.Duration { + base := int(float64(d) * 0.8) + factor := int(float64(d) * 0.4) + return time.Duration(base + rand.Intn(factor)) + } + + pendingBlocks := atomic.Uint64{} // pending blocks to be submitted. gap between produced and submitted. + + nProducedBytes := atomic.Uint64{} // tracking how many actual bytes have been produced but not submitted so far + producedBytesC := make(chan int) // producer sends on here, and can be blocked by not consuming from here + + // the time of the last block produced or the last batch submitted or the last starting of the node + timeLastProgress := atomic.Int64{} + + go func() { // simulate block production + go func() { // another thread to check system properties + for { + select { + case <-ctx.Done(): + return + default: + } + // producer shall not get too far ahead + absoluteMax := (args.batchSkew + 1) * args.batchBytes // +1 is because the producer is always blocked after the fact + nProduced := nProducedBytes.Load() + require.True(t, nProduced < absoluteMax, "produced bytes not less than maximum", "nProduced", nProduced, "max", absoluteMax) + } + }() + for { + select { + case <-ctx.Done(): + return + default: + } + time.Sleep(approx(args.produceTime)) + nBytes := rand.Intn(args.produceBytes) // simulate block production + nProducedBytes.Add(uint64(nBytes)) + producedBytesC <- nBytes + pendingBlocks.Add(1) // increase pending blocks to be submitted counter + + timeLastProgress.Store(time.Now().Unix()) + } + }() + + submitBatch := func(maxSize uint64) (uint64, error) { // mock the batch submission + time.Sleep(approx(args.submitTime)) + if rand.Float64() < args.submissionHaltProbability { + time.Sleep(args.submissionHaltTime) + timeLastProgress.Store(time.Now().Unix()) // we have now recovered + } + consumed := rand.Intn(int(maxSize)) + nProducedBytes.Add(^uint64(consumed - 1)) // subtract + + timeLastProgressT := time.Unix(timeLastProgress.Load(), 0) + absoluteMax := int64(2 * float64(args.maxTime)) // allow some leeway for code execution. Tests may run on small boxes (GH actions) + timeSinceLast := time.Since(timeLastProgressT).Milliseconds() + require.True(t, timeSinceLast < absoluteMax, "too long since last update", "timeSinceLast", timeSinceLast, "max", absoluteMax) + + pendingBlocks.Store(0) // no pending blocks to be submitted + timeLastProgress.Store(time.Now().Unix()) // we have submitted batch + return uint64(consumed), nil + } + accumulatedBlocks := func() uint64 { + return pendingBlocks.Load() + } + + block.SubmitLoopInner(ctx, log.NewNopLogger(), producedBytesC, args.batchSkew, accumulatedBlocks, args.maxTime, args.batchBytes, submitBatch) +} + +// Make sure the producer does not get too far ahead +func TestSubmitLoopFastProducerHaltingSubmitter(t *testing.T) { + testSubmitLoop( + t, + testArgs{ + nParallel: 50, + testDuration: 2 * time.Second, + batchSkew: 10, + batchBytes: 100, + maxTime: 10 * time.Millisecond, + submitTime: 2 * time.Millisecond, + produceBytes: 20, + produceTime: 2 * time.Millisecond, + // a relatively long possibility of the submitter halting + // tests the case where we need to stop the producer getting too far ahead + submissionHaltTime: 50 * time.Millisecond, + submissionHaltProbability: 0.01, + }, + ) +} + +// Make sure the timer works even if the producer is slow +func TestSubmitLoopTimer(t *testing.T) { + testSubmitLoop( + t, + testArgs{ + nParallel: 50, + testDuration: 2 * time.Second, + batchSkew: 10, + batchBytes: 100, + maxTime: 10 * time.Millisecond, + submitTime: 2 * time.Millisecond, + produceBytes: 20, + // a relatively long production time ensures we test the + // case where the producer is slow but we want to submit anyway due to time + produceTime: 50 * time.Millisecond, + }, + ) +} diff --git a/block/submit_test.go b/block/submit_test.go index f30e98534..7f2713787 100644 --- a/block/submit_test.go +++ b/block/submit_test.go @@ -9,18 +9,24 @@ import ( "testing" "time" + tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/proxy" - cosmosed25519 "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/libp2p/go-libp2p/core/crypto" + "github.com/dymensionxyz/dymint/block" "github.com/dymensionxyz/dymint/config" + "github.com/dymensionxyz/dymint/da" slmocks "github.com/dymensionxyz/dymint/mocks/github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/testutil" "github.com/dymensionxyz/dymint/types" + "github.com/dymensionxyz/dymint/version" ) // TestBatchOverhead tests the scenario where we have a single block that is very large, and occupies the entire batch size. @@ -29,7 +35,7 @@ import ( // 1. single block with single large tx // 2. single block with multiple small tx func TestBatchOverhead(t *testing.T) { - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, nil, nil) + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, nil, nil) require.NoError(t, err) require.NotNil(t, manager) @@ -52,7 +58,7 @@ func TestBatchOverhead(t *testing.T) { } for _, tcase := range tcases { - blocks, err := testutil.GenerateBlocks(1, 1, manager.ProposerKey) + blocks, err := testutil.GenerateBlocks(1, 1, manager.LocalKey) require.NoError(t, err) block := blocks[0] @@ -70,15 +76,13 @@ func TestBatchOverhead(t *testing.T) { mallete(tcase.nTxs) - commits, err := testutil.GenerateCommits(blocks, manager.ProposerKey) + commits, err := testutil.GenerateCommits(blocks, manager.LocalKey) require.NoError(t, err) commit := commits[0] batch := types.Batch{ - StartHeight: 1, - EndHeight: 1, - Blocks: blocks, - Commits: commits, + Blocks: blocks, + Commits: commits, } batchSize := batch.ToProto().Size() @@ -100,38 +104,63 @@ func TestBatchOverhead(t *testing.T) { func TestBatchSubmissionHappyFlow(t *testing.T) { require := require.New(t) - app := testutil.GetAppMock() + app := testutil.GetAppMock(testutil.EndBlock) ctx := context.Background() // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) err := proxyApp.Start() require.NoError(err) - - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, proxyApp, nil) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, proxyApp, nil) require.NoError(err) + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) + // Check initial assertions initialHeight := uint64(0) require.Zero(manager.State.Height()) require.Zero(manager.LastSubmittedHeight.Load()) // Produce block and validate that we produced blocks - _, _, err = manager.ProduceAndGossipBlock(ctx, true) + _, _, err = manager.ProduceApplyGossipBlock(ctx, true) require.NoError(err) assert.Greater(t, manager.State.Height(), initialHeight) assert.Zero(t, manager.LastSubmittedHeight.Load()) // submit and validate sync target - manager.HandleSubmissionTrigger() + manager.CreateAndSubmitBatch(manager.Conf.BatchSubmitBytes, false) assert.EqualValues(t, manager.State.Height(), manager.LastSubmittedHeight.Load()) } func TestBatchSubmissionFailedSubmission(t *testing.T) { require := require.New(t) - app := testutil.GetAppMock() + app := testutil.GetAppMock(testutil.EndBlock) ctx := context.Background() - + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) @@ -144,10 +173,8 @@ func TestBatchSubmissionFailedSubmission(t *testing.T) { lib2pPrivKey, err := crypto.UnmarshalEd25519PrivateKey(priv) require.NoError(err) - cosmosPrivKey := cosmosed25519.PrivKey{Key: priv} - proposer := &types.Sequencer{ - PublicKey: cosmosPrivKey.PubKey(), - } + proposerKey := tmed25519.PrivKey(priv) + proposer := *types.NewSequencer(proposerKey.PubKey(), "") // Create a new mock ClientI slmock := &slmocks.MockClientI{} @@ -155,27 +182,31 @@ func TestBatchSubmissionFailedSubmission(t *testing.T) { slmock.On("Start").Return(nil) slmock.On("GetProposer").Return(proposer) - manager, err := testutil.GetManagerWithProposerKey(testutil.GetManagerConfig(), lib2pPrivKey, slmock, nil, 1, 1, 0, proxyApp, nil) + manager, err := testutil.GetManagerWithProposerKey(testutil.GetManagerConfig(), lib2pPrivKey, slmock, 1, 1, 0, proxyApp, nil) require.NoError(err) + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) + // Check initial assertions initialHeight := uint64(0) require.Zero(manager.State.Height()) require.Zero(manager.LastSubmittedHeight.Load()) // Produce block and validate that we produced blocks - _, _, err = manager.ProduceAndGossipBlock(ctx, true) + _, _, err = manager.ProduceApplyGossipBlock(ctx, true) require.NoError(err) assert.Greater(t, manager.State.Height(), initialHeight) assert.Zero(t, manager.LastSubmittedHeight.Load()) // try to submit, we expect failure slmock.On("SubmitBatch", mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("submit batch")).Once() - assert.Error(t, manager.HandleSubmissionTrigger()) + _, err = manager.CreateAndSubmitBatch(manager.Conf.BatchSubmitBytes, false) + assert.Error(t, err) // try to submit again, we expect success slmock.On("SubmitBatch", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once() - manager.HandleSubmissionTrigger() + manager.CreateAndSubmitBatch(manager.Conf.BatchSubmitBytes, false) assert.EqualValues(t, manager.State.Height(), manager.LastSubmittedHeight.Load()) } @@ -188,7 +219,19 @@ func TestSubmissionByTime(t *testing.T) { ) require := require.New(t) - app := testutil.GetAppMock() + app := testutil.GetAppMock(testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) // Create proxy app clientCreator := proxy.NewLocalClientCreator(app) proxyApp := proxy.NewAppConns(clientCreator) @@ -197,16 +240,19 @@ func TestSubmissionByTime(t *testing.T) { // Init manager with empty blocks feature enabled managerConfig := config.BlockManagerConfig{ - BlockTime: blockTime, - MaxIdleTime: 0, - MaxSupportedBatchSkew: 10, - BatchSubmitMaxTime: submitTimeout, - BlockBatchMaxSizeBytes: 1000, + BlockTime: blockTime, + MaxIdleTime: 0, + BatchSkew: 10, + BatchSubmitTime: submitTimeout, + BatchSubmitBytes: 1000, } - manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, proxyApp, nil) + manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) + // Check initial height initialHeight := uint64(0) require.Equal(initialHeight, manager.State.Height()) @@ -218,13 +264,14 @@ func TestSubmissionByTime(t *testing.T) { wg.Add(2) // Add 2 because we have 2 goroutines + bytesProducedC := make(chan int) go func() { - manager.ProduceBlockLoop(mCtx) + manager.ProduceBlockLoop(mCtx, bytesProducedC) wg.Done() // Decrease counter when this goroutine finishes }() go func() { - manager.SubmitLoop(mCtx) + manager.SubmitLoop(mCtx, bytesProducedC) wg.Done() // Decrease counter when this goroutine finishes }() @@ -255,44 +302,69 @@ func TestSubmissionByBatchSize(t *testing.T) { } for _, c := range cases { + app := testutil.GetAppMock(testutil.EndBlock) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 40000000, + MaxBytes: 500000, + }, + }, + }) + // Create proxy app + clientCreator := proxy.NewLocalClientCreator(app) + proxyApp := proxy.NewAppConns(clientCreator) + err := proxyApp.Start() + require.NoError(err) + managerConfig := testutil.GetManagerConfig() - managerConfig.BlockBatchMaxSizeBytes = c.blockBatchMaxSizeBytes - manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, nil, nil) + managerConfig.BatchSubmitBytes = c.blockBatchMaxSizeBytes + manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) require.NoError(err) - // validate initial accumulated is zero - require.Equal(manager.AccumulatedBatchSize.Load(), uint64(0)) + manager.DAClient = testutil.GetMockDALC(log.TestingLogger()) + manager.Retriever = manager.DAClient.(da.BatchRetriever) + assert.Equal(manager.State.Height(), uint64(0)) - var wg sync.WaitGroup - wg.Add(2) // Add 2 because we have 2 goroutines + submissionByBatchSize(manager, assert, c.expectedSubmission) + } +} - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) - defer cancel() +func submissionByBatchSize(manager *block.Manager, assert *assert.Assertions, expectedSubmission bool) { + var wg sync.WaitGroup + wg.Add(2) // Add 2 because we have 2 goroutines - go func() { - manager.ProduceBlockLoop(ctx) - wg.Done() // Decrease counter when this goroutine finishes - }() + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() - go func() { - assert.Zero(manager.LastSubmittedHeight.Load()) - manager.SubmitLoop(ctx) - wg.Done() // Decrease counter when this goroutine finishes - }() + bytesProducedC := make(chan int) - // wait for block to be produced but not for submission threshold - time.Sleep(200 * time.Millisecond) - // assert block produced but nothing submitted yet - assert.Greater(manager.State.Height(), uint64(0)) - assert.Greater(manager.AccumulatedBatchSize.Load(), uint64(0)) + go func() { + manager.ProduceBlockLoop(ctx, bytesProducedC) + wg.Done() // Decrease counter when this goroutine finishes + }() - wg.Wait() // Wait for all goroutines to finish + go func() { + assert.Zero(manager.LastSubmittedHeight.Load()) + manager.SubmitLoop(ctx, bytesProducedC) + wg.Done() // Decrease counter when this goroutine finishes + }() - if c.expectedSubmission { - assert.Positive(manager.LastSubmittedHeight.Load()) - } else { - assert.Zero(manager.LastSubmittedHeight.Load()) - } + // wait for block to be produced but not for submission threshold + time.Sleep(200 * time.Millisecond) + // assert block produced but nothing submitted yet + assert.Greater(manager.State.Height(), uint64(0)) + + wg.Wait() // Wait for all goroutines to finish + + if expectedSubmission { + assert.Positive(manager.LastSubmittedHeight.Load()) + } else { + assert.Zero(manager.LastSubmittedHeight.Load()) } } diff --git a/block/sync.go b/block/sync.go deleted file mode 100644 index 5f3341662..000000000 --- a/block/sync.go +++ /dev/null @@ -1,48 +0,0 @@ -package block - -import ( - "context" - - "github.com/dymensionxyz/dymint/types" - - "code.cloudfoundry.org/go-diodes" - "github.com/dymensionxyz/dymint/settlement" -) - -// SyncToTargetHeightLoop gets real time updates about settlement batch submissions and sends the latest height downstream -// to be retrieved by another process which will pull the data. -func (m *Manager) SyncToTargetHeightLoop(ctx context.Context) { - m.logger.Info("Started sync target loop") - subscription, err := m.Pubsub.Subscribe(ctx, "syncTargetLoop", settlement.EventQueryNewSettlementBatchAccepted) - if err != nil { - m.logger.Error("subscribe to state update events", "error", err) - panic(err) - } - - for { - select { - case <-ctx.Done(): - return - case event := <-subscription.Out(): - eventData, _ := event.Data().(*settlement.EventDataNewBatchAccepted) - h := eventData.EndHeight - - if h <= m.State.Height() { - m.logger.Debug( - "syncTargetLoop: received new settlement batch accepted with batch end height <= current store height, skipping.", - "target sync height (batch end height)", - h, - "current store height", - m.State.Height(), - ) - continue - } - types.RollappHubHeightGauge.Set(float64(h)) - m.targetSyncHeight.Set(diodes.GenericDataType(&h)) - m.logger.Info("Set new target sync height", "height", h) - case <-subscription.Cancelled(): - m.logger.Error("syncTargetLoop subscription canceled") - return - } - } -} diff --git a/block/types.go b/block/types.go deleted file mode 100644 index ef55d271d..000000000 --- a/block/types.go +++ /dev/null @@ -1,37 +0,0 @@ -package block - -import ( - "github.com/dymensionxyz/dymint/types" - - "github.com/libp2p/go-libp2p/core/crypto" - tmcrypto "github.com/tendermint/tendermint/crypto" -) - -// TODO: move to types package - -type blockSource string - -const ( - producedBlock blockSource = "produced" - gossipedBlock blockSource = "gossip" - daBlock blockSource = "da" - localDbBlock blockSource = "local_db" -) - -type blockMetaData struct { - source blockSource - daHeight uint64 -} - -type CachedBlock struct { - Block *types.Block - Commit *types.Commit -} - -func getAddress(key crypto.PrivKey) ([]byte, error) { - rawKey, err := key.GetPublic().Raw() - if err != nil { - return nil, err - } - return tmcrypto.AddressHash(rawKey), nil -} diff --git a/cmd/dymint/commands/init.go b/cmd/dymint/commands/init.go index 21b85b0e4..9587731fd 100644 --- a/cmd/dymint/commands/init.go +++ b/cmd/dymint/commands/init.go @@ -61,6 +61,7 @@ func InitFilesWithConfig(config *cfg.Config) error { ChainID: fmt.Sprintf("test-chain-%v", tmrand.Str(6)), GenesisTime: tmtime.Now(), ConsensusParams: types.DefaultConsensusParams(), + AppState: []byte("{\"app_state\": {\"rollappparams\": {\"params\": {\"da\": \"mock\",\"version\": \"646983ec41942854aa8b2fc2b755106307e50170\"}}}}"), } pubKey, err := pv.GetPubKey() if err != nil { diff --git a/cmd/dymint/commands/root.go b/cmd/dymint/commands/root.go index b2afa0995..af981f80e 100644 --- a/cmd/dymint/commands/root.go +++ b/cmd/dymint/commands/root.go @@ -55,7 +55,7 @@ func ParseConfig(cmd *cobra.Command) (*cfg.Config, error) { return nil, fmt.Errorf("in config file: %v", err) } - cfg := config.DefaultConfig(home, "") + cfg := config.DefaultConfig(home) config.EnsureRoot(conf.RootDir, cfg) return conf, nil } diff --git a/config/config.go b/config/config.go index d770c6c4d..bca5dace6 100644 --- a/config/config.go +++ b/config/config.go @@ -18,6 +18,9 @@ const ( DefaultDymintDir = ".dymint" DefaultConfigDirName = "config" DefaultConfigFileName = "dymint.toml" + MinBlockTime = 200 * time.Millisecond + MaxBlockTime = 6 * time.Second + MaxBatchSubmitTime = 1 * time.Hour ) // NodeConfig stores Dymint node configuration. @@ -30,7 +33,6 @@ type NodeConfig struct { // parameters below are dymint specific and read from config BlockManagerConfig `mapstructure:",squash"` - DALayer string `mapstructure:"da_layer"` DAConfig string `mapstructure:"da_config"` SettlementLayer string `mapstructure:"settlement_layer"` SettlementConfig settlement.Config `mapstructure:",squash"` @@ -51,14 +53,12 @@ type BlockManagerConfig struct { MaxIdleTime time.Duration `mapstructure:"max_idle_time"` // MaxProofTime defines the max time to be idle, if txs that requires proof were included in last block MaxProofTime time.Duration `mapstructure:"max_proof_time"` - // BatchSubmitMaxTime defines how long should block manager wait for before submitting batch - BatchSubmitMaxTime time.Duration `mapstructure:"batch_submit_max_time"` - // Max amount of pending batches to be submitted. block production will be paused if this limit is reached. - MaxSupportedBatchSkew uint64 `mapstructure:"max_supported_batch_skew"` - // The size of the batch in Bytes. Every batch we'll write to the DA and the settlement layer. - BlockBatchMaxSizeBytes uint64 `mapstructure:"block_batch_max_size_bytes"` - // Namespaceid included in the header (not used) - NamespaceID string `mapstructure:"namespace_id"` + // BatchSubmitMaxTime is how long should block manager wait for before submitting batch + BatchSubmitTime time.Duration `mapstructure:"batch_submit_time"` + // BatchSkew is the number of batches waiting to be submitted. Block production will be paused if this limit is reached. + BatchSkew uint64 `mapstructure:"max_batch_skew"` + // The size of the batch of blocks and commits in Bytes. We'll write every batch to the DA and the settlement layer. + BatchSubmitBytes uint64 `mapstructure:"batch_submit_bytes"` } // GetViperConfig reads configuration parameters from Viper instance. @@ -126,8 +126,12 @@ func (nc NodeConfig) Validate() error { // Validate BlockManagerConfig func (c BlockManagerConfig) Validate() error { - if c.BlockTime <= 0 { - return fmt.Errorf("block_time must be positive") + if c.BlockTime < MinBlockTime { + return fmt.Errorf("block_time cannot be less than %s", MinBlockTime) + } + + if c.BlockTime > MaxBlockTime { + return fmt.Errorf("block_time cannot be greater than %s", MaxBlockTime) } if c.MaxIdleTime < 0 { @@ -135,32 +139,28 @@ func (c BlockManagerConfig) Validate() error { } // MaxIdleTime zero disables adaptive block production. if c.MaxIdleTime != 0 { - if c.MaxIdleTime <= c.BlockTime { - return fmt.Errorf("max_idle_time must be greater than block_time") + if c.MaxIdleTime <= c.BlockTime || c.MaxIdleTime > MaxBatchSubmitTime { + return fmt.Errorf("max_idle_time must be greater than block_time and not greater than %s", MaxBatchSubmitTime) } if c.MaxProofTime <= 0 || c.MaxProofTime > c.MaxIdleTime { return fmt.Errorf("max_proof_time must be positive and not greater than max_idle_time") } } - if c.BatchSubmitMaxTime <= 0 { - return fmt.Errorf("batch_submit_max_time must be positive") + if c.BatchSubmitTime < c.MaxIdleTime { + return fmt.Errorf("batch_submit_time must be greater than max_idle_time") } - if c.BatchSubmitMaxTime < c.BlockTime { - return fmt.Errorf("batch_submit_max_time must be greater than block_time") + if c.BatchSubmitTime > MaxBatchSubmitTime { + return fmt.Errorf("batch_submit_time must be not greater than %s", MaxBatchSubmitTime) } - if c.BatchSubmitMaxTime < c.MaxIdleTime { - return fmt.Errorf("batch_submit_max_time must be greater than max_idle_time") + if c.BatchSubmitBytes <= 0 { + return fmt.Errorf("batch_submit_bytes must be positive") } - if c.BlockBatchMaxSizeBytes <= 0 { - return fmt.Errorf("block_batch_size_bytes must be positive") - } - - if c.MaxSupportedBatchSkew <= 0 { - return fmt.Errorf("max_supported_batch_skew must be positive") + if c.BatchSkew <= 0 { + return fmt.Errorf("max_batch_skew must be positive") } return nil @@ -179,17 +179,6 @@ func (nc NodeConfig) validateSettlementLayer() error { } func (nc NodeConfig) validateDALayer() error { - if nc.DALayer == "" { - return fmt.Errorf("DALayer cannot be empty") - } - - if nc.DALayer == "mock" { - return nil - } - - if nc.DAConfig == "" { - return fmt.Errorf("DAConfig cannot be empty") - } if nc.DAGrpc.Host == "" { return fmt.Errorf("DAGrpc.Host cannot be empty") } @@ -229,7 +218,7 @@ func (ic InstrumentationConfig) Validate() error { // DBConfig holds configuration for the database. type DBConfig struct { - // SyncWrite makes sure that data is written to disk before returning from a write operation. + // SyncWrites makes sure that data is written to disk before returning from a write operation. SyncWrites bool `mapstructure:"sync_writes"` // InMemory sets the database to run in-memory, without touching the disk. InMemory bool `mapstructure:"in_memory"` diff --git a/config/config_test.go b/config/config_test.go index 5eb471470..f2eea6fd2 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -20,24 +20,20 @@ func TestViperAndCobra(t *testing.T) { config.AddNodeFlags(cmd) dir := t.TempDir() - nc := config.DefaultConfig("", "") + nc := config.DefaultConfig("") config.EnsureRoot(dir, nc) - assert.NoError(cmd.Flags().Set(config.FlagDALayer, "foobar")) assert.NoError(cmd.Flags().Set(config.FlagDAConfig, `{"json":true}`)) - assert.NoError(cmd.Flags().Set(config.FlagBlockTime, "1234s")) + assert.NoError(cmd.Flags().Set(config.FlagBlockTime, "4s")) assert.NoError(cmd.Flags().Set(config.FlagMaxIdleTime, "2000s")) - assert.NoError(cmd.Flags().Set(config.FlagBatchSubmitMaxTime, "3000s")) - assert.NoError(cmd.Flags().Set(config.FlagNamespaceID, "0102030405060708")) - assert.NoError(cmd.Flags().Set(config.FlagBlockBatchMaxSizeBytes, "1000")) + assert.NoError(cmd.Flags().Set(config.FlagBatchSubmitTime, "3000s")) + assert.NoError(cmd.Flags().Set(config.FlagBatchSubmitBytes, "1000")) assert.NoError(nc.GetViperConfig(cmd, dir)) - assert.Equal("foobar", nc.DALayer) assert.Equal(`{"json":true}`, nc.DAConfig) - assert.Equal(1234*time.Second, nc.BlockTime) - assert.Equal("0102030405060708", nc.NamespaceID) - assert.Equal(uint64(1000), nc.BlockManagerConfig.BlockBatchMaxSizeBytes) + assert.Equal(4*time.Second, nc.BlockTime) + assert.Equal(uint64(1000), nc.BlockManagerConfig.BatchSubmitBytes) } func TestNodeConfig_Validate(t *testing.T) { @@ -65,7 +61,19 @@ func TestNodeConfig_Validate(t *testing.T) { }, { name: "missing batch submit max time", malleate: func(nc *config.NodeConfig) { - nc.BlockManagerConfig.BatchSubmitMaxTime = 0 + nc.BlockManagerConfig.BatchSubmitTime = 0 + }, + wantErr: assert.Error, + }, { + name: "block_time too small", + malleate: func(nc *config.NodeConfig) { + nc.BlockManagerConfig.BlockTime = 10 * time.Millisecond + }, + wantErr: assert.Error, + }, { + name: "block_time greater than limit", + malleate: func(nc *config.NodeConfig) { + nc.BlockManagerConfig.BlockTime = 10 * time.Second }, wantErr: assert.Error, }, { @@ -77,16 +85,28 @@ func TestNodeConfig_Validate(t *testing.T) { }, wantErr: assert.Error, }, { - name: "batch_submit_max_time not greater than block_time", + name: "batch_submit_time not greater than block_time", malleate: func(nc *config.NodeConfig) { - nc.BlockManagerConfig.BatchSubmitMaxTime = 1 + nc.BlockManagerConfig.BatchSubmitTime = 1 nc.BlockManagerConfig.BlockTime = 2 }, wantErr: assert.Error, + }, { + name: "batch_submit_time greater than 1 hour", + malleate: func(nc *config.NodeConfig) { + nc.BlockManagerConfig.BatchSubmitTime = 2 * time.Hour + }, + wantErr: assert.Error, + }, { + name: "max_batch_skew 0", + malleate: func(nc *config.NodeConfig) { + nc.BlockManagerConfig.BatchSkew = 0 + }, + wantErr: assert.Error, }, { name: "missing block batch max size bytes", malleate: func(nc *config.NodeConfig) { - nc.BlockManagerConfig.BlockBatchMaxSizeBytes = 0 + nc.BlockManagerConfig.BatchSubmitBytes = 0 }, wantErr: assert.Error, }, { @@ -109,36 +129,12 @@ func TestNodeConfig_Validate(t *testing.T) { nc.SettlementConfig.GasFees = "" }, wantErr: assert.Error, - }, { - name: "settlement: missing rollapp id", - malleate: func(nc *config.NodeConfig) { - nc.SettlementConfig.RollappID = "" - }, - wantErr: assert.Error, }, { name: "settlement: mock", malleate: func(nc *config.NodeConfig) { nc.SettlementLayer = "mock" }, wantErr: assert.NoError, - }, { - name: "DALayer: empty", - malleate: func(nc *config.NodeConfig) { - nc.DALayer = "" - }, - wantErr: assert.Error, - }, { - name: "DALayer: mock", - malleate: func(nc *config.NodeConfig) { - nc.DALayer = "mock" - }, - wantErr: assert.NoError, - }, { - name: "DAConfig: empty", - malleate: func(nc *config.NodeConfig) { - nc.DAConfig = "" - }, - wantErr: assert.Error, }, { name: "DAGrpc.Host empty", malleate: func(nc *config.NodeConfig) { @@ -187,15 +183,13 @@ func TestNodeConfig_Validate(t *testing.T) { func fullNodeConfig() config.NodeConfig { return config.NodeConfig{ BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 1 * time.Second, - MaxIdleTime: 20 * time.Second, - MaxProofTime: 20 * time.Second, - BatchSubmitMaxTime: 20 * time.Second, - MaxSupportedBatchSkew: 10, - NamespaceID: "test", - BlockBatchMaxSizeBytes: 10000, + BlockTime: 1 * time.Second, + MaxIdleTime: 20 * time.Second, + MaxProofTime: 20 * time.Second, + BatchSubmitTime: 20 * time.Second, + BatchSkew: 10, + BatchSubmitBytes: 10000, }, - DALayer: "celestia", DAConfig: "da-config", SettlementLayer: "dymension", SettlementConfig: settlement.Config{ @@ -203,7 +197,6 @@ func fullNodeConfig() config.NodeConfig { NodeAddress: "http://localhost:26657", KeyringHomeDir: "/tmp/keyring-test", DymAccountName: "test", - RollappID: "test_123-1", GasLimit: 120, GasPrices: "0.025stake", GasFees: "", @@ -223,10 +216,11 @@ func fullNodeConfig() config.NodeConfig { Port: 9090, }, P2PConfig: config.P2PConfig{ - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - ListenAddress: config.DefaultListenAddress, - BootstrapNodes: "", + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, + ListenAddress: config.DefaultListenAddress, + BootstrapNodes: "", }, } } diff --git a/config/defaults.go b/config/defaults.go index 8ca893bb7..4342be555 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -13,36 +13,35 @@ const ( DefaultListenAddress = "/ip4/0.0.0.0/tcp/26656" DefaultHomeDir = "sequencer_keys" - DefaultChainID = "dymint-testnet" ) // DefaultNodeConfig keeps default values of NodeConfig -var DefaultNodeConfig = *DefaultConfig("", "") +var DefaultNodeConfig = *DefaultConfig("") // DefaultConfig returns a default configuration for dymint node. -func DefaultConfig(home, chainId string) *NodeConfig { +func DefaultConfig(home string) *NodeConfig { cfg := &NodeConfig{ BlockManagerConfig: BlockManagerConfig{ - BlockTime: 200 * time.Millisecond, - MaxIdleTime: 3600 * time.Second, - MaxProofTime: 100 * time.Second, - BatchSubmitMaxTime: 3600 * time.Second, - MaxSupportedBatchSkew: 20, - NamespaceID: "0000000000000000ffff", - BlockBatchMaxSizeBytes: 500000, + BlockTime: 200 * time.Millisecond, + MaxIdleTime: 3600 * time.Second, + MaxProofTime: 100 * time.Second, + BatchSubmitTime: 3600 * time.Second, + BatchSkew: 10, + BatchSubmitBytes: 500000, }, - DALayer: "mock", SettlementLayer: "mock", Instrumentation: &InstrumentationConfig{ Prometheus: false, PrometheusListenAddr: ":2112", }, P2PConfig: P2PConfig{ - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - ListenAddress: DefaultListenAddress, - BootstrapNodes: "", - AdvertisingEnabled: true, + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, + ListenAddress: DefaultListenAddress, + BootstrapNodes: "", + AdvertisingEnabled: true, + BlockSyncEnabled: true, }, DBConfig: DBConfig{ SyncWrites: true, @@ -54,9 +53,6 @@ func DefaultConfig(home, chainId string) *NodeConfig { home = "/tmp" } keyringDir := filepath.Join(home, DefaultHomeDir) - if chainId == "" { - chainId = DefaultChainID - } // Setting default params for sl grpc mock defaultSlGrpcConfig := settlement.GrpcConfig{ @@ -68,7 +64,6 @@ func DefaultConfig(home, chainId string) *NodeConfig { defaultSLconfig := settlement.Config{ KeyringBackend: "test", NodeAddress: "http://127.0.0.1:36657", - RollappID: chainId, KeyringHomeDir: keyringDir, DymAccountName: "sequencer", GasPrices: "1000000000adym", diff --git a/config/flags.go b/config/flags.go index d8470567b..92d009f60 100644 --- a/config/flags.go +++ b/config/flags.go @@ -7,13 +7,11 @@ import ( ) const ( - FlagDALayer = "dymint.da_layer" - FlagDAConfig = "dymint.da_config" - FlagBlockTime = "dymint.block_time" - FlagMaxIdleTime = "dymint.max_idle_time" - FlagBatchSubmitMaxTime = "dymint.batch_submit_max_time" - FlagNamespaceID = "dymint.namespace_id" - FlagBlockBatchMaxSizeBytes = "dymint.block_batch_max_size_bytes" + FlagDAConfig = "dymint.da_config" + FlagBlockTime = "dymint.block_time" + FlagMaxIdleTime = "dymint.max_idle_time" + FlagBatchSubmitTime = "dymint.batch_submit_time" + FlagBatchSubmitBytes = "dymint.batch_submit_bytes" ) const ( @@ -25,7 +23,6 @@ const ( FlagSLGasLimit = "dymint.settlement_config.gas_limit" FlagSLGasPrices = "dymint.settlement_config.gas_prices" FlagSLGasFees = "dymint.settlement_config.gas_fees" - FlagRollappID = "dymint.settlement_config.rollapp_id" ) const ( @@ -44,14 +41,11 @@ func AddNodeFlags(cmd *cobra.Command) { def := DefaultNodeConfig - cmd.Flags().String(FlagDALayer, def.DALayer, "Data Availability Layer Client name (mock or grpc") cmd.Flags().String(FlagDAConfig, def.DAConfig, "Data Availability Layer Client config") cmd.Flags().Duration(FlagBlockTime, def.BlockTime, "block time (for sequencer mode)") cmd.Flags().Duration(FlagMaxIdleTime, def.MaxIdleTime, "max time for empty blocks (for sequencer mode)") - cmd.Flags().Duration(FlagBatchSubmitMaxTime, def.BatchSubmitMaxTime, "max time for batch submit (for sequencer mode)") - cmd.Flags().String(FlagNamespaceID, def.NamespaceID, "namespace identifies (8 bytes in hex)") - cmd.Flags().Uint64(FlagBlockBatchMaxSizeBytes, def.BlockBatchMaxSizeBytes, "block batch size in bytes") - + cmd.Flags().Duration(FlagBatchSubmitTime, def.BatchSubmitTime, "max time for batch submit (for sequencer mode)") + cmd.Flags().Uint64(FlagBatchSubmitBytes, def.BatchSubmitBytes, "block batch size in bytes") cmd.Flags().String(FlagSettlementLayer, def.SettlementLayer, "Settlement Layer Client name") cmd.Flags().String(FlagSLNodeAddress, def.SettlementConfig.NodeAddress, "Settlement Layer RPC node address") cmd.Flags().String(FlagSLKeyringBackend, def.SettlementConfig.KeyringBackend, "Sequencer keyring backend") @@ -60,18 +54,14 @@ func AddNodeFlags(cmd *cobra.Command) { cmd.Flags().String(FlagSLGasFees, def.SettlementConfig.GasFees, "Settlement Layer gas fees") cmd.Flags().String(FlagSLGasPrices, def.SettlementConfig.GasPrices, "Settlement Layer gas prices") cmd.Flags().Uint64(FlagSLGasLimit, def.SettlementConfig.GasLimit, "Settlement Layer batch submit gas limit") - cmd.Flags().String(FlagRollappID, def.SettlementConfig.RollappID, "The chainID of the rollapp") cmd.Flags().String(FlagP2PListenAddress, def.P2PConfig.ListenAddress, "P2P listen address") cmd.Flags().String(FlagP2PBootstrapNodes, def.P2PConfig.BootstrapNodes, "P2P bootstrap nodes") cmd.Flags().Duration(FlagP2PBootstrapRetryTime, def.P2PConfig.BootstrapRetryTime, "P2P bootstrap time") - cmd.Flags().Uint64(FlagP2PGossipCacheSize, uint64(def.P2PConfig.GossipedBlocksCacheSize), "P2P Gossiped blocks cache size") + cmd.Flags().Uint64(FlagP2PGossipCacheSize, uint64(def.P2PConfig.GossipSubCacheSize), "P2P Gossiped blocks cache size") } func BindDymintFlags(cmd *cobra.Command, v *viper.Viper) error { - if err := v.BindPFlag("da_layer", cmd.Flags().Lookup(FlagDALayer)); err != nil { - return err - } if err := v.BindPFlag("da_config", cmd.Flags().Lookup(FlagDAConfig)); err != nil { return err } @@ -81,13 +71,10 @@ func BindDymintFlags(cmd *cobra.Command, v *viper.Viper) error { if err := v.BindPFlag("max_idle_time", cmd.Flags().Lookup(FlagMaxIdleTime)); err != nil { return err } - if err := v.BindPFlag("batch_submit_max_time", cmd.Flags().Lookup(FlagBatchSubmitMaxTime)); err != nil { + if err := v.BindPFlag("batch_submit_time", cmd.Flags().Lookup(FlagBatchSubmitTime)); err != nil { return err } - if err := v.BindPFlag("namespace_id", cmd.Flags().Lookup(FlagNamespaceID)); err != nil { - return err - } - if err := v.BindPFlag("block_batch_max_size_bytes", cmd.Flags().Lookup(FlagBlockBatchMaxSizeBytes)); err != nil { + if err := v.BindPFlag("batch_submit_bytes", cmd.Flags().Lookup(FlagBatchSubmitBytes)); err != nil { return err } if err := v.BindPFlag("settlement_layer", cmd.Flags().Lookup(FlagSettlementLayer)); err != nil { @@ -114,9 +101,6 @@ func BindDymintFlags(cmd *cobra.Command, v *viper.Viper) error { if err := v.BindPFlag("gas_limit", cmd.Flags().Lookup(FlagSLGasLimit)); err != nil { return err } - if err := v.BindPFlag("rollapp_id", cmd.Flags().Lookup(FlagRollappID)); err != nil { - return err - } if err := v.BindPFlag("p2p_listen_address", cmd.Flags().Lookup(FlagP2PListenAddress)); err != nil { return err } diff --git a/config/p2p.go b/config/p2p.go index 24fcc2443..a2449ed43 100644 --- a/config/p2p.go +++ b/config/p2p.go @@ -14,20 +14,28 @@ type P2PConfig struct { // List of nodes persistent P2P nodes PersistentNodes string `mapstructure:"p2p_persistent_nodes"` // Size of the Gossipsub router cache - GossipedBlocksCacheSize int `mapstructure:"p2p_gossiped_blocks_cache_size"` + GossipSubCacheSize int `mapstructure:"p2p_gossip_cache_size"` // Time interval a node tries to bootstrap again, in case no nodes connected BootstrapRetryTime time.Duration `mapstructure:"p2p_bootstrap_retry_time"` + // Param used to enable block sync from p2p + BlockSyncEnabled bool `mapstructure:"p2p_blocksync_enabled"` + // Time interval used by a node to request missing blocks (gap between cached blocks and local height) on demand from other peers using blocksync + BlockSyncRequestIntervalTime time.Duration `mapstructure:"p2p_blocksync_block_request_interval"` // Param used to enable the advertisement of the node to be part of the P2P network in the DHT AdvertisingEnabled bool `mapstructure:"p2p_advertising_enabled"` } // Validate P2PConfig func (c P2PConfig) Validate() error { - if c.GossipedBlocksCacheSize < 0 { + if c.GossipSubCacheSize < 0 { return fmt.Errorf("gossipsub cache size cannot be negative") } if c.BootstrapRetryTime <= 0 { return fmt.Errorf("bootstrap time must be positive") } + if c.BlockSyncRequestIntervalTime <= 0 { + return fmt.Errorf("blocksync retrieve time must be positive") + } + return nil } diff --git a/config/toml.go b/config/toml.go index 05dfea4da..d133cd514 100644 --- a/config/toml.go +++ b/config/toml.go @@ -70,18 +70,17 @@ block_time = "{{ .BlockManagerConfig.BlockTime }}" # block production interval in case of no transactions ("0s" produces empty blocks) max_idle_time = "{{ .BlockManagerConfig.MaxIdleTime }}" max_proof_time = "{{ .BlockManagerConfig.MaxProofTime }}" -max_supported_batch_skew = {{ .BlockManagerConfig.MaxSupportedBatchSkew }} +max_batch_skew = {{ .BlockManagerConfig.BatchSkew }} # triggers to submit batch to DA and settlement (both required) -batch_submit_max_time = "{{ .BlockManagerConfig.BatchSubmitMaxTime }}" +# max time between two batch submissions. submission will be triggered if there is no previous submission in batch_submit_time +batch_submit_time = "{{ .BlockManagerConfig.BatchSubmitTime }}" -# max size of batch in bytes that can be accepted by DA -block_batch_max_size_bytes = {{ .BlockManagerConfig.BlockBatchMaxSizeBytes }} +# max size of batch in bytes. submission will be triggered after accumulating blocks for batch_submit_bytes +batch_submit_bytes = {{ .BlockManagerConfig.BatchSubmitBytes }} ### da config ### -da_layer = "{{ .DALayer }}" # mock, celestia, avail -namespace_id = "{{ .BlockManagerConfig.NamespaceID }}" # this should be json matching the celestia.Config type da_config = "{{ .DAConfig }}" @@ -105,7 +104,7 @@ p2p_bootstrap_nodes = "{{ .P2PConfig.BootstrapNodes }}" p2p_persistent_nodes = "{{ .P2PConfig.PersistentNodes }}" # max number of cached messages by gossipsub protocol -p2p_gossiped_blocks_cache_size = {{ .P2PConfig.GossipedBlocksCacheSize }} +p2p_gossip_cache_size = {{ .P2PConfig.GossipSubCacheSize }} # time interval to check if no p2p nodes are connected to bootstrap again p2p_bootstrap_retry_time = "{{ .P2PConfig.BootstrapRetryTime }}" @@ -113,11 +112,16 @@ p2p_bootstrap_retry_time = "{{ .P2PConfig.BootstrapRetryTime }}" # set to false to disable advertising the node to the P2P network p2p_advertising_enabled= "{{ .P2PConfig.AdvertisingEnabled }}" +# set to false to disable block syncing from p2p +p2p_blocksync_enabled= "{{ .P2PConfig.BlockSyncEnabled }}" + +# time interval used to periodically check for missing blocks and retrieve it from other peers on demand using P2P +p2p_blocksync_block_request_interval= "{{ .P2PConfig.BlockSyncRequestIntervalTime }}" + ### settlement config ### settlement_layer = "{{ .SettlementLayer }}" # mock, dymension # dymension config -rollapp_id = "{{ .SettlementConfig.RollappID }}" settlement_node_address = "{{ .SettlementConfig.NodeAddress }}" settlement_gas_limit = {{ .SettlementConfig.GasLimit }} settlement_gas_prices = "{{ .SettlementConfig.GasPrices }}" diff --git a/conv/crypto.go b/conv/crypto.go index f42ab1b76..b2c49e18a 100644 --- a/conv/crypto.go +++ b/conv/crypto.go @@ -17,7 +17,7 @@ func GetNodeKey(nodeKey *p2p.NodeKey) (crypto.PrivKey, error) { case "ed25519": privKey, err := crypto.UnmarshalEd25519PrivateKey(nodeKey.PrivKey.Bytes()) if err != nil { - return nil, fmt.Errorf("node private key unmarshaling error: %w", err) + return nil, fmt.Errorf("node private key unmarshaling: %w", err) } return privKey, nil default: diff --git a/da/avail/avail.go b/da/avail/avail.go index c582832d2..a31e4a7b2 100644 --- a/da/avail/avail.go +++ b/da/avail/avail.go @@ -33,6 +33,7 @@ const ( DataCallMethod = "submit_data" DataCallSectionIndex = 29 DataCallMethodIndex = 1 + maxBlobSize = 2097152 // 2MB according to Avail docs https://docs.availproject.org/docs/build-with-avail/overview#expandable-blockspace ) type SubstrateApiI interface { @@ -136,6 +137,8 @@ func (c *DataAvailabilityLayerClient) Init(config []byte, pubsubServer *pubsub.S } } + types.RollappConsecutiveFailedDASubmission.Set(0) + c.ctx, c.cancel = context.WithCancel(context.Background()) return nil } @@ -265,6 +268,7 @@ func (c *DataAvailabilityLayerClient) submitBatchLoop(dataBlob []byte) da.Result var err error daBlockHeight, err = c.broadcastTx(dataBlob) if err != nil { + types.RollappConsecutiveFailedDASubmission.Inc() c.logger.Error("broadcasting batch", "error", err) if errors.Is(err, da.ErrTxBroadcastConfigError) { err = retry.Unrecoverable(err) @@ -295,6 +299,7 @@ func (c *DataAvailabilityLayerClient) submitBatchLoop(dataBlob []byte) da.Result c.logger.Error(err.Error()) continue } + types.RollappConsecutiveFailedDASubmission.Set(0) c.logger.Debug("Successfully submitted batch.") return da.ResultSubmitBatch{ @@ -431,3 +436,8 @@ func (c *DataAvailabilityLayerClient) getHeightFromHash(hash availtypes.Hash) (u } return uint64(header.Number), nil } + +// GetMaxBlobSizeBytes returns the maximum allowed blob size in the DA, used to check the max batch size configured +func (d *DataAvailabilityLayerClient) GetMaxBlobSizeBytes() uint32 { + return maxBlobSize +} diff --git a/da/avail/avail_test.go b/da/avail/avail_test.go index 5cac5df35..26097a853 100644 --- a/da/avail/avail_test.go +++ b/da/avail/avail_test.go @@ -9,7 +9,6 @@ import ( "github.com/dymensionxyz/dymint/da/avail" mocks "github.com/dymensionxyz/dymint/mocks/github.com/dymensionxyz/dymint/da/avail" "github.com/dymensionxyz/dymint/testutil" - "github.com/dymensionxyz/dymint/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -20,103 +19,16 @@ const ( seed = "copper mother insect grunt blue cute tell side welcome domain border oxygen" ) -// FIXME(omritoptix): This test is currently not working as I couldn't find a way to mock the SubmitAndWatchExtrinsic function. -// func TestSubmitBatch(t *testing.T) { -// assert := assert.New(t) -// require := require.New(t) -// configBytes, err := json.Marshal(avail.Config{ -// Seed: seed, -// }) -// require.NoError(err) -// // Create mock clients -// mockSubstrateApiClient := mocks.NewSubstrateApiI(t) -// // Configure DALC options -// options := []da.Option{ -// avail.WithClient(mockSubstrateApiClient), -// avail.WithBatchRetryAttempts(1), -// avail.WithBatchRetryDelay(1 * time.Second), -// avail.WithTxInclusionTimeout(1 * time.Second), -// } -// // Subscribe to the health status event -// pubsubServer := pubsub.NewServer() -// pubsubServer.Start() -// // HealthSubscription, err := pubsubServer.Subscribe(context.Background(), "testSubmitBatch", da.EventQueryDAHealthStatus) -// assert.NoError(err) -// // Start the DALC -// dalc := avail.DataAvailabilityLayerClient{} -// err = dalc.Init(configBytes, pubsubServer, nil, test.NewLogger(t), options...) -// require.NoError(err) -// err = dalc.Start() -// require.NoError(err) -// // Set the mock functions -// metadata := availtypes.NewMetadataV14() -// metadata.AsMetadataV14 = availtypes.MetadataV14{ -// Pallets: []availtypes.PalletMetadataV14{ -// { -// Name: "DataAvailability", -// HasCalls: true, -// }, -// { -// Name: "System", -// HasStorage: true, -// Storage: availtypes.StorageMetadataV14{ -// Prefix: "System", -// Items: []availtypes.StorageEntryMetadataV14{ -// { -// Name: "Account", -// Type: availtypes.StorageEntryTypeV14{ -// IsPlainType: true, -// IsMap: true, -// AsMap: availtypes.MapTypeV14{ -// Hashers: []availtypes.StorageHasherV10{ -// { -// IsIdentity: true, -// }, -// }, -// }, -// }, -// }, -// }, -// }, -// }, -// }, -// EfficientLookup: map[int64]*availtypes.Si1Type{ -// 0: { -// Def: availtypes.Si1TypeDef{ -// Variant: availtypes.Si1TypeDefVariant{ -// Variants: []availtypes.Si1Variant{ -// { -// Name: "submit_data", -// }, -// }, -// }, -// }, -// }, -// }, -// } +// TODO: there was another test here, it should be brought back https://github.com/dymensionxyz/dymint/issues/970 -// mockSubstrateApiClient.On("GetMetadataLatest").Return(metadata, nil) -// mockSubstrateApiClient.On("GetBlockHash", mock.Anything).Return(availtypes.NewHash([]byte("123")), nil) -// mockSubstrateApiClient.On("GetRuntimeVersionLatest").Return(availtypes.NewRuntimeVersion(), nil) -// mockSubstrateApiClient.On("GetStorageLatest", mock.Anything, mock.Anything).Return(true, nil) -// mockSubstrateApiClient.On("SubmitAndWatchExtrinsic", mock.Anything).Return(nil, nil) -// batch := &types.Batch{ -// StartHeight: 0, -// EndHeight: 1, -// } -// res := dalc.SubmitBatch(batch) -// assert.Equal(res.Code, da.StatusSuccess) - -// } - -// TestRetriveBatches tests the RetrieveBatches function manages +// TestRetrieveBatches tests the RetrieveBatches function manages // to decode the batches from the block extrinsics and only returns // the batches relevant for our app id and method index. -func TestRetriveBatches(t *testing.T) { +func TestRetrieveBatches(t *testing.T) { assert := assert.New(t) require := require.New(t) const appId = 123 - // Setup the config + // Set up the config configBytes, err := json.Marshal(avail.Config{ Seed: seed, AppID: int64(appId), @@ -140,8 +52,8 @@ func TestRetriveBatches(t *testing.T) { // Set the mock functions mockSubstrateApiClient.On("GetBlockHash", mock.Anything).Return(availtypes.NewHash([]byte("123")), nil) // Build batches for the block extrinsics - batch1 := types.Batch{StartHeight: 0, EndHeight: 1} - batch2 := types.Batch{StartHeight: 2, EndHeight: 3} + batch1 := testutil.MustGenerateBatchAndKey(0, 1) + batch2 := testutil.MustGenerateBatchAndKey(2, 3) batch1bytes, err := batch1.MarshalBinary() require.NoError(err) batch2bytes, err := batch2.MarshalBinary() @@ -181,5 +93,5 @@ func TestRetriveBatches(t *testing.T) { } batchResult := dalc.RetrieveBatches(daMetaData) assert.Equal(1, len(batchResult.Batches)) - assert.Equal(batch1.StartHeight, batchResult.Batches[0].StartHeight) + assert.Equal(batch1.StartHeight(), batchResult.Batches[0].StartHeight()) } diff --git a/da/celestia/celestia.go b/da/celestia/celestia.go index 4a4a89967..c9b979909 100644 --- a/da/celestia/celestia.go +++ b/da/celestia/celestia.go @@ -61,7 +61,7 @@ func WithRPCRetryDelay(delay time.Duration) da.Option { // WithRPCAttempts sets failed rpc calls retry attempts. func WithRPCAttempts(attempts int) da.Option { return func(daLayerClient da.DataAvailabilityLayerClient) { - daLayerClient.(*DataAvailabilityLayerClient).config.RetryAttempts = attempts + daLayerClient.(*DataAvailabilityLayerClient).config.RetryAttempts = &attempts } } @@ -91,6 +91,8 @@ func (c *DataAvailabilityLayerClient) Init(config []byte, pubsubServer *pubsub.S apply(c) } + types.RollappConsecutiveFailedDASubmission.Set(0) + return nil } @@ -120,6 +122,10 @@ func createConfig(bz []byte) (c Config, err error) { if c.Backoff == (uretry.BackoffConfig{}) { c.Backoff = defaultSubmitBackoff } + if c.RetryAttempts == nil { + attempts := defaultRpcRetryAttempts + c.RetryAttempts = &attempts + } return c, nil } @@ -201,8 +207,21 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS // TODO(srene): Split batch in multiple blobs if necessary if supported height, commitment, err := c.submit(data) + if errors.Is(err, gerrc.ErrInternal) { + // no point retrying if it's because of our code being wrong + err = fmt.Errorf("submit: %w", err) + return da.ResultSubmitBatch{ + BaseResult: da.BaseResult{ + Code: da.StatusError, + Message: err.Error(), + Error: err, + }, + } + } + if err != nil { c.logger.Error("Submit blob.", "error", err) + types.RollappConsecutiveFailedDASubmission.Inc() backoff.Sleep() continue } @@ -219,6 +238,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS result := c.CheckBatchAvailability(daMetaData) if result.Code != da.StatusSuccess { c.logger.Error("Check batch availability: submitted batch but did not get availability success status.", "error", err) + types.RollappConsecutiveFailedDASubmission.Inc() backoff.Sleep() continue } @@ -228,6 +248,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS c.logger.Debug("Blob availability check passed successfully.") + types.RollappConsecutiveFailedDASubmission.Set(0) return da.ResultSubmitBatch{ BaseResult: da.BaseResult{ Code: da.StatusSuccess, @@ -246,11 +267,11 @@ func (c *DataAvailabilityLayerClient) RetrieveBatches(daMetaData *da.DASubmitMet c.logger.Debug("Context cancelled.") return da.ResultRetrieveBatch{} default: - // Just for backward compatibility, in case no commitments are sent from the Hub, batch can be retrieved using previous implementation. var resultRetrieveBatch da.ResultRetrieveBatch err := retry.Do( func() error { var result da.ResultRetrieveBatch + // Just for backward compatibility, in case no commitments are sent from the Hub, batch can be retrieved using previous implementation. if daMetaData.Commitment == nil { result = c.retrieveBatchesNoCommitment(daMetaData.Height) } else { @@ -265,7 +286,7 @@ func (c *DataAvailabilityLayerClient) RetrieveBatches(daMetaData *da.DASubmitMet return nil }, - retry.Attempts(uint(c.config.RetryAttempts)), + retry.Attempts(uint(*c.config.RetryAttempts)), retry.DelayType(retry.FixedDelay), retry.Delay(c.config.RetryDelay), ) @@ -394,7 +415,7 @@ func (c *DataAvailabilityLayerClient) CheckBatchAvailability(daMetaData *da.DASu } return nil - }, retry.Attempts(uint(c.config.RetryAttempts)), retry.DelayType(retry.FixedDelay), retry.Delay(c.config.RetryDelay)) + }, retry.Attempts(uint(*c.config.RetryAttempts)), retry.DelayType(retry.FixedDelay), retry.Delay(c.config.RetryDelay)) if err != nil { c.logger.Error("CheckAvailability process failed.", "error", err) } @@ -512,11 +533,11 @@ func (c *DataAvailabilityLayerClient) checkBatchAvailability(daMetaData *da.DASu func (c *DataAvailabilityLayerClient) submit(daBlob da.Blob) (uint64, da.Commitment, error) { blobs, commitments, err := c.blobsAndCommitments(daBlob) if err != nil { - return 0, nil, fmt.Errorf("blobs and commitments: %w", err) + return 0, nil, fmt.Errorf("blobs and commitments: %w: %w", err, gerrc.ErrInternal) } if len(commitments) == 0 { - return 0, nil, fmt.Errorf("zero commitments: %w", gerrc.ErrNotFound) + return 0, nil, fmt.Errorf("zero commitments: %w: %w", gerrc.ErrNotFound, gerrc.ErrInternal) } blobSizes := make([]uint32, len(blobs)) @@ -527,7 +548,7 @@ func (c *DataAvailabilityLayerClient) submit(daBlob da.Blob) (uint64, da.Commitm ctx, cancel := context.WithTimeout(c.ctx, c.config.Timeout) defer cancel() - height, err := c.rpc.Submit(ctx, blobs, openrpc.GasPrice(c.config.GasPrices)) + height, err := c.rpc.Submit(ctx, blobs, blob.NewSubmitOptions(blob.WithGasPrice(c.config.GasPrices))) if err != nil { return 0, nil, fmt.Errorf("do rpc submit: %w", err) } @@ -557,12 +578,7 @@ func (c *DataAvailabilityLayerClient) blobsAndCommitments(daBlob da.Blob) ([]*bl } blobs = append(blobs, b) - commitment, err := blob.CreateCommitment(b) - if err != nil { - return nil, nil, fmt.Errorf("create commitment: %w", err) - } - - commitments = append(commitments, commitment) + commitments = append(commitments, b.Commitment) return blobs, commitments, nil } @@ -628,3 +644,8 @@ func (c *DataAvailabilityLayerClient) sync(rpc *openrpc.Client) { c.logger.Error("Waiting for Celestia data availability client to sync", "err", err) } } + +// GetMaxBlobSizeBytes returns the maximum allowed blob size in the DA, used to check the max batch size configured +func (d *DataAvailabilityLayerClient) GetMaxBlobSizeBytes() uint32 { + return maxBlobSizeBytes +} diff --git a/da/celestia/celestia_test.go b/da/celestia/celestia_test.go index a1777a10b..862832e3b 100644 --- a/da/celestia/celestia_test.go +++ b/da/celestia/celestia_test.go @@ -40,14 +40,10 @@ func TestDALC(t *testing.T) { block1 := getRandomBlock(1, 10) block2 := getRandomBlock(2, 10) batch1 := &types.Batch{ - StartHeight: block1.Header.Height, - EndHeight: block1.Header.Height, - Blocks: []*types.Block{block1}, + Blocks: []*types.Block{block1}, } batch2 := &types.Batch{ - StartHeight: block2.Header.Height, - EndHeight: block2.Header.Height, - Blocks: []*types.Block{block2}, + Blocks: []*types.Block{block2}, } nIDSize := 1 @@ -102,9 +98,7 @@ func TestRetrievalNotFound(t *testing.T) { // only blocks b1 and b2 will be submitted to DA block1 := getRandomBlock(1, 10) batch1 := &types.Batch{ - StartHeight: block1.Header.Height, - EndHeight: block1.Header.Height, - Blocks: []*types.Block{block1}, + Blocks: []*types.Block{block1}, } nIDSize := 1 @@ -146,9 +140,7 @@ func TestRetrievalNoCommitment(t *testing.T) { mockRPCClient, dalc, nID, _ := setDAandMock(t) block1 := getRandomBlock(1, 10) batch1 := &types.Batch{ - StartHeight: block1.Header.Height, - EndHeight: block1.Header.Height, - Blocks: []*types.Block{block1}, + Blocks: []*types.Block{block1}, } // only blocks b1 and b2 will be submitted to DA data1, _ := batch1.MarshalBinary() @@ -175,9 +167,7 @@ func TestAvalabilityOK(t *testing.T) { // only blocks b1 and b2 will be submitted to DA block1 := getRandomBlock(1, 10) batch1 := &types.Batch{ - StartHeight: block1.Header.Height, - EndHeight: block1.Header.Height, - Blocks: []*types.Block{block1}, + Blocks: []*types.Block{block1}, } nIDSize := 1 @@ -219,9 +209,7 @@ func TestAvalabilityWrongProof(t *testing.T) { // only blocks b1 and b2 will be submitted to DA block1 := getRandomBlock(1, 10) batch1 := &types.Batch{ - StartHeight: block1.Header.Height, - EndHeight: block1.Header.Height, - Blocks: []*types.Block{block1}, + Blocks: []*types.Block{block1}, } nIDSize := 1 @@ -345,8 +333,8 @@ func compareBlocks(t *testing.T, b1, b2 *types.Block) { func compareBatches(t *testing.T, b1, b2 *types.Batch) { t.Helper() - assert.Equal(t, b1.StartHeight, b2.StartHeight) - assert.Equal(t, b1.EndHeight, b2.EndHeight) + assert.Equal(t, b1.StartHeight(), b2.StartHeight()) + assert.Equal(t, b1.EndHeight(), b2.EndHeight()) assert.Equal(t, len(b1.Blocks), len(b2.Blocks)) for i := range b1.Blocks { compareBlocks(t, b1.Blocks[i], b2.Blocks[i]) diff --git a/da/celestia/config.go b/da/celestia/config.go index fafc40252..025a42e33 100644 --- a/da/celestia/config.go +++ b/da/celestia/config.go @@ -12,9 +12,11 @@ import ( ) const ( - defaultRpcRetryDelay = 3 * time.Second - namespaceVersion = 0 - DefaultGasPrices = 0.1 + defaultRpcRetryDelay = 3 * time.Second + namespaceVersion = 0 + DefaultGasPrices = 0.1 + defaultRpcRetryAttempts = 5 + maxBlobSizeBytes = 500000 ) var defaultSubmitBackoff = uretry.NewBackoffConfig( @@ -31,7 +33,7 @@ type Config struct { NamespaceIDStr string `json:"namespace_id,omitempty"` AuthToken string `json:"auth_token,omitempty"` Backoff uretry.BackoffConfig `json:"backoff,omitempty"` - RetryAttempts int `json:"retry_attempts,omitempty"` + RetryAttempts *int `json:"retry_attempts,omitempty"` RetryDelay time.Duration `json:"retry_delay,omitempty"` NamespaceID openrpcns.Namespace `json:"-"` } diff --git a/da/celestia/config_test.go b/da/celestia/config_test.go index cad82d7b2..2838b9a28 100644 --- a/da/celestia/config_test.go +++ b/da/celestia/config_test.go @@ -17,14 +17,17 @@ func TestCreateConfig(t *testing.T) { bz, _ := json.Marshal(v) return bz } + t.Run("simple", func(t *testing.T) { + retryAttempts := 10 + c := Config{ BaseURL: TestConfig.BaseURL, AppNodeURL: TestConfig.AppNodeURL, Timeout: TestConfig.Timeout, GasPrices: 42, Backoff: uretry.NewBackoffConfig(uretry.WithGrowthFactor(1.65)), - RetryAttempts: 10, + RetryAttempts: &retryAttempts, RetryDelay: 10 * time.Second, } bz := mustMarshal(c) @@ -47,6 +50,8 @@ func TestCreateConfig(t *testing.T) { assert.Equal(t, defaultSubmitBackoff, gotC.Backoff) }) t.Run("generate example", func(t *testing.T) { + retryAttempts := 4 + c := Config{ BaseURL: TestConfig.BaseURL, AppNodeURL: TestConfig.AppNodeURL, @@ -54,7 +59,7 @@ func TestCreateConfig(t *testing.T) { GasPrices: 0.1, AuthToken: "TOKEN", Backoff: defaultSubmitBackoff, - RetryAttempts: 4, + RetryAttempts: &retryAttempts, RetryDelay: 3 * time.Second, } bz := mustMarshal(c) diff --git a/da/celestia/rpc.go b/da/celestia/rpc.go index 65304951a..74673e6a6 100644 --- a/da/celestia/rpc.go +++ b/da/celestia/rpc.go @@ -30,9 +30,9 @@ func (c *OpenRPC) GetAll(ctx context.Context, height uint64, namespaces []share. return c.rpc.Blob.GetAll(ctx, height, namespaces) } -// Submit blobs. -func (c *OpenRPC) Submit(ctx context.Context, blobs []*blob.Blob, gasPrice openrpc.GasPrice) (uint64, error) { - return c.rpc.Blob.Submit(ctx, blobs, gasPrice) +// Submit blobs. +func (c *OpenRPC) Submit(ctx context.Context, blobs []*blob.Blob, options *blob.SubmitOptions) (uint64, error) { + return c.rpc.Blob.Submit(ctx, blobs, options) } // Getting proof for submitted blob diff --git a/da/celestia/rpc_test.go b/da/celestia/rpc_test.go index 7b854cc9f..7b6f9eee6 100644 --- a/da/celestia/rpc_test.go +++ b/da/celestia/rpc_test.go @@ -17,7 +17,6 @@ import ( "github.com/dymensionxyz/dymint/da/celestia" mocks "github.com/dymensionxyz/dymint/mocks/github.com/dymensionxyz/dymint/da/celestia/types" "github.com/dymensionxyz/dymint/testutil" - "github.com/dymensionxyz/dymint/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -53,10 +52,7 @@ func TestSubmitBatch(t *testing.T) { require := require.New(t) configBytes, err := json.Marshal(celestia.TestConfig) require.NoError(err) - batch := &types.Batch{ - StartHeight: 0, - EndHeight: 1, - } + batch := testutil.MustGenerateBatchAndKey(0, 1) nIDSize := 1 tree := exampleNMT(nIDSize, true, 1, 2, 3, 4) @@ -71,7 +67,7 @@ func TestSubmitBatch(t *testing.T) { cases := []struct { name string submitPFBReturn []interface{} - sumbitPFDRun func(args mock.Arguments) + submitPFBRun func(args mock.Arguments) expectedInclusionHeight uint64 getProofReturn []interface{} getProofDRun func(args mock.Arguments) @@ -83,7 +79,7 @@ func TestSubmitBatch(t *testing.T) { submitPFBReturn: []interface{}{uint64(1234), nil}, getProofReturn: []interface{}{&blobProof, nil}, includedReturn: []interface{}{true, nil}, - sumbitPFDRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, + submitPFBRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, getProofDRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, includedRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, expectedInclusionHeight: uint64(1234), @@ -93,7 +89,7 @@ func TestSubmitBatch(t *testing.T) { submitPFBReturn: []interface{}{uint64(0), timeOutErr}, getProofReturn: []interface{}{&blobProof, nil}, includedReturn: []interface{}{true, nil}, - sumbitPFDRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, + submitPFBRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, getProofDRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, includedRun: func(args mock.Arguments) { time.Sleep(10 * time.Millisecond) }, }, @@ -128,7 +124,7 @@ func TestSubmitBatch(t *testing.T) { DAH: dah, } - mockRPCClient.On(submitPFBFuncName, mock.Anything, mock.Anything, mock.Anything).Return(tc.submitPFBReturn...).Run(tc.sumbitPFDRun) + mockRPCClient.On(submitPFBFuncName, mock.Anything, mock.Anything, mock.Anything).Return(tc.submitPFBReturn...).Run(tc.submitPFBRun) if tc.name == "TestSubmitPFBResponseCodeSuccess" { mockRPCClient.On(getProofFuncName, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.getProofReturn...).Run(tc.getProofDRun) mockRPCClient.On(includedFuncName, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.includedReturn...).Run(tc.includedRun) diff --git a/da/celestia/types/rpc.go b/da/celestia/types/rpc.go index 6f47dd2db..efde9c9a4 100644 --- a/da/celestia/types/rpc.go +++ b/da/celestia/types/rpc.go @@ -3,7 +3,6 @@ package types import ( "context" - openrpc "github.com/celestiaorg/celestia-openrpc" "github.com/celestiaorg/celestia-openrpc/types/blob" "github.com/celestiaorg/celestia-openrpc/types/header" "github.com/celestiaorg/celestia-openrpc/types/share" @@ -15,7 +14,7 @@ type CelestiaRPCClient interface { GetAll(context.Context, uint64, []share.Namespace) ([]*blob.Blob, error) GetProof(ctx context.Context, height uint64, namespace share.Namespace, commitment blob.Commitment) (*blob.Proof, error) Included(ctx context.Context, height uint64, namespace share.Namespace, proof *blob.Proof, commitment blob.Commitment) (bool, error) - Submit(ctx context.Context, blobs []*blob.Blob, gasPrice openrpc.GasPrice) (uint64, error) + Submit(ctx context.Context, blobs []*blob.Blob, options *blob.SubmitOptions) (uint64, error) /* --------------------------------- header --------------------------------- */ GetByHeight(ctx context.Context, height uint64) (*header.ExtendedHeader, error) diff --git a/da/da.go b/da/da.go index 3b65a385f..7a6dfca8b 100644 --- a/da/da.go +++ b/da/da.go @@ -40,9 +40,9 @@ type Client string // Data availability clients const ( Mock Client = "mock" - Grpc Client = "grpc" Celestia Client = "celestia" Avail Client = "avail" + Grpc Client = "grpc" Interchain Client = "interchain" ) @@ -207,9 +207,8 @@ type ResultRetrieveBatch struct { // ResultRetrieveBatchV2 contains a batch of blocks returned from the DA layer client. type ResultRetrieveBatchV2 struct { BaseResult - // Batches is the full block retrieved from the DA layer. - // If BaseResult.Code is not StatusSuccess, this field is nil. - Batches []*types.Batch + // Batch is the full block retrieved from the DA layer. + Batch types.Batch } // Path TODO: move to the Dymension proto file @@ -242,7 +241,11 @@ type DataAvailabilityLayerClient interface { // CheckBatchAvailability checks the availability of the blob submitted getting proofs and validating them CheckBatchAvailability(daMetaData *DASubmitMetaData) ResultCheckBatch + // Channel used to check when the DA light client finished syncing Synced() <-chan struct{} + + // Returns the maximum allowed blob size in the DA, used to check the max batch size configured + GetMaxBlobSizeBytes() uint32 } // ClientV2 defines generic interface for DA layer block submission. @@ -260,7 +263,7 @@ type ClientV2 interface { Stop() error // SubmitBatchV2 submits the passed in block to the DA layer. - SubmitBatchV2(*types.Batch) ResultSubmitBatchV2 + SubmitBatchV2(types.Batch) ResultSubmitBatchV2 GetClientType() Client diff --git a/da/da_test.go b/da/da_test.go index 50aa4c665..ac7f084da 100644 --- a/da/da_test.go +++ b/da/da_test.go @@ -82,14 +82,10 @@ func doTestDALC(t *testing.T, mockDalc da.DataAvailabilityLayerClient) { block1 := getRandomBlock(1, 10) block2 := getRandomBlock(2, 10) batch1 := &types.Batch{ - StartHeight: block1.Header.Height, - EndHeight: block1.Header.Height, - Blocks: []*types.Block{block1}, + Blocks: []*types.Block{block1}, } batch2 := &types.Batch{ - StartHeight: block2.Header.Height, - EndHeight: block2.Header.Height, - Blocks: []*types.Block{block2}, + Blocks: []*types.Block{block2}, } resp := dalc.SubmitBatch(batch1) @@ -166,9 +162,7 @@ func doTestRetrieve(t *testing.T, dalc da.DataAvailabilityLayerClient) { for i := uint64(0); i < 100; i++ { b := getRandomBlock(i, rand.Int()%20) batch := &types.Batch{ - StartHeight: i, - EndHeight: i, - Blocks: []*types.Block{b}, + Blocks: []*types.Block{b}, Commits: []*types.Commit{ { Height: b.Header.Height, diff --git a/da/errors.go b/da/errors.go index bfcc91782..8301d05c0 100644 --- a/da/errors.go +++ b/da/errors.go @@ -1,6 +1,10 @@ package da -import "errors" +import ( + "errors" + + "github.com/dymensionxyz/gerr-cosmos/gerrc" +) var ( // ErrFailedTxBuild is returned when transaction build fails. @@ -21,4 +25,6 @@ var ( ErrProofNotMatching = errors.New("proof not matching") // ErrNameSpace is returned when wrong namespace used ErrNameSpace = errors.New("namespace not matching") + // ErrDAMismatch is returned when the DA client used does not match the da client specified in the da path of the state update + ErrDAMismatch = gerrc.ErrInvalidArgument.Wrap("DA in config not matching DA path") ) diff --git a/da/grpc/grpc.go b/da/grpc/grpc.go index d8aadb294..8a3dfc9d0 100644 --- a/da/grpc/grpc.go +++ b/da/grpc/grpc.go @@ -46,11 +46,11 @@ var ( // Init sets the configuration options. func (d *DataAvailabilityLayerClient) Init(config []byte, _ *pubsub.Server, _ store.KV, logger types.Logger, options ...da.Option) error { d.logger = logger + d.synced = make(chan struct{}, 1) if len(config) == 0 { d.config = DefaultConfig return nil } - d.synced = make(chan struct{}, 1) return json.Unmarshal(config, &d.config) } @@ -74,7 +74,7 @@ func (d *DataAvailabilityLayerClient) Start() error { // Stop closes connection to gRPC server. func (d *DataAvailabilityLayerClient) Stop() error { - d.logger.Info("stopoing GRPC DALC") + d.logger.Info("stopping GRPC DALC") return d.conn.Close() } @@ -119,6 +119,11 @@ func (d *DataAvailabilityLayerClient) CheckBatchAvailability(daMetaData *da.DASu } } +// GetMaxBlobSizeBytes returns the maximum allowed blob size in the DA, used to check the max batch size configured +func (d *DataAvailabilityLayerClient) GetMaxBlobSizeBytes() uint32 { + return 0 +} + // RetrieveBatches proxies RetrieveBlocks request to gRPC server. func (d *DataAvailabilityLayerClient) RetrieveBatches(daMetaData *da.DASubmitMetaData) da.ResultRetrieveBatch { resp, err := d.client.RetrieveBatches(context.TODO(), &dalc.RetrieveBatchesRequest{DataLayerHeight: daMetaData.Height}) diff --git a/da/interchain/chain_client.go b/da/interchain/chain_client.go index 8db866fde..2feb15dc6 100644 --- a/da/interchain/chain_client.go +++ b/da/interchain/chain_client.go @@ -9,16 +9,20 @@ import ( "github.com/dymensionxyz/cosmosclient/cosmosclient" "github.com/ignite/cli/ignite/pkg/cosmosaccount" "github.com/tendermint/tendermint/libs/bytes" + "github.com/tendermint/tendermint/light/provider" + "github.com/tendermint/tendermint/light/provider/http" rpcclient "github.com/tendermint/tendermint/rpc/client" - ctypes "github.com/tendermint/tendermint/rpc/core/types" + rpctypes "github.com/tendermint/tendermint/rpc/core/types" + tmtypes "github.com/tendermint/tendermint/types" interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" ) type daClient struct { cosmosclient.Client - queryClient interchainda.QueryClient - txService tx.ServiceClient + queryClient interchainda.QueryClient + txService tx.ServiceClient + lightProvider provider.Provider } func newDAClient(ctx context.Context, config DAConfig) (*daClient, error) { @@ -36,10 +40,17 @@ func newDAClient(ctx context.Context, config DAConfig) (*daClient, error) { if err != nil { return nil, fmt.Errorf("can't create DA layer cosmos client: %w", err) } + + lightProvider, err := http.New(config.ChainID, config.NodeAddress) + if err != nil { + return nil, fmt.Errorf("can't create DA layer IBC light provider: %w", err) + } + return &daClient{ - Client: c, - queryClient: interchainda.NewQueryClient(c.Context()), - txService: tx.NewServiceClient(c.Context()), + Client: c, + queryClient: interchainda.NewQueryClient(c.Context()), + txService: tx.NewServiceClient(c.Context()), + lightProvider: lightProvider, }, nil } @@ -51,6 +62,16 @@ func (c *daClient) Params(ctx context.Context) (interchainda.Params, error) { return resp.GetParams(), nil } +func (c *daClient) Blob(ctx context.Context, id interchainda.BlobID) (*interchainda.QueryBlobResponse, error) { + resp, err := c.queryClient.Blob(ctx, &interchainda.QueryBlobRequest{ + BlobId: uint64(id), + }) + if err != nil { + return nil, fmt.Errorf("can't query DA layer params: %w", err) + } + return resp, nil +} + func (c *daClient) GetTx(ctx context.Context, txHash string) (*tx.GetTxResponse, error) { return c.txService.GetTx(ctx, &tx.GetTxRequest{Hash: txHash}) } @@ -60,10 +81,14 @@ func (c *daClient) ABCIQueryWithProof( path string, data bytes.HexBytes, height int64, -) (*ctypes.ResultABCIQuery, error) { +) (*rpctypes.ResultABCIQuery, error) { opts := rpcclient.ABCIQueryOptions{ Height: height, Prove: true, } return c.RPC.ABCIQueryWithOptions(ctx, path, data, opts) } + +func (c *daClient) LightBlock(ctx context.Context, height uint64) (*tmtypes.LightBlock, error) { + return c.lightProvider.LightBlock(ctx, int64(height)) +} diff --git a/da/interchain/helpers.go b/da/interchain/helpers.go new file mode 100644 index 000000000..6e7545113 --- /dev/null +++ b/da/interchain/helpers.go @@ -0,0 +1,50 @@ +package interchain + +import ( + "errors" + "fmt" + + "github.com/dymensionxyz/dymint/da/interchain/ioutils" + "github.com/dymensionxyz/dymint/types" +) + +// EncodeBatch encodes the batch to the interchain DA layer format. +// The batch is represented in binary and gzipped. +func EncodeBatch(b types.Batch) ([]byte, error) { + // Prepare the blob data + blob, err := b.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("can't marshal batch: %w", err) + } + + // Gzip the blob + gzipped, err := ioutils.Gzip(blob) + if err != nil { + return nil, fmt.Errorf("can't gzip batch: %w", err) + } + + return gzipped, nil +} + +// DecodeBatch decodes the batch from the interchain DA layer format. +// The incoming batch must be a gzipped binary. +func DecodeBatch(b []byte) (types.Batch, error) { + if !ioutils.IsGzip(b) { + return types.Batch{}, errors.New("batch is not gzip-compressed") + } + + // Gunzip the blob + binary, err := ioutils.Gunzip(b) + if err != nil { + return types.Batch{}, fmt.Errorf("can't gunzip batch: %w", err) + } + + // Prepare the blob data + var batch types.Batch + err = batch.UnmarshalBinary(binary) + if err != nil { + return types.Batch{}, fmt.Errorf("can't unmarshal batch: %w", err) + } + + return batch, nil +} diff --git a/da/interchain/helpers_test.go b/da/interchain/helpers_test.go new file mode 100644 index 000000000..90eca119e --- /dev/null +++ b/da/interchain/helpers_test.go @@ -0,0 +1,69 @@ +package interchain_test + +import ( + "reflect" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/dymensionxyz/dymint/da/interchain" + "github.com/dymensionxyz/dymint/types" +) + +func FuzzEncodeDecodeBatch1(f *testing.F) { + f.Add(uint64(0), uint64(0)) + + f.Fuzz(func(t *testing.T, h1, h2 uint64) { + // Generate batches with random headers + expected := types.Batch{ + StartHeight: h1, + EndHeight: h2, + Blocks: []*types.Block{}, + Commits: []*types.Commit{}, + } + + data, err := interchain.EncodeBatch(expected) + require.NoError(t, err) + + actual, err := interchain.DecodeBatch(data) + require.NoError(t, err) + + require.Equal(t, expected, actual) + }) +} + +func TestEncodeDecodeBatch(t *testing.T) { + expected := types.Batch{ + StartHeight: 1, + EndHeight: 123, + Blocks: []*types.Block{ + { + Header: types.Header{ + Height: 1, + }, + }, + { + Header: types.Header{ + Height: 2, + }, + }, + }, + Commits: []*types.Commit{ + { + Height: 1, + }, + { + Height: 2, + }, + }, + } + + data, err := interchain.EncodeBatch(expected) + require.NoError(t, err) + + actual, err := interchain.DecodeBatch(data) + require.NoError(t, err) + + require.True(t, reflect.DeepEqual(expected, actual)) + require.Equal(t, expected, actual) +} diff --git a/da/interchain/interchain.go b/da/interchain/interchain.go index 3573760b7..7a3a0d4ba 100644 --- a/da/interchain/interchain.go +++ b/da/interchain/interchain.go @@ -15,6 +15,7 @@ import ( "github.com/tendermint/tendermint/libs/bytes" "github.com/tendermint/tendermint/libs/pubsub" ctypes "github.com/tendermint/tendermint/rpc/core/types" + tmtypes "github.com/tendermint/tendermint/types" "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/store" @@ -31,8 +32,10 @@ type DAClient interface { Context() sdkclient.Context BroadcastTx(string, ...sdk.Msg) (cosmosclient.Response, error) Params(context.Context) (interchainda.Params, error) + Blob(ctx context.Context, id interchainda.BlobID) (*interchainda.QueryBlobResponse, error) GetTx(context.Context, string) (*tx.GetTxResponse, error) ABCIQueryWithProof(ctx context.Context, path string, data bytes.HexBytes, height int64) (*ctypes.ResultABCIQuery, error) + LightBlock(ctx context.Context, height uint64) (*tmtypes.LightBlock, error) } // DALayerClient is a client for DA-provider blockchains supporting the interchain-da module. diff --git a/da/interchain/interchain_test.go b/da/interchain/interchain_test.go index 97c2c38b0..1b0de53e4 100644 --- a/da/interchain/interchain_test.go +++ b/da/interchain/interchain_test.go @@ -13,7 +13,7 @@ import ( ) // TODO: add interchain DA chain mock -func TestDALayerClient_Init(t *testing.T) { +func TestDALayerClient(t *testing.T) { t.Skip() // Test is not finished yet client := new(interchain.DALayerClient) @@ -25,12 +25,18 @@ func TestDALayerClient_Init(t *testing.T) { err = client.Init(rawConfig, nil, nil, logger) require.NoError(t, err) - result := client.SubmitBatchV2(&types.Batch{ + batch := types.Batch{ StartHeight: 1, EndHeight: 3, Blocks: []*types.Block{{Header: types.Header{Height: 1}}}, Commits: []*types.Commit{{Height: 1}}, - }) - require.NoError(t, result.Error) - t.Logf("result: %#v", result) + } + + submitResult := client.SubmitBatchV2(batch) + require.NoError(t, submitResult.Error) + + retrieveResult := client.RetrieveBatchesV2(submitResult) + require.NoError(t, retrieveResult.Error) + + require.Equal(t, batch, retrieveResult.Batch) } diff --git a/da/interchain/retrieve_batches.go b/da/interchain/retrieve_batches.go index 5dd2616dc..ee1007cff 100644 --- a/da/interchain/retrieve_batches.go +++ b/da/interchain/retrieve_batches.go @@ -1,11 +1,59 @@ package interchain -import "github.com/dymensionxyz/dymint/da" +import ( + "fmt" + + "github.com/dymensionxyz/dymint/da" + "github.com/dymensionxyz/dymint/types" + interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" +) func (c *DALayerClient) RetrieveBatches(daMetaData *da.DASubmitMetaData) da.ResultRetrieveBatch { panic("RetrieveBatches method is not supported by the interchain DA clint") } -func (c *DALayerClient) RetrieveBatchesV2(da.ResultSubmitBatchV2) da.ResultRetrieveBatchV2 { - panic("implement me") +func (c *DALayerClient) RetrieveBatchesV2(b da.ResultSubmitBatchV2) da.ResultRetrieveBatchV2 { + batch, err := c.retrieveBatches(b) + if err != nil { + return da.ResultRetrieveBatchV2{ + BaseResult: da.BaseResult{ + Code: da.StatusError, + Message: fmt.Sprintf("can't retrieve batch from the interchain DA layer: %s", err.Error()), + Error: err, + }, + Batch: types.Batch{}, + } + } + + return da.ResultRetrieveBatchV2{ + BaseResult: da.BaseResult{ + Code: da.StatusSuccess, + Message: "Retrieve successful", + }, + Batch: batch, + } +} + +func (c *DALayerClient) retrieveBatches(b da.ResultSubmitBatchV2) (types.Batch, error) { + var commitment *interchainda.Commitment + err := c.cdc.UnpackAny(b.DAPath.Commitment, &commitment) + if err != nil { + return types.Batch{}, fmt.Errorf("can't unpack commitment: %w", err) + } + + resp, err := c.daClient.Blob(c.ctx, interchainda.BlobID(commitment.BlobId)) + if err != nil { + return types.Batch{}, fmt.Errorf("can't get blob from the interchain DA layer: %w", err) + } + + if resp.BlobMetadata.BlobHash != commitment.BlobHash { + return types.Batch{}, fmt.Errorf("commitment blob hash doesn't match interchain DA layer blob hash") + } + + batch, err := DecodeBatch(resp.Blob) + if err != nil { + return types.Batch{}, fmt.Errorf("can't decode batch from interchain DA layer: %w", err) + } + + return batch, nil } diff --git a/da/interchain/submit_batch.go b/da/interchain/submit_batch.go index 9dfea9d99..b8985930a 100644 --- a/da/interchain/submit_batch.go +++ b/da/interchain/submit_batch.go @@ -1,6 +1,7 @@ package interchain import ( + "context" "fmt" "time" @@ -10,10 +11,11 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" + clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + tmclienttypes "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint/types" "github.com/dymensionxyz/cosmosclient/cosmosclient" "github.com/dymensionxyz/dymint/da" - "github.com/dymensionxyz/dymint/da/interchain/ioutils" "github.com/dymensionxyz/dymint/types" interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" ) @@ -22,7 +24,7 @@ func (c *DALayerClient) SubmitBatch(*types.Batch) da.ResultSubmitBatch { panic("SubmitBatch method is not supported by the interchain DA clint") } -func (c *DALayerClient) SubmitBatchV2(batch *types.Batch) da.ResultSubmitBatchV2 { +func (c *DALayerClient) SubmitBatchV2(batch types.Batch) da.ResultSubmitBatchV2 { commitment, err := c.submitBatch(batch) if err != nil { return da.ResultSubmitBatchV2{ @@ -62,17 +64,10 @@ func (c *DALayerClient) SubmitBatchV2(batch *types.Batch) da.ResultSubmitBatchV2 } // submitBatch is used to process and transmit batches to the interchain DA. -func (c *DALayerClient) submitBatch(batch *types.Batch) (*interchainda.Commitment, error) { - // Prepare the blob data - blob, err := batch.MarshalBinary() +func (c *DALayerClient) submitBatch(batch types.Batch) (*interchainda.Commitment, error) { + blob, err := EncodeBatch(batch) if err != nil { - return nil, fmt.Errorf("can't marshal batch: %w", err) - } - - // Gzip the blob - gzipped, err := ioutils.Gzip(blob) - if err != nil { - return nil, fmt.Errorf("can't gzip batch: %w", err) + return nil, fmt.Errorf("can't encode batch to interchain DA format: %w", err) } // Verify the size of the blob is within the limit @@ -86,7 +81,7 @@ func (c *DALayerClient) submitBatch(batch *types.Batch) (*interchainda.Commitmen // Prepare the message to be sent to the DA layer msg := interchainda.MsgSubmitBlob{ Creator: c.accountAddress, - Blob: gzipped, + Blob: blob, Fees: feesToPay, } @@ -159,6 +154,22 @@ func (c *DALayerClient) broadcastTx(msgs ...sdk.Msg) (cosmosclient.Response, err return txResp, nil } +func (c *DALayerClient) updateHubState(ctx context.Context, blobHeight uint64) error { + daBlock, err := c.daClient.LightBlock(ctx, blobHeight) + if err != nil { + return fmt.Errorf("can't get light block %d from DA layer: %w", blobHeight, err) + } + + tmclienttypes.Header{ + SignedHeader: nil, + ValidatorSet: daBlock.ValidatorSet, + TrustedHeight: clienttypes.Height{}, + TrustedValidators: nil, + } + + clienttypes.NewMsgUpdateClient(c.daConfig.ClientID, daBlock.Header, c.accountAddress) +} + // runWithRetry runs the given operation with retry, doing a number of attempts, and taking the last error only. func (c *DALayerClient) runWithRetry(operation func() error) error { return retry.Do( diff --git a/da/local/local.go b/da/local/local.go index f4b99318b..65c63fc93 100644 --- a/da/local/local.go +++ b/da/local/local.go @@ -23,7 +23,10 @@ type DataAvailabilityLayerClient struct { synced chan struct{} } -const defaultBlockTime = 3 * time.Second +const ( + defaultBlockTime = 3 * time.Second + maxBlobSize = 2097152 // 2MB (equivalent to avail or celestia) +) type config struct { BlockTime time.Duration @@ -89,14 +92,14 @@ func (m *DataAvailabilityLayerClient) GetClientType() da.Client { func (m *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultSubmitBatch { daHeight := m.daHeight.Load() - m.logger.Debug("Submitting batch to DA layer", "start height", batch.StartHeight, "end height", batch.EndHeight, "da height", daHeight) + m.logger.Debug("Submitting batch to DA layer", "start height", batch.StartHeight(), "end height", batch.EndHeight(), "da height", daHeight) blob, err := batch.MarshalBinary() if err != nil { return da.ResultSubmitBatch{BaseResult: da.BaseResult{Code: da.StatusError, Message: err.Error(), Error: err}} } - hash := sha1.Sum(uint64ToBinary(batch.EndHeight)) //#nosec - err = m.dalcKV.Set(getKey(daHeight, batch.StartHeight), hash[:]) + hash := sha1.Sum(uint64ToBinary(batch.EndHeight())) //#nosec + err = m.dalcKV.Set(getKey(daHeight, batch.StartHeight()), hash[:]) if err != nil { return da.ResultSubmitBatch{BaseResult: da.BaseResult{Code: da.StatusError, Message: err.Error(), Error: err}} } @@ -173,3 +176,8 @@ func (m *DataAvailabilityLayerClient) updateDAHeight() { blockStep := rand.Uint64()%10 + 1 //#nosec m.daHeight.Add(blockStep) } + +// GetMaxBlobSizeBytes returns the maximum allowed blob size in the DA, used to check the max batch size configured +func (d *DataAvailabilityLayerClient) GetMaxBlobSizeBytes() uint32 { + return maxBlobSize +} diff --git a/go.mod b/go.mod index 5c2a8207c..020ae9ee4 100644 --- a/go.mod +++ b/go.mod @@ -3,18 +3,17 @@ module github.com/dymensionxyz/dymint go 1.22.4 require ( - code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40 cosmossdk.io/collections v0.4.0 cosmossdk.io/errors v1.0.1 github.com/avast/retry-go/v4 v4.5.0 - github.com/celestiaorg/celestia-openrpc v0.4.0-rc.1 + github.com/celestiaorg/celestia-openrpc v0.4.1-0.20240828130104-089b92870cb6 github.com/celestiaorg/go-cnc v0.4.2 github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.12 github.com/cosmos/cosmos-sdk v0.46.16 github.com/dgraph-io/badger/v3 v3.2103.3 - github.com/dymensionxyz/cosmosclient v0.4.2-beta + github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13 github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56 - github.com/dymensionxyz/gerr-cosmos v0.1.2 + github.com/dymensionxyz/gerr-cosmos v1.0.0 github.com/go-kit/kit v0.12.0 github.com/gofrs/uuid v4.3.0+incompatible github.com/gogo/protobuf v1.3.3 @@ -23,12 +22,13 @@ require ( github.com/gorilla/mux v1.8.1 github.com/gorilla/rpc v1.2.0 github.com/gorilla/websocket v1.5.1 - github.com/hashicorp/go-multierror v1.1.1 github.com/ignite/cli v0.26.1 github.com/informalsystems/tm-load-test v1.3.0 + github.com/ipfs/boxo v0.18.0 github.com/libp2p/go-libp2p v0.33.1 github.com/libp2p/go-libp2p-kad-dht v0.25.2 - github.com/libp2p/go-libp2p-pubsub v0.9.3 + github.com/libp2p/go-libp2p-pubsub v0.10.1 + github.com/libp2p/go-libp2p-routing-helpers v0.7.3 github.com/multiformats/go-multiaddr v0.12.2 github.com/prometheus/client_golang v1.18.0 github.com/rs/cors v1.9.0 @@ -38,11 +38,27 @@ require ( github.com/tendermint/tendermint v0.34.29 go.uber.org/multierr v1.11.0 golang.org/x/net v0.24.0 - gonum.org/v1/gonum v0.13.0 + gonum.org/v1/gonum v0.14.0 google.golang.org/grpc v1.64.0 google.golang.org/protobuf v1.33.0 ) +require ( + cloud.google.com/go v0.112.1 // indirect + cloud.google.com/go/storage v1.38.0 // indirect + cosmossdk.io/api v0.7.0 // indirect + cosmossdk.io/core v0.10.0 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + github.com/celestiaorg/go-square v1.0.1 // indirect + github.com/celestiaorg/go-square/merkle v0.0.0-20240429192549-dea967e1533b // indirect + github.com/cosmos/cosmos-db v1.0.0 // indirect + github.com/cskr/pubsub v1.0.2 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/ipfs/go-block-format v0.2.0 // indirect + google.golang.org/api v0.169.0 // indirect +) + require ( filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -59,27 +75,27 @@ require ( github.com/celestiaorg/go-fraud v0.2.0 // indirect github.com/celestiaorg/go-header v0.4.1 // indirect github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect - github.com/celestiaorg/nmt v0.20.0 + github.com/celestiaorg/nmt v0.21.0 github.com/celestiaorg/rsmt2d v0.11.0 // indirect github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.11.0 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.3 - github.com/cosmos/gogoproto v1.4.11 // indirect + github.com/cosmos/gogoproto v1.5.0 github.com/creachadair/taskgroup v0.3.2 // indirect github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/base58 v1.0.4 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/ethereum/go-ethereum v1.12.0 // indirect - github.com/filecoin-project/go-jsonrpc v0.3.1 // indirect + github.com/filecoin-project/go-jsonrpc v0.5.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/klauspost/reedsolomon v1.11.8 // indirect github.com/lib/pq v1.10.7 // indirect @@ -93,21 +109,21 @@ require ( github.com/satori/go.uuid v1.2.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/tidwall/btree v1.5.0 // indirect - github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/gjson v1.17.1 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/vedhavyas/go-subkey v1.0.3 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/dig v1.17.1 // indirect go.uber.org/fx v1.20.1 // indirect golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect sigs.k8s.io/yaml v1.4.0 // indirect @@ -125,47 +141,47 @@ require ( github.com/cosmos/iavl v0.19.6 // indirect github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/elastic/gosigar v0.14.2 // indirect github.com/flynn/noise v1.1.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/protobuf v1.5.4 github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/gopacket v1.1.19 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/ipfs/go-cid v0.4.1 // indirect - github.com/ipfs/go-datastore v0.6.0 // indirect + github.com/ipfs/go-cid v0.4.1 + github.com/ipfs/go-datastore v0.6.0 github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/ipld/go-ipld-prime v0.20.0 // indirect + github.com/ipld/go-ipld-prime v0.21.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect @@ -200,7 +216,7 @@ require ( github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect - github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multihash v0.2.3 github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/opencontainers/runtime-spec v1.2.0 // indirect @@ -208,7 +224,7 @@ require ( github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.0.7 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polydawn/refmt v0.89.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect @@ -232,24 +248,21 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.22.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/sync v0.6.0 // indirect + golang.org/x/sync v0.6.0 golang.org/x/sys v0.19.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect + google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect ) require ( - cosmossdk.io/api v0.7.0 // indirect - cosmossdk.io/core v0.10.0 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/math v1.3.0 // indirect github.com/DataDog/zstd v1.5.5 // indirect - github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect + github.com/Jorropo/jsync v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect @@ -258,35 +271,42 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cosmos/cosmos-db v1.0.0 // indirect - github.com/cosmos/ibc-go/v6 v6.2.1 // indirect - github.com/danwt/gerr v0.1.5 // indirect - github.com/decred/dcrd/dcrec/edwards v1.0.0 // indirect + github.com/cosmos/ibc-go/v6 v6.2.1 + github.com/danwt/gerr v1.0.0 // indirect github.com/evmos/evmos/v12 v12.1.6 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect github.com/holiman/uint256 v1.2.2 // indirect - github.com/ipfs/boxo v0.10.0 // indirect + github.com/ipfs/bbloom v0.0.4 // indirect + github.com/ipfs/go-ds-leveldb v0.5.0 + github.com/ipfs/go-ipfs-delay v0.0.1 // indirect + github.com/ipfs/go-ipfs-pq v0.0.3 // indirect + github.com/ipfs/go-ipfs-util v0.0.3 // indirect + github.com/ipfs/go-ipld-format v0.6.0 + github.com/ipfs/go-ipld-legacy v0.2.1 // indirect + github.com/ipfs/go-metrics-interface v0.0.1 // indirect + github.com/ipfs/go-peertaskqueue v0.8.1 // indirect + github.com/ipld/go-codec-dagpb v1.6.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/libp2p/go-libp2p-routing-helpers v0.7.2 // indirect github.com/linxGnu/grocksdb v1.8.12 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect go.uber.org/mock v0.4.0 // indirect golang.org/x/tools v0.18.0 // indirect + pgregory.net/rapid v1.1.0 ) replace ( github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/availproject/go-substrate-rpc-client/v4 v4.0.12-avail-1.4.0-rc1-5e286e3 + github.com/dymensionxyz/dymension-rdk => github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240827102903-08636e7ab3f8 github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4 github.com/gorilla/rpc => github.com/dymensionxyz/rpc v1.3.1 - github.com/libp2p/go-libp2p-pubsub => github.com/dymensionxyz/go-libp2p-pubsub v0.0.0-20240513081713-3ecd83c19ea2 - github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.28 - + github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20240906143736-1e3959c2826e ) replace github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.0-dymension-v1.1.2 diff --git a/go.sum b/go.sum index 317732f9e..ac2a83af2 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= -cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= +cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= +cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -33,8 +33,8 @@ cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGB cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= -cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -45,10 +45,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= -code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40 h1:wzkYwwcf4uMGcDpn48WAbq8GtoqDny49tdQ4zJVAsmo= -code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40/go.mod h1:Nx9ASXN4nIlRDEXv+qXE3dpuhnTnO28Lxl/bMUd6BMc= +cloud.google.com/go/storage v1.38.0 h1:Az68ZRGlnNTpIBbLjSMIV2BDcwwXYlRlQzis0llkpJg= +cloud.google.com/go/storage v1.38.0/go.mod h1:tlUADB0mAb9BgYls9lq+8MGkfzOXuLrnHXlpHmvFJoY= cosmossdk.io/api v0.7.0 h1:QsEMIWuv9xWDbF2HZnW4Lpu1/SejCztPu0LQx7t6MN4= cosmossdk.io/api v0.7.0/go.mod h1:kJFAEMLN57y0viszHDPLMmieF0471o5QAwwApa+270M= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= @@ -82,6 +80,8 @@ github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Jorropo/jsync v1.0.1 h1:6HgRolFZnsdfzRUj+ImB9og1JYOxQoReSywkHOGSaUU= +github.com/Jorropo/jsync v1.0.1/go.mod h1:jCOZj3vrBCri3bSU3ErUYvevKlnbssrXeCivybS5ABQ= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= @@ -99,8 +99,6 @@ github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI= -github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -159,18 +157,22 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/celestiaorg/celestia-openrpc v0.4.0-rc.1 h1:CLhcfNP4496pg0aptcgHJubNXoY97PMHF0sDWx4HRrg= -github.com/celestiaorg/celestia-openrpc v0.4.0-rc.1/go.mod h1:+2xwD+PBy76D2XOAwDbkuNVUSAvwUFV54cQqMFBA1s0= +github.com/celestiaorg/celestia-openrpc v0.4.1-0.20240828130104-089b92870cb6 h1:CL3ESQnOsFnErzKCMMhi9m/zmerrKTZM03ZT8zEdjuA= +github.com/celestiaorg/celestia-openrpc v0.4.1-0.20240828130104-089b92870cb6/go.mod h1:I0b//K7q/RP1g6gtnQ1xi//ocGwrql4gcQeJEOhDifw= github.com/celestiaorg/go-cnc v0.4.2 h1:7ixf3tevMB7Lvz2mbyRG0ZOK+8qoPm7wNhdgpi8VreU= github.com/celestiaorg/go-cnc v0.4.2/go.mod h1:zYzvHudSd1iNPuHBMyvZ1YvWou5aT9JXgtch9Tkaf70= github.com/celestiaorg/go-fraud v0.2.0 h1:aaq2JiW0gTnhEdac3l51UCqSyJ4+VjFGTTpN83V4q7I= github.com/celestiaorg/go-fraud v0.2.0/go.mod h1:lNY1i4K6kUeeE60Z2VK8WXd+qXb8KRzfBhvwPkK6aUc= github.com/celestiaorg/go-header v0.4.1 h1:bjbUcKDnhrJJ9EoE7vtPpgleNLVjc2S+cB4/qe8nQmo= github.com/celestiaorg/go-header v0.4.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= +github.com/celestiaorg/go-square v1.0.1 h1:LEG1zrw4i03VBMElQF8GAbKYgh1bT1uGzWxasU2ePuo= +github.com/celestiaorg/go-square v1.0.1/go.mod h1:XMv5SGCeGSkynW2OOsedugaW/rQlvzxGzWGxTKsyYOU= +github.com/celestiaorg/go-square/merkle v0.0.0-20240429192549-dea967e1533b h1:jo6M4RJnr33sQC/TTraP5gA6ZgbFO/QqzX8e/lIQC7Q= +github.com/celestiaorg/go-square/merkle v0.0.0-20240429192549-dea967e1533b/go.mod h1:86qIYnEhmn/hfW+xvw98NOI3zGaDEB3x8JGjYo2FqLs= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= -github.com/celestiaorg/nmt v0.20.0 h1:9i7ultZ8Wv5ytt8ZRaxKQ5KOOMo4A2K2T/aPGjIlSas= -github.com/celestiaorg/nmt v0.20.0/go.mod h1:Oz15Ub6YPez9uJV0heoU4WpFctxazuIhKyUtaYNio7E= +github.com/celestiaorg/nmt v0.21.0 h1:81MBqxNn3orByoiCtdNVjwi5WsLgMkzHwP02ZMhTBHM= +github.com/celestiaorg/nmt v0.21.0/go.mod h1:ia/EpCk0enD5yO5frcxoNoFToz2Ghtk2i+blmCRjIY8= github.com/celestiaorg/rsmt2d v0.11.0 h1:lcto/637WyTEZR3dLRoNvyuExfnUbxvdvKi3qz/2V4k= github.com/celestiaorg/rsmt2d v0.11.0/go.mod h1:6Y580I3gVr0+OVFfW6m2JTwnCCmvW3WfbwSLfuT+HCA= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -211,8 +213,6 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAK github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft v0.34.28 h1:gwryf55P1SWMUP4nOXpRVI2D0yPoYEzN+IBqmRBOsDc= -github.com/cometbft/cometbft v0.34.28/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw= github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.11.0 h1:M3Lscmpogx5NTbb1EGyGDaFRdsoLWrUWimFEyf7jej8= @@ -222,8 +222,8 @@ github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= -github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= -github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -242,8 +242,8 @@ github.com/cosmos/cosmos-sdk v0.46.16/go.mod h1:05U50tAsOzQ8JOAePshJCbJQw5ib1YJR github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= -github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= +github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU= @@ -259,14 +259,17 @@ github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= +github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/danwt/gerr v0.1.5 h1:5s3G3cnftZG7Rq0+k+taMVteTmwKU66/g47kH6hY1js= -github.com/danwt/gerr v0.1.5/go.mod h1:tIj6P8ZPBLAbr64HdWqKHGUXbWJT6HenD08Fn98oAnE= +github.com/danwt/gerr v1.0.0 h1:v3Do0h1r+uctQQVYJfOTCo8uigp8oIaY4OL/wUU8LzI= +github.com/danwt/gerr v1.0.0/go.mod h1:tIj6P8ZPBLAbr64HdWqKHGUXbWJT6HenD08Fn98oAnE= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= @@ -278,8 +281,6 @@ github.com/decred/base58 v1.0.4/go.mod h1:jJswKPEdvpFpvf7dsDvFZyLT22xZ9lWqEByX38 github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/edwards v1.0.0 h1:UDcPNzclKiJlWqV3x1Fl8xMCJrolo4PB4X9t8LwKDWU= -github.com/decred/dcrd/dcrec/edwards v1.0.0/go.mod h1:HblVh1OfMt7xSxUL1ufjToaEvpbjpWvvTAUx4yem8BI= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= @@ -298,10 +299,10 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= -github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/cli v23.0.1+incompatible h1:LRyWITpGzl2C9e9uGxzisptnxAn1zfZKXy13Ul2Q5oM= +github.com/docker/cli v23.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY= +github.com/docker/docker v23.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -310,20 +311,20 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7 h1:kgvzE5wLsLa7XKfV85VZl40QXaMCaeFtHpPwJ8fhotY= github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac h1:opbrjaN/L8gg6Xh5D04Tem+8xVcz6ajZlGCs49mQgyg= -github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/dymensionxyz/cosmosclient v0.4.2-beta h1:sokBefcN1tIOlUKmB8Q2E9XMJ93LueqtFThiM/kA4DI= -github.com/dymensionxyz/cosmosclient v0.4.2-beta/go.mod h1:GQQu3ITEjWfi5ULR2B6X2i2YZNennY1yzcT5qdL4MGI= +github.com/dymensionxyz/cometbft v0.34.29-0.20240906143736-1e3959c2826e h1:A5FIvuFPvdxShuf9mSHfDUEL7I/oKVcSr1AtSlmgskA= +github.com/dymensionxyz/cometbft v0.34.29-0.20240906143736-1e3959c2826e/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw= +github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13 h1:u5yeve5jZR6TdRjjR+vYT/8PWKbhwCZxUmAu+/Tnxyg= +github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13/go.mod h1:jabDQYXrccscSE0fXkh7eQFYPWJCRiuWKonFGObVq6s= github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56 h1:cmpJYdRviuUfmlJdHrcAND8Jd6JIY4rp63bWAQzPr54= github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56/go.mod h1:3Pfrr8j/BR9ztNKztGfC5PqDiO6CcrzMLCJtFtPEVW4= github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3 h1:vmAdUGUc4rTIiO3Phezr7vGq+0uPDVKSA4WAe8+yl6w= github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3/go.mod h1:LfPv2O1HXMgETpka81Pg3nXy+U/7urq8dn85ZnSXK5Y= -github.com/dymensionxyz/gerr-cosmos v0.1.2 h1:4NiB9psF6swnWTCDYnHgHKtVEaRHuuNRuqvPGDw1BI8= -github.com/dymensionxyz/gerr-cosmos v0.1.2/go.mod h1:tXIhx3WdryAnYRISC3Weh+2xeXwaf1l4Yb1zjDUsT7k= -github.com/dymensionxyz/go-libp2p-pubsub v0.0.0-20240513081713-3ecd83c19ea2 h1:5FMEOpX5OuoRfwwjjA+LxRJXoDT0fFvg8/rlat7z8bE= -github.com/dymensionxyz/go-libp2p-pubsub v0.0.0-20240513081713-3ecd83c19ea2/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw= +github.com/dymensionxyz/gerr-cosmos v1.0.0 h1:oi91rgOkpJWr41oX9JOyjvvBnhGY54tj513x8VlDAEc= +github.com/dymensionxyz/gerr-cosmos v1.0.0/go.mod h1:n+0olxPogzWqFKba45mCpvrHLGmeS8W9UZjggHnWk6c= github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs= github.com/dymensionxyz/rpc v1.3.1/go.mod h1:f+WpX8ysy8wt95iGc6auYlHcnHj2bUkhiRVkkKNys8c= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= @@ -343,10 +344,10 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/filecoin-project/go-jsonrpc v0.3.1 h1:qwvAUc5VwAkooquKJmfz9R2+F8znhiqcNHYjEp/NM10= -github.com/filecoin-project/go-jsonrpc v0.3.1/go.mod h1:jBSvPTl8V1N7gSTuCR4bis8wnQnIjHbRPpROol6iQKM= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/filecoin-project/go-jsonrpc v0.5.0 h1:6PZghgMaM9wSjlhxkDD+YgZ+oucBUIkJOfVc7SdQBTE= +github.com/filecoin-project/go-jsonrpc v0.5.0/go.mod h1:/n/niXcS4ZQua6i37LcVbY1TmlJR0UIK9mDFQq2ICek= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= @@ -354,8 +355,8 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= @@ -382,11 +383,11 @@ github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -451,6 +452,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= @@ -507,6 +509,7 @@ github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -517,8 +520,8 @@ github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= +github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= @@ -565,10 +568,10 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4= -github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= @@ -584,8 +587,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ignite/cli v0.26.1 h1:T4qMjM9H38JOBsgCruilGcsfrlDGHO2K1V88gIe0ubs= github.com/ignite/cli v0.26.1/go.mod h1:0BQcJCseK0O5RG8HYP/lvVTFbZQjkw+AY8B+wDklj38= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -593,23 +596,47 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/informalsystems/tm-load-test v1.3.0 h1:FGjKy7vBw6mXNakt+wmNWKggQZRsKkEYpaFk/zR64VA= github.com/informalsystems/tm-load-test v1.3.0/go.mod h1:OQ5AQ9TbT5hKWBNIwsMjn6Bf4O0U4b1kRc+0qZlQJKw= -github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= -github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= +github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= +github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= +github.com/ipfs/boxo v0.18.0 h1:MOL9/AgoV3e7jlVMInicaSdbgralfqSsbkc31dZ9tmw= +github.com/ipfs/boxo v0.18.0/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80= +github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= +github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= +github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= -github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= +github.com/ipfs/go-ds-leveldb v0.5.0 h1:s++MEBbD3ZKc9/8/njrn4flZLnCuY9I79v94gBUNumo= +github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q= +github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= +github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= +github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= +github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= +github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= +github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= +github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4= +github.com/ipfs/go-ipfs-util v0.0.3 h1:2RFdGez6bu2ZlZdI+rWfIdbQb1KudQp3VGwPtdNCmE0= +github.com/ipfs/go-ipfs-util v0.0.3/go.mod h1:LHzG1a0Ig4G+iZ26UUOMjHd+lfM84LZCrn17xAKWBvs= +github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U= +github.com/ipfs/go-ipld-format v0.6.0/go.mod h1:g4QVMTn3marU3qXchwjpKPKgJv+zF+OlaKMyhJ4LHPg= +github.com/ipfs/go-ipld-legacy v0.2.1 h1:mDFtrBpmU7b//LzLSypVrXsD8QxkEWxu5qVxN99/+tk= +github.com/ipfs/go-ipld-legacy v0.2.1/go.mod h1:782MOUghNzMO2DER0FlBR94mllfdCJCkTtDtPM51otM= github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= -github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= -github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= +github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= +github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= +github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg= +github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU= +github.com/ipld/go-codec-dagpb v1.6.0 h1:9nYazfyu9B1p3NAgfVdpRco3Fs2nFC72DqVsMj6rOcc= +github.com/ipld/go-codec-dagpb v1.6.0/go.mod h1:ANzFhfP2uMJxRBr8CE+WQWs5UsNa0pYtmKZ+agnUw9s= +github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E= +github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= @@ -648,6 +675,7 @@ github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoK github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -674,10 +702,12 @@ github.com/libp2p/go-libp2p-kad-dht v0.25.2 h1:FOIk9gHoe4YRWXTu8SY9Z1d0RILol0Trt github.com/libp2p/go-libp2p-kad-dht v0.25.2/go.mod h1:6za56ncRHYXX4Nc2vn8z7CZK0P4QiMcrn77acKLM2Oo= github.com/libp2p/go-libp2p-kbucket v0.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0= github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0= +github.com/libp2p/go-libp2p-pubsub v0.10.1 h1:/RqOZpEtAolsr8/9CC8KqROJSOZeu7lK7fPftn4MwNg= +github.com/libp2p/go-libp2p-pubsub v0.10.1/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw= github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= -github.com/libp2p/go-libp2p-routing-helpers v0.7.2 h1:xJMFyhQ3Iuqnk9Q2dYE1eUTzsah7NLw3Qs2zjUV78T0= -github.com/libp2p/go-libp2p-routing-helpers v0.7.2/go.mod h1:cN4mJAD/7zfPKXBcs9ze31JGYAZgzdABEm+q/hkswb8= +github.com/libp2p/go-libp2p-routing-helpers v0.7.3 h1:u1LGzAMVRK9Nqq5aYDVOiq/HaB93U9WWczBzGyAC5ZY= +github.com/libp2p/go-libp2p-routing-helpers v0.7.3/go.mod h1:cN4mJAD/7zfPKXBcs9ze31JGYAZgzdABEm+q/hkswb8= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= @@ -735,8 +765,8 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -801,8 +831,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= -github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= +github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -835,8 +865,9 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -883,8 +914,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= @@ -976,6 +1007,7 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= @@ -987,8 +1019,8 @@ github.com/tendermint/tm-db v0.6.8-0.20220506192307-f628bb5dc95b/go.mod h1:ADqbS github.com/tidwall/btree v1.5.0 h1:iV0yVY/frd7r6qGBXfEYs7DH0gTDgrKTrDjS7xt/IyQ= github.com/tidwall/btree v1.5.0/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYmsObdKE= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= -github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= @@ -1014,8 +1046,12 @@ github.com/vedhavyas/go-subkey v1.0.3 h1:iKR33BB/akKmcR2PMlXPBeeODjWLM90EL98OrOG github.com/vedhavyas/go-subkey v1.0.3/go.mod h1:CloUaFQSSTdWnINfBRFjVMkWXZANW+nd8+TI5jYcl6Y= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= +github.com/warpfork/go-testmark v0.12.1 h1:rMgCpJfwy1sJ50x0M0NgyphxYYPMOODIJHhsXyEHU0s= +github.com/warpfork/go-testmark v0.12.1/go.mod h1:kHwy7wfvGSPh1rQJYKayD4AbtNaeyZdcGi9tNJTaa5Y= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= +github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= +github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= @@ -1050,12 +1086,16 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -1371,10 +1411,10 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= @@ -1397,8 +1437,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= -google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= +google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= +google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1453,8 +1493,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg= -google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= +google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= +google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= diff --git a/mocks/github.com/dymensionxyz/dymension/v3/x/rollapp/types/mock_QueryClient.go b/mocks/github.com/dymensionxyz/dymension/v3/x/rollapp/types/mock_QueryClient.go index 34778c1f1..8c6d0ed78 100644 --- a/mocks/github.com/dymensionxyz/dymension/v3/x/rollapp/types/mock_QueryClient.go +++ b/mocks/github.com/dymensionxyz/dymension/v3/x/rollapp/types/mock_QueryClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package types @@ -9,7 +9,7 @@ import ( mock "github.com/stretchr/testify/mock" - types "github.com/dymensionxyz/dymension/v3/x/rollapp/types" + types "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" ) // MockQueryClient is an autogenerated mock type for the QueryClient type @@ -25,6 +25,80 @@ func (_m *MockQueryClient) EXPECT() *MockQueryClient_Expecter { return &MockQueryClient_Expecter{mock: &_m.Mock} } +// LatestHeight provides a mock function with given fields: ctx, in, opts +func (_m *MockQueryClient) LatestHeight(ctx context.Context, in *types.QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*types.QueryGetLatestHeightResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for LatestHeight") + } + + var r0 *types.QueryGetLatestHeightResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetLatestHeightRequest, ...grpc.CallOption) (*types.QueryGetLatestHeightResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetLatestHeightRequest, ...grpc.CallOption) *types.QueryGetLatestHeightResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.QueryGetLatestHeightResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryGetLatestHeightRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryClient_LatestHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestHeight' +type MockQueryClient_LatestHeight_Call struct { + *mock.Call +} + +// LatestHeight is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryGetLatestHeightRequest +// - opts ...grpc.CallOption +func (_e *MockQueryClient_Expecter) LatestHeight(ctx interface{}, in interface{}, opts ...interface{}) *MockQueryClient_LatestHeight_Call { + return &MockQueryClient_LatestHeight_Call{Call: _e.mock.On("LatestHeight", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockQueryClient_LatestHeight_Call) Run(run func(ctx context.Context, in *types.QueryGetLatestHeightRequest, opts ...grpc.CallOption)) *MockQueryClient_LatestHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryGetLatestHeightRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockQueryClient_LatestHeight_Call) Return(_a0 *types.QueryGetLatestHeightResponse, _a1 error) *MockQueryClient_LatestHeight_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryClient_LatestHeight_Call) RunAndReturn(run func(context.Context, *types.QueryGetLatestHeightRequest, ...grpc.CallOption) (*types.QueryGetLatestHeightResponse, error)) *MockQueryClient_LatestHeight_Call { + _c.Call.Return(run) + return _c +} + // LatestStateIndex provides a mock function with given fields: ctx, in, opts func (_m *MockQueryClient) LatestStateIndex(ctx context.Context, in *types.QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*types.QueryGetLatestStateIndexResponse, error) { _va := make([]interface{}, len(opts)) @@ -469,80 +543,6 @@ func (_c *MockQueryClient_StateInfo_Call) RunAndReturn(run func(context.Context, return _c } -// StateInfoAll provides a mock function with given fields: ctx, in, opts -func (_m *MockQueryClient) StateInfoAll(ctx context.Context, in *types.QueryAllStateInfoRequest, opts ...grpc.CallOption) (*types.QueryAllStateInfoResponse, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, in) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for StateInfoAll") - } - - var r0 *types.QueryAllStateInfoResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryAllStateInfoRequest, ...grpc.CallOption) (*types.QueryAllStateInfoResponse, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryAllStateInfoRequest, ...grpc.CallOption) *types.QueryAllStateInfoResponse); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.QueryAllStateInfoResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryAllStateInfoRequest, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockQueryClient_StateInfoAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StateInfoAll' -type MockQueryClient_StateInfoAll_Call struct { - *mock.Call -} - -// StateInfoAll is a helper method to define mock.On call -// - ctx context.Context -// - in *types.QueryAllStateInfoRequest -// - opts ...grpc.CallOption -func (_e *MockQueryClient_Expecter) StateInfoAll(ctx interface{}, in interface{}, opts ...interface{}) *MockQueryClient_StateInfoAll_Call { - return &MockQueryClient_StateInfoAll_Call{Call: _e.mock.On("StateInfoAll", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *MockQueryClient_StateInfoAll_Call) Run(run func(ctx context.Context, in *types.QueryAllStateInfoRequest, opts ...grpc.CallOption)) *MockQueryClient_StateInfoAll_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*types.QueryAllStateInfoRequest), variadicArgs...) - }) - return _c -} - -func (_c *MockQueryClient_StateInfoAll_Call) Return(_a0 *types.QueryAllStateInfoResponse, _a1 error) *MockQueryClient_StateInfoAll_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockQueryClient_StateInfoAll_Call) RunAndReturn(run func(context.Context, *types.QueryAllStateInfoRequest, ...grpc.CallOption) (*types.QueryAllStateInfoResponse, error)) *MockQueryClient_StateInfoAll_Call { - _c.Call.Return(run) - return _c -} - // NewMockQueryClient creates a new instance of MockQueryClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockQueryClient(t interface { diff --git a/mocks/github.com/dymensionxyz/dymension/v3/x/sequencer/types/mock_QueryClient.go b/mocks/github.com/dymensionxyz/dymension/v3/x/sequencer/types/mock_QueryClient.go index c130f0bdd..fed52c6c5 100644 --- a/mocks/github.com/dymensionxyz/dymension/v3/x/sequencer/types/mock_QueryClient.go +++ b/mocks/github.com/dymensionxyz/dymension/v3/x/sequencer/types/mock_QueryClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package types @@ -9,7 +9,7 @@ import ( mock "github.com/stretchr/testify/mock" - types "github.com/dymensionxyz/dymension/v3/x/sequencer/types" + types "github.com/dymensionxyz/dymint/third_party/dymension/sequencer/types" ) // MockQueryClient is an autogenerated mock type for the QueryClient type @@ -25,6 +25,154 @@ func (_m *MockQueryClient) EXPECT() *MockQueryClient_Expecter { return &MockQueryClient_Expecter{mock: &_m.Mock} } +// GetNextProposerByRollapp provides a mock function with given fields: ctx, in, opts +func (_m *MockQueryClient) GetNextProposerByRollapp(ctx context.Context, in *types.QueryGetNextProposerByRollappRequest, opts ...grpc.CallOption) (*types.QueryGetNextProposerByRollappResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetNextProposerByRollapp") + } + + var r0 *types.QueryGetNextProposerByRollappResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetNextProposerByRollappRequest, ...grpc.CallOption) (*types.QueryGetNextProposerByRollappResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetNextProposerByRollappRequest, ...grpc.CallOption) *types.QueryGetNextProposerByRollappResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.QueryGetNextProposerByRollappResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryGetNextProposerByRollappRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryClient_GetNextProposerByRollapp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNextProposerByRollapp' +type MockQueryClient_GetNextProposerByRollapp_Call struct { + *mock.Call +} + +// GetNextProposerByRollapp is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryGetNextProposerByRollappRequest +// - opts ...grpc.CallOption +func (_e *MockQueryClient_Expecter) GetNextProposerByRollapp(ctx interface{}, in interface{}, opts ...interface{}) *MockQueryClient_GetNextProposerByRollapp_Call { + return &MockQueryClient_GetNextProposerByRollapp_Call{Call: _e.mock.On("GetNextProposerByRollapp", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockQueryClient_GetNextProposerByRollapp_Call) Run(run func(ctx context.Context, in *types.QueryGetNextProposerByRollappRequest, opts ...grpc.CallOption)) *MockQueryClient_GetNextProposerByRollapp_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryGetNextProposerByRollappRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockQueryClient_GetNextProposerByRollapp_Call) Return(_a0 *types.QueryGetNextProposerByRollappResponse, _a1 error) *MockQueryClient_GetNextProposerByRollapp_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryClient_GetNextProposerByRollapp_Call) RunAndReturn(run func(context.Context, *types.QueryGetNextProposerByRollappRequest, ...grpc.CallOption) (*types.QueryGetNextProposerByRollappResponse, error)) *MockQueryClient_GetNextProposerByRollapp_Call { + _c.Call.Return(run) + return _c +} + +// GetProposerByRollapp provides a mock function with given fields: ctx, in, opts +func (_m *MockQueryClient) GetProposerByRollapp(ctx context.Context, in *types.QueryGetProposerByRollappRequest, opts ...grpc.CallOption) (*types.QueryGetProposerByRollappResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetProposerByRollapp") + } + + var r0 *types.QueryGetProposerByRollappResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetProposerByRollappRequest, ...grpc.CallOption) (*types.QueryGetProposerByRollappResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetProposerByRollappRequest, ...grpc.CallOption) *types.QueryGetProposerByRollappResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.QueryGetProposerByRollappResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryGetProposerByRollappRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryClient_GetProposerByRollapp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProposerByRollapp' +type MockQueryClient_GetProposerByRollapp_Call struct { + *mock.Call +} + +// GetProposerByRollapp is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryGetProposerByRollappRequest +// - opts ...grpc.CallOption +func (_e *MockQueryClient_Expecter) GetProposerByRollapp(ctx interface{}, in interface{}, opts ...interface{}) *MockQueryClient_GetProposerByRollapp_Call { + return &MockQueryClient_GetProposerByRollapp_Call{Call: _e.mock.On("GetProposerByRollapp", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockQueryClient_GetProposerByRollapp_Call) Run(run func(ctx context.Context, in *types.QueryGetProposerByRollappRequest, opts ...grpc.CallOption)) *MockQueryClient_GetProposerByRollapp_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryGetProposerByRollappRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockQueryClient_GetProposerByRollapp_Call) Return(_a0 *types.QueryGetProposerByRollappResponse, _a1 error) *MockQueryClient_GetProposerByRollapp_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryClient_GetProposerByRollapp_Call) RunAndReturn(run func(context.Context, *types.QueryGetProposerByRollappRequest, ...grpc.CallOption) (*types.QueryGetProposerByRollappResponse, error)) *MockQueryClient_GetProposerByRollapp_Call { + _c.Call.Return(run) + return _c +} + // Params provides a mock function with given fields: ctx, in, opts func (_m *MockQueryClient) Params(ctx context.Context, in *types.QueryParamsRequest, opts ...grpc.CallOption) (*types.QueryParamsResponse, error) { _va := make([]interface{}, len(opts)) diff --git a/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go b/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go index b0dcef1df..6a52c1df8 100644 --- a/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go +++ b/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package avail diff --git a/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go b/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go index 435fabe8c..4935cc66a 100644 --- a/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go +++ b/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go @@ -1,13 +1,12 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package types import ( - client "github.com/celestiaorg/celestia-openrpc" - blob "github.com/celestiaorg/celestia-openrpc/types/blob" - context "context" + blob "github.com/celestiaorg/celestia-openrpc/types/blob" + header "github.com/celestiaorg/celestia-openrpc/types/header" mock "github.com/stretchr/testify/mock" @@ -329,9 +328,9 @@ func (_c *MockCelestiaRPCClient_Included_Call) RunAndReturn(run func(context.Con return _c } -// Submit provides a mock function with given fields: ctx, blobs, gasPrice -func (_m *MockCelestiaRPCClient) Submit(ctx context.Context, blobs []*blob.Blob, gasPrice client.GasPrice) (uint64, error) { - ret := _m.Called(ctx, blobs, gasPrice) +// Submit provides a mock function with given fields: ctx, blobs, options +func (_m *MockCelestiaRPCClient) Submit(ctx context.Context, blobs []*blob.Blob, options *blob.SubmitOptions) (uint64, error) { + ret := _m.Called(ctx, blobs, options) if len(ret) == 0 { panic("no return value specified for Submit") @@ -339,17 +338,17 @@ func (_m *MockCelestiaRPCClient) Submit(ctx context.Context, blobs []*blob.Blob, var r0 uint64 var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []*blob.Blob, client.GasPrice) (uint64, error)); ok { - return rf(ctx, blobs, gasPrice) + if rf, ok := ret.Get(0).(func(context.Context, []*blob.Blob, *blob.SubmitOptions) (uint64, error)); ok { + return rf(ctx, blobs, options) } - if rf, ok := ret.Get(0).(func(context.Context, []*blob.Blob, client.GasPrice) uint64); ok { - r0 = rf(ctx, blobs, gasPrice) + if rf, ok := ret.Get(0).(func(context.Context, []*blob.Blob, *blob.SubmitOptions) uint64); ok { + r0 = rf(ctx, blobs, options) } else { r0 = ret.Get(0).(uint64) } - if rf, ok := ret.Get(1).(func(context.Context, []*blob.Blob, client.GasPrice) error); ok { - r1 = rf(ctx, blobs, gasPrice) + if rf, ok := ret.Get(1).(func(context.Context, []*blob.Blob, *blob.SubmitOptions) error); ok { + r1 = rf(ctx, blobs, options) } else { r1 = ret.Error(1) } @@ -365,14 +364,14 @@ type MockCelestiaRPCClient_Submit_Call struct { // Submit is a helper method to define mock.On call // - ctx context.Context // - blobs []*blob.Blob -// - gasPrice client.GasPrice -func (_e *MockCelestiaRPCClient_Expecter) Submit(ctx interface{}, blobs interface{}, gasPrice interface{}) *MockCelestiaRPCClient_Submit_Call { - return &MockCelestiaRPCClient_Submit_Call{Call: _e.mock.On("Submit", ctx, blobs, gasPrice)} +// - options *blob.SubmitOptions +func (_e *MockCelestiaRPCClient_Expecter) Submit(ctx interface{}, blobs interface{}, options interface{}) *MockCelestiaRPCClient_Submit_Call { + return &MockCelestiaRPCClient_Submit_Call{Call: _e.mock.On("Submit", ctx, blobs, options)} } -func (_c *MockCelestiaRPCClient_Submit_Call) Run(run func(ctx context.Context, blobs []*blob.Blob, gasPrice client.GasPrice)) *MockCelestiaRPCClient_Submit_Call { +func (_c *MockCelestiaRPCClient_Submit_Call) Run(run func(ctx context.Context, blobs []*blob.Blob, options *blob.SubmitOptions)) *MockCelestiaRPCClient_Submit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]*blob.Blob), args[2].(client.GasPrice)) + run(args[0].(context.Context), args[1].([]*blob.Blob), args[2].(*blob.SubmitOptions)) }) return _c } @@ -382,7 +381,7 @@ func (_c *MockCelestiaRPCClient_Submit_Call) Return(_a0 uint64, _a1 error) *Mock return _c } -func (_c *MockCelestiaRPCClient_Submit_Call) RunAndReturn(run func(context.Context, []*blob.Blob, client.GasPrice) (uint64, error)) *MockCelestiaRPCClient_Submit_Call { +func (_c *MockCelestiaRPCClient_Submit_Call) RunAndReturn(run func(context.Context, []*blob.Blob, *blob.SubmitOptions) (uint64, error)) *MockCelestiaRPCClient_Submit_Call { _c.Call.Return(run) return _c } diff --git a/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go b/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go index 8f298f169..75727dd5e 100644 --- a/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go +++ b/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package da @@ -117,6 +117,51 @@ func (_c *MockDataAvailabilityLayerClient_GetClientType_Call) RunAndReturn(run f return _c } +// GetMaxBlobSizeBytes provides a mock function with given fields: +func (_m *MockDataAvailabilityLayerClient) GetMaxBlobSizeBytes() uint32 { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetMaxBlobSizeBytes") + } + + var r0 uint32 + if rf, ok := ret.Get(0).(func() uint32); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(uint32) + } + + return r0 +} + +// MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMaxBlobSizeBytes' +type MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call struct { + *mock.Call +} + +// GetMaxBlobSizeBytes is a helper method to define mock.On call +func (_e *MockDataAvailabilityLayerClient_Expecter) GetMaxBlobSizeBytes() *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call { + return &MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call{Call: _e.mock.On("GetMaxBlobSizeBytes")} +} + +func (_c *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call) Run(run func()) *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call) Return(_a0 uint32) *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call) RunAndReturn(run func() uint32) *MockDataAvailabilityLayerClient_GetMaxBlobSizeBytes_Call { + _c.Call.Return(run) + return _c +} + // Init provides a mock function with given fields: config, pubsubServer, kvStore, logger, options func (_m *MockDataAvailabilityLayerClient) Init(config []byte, pubsubServer *pubsub.Server, kvStore store.KV, logger types.Logger, options ...da.Option) error { _va := make([]interface{}, len(options)) diff --git a/mocks/github.com/dymensionxyz/dymint/p2p/mock_GetProposerI.go b/mocks/github.com/dymensionxyz/dymint/p2p/mock_GetProposerI.go new file mode 100644 index 000000000..22bf320ac --- /dev/null +++ b/mocks/github.com/dymensionxyz/dymint/p2p/mock_GetProposerI.go @@ -0,0 +1,82 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package p2p + +import ( + mock "github.com/stretchr/testify/mock" + crypto "github.com/tendermint/tendermint/crypto" +) + +// MockGetProposerI is an autogenerated mock type for the GetProposerI type +type MockGetProposerI struct { + mock.Mock +} + +type MockGetProposerI_Expecter struct { + mock *mock.Mock +} + +func (_m *MockGetProposerI) EXPECT() *MockGetProposerI_Expecter { + return &MockGetProposerI_Expecter{mock: &_m.Mock} +} + +// GetProposerPubKey provides a mock function with given fields: +func (_m *MockGetProposerI) GetProposerPubKey() crypto.PubKey { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetProposerPubKey") + } + + var r0 crypto.PubKey + if rf, ok := ret.Get(0).(func() crypto.PubKey); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(crypto.PubKey) + } + } + + return r0 +} + +// MockGetProposerI_GetProposerPubKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProposerPubKey' +type MockGetProposerI_GetProposerPubKey_Call struct { + *mock.Call +} + +// GetProposerPubKey is a helper method to define mock.On call +func (_e *MockGetProposerI_Expecter) GetProposerPubKey() *MockGetProposerI_GetProposerPubKey_Call { + return &MockGetProposerI_GetProposerPubKey_Call{Call: _e.mock.On("GetProposerPubKey")} +} + +func (_c *MockGetProposerI_GetProposerPubKey_Call) Run(run func()) *MockGetProposerI_GetProposerPubKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockGetProposerI_GetProposerPubKey_Call) Return(_a0 crypto.PubKey) *MockGetProposerI_GetProposerPubKey_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGetProposerI_GetProposerPubKey_Call) RunAndReturn(run func() crypto.PubKey) *MockGetProposerI_GetProposerPubKey_Call { + _c.Call.Return(run) + return _c +} + +// NewMockGetProposerI creates a new instance of MockGetProposerI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockGetProposerI(t interface { + mock.TestingT + Cleanup(func()) +}) *MockGetProposerI { + mock := &MockGetProposerI{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go b/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go index f31ee7fe3..408bfdec0 100644 --- a/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go +++ b/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package dymension @@ -15,9 +15,9 @@ import ( mock "github.com/stretchr/testify/mock" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" - sequencertypes "github.com/dymensionxyz/dymension/v3/x/sequencer/types" + sequencertypes "github.com/dymensionxyz/dymint/third_party/dymension/sequencer/types" types "github.com/cosmos/cosmos-sdk/types" ) @@ -513,6 +513,53 @@ func (_c *MockCosmosClient_SubscribeToEvents_Call) RunAndReturn(run func(context return _c } +// UnsubscribeAll provides a mock function with given fields: ctx, subscriber +func (_m *MockCosmosClient) UnsubscribeAll(ctx context.Context, subscriber string) error { + ret := _m.Called(ctx, subscriber) + + if len(ret) == 0 { + panic("no return value specified for UnsubscribeAll") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, subscriber) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockCosmosClient_UnsubscribeAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsubscribeAll' +type MockCosmosClient_UnsubscribeAll_Call struct { + *mock.Call +} + +// UnsubscribeAll is a helper method to define mock.On call +// - ctx context.Context +// - subscriber string +func (_e *MockCosmosClient_Expecter) UnsubscribeAll(ctx interface{}, subscriber interface{}) *MockCosmosClient_UnsubscribeAll_Call { + return &MockCosmosClient_UnsubscribeAll_Call{Call: _e.mock.On("UnsubscribeAll", ctx, subscriber)} +} + +func (_c *MockCosmosClient_UnsubscribeAll_Call) Run(run func(ctx context.Context, subscriber string)) *MockCosmosClient_UnsubscribeAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockCosmosClient_UnsubscribeAll_Call) Return(_a0 error) *MockCosmosClient_UnsubscribeAll_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCosmosClient_UnsubscribeAll_Call) RunAndReturn(run func(context.Context, string) error) *MockCosmosClient_UnsubscribeAll_Call { + _c.Call.Return(run) + return _c +} + // NewMockCosmosClient creates a new instance of MockCosmosClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockCosmosClient(t interface { diff --git a/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go b/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go index 7c980a17e..a4901beeb 100644 --- a/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go +++ b/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package settlement @@ -26,6 +26,120 @@ func (_m *MockClientI) EXPECT() *MockClientI_Expecter { return &MockClientI_Expecter{mock: &_m.Mock} } +// CheckRotationInProgress provides a mock function with given fields: +func (_m *MockClientI) CheckRotationInProgress() (*types.Sequencer, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for CheckRotationInProgress") + } + + var r0 *types.Sequencer + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Sequencer, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *types.Sequencer); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Sequencer) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientI_CheckRotationInProgress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckRotationInProgress' +type MockClientI_CheckRotationInProgress_Call struct { + *mock.Call +} + +// CheckRotationInProgress is a helper method to define mock.On call +func (_e *MockClientI_Expecter) CheckRotationInProgress() *MockClientI_CheckRotationInProgress_Call { + return &MockClientI_CheckRotationInProgress_Call{Call: _e.mock.On("CheckRotationInProgress")} +} + +func (_c *MockClientI_CheckRotationInProgress_Call) Run(run func()) *MockClientI_CheckRotationInProgress_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockClientI_CheckRotationInProgress_Call) Return(_a0 *types.Sequencer, _a1 error) *MockClientI_CheckRotationInProgress_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientI_CheckRotationInProgress_Call) RunAndReturn(run func() (*types.Sequencer, error)) *MockClientI_CheckRotationInProgress_Call { + _c.Call.Return(run) + return _c +} + +// GetAllSequencers provides a mock function with given fields: +func (_m *MockClientI) GetAllSequencers() ([]types.Sequencer, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetAllSequencers") + } + + var r0 []types.Sequencer + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.Sequencer, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.Sequencer); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Sequencer) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientI_GetAllSequencers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllSequencers' +type MockClientI_GetAllSequencers_Call struct { + *mock.Call +} + +// GetAllSequencers is a helper method to define mock.On call +func (_e *MockClientI_Expecter) GetAllSequencers() *MockClientI_GetAllSequencers_Call { + return &MockClientI_GetAllSequencers_Call{Call: _e.mock.On("GetAllSequencers")} +} + +func (_c *MockClientI_GetAllSequencers_Call) Run(run func()) *MockClientI_GetAllSequencers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockClientI_GetAllSequencers_Call) Return(_a0 []types.Sequencer, _a1 error) *MockClientI_GetAllSequencers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientI_GetAllSequencers_Call) RunAndReturn(run func() ([]types.Sequencer, error)) *MockClientI_GetAllSequencers_Call { + _c.Call.Return(run) + return _c +} + // GetBatchAtIndex provides a mock function with given fields: index func (_m *MockClientI) GetBatchAtIndex(index uint64) (*settlement.ResultRetrieveBatch, error) { ret := _m.Called(index) @@ -84,6 +198,63 @@ func (_c *MockClientI_GetBatchAtIndex_Call) RunAndReturn(run func(uint64) (*sett return _c } +// GetBondedSequencers provides a mock function with given fields: +func (_m *MockClientI) GetBondedSequencers() ([]types.Sequencer, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetBondedSequencers") + } + + var r0 []types.Sequencer + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.Sequencer, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.Sequencer); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Sequencer) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientI_GetBondedSequencers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBondedSequencers' +type MockClientI_GetBondedSequencers_Call struct { + *mock.Call +} + +// GetBondedSequencers is a helper method to define mock.On call +func (_e *MockClientI_Expecter) GetBondedSequencers() *MockClientI_GetBondedSequencers_Call { + return &MockClientI_GetBondedSequencers_Call{Call: _e.mock.On("GetBondedSequencers")} +} + +func (_c *MockClientI_GetBondedSequencers_Call) Run(run func()) *MockClientI_GetBondedSequencers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockClientI_GetBondedSequencers_Call) Return(_a0 []types.Sequencer, _a1 error) *MockClientI_GetBondedSequencers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientI_GetBondedSequencers_Call) RunAndReturn(run func() ([]types.Sequencer, error)) *MockClientI_GetBondedSequencers_Call { + _c.Call.Return(run) + return _c +} + // GetHeightState provides a mock function with given fields: _a0 func (_m *MockClientI) GetHeightState(_a0 uint64) (*settlement.ResultGetHeightState, error) { ret := _m.Called(_a0) @@ -246,71 +417,14 @@ func (_c *MockClientI_GetProposer_Call) RunAndReturn(run func() *types.Sequencer return _c } -// GetSequencers provides a mock function with given fields: -func (_m *MockClientI) GetSequencers() ([]*types.Sequencer, error) { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetSequencers") - } - - var r0 []*types.Sequencer - var r1 error - if rf, ok := ret.Get(0).(func() ([]*types.Sequencer, error)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() []*types.Sequencer); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*types.Sequencer) - } - } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientI_GetSequencers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSequencers' -type MockClientI_GetSequencers_Call struct { - *mock.Call -} - -// GetSequencers is a helper method to define mock.On call -func (_e *MockClientI_Expecter) GetSequencers() *MockClientI_GetSequencers_Call { - return &MockClientI_GetSequencers_Call{Call: _e.mock.On("GetSequencers")} -} - -func (_c *MockClientI_GetSequencers_Call) Run(run func()) *MockClientI_GetSequencers_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockClientI_GetSequencers_Call) Return(_a0 []*types.Sequencer, _a1 error) *MockClientI_GetSequencers_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientI_GetSequencers_Call) RunAndReturn(run func() ([]*types.Sequencer, error)) *MockClientI_GetSequencers_Call { - _c.Call.Return(run) - return _c -} - -// Init provides a mock function with given fields: config, _a1, logger, options -func (_m *MockClientI) Init(config settlement.Config, _a1 *pubsub.Server, logger types.Logger, options ...settlement.Option) error { +// Init provides a mock function with given fields: config, rollappId, _a2, logger, options +func (_m *MockClientI) Init(config settlement.Config, rollappId string, _a2 *pubsub.Server, logger types.Logger, options ...settlement.Option) error { _va := make([]interface{}, len(options)) for _i := range options { _va[_i] = options[_i] } var _ca []interface{} - _ca = append(_ca, config, _a1, logger) + _ca = append(_ca, config, rollappId, _a2, logger) _ca = append(_ca, _va...) ret := _m.Called(_ca...) @@ -319,8 +433,8 @@ func (_m *MockClientI) Init(config settlement.Config, _a1 *pubsub.Server, logger } var r0 error - if rf, ok := ret.Get(0).(func(settlement.Config, *pubsub.Server, types.Logger, ...settlement.Option) error); ok { - r0 = rf(config, _a1, logger, options...) + if rf, ok := ret.Get(0).(func(settlement.Config, string, *pubsub.Server, types.Logger, ...settlement.Option) error); ok { + r0 = rf(config, rollappId, _a2, logger, options...) } else { r0 = ret.Error(0) } @@ -335,23 +449,24 @@ type MockClientI_Init_Call struct { // Init is a helper method to define mock.On call // - config settlement.Config -// - _a1 *pubsub.Server +// - rollappId string +// - _a2 *pubsub.Server // - logger types.Logger // - options ...settlement.Option -func (_e *MockClientI_Expecter) Init(config interface{}, _a1 interface{}, logger interface{}, options ...interface{}) *MockClientI_Init_Call { +func (_e *MockClientI_Expecter) Init(config interface{}, rollappId interface{}, _a2 interface{}, logger interface{}, options ...interface{}) *MockClientI_Init_Call { return &MockClientI_Init_Call{Call: _e.mock.On("Init", - append([]interface{}{config, _a1, logger}, options...)...)} + append([]interface{}{config, rollappId, _a2, logger}, options...)...)} } -func (_c *MockClientI_Init_Call) Run(run func(config settlement.Config, _a1 *pubsub.Server, logger types.Logger, options ...settlement.Option)) *MockClientI_Init_Call { +func (_c *MockClientI_Init_Call) Run(run func(config settlement.Config, rollappId string, _a2 *pubsub.Server, logger types.Logger, options ...settlement.Option)) *MockClientI_Init_Call { _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]settlement.Option, len(args)-3) - for i, a := range args[3:] { + variadicArgs := make([]settlement.Option, len(args)-4) + for i, a := range args[4:] { if a != nil { variadicArgs[i] = a.(settlement.Option) } } - run(args[0].(settlement.Config), args[1].(*pubsub.Server), args[2].(types.Logger), variadicArgs...) + run(args[0].(settlement.Config), args[1].(string), args[2].(*pubsub.Server), args[3].(types.Logger), variadicArgs...) }) return _c } @@ -361,7 +476,7 @@ func (_c *MockClientI_Init_Call) Return(_a0 error) *MockClientI_Init_Call { return _c } -func (_c *MockClientI_Init_Call) RunAndReturn(run func(settlement.Config, *pubsub.Server, types.Logger, ...settlement.Option) error) *MockClientI_Init_Call { +func (_c *MockClientI_Init_Call) RunAndReturn(run func(settlement.Config, string, *pubsub.Server, types.Logger, ...settlement.Option) error) *MockClientI_Init_Call { _c.Call.Return(run) return _c } diff --git a/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go b/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go index 7235d0ec5..4ca1b3e4c 100644 --- a/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go +++ b/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go @@ -1,13 +1,14 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package store import ( - store "github.com/dymensionxyz/dymint/store" + cid "github.com/ipfs/go-cid" mock "github.com/stretchr/testify/mock" + state "github.com/tendermint/tendermint/proto/tendermint/state" - tenderminttypes "github.com/tendermint/tendermint/types" + store "github.com/dymensionxyz/dymint/store" types "github.com/dymensionxyz/dymint/types" ) @@ -26,8 +27,21 @@ func (_m *MockStore) EXPECT() *MockStore_Expecter { } // Close provides a mock function with given fields: -func (_m *MockStore) Close() { - _m.Called() +func (_m *MockStore) Close() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 } // MockStore_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' @@ -47,12 +61,12 @@ func (_c *MockStore_Close_Call) Run(run func()) *MockStore_Close_Call { return _c } -func (_c *MockStore_Close_Call) Return() *MockStore_Close_Call { - _c.Call.Return() +func (_c *MockStore_Close_Call) Return(_a0 error) *MockStore_Close_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockStore_Close_Call) RunAndReturn(run func()) *MockStore_Close_Call { +func (_c *MockStore_Close_Call) RunAndReturn(run func() error) *MockStore_Close_Call { _c.Call.Return(run) return _c } @@ -173,6 +187,62 @@ func (_c *MockStore_LoadBlockByHash_Call) RunAndReturn(run func([32]byte) (*type return _c } +// LoadBlockCid provides a mock function with given fields: height +func (_m *MockStore) LoadBlockCid(height uint64) (cid.Cid, error) { + ret := _m.Called(height) + + if len(ret) == 0 { + panic("no return value specified for LoadBlockCid") + } + + var r0 cid.Cid + var r1 error + if rf, ok := ret.Get(0).(func(uint64) (cid.Cid, error)); ok { + return rf(height) + } + if rf, ok := ret.Get(0).(func(uint64) cid.Cid); ok { + r0 = rf(height) + } else { + r0 = ret.Get(0).(cid.Cid) + } + + if rf, ok := ret.Get(1).(func(uint64) error); ok { + r1 = rf(height) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockStore_LoadBlockCid_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadBlockCid' +type MockStore_LoadBlockCid_Call struct { + *mock.Call +} + +// LoadBlockCid is a helper method to define mock.On call +// - height uint64 +func (_e *MockStore_Expecter) LoadBlockCid(height interface{}) *MockStore_LoadBlockCid_Call { + return &MockStore_LoadBlockCid_Call{Call: _e.mock.On("LoadBlockCid", height)} +} + +func (_c *MockStore_LoadBlockCid_Call) Run(run func(height uint64)) *MockStore_LoadBlockCid_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64)) + }) + return _c +} + +func (_c *MockStore_LoadBlockCid_Call) Return(_a0 cid.Cid, _a1 error) *MockStore_LoadBlockCid_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockStore_LoadBlockCid_Call) RunAndReturn(run func(uint64) (cid.Cid, error)) *MockStore_LoadBlockCid_Call { + _c.Call.Return(run) + return _c +} + // LoadBlockResponses provides a mock function with given fields: height func (_m *MockStore) LoadBlockResponses(height uint64) (*state.ABCIResponses, error) { ret := _m.Called(height) @@ -347,29 +417,29 @@ func (_c *MockStore_LoadCommitByHash_Call) RunAndReturn(run func([32]byte) (*typ return _c } -// LoadState provides a mock function with given fields: -func (_m *MockStore) LoadState() (*types.State, error) { - ret := _m.Called() +// LoadSequencers provides a mock function with given fields: height +func (_m *MockStore) LoadSequencers(height uint64) (*types.SequencerSet, error) { + ret := _m.Called(height) if len(ret) == 0 { - panic("no return value specified for LoadState") + panic("no return value specified for LoadSequencers") } - var r0 *types.State + var r0 *types.SequencerSet var r1 error - if rf, ok := ret.Get(0).(func() (*types.State, error)); ok { - return rf() + if rf, ok := ret.Get(0).(func(uint64) (*types.SequencerSet, error)); ok { + return rf(height) } - if rf, ok := ret.Get(0).(func() *types.State); ok { - r0 = rf() + if rf, ok := ret.Get(0).(func(uint64) *types.SequencerSet); ok { + r0 = rf(height) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.State) + r0 = ret.Get(0).(*types.SequencerSet) } } - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if rf, ok := ret.Get(1).(func(uint64) error); ok { + r1 = rf(height) } else { r1 = ret.Error(1) } @@ -377,56 +447,57 @@ func (_m *MockStore) LoadState() (*types.State, error) { return r0, r1 } -// MockStore_LoadState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadState' -type MockStore_LoadState_Call struct { +// MockStore_LoadSequencers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadSequencers' +type MockStore_LoadSequencers_Call struct { *mock.Call } -// LoadState is a helper method to define mock.On call -func (_e *MockStore_Expecter) LoadState() *MockStore_LoadState_Call { - return &MockStore_LoadState_Call{Call: _e.mock.On("LoadState")} +// LoadSequencers is a helper method to define mock.On call +// - height uint64 +func (_e *MockStore_Expecter) LoadSequencers(height interface{}) *MockStore_LoadSequencers_Call { + return &MockStore_LoadSequencers_Call{Call: _e.mock.On("LoadSequencers", height)} } -func (_c *MockStore_LoadState_Call) Run(run func()) *MockStore_LoadState_Call { +func (_c *MockStore_LoadSequencers_Call) Run(run func(height uint64)) *MockStore_LoadSequencers_Call { _c.Call.Run(func(args mock.Arguments) { - run() + run(args[0].(uint64)) }) return _c } -func (_c *MockStore_LoadState_Call) Return(_a0 *types.State, _a1 error) *MockStore_LoadState_Call { +func (_c *MockStore_LoadSequencers_Call) Return(_a0 *types.SequencerSet, _a1 error) *MockStore_LoadSequencers_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockStore_LoadState_Call) RunAndReturn(run func() (*types.State, error)) *MockStore_LoadState_Call { +func (_c *MockStore_LoadSequencers_Call) RunAndReturn(run func(uint64) (*types.SequencerSet, error)) *MockStore_LoadSequencers_Call { _c.Call.Return(run) return _c } -// LoadValidators provides a mock function with given fields: height -func (_m *MockStore) LoadValidators(height uint64) (*tenderminttypes.ValidatorSet, error) { - ret := _m.Called(height) +// LoadState provides a mock function with given fields: +func (_m *MockStore) LoadState() (*types.State, error) { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for LoadValidators") + panic("no return value specified for LoadState") } - var r0 *tenderminttypes.ValidatorSet + var r0 *types.State var r1 error - if rf, ok := ret.Get(0).(func(uint64) (*tenderminttypes.ValidatorSet, error)); ok { - return rf(height) + if rf, ok := ret.Get(0).(func() (*types.State, error)); ok { + return rf() } - if rf, ok := ret.Get(0).(func(uint64) *tenderminttypes.ValidatorSet); ok { - r0 = rf(height) + if rf, ok := ret.Get(0).(func() *types.State); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*tenderminttypes.ValidatorSet) + r0 = ret.Get(0).(*types.State) } } - if rf, ok := ret.Get(1).(func(uint64) error); ok { - r1 = rf(height) + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } @@ -434,30 +505,29 @@ func (_m *MockStore) LoadValidators(height uint64) (*tenderminttypes.ValidatorSe return r0, r1 } -// MockStore_LoadValidators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadValidators' -type MockStore_LoadValidators_Call struct { +// MockStore_LoadState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadState' +type MockStore_LoadState_Call struct { *mock.Call } -// LoadValidators is a helper method to define mock.On call -// - height uint64 -func (_e *MockStore_Expecter) LoadValidators(height interface{}) *MockStore_LoadValidators_Call { - return &MockStore_LoadValidators_Call{Call: _e.mock.On("LoadValidators", height)} +// LoadState is a helper method to define mock.On call +func (_e *MockStore_Expecter) LoadState() *MockStore_LoadState_Call { + return &MockStore_LoadState_Call{Call: _e.mock.On("LoadState")} } -func (_c *MockStore_LoadValidators_Call) Run(run func(height uint64)) *MockStore_LoadValidators_Call { +func (_c *MockStore_LoadState_Call) Run(run func()) *MockStore_LoadState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint64)) + run() }) return _c } -func (_c *MockStore_LoadValidators_Call) Return(_a0 *tenderminttypes.ValidatorSet, _a1 error) *MockStore_LoadValidators_Call { +func (_c *MockStore_LoadState_Call) Return(_a0 *types.State, _a1 error) *MockStore_LoadState_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockStore_LoadValidators_Call) RunAndReturn(run func(uint64) (*tenderminttypes.ValidatorSet, error)) *MockStore_LoadValidators_Call { +func (_c *MockStore_LoadState_Call) RunAndReturn(run func() (*types.State, error)) *MockStore_LoadState_Call { _c.Call.Return(run) return _c } @@ -626,6 +696,66 @@ func (_c *MockStore_SaveBlock_Call) RunAndReturn(run func(*types.Block, *types.C return _c } +// SaveBlockCid provides a mock function with given fields: height, _a1, batch +func (_m *MockStore) SaveBlockCid(height uint64, _a1 cid.Cid, batch store.KVBatch) (store.KVBatch, error) { + ret := _m.Called(height, _a1, batch) + + if len(ret) == 0 { + panic("no return value specified for SaveBlockCid") + } + + var r0 store.KVBatch + var r1 error + if rf, ok := ret.Get(0).(func(uint64, cid.Cid, store.KVBatch) (store.KVBatch, error)); ok { + return rf(height, _a1, batch) + } + if rf, ok := ret.Get(0).(func(uint64, cid.Cid, store.KVBatch) store.KVBatch); ok { + r0 = rf(height, _a1, batch) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.KVBatch) + } + } + + if rf, ok := ret.Get(1).(func(uint64, cid.Cid, store.KVBatch) error); ok { + r1 = rf(height, _a1, batch) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockStore_SaveBlockCid_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveBlockCid' +type MockStore_SaveBlockCid_Call struct { + *mock.Call +} + +// SaveBlockCid is a helper method to define mock.On call +// - height uint64 +// - _a1 cid.Cid +// - batch store.KVBatch +func (_e *MockStore_Expecter) SaveBlockCid(height interface{}, _a1 interface{}, batch interface{}) *MockStore_SaveBlockCid_Call { + return &MockStore_SaveBlockCid_Call{Call: _e.mock.On("SaveBlockCid", height, _a1, batch)} +} + +func (_c *MockStore_SaveBlockCid_Call) Run(run func(height uint64, _a1 cid.Cid, batch store.KVBatch)) *MockStore_SaveBlockCid_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(cid.Cid), args[2].(store.KVBatch)) + }) + return _c +} + +func (_c *MockStore_SaveBlockCid_Call) Return(_a0 store.KVBatch, _a1 error) *MockStore_SaveBlockCid_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockStore_SaveBlockCid_Call) RunAndReturn(run func(uint64, cid.Cid, store.KVBatch) (store.KVBatch, error)) *MockStore_SaveBlockCid_Call { + _c.Call.Return(run) + return _c +} + // SaveBlockResponses provides a mock function with given fields: height, responses, batch func (_m *MockStore) SaveBlockResponses(height uint64, responses *state.ABCIResponses, batch store.KVBatch) (store.KVBatch, error) { ret := _m.Called(height, responses, batch) @@ -686,29 +816,29 @@ func (_c *MockStore_SaveBlockResponses_Call) RunAndReturn(run func(uint64, *stat return _c } -// SaveState provides a mock function with given fields: _a0, batch -func (_m *MockStore) SaveState(_a0 *types.State, batch store.KVBatch) (store.KVBatch, error) { - ret := _m.Called(_a0, batch) +// SaveSequencers provides a mock function with given fields: height, seqSet, batch +func (_m *MockStore) SaveSequencers(height uint64, seqSet *types.SequencerSet, batch store.KVBatch) (store.KVBatch, error) { + ret := _m.Called(height, seqSet, batch) if len(ret) == 0 { - panic("no return value specified for SaveState") + panic("no return value specified for SaveSequencers") } var r0 store.KVBatch var r1 error - if rf, ok := ret.Get(0).(func(*types.State, store.KVBatch) (store.KVBatch, error)); ok { - return rf(_a0, batch) + if rf, ok := ret.Get(0).(func(uint64, *types.SequencerSet, store.KVBatch) (store.KVBatch, error)); ok { + return rf(height, seqSet, batch) } - if rf, ok := ret.Get(0).(func(*types.State, store.KVBatch) store.KVBatch); ok { - r0 = rf(_a0, batch) + if rf, ok := ret.Get(0).(func(uint64, *types.SequencerSet, store.KVBatch) store.KVBatch); ok { + r0 = rf(height, seqSet, batch) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(store.KVBatch) } } - if rf, ok := ret.Get(1).(func(*types.State, store.KVBatch) error); ok { - r1 = rf(_a0, batch) + if rf, ok := ret.Get(1).(func(uint64, *types.SequencerSet, store.KVBatch) error); ok { + r1 = rf(height, seqSet, batch) } else { r1 = ret.Error(1) } @@ -716,58 +846,59 @@ func (_m *MockStore) SaveState(_a0 *types.State, batch store.KVBatch) (store.KVB return r0, r1 } -// MockStore_SaveState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveState' -type MockStore_SaveState_Call struct { +// MockStore_SaveSequencers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveSequencers' +type MockStore_SaveSequencers_Call struct { *mock.Call } -// SaveState is a helper method to define mock.On call -// - _a0 *types.State +// SaveSequencers is a helper method to define mock.On call +// - height uint64 +// - seqSet *types.SequencerSet // - batch store.KVBatch -func (_e *MockStore_Expecter) SaveState(_a0 interface{}, batch interface{}) *MockStore_SaveState_Call { - return &MockStore_SaveState_Call{Call: _e.mock.On("SaveState", _a0, batch)} +func (_e *MockStore_Expecter) SaveSequencers(height interface{}, seqSet interface{}, batch interface{}) *MockStore_SaveSequencers_Call { + return &MockStore_SaveSequencers_Call{Call: _e.mock.On("SaveSequencers", height, seqSet, batch)} } -func (_c *MockStore_SaveState_Call) Run(run func(_a0 *types.State, batch store.KVBatch)) *MockStore_SaveState_Call { +func (_c *MockStore_SaveSequencers_Call) Run(run func(height uint64, seqSet *types.SequencerSet, batch store.KVBatch)) *MockStore_SaveSequencers_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*types.State), args[1].(store.KVBatch)) + run(args[0].(uint64), args[1].(*types.SequencerSet), args[2].(store.KVBatch)) }) return _c } -func (_c *MockStore_SaveState_Call) Return(_a0 store.KVBatch, _a1 error) *MockStore_SaveState_Call { +func (_c *MockStore_SaveSequencers_Call) Return(_a0 store.KVBatch, _a1 error) *MockStore_SaveSequencers_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockStore_SaveState_Call) RunAndReturn(run func(*types.State, store.KVBatch) (store.KVBatch, error)) *MockStore_SaveState_Call { +func (_c *MockStore_SaveSequencers_Call) RunAndReturn(run func(uint64, *types.SequencerSet, store.KVBatch) (store.KVBatch, error)) *MockStore_SaveSequencers_Call { _c.Call.Return(run) return _c } -// SaveValidators provides a mock function with given fields: height, validatorSet, batch -func (_m *MockStore) SaveValidators(height uint64, validatorSet *tenderminttypes.ValidatorSet, batch store.KVBatch) (store.KVBatch, error) { - ret := _m.Called(height, validatorSet, batch) +// SaveState provides a mock function with given fields: _a0, batch +func (_m *MockStore) SaveState(_a0 *types.State, batch store.KVBatch) (store.KVBatch, error) { + ret := _m.Called(_a0, batch) if len(ret) == 0 { - panic("no return value specified for SaveValidators") + panic("no return value specified for SaveState") } var r0 store.KVBatch var r1 error - if rf, ok := ret.Get(0).(func(uint64, *tenderminttypes.ValidatorSet, store.KVBatch) (store.KVBatch, error)); ok { - return rf(height, validatorSet, batch) + if rf, ok := ret.Get(0).(func(*types.State, store.KVBatch) (store.KVBatch, error)); ok { + return rf(_a0, batch) } - if rf, ok := ret.Get(0).(func(uint64, *tenderminttypes.ValidatorSet, store.KVBatch) store.KVBatch); ok { - r0 = rf(height, validatorSet, batch) + if rf, ok := ret.Get(0).(func(*types.State, store.KVBatch) store.KVBatch); ok { + r0 = rf(_a0, batch) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(store.KVBatch) } } - if rf, ok := ret.Get(1).(func(uint64, *tenderminttypes.ValidatorSet, store.KVBatch) error); ok { - r1 = rf(height, validatorSet, batch) + if rf, ok := ret.Get(1).(func(*types.State, store.KVBatch) error); ok { + r1 = rf(_a0, batch) } else { r1 = ret.Error(1) } @@ -775,32 +906,31 @@ func (_m *MockStore) SaveValidators(height uint64, validatorSet *tenderminttypes return r0, r1 } -// MockStore_SaveValidators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveValidators' -type MockStore_SaveValidators_Call struct { +// MockStore_SaveState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveState' +type MockStore_SaveState_Call struct { *mock.Call } -// SaveValidators is a helper method to define mock.On call -// - height uint64 -// - validatorSet *tenderminttypes.ValidatorSet +// SaveState is a helper method to define mock.On call +// - _a0 *types.State // - batch store.KVBatch -func (_e *MockStore_Expecter) SaveValidators(height interface{}, validatorSet interface{}, batch interface{}) *MockStore_SaveValidators_Call { - return &MockStore_SaveValidators_Call{Call: _e.mock.On("SaveValidators", height, validatorSet, batch)} +func (_e *MockStore_Expecter) SaveState(_a0 interface{}, batch interface{}) *MockStore_SaveState_Call { + return &MockStore_SaveState_Call{Call: _e.mock.On("SaveState", _a0, batch)} } -func (_c *MockStore_SaveValidators_Call) Run(run func(height uint64, validatorSet *tenderminttypes.ValidatorSet, batch store.KVBatch)) *MockStore_SaveValidators_Call { +func (_c *MockStore_SaveState_Call) Run(run func(_a0 *types.State, batch store.KVBatch)) *MockStore_SaveState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint64), args[1].(*tenderminttypes.ValidatorSet), args[2].(store.KVBatch)) + run(args[0].(*types.State), args[1].(store.KVBatch)) }) return _c } -func (_c *MockStore_SaveValidators_Call) Return(_a0 store.KVBatch, _a1 error) *MockStore_SaveValidators_Call { +func (_c *MockStore_SaveState_Call) Return(_a0 store.KVBatch, _a1 error) *MockStore_SaveState_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockStore_SaveValidators_Call) RunAndReturn(run func(uint64, *tenderminttypes.ValidatorSet, store.KVBatch) (store.KVBatch, error)) *MockStore_SaveValidators_Call { +func (_c *MockStore_SaveState_Call) RunAndReturn(run func(*types.State, store.KVBatch) (store.KVBatch, error)) *MockStore_SaveState_Call { _c.Call.Return(run) return _c } diff --git a/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go b/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go index 8424b4c94..7393ef94e 100644 --- a/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go +++ b/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package types diff --git a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go index 61691deb8..9ec6b2d18 100644 --- a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go +++ b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package proxy diff --git a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go index 4d5b4030d..affc90a4e 100644 --- a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go +++ b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. +// Code generated by mockery v2.42.3. DO NOT EDIT. package proxy diff --git a/node/node.go b/node/node.go index 32cca6162..f620f8929 100644 --- a/node/node.go +++ b/node/node.go @@ -2,26 +2,19 @@ package node import ( "context" - "encoding/base64" - "encoding/json" "fmt" "net/http" + "path/filepath" "time" + "github.com/ipfs/go-datastore" + leveldb "github.com/ipfs/go-ds-leveldb" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/libp2p/go-libp2p/core/crypto" - "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/libs/pubsub" - "github.com/tendermint/tendermint/libs/service" - "github.com/tendermint/tendermint/proxy" - tmtypes "github.com/tendermint/tendermint/types" - "github.com/dymensionxyz/dymint/block" "github.com/dymensionxyz/dymint/config" - "github.com/dymensionxyz/dymint/da" - daregistry "github.com/dymensionxyz/dymint/da/registry" indexer "github.com/dymensionxyz/dymint/indexers/blockindexer" blockidxkv "github.com/dymensionxyz/dymint/indexers/blockindexer/kv" "github.com/dymensionxyz/dymint/indexers/txindex" @@ -33,6 +26,11 @@ import ( "github.com/dymensionxyz/dymint/settlement" slregistry "github.com/dymensionxyz/dymint/settlement/registry" "github.com/dymensionxyz/dymint/store" + "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tendermint/libs/pubsub" + "github.com/tendermint/tendermint/libs/service" + "github.com/tendermint/tendermint/proxy" + tmtypes "github.com/tendermint/tendermint/types" ) // prefixes used in KV store to separate main node data from DALC data @@ -42,12 +40,6 @@ var ( indexerPrefix = []byte{2} ) -const ( - // genesisChunkSize is the maximum size, in bytes, of each - // chunk in the genesis structure for the chunked API - genesisChunkSize = 16 * 1024 * 1024 // 16 MiB -) - // Node represents a client node in Dymint network. // It connects all the components and orchestrates their work. type Node struct { @@ -57,8 +49,6 @@ type Node struct { proxyApp proxy.AppConns genesis *tmtypes.GenesisDoc - // cache of chunked genesis data. - genChunks []string conf config.NodeConfig P2P *p2p.Client @@ -68,9 +58,9 @@ type Node struct { MempoolIDs *nodemempool.MempoolIDs incomingTxCh chan *p2p.GossipMessage + baseKV store.KV Store store.Store BlockManager *block.Manager - dalc da.DataAvailabilityLayerClient settlementlc settlement.ClientI TxIndexer txindex.TxIndexer @@ -93,9 +83,6 @@ func NewNode( logger log.Logger, metrics *mempool.Metrics, ) (*Node, error) { - if conf.SettlementConfig.RollappID != genesis.ChainID { - return nil, fmt.Errorf("rollapp ID in settlement config doesn't match chain ID in genesis") - } proxyApp := proxy.NewAppConns(clientCreator) proxyApp.SetLogger(logger.With("module", "proxy")) if err := proxyApp.Start(); err != nil { @@ -111,28 +98,28 @@ func NewNode( pubsubServer := pubsub.NewServer() var baseKV store.KV + var dstore datastore.Datastore + if conf.DBConfig.InMemory || (conf.RootDir == "" && conf.DBPath == "") { // this is used for testing logger.Info("WARNING: working in in-memory mode") baseKV = store.NewDefaultInMemoryKVStore() + dstore = datastore.NewMapDatastore() } else { // TODO(omritoptx): Move dymint to const baseKV = store.NewKVStore(conf.RootDir, conf.DBPath, "dymint", conf.DBConfig.SyncWrites) + path := filepath.Join(store.Rootify(conf.RootDir, conf.DBPath), "blocksync") + var err error + dstore, err = leveldb.NewDatastore(path, &leveldb.Options{}) + if err != nil { + return nil, fmt.Errorf("initialize datastore at %s: %w", path, err) + } } s := store.New(store.NewPrefixKV(baseKV, mainPrefix)) - // TODO: dalcKV is needed for mock only. Initialize only if mock used - dalcKV := store.NewPrefixKV(baseKV, dalcPrefix) indexerKV := store.NewPrefixKV(baseKV, indexerPrefix) - dalc := daregistry.GetClient(conf.DALayer) - if dalc == nil { - return nil, fmt.Errorf("get data availability client named '%s'", conf.DALayer) - } - err := dalc.Init([]byte(conf.DAConfig), pubsubServer, dalcKV, logger.With("module", string(dalc.GetClientType()))) - if err != nil { - return nil, fmt.Errorf("data availability layer client initialization %w", err) - } - + // TODO: dalcKV is needed for mock only. Initialize only if mock used + dalcKV := store.NewPrefixKV(baseKV, dalcPrefix) // Init the settlement layer client settlementlc := slregistry.GetClient(slregistry.Client(conf.SettlementLayer)) if settlementlc == nil { @@ -141,7 +128,7 @@ func NewNode( if conf.SettlementLayer == "mock" { conf.SettlementConfig.KeyringHomeDir = conf.RootDir } - err = settlementlc.Init(conf.SettlementConfig, pubsubServer, logger.With("module", "settlement_client")) + err := settlementlc.Init(conf.SettlementConfig, genesis.ChainID, pubsubServer, logger.With("module", "settlement_client")) if err != nil { return nil, fmt.Errorf("settlement layer client initialization: %w", err) } @@ -161,34 +148,36 @@ func NewNode( mp := mempoolv1.NewTxMempool(logger, &conf.MempoolConfig, proxyApp.Mempool(), height, mempoolv1.WithMetrics(metrics)) mpIDs := nodemempool.NewMempoolIDs() - // Set p2p client and it's validators - p2pValidator := p2p.NewValidator(logger.With("module", "p2p_validator"), settlementlc) - - p2pClient, err := p2p.NewClient(conf.P2PConfig, p2pKey, genesis.ChainID, pubsubServer, logger.With("module", "p2p")) - if err != nil { - return nil, err - } - p2pClient.SetTxValidator(p2pValidator.TxValidator(mp, mpIDs)) - p2pClient.SetBlockValidator(p2pValidator.BlockValidator()) - blockManager, err := block.NewManager( signingKey, - conf.BlockManagerConfig, + conf, genesis, s, mp, proxyApp, - dalc, settlementlc, eventBus, pubsubServer, - p2pClient, - logger.With("module", "BlockManager"), + nil, // p2p client is set later + dalcKV, + logger, ) if err != nil { - return nil, fmt.Errorf("BlockManager initialization error: %w", err) + return nil, fmt.Errorf("BlockManager initialization: %w", err) } + // Set p2p client and it's validators + p2pValidator := p2p.NewValidator(logger.With("module", "p2p_validator"), blockManager) + p2pClient, err := p2p.NewClient(conf.P2PConfig, p2pKey, genesis.ChainID, s, pubsubServer, dstore, logger.With("module", "p2p")) + if err != nil { + return nil, err + } + p2pClient.SetTxValidator(p2pValidator.TxValidator(mp, mpIDs)) + p2pClient.SetBlockValidator(p2pValidator.BlockValidator()) + + // Set p2p client in block manager + blockManager.P2PClient = p2pClient + ctx, cancel := context.WithCancel(ctx) node := &Node{ proxyApp: proxyApp, @@ -198,11 +187,11 @@ func NewNode( conf: conf, P2P: p2pClient, BlockManager: blockManager, - dalc: dalc, settlementlc: settlementlc, Mempool: mp, MempoolIDs: mpIDs, incomingTxCh: make(chan *p2p.GossipMessage), + baseKV: baseKV, Store: s, TxIndexer: txIndexer, IndexerService: indexerService, @@ -216,35 +205,6 @@ func NewNode( return node, nil } -// initGenesisChunks creates a chunked format of the genesis document to make it easier to -// iterate through larger genesis structures. -func (n *Node) initGenesisChunks() error { - if n.genChunks != nil { - return nil - } - - if n.genesis == nil { - return nil - } - - data, err := json.Marshal(n.genesis) - if err != nil { - return err - } - - for i := 0; i < len(data); i += genesisChunkSize { - end := i + genesisChunkSize - - if end > len(data) { - end = len(data) - } - - n.genChunks = append(n.genChunks, base64.StdEncoding.EncodeToString(data[i:end])) - } - - return nil -} - // OnStart is a part of Service interface. func (n *Node) OnStart() error { n.Logger.Info("starting P2P client") @@ -256,7 +216,7 @@ func (n *Node) OnStart() error { if err != nil { return fmt.Errorf("start pubsub server: %w", err) } - err = n.dalc.Start() + err = n.BlockManager.DAClient.Start() if err != nil { return fmt.Errorf("start data availability layer client: %w", err) } @@ -284,20 +244,9 @@ func (n *Node) GetGenesis() *tmtypes.GenesisDoc { return n.genesis } -// GetGenesisChunks returns chunked version of genesis. -func (n *Node) GetGenesisChunks() ([]string, error) { - err := n.initGenesisChunks() - if err != nil { - return nil, err - } - return n.genChunks, err -} - // OnStop is a part of Service interface. func (n *Node) OnStop() { - n.cancel() - - err := n.dalc.Stop() + err := n.BlockManager.DAClient.Stop() if err != nil { n.Logger.Error("stop data availability layer client", "error", err) } @@ -316,6 +265,8 @@ func (n *Node) OnStop() { if err != nil { n.Logger.Error("close store", "error", err) } + + n.cancel() } // OnReset is a part of Service interface. diff --git a/node/node_test.go b/node/node_test.go index 697dc9bc7..bf7d6f936 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -20,7 +20,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/proxy" - "github.com/tendermint/tendermint/types" "github.com/dymensionxyz/dymint/config" tmmocks "github.com/dymensionxyz/dymint/mocks/github.com/tendermint/tendermint/abci/types" @@ -33,7 +32,7 @@ func TestStartup(t *testing.T) { require := require.New(t) // TODO(omritoptix): Test with and without sequencer mode. - node, err := testutil.CreateNode(false, nil) + node, err := testutil.CreateNode(false, nil, testutil.GenerateGenesis(0)) require.NoError(err) require.NotNil(node) @@ -59,31 +58,28 @@ func TestMempoolDirectly(t *testing.T) { key, _, _ := crypto.GenerateEd25519Key(rand.Reader) signingKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) anotherKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) - rollappID := "rollapp_1234-1" nodeConfig := config.NodeConfig{ RootDir: "", DBPath: "", P2PConfig: config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - BootstrapNodes: "", + ListenAddress: config.DefaultListenAddress, + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BootstrapNodes: "", + BlockSyncRequestIntervalTime: 30 * time.Second, }, RPC: config.RPCConfig{}, MempoolConfig: *tmcfg.DefaultMempoolConfig(), BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 1 * time.Second, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 100000, - MaxSupportedBatchSkew: 10, - }, - DALayer: "mock", - DAConfig: "", - SettlementLayer: "mock", - SettlementConfig: settlement.Config{ - RollappID: rollappID, + BlockTime: 1 * time.Second, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 100000, + BatchSkew: 10, }, + DAConfig: "", + SettlementLayer: "mock", + SettlementConfig: settlement.Config{}, } node, err := node.NewNode( context.Background(), @@ -91,7 +87,7 @@ func TestMempoolDirectly(t *testing.T) { key, signingKey, proxy.NewLocalClientCreator(app), - &types.GenesisDoc{ChainID: rollappID}, + testutil.GenerateGenesis(0), log.TestingLogger(), mempool.NopMetrics(), ) diff --git a/p2p/block.go b/p2p/block.go new file mode 100644 index 000000000..b74f92368 --- /dev/null +++ b/p2p/block.go @@ -0,0 +1,68 @@ +package p2p + +import ( + "github.com/dymensionxyz/dymint/p2p/pb" + "github.com/dymensionxyz/dymint/types" + tmcrypto "github.com/tendermint/tendermint/crypto" +) + +/* -------------------------------------------------------------------------- */ +/* Event Data */ +/* -------------------------------------------------------------------------- */ + +// BlockData defines the struct of the data for each block sent via P2P +type BlockData struct { + // Block is the block that was gossiped + Block types.Block + // Commit is the commit that was gossiped + Commit types.Commit +} + +// MarshalBinary encodes BlockData into binary form and returns it. +func (b *BlockData) MarshalBinary() ([]byte, error) { + return b.ToProto().Marshal() +} + +// UnmarshalBinary decodes binary form of p2p received block into object. +func (b *BlockData) UnmarshalBinary(data []byte) error { + var pbBlock pb.BlockData + err := pbBlock.Unmarshal(data) + if err != nil { + return err + } + err = b.FromProto(&pbBlock) + return err +} + +// ToProto converts Data into protobuf representation and returns it. +func (b *BlockData) ToProto() *pb.BlockData { + return &pb.BlockData{ + Block: b.Block.ToProto(), + Commit: b.Commit.ToProto(), + } +} + +// FromProto fills BlockData with data from its protobuf representation. +func (b *BlockData) FromProto(other *pb.BlockData) error { + if err := b.Block.FromProto(other.Block); err != nil { + return err + } + if err := b.Commit.FromProto(other.Commit); err != nil { + return err + } + return nil +} + +// Validate run basic validation on the p2p block received +func (b *BlockData) Validate(proposerPubKey tmcrypto.PubKey) error { + if err := b.Block.ValidateBasic(); err != nil { + return err + } + if err := b.Commit.ValidateBasic(); err != nil { + return err + } + if err := b.Commit.ValidateWithHeader(proposerPubKey, &b.Block.Header); err != nil { + return err + } + return nil +} diff --git a/p2p/block_sync.go b/p2p/block_sync.go new file mode 100644 index 000000000..e7bda4bf2 --- /dev/null +++ b/p2p/block_sync.go @@ -0,0 +1,117 @@ +package p2p + +import ( + "context" + "fmt" + + "github.com/dymensionxyz/dymint/types" + "github.com/ipfs/go-datastore" + dsync "github.com/ipfs/go-datastore/sync" + + mh "github.com/multiformats/go-multihash" + + "github.com/ipfs/boxo/bitswap/client" + "github.com/ipfs/boxo/bitswap/network" + "github.com/ipfs/boxo/bitswap/server" + "github.com/ipfs/boxo/blockservice" + "github.com/ipfs/boxo/blockstore" + "github.com/ipfs/go-cid" + routinghelpers "github.com/libp2p/go-libp2p-routing-helpers" + "github.com/libp2p/go-libp2p/core/host" +) + +// Blocksync is a protocol used to retrieve blocks on demand from the P2P network. +// Nodes store received blocks from gossip in an IPFS blockstore and nodes are able to request them on demand using bitswap protocol. +// In order to discover the identifier (CID) of each block a DHT request needs to be made for the specific block height. +// Nodes need to advertise CIDs/height map to the DHT periodically. +// https://www.notion.so/dymension/ADR-x-Rollapp-block-sync-protocol-6ee48b232a6a45e09989d67f1a6c0297?pvs=4 +type BlockSync struct { + // service that reads/writes blocks either from local datastore or the P2P network + bsrv blockservice.BlockService + // local datastore for IPFS blocks + bstore blockstore.Blockstore + // protocol used to obtain blocks from the P2P network + net network.BitSwapNetwork + // used to find all data chunks that are part of the same block + dsrv BlockSyncDagService + // used to define the content identifiers of each data chunk + cidBuilder cid.Builder + logger types.Logger +} + +type BlockSyncMessageHandler func(block *BlockData) + +// SetupBlockSync initializes all services required to provide and retrieve block data in the P2P network. +func SetupBlockSync(ctx context.Context, h host.Host, store datastore.Datastore, logger types.Logger) *BlockSync { + // construct a datastore + ds := dsync.MutexWrap(store) + + // set a blockstore (to store IPFS data chunks) with the previous datastore + bs := blockstore.NewBlockstore(ds) + + // initialize bitswap network used to retrieve data chunks from other peers in the P2P network + bsnet := network.NewFromIpfsHost(h, &routinghelpers.Null{}, network.Prefix("/dymension/block-sync/")) + + // Bitswap server that provides data to the network. + bsserver := server.New( + ctx, + bsnet, + bs, + server.ProvideEnabled(false), // we don't provide blocks over DHT + server.SetSendDontHaves(false), + ) + + // Bitswap client that retrieves data from the network. + bsclient := client.New( + ctx, + bsnet, + bs, + client.SetSimulateDontHavesOnTimeout(false), + client.WithBlockReceivedNotifier(bsserver), + client.WithoutDuplicatedBlockStats(), + ) + + // start the network + bsnet.Start(bsserver, bsclient) + + bsrv := blockservice.New(bs, bsclient) + + blockSync := &BlockSync{ + bsrv: bsrv, + net: bsnet, + bstore: bs, + dsrv: NewDAGService(bsrv), + cidBuilder: &cid.Prefix{ + Codec: cid.DagProtobuf, + MhLength: -1, + MhType: mh.SHA2_256, + Version: 1, + }, + logger: logger, + } + + return blockSync +} + +// SaveBlock stores the blocks produced in the DAG services to be retrievable from the P2P network. +func (blocksync *BlockSync) SaveBlock(ctx context.Context, block []byte) (cid.Cid, error) { + return blocksync.dsrv.SaveBlock(ctx, block) +} + +// LoadBlock retrieves the blocks (from the local blockstore or the network) using the DAGService to discover all data chunks that are part of the same block. +func (blocksync *BlockSync) LoadBlock(ctx context.Context, cid cid.Cid) (BlockData, error) { + blockBytes, err := blocksync.dsrv.LoadBlock(ctx, cid) + if err != nil { + return BlockData{}, err + } + var block BlockData + if err := block.UnmarshalBinary(blockBytes); err != nil { + return BlockData{}, fmt.Errorf("deserialize blocksync block %w", err) + } + return block, nil +} + +// RemoveBlock removes the block from the DAGservice. +func (blocksync *BlockSync) DeleteBlock(ctx context.Context, cid cid.Cid) error { + return blocksync.dsrv.Remove(ctx, cid) +} diff --git a/p2p/block_sync_dag.go b/p2p/block_sync_dag.go new file mode 100644 index 000000000..18d78dca3 --- /dev/null +++ b/p2p/block_sync_dag.go @@ -0,0 +1,137 @@ +package p2p + +import ( + "bytes" + "context" + "errors" + "io" + + chunker "github.com/ipfs/boxo/chunker" + mh "github.com/multiformats/go-multihash" + + "github.com/ipfs/boxo/blockservice" + "github.com/ipfs/boxo/ipld/merkledag" + dag "github.com/ipfs/boxo/ipld/merkledag" + "github.com/ipfs/go-cid" + ipld "github.com/ipfs/go-ipld-format" +) + +type BlockSyncDagService struct { + ipld.DAGService + cidBuilder cid.Builder +} + +// NewDAGService inits the DAGservice used to retrieve/send blocks data in the P2P. +// Block data is organized in a merkle DAG using IPLD (https://ipld.io/docs/) +func NewDAGService(bsrv blockservice.BlockService) BlockSyncDagService { + bsDagService := &BlockSyncDagService{ + cidBuilder: &cid.Prefix{ + Codec: cid.DagProtobuf, + MhLength: -1, + MhType: mh.SHA2_256, + Version: 1, + }, + } + bsDagService.DAGService = merkledag.NewDAGService(bsrv) + + return *bsDagService +} + +// SaveBlock splits the block in chunks of 256KB and it creates a new merkle DAG with them. it returns the content identifier (cid) of the root node of the DAG. +// Using the root CID the whole block can be retrieved using the DAG service +func (bsDagService *BlockSyncDagService) SaveBlock(ctx context.Context, block []byte) (cid.Cid, error) { + blockReader := bytes.NewReader(block) + + splitter := chunker.NewSizeSplitter(blockReader, chunker.DefaultBlockSize) + nodes := []*dag.ProtoNode{} + + // the loop creates nodes for each block chunk and sets each cid + for { + nextData, err := splitter.NextBytes() + if err == io.EOF { + break + } + if err != nil { + return cid.Undef, err + } + protoNode := dag.NodeWithData(nextData) + err = protoNode.SetCidBuilder(bsDagService.cidBuilder) + if err != nil { + return cid.Undef, err + } + nodes = append(nodes, protoNode) + + } + + // an empty root node is created + root := dag.NodeWithData(nil) + err := root.SetCidBuilder(bsDagService.cidBuilder) + if err != nil { + return cid.Undef, err + } + + // and linked to all chunks that are added to the DAGservice + for _, n := range nodes { + + err := root.AddNodeLink(n.Cid().String(), n) + if err != nil { + return cid.Undef, err + } + err = bsDagService.Add(ctx, n) + if err != nil { + return cid.Undef, err + } + } + err = bsDagService.Add(ctx, root) + if err != nil { + return cid.Undef, err + } + + return root.Cid(), nil +} + +// LoadBlock returns the block data obtained from the DAGService, using the root cid, either from the network or the local blockstore +func (bsDagService *BlockSyncDagService) LoadBlock(ctx context.Context, cid cid.Cid) ([]byte, error) { + // first it gets the root node + nd, err := bsDagService.Get(ctx, cid) + if err != nil { + return nil, err + } + + // then it gets all the data from the root node + read, err := dagReader(nd, bsDagService) + if err != nil { + return nil, err + } + + // the data is read to bytes array + data, err := io.ReadAll(read) + if err != nil { + return nil, err + } + return data, nil +} + +// dagReader is used to read the DAG (all the block chunks) from the root (IPLD) node +func dagReader(root ipld.Node, ds ipld.DAGService) (io.Reader, error) { + ctx := context.Background() + buf := new(bytes.Buffer) + + // the loop retrieves all the nodes (block chunks) either from the local store or the network, in case it is not there. + for _, l := range root.Links() { + n, err := ds.Get(ctx, l.Cid) + if err != nil { + return nil, err + } + rawdata, ok := n.(*dag.ProtoNode) + if !ok { + return nil, errors.New("read block DAG") + } + + _, err = buf.Write(rawdata.Data()) + if err != nil { + return nil, err + } + } + return buf, nil +} diff --git a/p2p/block_sync_test.go b/p2p/block_sync_test.go new file mode 100644 index 000000000..7b01a98ac --- /dev/null +++ b/p2p/block_sync_test.go @@ -0,0 +1,62 @@ +package p2p_test + +import ( + "context" + "testing" + + "github.com/dymensionxyz/dymint/p2p" + "github.com/dymensionxyz/dymint/testutil" + "github.com/ipfs/go-datastore" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" +) + +func TestBlockSync(t *testing.T) { + logger := log.TestingLogger() + ctx := context.Background() + + manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, 1, 1, 0, nil, nil) + + require.NoError(t, err) + require.NotNil(t, manager) + + // required for tx validator + assertRecv := func(tx *p2p.GossipMessage) bool { + return true + } + + // Create a block for height 1 + blocks, err := testutil.GenerateBlocksWithTxs(1, 1, manager.LocalKey, 1) + require.NoError(t, err) + + // Create commit + commits, err := testutil.GenerateCommits(blocks, manager.LocalKey) + require.NoError(t, err) + + gossipedBlock := p2p.BlockData{Block: *blocks[0], Commit: *commits[0]} + gossipedBlockbytes, err := gossipedBlock.MarshalBinary() + require.NoError(t, err) + + // validators required + validators := []p2p.GossipValidator{assertRecv, assertRecv, assertRecv, assertRecv, assertRecv} + + clients := testutil.StartTestNetwork(ctx, t, 1, map[int]testutil.HostDescr{ + 0: {Conns: []int{}, ChainID: "1"}, + }, validators, logger) + + blocksync := p2p.SetupBlockSync(ctx, clients[0].Host, datastore.NewMapDatastore(), logger) + require.NoError(t, err) + + // add block to blocksync protocol client 0 + cid, err := blocksync.SaveBlock(ctx, gossipedBlockbytes) + require.NoError(t, err) + + // get block + block, err := blocksync.LoadBlock(ctx, cid) + require.NoError(t, err) + require.Equal(t, gossipedBlock, block) + + // remove block + err = blocksync.DeleteBlock(ctx, cid) + require.NoError(t, err) +} diff --git a/p2p/blocks_received.go b/p2p/blocks_received.go new file mode 100644 index 000000000..ceaf0bf67 --- /dev/null +++ b/p2p/blocks_received.go @@ -0,0 +1,43 @@ +package p2p + +import "sync" + +// BlocksReceived tracks blocks received from P2P to know what are the missing blocks that need to be requested on demand +type BlocksReceived struct { + blocksReceived map[uint64]struct{} + latestSeenHeight uint64 + // mutex to protect blocksReceived map access + blockReceivedMu sync.Mutex +} + +// addBlockReceived adds the block height to a map +func (br *BlocksReceived) AddBlockReceived(height uint64) { + br.latestSeenHeight = max(height, br.latestSeenHeight) + br.blockReceivedMu.Lock() + defer br.blockReceivedMu.Unlock() + br.blocksReceived[height] = struct{}{} +} + +// isBlockReceived checks if a block height is already received +func (br *BlocksReceived) IsBlockReceived(height uint64) bool { + br.blockReceivedMu.Lock() + defer br.blockReceivedMu.Unlock() + _, ok := br.blocksReceived[height] + return ok +} + +// removeBlocksReceivedUpToHeight clears previous received block heights +func (br *BlocksReceived) RemoveBlocksReceivedUpToHeight(appliedHeight uint64) { + br.blockReceivedMu.Lock() + defer br.blockReceivedMu.Unlock() + for h := range br.blocksReceived { + if h < appliedHeight { + delete(br.blocksReceived, h) + } + } +} + +// GetLatestSeenHeight returns the latest height stored +func (br *BlocksReceived) GetLatestSeenHeight() uint64 { + return br.latestSeenHeight +} diff --git a/p2p/client.go b/p2p/client.go index 70e7ee084..2e9c6eb57 100644 --- a/p2p/client.go +++ b/p2p/client.go @@ -4,9 +4,14 @@ import ( "context" "encoding/hex" "fmt" + "strconv" "strings" "time" + "github.com/dymensionxyz/dymint/store" + "github.com/dymensionxyz/gerr-cosmos/gerrc" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-datastore" "github.com/libp2p/go-libp2p" dht "github.com/libp2p/go-libp2p-kad-dht" pubsub "github.com/libp2p/go-libp2p-pubsub" @@ -40,6 +45,9 @@ const ( // blockTopicSuffix is added after namespace to create pubsub topic for block gossiping. blockTopicSuffix = "-block" + + // blockSyncProtocolSuffix is added after namespace to create blocksync protocol prefix. + blockSyncProtocolPrefix = "block-sync" ) // Client is a P2P client, implemented with libp2p. @@ -69,15 +77,25 @@ type Client struct { localPubsubServer *tmpubsub.Server logger types.Logger + + // blocksync instance used to save and retrieve blocks from the P2P network on demand + blocksync *BlockSync + + // store used to store retrievable blocks using blocksync + blockSyncStore datastore.Datastore + + store store.Store + + blocksReceived *BlocksReceived } // NewClient creates new Client object. // // Basic checks on parameters are done, and default parameters are provided for unset-configuration // TODO(tzdybal): consider passing entire config, not just P2P config, to reduce number of arguments -func NewClient(conf config.P2PConfig, privKey crypto.PrivKey, chainID string, localPubsubServer *tmpubsub.Server, logger types.Logger) (*Client, error) { +func NewClient(conf config.P2PConfig, privKey crypto.PrivKey, chainID string, store store.Store, localPubsubServer *tmpubsub.Server, blockSyncStore datastore.Datastore, logger types.Logger) (*Client, error) { if privKey == nil { - return nil, errNoPrivKey + return nil, fmt.Errorf("private key: %w", gerrc.ErrNotFound) } if conf.ListenAddress == "" { conf.ListenAddress = config.DefaultListenAddress @@ -89,6 +107,11 @@ func NewClient(conf config.P2PConfig, privKey crypto.PrivKey, chainID string, lo chainID: chainID, logger: logger, localPubsubServer: localPubsubServer, + blockSyncStore: blockSyncStore, + store: store, + blocksReceived: &BlocksReceived{ + blocksReceived: make(map[uint64]struct{}), + }, }, nil } @@ -133,6 +156,17 @@ func (c *Client) StartWithHost(ctx context.Context, h host.Host) error { return err } + if !c.conf.BlockSyncEnabled { + c.logger.Info("Block sync protocol disabled") + return nil + } + + c.logger.Debug("Setting up block sync protocol") + err = c.startBlockSync(ctx) + if err != nil { + return err + } + return nil } @@ -165,6 +199,65 @@ func (c *Client) GossipBlock(ctx context.Context, blockBytes []byte) error { return c.blockGossiper.Publish(ctx, blockBytes) } +// SaveBlock stores the block in the blocksync datastore, stores locally the returned identifier and advertises the identifier to the DHT, so other nodes can know the identifier for the block height. +func (c *Client) SaveBlock(ctx context.Context, height uint64, blockBytes []byte) error { + if !c.conf.BlockSyncEnabled { + return nil + } + cid, err := c.blocksync.SaveBlock(ctx, blockBytes) + if err != nil { + return fmt.Errorf("blocksync add block: %w", err) + } + _, err = c.store.SaveBlockCid(height, cid, nil) + if err != nil { + return fmt.Errorf("blocksync store block id: %w", err) + } + err = c.AdvertiseBlockIdToDHT(ctx, height, cid) + if err != nil { + c.logger.Debug("block-sync advertise block", "error", err) + } + return nil +} + +// RemoveBlocks is used to prune blocks from the block sync datastore. +func (c *Client) RemoveBlocks(ctx context.Context, from, to uint64) error { + if from <= 0 { + return fmt.Errorf("from height must be greater than 0: %w", gerrc.ErrInvalidArgument) + } + + if to <= from { + return fmt.Errorf("to height must be greater than from height: to: %d: from: %d: %w", to, from, gerrc.ErrInvalidArgument) + } + + for h := from; h < to; h++ { + + cid, err := c.store.LoadBlockCid(h) + if err != nil { + return fmt.Errorf("load block id from store %d: %w", h, err) + } + err = c.blocksync.DeleteBlock(ctx, cid) + if err != nil { + return fmt.Errorf("remove block height %d: %w", h, err) + } + } + return nil +} + +// AdvertiseBlockIdToDHT is used to advertise the identifier (cid) for a specific block height to the DHT, using a PutValue operation +func (c *Client) AdvertiseBlockIdToDHT(ctx context.Context, height uint64, cid cid.Cid) error { + err := c.DHT.PutValue(ctx, getBlockSyncKeyByHeight(height), []byte(cid.String())) + return err +} + +// GetBlockIdFromDHT is used to retrieve the identifier (cid) for a specific block height from the DHT, using a GetValue operation +func (c *Client) GetBlockIdFromDHT(ctx context.Context, height uint64) (cid.Cid, error) { + cidBytes, err := c.DHT.GetValue(ctx, getBlockSyncKeyByHeight(height)) + if err != nil { + return cid.Undef, err + } + return cid.MustParse(string(cidBytes)), nil +} + // SetBlockValidator sets the callback function, that will be invoked after block is received from P2P network. func (c *Client) SetBlockValidator(validator GossipValidator) { c.blockValidator = validator @@ -243,7 +336,9 @@ func (c *Client) setupDHT(ctx context.Context) error { } var err error - c.DHT, err = dht.New(ctx, c.Host, dht.Mode(dht.ModeServer), dht.BootstrapPeers(bootstrapNodes...)) + + val := dht.NamespacedValidator(blockSyncProtocolPrefix, blockIdValidator{}) + c.DHT, err = dht.New(ctx, c.Host, dht.Mode(dht.ModeServer), dht.ProtocolPrefix(blockSyncProtocolPrefix), val, dht.BootstrapPeers(bootstrapNodes...)) if err != nil { return fmt.Errorf("create DHT: %w", err) } @@ -292,6 +387,14 @@ func (c *Client) setupPeerDiscovery(ctx context.Context) error { return nil } +func (c *Client) startBlockSync(ctx context.Context) error { + blocksync := SetupBlockSync(ctx, c.Host, c.blockSyncStore, c.logger) + c.blocksync = blocksync + go c.retrieveBlockSyncLoop(ctx, c.blockSyncReceived) + go c.advertiseBlockSyncCids(ctx) + return nil +} + func (c *Client) advertise(ctx context.Context) error { discutil.Advertise(ctx, c.disc, c.getNamespace(), cdiscovery.TTL(reAdvertisePeriod)) return nil @@ -322,10 +425,9 @@ func (c *Client) tryConnect(ctx context.Context, peer peer.AddrInfo) { } func (c *Client) setupGossiping(ctx context.Context) error { - pubsub.GossipSubHistoryGossip = c.conf.GossipedBlocksCacheSize - pubsub.GossipSubHistoryLength = c.conf.GossipedBlocksCacheSize + pubsub.GossipSubHistoryGossip = c.conf.GossipSubCacheSize + pubsub.GossipSubHistoryLength = c.conf.GossipSubCacheSize - // We add WithSeenMessagesTTL (with 1 year time) option to avoid ever requesting already seen blocks ps, err := pubsub.NewGossipSub(ctx, c.Host) if err != nil { return err @@ -338,7 +440,7 @@ func (c *Client) setupGossiping(ctx context.Context) error { } go c.txGossiper.ProcessMessages(ctx) - c.blockGossiper, err = NewGossiper(c.Host, ps, c.getBlockTopic(), c.gossipedBlockReceived, c.logger, + c.blockGossiper, err = NewGossiper(c.Host, ps, c.getBlockTopic(), c.blockGossipReceived, c.logger, WithValidator(c.blockValidator)) if err != nil { return err @@ -378,10 +480,12 @@ func (c *Client) getNamespace() string { return c.chainID } +// topic used to transmit transactions in gossipsub func (c *Client) getTxTopic() string { return c.getNamespace() + txTopicSuffix } +// topic used to transmit blocks in gossipsub func (c *Client) getBlockTopic() string { return c.getNamespace() + blockTopicSuffix } @@ -394,17 +498,43 @@ func (c *Client) NewTxValidator() GossipValidator { } } -func (c *Client) gossipedBlockReceived(msg *GossipMessage) { - var gossipedBlock GossipedBlock - if err := gossipedBlock.UnmarshalBinary(msg.Data); err != nil { +// blockSyncReceived is called on reception of new block via blocksync protocol +func (c *Client) blockSyncReceived(block *BlockData) { + err := c.localPubsubServer.PublishWithEvents(context.Background(), *block, map[string][]string{EventTypeKey: {EventNewBlockSyncBlock}}) + if err != nil { + c.logger.Error("Publishing event.", "err", err) + } + // Received block is cached and no longer needed to request using blocksync + c.blocksReceived.AddBlockReceived(block.Block.Header.Height) +} + +// blockSyncReceived is called on reception of new block via gossip protocol +func (c *Client) blockGossipReceived(ctx context.Context, block []byte) { + var gossipedBlock BlockData + if err := gossipedBlock.UnmarshalBinary(block); err != nil { c.logger.Error("Deserialize gossiped block", "error", err) } err := c.localPubsubServer.PublishWithEvents(context.Background(), gossipedBlock, map[string][]string{EventTypeKey: {EventNewGossipedBlock}}) if err != nil { c.logger.Error("Publishing event.", "err", err) } + if c.conf.BlockSyncEnabled { + _, err := c.store.LoadBlockCid(gossipedBlock.Block.Header.Height) + // skip block already added to blocksync + if err == nil { + return + } + err = c.SaveBlock(ctx, gossipedBlock.Block.Header.Height, block) + if err != nil { + c.logger.Error("Adding block to blocksync store.", "err", err, "height", gossipedBlock.Block.Header.Height) + } + // Received block is cached and no longer needed to request using blocksync + c.blocksReceived.AddBlockReceived(gossipedBlock.Block.Header.Height) + } } +// bootstrapLoop is used to periodically check if the node is connected to other nodes in the P2P network, re-bootstrapping the DHT in case it is necessary, +// or to try to connect to the persistent peers func (c *Client) bootstrapLoop(ctx context.Context) { ticker := time.NewTicker(c.conf.BootstrapRetryTime) defer ticker.Stop() @@ -431,6 +561,80 @@ func (c *Client) bootstrapLoop(ctx context.Context) { } } +// retrieveBlockSyncLoop checks if there is any block not received, previous to the latest block height received, to request it on demand +func (c *Client) retrieveBlockSyncLoop(ctx context.Context, msgHandler BlockSyncMessageHandler) { + ticker := time.NewTicker(c.conf.BlockSyncRequestIntervalTime) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + state, err := c.store.LoadState() + if err != nil { + continue + } + + // this loop iterates and retrieves all the blocks between the last block applied and the greatest height received, + // skipping any block cached, since are already received. + for h := state.NextHeight(); h <= c.blocksReceived.latestSeenHeight; h++ { + ok := c.blocksReceived.IsBlockReceived(h) + if ok { + continue + } + c.logger.Debug("Blocksync getting block.", "height", h) + id, err := c.GetBlockIdFromDHT(ctx, h) + if err != nil || id == cid.Undef { + c.logger.Error("Blocksync unable to find cid", "height", h) + continue + } + _, err = c.store.SaveBlockCid(h, id, nil) + if err != nil { + c.logger.Error("Blocksync storing block cid", "height", h, "cid", id) + continue + } + block, err := c.blocksync.LoadBlock(ctx, id) + if err != nil { + c.logger.Error("Blocksync LoadBlock", "err", err) + continue + } + + c.logger.Debug("Blocksync block received ", "height", h) + msgHandler(&block) + state, err := c.store.LoadState() + if err != nil { + return + } + h = max(h, state.NextHeight()-1) + } + c.blocksReceived.RemoveBlocksReceivedUpToHeight(state.NextHeight()) + } + } +} + +// advertiseBlockSyncCids is used to advertise all the block identifiers (cids) stored in the local store to the DHT on startup +func (c *Client) advertiseBlockSyncCids(ctx context.Context) { + state, err := c.store.LoadState() + if err != nil { + return + } + for h := state.BaseHeight; h <= state.Height(); h++ { + + id, err := c.store.LoadBlockCid(h) + if err != nil || id == cid.Undef { + continue + } + + err = c.AdvertiseBlockIdToDHT(ctx, h, id) + if err != nil { + continue + } + + } +} + +// findConnection returns true in case the node is already connected to the peer specified. func (c *Client) findConnection(peer peer.AddrInfo) bool { for _, con := range c.Host.Network().Conns() { if peer.ID == con.RemotePeer() { @@ -439,3 +643,17 @@ func (c *Client) findConnection(peer peer.AddrInfo) bool { } return false } + +func getBlockSyncKeyByHeight(height uint64) string { + return "/" + blockSyncProtocolPrefix + "/" + strconv.FormatUint(height, 10) +} + +// validates that the content identifiers advertised in the DHT are valid. +type blockIdValidator struct{} + +func (blockIdValidator) Validate(_ string, id []byte) error { + _, err := cid.Parse(string(id)) + return err +} + +func (blockIdValidator) Select(_ string, _ [][]byte) (int, error) { return 0, nil } diff --git a/p2p/client_test.go b/p2p/client_test.go index c519996c5..020d6a052 100644 --- a/p2p/client_test.go +++ b/p2p/client_test.go @@ -3,16 +3,21 @@ package p2p_test import ( "context" "crypto/rand" + "strconv" "sync" "testing" "time" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-datastore" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" "github.com/multiformats/go-multiaddr" + mh "github.com/multiformats/go-multihash" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/dymensionxyz/dymint/store" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/pubsub" @@ -26,11 +31,13 @@ func TestClientStartup(t *testing.T) { pubsubServer := pubsub.NewServer() err := pubsubServer.Start() require.NoError(t, err) + store := store.New(store.NewDefaultInMemoryKVStore()) client, err := p2p.NewClient(config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - }, privKey, "TestChain", pubsubServer, log.TestingLogger()) + ListenAddress: config.DefaultListenAddress, + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, + }, privKey, "TestChain", store, pubsubServer, datastore.NewMapDatastore(), log.TestingLogger()) assert := assert.New(t) assert.NoError(err) assert.NotNil(client) @@ -134,6 +141,89 @@ func TestGossiping(t *testing.T) { wg.Wait() } +// Test that advertises and retrieves a CID for a block height in the DHT +func TestAdvertiseBlock(t *testing.T) { + logger := log.TestingLogger() + + ctx := context.Background() + + // required for tx validator + assertRecv := func(tx *p2p.GossipMessage) bool { + return true + } + + // Create a cid manually by specifying the 'prefix' parameters + pref := &cid.Prefix{ + Codec: cid.DagProtobuf, + MhLength: -1, + MhType: mh.SHA2_256, + Version: 1, + } + + // And then feed it some data + expectedCid, err := pref.Sum([]byte("test")) + require.NoError(t, err) + + // validators required + validators := []p2p.GossipValidator{assertRecv, assertRecv, assertRecv, assertRecv, assertRecv} + + // network connections topology: 3<->1<->0<->2<->4 + clients := testutil.StartTestNetwork(ctx, t, 3, map[int]testutil.HostDescr{ + 0: {Conns: []int{}, ChainID: "1"}, + 1: {Conns: []int{0}, ChainID: "1"}, + 2: {Conns: []int{1}, ChainID: "1"}, + }, validators, logger) + + // wait for clients to finish refreshing routing tables + clients.WaitForDHT() + + // this sleep is required for pubsub to "propagate" subscription information + // TODO(tzdybal): is there a better way to wait for readiness? + time.Sleep(1 * time.Second) + + // advertise cid for height 1 + err = clients[2].AdvertiseBlockIdToDHT(ctx, 1, expectedCid) + require.NoError(t, err) + + // get cid for height 1 + receivedCid, err := clients[0].GetBlockIdFromDHT(ctx, 1) + require.NoError(t, err) + require.Equal(t, expectedCid, receivedCid) +} + +// Test that advertises an invalid CID in the DHT +func TestAdvertiseWrongCid(t *testing.T) { + logger := log.TestingLogger() + + ctx := context.Background() + + // required for tx validator + assertRecv := func(tx *p2p.GossipMessage) bool { + return true + } + + validators := []p2p.GossipValidator{assertRecv, assertRecv, assertRecv, assertRecv, assertRecv} + + // network connections topology: 3<->1<->0<->2<->4 + clients := testutil.StartTestNetwork(ctx, t, 3, map[int]testutil.HostDescr{ + 0: {Conns: []int{}, ChainID: "1"}, + 1: {Conns: []int{0}, ChainID: "1"}, + 2: {Conns: []int{1}, ChainID: "1"}, + }, validators, logger) + + // wait for clients to finish refreshing routing tables + clients.WaitForDHT() + + // this sleep is required for pubsub to "propagate" subscription information + // TODO(tzdybal): is there a better way to wait for readiness? + time.Sleep(1 * time.Second) + + // advertise cid for height 1 + receivedError := clients[2].DHT.PutValue(ctx, "/block-sync/"+strconv.FormatUint(1, 10), []byte("test")) + + require.Error(t, cid.ErrInvalidCid{}, receivedError) +} + func TestSeedStringParsing(t *testing.T) { t.Parallel() @@ -178,10 +268,11 @@ func TestSeedStringParsing(t *testing.T) { assert := assert.New(t) require := require.New(t) logger := &testutil.MockLogger{} + store := store.New(store.NewDefaultInMemoryKVStore()) client, err := p2p.NewClient(config.P2PConfig{ - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - }, privKey, "TestNetwork", pubsubServer, logger) + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + }, privKey, "TestNetwork", store, pubsubServer, datastore.NewMapDatastore(), logger) require.NoError(err) require.NotNil(client) actual := client.GetSeedAddrInfo(c.input) diff --git a/p2p/errors.go b/p2p/errors.go deleted file mode 100644 index 071dc4b79..000000000 --- a/p2p/errors.go +++ /dev/null @@ -1,5 +0,0 @@ -package p2p - -import "errors" - -var errNoPrivKey = errors.New("private key not provided") diff --git a/p2p/events.go b/p2p/events.go index 033ccdae5..45a0064a5 100644 --- a/p2p/events.go +++ b/p2p/events.go @@ -14,12 +14,16 @@ const ( ) const ( - EventNewGossipedBlock = "NewGossipedBlock" + EventNewGossipedBlock = "NewGossipedBlock" + EventNewBlockSyncBlock = "NewBlockSyncBlock" ) /* -------------------------------------------------------------------------- */ /* Queries */ /* -------------------------------------------------------------------------- */ -// EventQueryNewNewGossipedBlock is the query used for getting EventNewGossipedBlock -var EventQueryNewNewGossipedBlock = uevent.QueryFor(EventTypeKey, EventNewGossipedBlock) +// EventQueryNewGossipedBlock is the query used for getting EventNewGossipedBlock +var EventQueryNewGossipedBlock = uevent.QueryFor(EventTypeKey, EventNewGossipedBlock) + +// EventQueryNewBlockSyncBlock is the query used for getting EventNewBlockSyncBlock +var EventQueryNewBlockSyncBlock = uevent.QueryFor(EventTypeKey, EventNewBlockSyncBlock) diff --git a/p2p/gossip.go b/p2p/gossip.go index d4e19b479..6d4236e4c 100644 --- a/p2p/gossip.go +++ b/p2p/gossip.go @@ -13,6 +13,9 @@ import ( "github.com/dymensionxyz/dymint/types" ) +// buffer size used by gossipSub router to consume received packets (blocks or txs). packets are dropped in case buffer overflows. in case of blocks, it can buffer up to 5 minutes (assuming 200ms block rate) +const pubsubBufferSize = 3000 + // GossipMessage represents message gossiped via P2P network (e.g. transaction, Block etc). type GossipMessage struct { Data []byte @@ -22,7 +25,7 @@ type GossipMessage struct { // GossiperOption sets optional parameters of Gossiper. type GossiperOption func(*Gossiper) error -type GossipMessageHandler func(msg *GossipMessage) +type GossipMessageHandler func(ctx context.Context, gossipedBlock []byte) // WithValidator options registers topic validator for Gossiper. func WithValidator(validator GossipValidator) GossiperOption { @@ -50,8 +53,7 @@ func NewGossiper(host host.Host, ps *pubsub.PubSub, topicStr string, msgHandler if err != nil { return nil, err } - - subscription, err := topic.Subscribe() + subscription, err := topic.Subscribe(pubsub.WithBufferSize(max(pubsub.GossipSubHistoryGossip, pubsubBufferSize))) if err != nil { return nil, err } @@ -101,10 +103,7 @@ func (g *Gossiper) ProcessMessages(ctx context.Context) { return } if g.msgHandler != nil { - g.msgHandler(&GossipMessage{ - Data: msg.Data, - From: msg.GetFrom(), - }) + g.msgHandler(ctx, msg.Data) } } } diff --git a/p2p/gossiped_block.go b/p2p/gossiped_block.go deleted file mode 100644 index 7398299d0..000000000 --- a/p2p/gossiped_block.go +++ /dev/null @@ -1,74 +0,0 @@ -package p2p - -import ( - "github.com/dymensionxyz/dymint/p2p/pb" - "github.com/dymensionxyz/dymint/types" - tmtypes "github.com/tendermint/tendermint/types" -) - -/* -------------------------------------------------------------------------- */ -/* Event Data */ -/* -------------------------------------------------------------------------- */ - -// GossipedBlock defines the struct of the event data for the GossipedBlock -type GossipedBlock struct { - // Block is the block that was gossiped - Block types.Block - // Commit is the commit that was gossiped - Commit types.Commit -} - -// MarshalBinary encodes GossipedBlock into binary form and returns it. -func (e *GossipedBlock) MarshalBinary() ([]byte, error) { - return e.ToProto().Marshal() -} - -// UnmarshalBinary decodes binary form of GossipedBlock into object. -func (e *GossipedBlock) UnmarshalBinary(data []byte) error { - var pbGossipedBlock pb.GossipedBlock - err := pbGossipedBlock.Unmarshal(data) - if err != nil { - return err - } - err = e.FromProto(&pbGossipedBlock) - return err -} - -// ToProto converts Data into protobuf representation and returns it. -func (e *GossipedBlock) ToProto() *pb.GossipedBlock { - return &pb.GossipedBlock{ - Block: e.Block.ToProto(), - Commit: e.Commit.ToProto(), - } -} - -// FromProto fills GossipedBlock with data from its protobuf representation. -func (e *GossipedBlock) FromProto(other *pb.GossipedBlock) error { - if err := e.Block.FromProto(other.Block); err != nil { - return err - } - if err := e.Commit.FromProto(other.Commit); err != nil { - return err - } - return nil -} - -// Validate run basic validation on the gossiped block -func (e *GossipedBlock) Validate(proposer *types.Sequencer) error { - if err := e.Block.ValidateBasic(); err != nil { - return err - } - if err := e.Commit.ValidateBasic(); err != nil { - return err - } - if err := e.Commit.ValidateWithHeader(proposer, &e.Block.Header); err != nil { - return err - } - abciData := tmtypes.Data{ - Txs: types.ToABCIBlockDataTxs(&e.Block.Data), - } - if e.Block.Header.DataHash != [32]byte(abciData.Hash()) { - return types.ErrInvalidHeaderDataHash - } - return nil -} diff --git a/p2p/pb/gossiped_block.pb.go b/p2p/pb/blockdata.pb.go similarity index 56% rename from p2p/pb/gossiped_block.pb.go rename to p2p/pb/blockdata.pb.go index ebcd12548..23f78739c 100644 --- a/p2p/pb/gossiped_block.pb.go +++ b/p2p/pb/blockdata.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: p2p/gossiped_block.proto +// source: p2p/blockdata.proto package pb @@ -23,23 +23,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type GossipedBlock struct { +type BlockData struct { Block *dymint.Block `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` Commit *dymint.Commit `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` } -func (m *GossipedBlock) Reset() { *m = GossipedBlock{} } -func (m *GossipedBlock) String() string { return proto.CompactTextString(m) } -func (*GossipedBlock) ProtoMessage() {} -func (*GossipedBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_e39a70b849e02fbf, []int{0} +func (m *BlockData) Reset() { *m = BlockData{} } +func (m *BlockData) String() string { return proto.CompactTextString(m) } +func (*BlockData) ProtoMessage() {} +func (*BlockData) Descriptor() ([]byte, []int) { + return fileDescriptor_3cee9514a66baf30, []int{0} } -func (m *GossipedBlock) XXX_Unmarshal(b []byte) error { +func (m *BlockData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GossipedBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *BlockData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GossipedBlock.Marshal(b, m, deterministic) + return xxx_messageInfo_BlockData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -49,26 +49,26 @@ func (m *GossipedBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *GossipedBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_GossipedBlock.Merge(m, src) +func (m *BlockData) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockData.Merge(m, src) } -func (m *GossipedBlock) XXX_Size() int { +func (m *BlockData) XXX_Size() int { return m.Size() } -func (m *GossipedBlock) XXX_DiscardUnknown() { - xxx_messageInfo_GossipedBlock.DiscardUnknown(m) +func (m *BlockData) XXX_DiscardUnknown() { + xxx_messageInfo_BlockData.DiscardUnknown(m) } -var xxx_messageInfo_GossipedBlock proto.InternalMessageInfo +var xxx_messageInfo_BlockData proto.InternalMessageInfo -func (m *GossipedBlock) GetBlock() *dymint.Block { +func (m *BlockData) GetBlock() *dymint.Block { if m != nil { return m.Block } return nil } -func (m *GossipedBlock) GetCommit() *dymint.Commit { +func (m *BlockData) GetCommit() *dymint.Commit { if m != nil { return m.Commit } @@ -76,29 +76,29 @@ func (m *GossipedBlock) GetCommit() *dymint.Commit { } func init() { - proto.RegisterType((*GossipedBlock)(nil), "p2p.events.GossipedBlock") + proto.RegisterType((*BlockData)(nil), "p2p.events.BlockData") } -func init() { proto.RegisterFile("p2p/gossiped_block.proto", fileDescriptor_e39a70b849e02fbf) } +func init() { proto.RegisterFile("p2p/blockdata.proto", fileDescriptor_3cee9514a66baf30) } -var fileDescriptor_e39a70b849e02fbf = []byte{ - // 197 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x30, 0x2a, 0xd0, - 0x4f, 0xcf, 0x2f, 0x2e, 0xce, 0x2c, 0x48, 0x4d, 0x89, 0x4f, 0xca, 0xc9, 0x4f, 0xce, 0xd6, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x2a, 0x30, 0x2a, 0xd0, 0x4b, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, - 0x96, 0x92, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x4f, 0xa9, 0xcc, 0xcd, 0xcc, 0x2b, 0x81, 0x52, - 0x10, 0x65, 0x4a, 0x31, 0x5c, 0xbc, 0xee, 0x50, 0xed, 0x4e, 0x20, 0xdd, 0x42, 0xca, 0x5c, 0xac, - 0x60, 0x63, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x78, 0xf5, 0xa0, 0xca, 0xc1, 0xb2, 0x41, - 0x10, 0x39, 0x21, 0x35, 0x2e, 0xb6, 0xe4, 0xfc, 0xdc, 0xdc, 0xcc, 0x12, 0x09, 0x26, 0xb0, 0x2a, - 0x3e, 0x98, 0x2a, 0x67, 0xb0, 0x68, 0x10, 0x54, 0xd6, 0xc9, 0xfe, 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, 0x54, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, - 0x41, 0x0e, 0x4a, 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0xab, 0xa8, 0xac, 0x82, 0x39, 0x12, 0xe4, 0xaf, - 0x82, 0xa4, 0x24, 0x36, 0xb0, 0x2b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x0e, 0xf1, - 0x19, 0xe8, 0x00, 0x00, 0x00, +var fileDescriptor_3cee9514a66baf30 = []byte{ + // 193 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x30, 0x2a, 0xd0, + 0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x4e, 0x49, 0x2c, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0xe2, 0x2a, 0x30, 0x2a, 0xd0, 0x4b, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0x96, 0x92, 0x2c, 0xa9, 0x2c, + 0x48, 0x2d, 0xd6, 0x4f, 0xa9, 0xcc, 0xcd, 0xcc, 0x2b, 0x81, 0x52, 0x10, 0x65, 0x4a, 0x11, 0x5c, + 0x9c, 0x4e, 0x20, 0x9d, 0x2e, 0x89, 0x25, 0x89, 0x42, 0xca, 0x5c, 0xac, 0x60, 0x63, 0x24, 0x18, + 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x78, 0xf5, 0xa0, 0x4a, 0xc1, 0x2a, 0x82, 0x20, 0x72, 0x42, 0x6a, + 0x5c, 0x6c, 0xc9, 0xf9, 0xb9, 0xb9, 0x99, 0x25, 0x12, 0x4c, 0x60, 0x55, 0x7c, 0x30, 0x55, 0xce, + 0x60, 0xd1, 0x20, 0xa8, 0xac, 0x93, 0xfd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0xa9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0x82, 0x1c, 0x93, 0x9a, + 0x57, 0x9c, 0x99, 0x9f, 0x57, 0x51, 0x59, 0x05, 0x73, 0x20, 0xc8, 0x3b, 0x05, 0x49, 0x49, 0x6c, + 0x60, 0x17, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x81, 0x13, 0x29, 0x7e, 0xdf, 0x00, 0x00, + 0x00, } -func (m *GossipedBlock) Marshal() (dAtA []byte, err error) { +func (m *BlockData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -108,12 +108,12 @@ func (m *GossipedBlock) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GossipedBlock) MarshalTo(dAtA []byte) (int, error) { +func (m *BlockData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GossipedBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *BlockData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -125,7 +125,7 @@ func (m *GossipedBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintGossipedBlock(dAtA, i, uint64(size)) + i = encodeVarintBlockdata(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -137,7 +137,7 @@ func (m *GossipedBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintGossipedBlock(dAtA, i, uint64(size)) + i = encodeVarintBlockdata(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -145,8 +145,8 @@ func (m *GossipedBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintGossipedBlock(dAtA []byte, offset int, v uint64) int { - offset -= sovGossipedBlock(v) +func encodeVarintBlockdata(dAtA []byte, offset int, v uint64) int { + offset -= sovBlockdata(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -156,7 +156,7 @@ func encodeVarintGossipedBlock(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *GossipedBlock) Size() (n int) { +func (m *BlockData) Size() (n int) { if m == nil { return 0 } @@ -164,22 +164,22 @@ func (m *GossipedBlock) Size() (n int) { _ = l if m.Block != nil { l = m.Block.Size() - n += 1 + l + sovGossipedBlock(uint64(l)) + n += 1 + l + sovBlockdata(uint64(l)) } if m.Commit != nil { l = m.Commit.Size() - n += 1 + l + sovGossipedBlock(uint64(l)) + n += 1 + l + sovBlockdata(uint64(l)) } return n } -func sovGossipedBlock(x uint64) (n int) { +func sovBlockdata(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozGossipedBlock(x uint64) (n int) { - return sovGossipedBlock(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozBlockdata(x uint64) (n int) { + return sovBlockdata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *GossipedBlock) Unmarshal(dAtA []byte) error { +func (m *BlockData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -187,7 +187,7 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowGossipedBlock + return ErrIntOverflowBlockdata } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -202,10 +202,10 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GossipedBlock: wiretype end group for non-group") + return fmt.Errorf("proto: BlockData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GossipedBlock: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BlockData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -215,7 +215,7 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowGossipedBlock + return ErrIntOverflowBlockdata } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -228,11 +228,11 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthGossipedBlock + return ErrInvalidLengthBlockdata } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthGossipedBlock + return ErrInvalidLengthBlockdata } if postIndex > l { return io.ErrUnexpectedEOF @@ -251,7 +251,7 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowGossipedBlock + return ErrIntOverflowBlockdata } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -264,11 +264,11 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthGossipedBlock + return ErrInvalidLengthBlockdata } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthGossipedBlock + return ErrInvalidLengthBlockdata } if postIndex > l { return io.ErrUnexpectedEOF @@ -282,12 +282,12 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipGossipedBlock(dAtA[iNdEx:]) + skippy, err := skipBlockdata(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGossipedBlock + return ErrInvalidLengthBlockdata } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -301,7 +301,7 @@ func (m *GossipedBlock) Unmarshal(dAtA []byte) error { } return nil } -func skipGossipedBlock(dAtA []byte) (n int, err error) { +func skipBlockdata(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -309,7 +309,7 @@ func skipGossipedBlock(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowGossipedBlock + return 0, ErrIntOverflowBlockdata } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -326,7 +326,7 @@ func skipGossipedBlock(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowGossipedBlock + return 0, ErrIntOverflowBlockdata } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -342,7 +342,7 @@ func skipGossipedBlock(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowGossipedBlock + return 0, ErrIntOverflowBlockdata } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -355,14 +355,14 @@ func skipGossipedBlock(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthGossipedBlock + return 0, ErrInvalidLengthBlockdata } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGossipedBlock + return 0, ErrUnexpectedEndOfGroupBlockdata } depth-- case 5: @@ -371,7 +371,7 @@ func skipGossipedBlock(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthGossipedBlock + return 0, ErrInvalidLengthBlockdata } if depth == 0 { return iNdEx, nil @@ -381,7 +381,7 @@ func skipGossipedBlock(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthGossipedBlock = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGossipedBlock = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGossipedBlock = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthBlockdata = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBlockdata = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBlockdata = fmt.Errorf("proto: unexpected end of group") ) diff --git a/p2p/validator.go b/p2p/validator.go index ee25939fd..00ebcf302 100644 --- a/p2p/validator.go +++ b/p2p/validator.go @@ -5,12 +5,16 @@ import ( "github.com/dymensionxyz/dymint/mempool" nodemempool "github.com/dymensionxyz/dymint/node/mempool" - "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/types" abci "github.com/tendermint/tendermint/abci/types" + tmcrypto "github.com/tendermint/tendermint/crypto" corep2p "github.com/tendermint/tendermint/p2p" ) +type ProposerGetter interface { + GetProposerPubKey() tmcrypto.PubKey +} + // GossipValidator is a callback function type. type GossipValidator func(*GossipMessage) bool @@ -23,17 +27,17 @@ type IValidator interface { // Validator is a validator for messages gossiped in the p2p network. type Validator struct { - logger types.Logger - slClient settlement.ClientI + logger types.Logger + proposerGetter ProposerGetter } var _ IValidator = (*Validator)(nil) // NewValidator creates a new Validator. -func NewValidator(logger types.Logger, slClient settlement.ClientI) *Validator { +func NewValidator(logger types.Logger, blockmanager ProposerGetter) *Validator { return &Validator{ - logger: logger, - slClient: slClient, + logger: logger, + proposerGetter: blockmanager, } } @@ -71,12 +75,12 @@ func (v *Validator) TxValidator(mp mempool.Mempool, mpoolIDS *nodemempool.Mempoo // BlockValidator runs basic checks on the gossiped block func (v *Validator) BlockValidator() GossipValidator { return func(blockMsg *GossipMessage) bool { - var gossipedBlock GossipedBlock + var gossipedBlock BlockData if err := gossipedBlock.UnmarshalBinary(blockMsg.Data); err != nil { v.logger.Error("Deserialize gossiped block.", "error", err) return false } - if err := gossipedBlock.Validate(v.slClient.GetProposer()); err != nil { + if err := gossipedBlock.Validate(v.proposerGetter.GetProposerPubKey()); err != nil { v.logger.Error("Failed to validate gossiped block.", "height", gossipedBlock.Block.Header.Height, "error", err) return false } diff --git a/p2p/validator_test.go b/p2p/validator_test.go index 31da0b947..9c684eb74 100644 --- a/p2p/validator_test.go +++ b/p2p/validator_test.go @@ -1,10 +1,8 @@ package p2p_test import ( - "encoding/hex" "testing" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" mempoolv1 "github.com/dymensionxyz/dymint/mempool/v1" "github.com/dymensionxyz/dymint/types" @@ -12,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/libs/pubsub" "github.com/tendermint/tendermint/proxy" cfg "github.com/tendermint/tendermint/config" @@ -22,12 +20,11 @@ import ( "github.com/dymensionxyz/dymint/block" "github.com/dymensionxyz/dymint/mempool" + p2pmock "github.com/dymensionxyz/dymint/mocks/github.com/dymensionxyz/dymint/p2p" tmmocks "github.com/dymensionxyz/dymint/mocks/github.com/tendermint/tendermint/abci/types" nodemempool "github.com/dymensionxyz/dymint/node/mempool" "github.com/dymensionxyz/dymint/p2p" - "github.com/dymensionxyz/dymint/settlement" - "github.com/dymensionxyz/dymint/settlement/registry" ) func TestValidator_TxValidator(t *testing.T) { @@ -102,7 +99,7 @@ func TestValidator_BlockValidator(t *testing.T) { tests := []struct { name string - proposerKey *ed25519.PrivKey + proposerKey ed25519.PrivKey valid bool }{ { @@ -127,28 +124,22 @@ func TestValidator_BlockValidator(t *testing.T) { require.NoError(t, err) require.NotNil(t, clientCreator) require.NotNil(t, abciClient) - namespaceId := "0102030405060708" mpool := mempoolv1.NewTxMempool(logger, cfg.DefaultMempoolConfig(), proxy.NewAppConnMempool(abciClient), 0) - executor, err := block.NewExecutor([]byte("test address"), namespaceId, "test", mpool, proxy.NewAppConns(clientCreator), nil, logger) + executor, err := block.NewExecutor([]byte("test address"), "test", mpool, proxy.NewAppConns(clientCreator), nil, logger) assert.NoError(t, err) // Create state maxBytes := uint64(100) - state := types.State{} - state.ConsensusParams.Block.MaxBytes = int64(maxBytes) + state := &types.State{} + state.Sequencers.SetProposer(types.NewSequencerFromValidator(*tmtypes.NewValidator(proposerKey.PubKey(), 1))) state.ConsensusParams.Block.MaxGas = 100000 - state.Validators = tmtypes.NewValidatorSet(nil) + state.ConsensusParams.Block.MaxBytes = int64(maxBytes) // Create empty block - block := executor.CreateBlock(1, &types.Commit{}, [32]byte{}, &state, maxBytes) + block := executor.CreateBlock(1, &types.Commit{}, [32]byte{}, [32]byte(state.Sequencers.ProposerHash()), state, maxBytes) - // Create slclient - client := registry.GetClient(registry.Local) - pubsubServer := pubsub.NewServer() - err = pubsubServer.Start() - require.NoError(t, err) - err = client.Init(settlement.Config{ProposerPubKey: hex.EncodeToString(proposerKey.PubKey().Bytes())}, pubsubServer, log.TestingLogger()) - require.NoError(t, err) + getProposer := &p2pmock.MockGetProposerI{} + getProposer.On("GetProposerPubKey").Return(proposerKey.PubKey()) // Create commit for the block abciHeaderPb := types.ToABCIHeaderPB(&block.Header) @@ -169,7 +160,7 @@ func TestValidator_BlockValidator(t *testing.T) { } // Create gossiped block - gossipedBlock := p2p.GossipedBlock{Block: *block, Commit: *commit} + gossipedBlock := p2p.BlockData{Block: *block, Commit: *commit} gossipedBlockBytes, err := gossipedBlock.MarshalBinary() require.NoError(t, err) blockMsg := &p2p.GossipMessage{ @@ -178,7 +169,7 @@ func TestValidator_BlockValidator(t *testing.T) { } // Check block validity - validateBlock := p2p.NewValidator(logger, client).BlockValidator() + validateBlock := p2p.NewValidator(logger, getProposer).BlockValidator() valid := validateBlock(blockMsg) require.Equal(t, tt.valid, valid) }) diff --git a/proto/p2p/gossiped_block.proto b/proto/p2p/blockdata.proto similarity index 88% rename from proto/p2p/gossiped_block.proto rename to proto/p2p/blockdata.proto index e006b60e2..53480612a 100644 --- a/proto/p2p/gossiped_block.proto +++ b/proto/p2p/blockdata.proto @@ -5,7 +5,7 @@ option go_package = "github.com/dymensionxyz/dymint/p2p/pb"; import "types/dymint/dymint.proto"; -message GossipedBlock { +message BlockData { dymint.Block block = 1; dymint.Commit commit = 2; } diff --git a/proto/types/dymint/dymint.proto b/proto/types/dymint/dymint.proto index 625f63d95..80e733097 100755 --- a/proto/types/dymint/dymint.proto +++ b/proto/types/dymint/dymint.proto @@ -3,6 +3,7 @@ package dymint; option go_package = "github.com/dymensionxyz/dymint/types/pb/dymint"; import "types/tendermint/abci/types.proto"; import "types/tendermint/types/types.proto"; +import "types/tendermint/types/validator.proto"; // Version captures the consensus rules for processing a block in the blockchain, // including all blockchain data structures and the rules of the application's @@ -17,8 +18,8 @@ message Header { // Block and App version Version version = 1; // NamespaceID identifies this chain e.g. when connected to other rollups via IBC. - bytes namespace_id = 2; - + bytes namespace_id = 2 [deprecated=true]; + // Block height uint64 height = 3; @@ -52,8 +53,10 @@ message Header { // pubkey can't be recovered by the signature (e.g. ed25519). bytes proposer_address = 11; - // Hash of block sequencer set, at a time of block creation - bytes sequencers_hash = 12; + // Hash of proposer validatorSet (compatible with tendermint) + bytes sequencer_hash = 12; + // Hash of the next proposer validatorSet (compatible with tendermint) + bytes next_sequencer_hash = 14; // Chain ID the block belongs to string chain_id = 13; @@ -86,3 +89,13 @@ message Batch { repeated Commit commits = 4; } + +message Sequencer { + string settlement_address = 1; + tendermint.types.Validator validator = 2; +} + +message SequencerSet { + repeated Sequencer sequencers = 1; + Sequencer proposer = 2; +} \ No newline at end of file diff --git a/proto/types/dymint/state.proto b/proto/types/dymint/state.proto index b75f8187c..dc3b1bbf1 100755 --- a/proto/types/dymint/state.proto +++ b/proto/types/dymint/state.proto @@ -9,6 +9,7 @@ import "types/tendermint/types/types.proto"; import "types/tendermint/types/validator.proto"; import "types/tendermint/types/params.proto"; import "types/tendermint/state/types.proto"; +import "types/dymint/dymint.proto"; message State { @@ -23,11 +24,13 @@ message State { google.protobuf.Timestamp last_block_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; reserved 7; + reserved 8; + tendermint.types.ValidatorSet validators = 9 [deprecated = true]; + reserved 10; + - tendermint.types.ValidatorSet next_validators = 8; - tendermint.types.ValidatorSet validators = 9; - tendermint.types.ValidatorSet last_validators = 10; int64 last_height_validators_changed = 11; + tendermint.types.ConsensusParams consensus_params = 12 [(gogoproto.nullable) = false]; int64 last_height_consensus_params_changed = 13; @@ -38,4 +41,17 @@ message State { uint64 last_store_height = 16 [(gogoproto.customname) = "LastStoreHeight"]; uint64 base_height = 17; + + SequencerSet sequencerSet = 18 [(gogoproto.nullable) = false]; + RollappParams rollapp_params = 19 [(gogoproto.nullable) = false]; + } + +//rollapp params defined in genesis and updated via gov proposal +message RollappParams { + //data availability type (e.g. celestia) used in the rollapp + string da = 1 ; + //commit used for the rollapp executable + string version = 2 ; + +} \ No newline at end of file diff --git a/proto/types/tendermint/abci/types.proto b/proto/types/tendermint/abci/types.proto index a918e6a88..aa78e5f48 100755 --- a/proto/types/tendermint/abci/types.proto +++ b/proto/types/tendermint/abci/types.proto @@ -374,6 +374,7 @@ message Evidence { int64 total_voting_power = 5; } + //---------------------------------------- // State Sync Types diff --git a/proto/types/tendermint/types/params.proto b/proto/types/tendermint/types/params.proto index 0de7d846f..1af0c6ebe 100755 --- a/proto/types/tendermint/types/params.proto +++ b/proto/types/tendermint/types/params.proto @@ -78,3 +78,5 @@ message HashedParams { int64 block_max_bytes = 1; int64 block_max_gas = 2; } + + diff --git a/rpc/client/client.go b/rpc/client/client.go index 246109564..6fa48a6bb 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -7,12 +7,7 @@ import ( "sort" "time" - "github.com/dymensionxyz/dymint/types" - - "github.com/dymensionxyz/dymint/version" - sdkerrors "cosmossdk.io/errors" - abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/config" tmbytes "github.com/tendermint/tendermint/libs/bytes" @@ -29,6 +24,8 @@ import ( "github.com/dymensionxyz/dymint/mempool" "github.com/dymensionxyz/dymint/node" + "github.com/dymensionxyz/dymint/types" + "github.com/dymensionxyz/dymint/version" ) const ( @@ -50,8 +47,10 @@ var _ rpcclient.Client = &Client{} type Client struct { *tmtypes.EventBus config *config.RPCConfig + node *node.Node - node *node.Node + // cache of chunked genesis data. + genChunks []string } // NewClient returns Client working with given node. @@ -285,7 +284,7 @@ func (c *Client) Genesis(_ context.Context) (*ctypes.ResultGenesis, error) { // GenesisChunked returns given chunk of genesis. func (c *Client) GenesisChunked(context context.Context, id uint) (*ctypes.ResultGenesisChunk, error) { - genChunks, err := c.node.GetGenesisChunks() + genChunks, err := c.GetGenesisChunks() if err != nil { return nil, fmt.Errorf("while creating chunks of the genesis document: %w", err) } @@ -314,7 +313,7 @@ func (c *Client) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) const limit int64 = 20 minHeight, maxHeight, err := filterMinMax( - 0, // FIXME: we might be pruned + int64(c.node.BlockManager.State.BaseHeight), int64(c.node.GetBlockManagerHeight()), minHeight, maxHeight, @@ -509,12 +508,12 @@ func (c *Client) Commit(ctx context.Context, height *int64) (*ctypes.ResultCommi // Validators returns paginated list of validators at given height. func (c *Client) Validators(ctx context.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*ctypes.ResultValidators, error) { height := c.normalizeHeight(heightPtr) - validators, err := c.node.Store.LoadValidators(height) + sequencers, err := c.node.Store.LoadSequencers(height) if err != nil { return nil, fmt.Errorf("load validators for height %d: %w", height, err) } - totalCount := len(validators.Validators) + totalCount := len(sequencers.Sequencers) perPage := validatePerPage(perPagePtr) page, err := validatePage(pagePtr, perPage, totalCount) if err != nil { @@ -522,7 +521,17 @@ func (c *Client) Validators(ctx context.Context, heightPtr *int64, pagePtr, perP } skipCount := validateSkipCount(page, perPage) - v := validators.Validators[skipCount : skipCount+tmmath.MinInt(perPage, totalCount-skipCount)] + + var vals []*tmtypes.Validator + for _, s := range sequencers.Sequencers { + val, err := s.TMValidator() + if err != nil { + return nil, fmt.Errorf("convert sequencer to validator: %s :%w", s.SettlementAddress, err) + } + vals = append(vals, val) + } + + v := vals[skipCount : skipCount+tmmath.MinInt(perPage, totalCount-skipCount)] return &ctypes.ResultValidators{ BlockHeight: int64(height), Validators: v, @@ -708,15 +717,14 @@ func (c *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error) { latestHeight := latest.Header.Height latestBlockTimeNano := latest.Header.Time - validators, err := c.node.Store.LoadValidators(latest.Header.Height) + sequencers, err := c.node.Store.LoadSequencers(latest.Header.Height) if err != nil { return nil, fmt.Errorf("fetch the validator info at latest block: %w", err) } - _, validator := validators.GetByAddress(latest.Header.ProposerAddress) - if validator == nil { + proposer := sequencers.Proposer + if proposer == nil { return nil, fmt.Errorf("find proposer %s in the valSet", string(latest.Header.ProposerAddress)) } - state, err := c.node.Store.LoadState() if err != nil { return nil, fmt.Errorf("load the last saved state: %w", err) @@ -749,19 +757,20 @@ func (c *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error) { LatestAppHash: latestAppHash[:], LatestBlockHeight: int64(latestHeight), LatestBlockTime: time.Unix(0, int64(latestBlockTimeNano)), + // CatchingUp is true if the node is not at the latest height received from p2p or da. + CatchingUp: c.node.BlockManager.TargetHeight.Load() > latestHeight, // TODO(tzdybal): add missing fields // EarliestBlockHash: earliestBlockHash, // EarliestAppHash: earliestAppHash, // EarliestBlockHeight: earliestBloc // kHeight, // EarliestBlockTime: time.Unix(0, earliestBlockTimeNano), - // CatchingUp: env.ConsensusReactor.WaitSync(), }, // TODO(ItzhakBokris): update ValidatorInfo fields ValidatorInfo: ctypes.ValidatorInfo{ - Address: validator.Address, - PubKey: validator.PubKey, - VotingPower: validator.VotingPower, + Address: tmbytes.HexBytes(proposer.ConsAddress()), + PubKey: proposer.PubKey(), + VotingPower: 1, }, } return result, nil diff --git a/rpc/client/client_test.go b/rpc/client/client_test.go index 99e004970..aebc0957d 100644 --- a/rpc/client/client_test.go +++ b/rpc/client/client_test.go @@ -35,6 +35,7 @@ import ( "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/testutil" "github.com/dymensionxyz/dymint/types" + "github.com/dymensionxyz/dymint/version" ) var expectedInfo = abci.ResponseInfo{ @@ -82,16 +83,8 @@ func TestCheckTx(t *testing.T) { func TestGenesisChunked(t *testing.T) { assert := assert.New(t) - rollappID := "rollapp_1234-1" - - genDoc := &tmtypes.GenesisDoc{ - ChainID: rollappID, - InitialHeight: int64(1), - AppHash: []byte("test hash"), - Validators: []tmtypes.GenesisValidator{ - {Address: bytes.HexBytes{}, Name: "test", Power: 1, PubKey: ed25519.GenPrivKey().PubKey()}, - }, - } + + genDoc := testutil.GenerateGenesis(1) mockApp := &tmmocks.MockApplication{} mockApp.On("InitChain", mock.Anything).Return(abci.ResponseInitChain{}) @@ -103,24 +96,22 @@ func TestGenesisChunked(t *testing.T) { RootDir: "", DBPath: "", P2PConfig: config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - BootstrapNodes: "", - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, + ListenAddress: config.DefaultListenAddress, + BootstrapNodes: "", + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, }, RPC: config.RPCConfig{}, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 1000, - MaxSupportedBatchSkew: 10, - }, - DALayer: "mock", - DAConfig: "", - SettlementLayer: "mock", - SettlementConfig: settlement.Config{ - RollappID: rollappID, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, }, + DAConfig: "", + SettlementLayer: "mock", + SettlementConfig: settlement.Config{}, } n, err := node.NewNode( context.Background(), @@ -452,7 +443,18 @@ func TestTx(t *testing.T) { require.NotNil(rpc) mockApp.On("BeginBlock", mock.Anything).Return(abci.ResponseBeginBlock{}) - mockApp.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}) + mockApp.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 100, + MaxBytes: 100, + }, + }, + }) mockApp.On("Commit", mock.Anything).Return(abci.ResponseCommit{}) mockApp.On("DeliverTx", mock.Anything).Return(abci.ResponseDeliverTx{}) mockApp.On("CheckTx", mock.Anything).Return(abci.ResponseCheckTx{}) @@ -662,6 +664,7 @@ func TestBlockchainInfo(t *testing.T) { } } +// TestValidatorSetHandling tests that EndBlock updates are ignored and the validator set is fetched from the state func TestValidatorSetHandling(t *testing.T) { assert := assert.New(t) require := require.New(t) @@ -669,7 +672,6 @@ func TestValidatorSetHandling(t *testing.T) { app.On("InitChain", mock.Anything).Return(abci.ResponseInitChain{}) app.On("CheckTx", mock.Anything).Return(abci.ResponseCheckTx{}) app.On("BeginBlock", mock.Anything).Return(abci.ResponseBeginBlock{}) - app.On("Commit", mock.Anything).Return(abci.ResponseCommit{}) app.On("Info", mock.Anything).Return(abci.ResponseInfo{LastBlockHeight: 0, LastBlockAppHash: []byte{0}}) key, _, _ := crypto.GenerateEd25519Key(crand.Reader) @@ -686,38 +688,35 @@ func TestValidatorSetHandling(t *testing.T) { genesisValidators[i] = tmtypes.GenesisValidator{Address: vKeys[i].PubKey().Address(), PubKey: vKeys[i].PubKey(), Power: int64(i + 100), Name: "one"} } + // dummy pubkey, we don't care about the actual key pbValKey, err := encoding.PubKeyToProto(vKeys[0].PubKey()) require.NoError(err) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{{PubKey: pbValKey, Power: 100}}}) waitCh := make(chan interface{}) - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}).Times(2) - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{{PubKey: pbValKey, Power: 0}}}).Once() - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}).Once() - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{{PubKey: pbValKey, Power: 100}}}).Once() - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}).Run(func(args mock.Arguments) { + app.On("Commit", mock.Anything).Return(abci.ResponseCommit{}).Times(5) + app.On("Commit", mock.Anything).Return(abci.ResponseCommit{}).Run(func(args mock.Arguments) { waitCh <- nil }) - rollappID := "rollapp_1234-1" nodeConfig := config.NodeConfig{ - DALayer: "mock", SettlementLayer: "mock", P2PConfig: config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - BootstrapNodes: "", - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, + ListenAddress: config.DefaultListenAddress, + BootstrapNodes: "", + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, }, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 10 * time.Millisecond, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 1000, - MaxSupportedBatchSkew: 10, + BlockTime: 10 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, }, SettlementConfig: settlement.Config{ ProposerPubKey: hex.EncodeToString(proposerPubKeyBytes), - RollappID: rollappID, }, } @@ -727,7 +726,7 @@ func TestValidatorSetHandling(t *testing.T) { key, signingKey, proxy.NewLocalClientCreator(app), - &tmtypes.GenesisDoc{ChainID: rollappID}, + testutil.GenerateGenesis(0), log.TestingLogger(), mempool.NopMetrics(), ) @@ -740,7 +739,10 @@ func TestValidatorSetHandling(t *testing.T) { err = node.Start() require.NoError(err) - <-waitCh + defer node.Stop() + + <-waitCh // triggered on the 6th commit + time.Sleep(300 * time.Millisecond) // give time for the sequencers commit to db // validator set isn't updated through ABCI anymore for h := int64(1); h <= 5; h++ { @@ -855,31 +857,28 @@ func getRPCInternal(t *testing.T, sequencer bool) (*tmmocks.MockApplication, *cl localKey = slSeqKey } - rollappID := "rollapp_1234-1" - config := config.NodeConfig{ RootDir: "", DBPath: "", P2PConfig: config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - BootstrapNodes: "", - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, + ListenAddress: config.DefaultListenAddress, + BootstrapNodes: "", + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, }, RPC: config.RPCConfig{}, MempoolConfig: *tmcfg.DefaultMempoolConfig(), BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 1000, - MaxSupportedBatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, }, - DALayer: "mock", DAConfig: "", SettlementLayer: "mock", SettlementConfig: settlement.Config{ ProposerPubKey: proposerKey, - RollappID: rollappID, }, } node, err := node.NewNode( @@ -888,7 +887,7 @@ func getRPCInternal(t *testing.T, sequencer bool) (*tmmocks.MockApplication, *cl key, localKey, // this is where sequencer mode is set. if same key as in settlement.Config, it's sequencer proxy.NewLocalClientCreator(app), - &tmtypes.GenesisDoc{ChainID: rollappID}, + testutil.GenerateGenesis(0), log.TestingLogger(), mempool.NopMetrics(), ) @@ -962,53 +961,50 @@ func TestMempool2Nodes(t *testing.T) { id1, err := peer.IDFromPrivateKey(key1) require.NoError(err) - rollappID := "rollapp_1234-1" - + genesis := testutil.GenerateGenesis(0) node1, err := node.NewNode(context.Background(), config.NodeConfig{ - DALayer: "mock", SettlementLayer: "mock", SettlementConfig: settlement.Config{ ProposerPubKey: hex.EncodeToString(proposerPK), - RollappID: rollappID, }, P2PConfig: config.P2PConfig{ - ListenAddress: "/ip4/127.0.0.1/tcp/9001", - BootstrapNodes: "", - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, + ListenAddress: "/ip4/127.0.0.1/tcp/9001", + BootstrapNodes: "", + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, }, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 1000, - MaxSupportedBatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, }, MempoolConfig: *tmcfg.DefaultMempoolConfig(), - }, key1, signingKey1, proxy.NewLocalClientCreator(app), &tmtypes.GenesisDoc{ChainID: rollappID}, log.TestingLogger(), mempool.NopMetrics()) + }, key1, signingKey1, proxy.NewLocalClientCreator(app), genesis, log.TestingLogger(), mempool.NopMetrics()) require.NoError(err) require.NotNil(node1) node2, err := node.NewNode(context.Background(), config.NodeConfig{ - DALayer: "mock", SettlementLayer: "mock", SettlementConfig: settlement.Config{ ProposerPubKey: hex.EncodeToString(proposerPK), - RollappID: rollappID, }, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 1000, - MaxSupportedBatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, }, P2PConfig: config.P2PConfig{ - ListenAddress: "/ip4/127.0.0.1/tcp/9002", - BootstrapNodes: "/ip4/127.0.0.1/tcp/9001/p2p/" + id1.String(), - BootstrapRetryTime: 30 * time.Second, - GossipedBlocksCacheSize: 50, + ListenAddress: "/ip4/127.0.0.1/tcp/9002", + BootstrapNodes: "/ip4/127.0.0.1/tcp/9001/p2p/" + id1.String(), + BootstrapRetryTime: 30 * time.Second, + GossipSubCacheSize: 50, + BlockSyncRequestIntervalTime: 30 * time.Second, }, MempoolConfig: *tmcfg.DefaultMempoolConfig(), - }, key2, signingKey2, proxy.NewLocalClientCreator(app), &tmtypes.GenesisDoc{ChainID: rollappID}, log.TestingLogger(), mempool.NopMetrics()) + }, key2, signingKey2, proxy.NewLocalClientCreator(app), genesis, log.TestingLogger(), mempool.NopMetrics()) require.NoError(err) require.NotNil(node1) diff --git a/rpc/client/utils.go b/rpc/client/utils.go new file mode 100644 index 000000000..894c60547 --- /dev/null +++ b/rpc/client/utils.go @@ -0,0 +1,48 @@ +package client + +import ( + "encoding/base64" + "encoding/json" + + tmtypes "github.com/tendermint/tendermint/types" +) + +const ( + // genesisChunkSize is the maximum size, in bytes, of each + // chunk in the genesis structure for the chunked API + genesisChunkSize = 16 * 1024 * 1024 // 16 MiB +) + +// GetGenesisChunks returns chunked version of genesis. +func (c *Client) GetGenesisChunks() ([]string, error) { + if c.genChunks != nil { + return c.genChunks, nil + } + + err := c.initGenesisChunks(c.node.GetGenesis()) + if err != nil { + return nil, err + } + return c.genChunks, err +} + +// initGenesisChunks creates a chunked format of the genesis document to make it easier to +// iterate through larger genesis structures. +func (c *Client) initGenesisChunks(genesis *tmtypes.GenesisDoc) error { + if genesis == nil { + return nil + } + + data, err := json.Marshal(genesis) + if err != nil { + return err + } + + for i := 0; i < len(data); i += genesisChunkSize { + end := i + genesisChunkSize + end = min(end, len(data)) + c.genChunks = append(c.genChunks, base64.StdEncoding.EncodeToString(data[i:end])) + } + + return nil +} diff --git a/rpc/json/service_test.go b/rpc/json/service_test.go index 397c485da..d9c967fab 100644 --- a/rpc/json/service_test.go +++ b/rpc/json/service_test.go @@ -32,6 +32,7 @@ import ( "github.com/dymensionxyz/dymint/node" "github.com/dymensionxyz/dymint/rpc/client" "github.com/dymensionxyz/dymint/settlement" + "github.com/dymensionxyz/dymint/version" ) func TestHandlerMapping(t *testing.T) { @@ -279,7 +280,18 @@ func getRPC(t *testing.T) (*tmmocks.MockApplication, *client.Client) { app := &tmmocks.MockApplication{} app.On("InitChain", mock.Anything).Return(abci.ResponseInitChain{}) app.On("BeginBlock", mock.Anything).Return(abci.ResponseBeginBlock{}) - app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}) + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "mock", + Version: version.Commit, + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 100, + MaxBytes: 100, + }, + }, + }) app.On("Commit", mock.Anything).Return(abci.ResponseCommit{}) app.On("CheckTx", mock.Anything).Return(abci.ResponseCheckTx{ GasWanted: 1000, @@ -300,23 +312,22 @@ func getRPC(t *testing.T) (*tmmocks.MockApplication, *client.Client) { rollappID := "rollapp_1234-1" config := config.NodeConfig{ - DALayer: "mock", SettlementLayer: "mock", + SettlementLayer: "mock", BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 1 * time.Second, - MaxIdleTime: 0, - MaxSupportedBatchSkew: 10, - BatchSubmitMaxTime: 30 * time.Minute, - NamespaceID: "0102030405060708", - BlockBatchMaxSizeBytes: 1000, + BlockTime: 1 * time.Second, + MaxIdleTime: 0, + BatchSkew: 10, + BatchSubmitTime: 30 * time.Minute, + BatchSubmitBytes: 1000, }, SettlementConfig: settlement.Config{ ProposerPubKey: hex.EncodeToString(proposerPubKeyBytes), - RollappID: rollappID, }, P2PConfig: config.P2PConfig{ - ListenAddress: config.DefaultListenAddress, - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, + ListenAddress: config.DefaultListenAddress, + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, }, } node, err := node.NewNode( @@ -325,7 +336,7 @@ func getRPC(t *testing.T) (*tmmocks.MockApplication, *client.Client) { key, signingKey, proxy.NewLocalClientCreator(app), - &types.GenesisDoc{ChainID: rollappID}, + &types.GenesisDoc{ChainID: rollappID, AppState: []byte("{\"rollappparams\": {\"params\": {\"da\": \"mock\",\"version\": \"" + version.Commit + "\"}}}")}, log.TestingLogger(), mempool.NopMetrics(), ) diff --git a/rpc/json/ws.go b/rpc/json/ws.go index d9b194ccb..a086ba980 100644 --- a/rpc/json/ws.go +++ b/rpc/json/ws.go @@ -8,7 +8,6 @@ import ( "time" "github.com/gorilla/websocket" - tmpubsub "github.com/tendermint/tendermint/libs/pubsub" "github.com/dymensionxyz/dymint/types" @@ -79,13 +78,13 @@ func (h *handler) wsHandler(w http.ResponseWriter, r *http.Request) { if err != nil { if _, ok := err.(*websocket.CloseError); ok { h.logger.Debug("WebSocket connection closed", "reason", err) - err := h.srv.client.EventBus.UnsubscribeAll(r.Context(), remoteAddr) - if err != nil && !errors.Is(err, tmpubsub.ErrSubscriptionNotFound) { - h.logger.Error("unsubscribe addr from events", "addr", remoteAddr, "err", err) - } } else { h.logger.Error("read next WebSocket message", "error", err) } + err := h.srv.client.EventBus.UnsubscribeAll(r.Context(), remoteAddr) + if err != nil && !errors.Is(err, tmpubsub.ErrSubscriptionNotFound) { + h.logger.Error("unsubscribe addr from events", "addr", remoteAddr, "err", err) + } break } diff --git a/rpc/json/ws_test.go b/rpc/json/ws_test.go index ad9223223..78a028cb8 100644 --- a/rpc/json/ws_test.go +++ b/rpc/json/ws_test.go @@ -37,14 +37,15 @@ func TestWebSockets(t *testing.T) { conn, resp, err := websocket.DefaultDialer.Dial(strings.Replace(srv.URL, "http://", "ws://", 1)+"/websocket", nil) require.NoError(err) - require.NotNil(resp) - require.NotNil(conn) defer func() { _ = conn.Close() }() - assert.Equal(http.StatusSwitchingProtocols, resp.StatusCode) - + require.NotNil(resp) + require.NotNil(conn) + require.Equal(http.StatusSwitchingProtocols, resp.StatusCode) + err = conn.SetReadDeadline(time.Now().Add(300 * time.Second)) + require.NoError(err) err = conn.WriteMessage(websocket.TextMessage, []byte(` { "jsonrpc": "2.0", @@ -55,26 +56,23 @@ func TestWebSockets(t *testing.T) { } } `)) - assert.NoError(err) + require.NoError(err) - err = conn.SetReadDeadline(time.Now().Add(3 * time.Second)) - assert.NoError(err) typ, msg, err := conn.ReadMessage() - assert.NoError(err) - assert.Equal(websocket.TextMessage, typ) - assert.NotEmpty(msg) + require.NoError(err) + require.Equal(websocket.TextMessage, typ) + require.NotEmpty(msg) // wait for new block event - err = conn.SetReadDeadline(time.Now().Add(3 * time.Second)) - assert.NoError(err) + time.Sleep(5 * time.Second) typ, msg, err = conn.ReadMessage() - assert.NoError(err) - assert.Equal(websocket.TextMessage, typ) - assert.NotEmpty(msg) + require.NoError(err) + require.Equal(websocket.TextMessage, typ) + require.NotEmpty(msg) var responsePayload rpctypes.RPCResponse err = json.Unmarshal(msg, &responsePayload) - assert.NoError(err) - assert.Equal(rpctypes.JSONRPCIntID(7), responsePayload.ID) + require.NoError(err) + require.Equal(rpctypes.JSONRPCIntID(7), responsePayload.ID) var m map[string]interface{} err = json.Unmarshal([]byte(responsePayload.Result), &m) require.NoError(err) @@ -113,6 +111,7 @@ func TestWebsocketCloseUnsubscribe(t *testing.T) { _, local := getRPC(t) handler, err := GetHTTPHandler(local, log.TestingLogger()) require.NoError(err) + defer local.Stop() srv := httptest.NewServer(handler) diff --git a/settlement/config.go b/settlement/config.go index 628a149c3..3f01909e0 100644 --- a/settlement/config.go +++ b/settlement/config.go @@ -11,7 +11,6 @@ type Config struct { NodeAddress string `mapstructure:"settlement_node_address"` KeyringHomeDir string `mapstructure:"keyring_home_dir"` DymAccountName string `mapstructure:"dym_account_name"` - RollappID string `mapstructure:"rollapp_id"` GasLimit uint64 `mapstructure:"settlement_gas_limit"` GasPrices string `mapstructure:"settlement_gas_prices"` GasFees string `mapstructure:"settlement_gas_fees"` @@ -41,9 +40,5 @@ func (c Config) Validate() error { return errors.New("must provide either fees or gas prices") } - if c.RollappID == "" { - return errors.New("must provide rollapp id") - } - return nil } diff --git a/settlement/dymension/cosmosclient.go b/settlement/dymension/cosmosclient.go index ee23068d4..346938466 100644 --- a/settlement/dymension/cosmosclient.go +++ b/settlement/dymension/cosmosclient.go @@ -9,8 +9,8 @@ import ( sdkclient "github.com/cosmos/cosmos-sdk/client" sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/dymensionxyz/cosmosclient/cosmosclient" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" - sequencertypes "github.com/dymensionxyz/dymension/v3/x/sequencer/types" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" + sequencertypes "github.com/dymensionxyz/dymint/third_party/dymension/sequencer/types" "github.com/dymensionxyz/gerr-cosmos/gerrc" "github.com/ignite/cli/ignite/pkg/cosmosaccount" ctypes "github.com/tendermint/tendermint/rpc/core/types" @@ -26,6 +26,7 @@ type CosmosClient interface { StopEventListener() error EventListenerQuit() <-chan struct{} SubscribeToEvents(ctx context.Context, subscriber string, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error) + UnsubscribeAll(ctx context.Context, subscriber string) error BroadcastTx(accountName string, msgs ...sdktypes.Msg) (cosmosclient.Response, error) GetRollappClient() rollapptypes.QueryClient GetSequencerClient() sequencertypes.QueryClient @@ -44,19 +45,23 @@ func NewCosmosClient(client cosmosclient.Client) CosmosClient { } func (c *cosmosClient) StartEventListener() error { - return c.Client.RPC.WSEvents.Start() + return c.Client.RPC.Start() } func (c *cosmosClient) StopEventListener() error { - return c.Client.RPC.WSEvents.Stop() + return c.Client.RPC.Stop() } func (c *cosmosClient) EventListenerQuit() <-chan struct{} { - return c.Client.RPC.GetWSClient().Quit() + return c.Client.RPC.Quit() } func (c *cosmosClient) SubscribeToEvents(ctx context.Context, subscriber string, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error) { - return c.Client.RPC.WSEvents.Subscribe(ctx, subscriber, query, outCapacity...) + return c.Client.WSEvents.Subscribe(ctx, subscriber, query, outCapacity...) +} + +func (c *cosmosClient) UnsubscribeAll(ctx context.Context, subscriber string) error { + return c.Client.WSEvents.UnsubscribeAll(ctx, subscriber) } func (c *cosmosClient) GetRollappClient() rollapptypes.QueryClient { diff --git a/settlement/dymension/dymension.go b/settlement/dymension/dymension.go index ad798f091..a5ee24adf 100644 --- a/settlement/dymension/dymension.go +++ b/settlement/dymension/dymension.go @@ -4,43 +4,33 @@ import ( "context" "errors" "fmt" + "slices" + "strconv" "strings" "time" - uevent "github.com/dymensionxyz/dymint/utils/event" - "github.com/dymensionxyz/gerr-cosmos/gerrc" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "github.com/avast/retry-go/v4" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/dymensionxyz/cosmosclient/cosmosclient" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" + sequencertypes "github.com/dymensionxyz/dymint/third_party/dymension/sequencer/types" + "github.com/dymensionxyz/gerr-cosmos/gerrc" "github.com/google/uuid" "github.com/ignite/cli/ignite/pkg/cosmosaccount" + "github.com/tendermint/tendermint/libs/pubsub" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sequencertypes "github.com/dymensionxyz/dymension/v3/x/sequencer/types" "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/types" - "github.com/tendermint/tendermint/libs/pubsub" - ctypes "github.com/tendermint/tendermint/rpc/core/types" -) - -const ( - addressPrefix = "dym" - dymRollappVersion = 0 - defaultGasLimit = 300000 ) const ( - eventStateUpdate = "state_update.rollapp_id='%s' AND state_update.status='PENDING'" - eventSequencersListUpdate = "sequencers_list_update.rollapp_id='%s'" + addressPrefix = "dym" ) const ( @@ -50,16 +40,15 @@ const ( // Client is the client for the Dymension Hub. type Client struct { config *settlement.Config + rollappId string logger types.Logger pubsub *pubsub.Server cosmosClient CosmosClient ctx context.Context - cancel context.CancelFunc rollappQueryClient rollapptypes.QueryClient sequencerQueryClient sequencertypes.QueryClient protoCodec *codec.ProtoCodec - eventMap map[string]string - sequencerList []*types.Sequencer + proposer types.Sequencer retryAttempts uint retryMinDelay time.Duration retryMaxDelay time.Duration @@ -70,23 +59,16 @@ type Client struct { var _ settlement.ClientI = &Client{} // Init is called once. it initializes the struct members. -func (c *Client) Init(config settlement.Config, pubsub *pubsub.Server, logger types.Logger, options ...settlement.Option) error { - ctx, cancel := context.WithCancel(context.Background()) - eventMap := map[string]string{ - fmt.Sprintf(eventStateUpdate, config.RollappID): settlement.EventNewBatchAccepted, - fmt.Sprintf(eventSequencersListUpdate, config.RollappID): settlement.EventSequencersListUpdated, - } - +func (c *Client) Init(config settlement.Config, rollappId string, pubsub *pubsub.Server, logger types.Logger, options ...settlement.Option) error { interfaceRegistry := cdctypes.NewInterfaceRegistry() cryptocodec.RegisterInterfaces(interfaceRegistry) protoCodec := codec.NewProtoCodec(interfaceRegistry) + c.rollappId = rollappId c.config = &config c.logger = logger c.pubsub = pubsub - c.ctx = ctx - c.cancel = cancel - c.eventMap = eventMap + c.ctx = context.Background() c.protoCodec = protoCodec c.retryAttempts = config.RetryAttempts c.batchAcceptanceTimeout = config.BatchAcceptanceTimeout @@ -101,7 +83,6 @@ func (c *Client) Init(config settlement.Config, pubsub *pubsub.Server, logger ty if c.cosmosClient == nil { client, err := cosmosclient.New( - ctx, getCosmosClientOptions(&config)..., ) if err != nil { @@ -127,13 +108,7 @@ func (c *Client) Start() error { // Stop stops the HubClient. func (c *Client) Stop() error { - c.cancel() - err := c.cosmosClient.StopEventListener() - if err != nil { - return err - } - - return nil + return c.cosmosClient.StopEventListener() } // SubmitBatch posts a batch to the Dymension Hub. it tries to post the batch until it is accepted by the settlement layer. @@ -145,30 +120,30 @@ func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *d } // TODO: probably should be changed to be a channel, as the eventHandler is also in the HubClient in he produces the event - postBatchSubscriberClient := fmt.Sprintf("%s-%d-%s", postBatchSubscriberPrefix, batch.StartHeight, uuid.New().String()) + postBatchSubscriberClient := fmt.Sprintf("%s-%d-%s", postBatchSubscriberPrefix, batch.StartHeight(), uuid.New().String()) subscription, err := c.pubsub.Subscribe(c.ctx, postBatchSubscriberClient, settlement.EventQueryNewSettlementBatchAccepted, 1000) if err != nil { return fmt.Errorf("pub sub subscribe to settlement state updates: %w", err) } //nolint:errcheck - defer c.pubsub.Unsubscribe(c.ctx, postBatchSubscriberClient, settlement.EventQueryNewSettlementBatchAccepted) + defer c.pubsub.UnsubscribeAll(c.ctx, postBatchSubscriberClient) for { // broadcast loop: broadcast the transaction to the blockchain (with infinite retries). err := c.RunWithRetryInfinitely(func() error { err := c.broadcastBatch(msgUpdateState) if err != nil { - if errors.Is(err, gerrc.ErrAlreadyExist) { + if errors.Is(err, gerrc.ErrAlreadyExists) { return retry.Unrecoverable(err) } c.logger.Error( "Submit batch", "startHeight", - batch.StartHeight, + batch.StartHeight(), "endHeight", - batch.EndHeight, + batch.EndHeight(), "error", err, ) @@ -177,8 +152,8 @@ func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *d }) if err != nil { // this could happen if we timed-out waiting for acceptance in the previous iteration, but the batch was indeed submitted - if errors.Is(err, gerrc.ErrAlreadyExist) { - c.logger.Debug("Batch already accepted", "startHeight", batch.StartHeight, "endHeight", batch.EndHeight) + if errors.Is(err, gerrc.ErrAlreadyExists) { + c.logger.Debug("Batch already accepted", "startHeight", batch.StartHeight(), "endHeight", batch.EndHeight()) return nil } return fmt.Errorf("broadcast batch: %w", err) @@ -199,16 +174,16 @@ func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *d case event := <-subscription.Out(): eventData, _ := event.Data().(*settlement.EventDataNewBatchAccepted) - if eventData.EndHeight != batch.EndHeight { + if eventData.EndHeight != batch.EndHeight() { c.logger.Debug("Received event for a different batch, ignoring.", "event", eventData) continue // continue waiting for acceptance of the current batch } - c.logger.Info("Batch accepted.", "startHeight", batch.StartHeight, "endHeight", batch.EndHeight, "stateIndex", eventData.StateIndex) + c.logger.Info("Batch accepted.", "startHeight", batch.StartHeight(), "endHeight", batch.EndHeight(), "stateIndex", eventData.StateIndex, "dapath", msgUpdateState.DAPath) return nil case <-timer.C: // Check if the batch was accepted by the settlement layer, and we've just missed the event. - includedBatch, err := c.pollForBatchInclusion(batch.EndHeight) + includedBatch, err := c.pollForBatchInclusion(batch.EndHeight()) timer.Reset(c.batchAcceptanceTimeout) // no error, but still not included if err == nil && !includedBatch { @@ -219,9 +194,9 @@ func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *d c.logger.Error( "Timed out waiting for batch inclusion on settlement layer", "startHeight", - batch.StartHeight, + batch.StartHeight(), "endHeight", - batch.EndHeight, + batch.EndHeight(), ) break // breaks the switch case, and goes back to the broadcast loop } @@ -229,16 +204,16 @@ func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *d c.logger.Error( "Wait for batch inclusion", "startHeight", - batch.StartHeight, + batch.StartHeight(), "endHeight", - batch.EndHeight, + batch.EndHeight(), "error", err, ) continue // continue waiting for acceptance of the current batch } // all good - c.logger.Info("Batch accepted", "startHeight", batch.StartHeight, "endHeight", batch.EndHeight) + c.logger.Info("Batch accepted", "startHeight", batch.StartHeight(), "endHeight", batch.EndHeight()) return nil } break // failed waiting for acceptance. broadcast the batch again @@ -247,7 +222,7 @@ func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *d } func (c *Client) getStateInfo(index, height *uint64) (res *rollapptypes.QueryGetStateInfoResponse, err error) { - req := &rollapptypes.QueryGetStateInfoRequest{RollappId: c.config.RollappID} + req := &rollapptypes.QueryGetStateInfoRequest{RollappId: c.rollappId} if index != nil { req.Index = *index } @@ -258,12 +233,12 @@ func (c *Client) getStateInfo(index, height *uint64) (res *rollapptypes.QueryGet res, err = c.rollappQueryClient.StateInfo(c.ctx, req) if status.Code(err) == codes.NotFound { - return retry.Unrecoverable(gerrc.ErrNotFound) + return retry.Unrecoverable(errors.Join(gerrc.ErrNotFound, err)) } return err }) if err != nil { - return nil, fmt.Errorf("query state info: %w: %w", gerrc.ErrUnknown, err) + return nil, fmt.Errorf("query state info: %w", err) } if res == nil { // not supposed to happen return nil, fmt.Errorf("empty response with nil err: %w", gerrc.ErrUnknown) @@ -304,33 +279,114 @@ func (c *Client) GetHeightState(h uint64) (*settlement.ResultGetHeightState, err // GetProposer implements settlement.ClientI. func (c *Client) GetProposer() *types.Sequencer { - seqs, err := c.GetSequencers() + // return cached proposer + if !c.proposer.IsEmpty() { + return &c.proposer + } + + seqs, err := c.GetBondedSequencers() if err != nil { - c.logger.Error("Get sequencers", "error", err) + c.logger.Error("GetBondedSequencers", "error", err) return nil } - for _, sequencer := range seqs { - if sequencer.Status == types.Proposer { - return sequencer + + var proposerAddr string + err = c.RunWithRetry(func() error { + reqProposer := &sequencertypes.QueryGetProposerByRollappRequest{ + RollappId: c.rollappId, + } + res, err := c.sequencerQueryClient.GetProposerByRollapp(c.ctx, reqProposer) + if err == nil { + proposerAddr = res.ProposerAddr + return nil + } + if status.Code(err) == codes.NotFound { + return nil } + return err + }) + if err != nil { + c.logger.Error("GetProposer", "error", err) + return nil } - return nil + + // find the sequencer with the proposer address + index := slices.IndexFunc(seqs, func(seq types.Sequencer) bool { + return seq.SettlementAddress == proposerAddr + }) + // will return nil if the proposer is not set + if index == -1 { + return nil + } + c.proposer = seqs[index] + return &seqs[index] } -// GetSequencers returns the bonded sequencers of the given rollapp. -func (c *Client) GetSequencers() ([]*types.Sequencer, error) { - if c.sequencerList != nil { - return c.sequencerList, nil +// GetAllSequencers returns all sequencers of the given rollapp. +func (c *Client) GetAllSequencers() ([]types.Sequencer, error) { + var res *sequencertypes.QueryGetSequencersByRollappResponse + req := &sequencertypes.QueryGetSequencersByRollappRequest{ + RollappId: c.rollappId, } + err := c.RunWithRetry(func() error { + var err error + res, err = c.sequencerQueryClient.SequencersByRollapp(c.ctx, req) + if err == nil { + return nil + } + + if status.Code(err) == codes.NotFound { + return retry.Unrecoverable(errors.Join(gerrc.ErrNotFound, err)) + } + return err + }) + if err != nil { + return nil, err + } + + // not supposed to happen, but just in case + if res == nil { + return nil, fmt.Errorf("empty response: %w", gerrc.ErrUnknown) + } + + var sequencerList []types.Sequencer + for _, sequencer := range res.Sequencers { + var pubKey cryptotypes.PubKey + err := c.protoCodec.UnpackAny(sequencer.DymintPubKey, &pubKey) + if err != nil { + return nil, err + } + + tmPubKey, err := cryptocodec.ToTmPubKeyInterface(pubKey) + if err != nil { + return nil, err + } + + sequencerList = append(sequencerList, *types.NewSequencer(tmPubKey, sequencer.Address)) + } + + return sequencerList, nil +} + +// GetBondedSequencers returns the bonded sequencers of the given rollapp. +func (c *Client) GetBondedSequencers() ([]types.Sequencer, error) { var res *sequencertypes.QueryGetSequencersByRollappByStatusResponse req := &sequencertypes.QueryGetSequencersByRollappByStatusRequest{ - RollappId: c.config.RollappID, + RollappId: c.rollappId, Status: sequencertypes.Bonded, } + err := c.RunWithRetry(func() error { var err error res, err = c.sequencerQueryClient.SequencersByRollappByStatus(c.ctx, req) + if err == nil { + return nil + } + + if status.Code(err) == codes.NotFound { + return retry.Unrecoverable(errors.Join(gerrc.ErrNotFound, err)) + } return err }) if err != nil { @@ -342,7 +398,7 @@ func (c *Client) GetSequencers() ([]*types.Sequencer, error) { return nil, fmt.Errorf("empty response: %w", gerrc.ErrUnknown) } - sequencersList := make([]*types.Sequencer, 0, len(res.Sequencers)) + var sequencerList []types.Sequencer for _, sequencer := range res.Sequencers { var pubKey cryptotypes.PubKey err := c.protoCodec.UnpackAny(sequencer.DymintPubKey, &pubKey) @@ -350,64 +406,76 @@ func (c *Client) GetSequencers() ([]*types.Sequencer, error) { return nil, err } - status := types.Inactive - if sequencer.Proposer { - status = types.Proposer + tmPubKey, err := cryptocodec.ToTmPubKeyInterface(pubKey) + if err != nil { + return nil, err } + sequencerList = append(sequencerList, *types.NewSequencer(tmPubKey, sequencer.Address)) + } - sequencersList = append(sequencersList, &types.Sequencer{ - PublicKey: pubKey, - Status: status, - }) + return sequencerList, nil +} + +// CheckRotationInProgress implements settlement.ClientI. +func (c *Client) CheckRotationInProgress() (*types.Sequencer, error) { + var ( + nextAddr string + found bool + ) + err := c.RunWithRetry(func() error { + req := &sequencertypes.QueryGetNextProposerByRollappRequest{ + RollappId: c.rollappId, + } + res, err := c.sequencerQueryClient.GetNextProposerByRollapp(c.ctx, req) + if err == nil && res.RotationInProgress { + nextAddr = res.NextProposerAddr + found = true + return nil + } + if status.Code(err) == codes.NotFound { + return nil + } + return err + }) + if err != nil { + return nil, err + } + if !found { + return nil, nil + } + if nextAddr == "" { + return &types.Sequencer{}, nil + } + + seqs, err := c.GetBondedSequencers() + if err != nil { + return nil, fmt.Errorf("get sequencers: %w", err) } - c.sequencerList = sequencersList - return sequencersList, nil + + for _, sequencer := range seqs { + if sequencer.SettlementAddress == nextAddr { + return &sequencer, nil + } + } + + return nil, fmt.Errorf("next proposer not found in bonded set: %w", gerrc.ErrInternal) } func (c *Client) broadcastBatch(msgUpdateState *rollapptypes.MsgUpdateState) error { txResp, err := c.cosmosClient.BroadcastTx(c.config.DymAccountName, msgUpdateState) if err != nil { if strings.Contains(err.Error(), rollapptypes.ErrWrongBlockHeight.Error()) { - err = fmt.Errorf("%w: %w", err, gerrc.ErrAlreadyExist) + err = fmt.Errorf("%w: %w", err, gerrc.ErrAlreadyExists) } return fmt.Errorf("broadcast tx: %w", err) } if txResp.Code != 0 { return fmt.Errorf("broadcast tx status code is not 0: %w", gerrc.ErrUnknown) } - return nil -} -func (c *Client) eventHandler() { - // TODO(omritoptix): eventsChannel should be a generic channel which is later filtered by the event type. - subscriber := fmt.Sprintf("dymension-client-%s", uuid.New().String()) - eventsChannel, err := c.cosmosClient.SubscribeToEvents(c.ctx, subscriber, fmt.Sprintf(eventStateUpdate, c.config.RollappID), 1000) - if err != nil { - panic("Error subscribing to events") - } - // TODO: add defer unsubscribeAll + c.logger.Info("Broadcasted batch", "txHash", txResp.TxHash) - for { - select { - case <-c.ctx.Done(): - return - case <-c.cosmosClient.EventListenerQuit(): - // TODO(omritoptix): Fallback to polling - panic("Settlement WS disconnected") - case event := <-eventsChannel: - // Assert value is in map and publish it to the event bus - _, ok := c.eventMap[event.Query] - if !ok { - c.logger.Debug("Ignoring event. Type not supported", "event", event) - continue - } - eventData, err := c.getEventData(c.eventMap[event.Query], event) - if err != nil { - panic(err) - } - uevent.MustPublish(c.ctx, c.pubsub, eventData, map[string][]string{settlement.EventTypeKey: {c.eventMap[event.Query]}}) - } - } + return nil } func (c *Client) convertBatchToMsgUpdateState(batch *types.Batch, daResult *da.ResultSubmitBatch) (*rollapptypes.MsgUpdateState, error) { @@ -426,32 +494,40 @@ func (c *Client) convertBatchToMsgUpdateState(batch *types.Batch, daResult *da.R blockDescriptor := rollapptypes.BlockDescriptor{ Height: block.Header.Height, StateRoot: block.Header.AppHash[:], + Timestamp: block.Header.GetTimestamp(), } blockDescriptors[index] = blockDescriptor } settlementBatch := &rollapptypes.MsgUpdateState{ Creator: addr, - RollappId: c.config.RollappID, - StartHeight: batch.StartHeight, - NumBlocks: batch.EndHeight - batch.StartHeight + 1, + RollappId: c.rollappId, + StartHeight: batch.StartHeight(), + NumBlocks: batch.NumBlocks(), DAPath: daResult.SubmitMetaData.ToPath(), - Version: dymRollappVersion, BDs: rollapptypes.BlockDescriptors{BD: blockDescriptors}, + Last: batch.LastBatch, } return settlementBatch, nil } func getCosmosClientOptions(config *settlement.Config) []cosmosclient.Option { + var ( + gas string + gasAdjustment float64 = 1.0 + ) if config.GasLimit == 0 { - config.GasLimit = defaultGasLimit + gas = "auto" + gasAdjustment = 1.1 + } else { + gas = strconv.FormatUint(config.GasLimit, 10) } options := []cosmosclient.Option{ cosmosclient.WithAddressPrefix(addressPrefix), - cosmosclient.WithBroadcastMode(flags.BroadcastSync), cosmosclient.WithNodeAddress(config.NodeAddress), cosmosclient.WithFees(config.GasFees), - cosmosclient.WithGasLimit(config.GasLimit), + cosmosclient.WithGas(gas), + cosmosclient.WithGasAdjustment(gasAdjustment), cosmosclient.WithGasPrices(config.GasPrices), } if config.KeyringHomeDir != "" { @@ -463,14 +539,6 @@ func getCosmosClientOptions(config *settlement.Config) []cosmosclient.Option { return options } -func (c *Client) getEventData(eventType string, rawEventData ctypes.ResultEvent) (interface{}, error) { - switch eventType { - case settlement.EventNewBatchAccepted: - return convertToNewBatchEvent(rawEventData) - } - return nil, fmt.Errorf("event type %s not recognized", eventType) -} - // pollForBatchInclusion polls the hub for the inclusion of a batch with the given end height. func (c *Client) pollForBatchInclusion(batchEndHeight uint64) (bool, error) { latestBatch, err := c.GetLatestBatch() diff --git a/settlement/dymension/dymension_test.go b/settlement/dymension/dymension_test.go index 8e78ec2e1..3a89d21c3 100644 --- a/settlement/dymension/dymension_test.go +++ b/settlement/dymension/dymension_test.go @@ -13,7 +13,6 @@ import ( "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/types" "github.com/ignite/cli/ignite/pkg/cosmosaccount" @@ -25,8 +24,6 @@ import ( coretypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/dymensionxyz/cosmosclient/cosmosclient" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" - sequencertypes "github.com/dymensionxyz/dymension/v3/x/sequencer/types" "github.com/dymensionxyz/dymint/da" rollapptypesmock "github.com/dymensionxyz/dymint/mocks/github.com/dymensionxyz/dymension/v3/x/rollapp/types" sequencertypesmock "github.com/dymensionxyz/dymint/mocks/github.com/dymensionxyz/dymension/v3/x/sequencer/types" @@ -34,6 +31,8 @@ import ( "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/settlement/dymension" "github.com/dymensionxyz/dymint/testutil" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" + sequencertypes "github.com/dymensionxyz/dymint/third_party/dymension/sequencer/types" sdkcodectypes "github.com/cosmos/cosmos-sdk/codec/types" ) @@ -45,7 +44,7 @@ func TestGetSequencers(t *testing.T) { sequencerQueryClientMock := sequencertypesmock.NewMockQueryClient(t) count := 5 - sequencersRollappResponse, _ := generateSequencerByRollappResponse(t, count) + sequencersRollappResponse := generateSequencerByRollappResponse(t, count) sequencerQueryClientMock.On("SequencersByRollappByStatus", mock.Anything, mock.Anything).Return(sequencersRollappResponse, nil) cosmosClientMock.On("GetRollappClient").Return(rollapptypesmock.NewMockQueryClient(t)) @@ -60,10 +59,10 @@ func TestGetSequencers(t *testing.T) { require.NoError(err) hubClient := dymension.Client{} - err = hubClient.Init(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) + err = hubClient.Init(settlement.Config{}, "rollappTest", pubsubServer, log.TestingLogger(), options...) require.NoError(err) - sequencers, err := hubClient.GetSequencers() + sequencers, err := hubClient.GetBondedSequencers() require.NoError(err) require.Len(sequencers, count) } @@ -99,7 +98,7 @@ func TestPostBatchRPCError(t *testing.T) { require.NoError(err) hubClient := dymension.Client{} - err = hubClient.Init(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) + err = hubClient.Init(settlement.Config{}, "rollappTest", pubsubServer, log.TestingLogger(), options...) require.NoError(err) // submit passes @@ -221,7 +220,6 @@ func TestPostBatch(t *testing.T) { t.Run(c.name, func(t *testing.T) { // Reset the mock functions testutil.UnsetMockFn(cosmosClientMock.On("BroadcastTx")) - testutil.UnsetMockFn(rollappQueryClientMock.On("StateInfo")) // Set the mock logic based on the test case if !c.isBatchSubmitSuccess { cosmosClientMock.On("BroadcastTx", mock.Anything, mock.Anything).Return(cosmosclient.Response{TxResponse: &types.TxResponse{Code: 1}}, submitBatchError) @@ -236,7 +234,7 @@ func TestPostBatch(t *testing.T) { } rollappQueryClientMock.On("StateInfo", mock.Anything, mock.Anything).Return( &rollapptypes.QueryGetStateInfoResponse{StateInfo: rollapptypes.StateInfo{ - StartHeight: batch.StartHeight, StateInfoIndex: rollapptypes.StateInfoIndex{Index: 1}, DAPath: daMetaData.ToPath(), NumBlocks: 1, + StartHeight: batch.StartHeight(), StateInfoIndex: rollapptypes.StateInfoIndex{Index: 1}, DAPath: daMetaData.ToPath(), NumBlocks: 1, }}, nil) } else { @@ -244,7 +242,7 @@ func TestPostBatch(t *testing.T) { } } hubClient := dymension.Client{} - err := hubClient.Init(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) + err := hubClient.Init(settlement.Config{}, "rollappTest", pubsubServer, log.TestingLogger(), options...) require.NoError(err) err = hubClient.Start() require.NoError(err) @@ -290,29 +288,20 @@ func TestPostBatch(t *testing.T) { /* Utils */ /* -------------------------------------------------------------------------- */ -func generateSequencerByRollappResponse(t *testing.T, count int) (*sequencertypes.QueryGetSequencersByRollappByStatusResponse, sequencertypes.Sequencer) { - // Generate the proposer sequencer - proposerPubKeyAny, err := sdkcodectypes.NewAnyWithValue(ed25519.GenPrivKey().PubKey()) - require.NoError(t, err) - proposer := sequencertypes.Sequencer{ - DymintPubKey: proposerPubKeyAny, - Status: sequencertypes.Bonded, - Proposer: true, - } - squencerInfoList := []sequencertypes.Sequencer{proposer} - // Generate the inactive sequencers - for i := 0; i < count-1; i++ { - nonProposerPubKeyAny, err := sdkcodectypes.NewAnyWithValue(secp256k1.GenPrivKey().PubKey()) +func generateSequencerByRollappResponse(t *testing.T, count int) *sequencertypes.QueryGetSequencersByRollappByStatusResponse { + sequencerInfoList := []sequencertypes.Sequencer{} + for i := 0; i < count; i++ { + pk, err := sdkcodectypes.NewAnyWithValue(secp256k1.GenPrivKey().PubKey()) require.NoError(t, err) - nonProposer := sequencertypes.Sequencer{ - DymintPubKey: nonProposerPubKeyAny, + seq := sequencertypes.Sequencer{ + DymintPubKey: pk, Status: sequencertypes.Bonded, } - squencerInfoList = append(squencerInfoList, nonProposer) + sequencerInfoList = append(sequencerInfoList, seq) } response := &sequencertypes.QueryGetSequencersByRollappByStatusResponse{ - Sequencers: squencerInfoList, + Sequencers: sequencerInfoList, } - return response, proposer + return response } diff --git a/settlement/dymension/events.go b/settlement/dymension/events.go new file mode 100644 index 000000000..18f53cdef --- /dev/null +++ b/settlement/dymension/events.go @@ -0,0 +1,162 @@ +package dymension + +import ( + "errors" + "fmt" + "strconv" + + "github.com/dymensionxyz/dymint/settlement" + uevent "github.com/dymensionxyz/dymint/utils/event" + + "github.com/google/uuid" + ctypes "github.com/tendermint/tendermint/rpc/core/types" +) + +// TODO: use types and attributes from dymension proto +const ( + eventStateUpdateFmt = "state_update.rollapp_id='%s' AND state_update.status='PENDING'" + eventSequencersListUpdateFmt = "create_sequencer.rollapp_id='%s'" + eventRotationStartedFmt = "proposer_rotation_started.rollapp_id='%s'" +) + +func (c *Client) getEventData(eventType string, rawEventData ctypes.ResultEvent) (interface{}, error) { + switch eventType { + case settlement.EventNewBatchAccepted: + return convertToNewBatchEvent(rawEventData) + case settlement.EventNewBondedSequencer: + return convertToNewSequencerEvent(rawEventData) + case settlement.EventRotationStarted: + return convertToRotationStartedEvent(rawEventData) + } + return nil, fmt.Errorf("unrecognized event type: %s", eventType) +} + +func (c *Client) eventHandler() { + subscriber := fmt.Sprintf("dymension-client-%s", uuid.New().String()) + + eventStateUpdateQ := fmt.Sprintf(eventStateUpdateFmt, c.rollappId) + eventSequencersListQ := fmt.Sprintf(eventSequencersListUpdateFmt, c.rollappId) + eventRotationStartedQ := fmt.Sprintf(eventRotationStartedFmt, c.rollappId) + + // TODO: add validation callback for the event data + eventMap := map[string]string{ + eventStateUpdateQ: settlement.EventNewBatchAccepted, + eventSequencersListQ: settlement.EventNewBondedSequencer, + eventRotationStartedQ: settlement.EventRotationStarted, + } + + stateUpdatesC, err := c.cosmosClient.SubscribeToEvents(c.ctx, subscriber, eventStateUpdateQ, 1000) + if err != nil { + panic(fmt.Errorf("subscribe to events (%s): %w", eventStateUpdateQ, err)) + } + sequencersListC, err := c.cosmosClient.SubscribeToEvents(c.ctx, subscriber, eventSequencersListQ, 1000) + if err != nil { + panic(fmt.Errorf("subscribe to events (%s): %w", eventSequencersListQ, err)) + } + rotationStartedC, err := c.cosmosClient.SubscribeToEvents(c.ctx, subscriber, eventRotationStartedQ, 1000) + if err != nil { + panic(fmt.Errorf("subscribe to events (%s): %w", eventRotationStartedQ, err)) + } + + defer c.cosmosClient.UnsubscribeAll(c.ctx, subscriber) //nolint:errcheck + + for { + var e ctypes.ResultEvent + select { + case <-c.ctx.Done(): + return + case <-c.cosmosClient.EventListenerQuit(): + // TODO(omritoptix): Fallback to polling + return + case e = <-stateUpdatesC: + case e = <-sequencersListC: + case e = <-rotationStartedC: + } + c.handleReceivedEvent(e, eventMap) + } +} + +func (c *Client) handleReceivedEvent(event ctypes.ResultEvent, eventMap map[string]string) { + // Assert value is in map and publish it to the event bus + internalType, ok := eventMap[event.Query] + if !ok { + c.logger.Error("Ignoring event. Type not supported.", "event", event) + return + } + eventData, err := c.getEventData(internalType, event) + if err != nil { + c.logger.Error("Converting event data.", "event", event, "error", err) + return + } + + c.logger.Debug("Publishing internal event.", "event", internalType, "data", eventData) + + uevent.MustPublish(c.ctx, c.pubsub, eventData, map[string][]string{settlement.EventTypeKey: {internalType}}) +} + +func convertToNewBatchEvent(rawEventData ctypes.ResultEvent) (*settlement.EventDataNewBatchAccepted, error) { + var errs []error + // check all expected attributes exists + events := rawEventData.Events + if events["state_update.num_blocks"] == nil || events["state_update.start_height"] == nil || events["state_update.state_info_index"] == nil { + return nil, fmt.Errorf("missing expected attributes in event") + } + + numBlocks, err := strconv.ParseInt(rawEventData.Events["state_update.num_blocks"][0], 10, 64) + if err != nil { + errs = append(errs, err) + } + startHeight, err := strconv.ParseInt(rawEventData.Events["state_update.start_height"][0], 10, 64) + if err != nil { + errs = append(errs, err) + } + stateIndex, err := strconv.ParseInt(rawEventData.Events["state_update.state_info_index"][0], 10, 64) + if err != nil { + errs = append(errs, err) + } + if len(errs) > 0 { + return nil, errors.Join(errs...) + } + endHeight := uint64(startHeight + numBlocks - 1) + NewBatchEvent := &settlement.EventDataNewBatchAccepted{ + EndHeight: endHeight, + StateIndex: uint64(stateIndex), + } + return NewBatchEvent, nil +} + +func convertToNewSequencerEvent(rawEventData ctypes.ResultEvent) (*settlement.EventDataNewBondedSequencer, error) { + // check all expected attributes exists + events := rawEventData.Events + if events["create_sequencer.rollapp_id"] == nil { + return nil, fmt.Errorf("missing expected attributes in event") + } + // TODO: validate rollappID + + if events["create_sequencer.sequencer"] == nil { + return nil, fmt.Errorf("missing expected attributes in event") + } + + return &settlement.EventDataNewBondedSequencer{ + SeqAddr: events["create_sequencer.sequencer"][0], + }, nil +} + +func convertToRotationStartedEvent(rawEventData ctypes.ResultEvent) (*settlement.EventDataRotationStarted, error) { + // check all expected attributes exists + events := rawEventData.Events + if events["proposer_rotation_started.rollapp_id"] == nil { + return nil, fmt.Errorf("missing expected attributes in event") + } + + // TODO: validate rollappID + + if events["proposer_rotation_started.next_proposer"] == nil { + return nil, fmt.Errorf("missing expected attributes in event") + } + nextProposer := events["proposer_rotation_started.next_proposer"][0] + rotationStartedEvent := &settlement.EventDataRotationStarted{ + NextSeqAddr: nextProposer, + } + return rotationStartedEvent, nil +} diff --git a/settlement/dymension/utils.go b/settlement/dymension/utils.go index 950ee01b6..89bf9c6da 100644 --- a/settlement/dymension/utils.go +++ b/settlement/dymension/utils.go @@ -1,15 +1,10 @@ package dymension import ( - "fmt" - "strconv" - "github.com/avast/retry-go/v4" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/settlement" - "github.com/hashicorp/go-multierror" - ctypes "github.com/tendermint/tendermint/rpc/core/types" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" ) // RunWithRetry runs the given operation with retry, doing a number of attempts, and taking the last @@ -43,6 +38,7 @@ func convertStateInfoToResultRetrieveBatch(stateInfo *rollapptypes.StateInfo) (* return nil, err } batchResult := &settlement.Batch{ + Sequencer: stateInfo.Sequencer, StartHeight: stateInfo.StartHeight, EndHeight: stateInfo.StartHeight + stateInfo.NumBlocks - 1, MetaData: &settlement.BatchMetaData{ @@ -54,29 +50,3 @@ func convertStateInfoToResultRetrieveBatch(stateInfo *rollapptypes.StateInfo) (* Batch: batchResult, }, nil } - -func convertToNewBatchEvent(rawEventData ctypes.ResultEvent) (*settlement.EventDataNewBatchAccepted, error) { - // check all expected attributes exists - events := rawEventData.Events - if events["state_update.num_blocks"] == nil || events["state_update.start_height"] == nil || events["state_update.state_info_index"] == nil { - return nil, fmt.Errorf("missing expected attributes in event") - } - - var multiErr *multierror.Error - numBlocks, err := strconv.ParseInt(rawEventData.Events["state_update.num_blocks"][0], 10, 64) - multiErr = multierror.Append(multiErr, err) - startHeight, err := strconv.ParseInt(rawEventData.Events["state_update.start_height"][0], 10, 64) - multiErr = multierror.Append(multiErr, err) - stateIndex, err := strconv.ParseInt(rawEventData.Events["state_update.state_info_index"][0], 10, 64) - multiErr = multierror.Append(multiErr, err) - err = multiErr.ErrorOrNil() - if err != nil { - return nil, multiErr - } - endHeight := uint64(startHeight + numBlocks - 1) - NewBatchEvent := &settlement.EventDataNewBatchAccepted{ - EndHeight: endHeight, - StateIndex: uint64(stateIndex), - } - return NewBatchEvent, nil -} diff --git a/settlement/events.go b/settlement/events.go index 41447184e..f5e31f8ef 100644 --- a/settlement/events.go +++ b/settlement/events.go @@ -3,28 +3,32 @@ package settlement import ( "fmt" - "github.com/dymensionxyz/dymint/types" uevent "github.com/dymensionxyz/dymint/utils/event" ) -// Type keys - const ( // EventTypeKey is a reserved composite key for event name. EventTypeKey = "settlement.event" -) - -// Types -const ( - // EventNewBatchAccepted should be emitted internally in order to communicate between the settlement layer and the hub client - EventNewBatchAccepted = "EventNewBatchAccepted" - EventSequencersListUpdated = "SequencersListUpdated" + // Event types + EventNewBatchAccepted = "NewBatchAccepted" + EventNewBondedSequencer = "NewBondedSequencer" + EventRotationStarted = "RotationStarted" ) // Convenience objects +var ( + EventNewBatchAcceptedList = map[string][]string{EventTypeKey: {EventNewBatchAccepted}} + EventNewBondedSequencerList = map[string][]string{EventTypeKey: {EventNewBondedSequencer}} + EventRotationStartedList = map[string][]string{EventTypeKey: {EventRotationStarted}} +) -var EventNewBatchAcceptedList = map[string][]string{EventTypeKey: {EventNewBatchAccepted}} +// Queries +var ( + EventQueryNewSettlementBatchAccepted = uevent.QueryFor(EventTypeKey, EventNewBatchAccepted) + EventQueryNewBondedSequencer = uevent.QueryFor(EventTypeKey, EventNewBondedSequencer) + EventQueryRotationStarted = uevent.QueryFor(EventTypeKey, EventRotationStarted) +) // Data @@ -39,12 +43,18 @@ func (e EventDataNewBatchAccepted) String() string { return fmt.Sprintf("EndHeight: %d, StateIndex: %d", e.EndHeight, e.StateIndex) } -type EventDataSequencersListUpdated struct { - // Sequencers is the list of new sequencers - Sequencers []types.Sequencer +type EventDataNewBondedSequencer struct { + SeqAddr string } -// Queries -var ( - EventQueryNewSettlementBatchAccepted = uevent.QueryFor(EventTypeKey, EventNewBatchAccepted) -) +func (e EventDataNewBondedSequencer) String() string { + return fmt.Sprintf("SeqAddr: %s", e.SeqAddr) +} + +type EventDataRotationStarted struct { + NextSeqAddr string +} + +func (e EventDataRotationStarted) String() string { + return fmt.Sprintf("NextSeqAddr: %s", e.NextSeqAddr) +} diff --git a/settlement/grpc/grpc.go b/settlement/grpc/grpc.go index 603d45d17..e2e826e55 100644 --- a/settlement/grpc/grpc.go +++ b/settlement/grpc/grpc.go @@ -11,6 +11,7 @@ import ( "sync/atomic" "time" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/dymensionxyz/gerr-cosmos/gerrc" "github.com/libp2p/go-libp2p/core/crypto" tmp2p "github.com/tendermint/tendermint/p2p" @@ -19,9 +20,9 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/settlement" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" "github.com/dymensionxyz/dymint/types" "github.com/tendermint/tendermint/libs/pubsub" @@ -48,7 +49,7 @@ type Client struct { var _ settlement.ClientI = (*Client)(nil) // Init initializes the mock layer client. -func (c *Client) Init(config settlement.Config, pubsub *pubsub.Server, logger types.Logger, options ...settlement.Option) error { +func (c *Client) Init(config settlement.Config, rollappId string, pubsub *pubsub.Server, logger types.Logger, options ...settlement.Option) error { ctx := context.Background() latestHeight := uint64(0) @@ -87,7 +88,7 @@ func (c *Client) Init(config settlement.Config, pubsub *pubsub.Server, logger ty } logger.Debug("Starting grpc SL ", "index", slStateIndex) - c.rollappID = config.RollappID + c.rollappID = rollappId c.ProposerPubKey = proposer c.logger = logger c.ctx = ctx @@ -173,7 +174,7 @@ func (c *Client) Stop() error { return nil } -// PostBatch saves the batch to the kv store +// SubmitBatch saves the batch to the kv store func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *da.ResultSubmitBatch) error { settlementBatch := c.convertBatchtoSettlementBatch(batch, daResult) err := c.saveBatch(settlementBatch) @@ -221,15 +222,27 @@ func (c *Client) GetProposer() *types.Sequencer { return nil } var pubKey cryptotypes.PubKey = &ed25519.PubKey{Key: pubKeyBytes} - return &types.Sequencer{ - PublicKey: pubKey, - Status: types.Proposer, + tmPubKey, err := cryptocodec.ToTmPubKeyInterface(pubKey) + if err != nil { + c.logger.Error("Error converting to tendermint pubkey", "err", err) + return nil } + return types.NewSequencer(tmPubKey, pubKey.Address().String()) +} + +// GetAllSequencers implements settlement.ClientI. +func (c *Client) GetAllSequencers() ([]types.Sequencer, error) { + return c.GetBondedSequencers() +} + +// GetBondedSequencers implements settlement.ClientI. +func (c *Client) GetBondedSequencers() ([]types.Sequencer, error) { + return []types.Sequencer{*c.GetProposer()}, nil } -// GetSequencers implements settlement.ClientI. -func (c *Client) GetSequencers() ([]*types.Sequencer, error) { - return []*types.Sequencer{c.GetProposer()}, nil +// CheckRotationInProgress implements settlement.ClientI. +func (c *Client) CheckRotationInProgress() (*types.Sequencer, error) { + return nil, nil } func (c *Client) saveBatch(batch *settlement.Batch) error { @@ -263,8 +276,9 @@ func (c *Client) saveBatch(batch *settlement.Batch) error { func (c *Client) convertBatchtoSettlementBatch(batch *types.Batch, daResult *da.ResultSubmitBatch) *settlement.Batch { settlementBatch := &settlement.Batch{ - StartHeight: batch.StartHeight, - EndHeight: batch.EndHeight, + Sequencer: c.GetProposer().SettlementAddress, + StartHeight: batch.StartHeight(), + EndHeight: batch.EndHeight(), MetaData: &settlement.BatchMetaData{ DA: &da.DASubmitMetaData{ Height: daResult.SubmitMetaData.Height, diff --git a/settlement/local/local.go b/settlement/local/local.go index 2c7a62c61..a08c28694 100644 --- a/settlement/local/local.go +++ b/settlement/local/local.go @@ -12,16 +12,18 @@ import ( "sync" "time" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/dymensionxyz/gerr-cosmos/gerrc" "github.com/libp2p/go-libp2p/core/crypto" tmp2p "github.com/tendermint/tendermint/p2p" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/store" + rollapptypes "github.com/dymensionxyz/dymint/third_party/dymension/rollapp/types" "github.com/dymensionxyz/dymint/types" uevent "github.com/dymensionxyz/dymint/utils/event" @@ -52,7 +54,7 @@ type Client struct { var _ settlement.ClientI = (*Client)(nil) // Init initializes the mock layer client. -func (c *Client) Init(config settlement.Config, pubsub *pubsub.Server, logger types.Logger, options ...settlement.Option) error { +func (c *Client) Init(config settlement.Config, rollappId string, pubsub *pubsub.Server, logger types.Logger, options ...settlement.Option) error { slstore, proposer, err := initConfig(config) if err != nil { return err @@ -76,7 +78,7 @@ func (c *Client) Init(config settlement.Config, pubsub *pubsub.Server, logger ty } latestHeight = settlementBatch.StartHeight + settlementBatch.NumBlocks - 1 } - c.rollappID = config.RollappID + c.rollappID = rollappId c.ProposerPubKey = proposer c.logger = logger c.pubsub = pubsub @@ -134,7 +136,7 @@ func (c *Client) Stop() error { // PostBatch saves the batch to the kv store func (c *Client) SubmitBatch(batch *types.Batch, daClient da.Client, daResult *da.ResultSubmitBatch) error { - settlementBatch := convertBatchToSettlementBatch(batch, daResult) + settlementBatch := c.convertBatchToSettlementBatch(batch, daResult) err := c.saveBatch(settlementBatch) if err != nil { return err @@ -198,15 +200,27 @@ func (c *Client) GetProposer() *types.Sequencer { return nil } var pubKey cryptotypes.PubKey = &ed25519.PubKey{Key: pubKeyBytes} - return &types.Sequencer{ - PublicKey: pubKey, - Status: types.Proposer, + tmPubKey, err := cryptocodec.ToTmPubKeyInterface(pubKey) + if err != nil { + c.logger.Error("Error converting to tendermint pubkey", "err", err) + return nil } + return types.NewSequencer(tmPubKey, pubKey.Address().String()) +} + +// GetAllSequencers implements settlement.ClientI. +func (c *Client) GetAllSequencers() ([]types.Sequencer, error) { + return c.GetBondedSequencers() +} + +// GetBondedSequencers implements settlement.ClientI. +func (c *Client) GetBondedSequencers() ([]types.Sequencer, error) { + return []types.Sequencer{*c.GetProposer()}, nil } -// GetSequencers implements settlement.ClientI. -func (c *Client) GetSequencers() ([]*types.Sequencer, error) { - return []*types.Sequencer{c.GetProposer()}, nil +// CheckRotationInProgress implements settlement.ClientI. +func (c *Client) CheckRotationInProgress() (*types.Sequencer, error) { + return nil, nil } func (c *Client) saveBatch(batch *settlement.Batch) error { @@ -254,10 +268,11 @@ func (c *Client) retrieveBatchAtStateIndex(slStateIndex uint64) (*settlement.Res return &batchResult, nil } -func convertBatchToSettlementBatch(batch *types.Batch, daResult *da.ResultSubmitBatch) *settlement.Batch { +func (c *Client) convertBatchToSettlementBatch(batch *types.Batch, daResult *da.ResultSubmitBatch) *settlement.Batch { settlementBatch := &settlement.Batch{ - StartHeight: batch.StartHeight, - EndHeight: batch.EndHeight, + Sequencer: c.GetProposer().SettlementAddress, + StartHeight: batch.StartHeight(), + EndHeight: batch.EndHeight(), MetaData: &settlement.BatchMetaData{ DA: &da.DASubmitMetaData{ Height: daResult.SubmitMetaData.Height, diff --git a/settlement/local/local_test.go b/settlement/local/local_test.go index 3268fa2c5..76600c57b 100644 --- a/settlement/local/local_test.go +++ b/settlement/local/local_test.go @@ -28,17 +28,17 @@ func TestGetSequencers(t *testing.T) { sllayer := local.Client{} cfg := settlement.Config{ProposerPubKey: hex.EncodeToString(pubKeybytes)} - err = sllayer.Init(cfg, nil, log.TestingLogger()) + err = sllayer.Init(cfg, "rollappTest", nil, log.TestingLogger()) require.NoError(err) - sequencers, err := sllayer.GetSequencers() + sequencers, err := sllayer.GetBondedSequencers() require.NoError(err) assert.Equal(1, len(sequencers)) - assert.Equal(pubKeybytes, sequencers[0].PublicKey.Bytes()) + assert.Equal(pubKeybytes, sequencers[0].PubKey().Bytes()) proposer := sllayer.GetProposer() require.NotNil(proposer) - assert.Equal(pubKeybytes, proposer.PublicKey.Bytes()) + assert.Equal(pubKeybytes, proposer.PubKey().Bytes()) } func TestSubmitBatch(t *testing.T) { @@ -51,17 +51,17 @@ func TestSubmitBatch(t *testing.T) { require.NoError(err) sllayer := local.Client{} - err = sllayer.Init(settlement.Config{}, pubsubServer, logger) + err = sllayer.Init(settlement.Config{}, "rollappTest", pubsubServer, logger) require.NoError(err) _, err = sllayer.GetLatestBatch() require.Error(err) // no batch should be present // Create a batches which will be submitted - propserKey, _, err := crypto.GenerateEd25519Key(nil) + proposerKey, _, err := crypto.GenerateEd25519Key(nil) require.NoError(err) - batch1, err := testutil.GenerateBatch(1, 1, propserKey) + batch1, err := testutil.GenerateBatch(1, 1, proposerKey) require.NoError(err) - batch2, err := testutil.GenerateBatch(2, 2, propserKey) + batch2, err := testutil.GenerateBatch(2, 2, proposerKey) require.NoError(err) resultSubmitBatch := &da.ResultSubmitBatch{} resultSubmitBatch.SubmitMetaData = &da.DASubmitMetaData{} @@ -74,7 +74,7 @@ func TestSubmitBatch(t *testing.T) { // Check if the batch was submitted queriedBatch, err := sllayer.GetLatestBatch() require.NoError(err) - assert.Equal(batch1.EndHeight, queriedBatch.Batch.EndHeight) + assert.Equal(batch1.EndHeight(), queriedBatch.Batch.EndHeight) state, err := sllayer.GetHeightState(1) require.NoError(err) @@ -82,7 +82,7 @@ func TestSubmitBatch(t *testing.T) { queriedBatch, err = sllayer.GetBatchAtIndex(state.State.StateIndex) require.NoError(err) - assert.Equal(batch1.EndHeight, queriedBatch.Batch.EndHeight) + assert.Equal(batch1.EndHeight(), queriedBatch.Batch.EndHeight) // Submit the 2nd batch and check if it was successful err = sllayer.SubmitBatch(batch2, da.Mock, resultSubmitBatch) @@ -92,7 +92,7 @@ func TestSubmitBatch(t *testing.T) { // Check if the batch was submitted queriedBatch, err = sllayer.GetLatestBatch() require.NoError(err) - assert.Equal(batch2.EndHeight, queriedBatch.Batch.EndHeight) + assert.Equal(batch2.EndHeight(), queriedBatch.Batch.EndHeight) state, err = sllayer.GetHeightState(2) require.NoError(err) @@ -100,7 +100,7 @@ func TestSubmitBatch(t *testing.T) { queriedBatch, err = sllayer.GetBatchAtIndex(state.State.StateIndex) require.NoError(err) - assert.Equal(batch2.EndHeight, queriedBatch.Batch.EndHeight) + assert.Equal(batch2.EndHeight(), queriedBatch.Batch.EndHeight) // TODO: test event emitted } @@ -126,7 +126,7 @@ func TestPersistency(t *testing.T) { require.NoError(err) cfg := settlement.Config{KeyringHomeDir: tmpdir, ProposerPubKey: hex.EncodeToString(pubKeybytes)} - err = sllayer.Init(cfg, pubsubServer, logger) + err = sllayer.Init(cfg, "rollappTest", pubsubServer, logger) require.NoError(err) _, err = sllayer.GetLatestBatch() @@ -145,14 +145,14 @@ func TestPersistency(t *testing.T) { queriedBatch, err := sllayer.GetLatestBatch() require.NoError(err) - assert.Equal(batch1.EndHeight, queriedBatch.Batch.EndHeight) + assert.Equal(batch1.EndHeight(), queriedBatch.Batch.EndHeight) // Restart the layer and check if the batch is still present err = sllayer.Stop() require.NoError(err) sllayer = local.Client{} - _ = sllayer.Init(cfg, pubsubServer, logger) + _ = sllayer.Init(cfg, "rollappTest", pubsubServer, logger) queriedBatch, err = sllayer.GetLatestBatch() require.NoError(err) - assert.Equal(batch1.EndHeight, queriedBatch.Batch.EndHeight) + assert.Equal(batch1.EndHeight(), queriedBatch.Batch.EndHeight) } diff --git a/settlement/settlement.go b/settlement/settlement.go index 8e6c603a5..91dea7fdb 100644 --- a/settlement/settlement.go +++ b/settlement/settlement.go @@ -32,6 +32,8 @@ type BatchMetaData struct { } type Batch struct { + // sequencer is the bech32-encoded address of the sequencer sent the update + Sequencer string StartHeight uint64 EndHeight uint64 AppHashes [][32]byte @@ -59,7 +61,7 @@ type Option func(ClientI) // ClientI defines generic interface for Settlement layer interaction. type ClientI interface { // Init is called once for the client initialization - Init(config Config, pubsub *pubsub.Server, logger types.Logger, options ...Option) error + Init(config Config, rollappId string, pubsub *pubsub.Server, logger types.Logger, options ...Option) error // Start is called once, after Init. It's implementation should start the client service. Start() error // Stop is called once, after Start. It should stop the client service. @@ -72,10 +74,16 @@ type ClientI interface { // GetBatchAtIndex returns the batch at the given index. GetBatchAtIndex(index uint64) (*ResultRetrieveBatch, error) - // GetSequencersList returns the list of the sequencers for this chain. - GetSequencers() ([]*types.Sequencer, error) + // GetAllSequencers returns all sequencers for this rollapp (bonded and not bonded). + GetAllSequencers() ([]types.Sequencer, error) + // GetBondedSequencers returns the list of the bonded sequencers for this rollapp. + GetBondedSequencers() ([]types.Sequencer, error) // GetProposer returns the current proposer for this chain. GetProposer() *types.Sequencer + // CheckRotationInProgress returns the next proposer for this chain in case of a rotation. + // If no rotation is in progress, it should return nil. + CheckRotationInProgress() (*types.Sequencer, error) + GetHeightState(uint64) (*ResultGetHeightState, error) } diff --git a/store/badger.go b/store/badger.go index 58019f784..dd72dd79f 100644 --- a/store/badger.go +++ b/store/badger.go @@ -31,7 +31,7 @@ func NewDefaultInMemoryKVStore() KV { } func NewKVStore(rootDir, dbPath, dbName string, syncWrites bool) KV { - path := filepath.Join(rootify(rootDir, dbPath), dbName) + path := filepath.Join(Rootify(rootDir, dbPath), dbName) db, err := badger.Open(badger.DefaultOptions(path).WithSyncWrites(syncWrites)) if err != nil { panic(err) @@ -46,8 +46,8 @@ func NewDefaultKVStore(rootDir, dbPath, dbName string) KV { return NewKVStore(rootDir, dbPath, dbName, true) } -// rootify works just like in cosmos-sdk -func rootify(rootDir, dbPath string) string { +// Rootify is helper function to make config creation independent of root dir +func Rootify(rootDir, dbPath string) string { if filepath.IsAbs(dbPath) { return dbPath } diff --git a/store/pruning.go b/store/pruning.go index 3c0a358cc..45ab0e208 100644 --- a/store/pruning.go +++ b/store/pruning.go @@ -45,7 +45,10 @@ func (s *DefaultStore) PruneBlocks(from, to uint64) (uint64, error) { if err := batch.Delete(getResponsesKey(h)); err != nil { return 0, err } - if err := batch.Delete(getValidatorsKey(h)); err != nil { + if err := batch.Delete(getSequencersKey(h)); err != nil { + return 0, err + } + if err := batch.Delete(getCidKey(h)); err != nil { return 0, err } diff --git a/store/pruning_test.go b/store/pruning_test.go index 43f9c0e7a..f814989af 100644 --- a/store/pruning_test.go +++ b/store/pruning_test.go @@ -6,6 +6,8 @@ import ( "github.com/dymensionxyz/dymint/store" "github.com/dymensionxyz/dymint/testutil" "github.com/dymensionxyz/dymint/types" + "github.com/ipfs/go-cid" + mh "github.com/multiformats/go-multihash" "github.com/stretchr/testify/assert" ) @@ -63,10 +65,25 @@ func TestStorePruning(t *testing.T) { _, err := bstore.SaveBlock(block, &types.Commit{}, nil) assert.NoError(err) savedHeights[block.Header.Height] = true + blockBytes, err := block.MarshalBinary() + assert.NoError(err) + // Create a cid manually by specifying the 'prefix' parameters + pref := &cid.Prefix{ + Codec: cid.DagProtobuf, + MhLength: -1, + MhType: mh.SHA2_256, + Version: 1, + } + cid, err := pref.Sum(blockBytes) + assert.NoError(err) + _, err = bstore.SaveBlockCid(block.Header.Height, cid, nil) + assert.NoError(err) // TODO: add block responses and commits } + // And then feed it some data + // expectedCid, err := pref.Sum(block) // Validate all blocks are saved for k := range savedHeights { _, err := bstore.LoadBlock(k) @@ -92,9 +109,17 @@ func TestStorePruning(t *testing.T) { _, err = bstore.LoadCommit(k) assert.Error(err, "Commit at height %d should be pruned", k) + + _, err = bstore.LoadBlockCid(k) + assert.Error(err, "Cid at height %d should be pruned", k) + } else { _, err := bstore.LoadBlock(k) assert.NoError(err) + + _, err = bstore.LoadBlockCid(k) + assert.NoError(err) + } } }) diff --git a/store/store.go b/store/store.go index e3c9e69dd..1ab464dab 100644 --- a/store/store.go +++ b/store/store.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" + "github.com/ipfs/go-cid" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" @@ -20,7 +21,8 @@ var ( commitPrefix = [1]byte{3} statePrefix = [1]byte{4} responsesPrefix = [1]byte{5} - validatorsPrefix = [1]byte{6} + sequencersPrefix = [1]byte{6} + cidPrefix = [1]byte{7} ) // DefaultStore is a default store implementation. @@ -114,7 +116,7 @@ func (s *DefaultStore) LoadBlockByHash(hash [32]byte) (*types.Block, error) { return block, nil } -// SaveBlockResponses saves block responses (events, tx responses, validator set updates, etc) in Store. +// SaveBlockResponses saves block responses (events, tx responses, etc) in Store. func (s *DefaultStore) SaveBlockResponses(height uint64, responses *tmstate.ABCIResponses, batch KVBatch) (KVBatch, error) { data, err := responses.Marshal() if err != nil { @@ -204,37 +206,61 @@ func (s *DefaultStore) LoadState() (*types.State, error) { return &state, nil } -// SaveValidators stores validator set for given block height in store. -func (s *DefaultStore) SaveValidators(height uint64, validatorSet *tmtypes.ValidatorSet, batch KVBatch) (KVBatch, error) { - pbValSet, err := validatorSet.ToProto() +// SaveSequencers stores sequencerSet for given block height in store. +func (s *DefaultStore) SaveSequencers(height uint64, sequencerSet *types.SequencerSet, batch KVBatch) (KVBatch, error) { + pbValSet, err := sequencerSet.ToProto() if err != nil { - return batch, fmt.Errorf("marshal ValidatorSet to protobuf: %w", err) + return batch, fmt.Errorf("marshal sequencerSet to protobuf: %w", err) } blob, err := pbValSet.Marshal() if err != nil { - return batch, fmt.Errorf("marshal ValidatorSet: %w", err) + return batch, fmt.Errorf("marshal sequencerSet: %w", err) } if batch == nil { - return nil, s.db.Set(getValidatorsKey(height), blob) + return nil, s.db.Set(getSequencersKey(height), blob) } - err = batch.Set(getValidatorsKey(height), blob) + err = batch.Set(getSequencersKey(height), blob) return batch, err } -// LoadValidators loads validator set at given block height from store. -func (s *DefaultStore) LoadValidators(height uint64) (*tmtypes.ValidatorSet, error) { - blob, err := s.db.Get(getValidatorsKey(height)) +// LoadSequencers loads sequencer set at given block height from store. +func (s *DefaultStore) LoadSequencers(height uint64) (*types.SequencerSet, error) { + blob, err := s.db.Get(getSequencersKey(height)) if err != nil { - return nil, fmt.Errorf("load Validators for height %v: %w", height, err) + return nil, fmt.Errorf("load sequencers for height %v: %w", height, err) } - var pbValSet tmproto.ValidatorSet + var pbValSet pb.SequencerSet err = pbValSet.Unmarshal(blob) if err != nil { - return nil, fmt.Errorf("unmarshal to protobuf: %w", err) + // migration support: try to unmarshal as old ValidatorSet + return parseAsValidatorSet(blob) } - return tmtypes.ValidatorSetFromProto(&pbValSet) + var ss types.SequencerSet + err = ss.FromProto(pbValSet) + if err != nil { + return nil, fmt.Errorf("unmarshal from proto: %w", err) + } + + return &ss, nil +} + +func parseAsValidatorSet(blob []byte) (*types.SequencerSet, error) { + var ( + ss types.SequencerSet + pbValSetOld tmproto.ValidatorSet + ) + err := pbValSetOld.Unmarshal(blob) + if err != nil { + return nil, fmt.Errorf("unmarshal protobuf: %w", err) + } + pbValSet, err := tmtypes.ValidatorSetFromProto(&pbValSetOld) + if err != nil { + return nil, fmt.Errorf("unmarshal to ValidatorSet: %w", err) + } + ss.LoadFromValSet(pbValSet) + return &ss, nil } func (s *DefaultStore) loadHashFromIndex(height uint64) ([32]byte, error) { @@ -251,6 +277,26 @@ func (s *DefaultStore) loadHashFromIndex(height uint64) ([32]byte, error) { return hash, nil } +func (s *DefaultStore) SaveBlockCid(height uint64, cid cid.Cid, batch KVBatch) (KVBatch, error) { + if batch == nil { + return nil, s.db.Set(getCidKey(height), []byte(cid.String())) + } + err := batch.Set(getCidKey(height), []byte(cid.String())) + return batch, err +} + +func (s *DefaultStore) LoadBlockCid(height uint64) (cid.Cid, error) { + cidBytes, err := s.db.Get(getCidKey(height)) + if err != nil { + return cid.Undef, fmt.Errorf("load cid for height %v: %w", height, err) + } + parsedCid, err := cid.Parse(string(cidBytes)) + if err != nil { + return cid.Undef, fmt.Errorf("parse cid: %w", err) + } + return parsedCid, nil +} + func getBlockKey(hash [32]byte) []byte { return append(blockPrefix[:], hash[:]...) } @@ -275,8 +321,14 @@ func getResponsesKey(height uint64) []byte { return append(responsesPrefix[:], buf[:]...) } -func getValidatorsKey(height uint64) []byte { +func getSequencersKey(height uint64) []byte { + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, height) + return append(sequencersPrefix[:], buf[:]...) +} + +func getCidKey(height uint64) []byte { buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, height) - return append(validatorsPrefix[:], buf[:]...) + return append(cidPrefix[:], buf[:]...) } diff --git a/store/storeIface.go b/store/storeIface.go index 169b74444..9013a5242 100644 --- a/store/storeIface.go +++ b/store/storeIface.go @@ -2,8 +2,8 @@ package store import ( "github.com/dymensionxyz/dymint/types" + "github.com/ipfs/go-cid" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" - tmtypes "github.com/tendermint/tendermint/types" ) // KV encapsulates key-value store abstraction, in minimalistic interface. @@ -67,11 +67,15 @@ type Store interface { // LoadState returns last state saved with UpdateState. LoadState() (*types.State, error) - SaveValidators(height uint64, validatorSet *tmtypes.ValidatorSet, batch KVBatch) (KVBatch, error) + SaveSequencers(height uint64, seqSet *types.SequencerSet, batch KVBatch) (KVBatch, error) - LoadValidators(height uint64) (*tmtypes.ValidatorSet, error) + LoadSequencers(height uint64) (*types.SequencerSet, error) PruneBlocks(from, to uint64) (uint64, error) Close() error + + SaveBlockCid(height uint64, cid cid.Cid, batch KVBatch) (KVBatch, error) + + LoadBlockCid(height uint64) (cid.Cid, error) } diff --git a/store/store_test.go b/store/store_test.go index fba5db3b9..f7afb7746 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -5,6 +5,9 @@ import ( "testing" "github.com/dymensionxyz/gerr-cosmos/gerrc" + "github.com/ipfs/go-cid" + mh "github.com/multiformats/go-multihash" + abcitypes "github.com/tendermint/tendermint/abci/types" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" @@ -89,16 +92,15 @@ func TestLoadState(t *testing.T) { assert := assert.New(t) - validatorSet := testutil.GetRandomValidatorSet() + validatorSet := testutil.GenerateRandomValidatorSet() kv := store.NewDefaultInMemoryKVStore() s1 := store.New(kv) expectedHeight := uint64(10) - s := &types.State{ - NextValidators: validatorSet, - Validators: validatorSet, - } - s.LastBlockHeight.Store(expectedHeight) + s := &types.State{} + s.Sequencers.LoadFromValSet(validatorSet) + + s.SetHeight(expectedHeight) _, err := s1.SaveState(s, nil) assert.NoError(err) @@ -106,7 +108,7 @@ func TestLoadState(t *testing.T) { state, err := s2.LoadState() assert.NoError(err) - assert.Equal(expectedHeight, state.LastBlockHeight.Load()) + assert.Equal(expectedHeight, state.Height()) } func TestBlockResponses(t *testing.T) { @@ -198,3 +200,52 @@ func TestBatch(t *testing.T) { assert.NotNil(resp) assert.Equal(expected, resp) } + +// test for saving and loading cids for specific block heights in the store with and w/out batches +func TestBlockId(t *testing.T) { + require := require.New(t) + + kv := store.NewDefaultInMemoryKVStore() + s := store.New(kv) + + // Create a cid manually by specifying the 'prefix' parameters + pref := &cid.Prefix{ + Codec: cid.DagProtobuf, + MhLength: -1, + MhType: mh.SHA2_256, + Version: 1, + } + + // And then feed it some data + expectedCid, err := pref.Sum([]byte("test")) + require.NoError(err) + + // store cid for height 1 + _, err = s.SaveBlockCid(1, expectedCid, nil) + require.NoError(err) + + // retrieve cid for height 1 + resultCid, err := s.LoadBlockCid(1) + require.NoError(err) + + require.Equal(expectedCid, resultCid) + + // repeat test using batch + batch := s.NewBatch() + + // store cid for height 2 + batch, err = s.SaveBlockCid(2, expectedCid, batch) + require.NoError(err) + + // retrieve cid for height 2 + _, err = s.LoadBlockCid(2) + require.Error(err, gerrc.ErrNotFound) + + // commit + batch.Commit() + + // retrieve cid for height 2 + resultCid, err = s.LoadBlockCid(2) + require.NoError(err) + require.Equal(expectedCid, resultCid) +} diff --git a/test/loadtime/cmd/report/main.go b/test/loadtime/cmd/report/main.go index cbb68ce41..c981a65e4 100644 --- a/test/loadtime/cmd/report/main.go +++ b/test/loadtime/cmd/report/main.go @@ -53,7 +53,7 @@ func newBlockStore(kvstore store.KV, baseHeight uint64) *BlockStore { return &BlockStore{ DefaultStore: store, base: state.BaseHeight, - height: state.LastBlockHeight.Load(), + height: state.Height(), } } diff --git a/testutil/block.go b/testutil/block.go index 9f326dd7d..88d964dc5 100644 --- a/testutil/block.go +++ b/testutil/block.go @@ -9,8 +9,10 @@ import ( "github.com/dymensionxyz/dymint/block" "github.com/dymensionxyz/dymint/p2p" "github.com/dymensionxyz/dymint/settlement" + "github.com/ipfs/go-datastore" "github.com/libp2p/go-libp2p/core/crypto" + "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/pubsub" "github.com/tendermint/tendermint/proxy" @@ -32,11 +34,15 @@ const ( /* -------------------------------------------------------------------------- */ /* utils */ /* -------------------------------------------------------------------------- */ -func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypto.PrivKey, settlementlc settlement.ClientI, dalc da.DataAvailabilityLayerClient, genesisHeight, storeInitialHeight, storeLastBlockHeight int64, proxyAppConns proxy.AppConns, mockStore store.Store) (*block.Manager, error) { + +func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypto.PrivKey, settlementlc settlement.ClientI, genesisHeight, storeInitialHeight, storeLastBlockHeight int64, proxyAppConns proxy.AppConns, mockStore store.Store) (*block.Manager, error) { genesis := GenerateGenesis(genesisHeight) // Change the LastBlockHeight to avoid calling InitChainSync within the manager // And updating the state according to the genesis. - state := GenerateState(storeInitialHeight, storeLastBlockHeight) + raw, _ := proposerKey.GetPublic().Raw() + pubkey := ed25519.PubKey(raw) + + state := GenerateStateWithSequencer(storeInitialHeight, storeLastBlockHeight, pubkey) var managerStore store.Store if mockStore == nil { managerStore = store.New(store.NewDefaultInMemoryKVStore()) @@ -65,16 +71,11 @@ func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypt return nil, err } - err = initSettlementLayerMock(settlementlc, hex.EncodeToString(pubKeybytes), pubsubServer, logger) + err = initSettlementLayerMock(genesis.ChainID, settlementlc, hex.EncodeToString(pubKeybytes), pubsubServer, logger) if err != nil { return nil, err } - if dalc == nil { - dalc = &localda.DataAvailabilityLayerClient{} - } - initDALCMock(dalc, pubsubServer, logger) - var proxyApp proxy.AppConns if proxyAppConns == nil { proxyApp = GetABCIProxyAppMock(logger.With("module", "proxy")) @@ -91,34 +92,42 @@ func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypt // Init p2p client and validator p2pKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) p2pClient, err := p2p.NewClient(config.P2PConfig{ - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - }, p2pKey, "TestChain", pubsubServer, logger) + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, + }, p2pKey, "TestChain", managerStore, pubsubServer, datastore.NewMapDatastore(), logger) if err != nil { return nil, err } - p2pValidator := p2p.NewValidator(logger, settlementlc) - p2pClient.SetTxValidator(p2pValidator.TxValidator(mp, mpIDs)) - p2pClient.SetBlockValidator(p2pValidator.BlockValidator()) - if err = p2pClient.Start(context.Background()); err != nil { + config := config.NodeConfig{ + BlockManagerConfig: conf, + DAConfig: "", + } + manager, err := block.NewManager(proposerKey, config, genesis, managerStore, mp, proxyApp, settlementlc, nil, + pubsubServer, p2pClient, nil, logger) + if err != nil { return nil, err } - manager, err := block.NewManager(proposerKey, conf, genesis, managerStore, mp, proxyApp, dalc, settlementlc, nil, - pubsubServer, p2pClient, logger) - if err != nil { + p2pValidator := p2p.NewValidator(logger, manager) + p2pClient.SetTxValidator(p2pValidator.TxValidator(mp, mpIDs)) + p2pClient.SetBlockValidator(p2pValidator.BlockValidator()) + + manager.P2PClient = p2pClient + + if err = p2pClient.Start(context.Background()); err != nil { return nil, err } return manager, nil } -func GetManager(conf config.BlockManagerConfig, settlementlc settlement.ClientI, dalc da.DataAvailabilityLayerClient, genesisHeight, storeInitialHeight, storeLastBlockHeight int64, proxyAppConns proxy.AppConns, mockStore store.Store) (*block.Manager, error) { +func GetManager(conf config.BlockManagerConfig, settlementlc settlement.ClientI, genesisHeight, storeInitialHeight, storeLastBlockHeight int64, proxyAppConns proxy.AppConns, mockStore store.Store) (*block.Manager, error) { proposerKey, _, err := crypto.GenerateEd25519Key(rand.Reader) if err != nil { return nil, err } - return GetManagerWithProposerKey(conf, proposerKey, settlementlc, dalc, genesisHeight, storeInitialHeight, storeLastBlockHeight, proxyAppConns, mockStore) + return GetManagerWithProposerKey(conf, proposerKey, settlementlc, genesisHeight, storeInitialHeight, storeLastBlockHeight, proxyAppConns, mockStore) } func GetMockDALC(logger log.Logger) da.DataAvailabilityLayerClient { @@ -132,8 +141,8 @@ func initDALCMock(dalc da.DataAvailabilityLayerClient, pubsubServer *pubsub.Serv _ = dalc.Start() } -func initSettlementLayerMock(settlementlc settlement.ClientI, proposer string, pubsubServer *pubsub.Server, logger log.Logger) error { - err := settlementlc.Init(settlement.Config{ProposerPubKey: proposer}, pubsubServer, logger) +func initSettlementLayerMock(rollappId string, settlementlc settlement.ClientI, proposer string, pubsubServer *pubsub.Server, logger log.Logger) error { + err := settlementlc.Init(settlement.Config{ProposerPubKey: proposer}, rollappId, pubsubServer, logger) if err != nil { return err } @@ -146,10 +155,9 @@ func initSettlementLayerMock(settlementlc settlement.ClientI, proposer string, p func GetManagerConfig() config.BlockManagerConfig { return config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BlockBatchMaxSizeBytes: 1000000, - BatchSubmitMaxTime: 30 * time.Minute, - MaxSupportedBatchSkew: 10, - NamespaceID: "0102030405060708", + BlockTime: 100 * time.Millisecond, + BatchSubmitBytes: 1000000, + BatchSubmitTime: 30 * time.Minute, + BatchSkew: 10, } } diff --git a/testutil/node.go b/testutil/node.go index 0b8b9853c..5a58540bc 100644 --- a/testutil/node.go +++ b/testutil/node.go @@ -11,14 +11,37 @@ import ( "github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/types" + "github.com/stretchr/testify/mock" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/dymensionxyz/dymint/config" "github.com/dymensionxyz/dymint/mempool" "github.com/dymensionxyz/dymint/node" "github.com/dymensionxyz/dymint/settlement" ) -func CreateNode(isSequencer bool, blockManagerConfig *config.BlockManagerConfig) (*node.Node, error) { - app := GetAppMock() +func CreateNode(isSequencer bool, blockManagerConfig *config.BlockManagerConfig, genesis *types.GenesisDoc) (*node.Node, error) { + app := GetAppMock(EndBlock) + // Create proxy app + clientCreator := proxy.NewLocalClientCreator(app) + proxyApp := proxy.NewAppConns(clientCreator) + err := proxyApp.Start() + if err != nil { + return nil, err + } + app.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{ + RollappParamUpdates: &abci.RollappParams{ + Da: "celestia", + Version: "abcde", + }, + ConsensusParamUpdates: &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxGas: 100, + MaxBytes: 100, + }, + }, + }) + key, _, _ := crypto.GenerateEd25519Key(rand.Reader) signingKey, pubkey, _ := crypto.GenerateEd25519Key(rand.Reader) pubkeyBytes, _ := pubkey.Raw() @@ -28,18 +51,16 @@ func CreateNode(isSequencer bool, blockManagerConfig *config.BlockManagerConfig) if blockManagerConfig == nil { blockManagerConfig = &config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitMaxTime: 60 * time.Second, - BlockBatchMaxSizeBytes: 1000, - MaxSupportedBatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, } } nodeConfig.BlockManagerConfig = *blockManagerConfig - rollappID := "rollapp_1234-1" - // SL config - nodeConfig.SettlementConfig = settlement.Config{ProposerPubKey: hex.EncodeToString(pubkeyBytes), RollappID: rollappID} + nodeConfig.SettlementConfig = settlement.Config{ProposerPubKey: hex.EncodeToString(pubkeyBytes)} node, err := node.NewNode( context.Background(), @@ -47,7 +68,7 @@ func CreateNode(isSequencer bool, blockManagerConfig *config.BlockManagerConfig) key, signingKey, proxy.NewLocalClientCreator(app), - &types.GenesisDoc{ChainID: rollappID}, + genesis, log.TestingLogger(), mempool.NopMetrics(), ) diff --git a/testutil/p2p.go b/testutil/p2p.go index 713a7aada..8dd88fbe8 100644 --- a/testutil/p2p.go +++ b/testutil/p2p.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/ipfs/go-datastore" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" mocknet "github.com/libp2p/go-libp2p/p2p/net/mock" @@ -19,6 +20,7 @@ import ( "github.com/dymensionxyz/dymint/config" "github.com/dymensionxyz/dymint/p2p" + "github.com/dymensionxyz/dymint/store" "github.com/dymensionxyz/dymint/types" ) @@ -106,16 +108,20 @@ func StartTestNetwork(ctx context.Context, t *testing.T, n int, conf map[int]Hos require.NoError(err) clients := make([]*p2p.Client, n) + store := store.New(store.NewDefaultInMemoryKVStore()) for i := 0; i < n; i++ { client, err := p2p.NewClient(config.P2PConfig{ - BootstrapNodes: seeds[i], - GossipedBlocksCacheSize: 50, - BootstrapRetryTime: 30 * time.Second, - ListenAddress: config.DefaultListenAddress, + BootstrapNodes: seeds[i], + GossipSubCacheSize: 50, + BootstrapRetryTime: 30 * time.Second, + BlockSyncRequestIntervalTime: 30 * time.Second, + ListenAddress: config.DefaultListenAddress, + BlockSyncEnabled: true, }, mnet.Hosts()[i].Peerstore().PrivKey(mnet.Hosts()[i].ID()), conf[i].ChainID, - pubsubServer, + store, + pubsubServer, datastore.NewMapDatastore(), logger) require.NoError(err) require.NotNil(client) diff --git a/testutil/rpc.go b/testutil/rpc.go index fd7b2d305..3b6bed272 100644 --- a/testutil/rpc.go +++ b/testutil/rpc.go @@ -22,7 +22,7 @@ func CreateLocalServer(t *testing.T) (*rpc.Server, net.Listener) { var server *rpc.Server // Start server with listener go func() { - node, err := CreateNode(true, nil) + node, err := CreateNode(true, nil, GenerateGenesis(0)) require.NoError(t, err) err = node.Start() require.NoError(t, err) diff --git a/testutil/types.go b/testutil/types.go index 50ab642ee..e019fc0bc 100644 --- a/testutil/types.go +++ b/testutil/types.go @@ -5,10 +5,12 @@ import ( "math/big" "time" - "github.com/libp2p/go-libp2p/core/crypto" - "github.com/dymensionxyz/dymint/types" + "github.com/dymensionxyz/dymint/types/pb/dymint" + dymintversion "github.com/dymensionxyz/dymint/version" + "github.com/libp2p/go-libp2p/core/crypto" abci "github.com/tendermint/tendermint/abci/types" + tmcrypto "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -49,7 +51,7 @@ func GetRandomBytes(n uint64) []byte { } // generateBlock generates random blocks. -func generateBlock(height uint64) *types.Block { +func generateBlock(height uint64, proposerHash []byte) *types.Block { h := createRandomHashes() block := &types.Block{ Header: types.Header{ @@ -57,18 +59,17 @@ func generateBlock(height uint64) *types.Block { Block: BlockVersion, App: AppVersion, }, - NamespaceID: [8]byte{0, 1, 2, 3, 4, 5, 6, 7}, - Height: height, - Time: 4567, - LastHeaderHash: h[0], - LastCommitHash: h[1], - DataHash: h[2], - ConsensusHash: h[3], - // AppHash: h[4], - AppHash: [32]byte{}, - LastResultsHash: GetEmptyLastResultsHash(), - ProposerAddress: []byte{4, 3, 2, 1}, - SequencersHash: h[6], + Height: height, + Time: 4567, + LastHeaderHash: h[0], + LastCommitHash: h[1], + DataHash: h[2], + ConsensusHash: h[3], + AppHash: [32]byte{}, + LastResultsHash: GetEmptyLastResultsHash(), + ProposerAddress: []byte{4, 3, 2, 1}, + SequencerHash: [32]byte(proposerHash), + NextSequencersHash: [32]byte(proposerHash), }, Data: types.Data{ Txs: nil, @@ -86,10 +87,14 @@ func generateBlock(height uint64) *types.Block { } func GenerateBlocksWithTxs(startHeight uint64, num uint64, proposerKey crypto.PrivKey, nTxs int) ([]*types.Block, error) { + r, _ := proposerKey.Raw() + seq := types.NewSequencerFromValidator(*tmtypes.NewValidator(ed25519.PrivKey(r).PubKey(), 1)) + proposerHash := seq.Hash() + blocks := make([]*types.Block, num) for i := uint64(0); i < num; i++ { - block := generateBlock(i + startHeight) + block := generateBlock(i+startHeight, proposerHash) block.Data = types.Data{ Txs: make(types.Txs, nTxs), @@ -115,9 +120,17 @@ func GenerateBlocksWithTxs(startHeight uint64, num uint64, proposerKey crypto.Pr // GenerateBlocks generates random blocks. func GenerateBlocks(startHeight uint64, num uint64, proposerKey crypto.PrivKey) ([]*types.Block, error) { + r, _ := proposerKey.Raw() + seq := types.NewSequencerFromValidator(*tmtypes.NewValidator(ed25519.PrivKey(r).PubKey(), 1)) + proposerHash := seq.Hash() + blocks := make([]*types.Block, num) for i := uint64(0); i < num; i++ { - block := generateBlock(i + startHeight) + block := generateBlock(i+startHeight, proposerHash) + copy(block.Header.DataHash[:], types.GetDataHash(block)) + if i > 0 { + copy(block.Header.LastCommitHash[:], types.GetLastCommitHash(&blocks[i-1].LastCommit, &block.Header)) + } signature, err := generateSignature(proposerKey, &block.Header) if err != nil { @@ -173,30 +186,48 @@ func GenerateBatch(startHeight uint64, endHeight uint64, proposerKey crypto.Priv return nil, err } batch := &types.Batch{ - StartHeight: startHeight, - EndHeight: endHeight, - Blocks: blocks, - Commits: commits, + Blocks: blocks, + Commits: commits, } return batch, nil } +func MustGenerateBatch(startHeight uint64, endHeight uint64, proposerKey crypto.PrivKey) *types.Batch { + blocks, err := GenerateBlocks(startHeight, endHeight-startHeight+1, proposerKey) + if err != nil { + panic(err) + } + commits, err := GenerateCommits(blocks, proposerKey) + if err != nil { + panic(err) + } + return &types.Batch{ + Blocks: blocks, + Commits: commits, + } +} + +func MustGenerateBatchAndKey(startHeight uint64, endHeight uint64) *types.Batch { + proposerKey, _, err := crypto.GenerateEd25519Key(nil) + if err != nil { + panic(err) + } + return MustGenerateBatch(startHeight, endHeight, proposerKey) +} + // GenerateRandomValidatorSet generates random validator sets func GenerateRandomValidatorSet() *tmtypes.ValidatorSet { - pubKey := ed25519.GenPrivKey().PubKey() - return &tmtypes.ValidatorSet{ - Proposer: &tmtypes.Validator{PubKey: pubKey, Address: pubKey.Address()}, - Validators: []*tmtypes.Validator{ - {PubKey: pubKey, Address: pubKey.Address()}, - }, - } + return tmtypes.NewValidatorSet([]*tmtypes.Validator{ + tmtypes.NewValidator(ed25519.GenPrivKey().PubKey(), 1), + }) } -// GenerateState generates an initial state for testing. -func GenerateState(initialHeight int64, lastBlockHeight int64) *types.State { +// GenerateStateWithSequencer generates an initial state for testing. +func GenerateStateWithSequencer(initialHeight int64, lastBlockHeight int64, pubkey tmcrypto.PubKey) *types.State { s := &types.State{ ChainID: "test-chain", InitialHeight: uint64(initialHeight), + BaseHeight: uint64(initialHeight), AppHash: [32]byte{}, LastResultsHash: GetEmptyLastResultsHash(), Version: tmstate.Version{ @@ -205,10 +236,19 @@ func GenerateState(initialHeight int64, lastBlockHeight int64) *types.State { App: AppVersion, }, }, - Validators: GenerateRandomValidatorSet(), - NextValidators: GenerateRandomValidatorSet(), + RollappParams: dymint.RollappParams{ + Da: "mock", + Version: dymintversion.Commit, + }, + ConsensusParams: tmproto.ConsensusParams{ + Block: tmproto.BlockParams{ + MaxBytes: 100, + MaxGas: 100, + }, + }, } - s.LastBlockHeight.Store(uint64(lastBlockHeight)) + s.Sequencers.SetProposer(types.NewSequencer(pubkey, "")) + s.SetHeight(uint64(lastBlockHeight)) return s } @@ -234,6 +274,7 @@ func GenerateGenesis(initialHeight int64) *tmtypes.GenesisDoc { AppVersion: AppVersion, }, }, + AppState: []byte("{\"rollappparams\": {\"params\": {\"da\": \"mock\",\"version\": \"" + dymintversion.Commit + "\"}}}"), } } @@ -262,13 +303,3 @@ func GetRandomBlock(height uint64, nTxs int) *types.Block { return block } - -func GetRandomValidatorSet() *tmtypes.ValidatorSet { - pubKey := ed25519.GenPrivKey().PubKey() - return &tmtypes.ValidatorSet{ - Proposer: &tmtypes.Validator{PubKey: pubKey, Address: pubKey.Address()}, - Validators: []*tmtypes.Validator{ - {PubKey: pubKey, Address: pubKey.Address()}, - }, - } -} diff --git a/third_party/dymension/rollapp/types/block_descriptor.pb.go b/third_party/dymension/rollapp/types/block_descriptor.pb.go new file mode 100644 index 000000000..1a7e3ff24 --- /dev/null +++ b/third_party/dymension/rollapp/types/block_descriptor.pb.go @@ -0,0 +1,604 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymensionxyz/dymension/rollapp/block_descriptor.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// BlockDescriptor defines a single rollapp chain block description. +type BlockDescriptor struct { + // height is the height of the block + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // stateRoot is a 32 byte array of the hash of the block (state root of the block) + StateRoot []byte `protobuf:"bytes,2,opt,name=stateRoot,proto3" json:"stateRoot,omitempty"` + // timestamp is the time of the block finalization + Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,proto3,stdtime" json:"timestamp"` +} + +func (m *BlockDescriptor) Reset() { *m = BlockDescriptor{} } +func (m *BlockDescriptor) String() string { return proto.CompactTextString(m) } +func (*BlockDescriptor) ProtoMessage() {} +func (*BlockDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_6eb4c1d0c21c2e68, []int{0} +} +func (m *BlockDescriptor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockDescriptor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BlockDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockDescriptor.Merge(m, src) +} +func (m *BlockDescriptor) XXX_Size() int { + return m.Size() +} +func (m *BlockDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_BlockDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockDescriptor proto.InternalMessageInfo + +func (m *BlockDescriptor) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockDescriptor) GetStateRoot() []byte { + if m != nil { + return m.StateRoot + } + return nil +} + +func (m *BlockDescriptor) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +// BlockDescriptors defines list of BlockDescriptor. +type BlockDescriptors struct { + BD []BlockDescriptor `protobuf:"bytes,1,rep,name=BD,proto3" json:"BD"` +} + +func (m *BlockDescriptors) Reset() { *m = BlockDescriptors{} } +func (m *BlockDescriptors) String() string { return proto.CompactTextString(m) } +func (*BlockDescriptors) ProtoMessage() {} +func (*BlockDescriptors) Descriptor() ([]byte, []int) { + return fileDescriptor_6eb4c1d0c21c2e68, []int{1} +} +func (m *BlockDescriptors) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockDescriptors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockDescriptors.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BlockDescriptors) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockDescriptors.Merge(m, src) +} +func (m *BlockDescriptors) XXX_Size() int { + return m.Size() +} +func (m *BlockDescriptors) XXX_DiscardUnknown() { + xxx_messageInfo_BlockDescriptors.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockDescriptors proto.InternalMessageInfo + +func (m *BlockDescriptors) GetBD() []BlockDescriptor { + if m != nil { + return m.BD + } + return nil +} + +func init() { + proto.RegisterType((*BlockDescriptor)(nil), "dymensionxyz.dymension.rollapp.BlockDescriptor") + proto.RegisterType((*BlockDescriptors)(nil), "dymensionxyz.dymension.rollapp.BlockDescriptors") +} + +func init() { + proto.RegisterFile("dymensionxyz/dymension/rollapp/block_descriptor.proto", fileDescriptor_6eb4c1d0c21c2e68) +} + +var fileDescriptor_6eb4c1d0c21c2e68 = []byte{ + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4e, 0xc2, 0x30, + 0x18, 0xc7, 0x57, 0x20, 0x44, 0x8a, 0x89, 0x66, 0x31, 0x66, 0x21, 0xa6, 0x2c, 0x9c, 0x76, 0x6a, + 0x13, 0xd0, 0x17, 0x68, 0xf0, 0xea, 0x61, 0xf1, 0xa2, 0x17, 0xc3, 0xa0, 0x96, 0xc5, 0x8d, 0xaf, + 0x59, 0x8b, 0x61, 0xbe, 0x82, 0x17, 0x1e, 0x8b, 0x23, 0x47, 0x4f, 0x6a, 0xb6, 0x17, 0x31, 0xdb, + 0x60, 0x18, 0x12, 0xbd, 0xf5, 0xdf, 0xfc, 0x7f, 0xfd, 0xb5, 0xfd, 0xf0, 0xcd, 0x2c, 0x8d, 0xc5, + 0x42, 0x87, 0xb0, 0x58, 0xa5, 0x6f, 0xac, 0x0e, 0x2c, 0x81, 0x28, 0x9a, 0x28, 0xc5, 0x82, 0x08, + 0xa6, 0x2f, 0x4f, 0x33, 0xa1, 0xa7, 0x49, 0xa8, 0x0c, 0x24, 0x54, 0x25, 0x60, 0xc0, 0x26, 0xbf, + 0x31, 0x5a, 0x07, 0xba, 0xc3, 0x7a, 0x17, 0x12, 0x24, 0x94, 0x55, 0x56, 0xac, 0x2a, 0xaa, 0xd7, + 0x97, 0x00, 0x32, 0x12, 0xac, 0x4c, 0xc1, 0xf2, 0x99, 0x99, 0x30, 0x16, 0xda, 0x4c, 0x62, 0x55, + 0x15, 0x06, 0xef, 0x08, 0x9f, 0xf1, 0xc2, 0x38, 0xae, 0x85, 0xf6, 0x25, 0x6e, 0xcf, 0x45, 0x28, + 0xe7, 0xc6, 0x41, 0x2e, 0xf2, 0x5a, 0xfe, 0x2e, 0xd9, 0x57, 0xb8, 0xa3, 0xcd, 0xc4, 0x08, 0x1f, + 0xc0, 0x38, 0x0d, 0x17, 0x79, 0xa7, 0xfe, 0x61, 0xc3, 0xe6, 0xb8, 0x53, 0x1f, 0xee, 0x34, 0x5d, + 0xe4, 0x75, 0x87, 0x3d, 0x5a, 0xe9, 0xe9, 0x5e, 0x4f, 0xef, 0xf7, 0x0d, 0x7e, 0xb2, 0xf9, 0xec, + 0x5b, 0xeb, 0xaf, 0x3e, 0xf2, 0x0f, 0xd8, 0xe0, 0x01, 0x9f, 0x1f, 0x5d, 0x46, 0xdb, 0xb7, 0xb8, + 0xc1, 0xc7, 0x0e, 0x72, 0x9b, 0x5e, 0x77, 0xc8, 0xe8, 0xff, 0xbf, 0x40, 0x8f, 0x68, 0xde, 0x2a, + 0x2c, 0x7e, 0x83, 0x8f, 0xf9, 0xdd, 0x26, 0x23, 0x68, 0x9b, 0x11, 0xf4, 0x9d, 0x11, 0xb4, 0xce, + 0x89, 0xb5, 0xcd, 0x89, 0xf5, 0x91, 0x13, 0xeb, 0xf1, 0x5a, 0x86, 0x66, 0xbe, 0x0c, 0xe8, 0x14, + 0x62, 0xf6, 0xc7, 0x6c, 0x5e, 0x47, 0x6c, 0x55, 0x0f, 0xc8, 0xa4, 0x4a, 0xe8, 0xa0, 0x5d, 0xbe, + 0x69, 0xf4, 0x13, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x62, 0xb7, 0x2c, 0xcf, 0x01, 0x00, 0x00, +} + +func (m *BlockDescriptor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlockDescriptor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintBlockDescriptor(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + if len(m.StateRoot) > 0 { + i -= len(m.StateRoot) + copy(dAtA[i:], m.StateRoot) + i = encodeVarintBlockDescriptor(dAtA, i, uint64(len(m.StateRoot))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintBlockDescriptor(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BlockDescriptors) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlockDescriptors) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BD) > 0 { + for iNdEx := len(m.BD) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BD[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBlockDescriptor(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintBlockDescriptor(dAtA []byte, offset int, v uint64) int { + offset -= sovBlockDescriptor(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BlockDescriptor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovBlockDescriptor(uint64(m.Height)) + } + l = len(m.StateRoot) + if l > 0 { + n += 1 + l + sovBlockDescriptor(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovBlockDescriptor(uint64(l)) + return n +} + +func (m *BlockDescriptors) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BD) > 0 { + for _, e := range m.BD { + l = e.Size() + n += 1 + l + sovBlockDescriptor(uint64(l)) + } + } + return n +} + +func sovBlockDescriptor(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBlockDescriptor(x uint64) (n int) { + return sovBlockDescriptor(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlockDescriptor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockDescriptor + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockDescriptor + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) + if m.StateRoot == nil { + m.StateRoot = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBlockDescriptor + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBlockDescriptor + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlockDescriptor(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBlockDescriptor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlockDescriptors: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockDescriptors: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BD", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBlockDescriptor + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBlockDescriptor + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BD = append(m.BD, BlockDescriptor{}) + if err := m.BD[len(m.BD)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlockDescriptor(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBlockDescriptor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBlockDescriptor(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthBlockDescriptor + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBlockDescriptor + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBlockDescriptor + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBlockDescriptor = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBlockDescriptor = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBlockDescriptor = fmt.Errorf("proto: unexpected end of group") +) \ No newline at end of file diff --git a/third_party/dymension/rollapp/types/errors.go b/third_party/dymension/rollapp/types/errors.go new file mode 100644 index 000000000..6a7963ff3 --- /dev/null +++ b/third_party/dymension/rollapp/types/errors.go @@ -0,0 +1,52 @@ +package types + +// DONTCOVER + +import ( + errorsmod "cosmossdk.io/errors" + "github.com/dymensionxyz/gerr-cosmos/gerrc" +) + +// x/rollapp module sentinel errors +var ( + ErrRollappExists = errorsmod.Register(ModuleName, 1000, "rollapp already exists") + ErrInvalidInitialSequencer = errorsmod.Register(ModuleName, 1001, "empty initial sequencer") + ErrInvalidCreatorAddress = errorsmod.Register(ModuleName, 1002, "invalid creator address") + ErrInvalidBech32Prefix = errorsmod.Register(ModuleName, 1003, "invalid Bech32 prefix") + ErrRollappFrozen = errorsmod.Register(ModuleName, 1004, "rollapp is frozen") + ErrInvalidNumBlocks = errorsmod.Register(ModuleName, 1005, "invalid number of blocks") + ErrInvalidBlockSequence = errorsmod.Register(ModuleName, 1006, "invalid block sequence") + ErrUnknownRollappID = errorsmod.Register(ModuleName, 1007, "rollapp does not exist") + ErrWrongBlockHeight = errorsmod.Register(ModuleName, 1009, "start-height does not match rollapps state") + ErrInvalidGenesisChecksum = errorsmod.Register(ModuleName, 1010, "invalid genesis checksum") + ErrInvalidStateRoot = errorsmod.Register(ModuleName, 1011, "invalid blocks state root") + ErrFeePayment = errorsmod.Register(ModuleName, 1013, "rollapp creation fee payment error") + ErrStateNotExists = errorsmod.Register(ModuleName, 1017, "state of this height doesn't exist") + ErrInvalidHeight = errorsmod.Register(ModuleName, 1018, "invalid rollapp height") + ErrInvalidRollappID = errorsmod.Register(ModuleName, 1020, "invalid rollapp-id") + ErrNoFinalizedStateYetForRollapp = errorsmod.Register(ModuleName, 1024, "no finalized state yet for rollapp") + ErrInvalidClientState = errorsmod.Register(ModuleName, 1025, "invalid client state") + ErrRollappNotRegistered = errorsmod.Register(ModuleName, 1035, "rollapp not registered") + ErrUnknownRequest = errorsmod.Register(ModuleName, 1036, "unknown request") + ErrNotFound = errorsmod.Register(ModuleName, 1037, "not found") + ErrLogic = errorsmod.Register(ModuleName, 1038, "internal logic error") + ErrInvalidAddress = errorsmod.Register(ModuleName, 1040, "invalid address") + ErrInvalidAlias = errorsmod.Wrap(gerrc.ErrInvalidArgument, "alias") + ErrInvalidURL = errorsmod.Wrap(gerrc.ErrInvalidArgument, "invalid url") + ErrInvalidDescription = errorsmod.Wrap(gerrc.ErrInvalidArgument, "description") + ErrInvalidLogoURI = errorsmod.Wrap(gerrc.ErrInvalidArgument, "logo uri") + ErrInvalidTokenLogoURI = errorsmod.Wrap(gerrc.ErrInvalidArgument, "token logo uri") + ErrInvalidMetadata = errorsmod.Wrap(gerrc.ErrInvalidArgument, "metadata") + ErrImmutableFieldUpdateAfterSealed = errorsmod.Wrap(gerrc.ErrInvalidArgument, "update immutable field after rollapp sealed") + ErrSealWithImmutableFieldsNotSet = errorsmod.Wrap(gerrc.ErrInvalidArgument, "seal with immutable fields not set") + ErrUnauthorizedSigner = errorsmod.Wrap(gerrc.ErrPermissionDenied, "unauthorized signer") + ErrSameOwner = errorsmod.Wrap(gerrc.ErrInvalidArgument, "same owner") + ErrInvalidRequest = errorsmod.Wrap(gerrc.ErrInvalidArgument, "invalid request") + ErrInvalidVMType = errorsmod.Wrap(gerrc.ErrInvalidArgument, "invalid vm type") + + /* ------------------------------ fraud related ----------------------------- */ + ErrDisputeAlreadyFinalized = errorsmod.Register(ModuleName, 2000, "disputed height already finalized") + ErrDisputeAlreadyReverted = errorsmod.Register(ModuleName, 2001, "disputed height already reverted") + ErrWrongClientId = errorsmod.Register(ModuleName, 2002, "client id does not match the rollapp") + ErrWrongProposerAddr = errorsmod.Register(ModuleName, 2003, "wrong proposer address") +) diff --git a/third_party/dymension/rollapp/types/events.go b/third_party/dymension/rollapp/types/events.go new file mode 100644 index 000000000..fad8b67b0 --- /dev/null +++ b/third_party/dymension/rollapp/types/events.go @@ -0,0 +1,22 @@ +package types + +const ( + EventTypeStateUpdate = "state_update" + EventTypeStatusChange = "status_change" + + AttributeKeyRollappId = "rollapp_id" + AttributeKeyStateInfoIndex = "state_info_index" + AttributeKeyStartHeight = "start_height" + AttributeKeyNumBlocks = "num_blocks" + AttributeKeyDAPath = "da_path" + AttributeKeyStatus = "status" + + // EventTypeFraud is emitted when a fraud evidence is submitted + EventTypeFraud = "fraud_proposal" + AttributeKeyFraudHeight = "fraud_height" + AttributeKeyFraudSequencer = "fraud_sequencer" + AttributeKeyClientID = "client_id" + + // EventTypeTransferGenesisTransfersEnabled is when the bridge is enabled + EventTypeTransferGenesisTransfersEnabled = "transfer_genesis_transfers_enabled" +) diff --git a/third_party/dymension/rollapp/types/genesis.pb.go b/third_party/dymension/rollapp/types/genesis.pb.go new file mode 100644 index 000000000..6c52485f5 --- /dev/null +++ b/third_party/dymension/rollapp/types/genesis.pb.go @@ -0,0 +1,708 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the rollapp module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + RollappList []Rollapp `protobuf:"bytes,2,rep,name=rollappList,proto3" json:"rollappList"` + StateInfoList []StateInfo `protobuf:"bytes,3,rep,name=stateInfoList,proto3" json:"stateInfoList"` + LatestStateInfoIndexList []StateInfoIndex `protobuf:"bytes,4,rep,name=latestStateInfoIndexList,proto3" json:"latestStateInfoIndexList"` + LatestFinalizedStateIndexList []StateInfoIndex `protobuf:"bytes,5,rep,name=latestFinalizedStateIndexList,proto3" json:"latestFinalizedStateIndexList"` + BlockHeightToFinalizationQueueList []BlockHeightToFinalizationQueue `protobuf:"bytes,6,rep,name=blockHeightToFinalizationQueueList,proto3" json:"blockHeightToFinalizationQueueList"` + // LivenessEvents are scheduled upcoming liveness events + LivenessEvents []LivenessEvent `protobuf:"bytes,7,rep,name=livenessEvents,proto3" json:"livenessEvents"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_f4bf6d3c28914609, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetRollappList() []Rollapp { + if m != nil { + return m.RollappList + } + return nil +} + +func (m *GenesisState) GetStateInfoList() []StateInfo { + if m != nil { + return m.StateInfoList + } + return nil +} + +func (m *GenesisState) GetLatestStateInfoIndexList() []StateInfoIndex { + if m != nil { + return m.LatestStateInfoIndexList + } + return nil +} + +func (m *GenesisState) GetLatestFinalizedStateIndexList() []StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndexList + } + return nil +} + +func (m *GenesisState) GetBlockHeightToFinalizationQueueList() []BlockHeightToFinalizationQueue { + if m != nil { + return m.BlockHeightToFinalizationQueueList + } + return nil +} + +func (m *GenesisState) GetLivenessEvents() []LivenessEvent { + if m != nil { + return m.LivenessEvents + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "dymensionxyz.dymension.rollapp.GenesisState") +} + +func init() { proto.RegisterFile("dymension/rollapp/genesis.proto", fileDescriptor_f4bf6d3c28914609) } + +var fileDescriptor_f4bf6d3c28914609 = []byte{ + // 421 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x4d, 0x6f, 0xda, 0x30, + 0x1c, 0xc6, 0x93, 0xf1, 0x32, 0xc9, 0x6c, 0x3b, 0x58, 0x3b, 0x44, 0x48, 0x33, 0x88, 0xc3, 0xc6, + 0x0e, 0x4b, 0x24, 0xd8, 0x79, 0x07, 0xb4, 0x37, 0x24, 0xd4, 0x17, 0x68, 0x2f, 0xed, 0x01, 0x19, + 0x30, 0xc1, 0x6a, 0xb0, 0xa3, 0xd8, 0x20, 0xe0, 0x53, 0xf4, 0xd0, 0x0f, 0xc5, 0x91, 0x63, 0x4f, + 0xa8, 0x82, 0x2f, 0x52, 0xe1, 0x38, 0x29, 0x2d, 0x85, 0x20, 0xf5, 0xe4, 0x58, 0x7e, 0xfe, 0xbf, + 0xdf, 0x23, 0x2b, 0x06, 0x85, 0xde, 0x74, 0x48, 0x98, 0xa0, 0x9c, 0x39, 0x01, 0xf7, 0x3c, 0xec, + 0xfb, 0x8e, 0x4b, 0x18, 0x11, 0x54, 0xd8, 0x7e, 0xc0, 0x25, 0x87, 0x28, 0x0e, 0x4c, 0xa6, 0x33, + 0x3b, 0xde, 0xd8, 0x3a, 0x9d, 0xff, 0xec, 0x72, 0x97, 0xab, 0xa8, 0xb3, 0xf9, 0x0a, 0xa7, 0xf2, + 0x68, 0x17, 0xeb, 0xe3, 0x00, 0x0f, 0x35, 0x35, 0xff, 0x8a, 0x56, 0xaf, 0x3a, 0x50, 0xda, 0x0d, + 0x08, 0x89, 0x25, 0x69, 0x53, 0xd6, 0x8f, 0x24, 0xe5, 0xbd, 0xdd, 0xdb, 0x32, 0xc0, 0x4c, 0xf4, + 0x49, 0xa0, 0x93, 0xc5, 0xdd, 0xa4, 0x47, 0xc7, 0x9b, 0xac, 0x2e, 0x54, 0x5a, 0x66, 0xc0, 0x87, + 0x7f, 0xe1, 0x70, 0x6b, 0xe3, 0x81, 0xbf, 0x41, 0x36, 0x6c, 0x6c, 0x99, 0x45, 0xb3, 0x9c, 0xab, + 0x7c, 0xb5, 0x0f, 0x5f, 0x84, 0x7d, 0xa6, 0xd2, 0xb5, 0xf4, 0x7c, 0x59, 0x30, 0x9a, 0x7a, 0x16, + 0x9e, 0x82, 0x9c, 0x3e, 0x6f, 0x50, 0x21, 0xad, 0x77, 0xc5, 0x54, 0x39, 0x57, 0xf9, 0x96, 0x84, + 0x6a, 0x86, 0xab, 0x66, 0x6d, 0x13, 0xe0, 0x25, 0xf8, 0xa8, 0xee, 0xa1, 0xce, 0xfa, 0x5c, 0x21, + 0x53, 0x0a, 0xf9, 0x3d, 0x09, 0xd9, 0x8a, 0x86, 0x34, 0xf4, 0x39, 0x05, 0xfa, 0xc0, 0xf2, 0xb0, + 0x24, 0x42, 0xc6, 0xb9, 0x3a, 0xeb, 0x91, 0x89, 0x32, 0xa4, 0x95, 0xc1, 0x3e, 0xda, 0xa0, 0x26, + 0xb5, 0x66, 0x2f, 0x15, 0xce, 0xc0, 0x97, 0xf0, 0xec, 0x2f, 0x65, 0xd8, 0xa3, 0x33, 0xd2, 0xd3, + 0xa1, 0x48, 0x9b, 0x79, 0x83, 0xf6, 0x30, 0x1a, 0xde, 0x99, 0xa0, 0xd4, 0xf1, 0x78, 0xf7, 0xe6, + 0x3f, 0xa1, 0xee, 0x40, 0x5e, 0x70, 0x1d, 0xc4, 0x92, 0x72, 0x76, 0x3e, 0x22, 0x23, 0xa2, 0x1a, + 0x64, 0x55, 0x83, 0x5f, 0x49, 0x0d, 0x6a, 0x07, 0x49, 0xba, 0xd1, 0x11, 0x3e, 0x78, 0x0d, 0x3e, + 0x45, 0x7f, 0xe5, 0x9f, 0x31, 0x61, 0x52, 0x58, 0xef, 0x55, 0x83, 0x1f, 0x49, 0x0d, 0x1a, 0xdb, + 0x53, 0x5a, 0xf8, 0x02, 0x55, 0x3b, 0x99, 0xaf, 0x90, 0xb9, 0x58, 0x21, 0xf3, 0x61, 0x85, 0xcc, + 0xdb, 0x35, 0x32, 0x16, 0x6b, 0x64, 0xdc, 0xaf, 0x91, 0x71, 0xf5, 0xd3, 0xa5, 0x72, 0x30, 0xea, + 0xd8, 0x5d, 0x3e, 0x74, 0xb6, 0x45, 0x4f, 0x1b, 0x67, 0x5c, 0x75, 0x26, 0xf1, 0xcb, 0x91, 0x53, + 0x9f, 0x88, 0x4e, 0x56, 0xbd, 0x9b, 0xea, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x1a, 0xa4, + 0x2f, 0x41, 0x04, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LivenessEvents) > 0 { + for iNdEx := len(m.LivenessEvents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LivenessEvents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.BlockHeightToFinalizationQueueList) > 0 { + for iNdEx := len(m.BlockHeightToFinalizationQueueList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlockHeightToFinalizationQueueList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.LatestFinalizedStateIndexList) > 0 { + for iNdEx := len(m.LatestFinalizedStateIndexList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LatestFinalizedStateIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.LatestStateInfoIndexList) > 0 { + for iNdEx := len(m.LatestStateInfoIndexList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LatestStateInfoIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.StateInfoList) > 0 { + for iNdEx := len(m.StateInfoList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StateInfoList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.RollappList) > 0 { + for iNdEx := len(m.RollappList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RollappList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.RollappList) > 0 { + for _, e := range m.RollappList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.StateInfoList) > 0 { + for _, e := range m.StateInfoList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LatestStateInfoIndexList) > 0 { + for _, e := range m.LatestStateInfoIndexList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LatestFinalizedStateIndexList) > 0 { + for _, e := range m.LatestFinalizedStateIndexList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BlockHeightToFinalizationQueueList) > 0 { + for _, e := range m.BlockHeightToFinalizationQueueList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LivenessEvents) > 0 { + for _, e := range m.LivenessEvents { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappList = append(m.RollappList, Rollapp{}) + if err := m.RollappList[len(m.RollappList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateInfoList = append(m.StateInfoList, StateInfo{}) + if err := m.StateInfoList[len(m.StateInfoList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateInfoIndexList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LatestStateInfoIndexList = append(m.LatestStateInfoIndexList, StateInfoIndex{}) + if err := m.LatestStateInfoIndexList[len(m.LatestStateInfoIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndexList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LatestFinalizedStateIndexList = append(m.LatestFinalizedStateIndexList, StateInfoIndex{}) + if err := m.LatestFinalizedStateIndexList[len(m.LatestFinalizedStateIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeightToFinalizationQueueList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHeightToFinalizationQueueList = append(m.BlockHeightToFinalizationQueueList, BlockHeightToFinalizationQueue{}) + if err := m.BlockHeightToFinalizationQueueList[len(m.BlockHeightToFinalizationQueueList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LivenessEvents", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LivenessEvents = append(m.LivenessEvents, LivenessEvent{}) + if err := m.LivenessEvents[len(m.LivenessEvents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/genesis_transfer.pb.go b/third_party/dymension/rollapp/types/genesis_transfer.pb.go new file mode 100644 index 000000000..687d3c360 --- /dev/null +++ b/third_party/dymension/rollapp/types/genesis_transfer.pb.go @@ -0,0 +1,398 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/genesis_transfer.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Bookkeeping for the genesis transfer bridge protocol. +// Each rollapp will have one of these items corresponding to it. +type GenesisTransfers struct { + RollappID string `protobuf:"bytes,1,opt,name=rollappID,proto3" json:"rollappID,omitempty"` + // The total number of incoming ibc transfers to be fast tracked in the genesis transfer period + NumTotal uint64 `protobuf:"varint,2,opt,name=numTotal,proto3" json:"numTotal,omitempty"` + // The number of transfers already processed, when this number reaches numTotal the genesis transfer window closes. + NumReceived uint64 `protobuf:"varint,3,opt,name=numReceived,proto3" json:"numReceived,omitempty"` +} + +func (m *GenesisTransfers) Reset() { *m = GenesisTransfers{} } +func (m *GenesisTransfers) String() string { return proto.CompactTextString(m) } +func (*GenesisTransfers) ProtoMessage() {} +func (*GenesisTransfers) Descriptor() ([]byte, []int) { + return fileDescriptor_abbd5969075b03fa, []int{0} +} +func (m *GenesisTransfers) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisTransfers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisTransfers.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisTransfers) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisTransfers.Merge(m, src) +} +func (m *GenesisTransfers) XXX_Size() int { + return m.Size() +} +func (m *GenesisTransfers) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisTransfers.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisTransfers proto.InternalMessageInfo + +func (m *GenesisTransfers) GetRollappID() string { + if m != nil { + return m.RollappID + } + return "" +} + +func (m *GenesisTransfers) GetNumTotal() uint64 { + if m != nil { + return m.NumTotal + } + return 0 +} + +func (m *GenesisTransfers) GetNumReceived() uint64 { + if m != nil { + return m.NumReceived + } + return 0 +} + +func init() { + proto.RegisterType((*GenesisTransfers)(nil), "dymensionxyz.dymension.rollapp.GenesisTransfers") +} + +func init() { + proto.RegisterFile("dymension/rollapp/genesis_transfer.proto", fileDescriptor_abbd5969075b03fa) +} + +var fileDescriptor_abbd5969075b03fa = []byte{ + // 257 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x48, 0xa9, 0xcc, 0x4d, + 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0xd3, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0x4f, + 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0x8e, 0x2f, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xd2, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x83, 0xab, 0xac, 0xa8, 0xac, 0xd2, 0x83, 0x73, 0xf4, 0xa0, + 0xda, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4a, 0xf5, 0x41, 0x2c, 0x88, 0x2e, 0x29, 0x39, + 0x4c, 0xf3, 0x0b, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0xa1, 0xf2, 0xf2, 0x98, 0xf2, 0x50, 0x1a, 0xaa, + 0x40, 0x09, 0x53, 0x41, 0x71, 0x49, 0x62, 0x49, 0x6a, 0x7c, 0x66, 0x5e, 0x1a, 0xd4, 0x12, 0xa5, + 0x3c, 0x2e, 0x01, 0x77, 0x88, 0xa3, 0x43, 0xa0, 0x6e, 0x2e, 0x16, 0x92, 0xe1, 0xe2, 0x84, 0xaa, + 0xf7, 0x74, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x08, 0x08, 0x49, 0x71, 0x71, 0xe4, + 0x95, 0xe6, 0x86, 0xe4, 0x97, 0x24, 0xe6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0xc1, 0xf9, + 0x42, 0x0a, 0x5c, 0xdc, 0x79, 0xa5, 0xb9, 0x41, 0xa9, 0xc9, 0xa9, 0x99, 0x65, 0xa9, 0x29, 0x12, + 0xcc, 0x60, 0x69, 0x64, 0x21, 0x27, 0xbf, 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, 0x32, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x47, 0x0e, 0x2f, + 0x04, 0x47, 0xbf, 0xcc, 0x58, 0xbf, 0x02, 0xee, 0x95, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, + 0xb0, 0x37, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x28, 0x1c, 0x26, 0x98, 0x8d, 0x01, 0x00, + 0x00, +} + +func (m *GenesisTransfers) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisTransfers) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisTransfers) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumReceived != 0 { + i = encodeVarintGenesisTransfer(dAtA, i, uint64(m.NumReceived)) + i-- + dAtA[i] = 0x18 + } + if m.NumTotal != 0 { + i = encodeVarintGenesisTransfer(dAtA, i, uint64(m.NumTotal)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappID) > 0 { + i -= len(m.RollappID) + copy(dAtA[i:], m.RollappID) + i = encodeVarintGenesisTransfer(dAtA, i, uint64(len(m.RollappID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesisTransfer(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesisTransfer(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisTransfers) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappID) + if l > 0 { + n += 1 + l + sovGenesisTransfer(uint64(l)) + } + if m.NumTotal != 0 { + n += 1 + sovGenesisTransfer(uint64(m.NumTotal)) + } + if m.NumReceived != 0 { + n += 1 + sovGenesisTransfer(uint64(m.NumReceived)) + } + return n +} + +func sovGenesisTransfer(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesisTransfer(x uint64) (n int) { + return sovGenesisTransfer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisTransfers) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisTransfers: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisTransfers: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesisTransfer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesisTransfer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumTotal", wireType) + } + m.NumTotal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumTotal |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumReceived", wireType) + } + m.NumReceived = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumReceived |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesisTransfer(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesisTransfer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesisTransfer(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesisTransfer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesisTransfer + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesisTransfer + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesisTransfer + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesisTransfer = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesisTransfer = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesisTransfer = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/keys.go b/third_party/dymension/rollapp/types/keys.go new file mode 100644 index 000000000..aadec02e2 --- /dev/null +++ b/third_party/dymension/rollapp/types/keys.go @@ -0,0 +1,22 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "rollapp" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_rollapp" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/third_party/dymension/rollapp/types/liveness.pb.go b/third_party/dymension/rollapp/types/liveness.pb.go new file mode 100644 index 000000000..a43a3cda3 --- /dev/null +++ b/third_party/dymension/rollapp/types/liveness.pb.go @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/liveness.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// LivenessEvent stores upcoming slash/jail actions on sequencers of rollapps +type LivenessEvent struct { + // RollappId of relevant rollapp + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // HubHeight when event will occur + HubHeight int64 `protobuf:"varint,2,opt,name=hub_height,json=hubHeight,proto3" json:"hub_height,omitempty"` + // IsJail is true iff the event is to jail rather than slash + IsJail bool `protobuf:"varint,3,opt,name=is_jail,json=isJail,proto3" json:"is_jail,omitempty"` +} + +func (m *LivenessEvent) Reset() { *m = LivenessEvent{} } +func (m *LivenessEvent) String() string { return proto.CompactTextString(m) } +func (*LivenessEvent) ProtoMessage() {} +func (*LivenessEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_2246d0b8d3a7ee7a, []int{0} +} +func (m *LivenessEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LivenessEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LivenessEvent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LivenessEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_LivenessEvent.Merge(m, src) +} +func (m *LivenessEvent) XXX_Size() int { + return m.Size() +} +func (m *LivenessEvent) XXX_DiscardUnknown() { + xxx_messageInfo_LivenessEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_LivenessEvent proto.InternalMessageInfo + +func (m *LivenessEvent) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *LivenessEvent) GetHubHeight() int64 { + if m != nil { + return m.HubHeight + } + return 0 +} + +func (m *LivenessEvent) GetIsJail() bool { + if m != nil { + return m.IsJail + } + return false +} + +func init() { + proto.RegisterType((*LivenessEvent)(nil), "dymensionxyz.dymension.rollapp.LivenessEvent") +} + +func init() { proto.RegisterFile("dymension/rollapp/liveness.proto", fileDescriptor_2246d0b8d3a7ee7a) } + +var fileDescriptor_2246d0b8d3a7ee7a = []byte{ + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x41, 0x4b, 0xc3, 0x30, + 0x1c, 0xc5, 0x1b, 0x07, 0xd3, 0x16, 0xbc, 0x14, 0xc1, 0x32, 0x30, 0x94, 0x9d, 0x7a, 0x6a, 0x18, + 0xf3, 0x13, 0x08, 0x82, 0x8a, 0x78, 0xe8, 0xd1, 0x4b, 0x49, 0xda, 0xac, 0xfd, 0x4b, 0x9b, 0x94, + 0xfd, 0xd3, 0xb2, 0xfa, 0x29, 0xfc, 0x58, 0x1e, 0x77, 0xf4, 0x28, 0xed, 0x17, 0x91, 0x75, 0xb5, + 0x0a, 0xbb, 0xe5, 0xbd, 0xf7, 0xcb, 0xe3, 0x25, 0x8e, 0x9f, 0xb6, 0xa5, 0x54, 0x08, 0x5a, 0xb1, + 0xad, 0x2e, 0x0a, 0x5e, 0x55, 0xac, 0x80, 0x46, 0x2a, 0x89, 0x18, 0x56, 0x5b, 0x6d, 0xb4, 0x4b, + 0x27, 0x62, 0xd7, 0xbe, 0x87, 0x93, 0x08, 0x47, 0x7c, 0x71, 0x95, 0xe9, 0x4c, 0x0f, 0x28, 0x3b, + 0x9c, 0x8e, 0xb7, 0x16, 0xcb, 0xd3, 0x5e, 0x34, 0xdc, 0xc8, 0x18, 0xd4, 0xe6, 0x97, 0xa1, 0x89, + 0xc6, 0x52, 0x23, 0x13, 0x1c, 0x25, 0x6b, 0x56, 0x42, 0x1a, 0xbe, 0x62, 0x89, 0x06, 0x75, 0xcc, + 0x97, 0x1b, 0xe7, 0xf2, 0x79, 0xdc, 0x72, 0xdf, 0x48, 0x65, 0xdc, 0x1b, 0xc7, 0x19, 0xcb, 0x62, + 0x48, 0x3d, 0xe2, 0x93, 0xc0, 0x8e, 0xec, 0xd1, 0x79, 0x4c, 0x0f, 0x71, 0x5e, 0x8b, 0x38, 0x97, + 0x90, 0xe5, 0xc6, 0x3b, 0xf3, 0x49, 0x30, 0x8b, 0xec, 0xbc, 0x16, 0x0f, 0x83, 0xe1, 0x5e, 0x3b, + 0xe7, 0x80, 0xf1, 0x1b, 0x87, 0xc2, 0x9b, 0xf9, 0x24, 0xb8, 0x88, 0xe6, 0x80, 0x4f, 0x1c, 0x8a, + 0xbb, 0x97, 0xcf, 0x8e, 0x92, 0x7d, 0x47, 0xc9, 0x77, 0x47, 0xc9, 0x47, 0x4f, 0xad, 0x7d, 0x4f, + 0xad, 0xaf, 0x9e, 0x5a, 0xaf, 0xb7, 0x19, 0x98, 0xbc, 0x16, 0x61, 0xa2, 0x4b, 0xf6, 0xff, 0x1b, + 0xfe, 0x04, 0x6b, 0xd6, 0x6c, 0x37, 0x3d, 0xd1, 0xb4, 0x95, 0x44, 0x31, 0x1f, 0xe6, 0xaf, 0x7f, + 0x02, 0x00, 0x00, 0xff, 0xff, 0xa4, 0xff, 0xb9, 0x45, 0x5c, 0x01, 0x00, 0x00, +} + +func (m *LivenessEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LivenessEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LivenessEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsJail { + i-- + if m.IsJail { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.HubHeight != 0 { + i = encodeVarintLiveness(dAtA, i, uint64(m.HubHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintLiveness(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintLiveness(dAtA []byte, offset int, v uint64) int { + offset -= sovLiveness(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LivenessEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovLiveness(uint64(l)) + } + if m.HubHeight != 0 { + n += 1 + sovLiveness(uint64(m.HubHeight)) + } + if m.IsJail { + n += 2 + } + return n +} + +func sovLiveness(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLiveness(x uint64) (n int) { + return sovLiveness(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LivenessEvent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiveness + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LivenessEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LivenessEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiveness + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLiveness + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiveness + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HubHeight", wireType) + } + m.HubHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiveness + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HubHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsJail", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiveness + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsJail = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipLiveness(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiveness + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLiveness(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLiveness + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLiveness + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLiveness + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLiveness + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLiveness + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLiveness + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLiveness = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLiveness = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLiveness = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/message_update_state.go b/third_party/dymension/rollapp/types/message_update_state.go new file mode 100644 index 000000000..5ac362c2a --- /dev/null +++ b/third_party/dymension/rollapp/types/message_update_state.go @@ -0,0 +1,60 @@ +package types + +import ( + "math" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgUpdateState = "update_state" + +var _ sdk.Msg = &MsgUpdateState{} + +func (msg *MsgUpdateState) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateState) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return errorsmod.Wrapf(ErrInvalidAddress, "invalid creator address (%s)", err) + } + + // an update can't be with no BDs + if msg.NumBlocks == uint64(0) { + return errorsmod.Wrap(ErrInvalidNumBlocks, "number of blocks can not be zero") + } + + if msg.NumBlocks > math.MaxUint64-msg.StartHeight { + return errorsmod.Wrapf(ErrInvalidNumBlocks, "numBlocks(%d) + startHeight(%d) exceeds max uint64", msg.NumBlocks, msg.StartHeight) + } + + // check to see that update contains all BDs + if len(msg.BDs.BD) != int(msg.NumBlocks) { + return errorsmod.Wrapf(ErrInvalidNumBlocks, "number of blocks (%d) != number of block descriptors(%d)", msg.NumBlocks, len(msg.BDs.BD)) + } + + // check to see that startHeight is not zaro + if msg.StartHeight == 0 { + return errorsmod.Wrapf(ErrWrongBlockHeight, "StartHeight must be greater than zero") + } + + // check that the blocks are sequential by height + for bdIndex := uint64(0); bdIndex < msg.NumBlocks; bdIndex += 1 { + if msg.BDs.BD[bdIndex].Height != msg.StartHeight+bdIndex { + return ErrInvalidBlockSequence + } + // check to see stateRoot is a 32 byte array + if len(msg.BDs.BD[bdIndex].StateRoot) != 32 { + return errorsmod.Wrapf(ErrInvalidStateRoot, "StateRoot of block high (%d) must be 32 byte array. But received (%d) bytes", + msg.BDs.BD[bdIndex].Height, len(msg.BDs.BD[bdIndex].StateRoot)) + } + } + + return nil +} diff --git a/third_party/dymension/rollapp/types/metadata.pb.go b/third_party/dymension/rollapp/types/metadata.pb.go new file mode 100644 index 000000000..76dd0a070 --- /dev/null +++ b/third_party/dymension/rollapp/types/metadata.pb.go @@ -0,0 +1,582 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/metadata.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type RollappMetadata struct { + // website is the rollapp website + Website string `protobuf:"bytes,1,opt,name=website,proto3" json:"website,omitempty"` + // description is the rollapp description. should be limited to 512 chars + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // logo_data_uri is a base64 rep with a URI prefix to the rollapp logo. Should be limited to 25kb. + LogoDataUri string `protobuf:"bytes,3,opt,name=logo_data_uri,json=logoDataUri,proto3" json:"logo_data_uri,omitempty"` + // token_logo_data_uri is a URI to the native token logo. Should be limited to 25kb. + TokenLogoDataUri string `protobuf:"bytes,4,opt,name=token_logo_data_uri,json=tokenLogoDataUri,proto3" json:"token_logo_data_uri,omitempty"` + // telegram is the rollapp telegram link + Telegram string `protobuf:"bytes,5,opt,name=telegram,proto3" json:"telegram,omitempty"` + // x is the rollapp twitter link + X string `protobuf:"bytes,6,opt,name=x,proto3" json:"x,omitempty"` +} + +func (m *RollappMetadata) Reset() { *m = RollappMetadata{} } +func (m *RollappMetadata) String() string { return proto.CompactTextString(m) } +func (*RollappMetadata) ProtoMessage() {} +func (*RollappMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_1b2ee545949ab800, []int{0} +} +func (m *RollappMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollappMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollappMetadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RollappMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappMetadata.Merge(m, src) +} +func (m *RollappMetadata) XXX_Size() int { + return m.Size() +} +func (m *RollappMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_RollappMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_RollappMetadata proto.InternalMessageInfo + +func (m *RollappMetadata) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *RollappMetadata) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *RollappMetadata) GetLogoDataUri() string { + if m != nil { + return m.LogoDataUri + } + return "" +} + +func (m *RollappMetadata) GetTokenLogoDataUri() string { + if m != nil { + return m.TokenLogoDataUri + } + return "" +} + +func (m *RollappMetadata) GetTelegram() string { + if m != nil { + return m.Telegram + } + return "" +} + +func (m *RollappMetadata) GetX() string { + if m != nil { + return m.X + } + return "" +} + +func init() { + proto.RegisterType((*RollappMetadata)(nil), "dymensionxyz.dymension.rollapp.RollappMetadata") +} + +func init() { proto.RegisterFile("dymension/rollapp/metadata.proto", fileDescriptor_1b2ee545949ab800) } + +var fileDescriptor_1b2ee545949ab800 = []byte{ + // 260 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0x63, 0x7e, 0x0a, 0x18, 0x10, 0xc8, 0x2c, 0x16, 0x83, 0x15, 0x75, 0x62, 0x21, 0x1e, + 0xca, 0x13, 0x20, 0x46, 0x60, 0xa8, 0xc4, 0xc2, 0x12, 0x39, 0x8d, 0x15, 0x2c, 0x92, 0x5c, 0xcb, + 0xb9, 0x85, 0x84, 0xa7, 0xe0, 0xb1, 0x10, 0x53, 0x47, 0x46, 0x94, 0xbc, 0x08, 0xaa, 0x1b, 0x42, + 0xd8, 0xfc, 0x9d, 0xf3, 0xf9, 0x0e, 0x87, 0x86, 0x69, 0x53, 0xe8, 0xb2, 0x32, 0x50, 0x4a, 0x07, + 0x79, 0xae, 0xac, 0x95, 0x85, 0x46, 0x95, 0x2a, 0x54, 0x91, 0x75, 0x80, 0xc0, 0xc4, 0x60, 0xd4, + 0xcd, 0x5b, 0x34, 0x40, 0xd4, 0xeb, 0xd3, 0x4f, 0x42, 0x4f, 0xe6, 0x9b, 0xf7, 0x5d, 0xff, 0x93, + 0x71, 0xba, 0xf7, 0xaa, 0x93, 0xca, 0xa0, 0xe6, 0x24, 0x24, 0x17, 0x07, 0xf3, 0x5f, 0x64, 0x21, + 0x3d, 0x4c, 0x75, 0xb5, 0x70, 0xc6, 0xa2, 0x81, 0x92, 0x6f, 0xf9, 0x76, 0x1c, 0xb1, 0x29, 0x3d, + 0xce, 0x21, 0x83, 0x78, 0x7d, 0x28, 0x5e, 0x3a, 0xc3, 0xb7, 0x37, 0xce, 0x3a, 0xbc, 0x51, 0xa8, + 0x1e, 0x9c, 0x61, 0x97, 0xf4, 0x0c, 0xe1, 0x59, 0x97, 0xf1, 0x7f, 0x73, 0xc7, 0x9b, 0xa7, 0xbe, + 0xba, 0x1d, 0xe9, 0xe7, 0x74, 0x1f, 0x75, 0xae, 0x33, 0xa7, 0x0a, 0xbe, 0xeb, 0x9d, 0x81, 0xd9, + 0x11, 0x25, 0x35, 0x9f, 0xf8, 0x90, 0xd4, 0xd7, 0xf7, 0x1f, 0xad, 0x20, 0xab, 0x56, 0x90, 0xef, + 0x56, 0x90, 0xf7, 0x4e, 0x04, 0xab, 0x4e, 0x04, 0x5f, 0x9d, 0x08, 0x1e, 0xaf, 0x32, 0x83, 0x4f, + 0xcb, 0x24, 0x5a, 0x40, 0x21, 0xc7, 0x8b, 0xfc, 0x81, 0x7c, 0x99, 0xc9, 0x7a, 0x58, 0x11, 0x1b, + 0xab, 0xab, 0x64, 0xe2, 0x37, 0x9c, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xa5, 0x40, 0xd1, + 0x67, 0x01, 0x00, 0x00, +} + +func (m *RollappMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RollappMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollappMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.X) > 0 { + i -= len(m.X) + copy(dAtA[i:], m.X) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.X))) + i-- + dAtA[i] = 0x32 + } + if len(m.Telegram) > 0 { + i -= len(m.Telegram) + copy(dAtA[i:], m.Telegram) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Telegram))) + i-- + dAtA[i] = 0x2a + } + if len(m.TokenLogoDataUri) > 0 { + i -= len(m.TokenLogoDataUri) + copy(dAtA[i:], m.TokenLogoDataUri) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.TokenLogoDataUri))) + i-- + dAtA[i] = 0x22 + } + if len(m.LogoDataUri) > 0 { + i -= len(m.LogoDataUri) + copy(dAtA[i:], m.LogoDataUri) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.LogoDataUri))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMetadata(dAtA []byte, offset int, v uint64) int { + offset -= sovMetadata(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RollappMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Website) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.LogoDataUri) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.TokenLogoDataUri) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.Telegram) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.X) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + return n +} + +func sovMetadata(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMetadata(x uint64) (n int) { + return sovMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RollappMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RollappMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollappMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LogoDataUri", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LogoDataUri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenLogoDataUri", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenLogoDataUri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Telegram", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Telegram = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field X", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.X = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMetadata + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMetadata(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMetadata + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMetadata + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMetadata + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMetadata = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetadata = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMetadata = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/params.go b/third_party/dymension/rollapp/types/params.go new file mode 100644 index 000000000..45f4172cb --- /dev/null +++ b/third_party/dymension/rollapp/types/params.go @@ -0,0 +1,9 @@ +package types + +import "gopkg.in/yaml.v2" + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/third_party/dymension/rollapp/types/params.pb.go b/third_party/dymension/rollapp/types/params.pb.go new file mode 100644 index 000000000..2146385c9 --- /dev/null +++ b/third_party/dymension/rollapp/types/params.pb.go @@ -0,0 +1,424 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { + // dispute_period_in_blocks the number of blocks it takes + // to change a status of a state from received to finalized. + // during that period, any user could submit fraud proof + DisputePeriodInBlocks uint64 `protobuf:"varint,1,opt,name=dispute_period_in_blocks,json=disputePeriodInBlocks,proto3" json:"dispute_period_in_blocks,omitempty" yaml:"dispute_period_in_blocks"` + // The time (num hub blocks) a sequencer has to post a block, before he will be slashed + LivenessSlashBlocks uint64 `protobuf:"varint,4,opt,name=liveness_slash_blocks,json=livenessSlashBlocks,proto3" json:"liveness_slash_blocks,omitempty" yaml:"liveness_slash_blocks"` + // The min gap (num hub blocks) between a sequence of slashes if the sequencer continues to be down + LivenessSlashInterval uint64 `protobuf:"varint,5,opt,name=liveness_slash_interval,json=livenessSlashInterval,proto3" json:"liveness_slash_interval,omitempty" yaml:"liveness_slash_interval"` + // The time (num hub blocks) a sequencer can be down after which he will be jailed rather than slashed + LivenessJailBlocks uint64 `protobuf:"varint,6,opt,name=liveness_jail_blocks,json=livenessJailBlocks,proto3" json:"liveness_jail_blocks,omitempty" yaml:"liveness_jail_blocks"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_8a5e294b0dff70d2, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetDisputePeriodInBlocks() uint64 { + if m != nil { + return m.DisputePeriodInBlocks + } + return 0 +} + +func (m *Params) GetLivenessSlashBlocks() uint64 { + if m != nil { + return m.LivenessSlashBlocks + } + return 0 +} + +func (m *Params) GetLivenessSlashInterval() uint64 { + if m != nil { + return m.LivenessSlashInterval + } + return 0 +} + +func (m *Params) GetLivenessJailBlocks() uint64 { + if m != nil { + return m.LivenessJailBlocks + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "dymensionxyz.dymension.rollapp.Params") +} + +func init() { proto.RegisterFile("dymension/rollapp/params.proto", fileDescriptor_8a5e294b0dff70d2) } + +var fileDescriptor_8a5e294b0dff70d2 = []byte{ + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x31, 0x6f, 0xb2, 0x40, + 0x18, 0xc7, 0x41, 0x79, 0x8d, 0x61, 0x32, 0xbc, 0x9a, 0xd7, 0xf8, 0x36, 0x87, 0xa1, 0x4b, 0x27, + 0x2e, 0xc6, 0x4e, 0x8e, 0x6e, 0x3a, 0x34, 0x96, 0x76, 0x32, 0x4d, 0xc8, 0x81, 0x17, 0xbd, 0xf6, + 0xe0, 0x08, 0x87, 0x44, 0xfa, 0x29, 0x3a, 0x76, 0xec, 0xc7, 0xe9, 0xe8, 0xd8, 0x89, 0x34, 0xfa, + 0x0d, 0xd8, 0x9b, 0x34, 0x1e, 0xa0, 0xd6, 0xd8, 0x8d, 0xfb, 0xff, 0x7f, 0xf7, 0xe3, 0x49, 0x9e, + 0x53, 0xc1, 0x2c, 0xf1, 0xb0, 0xcf, 0x09, 0xf3, 0x61, 0xc8, 0x28, 0x45, 0x41, 0x00, 0x03, 0x14, + 0x22, 0x8f, 0x9b, 0x41, 0xc8, 0x22, 0xa6, 0x1d, 0xfa, 0x55, 0xf2, 0x6c, 0xee, 0x0f, 0x66, 0x01, + 0x77, 0x9a, 0x73, 0x36, 0x67, 0x02, 0x85, 0xbb, 0xaf, 0xfc, 0x56, 0x07, 0xb8, 0x8c, 0x7b, 0x8c, + 0x43, 0x07, 0x71, 0x0c, 0xe3, 0x9e, 0x83, 0x23, 0xd4, 0x83, 0x2e, 0x23, 0x7e, 0xde, 0x1b, 0x5f, + 0x15, 0xb5, 0x36, 0x11, 0xbf, 0xd1, 0x1e, 0xd4, 0xf6, 0x8c, 0xf0, 0x60, 0x19, 0x61, 0x3b, 0xc0, + 0x21, 0x61, 0x33, 0x9b, 0xf8, 0xb6, 0x43, 0x99, 0xfb, 0xc4, 0xdb, 0x72, 0x57, 0xbe, 0x52, 0x86, + 0x97, 0x59, 0xaa, 0xeb, 0x09, 0xf2, 0xe8, 0xc0, 0xf8, 0x8d, 0x34, 0xac, 0x56, 0x51, 0x4d, 0x44, + 0x33, 0xf2, 0x87, 0x22, 0xd7, 0xee, 0xd5, 0x16, 0x25, 0x31, 0xf6, 0x31, 0xe7, 0x36, 0xa7, 0x88, + 0x2f, 0x4a, 0xb5, 0x22, 0xd4, 0xdd, 0x2c, 0xd5, 0x2f, 0x72, 0xf5, 0x59, 0xcc, 0xb0, 0xfe, 0x96, + 0xf9, 0xdd, 0x2e, 0x2e, 0xac, 0x53, 0xf5, 0xdf, 0x09, 0x4e, 0xfc, 0x08, 0x87, 0x31, 0xa2, 0xed, + 0x3f, 0xc2, 0x6b, 0x64, 0xa9, 0x0e, 0xce, 0x7a, 0x4b, 0xd0, 0xb0, 0x5a, 0x3f, 0xcc, 0xa3, 0x22, + 0xd7, 0x6e, 0xd5, 0xe6, 0xfe, 0xca, 0x23, 0x22, 0xb4, 0x1c, 0xb8, 0x26, 0xc4, 0x7a, 0x96, 0xea, + 0xff, 0x4f, 0xc4, 0x47, 0x94, 0x61, 0x69, 0x65, 0x3c, 0x46, 0x84, 0xe6, 0xe3, 0x0e, 0x94, 0xd7, + 0x37, 0x5d, 0x1a, 0x2b, 0xf5, 0x4a, 0xa3, 0x3a, 0x56, 0xea, 0xd5, 0x86, 0x32, 0xbc, 0x79, 0xdf, + 0x00, 0x79, 0xbd, 0x01, 0xf2, 0xe7, 0x06, 0xc8, 0x2f, 0x5b, 0x20, 0xad, 0xb7, 0x40, 0xfa, 0xd8, + 0x02, 0x69, 0x7a, 0x3d, 0x27, 0xd1, 0x62, 0xe9, 0x98, 0x2e, 0xf3, 0xe0, 0xf1, 0xea, 0x0f, 0x07, + 0x18, 0xf7, 0xe1, 0x6a, 0xff, 0x58, 0xa2, 0x24, 0xc0, 0xdc, 0xa9, 0x89, 0xb5, 0xf6, 0xbf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x54, 0x12, 0x48, 0xc3, 0x4e, 0x02, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LivenessJailBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.LivenessJailBlocks)) + i-- + dAtA[i] = 0x30 + } + if m.LivenessSlashInterval != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.LivenessSlashInterval)) + i-- + dAtA[i] = 0x28 + } + if m.LivenessSlashBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.LivenessSlashBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.DisputePeriodInBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DisputePeriodInBlocks)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DisputePeriodInBlocks != 0 { + n += 1 + sovParams(uint64(m.DisputePeriodInBlocks)) + } + if m.LivenessSlashBlocks != 0 { + n += 1 + sovParams(uint64(m.LivenessSlashBlocks)) + } + if m.LivenessSlashInterval != 0 { + n += 1 + sovParams(uint64(m.LivenessSlashInterval)) + } + if m.LivenessJailBlocks != 0 { + n += 1 + sovParams(uint64(m.LivenessJailBlocks)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisputePeriodInBlocks", wireType) + } + m.DisputePeriodInBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DisputePeriodInBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LivenessSlashBlocks", wireType) + } + m.LivenessSlashBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LivenessSlashBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LivenessSlashInterval", wireType) + } + m.LivenessSlashInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LivenessSlashInterval |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LivenessJailBlocks", wireType) + } + m.LivenessJailBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LivenessJailBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/query.pb.go b/third_party/dymension/rollapp/types/query.pb.go new file mode 100644 index 000000000..7bd7cadd8 --- /dev/null +++ b/third_party/dymension/rollapp/types/query.pb.go @@ -0,0 +1,3112 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryGetRollappRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` +} + +func (m *QueryGetRollappRequest) Reset() { *m = QueryGetRollappRequest{} } +func (m *QueryGetRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappRequest) ProtoMessage() {} +func (*QueryGetRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{2} +} +func (m *QueryGetRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappRequest.Merge(m, src) +} +func (m *QueryGetRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappRequest proto.InternalMessageInfo + +func (m *QueryGetRollappRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type QueryGetRollappByEIP155Request struct { + Eip155 uint64 `protobuf:"varint,1,opt,name=eip155,proto3" json:"eip155,omitempty"` +} + +func (m *QueryGetRollappByEIP155Request) Reset() { *m = QueryGetRollappByEIP155Request{} } +func (m *QueryGetRollappByEIP155Request) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappByEIP155Request) ProtoMessage() {} +func (*QueryGetRollappByEIP155Request) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{3} +} +func (m *QueryGetRollappByEIP155Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappByEIP155Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappByEIP155Request.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetRollappByEIP155Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappByEIP155Request.Merge(m, src) +} +func (m *QueryGetRollappByEIP155Request) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappByEIP155Request) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappByEIP155Request.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappByEIP155Request proto.InternalMessageInfo + +func (m *QueryGetRollappByEIP155Request) GetEip155() uint64 { + if m != nil { + return m.Eip155 + } + return 0 +} + +type QueryGetLatestHeightRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetLatestHeightRequest) Reset() { *m = QueryGetLatestHeightRequest{} } +func (m *QueryGetLatestHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestHeightRequest) ProtoMessage() {} +func (*QueryGetLatestHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{4} +} +func (m *QueryGetLatestHeightRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestHeightRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetLatestHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestHeightRequest.Merge(m, src) +} +func (m *QueryGetLatestHeightRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestHeightRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestHeightRequest proto.InternalMessageInfo + +func (m *QueryGetLatestHeightRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetLatestHeightRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetLatestHeightResponse struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryGetLatestHeightResponse) Reset() { *m = QueryGetLatestHeightResponse{} } +func (m *QueryGetLatestHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestHeightResponse) ProtoMessage() {} +func (*QueryGetLatestHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{5} +} +func (m *QueryGetLatestHeightResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestHeightResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetLatestHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestHeightResponse.Merge(m, src) +} +func (m *QueryGetLatestHeightResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestHeightResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestHeightResponse proto.InternalMessageInfo + +func (m *QueryGetLatestHeightResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +type QueryGetLatestStateIndexRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetLatestStateIndexRequest) Reset() { *m = QueryGetLatestStateIndexRequest{} } +func (m *QueryGetLatestStateIndexRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateIndexRequest) ProtoMessage() {} +func (*QueryGetLatestStateIndexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{6} +} +func (m *QueryGetLatestStateIndexRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestStateIndexRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetLatestStateIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateIndexRequest.Merge(m, src) +} +func (m *QueryGetLatestStateIndexRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestStateIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateIndexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestStateIndexRequest proto.InternalMessageInfo + +func (m *QueryGetLatestStateIndexRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetLatestStateIndexRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetLatestStateIndexResponse struct { + StateIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateIndex,proto3" json:"stateIndex"` +} + +func (m *QueryGetLatestStateIndexResponse) Reset() { *m = QueryGetLatestStateIndexResponse{} } +func (m *QueryGetLatestStateIndexResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateIndexResponse) ProtoMessage() {} +func (*QueryGetLatestStateIndexResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{7} +} +func (m *QueryGetLatestStateIndexResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestStateIndexResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetLatestStateIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateIndexResponse.Merge(m, src) +} +func (m *QueryGetLatestStateIndexResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestStateIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateIndexResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestStateIndexResponse proto.InternalMessageInfo + +func (m *QueryGetLatestStateIndexResponse) GetStateIndex() StateInfoIndex { + if m != nil { + return m.StateIndex + } + return StateInfoIndex{} +} + +type QueryGetRollappResponse struct { + Rollapp Rollapp `protobuf:"bytes,1,opt,name=rollapp,proto3" json:"rollapp"` + // Defines the index of the last rollapp UpdateState. + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` + // Defines the index of the last rollapp UpdateState that was finalized. + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` + LatestHeight uint64 `protobuf:"varint,4,opt,name=latestHeight,proto3" json:"latestHeight,omitempty"` + LatestFinalizedHeight uint64 `protobuf:"varint,5,opt,name=latestFinalizedHeight,proto3" json:"latestFinalizedHeight,omitempty"` +} + +func (m *QueryGetRollappResponse) Reset() { *m = QueryGetRollappResponse{} } +func (m *QueryGetRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappResponse) ProtoMessage() {} +func (*QueryGetRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{8} +} +func (m *QueryGetRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappResponse.Merge(m, src) +} +func (m *QueryGetRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappResponse proto.InternalMessageInfo + +func (m *QueryGetRollappResponse) GetRollapp() Rollapp { + if m != nil { + return m.Rollapp + } + return Rollapp{} +} + +func (m *QueryGetRollappResponse) GetLatestStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestStateIndex + } + return nil +} + +func (m *QueryGetRollappResponse) GetLatestFinalizedStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndex + } + return nil +} + +func (m *QueryGetRollappResponse) GetLatestHeight() uint64 { + if m != nil { + return m.LatestHeight + } + return 0 +} + +func (m *QueryGetRollappResponse) GetLatestFinalizedHeight() uint64 { + if m != nil { + return m.LatestFinalizedHeight + } + return 0 +} + +type QueryAllRollappRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRollappRequest) Reset() { *m = QueryAllRollappRequest{} } +func (m *QueryAllRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollappRequest) ProtoMessage() {} +func (*QueryAllRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{9} +} +func (m *QueryAllRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollappRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollappRequest.Merge(m, src) +} +func (m *QueryAllRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollappRequest proto.InternalMessageInfo + +func (m *QueryAllRollappRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllRollappResponse struct { + Rollapp []RollappSummary `protobuf:"bytes,1,rep,name=rollapp,proto3" json:"rollapp"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRollappResponse) Reset() { *m = QueryAllRollappResponse{} } +func (m *QueryAllRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollappResponse) ProtoMessage() {} +func (*QueryAllRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{10} +} +func (m *QueryAllRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollappResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollappResponse.Merge(m, src) +} +func (m *QueryAllRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollappResponse proto.InternalMessageInfo + +func (m *QueryAllRollappResponse) GetRollapp() []RollappSummary { + if m != nil { + return m.Rollapp + } + return nil +} + +func (m *QueryAllRollappResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetStateInfoRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Finalized bool `protobuf:"varint,4,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetStateInfoRequest) Reset() { *m = QueryGetStateInfoRequest{} } +func (m *QueryGetStateInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetStateInfoRequest) ProtoMessage() {} +func (*QueryGetStateInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{11} +} +func (m *QueryGetStateInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetStateInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetStateInfoRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetStateInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetStateInfoRequest.Merge(m, src) +} +func (m *QueryGetStateInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetStateInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetStateInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetStateInfoRequest proto.InternalMessageInfo + +func (m *QueryGetStateInfoRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetStateInfoRequest) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *QueryGetStateInfoRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *QueryGetStateInfoRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetStateInfoResponse struct { + StateInfo StateInfo `protobuf:"bytes,1,opt,name=stateInfo,proto3" json:"stateInfo"` +} + +func (m *QueryGetStateInfoResponse) Reset() { *m = QueryGetStateInfoResponse{} } +func (m *QueryGetStateInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetStateInfoResponse) ProtoMessage() {} +func (*QueryGetStateInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6816c5236b322a4f, []int{12} +} +func (m *QueryGetStateInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetStateInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetStateInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetStateInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetStateInfoResponse.Merge(m, src) +} +func (m *QueryGetStateInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetStateInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetStateInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetStateInfoResponse proto.InternalMessageInfo + +func (m *QueryGetStateInfoResponse) GetStateInfo() StateInfo { + if m != nil { + return m.StateInfo + } + return StateInfo{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "dymensionxyz.dymension.rollapp.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "dymensionxyz.dymension.rollapp.QueryParamsResponse") + proto.RegisterType((*QueryGetRollappRequest)(nil), "dymensionxyz.dymension.rollapp.QueryGetRollappRequest") + proto.RegisterType((*QueryGetRollappByEIP155Request)(nil), "dymensionxyz.dymension.rollapp.QueryGetRollappByEIP155Request") + proto.RegisterType((*QueryGetLatestHeightRequest)(nil), "dymensionxyz.dymension.rollapp.QueryGetLatestHeightRequest") + proto.RegisterType((*QueryGetLatestHeightResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetLatestHeightResponse") + proto.RegisterType((*QueryGetLatestStateIndexRequest)(nil), "dymensionxyz.dymension.rollapp.QueryGetLatestStateIndexRequest") + proto.RegisterType((*QueryGetLatestStateIndexResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetLatestStateIndexResponse") + proto.RegisterType((*QueryGetRollappResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetRollappResponse") + proto.RegisterType((*QueryAllRollappRequest)(nil), "dymensionxyz.dymension.rollapp.QueryAllRollappRequest") + proto.RegisterType((*QueryAllRollappResponse)(nil), "dymensionxyz.dymension.rollapp.QueryAllRollappResponse") + proto.RegisterType((*QueryGetStateInfoRequest)(nil), "dymensionxyz.dymension.rollapp.QueryGetStateInfoRequest") + proto.RegisterType((*QueryGetStateInfoResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetStateInfoResponse") +} + +func init() { proto.RegisterFile("dymension/rollapp/query.proto", fileDescriptor_6816c5236b322a4f) } + +var fileDescriptor_6816c5236b322a4f = []byte{ + // 900 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x4f, 0x33, 0x55, + 0x14, 0xee, 0xd0, 0xd2, 0xd7, 0x1e, 0xdf, 0x44, 0x72, 0x45, 0x2c, 0x15, 0x07, 0x32, 0x0b, 0x3e, + 0x5c, 0xcc, 0xa4, 0x94, 0xf2, 0x11, 0x0c, 0x02, 0x51, 0x90, 0x44, 0x09, 0x0e, 0x6e, 0xc4, 0x18, + 0x9c, 0xd2, 0xcb, 0x30, 0x66, 0x3a, 0x33, 0x74, 0xa6, 0xa4, 0x85, 0xb0, 0x31, 0xc6, 0xb5, 0x89, + 0xbf, 0xc0, 0x3f, 0xe0, 0xc2, 0x8d, 0x3f, 0xc0, 0x0d, 0x0b, 0x17, 0x24, 0x26, 0xc6, 0x8d, 0xc6, + 0x80, 0x3f, 0xc4, 0xf4, 0xde, 0x33, 0xd3, 0xf9, 0x68, 0xed, 0xb4, 0x71, 0xd5, 0xce, 0xbd, 0xe7, + 0x79, 0xce, 0x73, 0xee, 0x39, 0xf7, 0x9c, 0x0b, 0x6f, 0xd7, 0x3b, 0x0d, 0x6a, 0xb9, 0x86, 0x6d, + 0x29, 0x4d, 0xdb, 0x34, 0x35, 0xc7, 0x51, 0xae, 0x5b, 0xb4, 0xd9, 0x91, 0x9d, 0xa6, 0xed, 0xd9, + 0x44, 0x0c, 0xb6, 0xdb, 0x9d, 0x5b, 0x39, 0xf8, 0x90, 0xd1, 0xb6, 0x34, 0xad, 0xdb, 0xba, 0xcd, + 0x4c, 0x95, 0xee, 0x3f, 0x8e, 0x2a, 0xcd, 0xe9, 0xb6, 0xad, 0x9b, 0x54, 0xd1, 0x1c, 0x43, 0xd1, + 0x2c, 0xcb, 0xf6, 0x34, 0xcf, 0xb0, 0x2d, 0x17, 0x77, 0xdf, 0xb9, 0xb0, 0xdd, 0x86, 0xed, 0x2a, + 0x35, 0xcd, 0xa5, 0xdc, 0x99, 0x72, 0x53, 0xae, 0x51, 0x4f, 0x2b, 0x2b, 0x8e, 0xa6, 0x1b, 0x16, + 0x33, 0x46, 0x5b, 0x31, 0x29, 0xcf, 0xd1, 0x9a, 0x5a, 0xc3, 0xe7, 0x9a, 0x4f, 0xee, 0xe3, 0x2f, + 0x1a, 0x48, 0x49, 0x03, 0xd7, 0xd3, 0x3c, 0x7a, 0x6e, 0x58, 0x97, 0x28, 0x57, 0x9a, 0x06, 0xf2, + 0x49, 0x57, 0xc6, 0x09, 0x63, 0x56, 0xe9, 0x75, 0x8b, 0xba, 0x9e, 0xf4, 0x39, 0xbc, 0x1e, 0x59, + 0x75, 0x1d, 0xdb, 0x72, 0x29, 0x79, 0x1f, 0xf2, 0x5c, 0x41, 0x51, 0x58, 0x10, 0x96, 0x5f, 0x5d, + 0x5d, 0x94, 0xff, 0xfb, 0x88, 0x64, 0x8e, 0xdf, 0xcf, 0x3d, 0xfc, 0x35, 0x9f, 0x51, 0x11, 0x2b, + 0xad, 0xc3, 0x0c, 0x23, 0x3f, 0xa4, 0x9e, 0xca, 0xed, 0xd0, 0x2d, 0x99, 0x83, 0x02, 0x22, 0x8f, + 0xea, 0xcc, 0x45, 0x41, 0xed, 0x2d, 0x48, 0x9b, 0x20, 0xc6, 0x70, 0xfb, 0x9d, 0x0f, 0x8e, 0x4e, + 0xca, 0xd5, 0xaa, 0x8f, 0x9f, 0x81, 0x3c, 0x35, 0x9c, 0x72, 0xb5, 0xca, 0xc0, 0x39, 0x15, 0xbf, + 0xa4, 0xcf, 0xe0, 0x2d, 0x1f, 0xf9, 0x91, 0xe6, 0x51, 0xd7, 0xfb, 0x90, 0x1a, 0xfa, 0x95, 0x97, + 0xca, 0x6d, 0x77, 0xf7, 0xd2, 0xb0, 0x34, 0xd3, 0xb8, 0xa5, 0xf5, 0xe2, 0xc4, 0x82, 0xb0, 0xfc, + 0x8a, 0xda, 0x5b, 0x90, 0xd6, 0x61, 0xae, 0x3f, 0x35, 0x1e, 0xd9, 0x0c, 0xe4, 0xaf, 0xd8, 0x8a, + 0x2f, 0x89, 0x7f, 0x49, 0x5f, 0xc0, 0x7c, 0x14, 0x77, 0xda, 0xcd, 0xcc, 0x91, 0x55, 0xa7, 0xed, + 0xff, 0x43, 0x56, 0x1b, 0x16, 0x06, 0xd3, 0xa3, 0xb4, 0x4f, 0x01, 0xdc, 0x60, 0x15, 0x33, 0x2a, + 0x0f, 0xcb, 0x28, 0xf2, 0x5c, 0xda, 0x0c, 0x85, 0x99, 0x0d, 0xf1, 0x48, 0xdf, 0x66, 0xe1, 0xcd, + 0x44, 0x7a, 0xd1, 0xe3, 0x21, 0xbc, 0x40, 0x1e, 0x74, 0xb7, 0x34, 0xcc, 0x9d, 0x9f, 0x68, 0xee, + 0xc7, 0x47, 0x93, 0x33, 0x98, 0x32, 0x63, 0x61, 0xb1, 0x33, 0x18, 0x39, 0x00, 0x35, 0xc1, 0x43, + 0x4c, 0x98, 0xe5, 0x6b, 0x07, 0xfe, 0x69, 0x86, 0x9c, 0x64, 0xc7, 0x72, 0x32, 0x98, 0x90, 0x48, + 0xf0, 0xd2, 0x0c, 0xd5, 0x4d, 0x31, 0xc7, 0xaa, 0x24, 0xb2, 0x46, 0xd6, 0xe0, 0x8d, 0x18, 0x01, + 0x1a, 0x4f, 0x32, 0xe3, 0xfe, 0x9b, 0xd2, 0x97, 0x78, 0xcd, 0xf6, 0x4c, 0x33, 0x76, 0xcd, 0x0e, + 0x00, 0x7a, 0xcd, 0x26, 0xb8, 0xca, 0xbc, 0x33, 0xc9, 0xdd, 0xce, 0x24, 0xf3, 0x36, 0x88, 0x9d, + 0x49, 0x3e, 0xd1, 0x74, 0x8a, 0x58, 0x35, 0x84, 0x94, 0x7e, 0x12, 0x30, 0xd5, 0x61, 0x17, 0x98, + 0xea, 0xe3, 0x70, 0xaa, 0xb3, 0x69, 0xce, 0x0c, 0x19, 0x4e, 0x5b, 0x8d, 0x86, 0xd6, 0xec, 0xc4, + 0x33, 0x7e, 0x18, 0xd1, 0x3c, 0x81, 0xd5, 0x33, 0x4c, 0x33, 0x17, 0x13, 0x11, 0xfd, 0x8d, 0x00, + 0x45, 0xbf, 0x3e, 0x83, 0x34, 0xa5, 0xbb, 0x72, 0xd3, 0x30, 0x69, 0x04, 0xa5, 0x96, 0x53, 0xf9, + 0x47, 0xe8, 0x86, 0x67, 0xc3, 0x37, 0x3c, 0x7a, 0x41, 0x73, 0xf1, 0x0b, 0xfa, 0x15, 0xcc, 0xf6, + 0x51, 0x81, 0x87, 0xf7, 0x31, 0x14, 0x5c, 0x7f, 0x11, 0xf3, 0xb3, 0x92, 0xba, 0xe4, 0xf0, 0xe4, + 0x7a, 0x0c, 0xab, 0xbf, 0x03, 0x4c, 0x32, 0x67, 0xe4, 0x07, 0x01, 0xf2, 0xbc, 0x27, 0x93, 0xd5, + 0x61, 0x84, 0xc9, 0xb1, 0x50, 0xaa, 0x8c, 0x84, 0xe1, 0xc1, 0x48, 0xf2, 0xd7, 0xbf, 0xfd, 0xf3, + 0xfd, 0xc4, 0x32, 0x59, 0x54, 0xc2, 0x60, 0x65, 0xd0, 0x70, 0x23, 0x3f, 0x0b, 0xf0, 0x02, 0x6b, + 0x81, 0xac, 0xa7, 0x72, 0x98, 0x18, 0x24, 0xa5, 0x8d, 0x91, 0x71, 0x28, 0x76, 0x9b, 0x89, 0xad, + 0x92, 0xca, 0x30, 0xb1, 0xfe, 0xef, 0x5d, 0x50, 0x1e, 0xf7, 0xe4, 0x17, 0x01, 0x5e, 0x8b, 0x4d, + 0x26, 0xb2, 0x33, 0xa2, 0x92, 0xd8, 0x48, 0x1b, 0x3f, 0x92, 0x0d, 0x16, 0x49, 0x99, 0x28, 0xc3, + 0x22, 0xe1, 0x33, 0x52, 0xb9, 0xe3, 0xbf, 0xf7, 0xe4, 0x47, 0x01, 0x00, 0xc9, 0xf6, 0x4c, 0x33, + 0x65, 0x0a, 0x12, 0x4d, 0x26, 0xa5, 0xf0, 0x64, 0xe7, 0x90, 0x14, 0x26, 0x7c, 0x85, 0x2c, 0xa5, + 0x4c, 0x01, 0xf9, 0x55, 0x80, 0x97, 0xe1, 0xd9, 0x4b, 0xb6, 0xd3, 0x9e, 0x59, 0x9f, 0xc7, 0x40, + 0xe9, 0xdd, 0xf1, 0xc0, 0x28, 0x7e, 0x8f, 0x89, 0xdf, 0x26, 0x5b, 0xc3, 0xc4, 0xf3, 0x9e, 0x7d, + 0xce, 0x7b, 0x45, 0xa4, 0x8a, 0xfe, 0x14, 0x60, 0x2a, 0x3e, 0xb3, 0xc9, 0x7b, 0xa3, 0xa9, 0x4a, + 0x3c, 0x26, 0x4a, 0xbb, 0xe3, 0x13, 0x60, 0x68, 0x07, 0x2c, 0xb4, 0x5d, 0xb2, 0x93, 0x32, 0x34, + 0xff, 0xa9, 0x59, 0xa7, 0xed, 0x48, 0x7c, 0x0f, 0x02, 0x14, 0x82, 0x66, 0x45, 0x36, 0xd3, 0xea, + 0x8a, 0xf7, 0xea, 0xd2, 0xd6, 0x18, 0xc8, 0x51, 0x43, 0xe9, 0x3d, 0x97, 0xc3, 0x21, 0x28, 0x77, + 0x2c, 0xaa, 0xfb, 0xfd, 0xe3, 0x87, 0x27, 0x51, 0x78, 0x7c, 0x12, 0x85, 0xbf, 0x9f, 0x44, 0xe1, + 0xbb, 0x67, 0x31, 0xf3, 0xf8, 0x2c, 0x66, 0xfe, 0x78, 0x16, 0x33, 0x67, 0x6b, 0xba, 0xe1, 0x5d, + 0xb5, 0x6a, 0xf2, 0x85, 0xdd, 0x18, 0xe4, 0xe3, 0xa6, 0xa2, 0xb4, 0x03, 0x47, 0x5e, 0xc7, 0xa1, + 0x6e, 0x2d, 0xcf, 0xde, 0xe4, 0x95, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x05, 0x4c, 0xda, 0x84, + 0x99, 0x0c, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a Rollapp by index. + Rollapp(ctx context.Context, in *QueryGetRollappRequest, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) + // Queries a Rollapp by index. + RollappByEIP155(ctx context.Context, in *QueryGetRollappByEIP155Request, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) + // Queries a list of Rollapp items. + RollappAll(ctx context.Context, in *QueryAllRollappRequest, opts ...grpc.CallOption) (*QueryAllRollappResponse, error) + // Queries a LatestHeight by rollapp-id. + LatestHeight(ctx context.Context, in *QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*QueryGetLatestHeightResponse, error) + // Queries a LatestStateIndex by rollapp-id. + LatestStateIndex(ctx context.Context, in *QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateIndexResponse, error) + // Queries a StateInfo by index. + StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Rollapp(ctx context.Context, in *QueryGetRollappRequest, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) { + out := new(QueryGetRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/Rollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RollappByEIP155(ctx context.Context, in *QueryGetRollappByEIP155Request, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) { + out := new(QueryGetRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/RollappByEIP155", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RollappAll(ctx context.Context, in *QueryAllRollappRequest, opts ...grpc.CallOption) (*QueryAllRollappResponse, error) { + out := new(QueryAllRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/RollappAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestHeight(ctx context.Context, in *QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*QueryGetLatestHeightResponse, error) { + out := new(QueryGetLatestHeightResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/LatestHeight", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestStateIndex(ctx context.Context, in *QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateIndexResponse, error) { + out := new(QueryGetLatestStateIndexResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/LatestStateIndex", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) { + out := new(QueryGetStateInfoResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/StateInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a Rollapp by index. + Rollapp(context.Context, *QueryGetRollappRequest) (*QueryGetRollappResponse, error) + // Queries a Rollapp by index. + RollappByEIP155(context.Context, *QueryGetRollappByEIP155Request) (*QueryGetRollappResponse, error) + // Queries a list of Rollapp items. + RollappAll(context.Context, *QueryAllRollappRequest) (*QueryAllRollappResponse, error) + // Queries a LatestHeight by rollapp-id. + LatestHeight(context.Context, *QueryGetLatestHeightRequest) (*QueryGetLatestHeightResponse, error) + // Queries a LatestStateIndex by rollapp-id. + LatestStateIndex(context.Context, *QueryGetLatestStateIndexRequest) (*QueryGetLatestStateIndexResponse, error) + // Queries a StateInfo by index. + StateInfo(context.Context, *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Rollapp(ctx context.Context, req *QueryGetRollappRequest) (*QueryGetRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Rollapp not implemented") +} +func (*UnimplementedQueryServer) RollappByEIP155(ctx context.Context, req *QueryGetRollappByEIP155Request) (*QueryGetRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RollappByEIP155 not implemented") +} +func (*UnimplementedQueryServer) RollappAll(ctx context.Context, req *QueryAllRollappRequest) (*QueryAllRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RollappAll not implemented") +} +func (*UnimplementedQueryServer) LatestHeight(ctx context.Context, req *QueryGetLatestHeightRequest) (*QueryGetLatestHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestHeight not implemented") +} +func (*UnimplementedQueryServer) LatestStateIndex(ctx context.Context, req *QueryGetLatestStateIndexRequest) (*QueryGetLatestStateIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestStateIndex not implemented") +} +func (*UnimplementedQueryServer) StateInfo(ctx context.Context, req *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StateInfo not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Rollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Rollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/Rollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Rollapp(ctx, req.(*QueryGetRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RollappByEIP155_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRollappByEIP155Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RollappByEIP155(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/RollappByEIP155", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RollappByEIP155(ctx, req.(*QueryGetRollappByEIP155Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RollappAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RollappAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/RollappAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RollappAll(ctx, req.(*QueryAllRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/LatestHeight", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestHeight(ctx, req.(*QueryGetLatestHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestStateIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestStateIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestStateIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/LatestStateIndex", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestStateIndex(ctx, req.(*QueryGetLatestStateIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StateInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetStateInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StateInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Query/StateInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StateInfo(ctx, req.(*QueryGetStateInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dymensionxyz.dymension.rollapp.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Rollapp", + Handler: _Query_Rollapp_Handler, + }, + { + MethodName: "RollappByEIP155", + Handler: _Query_RollappByEIP155_Handler, + }, + { + MethodName: "RollappAll", + Handler: _Query_RollappAll_Handler, + }, + { + MethodName: "LatestHeight", + Handler: _Query_LatestHeight_Handler, + }, + { + MethodName: "LatestStateIndex", + Handler: _Query_LatestStateIndex_Handler, + }, + { + MethodName: "StateInfo", + Handler: _Query_StateInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dymension/rollapp/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappByEIP155Request) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetRollappByEIP155Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappByEIP155Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Eip155 != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Eip155)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestHeightRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetLatestHeightRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestHeightResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetLatestHeightResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestStateIndexRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetLatestStateIndexRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestStateIndexResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetLatestStateIndexResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.StateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestFinalizedHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LatestFinalizedHeight)) + i-- + dAtA[i] = 0x28 + } + if m.LatestHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LatestHeight)) + i-- + dAtA[i] = 0x20 + } + if m.LatestFinalizedStateIndex != nil { + { + size, err := m.LatestFinalizedStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.LatestStateIndex != nil { + { + size, err := m.LatestStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Rollapp.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllRollappRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllRollappResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Rollapp) > 0 { + for iNdEx := len(m.Rollapp) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rollapp[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetStateInfoRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetStateInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetStateInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if m.Index != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetStateInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetStateInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetStateInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.StateInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRollappByEIP155Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Eip155 != 0 { + n += 1 + sovQuery(uint64(m.Eip155)) + } + return n +} + +func (m *QueryGetLatestHeightRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetLatestHeightResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryGetLatestStateIndexRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetLatestStateIndexResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Rollapp.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.LatestStateIndex != nil { + l = m.LatestStateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.LatestFinalizedStateIndex != nil { + l = m.LatestFinalizedStateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.LatestHeight != 0 { + n += 1 + sovQuery(uint64(m.LatestHeight)) + } + if m.LatestFinalizedHeight != 0 { + n += 1 + sovQuery(uint64(m.LatestFinalizedHeight)) + } + return n +} + +func (m *QueryAllRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rollapp) > 0 { + for _, e := range m.Rollapp { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetStateInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovQuery(uint64(m.Index)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetStateInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRollappRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRollappByEIP155Request) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetRollappByEIP155Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappByEIP155Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Eip155", wireType) + } + m.Eip155 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Eip155 |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLatestHeightRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetLatestHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Finalized = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLatestHeightResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetLatestHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLatestStateIndexRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetLatestStateIndexRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestStateIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Finalized = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLatestStateIndexResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetLatestStateIndexResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestStateIndexResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRollappResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rollapp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rollapp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestStateIndex == nil { + m.LatestStateIndex = &StateInfoIndex{} + } + if err := m.LatestStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestFinalizedStateIndex == nil { + m.LatestFinalizedStateIndex = &StateInfoIndex{} + } + if err := m.LatestFinalizedStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHeight", wireType) + } + m.LatestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedHeight", wireType) + } + m.LatestFinalizedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestFinalizedHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllRollappRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllRollappResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rollapp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rollapp = append(m.Rollapp, RollappSummary{}) + if err := m.Rollapp[len(m.Rollapp)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetStateInfoRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetStateInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetStateInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Finalized = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetStateInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetStateInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetStateInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/query.pb.gw.go b/third_party/dymension/rollapp/types/query.pb.gw.go new file mode 100644 index 000000000..190a21b4b --- /dev/null +++ b/third_party/dymension/rollapp/types/query.pb.gw.go @@ -0,0 +1,817 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: dymension/rollapp/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := client.Rollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := server.Rollapp(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_RollappByEIP155_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappByEIP155Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["eip155"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "eip155") + } + + protoReq.Eip155, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "eip155", err) + } + + msg, err := client.RollappByEIP155(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RollappByEIP155_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappByEIP155Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["eip155"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "eip155") + } + + protoReq.Eip155, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "eip155", err) + } + + msg, err := server.RollappByEIP155(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RollappAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollappRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RollappAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RollappAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollappRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RollappAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RollappAll(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestHeight_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestHeight_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestHeight_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestHeight(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestStateIndex_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateIndexRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateIndex_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestStateIndex(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateIndexRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateIndex_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestStateIndex(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_StateInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0, "index": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetStateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StateInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.StateInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetStateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StateInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.StateInfo(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Rollapp_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Rollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappByEIP155_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RollappByEIP155_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RollappByEIP155_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RollappAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RollappAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LatestHeight_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LatestHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestStateIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LatestStateIndex_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LatestStateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StateInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Rollapp_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Rollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappByEIP155_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RollappByEIP155_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RollappByEIP155_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RollappAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RollappAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LatestHeight_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LatestHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestStateIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LatestStateIndex_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LatestStateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_StateInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension", "rollapp", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Rollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dymensionxyz", "dymension", "rollapp", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RollappByEIP155_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 3}, []string{"dymensionxyz", "dymension", "rollapp", "eip155"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RollappAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2}, []string{"dymensionxyz", "dymension", "rollapp"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "rollapp", "latest_height", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestStateIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "rollapp", "latest_state_index", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"dymensionxyz", "dymension", "rollapp", "state_info", "rollappId", "index"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Rollapp_0 = runtime.ForwardResponseMessage + + forward_Query_RollappByEIP155_0 = runtime.ForwardResponseMessage + + forward_Query_RollappAll_0 = runtime.ForwardResponseMessage + + forward_Query_LatestHeight_0 = runtime.ForwardResponseMessage + + forward_Query_LatestStateIndex_0 = runtime.ForwardResponseMessage + + forward_Query_StateInfo_0 = runtime.ForwardResponseMessage +) diff --git a/third_party/dymension/rollapp/types/rollapp.pb.go b/third_party/dymension/rollapp/types/rollapp.pb.go new file mode 100644 index 000000000..431f8719a --- /dev/null +++ b/third_party/dymension/rollapp/types/rollapp.pb.go @@ -0,0 +1,1479 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/rollapp.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Rollapp_VMType int32 + +const ( + Rollapp_Unspecified Rollapp_VMType = 0 + Rollapp_EVM Rollapp_VMType = 1 + Rollapp_WASM Rollapp_VMType = 2 +) + +var Rollapp_VMType_name = map[int32]string{ + 0: "Unspecified", + 1: "EVM", + 2: "WASM", +} + +var Rollapp_VMType_value = map[string]int32{ + "Unspecified": 0, + "EVM": 1, + "WASM": 2, +} + +func (x Rollapp_VMType) String() string { + return proto.EnumName(Rollapp_VMType_name, int32(x)) +} + +func (Rollapp_VMType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_2c072320fdc0abd9, []int{1, 0} +} + +// RollappGenesisState is a partial repr of the state the hub can expect the rollapp to be in upon genesis +type RollappGenesisState struct { + // If true, then full usage of the canonical ibc transfer channel is enabled. + // Note: in v3.1.0 and prior this field marked the completion of the 'genesis event' + // Keeping and renaming the field enables a seamless upgrade https://www.notion.so/dymension/ADR-x-Genesis-Bridge-Phase-2-89769aa551b5440b9ed403a101775ce1?pvs=4#89698384d815435b87393dbe45bc5a74 + // to the new genesis transfer protocol + // Note: if this field is false, ibc transfers may still be allowed in one or either direction. + TransfersEnabled bool `protobuf:"varint,2,opt,name=transfers_enabled,json=transfersEnabled,proto3" json:"transfers_enabled,omitempty"` +} + +func (m *RollappGenesisState) Reset() { *m = RollappGenesisState{} } +func (m *RollappGenesisState) String() string { return proto.CompactTextString(m) } +func (*RollappGenesisState) ProtoMessage() {} +func (*RollappGenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_2c072320fdc0abd9, []int{0} +} +func (m *RollappGenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollappGenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollappGenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RollappGenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappGenesisState.Merge(m, src) +} +func (m *RollappGenesisState) XXX_Size() int { + return m.Size() +} +func (m *RollappGenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_RollappGenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_RollappGenesisState proto.InternalMessageInfo + +func (m *RollappGenesisState) GetTransfersEnabled() bool { + if m != nil { + return m.TransfersEnabled + } + return false +} + +// Rollapp defines a rollapp object. First, the RollApp is created and then +// sequencers can be created and attached. The RollApp is identified by rollappId +type Rollapp struct { + // The unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // owner is the bech32-encoded address of the rollapp owner. + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // genesis_state is a partial repr of the state the hub can expect the rollapp to be in upon genesis + GenesisState RollappGenesisState `protobuf:"bytes,7,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` + // channel_id will be set to the canonical IBC channel of the rollapp. + ChannelId string `protobuf:"bytes,8,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // frozen is a boolean that indicates if the rollapp is frozen. + Frozen bool `protobuf:"varint,9,opt,name=frozen,proto3" json:"frozen,omitempty"` + // registeredDenoms is a list of registered denom bases on this rollapp + RegisteredDenoms []string `protobuf:"bytes,10,rep,name=registeredDenoms,proto3" json:"registeredDenoms,omitempty"` + // unique bech32 prefix + Bech32Prefix string `protobuf:"bytes,11,opt,name=bech32_prefix,json=bech32Prefix,proto3" json:"bech32_prefix,omitempty"` + // checksum used to verify integrity of the genesis file + GenesisChecksum string `protobuf:"bytes,12,opt,name=genesis_checksum,json=genesisChecksum,proto3" json:"genesis_checksum,omitempty"` + // metadata is the rollapp metadata + Metadata *RollappMetadata `protobuf:"bytes,14,opt,name=metadata,proto3" json:"metadata,omitempty"` + // initial_sequencer is an option to preset one or more coma-separated bech32-encoded addresses of the + // sequencer(s) that are allowed to initially register and serve for this rollapp. + // if left empty, no sequencer is allowed to register. + // if set to "*" any sequencer can register. + InitialSequencer string `protobuf:"bytes,15,opt,name=initial_sequencer,json=initialSequencer,proto3" json:"initial_sequencer,omitempty"` + // vm_type is the type of rollapp machine: EVM or WASM + VmType Rollapp_VMType `protobuf:"varint,16,opt,name=vm_type,json=vmType,proto3,enum=dymensionxyz.dymension.rollapp.Rollapp_VMType" json:"vm_type,omitempty"` + // sealed is a boolean that indicates if the immutable fields are no longer updatable. + Sealed bool `protobuf:"varint,17,opt,name=sealed,proto3" json:"sealed,omitempty"` + // LivenessEventHeight is the height of an upcoming liveness event (slash or jail) + // 0 means not set + LivenessEventHeight int64 `protobuf:"varint,18,opt,name=liveness_event_height,json=livenessEventHeight,proto3" json:"liveness_event_height,omitempty"` + // The LastStateUpdateHeight HUB height when the last state update was received + LastStateUpdateHeight int64 `protobuf:"varint,19,opt,name=last_state_update_height,json=lastStateUpdateHeight,proto3" json:"last_state_update_height,omitempty"` +} + +func (m *Rollapp) Reset() { *m = Rollapp{} } +func (m *Rollapp) String() string { return proto.CompactTextString(m) } +func (*Rollapp) ProtoMessage() {} +func (*Rollapp) Descriptor() ([]byte, []int) { + return fileDescriptor_2c072320fdc0abd9, []int{1} +} +func (m *Rollapp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rollapp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rollapp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Rollapp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rollapp.Merge(m, src) +} +func (m *Rollapp) XXX_Size() int { + return m.Size() +} +func (m *Rollapp) XXX_DiscardUnknown() { + xxx_messageInfo_Rollapp.DiscardUnknown(m) +} + +var xxx_messageInfo_Rollapp proto.InternalMessageInfo + +func (m *Rollapp) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *Rollapp) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *Rollapp) GetGenesisState() RollappGenesisState { + if m != nil { + return m.GenesisState + } + return RollappGenesisState{} +} + +func (m *Rollapp) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *Rollapp) GetFrozen() bool { + if m != nil { + return m.Frozen + } + return false +} + +func (m *Rollapp) GetRegisteredDenoms() []string { + if m != nil { + return m.RegisteredDenoms + } + return nil +} + +func (m *Rollapp) GetBech32Prefix() string { + if m != nil { + return m.Bech32Prefix + } + return "" +} + +func (m *Rollapp) GetGenesisChecksum() string { + if m != nil { + return m.GenesisChecksum + } + return "" +} + +func (m *Rollapp) GetMetadata() *RollappMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Rollapp) GetInitialSequencer() string { + if m != nil { + return m.InitialSequencer + } + return "" +} + +func (m *Rollapp) GetVmType() Rollapp_VMType { + if m != nil { + return m.VmType + } + return Rollapp_Unspecified +} + +func (m *Rollapp) GetSealed() bool { + if m != nil { + return m.Sealed + } + return false +} + +func (m *Rollapp) GetLivenessEventHeight() int64 { + if m != nil { + return m.LivenessEventHeight + } + return 0 +} + +func (m *Rollapp) GetLastStateUpdateHeight() int64 { + if m != nil { + return m.LastStateUpdateHeight + } + return 0 +} + +// Rollapp summary is a compact representation of Rollapp +type RollappSummary struct { + // The unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // Defines the index of the last rollapp UpdateState. + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` + // Defines the index of the last rollapp UpdateState that was finalized. + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` +} + +func (m *RollappSummary) Reset() { *m = RollappSummary{} } +func (m *RollappSummary) String() string { return proto.CompactTextString(m) } +func (*RollappSummary) ProtoMessage() {} +func (*RollappSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_2c072320fdc0abd9, []int{2} +} +func (m *RollappSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollappSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollappSummary.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RollappSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappSummary.Merge(m, src) +} +func (m *RollappSummary) XXX_Size() int { + return m.Size() +} +func (m *RollappSummary) XXX_DiscardUnknown() { + xxx_messageInfo_RollappSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_RollappSummary proto.InternalMessageInfo + +func (m *RollappSummary) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *RollappSummary) GetLatestStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestStateIndex + } + return nil +} + +func (m *RollappSummary) GetLatestFinalizedStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndex + } + return nil +} + +func init() { + proto.RegisterEnum("dymensionxyz.dymension.rollapp.Rollapp_VMType", Rollapp_VMType_name, Rollapp_VMType_value) + proto.RegisterType((*RollappGenesisState)(nil), "dymensionxyz.dymension.rollapp.RollappGenesisState") + proto.RegisterType((*Rollapp)(nil), "dymensionxyz.dymension.rollapp.Rollapp") + proto.RegisterType((*RollappSummary)(nil), "dymensionxyz.dymension.rollapp.RollappSummary") +} + +func init() { proto.RegisterFile("dymension/rollapp/rollapp.proto", fileDescriptor_2c072320fdc0abd9) } + +var fileDescriptor_2c072320fdc0abd9 = []byte{ + // 688 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc9, 0x6e, 0xdb, 0x48, + 0x10, 0x15, 0x2d, 0x59, 0x4b, 0xcb, 0x0b, 0xdd, 0xb6, 0x67, 0x38, 0xc6, 0x98, 0x16, 0x34, 0x17, + 0xcd, 0x02, 0x12, 0x96, 0x06, 0x98, 0xf3, 0x38, 0x71, 0xbc, 0x04, 0x0a, 0x02, 0x2a, 0x76, 0x00, + 0x1f, 0x42, 0xb4, 0xc8, 0x12, 0xd5, 0x08, 0xd9, 0x64, 0xd8, 0x2d, 0x45, 0xf2, 0x57, 0xe4, 0xb3, + 0x7c, 0x09, 0xe0, 0x63, 0x4e, 0x41, 0x60, 0xff, 0x44, 0x8e, 0x01, 0x9b, 0x2d, 0xd9, 0x80, 0xb2, + 0x18, 0x39, 0x15, 0xeb, 0xbd, 0xaa, 0x7a, 0x55, 0xd5, 0x05, 0xa2, 0x3d, 0x7f, 0x1a, 0x01, 0xe3, + 0x34, 0x66, 0x76, 0x1a, 0x87, 0x21, 0x49, 0x92, 0x99, 0xb5, 0x92, 0x34, 0x16, 0x31, 0x36, 0xe7, + 0x01, 0x93, 0xe9, 0xa5, 0x35, 0x77, 0x2c, 0x15, 0xb5, 0xb3, 0x15, 0xc4, 0x41, 0x2c, 0x43, 0xed, + 0xec, 0x2b, 0xcf, 0xda, 0x31, 0xbd, 0x98, 0x47, 0x31, 0xb7, 0xfb, 0x84, 0x83, 0x3d, 0xde, 0xef, + 0x83, 0x20, 0xfb, 0xb6, 0x17, 0x53, 0xa6, 0xf8, 0x5f, 0x15, 0x1f, 0xf1, 0xc0, 0x1e, 0xef, 0x67, + 0x46, 0x11, 0xcd, 0xc5, 0x7e, 0xb8, 0x20, 0x02, 0x5c, 0xca, 0x06, 0xb3, 0xe2, 0x8d, 0xc5, 0x98, + 0x08, 0x04, 0xf1, 0x89, 0x20, 0x79, 0x44, 0xf3, 0x18, 0x6d, 0x3a, 0x39, 0x73, 0x04, 0x0c, 0x38, + 0xe5, 0xbd, 0xac, 0x06, 0xfe, 0x1b, 0x6d, 0x88, 0x94, 0x30, 0x3e, 0x80, 0x94, 0xbb, 0xc0, 0x48, + 0x3f, 0x04, 0xdf, 0x58, 0x6a, 0x68, 0xad, 0xaa, 0xa3, 0xcf, 0x89, 0xc3, 0x1c, 0x3f, 0x2d, 0x55, + 0x35, 0x7d, 0xa9, 0xf9, 0x7e, 0x19, 0x55, 0x54, 0x29, 0xbc, 0x8b, 0x90, 0xd2, 0x73, 0xa9, 0x6f, + 0x68, 0x0d, 0xad, 0x55, 0x73, 0x6a, 0x0a, 0x39, 0xf1, 0xf1, 0x16, 0x5a, 0x8e, 0xdf, 0x32, 0x48, + 0x65, 0xc5, 0x9a, 0x93, 0x3b, 0xf8, 0x15, 0x5a, 0x0d, 0xf2, 0x1e, 0x5c, 0x39, 0x88, 0x51, 0x69, + 0x68, 0xad, 0x7a, 0xbb, 0x63, 0x7d, 0x7f, 0xaf, 0xd6, 0x57, 0xfa, 0x3f, 0x28, 0x5d, 0x7d, 0xdc, + 0x2b, 0x38, 0x2b, 0xc1, 0xfd, 0x99, 0x76, 0x11, 0xf2, 0x86, 0x84, 0x31, 0x08, 0xb3, 0xa6, 0xaa, + 0x79, 0x53, 0x0a, 0x39, 0xf1, 0xf1, 0x2f, 0xa8, 0x3c, 0x48, 0xe3, 0x4b, 0x60, 0x46, 0x4d, 0xce, + 0xa9, 0x3c, 0xfc, 0x17, 0xd2, 0x53, 0x08, 0x28, 0x17, 0x90, 0x82, 0xff, 0x18, 0x58, 0x1c, 0x71, + 0x03, 0x35, 0x8a, 0xad, 0x9a, 0xb3, 0x80, 0xe3, 0x3f, 0xd0, 0x6a, 0x1f, 0xbc, 0x61, 0xa7, 0xed, + 0x26, 0x29, 0x0c, 0xe8, 0xc4, 0xa8, 0x4b, 0x95, 0x95, 0x1c, 0x7c, 0x2e, 0x31, 0xfc, 0x27, 0xd2, + 0x67, 0x73, 0x7a, 0x43, 0xf0, 0x5e, 0xf3, 0x51, 0x64, 0xac, 0xc8, 0xb8, 0x75, 0x85, 0x3f, 0x52, + 0x30, 0x7e, 0x8a, 0xaa, 0xb3, 0xf7, 0x32, 0xd6, 0xe4, 0x36, 0xec, 0x07, 0x6e, 0xa3, 0xab, 0xd2, + 0x9c, 0x79, 0x81, 0xec, 0x4d, 0x29, 0xa3, 0x82, 0x92, 0xd0, 0xe5, 0xf0, 0x66, 0x04, 0xcc, 0x83, + 0xd4, 0x58, 0x97, 0xc2, 0xba, 0x22, 0x7a, 0x33, 0x1c, 0x1f, 0xa1, 0xca, 0x38, 0x72, 0xc5, 0x34, + 0x01, 0x43, 0x6f, 0x68, 0xad, 0xb5, 0xb6, 0xf5, 0x40, 0x61, 0xeb, 0xbc, 0xfb, 0x62, 0x9a, 0x80, + 0x53, 0x1e, 0x47, 0x99, 0xcd, 0xd6, 0xca, 0x81, 0x64, 0xe7, 0xb3, 0x91, 0xaf, 0x35, 0xf7, 0x70, + 0x1b, 0x6d, 0x87, 0x74, 0x9c, 0xcd, 0xcb, 0x5d, 0x18, 0x03, 0x13, 0xee, 0x10, 0x68, 0x30, 0x14, + 0x06, 0x6e, 0x68, 0xad, 0xa2, 0xb3, 0x39, 0x23, 0x0f, 0x33, 0xee, 0x58, 0x52, 0xf8, 0x3f, 0x64, + 0x84, 0x84, 0x8b, 0xfc, 0x3c, 0xdc, 0x51, 0xe2, 0x67, 0x46, 0xa5, 0x6d, 0xca, 0xb4, 0xed, 0x8c, + 0x97, 0xcf, 0x7d, 0x26, 0xd9, 0x3c, 0xb1, 0xf9, 0x0f, 0x2a, 0xe7, 0x6d, 0xe1, 0x75, 0x54, 0x3f, + 0x63, 0x3c, 0x01, 0x8f, 0x0e, 0x28, 0xf8, 0x7a, 0x01, 0x57, 0x50, 0xf1, 0xf0, 0xbc, 0xab, 0x6b, + 0xb8, 0x8a, 0x4a, 0x2f, 0xff, 0xef, 0x75, 0xf5, 0xa5, 0xd3, 0x52, 0xb5, 0xa8, 0x57, 0x9a, 0x9f, + 0x35, 0xb4, 0xa6, 0x66, 0xea, 0x8d, 0xa2, 0x88, 0xa4, 0x53, 0xfc, 0x3b, 0xba, 0x3b, 0xe2, 0xc5, + 0xab, 0xbe, 0x40, 0x7a, 0x48, 0x04, 0x28, 0xfd, 0x13, 0xe6, 0xc3, 0x44, 0x1e, 0x78, 0xfd, 0xc7, + 0xbb, 0x53, 0x19, 0x83, 0x58, 0x66, 0x39, 0x0b, 0x75, 0x70, 0x88, 0x7e, 0xcb, 0xb1, 0x27, 0x94, + 0x91, 0x90, 0x5e, 0x82, 0x7f, 0x4f, 0xa4, 0xf8, 0x53, 0x22, 0xdf, 0x2e, 0x78, 0xf0, 0xec, 0xea, + 0xc6, 0xd4, 0xae, 0x6f, 0x4c, 0xed, 0xd3, 0x8d, 0xa9, 0xbd, 0xbb, 0x35, 0x0b, 0xd7, 0xb7, 0x66, + 0xe1, 0xc3, 0xad, 0x59, 0xb8, 0xf8, 0x37, 0xa0, 0x62, 0x38, 0xea, 0x5b, 0x5e, 0x1c, 0xd9, 0xf7, + 0xe5, 0xee, 0x1c, 0x7b, 0xdc, 0xb1, 0x27, 0xf3, 0xbf, 0x4d, 0x76, 0x40, 0xbc, 0x5f, 0x96, 0xff, + 0x9a, 0xce, 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x5c, 0xa0, 0xd1, 0x43, 0x05, 0x00, 0x00, +} + +func (m *RollappGenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RollappGenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollappGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TransfersEnabled { + i-- + if m.TransfersEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + return len(dAtA) - i, nil +} + +func (m *Rollapp) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Rollapp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastStateUpdateHeight != 0 { + i = encodeVarintRollapp(dAtA, i, uint64(m.LastStateUpdateHeight)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x98 + } + if m.LivenessEventHeight != 0 { + i = encodeVarintRollapp(dAtA, i, uint64(m.LivenessEventHeight)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x90 + } + if m.Sealed { + i-- + if m.Sealed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.VmType != 0 { + i = encodeVarintRollapp(dAtA, i, uint64(m.VmType)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if len(m.InitialSequencer) > 0 { + i -= len(m.InitialSequencer) + copy(dAtA[i:], m.InitialSequencer) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.InitialSequencer))) + i-- + dAtA[i] = 0x7a + } + if m.Metadata != nil { + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + if len(m.GenesisChecksum) > 0 { + i -= len(m.GenesisChecksum) + copy(dAtA[i:], m.GenesisChecksum) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.GenesisChecksum))) + i-- + dAtA[i] = 0x62 + } + if len(m.Bech32Prefix) > 0 { + i -= len(m.Bech32Prefix) + copy(dAtA[i:], m.Bech32Prefix) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.Bech32Prefix))) + i-- + dAtA[i] = 0x5a + } + if len(m.RegisteredDenoms) > 0 { + for iNdEx := len(m.RegisteredDenoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RegisteredDenoms[iNdEx]) + copy(dAtA[i:], m.RegisteredDenoms[iNdEx]) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RegisteredDenoms[iNdEx]))) + i-- + dAtA[i] = 0x52 + } + } + if m.Frozen { + i-- + if m.Frozen { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x42 + } + { + size, err := m.GenesisState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RollappSummary) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RollappSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollappSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestFinalizedStateIndex != nil { + { + size, err := m.LatestFinalizedStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.LatestStateIndex != nil { + { + size, err := m.LatestStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRollapp(dAtA []byte, offset int, v uint64) int { + offset -= sovRollapp(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RollappGenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TransfersEnabled { + n += 2 + } + return n +} + +func (m *Rollapp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + l = m.GenesisState.Size() + n += 1 + l + sovRollapp(uint64(l)) + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.Frozen { + n += 2 + } + if len(m.RegisteredDenoms) > 0 { + for _, s := range m.RegisteredDenoms { + l = len(s) + n += 1 + l + sovRollapp(uint64(l)) + } + } + l = len(m.Bech32Prefix) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + l = len(m.GenesisChecksum) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + l = len(m.InitialSequencer) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.VmType != 0 { + n += 2 + sovRollapp(uint64(m.VmType)) + } + if m.Sealed { + n += 3 + } + if m.LivenessEventHeight != 0 { + n += 2 + sovRollapp(uint64(m.LivenessEventHeight)) + } + if m.LastStateUpdateHeight != 0 { + n += 2 + sovRollapp(uint64(m.LastStateUpdateHeight)) + } + return n +} + +func (m *RollappSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.LatestStateIndex != nil { + l = m.LatestStateIndex.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + if m.LatestFinalizedStateIndex != nil { + l = m.LatestFinalizedStateIndex.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + return n +} + +func sovRollapp(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRollapp(x uint64) (n int) { + return sovRollapp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RollappGenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RollappGenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollappGenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TransfersEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TransfersEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Rollapp) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Rollapp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rollapp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GenesisState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Frozen", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Frozen = bool(v != 0) + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegisteredDenoms", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RegisteredDenoms = append(m.RegisteredDenoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bech32Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bech32Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisChecksum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisChecksum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &RollappMetadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialSequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialSequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VmType", wireType) + } + m.VmType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VmType |= Rollapp_VMType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sealed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sealed = bool(v != 0) + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LivenessEventHeight", wireType) + } + m.LivenessEventHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LivenessEventHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 19: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastStateUpdateHeight", wireType) + } + m.LastStateUpdateHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastStateUpdateHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RollappSummary) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RollappSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollappSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestStateIndex == nil { + m.LatestStateIndex = &StateInfoIndex{} + } + if err := m.LatestStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestFinalizedStateIndex == nil { + m.LatestFinalizedStateIndex = &StateInfoIndex{} + } + if err := m.LatestFinalizedStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRollapp(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRollapp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRollapp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRollapp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRollapp + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRollapp + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRollapp + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRollapp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRollapp = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRollapp = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/state_info.pb.go b/third_party/dymension/rollapp/types/state_info.pb.go new file mode 100644 index 000000000..ae2e20ee5 --- /dev/null +++ b/third_party/dymension/rollapp/types/state_info.pb.go @@ -0,0 +1,1328 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/state_info.proto + +package types + +import ( + fmt "fmt" + types "github.com/dymensionxyz/dymension/v3/x/common/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) index of the latest StateInfo that was finalized +type StateInfoIndex struct { + // rollappId is the rollapp that the sequencer belongs to and asking to update + // it used to identify the what rollapp a StateInfo belongs + // The rollappId follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is 1 + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *StateInfoIndex) Reset() { *m = StateInfoIndex{} } +func (m *StateInfoIndex) String() string { return proto.CompactTextString(m) } +func (*StateInfoIndex) ProtoMessage() {} +func (*StateInfoIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_17fce0215a9cbbfb, []int{0} +} +func (m *StateInfoIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoIndex.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StateInfoIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoIndex.Merge(m, src) +} +func (m *StateInfoIndex) XXX_Size() int { + return m.Size() +} +func (m *StateInfoIndex) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoIndex proto.InternalMessageInfo + +func (m *StateInfoIndex) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *StateInfoIndex) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +// StateInfo defines a rollapps' state. +type StateInfo struct { + // stateInfoIndex defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + // sequencer is the bech32-encoded address of the sequencer sent the update + Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` + // startHeight is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` + // numBlocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` + // DAPath is the description of the location on the DA layer + DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // creationHeight is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,7,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // status is the status of the state update + Status types.Status `protobuf:"varint,8,opt,name=status,proto3,enum=dymensionxyz.dymension.common.Status" json:"status,omitempty"` + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + BDs BlockDescriptors `protobuf:"bytes,9,opt,name=BDs,proto3" json:"BDs"` +} + +func (m *StateInfo) Reset() { *m = StateInfo{} } +func (m *StateInfo) String() string { return proto.CompactTextString(m) } +func (*StateInfo) ProtoMessage() {} +func (*StateInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_17fce0215a9cbbfb, []int{1} +} +func (m *StateInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StateInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfo.Merge(m, src) +} +func (m *StateInfo) XXX_Size() int { + return m.Size() +} +func (m *StateInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfo proto.InternalMessageInfo + +func (m *StateInfo) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfo) GetSequencer() string { + if m != nil { + return m.Sequencer + } + return "" +} + +func (m *StateInfo) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *StateInfo) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *StateInfo) GetDAPath() string { + if m != nil { + return m.DAPath + } + return "" +} + +func (m *StateInfo) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *StateInfo) GetStatus() types.Status { + if m != nil { + return m.Status + } + return types.Status_PENDING +} + +func (m *StateInfo) GetBDs() BlockDescriptors { + if m != nil { + return m.BDs + } + return BlockDescriptors{} +} + +// StateInfoSummary is a compact representation of StateInfo +type StateInfoSummary struct { + // stateInfoIndex defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + // status is the status of the state update + Status types.Status `protobuf:"varint,2,opt,name=status,proto3,enum=dymensionxyz.dymension.common.Status" json:"status,omitempty"` + // creationHeight is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,3,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` +} + +func (m *StateInfoSummary) Reset() { *m = StateInfoSummary{} } +func (m *StateInfoSummary) String() string { return proto.CompactTextString(m) } +func (*StateInfoSummary) ProtoMessage() {} +func (*StateInfoSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_17fce0215a9cbbfb, []int{2} +} +func (m *StateInfoSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoSummary.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StateInfoSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoSummary.Merge(m, src) +} +func (m *StateInfoSummary) XXX_Size() int { + return m.Size() +} +func (m *StateInfoSummary) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoSummary proto.InternalMessageInfo + +func (m *StateInfoSummary) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfoSummary) GetStatus() types.Status { + if m != nil { + return m.Status + } + return types.Status_PENDING +} + +func (m *StateInfoSummary) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +// BlockHeightToFinalizationQueue defines a map from block height to list of states to finalized +type BlockHeightToFinalizationQueue struct { + // creationHeight is the block height that the state should be finalized + CreationHeight uint64 `protobuf:"varint,1,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // finalizationQueue is a list of states that are waiting to be finalized + // when the block height becomes creationHeight + FinalizationQueue []StateInfoIndex `protobuf:"bytes,2,rep,name=finalizationQueue,proto3" json:"finalizationQueue"` +} + +func (m *BlockHeightToFinalizationQueue) Reset() { *m = BlockHeightToFinalizationQueue{} } +func (m *BlockHeightToFinalizationQueue) String() string { return proto.CompactTextString(m) } +func (*BlockHeightToFinalizationQueue) ProtoMessage() {} +func (*BlockHeightToFinalizationQueue) Descriptor() ([]byte, []int) { + return fileDescriptor_17fce0215a9cbbfb, []int{3} +} +func (m *BlockHeightToFinalizationQueue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockHeightToFinalizationQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockHeightToFinalizationQueue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BlockHeightToFinalizationQueue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockHeightToFinalizationQueue.Merge(m, src) +} +func (m *BlockHeightToFinalizationQueue) XXX_Size() int { + return m.Size() +} +func (m *BlockHeightToFinalizationQueue) XXX_DiscardUnknown() { + xxx_messageInfo_BlockHeightToFinalizationQueue.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockHeightToFinalizationQueue proto.InternalMessageInfo + +func (m *BlockHeightToFinalizationQueue) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *BlockHeightToFinalizationQueue) GetFinalizationQueue() []StateInfoIndex { + if m != nil { + return m.FinalizationQueue + } + return nil +} + +func init() { + proto.RegisterType((*StateInfoIndex)(nil), "dymensionxyz.dymension.rollapp.StateInfoIndex") + proto.RegisterType((*StateInfo)(nil), "dymensionxyz.dymension.rollapp.StateInfo") + proto.RegisterType((*StateInfoSummary)(nil), "dymensionxyz.dymension.rollapp.StateInfoSummary") + proto.RegisterType((*BlockHeightToFinalizationQueue)(nil), "dymensionxyz.dymension.rollapp.BlockHeightToFinalizationQueue") +} + +func init() { + proto.RegisterFile("dymension/rollapp/state_info.proto", fileDescriptor_17fce0215a9cbbfb) +} + +var fileDescriptor_17fce0215a9cbbfb = []byte{ + // 479 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0x4f, 0x6b, 0x13, 0x41, + 0x18, 0xc6, 0x33, 0xd9, 0x34, 0xed, 0x4e, 0x21, 0xd4, 0xa1, 0xc8, 0x52, 0x74, 0x5c, 0x16, 0x94, + 0x9c, 0x76, 0xa5, 0xf5, 0xea, 0xc1, 0x10, 0xa4, 0xf1, 0x20, 0xba, 0xf5, 0x24, 0x42, 0xd9, 0x6c, + 0x26, 0xc9, 0x60, 0x76, 0x66, 0x9d, 0x3f, 0x92, 0xf4, 0x53, 0x78, 0xf2, 0x53, 0xf8, 0x41, 0x7a, + 0xec, 0x4d, 0x4f, 0x22, 0xc9, 0x17, 0x91, 0x99, 0x5d, 0x76, 0xdb, 0x24, 0x2a, 0x04, 0xbc, 0xe5, + 0x7d, 0xf7, 0x7d, 0x9e, 0x3c, 0xef, 0xef, 0x65, 0x60, 0x30, 0x5a, 0x64, 0x84, 0x49, 0xca, 0x59, + 0x24, 0xf8, 0x6c, 0x96, 0xe4, 0x79, 0x24, 0x55, 0xa2, 0xc8, 0x25, 0x65, 0x63, 0x1e, 0xe6, 0x82, + 0x2b, 0x8e, 0x70, 0x35, 0x33, 0x5f, 0x5c, 0x85, 0x55, 0x11, 0x96, 0x82, 0x93, 0xe3, 0x09, 0x9f, + 0x70, 0x3b, 0x1a, 0x99, 0x5f, 0x85, 0xea, 0xa4, 0xbb, 0xe9, 0x3c, 0x9c, 0xf1, 0xf4, 0xe3, 0xe5, + 0x88, 0xc8, 0x54, 0xd0, 0x5c, 0x71, 0x51, 0x4e, 0x3e, 0xac, 0x27, 0x53, 0x9e, 0x65, 0x9c, 0xd9, + 0x08, 0x5a, 0x16, 0x9f, 0x83, 0x3e, 0xec, 0x5c, 0x98, 0x48, 0x03, 0x36, 0xe6, 0x03, 0x36, 0x22, + 0x73, 0xf4, 0x00, 0xba, 0xa5, 0xe5, 0x60, 0xe4, 0x01, 0x1f, 0x74, 0xdd, 0xb8, 0x6e, 0xa0, 0x63, + 0xb8, 0x47, 0xcd, 0x98, 0xd7, 0xf4, 0x41, 0xb7, 0x15, 0x17, 0x45, 0xf0, 0xd5, 0x81, 0x6e, 0x65, + 0x83, 0x3e, 0xc0, 0x8e, 0xbc, 0xe3, 0x69, 0x6d, 0x0e, 0x4f, 0xc3, 0xf0, 0xef, 0xbb, 0x86, 0x77, + 0x93, 0xf4, 0x5a, 0xd7, 0x3f, 0x1f, 0x35, 0xe2, 0x35, 0x2f, 0x93, 0x4f, 0x92, 0x4f, 0x9a, 0xb0, + 0x94, 0x08, 0x9b, 0xc2, 0x8d, 0xeb, 0x06, 0xf2, 0xe1, 0xa1, 0x54, 0x89, 0x50, 0xe7, 0x84, 0x4e, + 0xa6, 0xca, 0x73, 0x6c, 0xca, 0xdb, 0x2d, 0xa3, 0x67, 0x3a, 0xeb, 0x19, 0x5a, 0xd2, 0x6b, 0xd9, + 0xef, 0x75, 0x03, 0xdd, 0x87, 0xed, 0xfe, 0x8b, 0x37, 0x89, 0x9a, 0x7a, 0x7b, 0xd6, 0xba, 0xac, + 0xd0, 0x13, 0xd8, 0x49, 0x05, 0x49, 0x14, 0xe5, 0xac, 0xb4, 0xde, 0xb7, 0xd2, 0xb5, 0x2e, 0x7a, + 0x0e, 0xdb, 0x05, 0x5f, 0xef, 0xc0, 0x07, 0xdd, 0xce, 0xe9, 0xe3, 0x3f, 0xed, 0x5c, 0x1c, 0xc3, + 0xae, 0xac, 0x65, 0x5c, 0x8a, 0xd0, 0x39, 0x74, 0x7a, 0x7d, 0xe9, 0xb9, 0x96, 0xd7, 0xd3, 0x7f, + 0xf1, 0xb2, 0x99, 0xfb, 0xd5, 0xc5, 0x65, 0x49, 0xcc, 0x58, 0xbc, 0x6a, 0x1d, 0xb4, 0x8f, 0xf6, + 0x83, 0xef, 0x00, 0x1e, 0x55, 0x54, 0x2f, 0x74, 0x96, 0x25, 0x62, 0xf1, 0x9f, 0xef, 0x53, 0x13, + 0x68, 0xee, 0x42, 0x60, 0x13, 0xb4, 0xb3, 0x0d, 0x74, 0xf0, 0x0d, 0x40, 0x6c, 0xf7, 0x2f, 0xea, + 0x77, 0xfc, 0x25, 0x65, 0xc9, 0x8c, 0x5e, 0xd9, 0x99, 0xb7, 0x9a, 0x68, 0xb2, 0xc5, 0x0a, 0x6c, + 0xbd, 0xd9, 0x10, 0xde, 0x1b, 0xaf, 0x8b, 0xbd, 0xa6, 0xef, 0xec, 0x8c, 0x64, 0xd3, 0xae, 0xf7, + 0xfa, 0x7a, 0x89, 0xc1, 0xcd, 0x12, 0x83, 0x5f, 0x4b, 0x0c, 0xbe, 0xac, 0x70, 0xe3, 0x66, 0x85, + 0x1b, 0x3f, 0x56, 0xb8, 0xf1, 0xfe, 0xd9, 0x84, 0xaa, 0xa9, 0x1e, 0x1a, 0x1c, 0xd1, 0xed, 0x3f, + 0xab, 0x8b, 0xe8, 0xf3, 0x59, 0x34, 0xaf, 0xde, 0xb9, 0x5a, 0xe4, 0x44, 0x0e, 0xdb, 0xf6, 0xf9, + 0x9e, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x18, 0x32, 0x02, 0x7e, 0x63, 0x04, 0x00, 0x00, +} + +func (m *StateInfoIndex) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StateInfoIndex) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Index != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StateInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StateInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.Status != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x38 + } + if len(m.DAPath) > 0 { + i -= len(m.DAPath) + copy(dAtA[i:], m.DAPath) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.DAPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Sequencer) > 0 { + i -= len(m.Sequencer) + copy(dAtA[i:], m.Sequencer) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.Sequencer))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StateInfoSummary) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StateInfoSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x18 + } + if m.Status != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BlockHeightToFinalizationQueue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlockHeightToFinalizationQueue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockHeightToFinalizationQueue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FinalizationQueue) > 0 { + for iNdEx := len(m.FinalizationQueue) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FinalizationQueue[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStateInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovStateInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StateInfoIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovStateInfo(uint64(m.Index)) + } + return n +} + +func (m *StateInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovStateInfo(uint64(l)) + l = len(m.Sequencer) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovStateInfo(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovStateInfo(uint64(m.NumBlocks)) + } + l = len(m.DAPath) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + if m.Status != 0 { + n += 1 + sovStateInfo(uint64(m.Status)) + } + l = m.BDs.Size() + n += 1 + l + sovStateInfo(uint64(l)) + return n +} + +func (m *StateInfoSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovStateInfo(uint64(l)) + if m.Status != 0 { + n += 1 + sovStateInfo(uint64(m.Status)) + } + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + return n +} + +func (m *BlockHeightToFinalizationQueue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + if len(m.FinalizationQueue) > 0 { + for _, e := range m.FinalizationQueue { + l = e.Size() + n += 1 + l + sovStateInfo(uint64(l)) + } + } + return n +} + +func sovStateInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStateInfo(x uint64) (n int) { + return sovStateInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StateInfoIndex) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StateInfoIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StateInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DAPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types.Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfoSummary) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StateInfoSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types.Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockHeightToFinalizationQueue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlockHeightToFinalizationQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockHeightToFinalizationQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizationQueue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FinalizationQueue = append(m.FinalizationQueue, StateInfoIndex{}) + if err := m.FinalizationQueue[len(m.FinalizationQueue)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStateInfo(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStateInfo + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStateInfo + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStateInfo + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthStateInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStateInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStateInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStateInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStateInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStateInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/tx.pb.go b/third_party/dymension/rollapp/types/tx.pb.go new file mode 100644 index 000000000..ca1cd5064 --- /dev/null +++ b/third_party/dymension/rollapp/types/tx.pb.go @@ -0,0 +1,2595 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/rollapp/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateRollapp creates a new rollapp chain on the hub. +type MsgCreateRollapp struct { + // creator is the bech32-encoded address of the rollapp creator + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollappId is the unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // initial_sequencer takes one or more coma-separated bech32-encoded addresses of the + // sequencer(s) that are allowed to initially serve this rollappId. + InitialSequencer string `protobuf:"bytes,11,opt,name=initial_sequencer,json=initialSequencer,proto3" json:"initial_sequencer,omitempty"` + // the unique rollapp address bech32 prefix. + Bech32Prefix string `protobuf:"bytes,12,opt,name=bech32_prefix,json=bech32Prefix,proto3" json:"bech32_prefix,omitempty"` + // alias is the chain alias used for display and namespace system + Alias string `protobuf:"bytes,13,opt,name=alias,proto3" json:"alias,omitempty"` + // checksum used to verify integrity of the genesis file + GenesisChecksum string `protobuf:"bytes,14,opt,name=genesis_checksum,json=genesisChecksum,proto3" json:"genesis_checksum,omitempty"` + // metadata is the rollapp metadata + Metadata *RollappMetadata `protobuf:"bytes,15,opt,name=metadata,proto3" json:"metadata,omitempty"` + // vm_type is the type of rollapp machine: EVM or WASM + VmType Rollapp_VMType `protobuf:"varint,16,opt,name=vm_type,json=vmType,proto3,enum=dymensionxyz.dymension.rollapp.Rollapp_VMType" json:"vm_type,omitempty"` +} + +func (m *MsgCreateRollapp) Reset() { *m = MsgCreateRollapp{} } +func (m *MsgCreateRollapp) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollapp) ProtoMessage() {} +func (*MsgCreateRollapp) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{0} +} +func (m *MsgCreateRollapp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollapp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollapp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateRollapp) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollapp.Merge(m, src) +} +func (m *MsgCreateRollapp) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollapp) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollapp.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollapp proto.InternalMessageInfo + +func (m *MsgCreateRollapp) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateRollapp) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgCreateRollapp) GetInitialSequencer() string { + if m != nil { + return m.InitialSequencer + } + return "" +} + +func (m *MsgCreateRollapp) GetBech32Prefix() string { + if m != nil { + return m.Bech32Prefix + } + return "" +} + +func (m *MsgCreateRollapp) GetAlias() string { + if m != nil { + return m.Alias + } + return "" +} + +func (m *MsgCreateRollapp) GetGenesisChecksum() string { + if m != nil { + return m.GenesisChecksum + } + return "" +} + +func (m *MsgCreateRollapp) GetMetadata() *RollappMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *MsgCreateRollapp) GetVmType() Rollapp_VMType { + if m != nil { + return m.VmType + } + return Rollapp_Unspecified +} + +type MsgCreateRollappResponse struct { +} + +func (m *MsgCreateRollappResponse) Reset() { *m = MsgCreateRollappResponse{} } +func (m *MsgCreateRollappResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollappResponse) ProtoMessage() {} +func (*MsgCreateRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{1} +} +func (m *MsgCreateRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollappResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollappResponse.Merge(m, src) +} +func (m *MsgCreateRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollappResponse proto.InternalMessageInfo + +// MsgUpdateRollappInformation updates the rollapp information. +type MsgUpdateRollappInformation struct { + // owner is the bech32-encoded address of the rollapp owner + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // rollapp_id is the unique identifier of the rollapp chain. + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // initial_sequencer is one or more bech32-encoded address of the + // sequencer that are allowed to initially serve this rollappId. + // wildcard '*' means any sequencer is allowed to be the first proposer. + InitialSequencer string `protobuf:"bytes,3,opt,name=initial_sequencer,json=initialSequencer,proto3" json:"initial_sequencer,omitempty"` + // checksum used to verify integrity + GenesisChecksum string `protobuf:"bytes,4,opt,name=genesis_checksum,json=genesisChecksum,proto3" json:"genesis_checksum,omitempty"` + // metadata is the rollapp metadata + Metadata *RollappMetadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` +} + +func (m *MsgUpdateRollappInformation) Reset() { *m = MsgUpdateRollappInformation{} } +func (m *MsgUpdateRollappInformation) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateRollappInformation) ProtoMessage() {} +func (*MsgUpdateRollappInformation) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{2} +} +func (m *MsgUpdateRollappInformation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateRollappInformation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateRollappInformation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateRollappInformation) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateRollappInformation.Merge(m, src) +} +func (m *MsgUpdateRollappInformation) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateRollappInformation) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateRollappInformation.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateRollappInformation proto.InternalMessageInfo + +func (m *MsgUpdateRollappInformation) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgUpdateRollappInformation) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgUpdateRollappInformation) GetInitialSequencer() string { + if m != nil { + return m.InitialSequencer + } + return "" +} + +func (m *MsgUpdateRollappInformation) GetGenesisChecksum() string { + if m != nil { + return m.GenesisChecksum + } + return "" +} + +func (m *MsgUpdateRollappInformation) GetMetadata() *RollappMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +type MsgUpdateRollappInformationResponse struct { +} + +func (m *MsgUpdateRollappInformationResponse) Reset() { *m = MsgUpdateRollappInformationResponse{} } +func (m *MsgUpdateRollappInformationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateRollappInformationResponse) ProtoMessage() {} +func (*MsgUpdateRollappInformationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{3} +} +func (m *MsgUpdateRollappInformationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateRollappInformationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateRollappInformationResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateRollappInformationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateRollappInformationResponse.Merge(m, src) +} +func (m *MsgUpdateRollappInformationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateRollappInformationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateRollappInformationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateRollappInformationResponse proto.InternalMessageInfo + +// MsgUpdateState updates a rollapp state with a block batch. +// a block batch is a list of ordered blocks (by height) +type MsgUpdateState struct { + // creator is the bech32-encoded address of the sequencer sending the update + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollappId is the rollapp that the sequencer belongs to and asking to update + // The rollappId follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // startHeight is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` + // numBlocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` + // DAPath is the description of the location on the DA layer + DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + BDs BlockDescriptors `protobuf:"bytes,7,opt,name=BDs,proto3" json:"BDs"` + // last is true if this is the last batch of the sequencer + Last bool `protobuf:"varint,8,opt,name=last,proto3" json:"last,omitempty"` +} + +func (m *MsgUpdateState) Reset() { *m = MsgUpdateState{} } +func (m *MsgUpdateState) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateState) ProtoMessage() {} +func (*MsgUpdateState) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{4} +} +func (m *MsgUpdateState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateState) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateState.Merge(m, src) +} +func (m *MsgUpdateState) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateState) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateState.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateState proto.InternalMessageInfo + +func (m *MsgUpdateState) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateState) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgUpdateState) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *MsgUpdateState) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *MsgUpdateState) GetDAPath() string { + if m != nil { + return m.DAPath + } + return "" +} + +func (m *MsgUpdateState) GetBDs() BlockDescriptors { + if m != nil { + return m.BDs + } + return BlockDescriptors{} +} + +func (m *MsgUpdateState) GetLast() bool { + if m != nil { + return m.Last + } + return false +} + +type MsgUpdateStateResponse struct { + NextProposerAddr string `protobuf:"bytes,1,opt,name=nextProposerAddr,proto3" json:"nextProposerAddr,omitempty"` + RotationInProgress bool `protobuf:"varint,2,opt,name=rotationInProgress,proto3" json:"rotationInProgress,omitempty"` +} + +func (m *MsgUpdateStateResponse) Reset() { *m = MsgUpdateStateResponse{} } +func (m *MsgUpdateStateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateStateResponse) ProtoMessage() {} +func (*MsgUpdateStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{5} +} +func (m *MsgUpdateStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateStateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateStateResponse.Merge(m, src) +} +func (m *MsgUpdateStateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateStateResponse proto.InternalMessageInfo + +func (m *MsgUpdateStateResponse) GetNextProposerAddr() string { + if m != nil { + return m.NextProposerAddr + } + return "" +} + +func (m *MsgUpdateStateResponse) GetRotationInProgress() bool { + if m != nil { + return m.RotationInProgress + } + return false +} + +// MsgTransferOwnership transfers the ownership of a rollapp chain to a new owner. +type MsgTransferOwnership struct { + // current_owner is the bech32-encoded address of the current owner + CurrentOwner string `protobuf:"bytes,1,opt,name=current_owner,json=currentOwner,proto3" json:"current_owner,omitempty"` + // new_owner is the bech32-encoded address of the new owner + NewOwner string `protobuf:"bytes,2,opt,name=new_owner,json=newOwner,proto3" json:"new_owner,omitempty"` + // rollapp_id is the unique identifier of the rollapp chain. + RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` +} + +func (m *MsgTransferOwnership) Reset() { *m = MsgTransferOwnership{} } +func (m *MsgTransferOwnership) String() string { return proto.CompactTextString(m) } +func (*MsgTransferOwnership) ProtoMessage() {} +func (*MsgTransferOwnership) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{6} +} +func (m *MsgTransferOwnership) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferOwnership.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTransferOwnership) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferOwnership.Merge(m, src) +} +func (m *MsgTransferOwnership) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferOwnership) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferOwnership.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferOwnership proto.InternalMessageInfo + +func (m *MsgTransferOwnership) GetCurrentOwner() string { + if m != nil { + return m.CurrentOwner + } + return "" +} + +func (m *MsgTransferOwnership) GetNewOwner() string { + if m != nil { + return m.NewOwner + } + return "" +} + +func (m *MsgTransferOwnership) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type MsgTransferOwnershipResponse struct { +} + +func (m *MsgTransferOwnershipResponse) Reset() { *m = MsgTransferOwnershipResponse{} } +func (m *MsgTransferOwnershipResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTransferOwnershipResponse) ProtoMessage() {} +func (*MsgTransferOwnershipResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_935cc363af28220c, []int{7} +} +func (m *MsgTransferOwnershipResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferOwnershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferOwnershipResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTransferOwnershipResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferOwnershipResponse.Merge(m, src) +} +func (m *MsgTransferOwnershipResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferOwnershipResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferOwnershipResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferOwnershipResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateRollapp)(nil), "dymensionxyz.dymension.rollapp.MsgCreateRollapp") + proto.RegisterType((*MsgCreateRollappResponse)(nil), "dymensionxyz.dymension.rollapp.MsgCreateRollappResponse") + proto.RegisterType((*MsgUpdateRollappInformation)(nil), "dymensionxyz.dymension.rollapp.MsgUpdateRollappInformation") + proto.RegisterType((*MsgUpdateRollappInformationResponse)(nil), "dymensionxyz.dymension.rollapp.MsgUpdateRollappInformationResponse") + proto.RegisterType((*MsgUpdateState)(nil), "dymensionxyz.dymension.rollapp.MsgUpdateState") + proto.RegisterType((*MsgUpdateStateResponse)(nil), "dymensionxyz.dymension.rollapp.MsgUpdateStateResponse") + proto.RegisterType((*MsgTransferOwnership)(nil), "dymensionxyz.dymension.rollapp.MsgTransferOwnership") + proto.RegisterType((*MsgTransferOwnershipResponse)(nil), "dymensionxyz.dymension.rollapp.MsgTransferOwnershipResponse") +} + +func init() { proto.RegisterFile("dymension/rollapp/tx.proto", fileDescriptor_935cc363af28220c) } + +var fileDescriptor_935cc363af28220c = []byte{ + // 815 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xe3, 0x26, 0x9b, 0x1f, 0x2f, 0x69, 0x37, 0x3b, 0xaa, 0x16, 0xcb, 0xbb, 0x78, 0xa3, + 0xac, 0x90, 0xc2, 0x22, 0xd9, 0x90, 0xae, 0x10, 0x2a, 0x5c, 0x36, 0xad, 0xc4, 0x16, 0x14, 0x36, + 0x78, 0x17, 0x0e, 0x5c, 0x22, 0xc7, 0x9e, 0x3a, 0xd6, 0xc6, 0x33, 0x66, 0x66, 0x92, 0x26, 0x70, + 0xe3, 0x02, 0x88, 0x0b, 0xe2, 0xcc, 0x89, 0xbf, 0x80, 0x3f, 0x63, 0x8f, 0x7b, 0xe4, 0x84, 0x50, + 0x7b, 0xe0, 0xdf, 0x40, 0x1e, 0xff, 0x48, 0x5a, 0xa7, 0xdd, 0xb4, 0x9c, 0xec, 0xf7, 0x7d, 0xdf, + 0xf7, 0x3c, 0xfd, 0xbc, 0x99, 0x69, 0x40, 0x73, 0x17, 0x01, 0x26, 0xdc, 0xa7, 0xc4, 0x64, 0x74, + 0x32, 0xb1, 0xc3, 0xd0, 0x14, 0x73, 0x23, 0x64, 0x54, 0x50, 0xa4, 0x67, 0xb9, 0xf9, 0xe2, 0x3b, + 0x23, 0x0b, 0x8c, 0xc4, 0xa8, 0xbd, 0xe5, 0x50, 0x1e, 0x50, 0x6e, 0x06, 0xdc, 0x33, 0x67, 0x1f, + 0x44, 0x8f, 0xb8, 0x50, 0xeb, 0xe4, 0x9b, 0x8e, 0x26, 0xd4, 0x79, 0x39, 0x74, 0x31, 0x77, 0x98, + 0x1f, 0x0a, 0xca, 0x12, 0xe7, 0x83, 0xbc, 0x33, 0x79, 0x26, 0x86, 0x56, 0xde, 0x10, 0x60, 0x61, + 0xbb, 0xb6, 0xb0, 0x13, 0xc7, 0xae, 0x47, 0x3d, 0x2a, 0x5f, 0xcd, 0xe8, 0x2d, 0x56, 0xdb, 0x3f, + 0x15, 0xa1, 0xd9, 0xe7, 0xde, 0x01, 0xc3, 0xb6, 0xc0, 0x56, 0x5c, 0x89, 0x54, 0xa8, 0x38, 0x91, + 0x40, 0x99, 0xaa, 0xb4, 0x94, 0x4e, 0xcd, 0x4a, 0x43, 0xf4, 0x36, 0x40, 0xd2, 0x7e, 0xe8, 0xbb, + 0xea, 0x96, 0x4c, 0xd6, 0x12, 0xe5, 0xc8, 0x45, 0xef, 0xc1, 0x1d, 0x9f, 0xf8, 0xc2, 0xb7, 0x27, + 0x43, 0x8e, 0xbf, 0x9d, 0x62, 0xe2, 0x60, 0xa6, 0xd6, 0xa5, 0xab, 0x99, 0x24, 0x9e, 0xa7, 0x3a, + 0x7a, 0x08, 0xdb, 0x23, 0xec, 0x8c, 0xf7, 0xba, 0xc3, 0x90, 0xe1, 0x63, 0x7f, 0xae, 0x36, 0xa4, + 0xb1, 0x11, 0x8b, 0x03, 0xa9, 0xa1, 0x5d, 0xb8, 0x65, 0x4f, 0x7c, 0x9b, 0xab, 0xdb, 0x32, 0x19, + 0x07, 0xe8, 0x5d, 0x68, 0x7a, 0x98, 0x60, 0xee, 0xf3, 0xa1, 0x33, 0xc6, 0xce, 0x4b, 0x3e, 0x0d, + 0xd4, 0x1d, 0x69, 0xb8, 0x9d, 0xe8, 0x07, 0x89, 0x8c, 0x3e, 0x87, 0x6a, 0x0a, 0x42, 0xbd, 0xdd, + 0x52, 0x3a, 0xf5, 0xae, 0x69, 0x5c, 0x3d, 0x2f, 0x23, 0xc1, 0xd0, 0x4f, 0xca, 0xac, 0xac, 0x01, + 0xfa, 0x14, 0x2a, 0xb3, 0x60, 0x28, 0x16, 0x21, 0x56, 0x9b, 0x2d, 0xa5, 0xb3, 0xd3, 0x35, 0x36, + 0xec, 0x65, 0x7c, 0xdd, 0x7f, 0xb1, 0x08, 0xb1, 0x55, 0x9e, 0x05, 0xd1, 0x73, 0xbf, 0xf1, 0xc3, + 0xbf, 0x7f, 0x3e, 0x4a, 0xa9, 0x7e, 0x56, 0xaa, 0x16, 0x9b, 0xf5, 0xb6, 0x06, 0xea, 0xc5, 0x49, + 0x58, 0x98, 0x87, 0x94, 0x70, 0xdc, 0xfe, 0x79, 0x0b, 0xee, 0xf5, 0xb9, 0xf7, 0x55, 0xe8, 0x2e, + 0x93, 0x47, 0xe4, 0x98, 0xb2, 0xc0, 0x16, 0x3e, 0x25, 0x11, 0x26, 0x7a, 0x42, 0x70, 0x3a, 0xaf, + 0x38, 0xb8, 0xd1, 0xb4, 0x8a, 0x97, 0x4c, 0x6b, 0x1d, 0xf2, 0xd2, 0x7a, 0xe4, 0x5f, 0xae, 0x20, + 0xbf, 0x75, 0x23, 0xe4, 0xbd, 0xd2, 0xab, 0xbf, 0x1f, 0x28, 0x4b, 0xf0, 0xfb, 0x10, 0xf1, 0x8a, + 0xff, 0xaa, 0xf6, 0x3b, 0xf0, 0xf0, 0x0a, 0x14, 0x19, 0xb2, 0xdf, 0xb6, 0x60, 0x27, 0xf3, 0x3d, + 0x17, 0xb6, 0xc0, 0x57, 0xec, 0xeb, 0xfb, 0xb0, 0xe4, 0x92, 0x07, 0xd5, 0x82, 0x3a, 0x17, 0x36, + 0x13, 0x4f, 0xb1, 0xef, 0x8d, 0x85, 0x44, 0x54, 0xb2, 0x56, 0xa5, 0xa8, 0x9e, 0x4c, 0x83, 0x5e, + 0x74, 0x78, 0xb9, 0xc4, 0x52, 0xb2, 0x96, 0x02, 0xba, 0x0b, 0xe5, 0xc3, 0x27, 0x03, 0x5b, 0x8c, + 0x25, 0x8e, 0x9a, 0x95, 0x44, 0xe8, 0x29, 0x14, 0x7b, 0x87, 0x5c, 0xad, 0x48, 0x46, 0xef, 0xbf, + 0x89, 0x91, 0x6c, 0x76, 0x98, 0xdd, 0x0c, 0x5c, 0x42, 0x2a, 0x58, 0x51, 0x0b, 0x84, 0xa0, 0x34, + 0xb1, 0xb9, 0x50, 0xab, 0x2d, 0xa5, 0x53, 0xb5, 0xe4, 0x7b, 0x6e, 0x8f, 0x95, 0x9b, 0x95, 0xb6, + 0x80, 0xbb, 0xe7, 0x99, 0xa4, 0xb8, 0xd0, 0x23, 0x68, 0x12, 0x3c, 0x17, 0x03, 0x46, 0x43, 0xca, + 0x31, 0x7b, 0xe2, 0xba, 0x29, 0xa4, 0x9c, 0x8e, 0x0c, 0x40, 0x8c, 0x0a, 0x89, 0xfb, 0x88, 0x0c, + 0x18, 0xf5, 0x18, 0xe6, 0x5c, 0x62, 0xab, 0x5a, 0x6b, 0x32, 0xed, 0x5f, 0x14, 0xd8, 0xed, 0x73, + 0xef, 0x05, 0xb3, 0x09, 0x3f, 0xc6, 0xec, 0x59, 0x34, 0x46, 0x3e, 0xf6, 0xc3, 0xe8, 0x0a, 0x70, + 0xa6, 0x8c, 0x61, 0x22, 0x86, 0xab, 0xdb, 0xb7, 0x91, 0x88, 0xd2, 0x88, 0xee, 0x41, 0x8d, 0xe0, + 0x93, 0xc4, 0x10, 0xcf, 0xa6, 0x4a, 0xf0, 0xc9, 0xb3, 0x35, 0x5b, 0xbc, 0x78, 0x61, 0x72, 0xfb, + 0x28, 0x62, 0x70, 0xfe, 0x1b, 0x6d, 0x1d, 0xee, 0xaf, 0x5b, 0x4c, 0x4a, 0xa2, 0xfb, 0x47, 0x09, + 0x8a, 0x7d, 0xee, 0xa1, 0xef, 0x61, 0xfb, 0xfc, 0xb5, 0xf8, 0xc6, 0x09, 0x5d, 0x3c, 0xbe, 0xda, + 0x47, 0xd7, 0xad, 0xc8, 0xc6, 0xf1, 0xbb, 0x02, 0xea, 0xa5, 0xa7, 0xfd, 0xe3, 0x0d, 0xda, 0x5e, + 0x56, 0xac, 0x1d, 0xfc, 0x8f, 0xe2, 0x6c, 0x79, 0x53, 0xa8, 0xaf, 0x1e, 0x2c, 0x63, 0xe3, 0x9e, + 0xd2, 0xaf, 0x7d, 0x78, 0x3d, 0x7f, 0xf6, 0xd9, 0x1f, 0x15, 0xb8, 0x93, 0xdf, 0x45, 0x8f, 0x37, + 0xe8, 0x96, 0xab, 0xd2, 0x3e, 0xb9, 0x49, 0x55, 0xba, 0x92, 0xde, 0x17, 0xaf, 0x4e, 0x75, 0xe5, + 0xf5, 0xa9, 0xae, 0xfc, 0x73, 0xaa, 0x2b, 0xbf, 0x9e, 0xe9, 0x85, 0xd7, 0x67, 0x7a, 0xe1, 0xaf, + 0x33, 0xbd, 0xf0, 0xcd, 0x63, 0xcf, 0x17, 0xe3, 0xe9, 0xc8, 0x70, 0x68, 0x60, 0xae, 0x7e, 0x61, + 0x19, 0x98, 0xb3, 0x3d, 0x73, 0xbe, 0xfc, 0x19, 0xb1, 0x08, 0x31, 0x1f, 0x95, 0xe5, 0xbf, 0xe3, + 0xbd, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x94, 0x38, 0xf3, 0x65, 0x68, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + CreateRollapp(ctx context.Context, in *MsgCreateRollapp, opts ...grpc.CallOption) (*MsgCreateRollappResponse, error) + UpdateRollappInformation(ctx context.Context, in *MsgUpdateRollappInformation, opts ...grpc.CallOption) (*MsgUpdateRollappInformationResponse, error) + UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) + TransferOwnership(ctx context.Context, in *MsgTransferOwnership, opts ...grpc.CallOption) (*MsgTransferOwnershipResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateRollapp(ctx context.Context, in *MsgCreateRollapp, opts ...grpc.CallOption) (*MsgCreateRollappResponse, error) { + out := new(MsgCreateRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Msg/CreateRollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateRollappInformation(ctx context.Context, in *MsgUpdateRollappInformation, opts ...grpc.CallOption) (*MsgUpdateRollappInformationResponse, error) { + out := new(MsgUpdateRollappInformationResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Msg/UpdateRollappInformation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) { + out := new(MsgUpdateStateResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Msg/UpdateState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) TransferOwnership(ctx context.Context, in *MsgTransferOwnership, opts ...grpc.CallOption) (*MsgTransferOwnershipResponse, error) { + out := new(MsgTransferOwnershipResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Msg/TransferOwnership", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CreateRollapp(context.Context, *MsgCreateRollapp) (*MsgCreateRollappResponse, error) + UpdateRollappInformation(context.Context, *MsgUpdateRollappInformation) (*MsgUpdateRollappInformationResponse, error) + UpdateState(context.Context, *MsgUpdateState) (*MsgUpdateStateResponse, error) + TransferOwnership(context.Context, *MsgTransferOwnership) (*MsgTransferOwnershipResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateRollapp(ctx context.Context, req *MsgCreateRollapp) (*MsgCreateRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRollapp not implemented") +} +func (*UnimplementedMsgServer) UpdateRollappInformation(ctx context.Context, req *MsgUpdateRollappInformation) (*MsgUpdateRollappInformationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRollappInformation not implemented") +} +func (*UnimplementedMsgServer) UpdateState(ctx context.Context, req *MsgUpdateState) (*MsgUpdateStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateState not implemented") +} +func (*UnimplementedMsgServer) TransferOwnership(ctx context.Context, req *MsgTransferOwnership) (*MsgTransferOwnershipResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TransferOwnership not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateRollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateRollapp) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateRollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Msg/CreateRollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateRollapp(ctx, req.(*MsgCreateRollapp)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateRollappInformation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateRollappInformation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateRollappInformation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Msg/UpdateRollappInformation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateRollappInformation(ctx, req.(*MsgUpdateRollappInformation)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateState) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Msg/UpdateState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateState(ctx, req.(*MsgUpdateState)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_TransferOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTransferOwnership) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TransferOwnership(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.rollapp.Msg/TransferOwnership", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TransferOwnership(ctx, req.(*MsgTransferOwnership)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dymensionxyz.dymension.rollapp.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateRollapp", + Handler: _Msg_CreateRollapp_Handler, + }, + { + MethodName: "UpdateRollappInformation", + Handler: _Msg_UpdateRollappInformation_Handler, + }, + { + MethodName: "UpdateState", + Handler: _Msg_UpdateState_Handler, + }, + { + MethodName: "TransferOwnership", + Handler: _Msg_TransferOwnership_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dymension/rollapp/tx.proto", +} + +func (m *MsgCreateRollapp) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateRollapp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VmType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VmType)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.Metadata != nil { + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + } + if len(m.GenesisChecksum) > 0 { + i -= len(m.GenesisChecksum) + copy(dAtA[i:], m.GenesisChecksum) + i = encodeVarintTx(dAtA, i, uint64(len(m.GenesisChecksum))) + i-- + dAtA[i] = 0x72 + } + if len(m.Alias) > 0 { + i -= len(m.Alias) + copy(dAtA[i:], m.Alias) + i = encodeVarintTx(dAtA, i, uint64(len(m.Alias))) + i-- + dAtA[i] = 0x6a + } + if len(m.Bech32Prefix) > 0 { + i -= len(m.Bech32Prefix) + copy(dAtA[i:], m.Bech32Prefix) + i = encodeVarintTx(dAtA, i, uint64(len(m.Bech32Prefix))) + i-- + dAtA[i] = 0x62 + } + if len(m.InitialSequencer) > 0 { + i -= len(m.InitialSequencer) + copy(dAtA[i:], m.InitialSequencer) + i = encodeVarintTx(dAtA, i, uint64(len(m.InitialSequencer))) + i-- + dAtA[i] = 0x5a + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateRollappResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateRollappInformation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateRollappInformation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateRollappInformation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Metadata != nil { + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.GenesisChecksum) > 0 { + i -= len(m.GenesisChecksum) + copy(dAtA[i:], m.GenesisChecksum) + i = encodeVarintTx(dAtA, i, uint64(len(m.GenesisChecksum))) + i-- + dAtA[i] = 0x22 + } + if len(m.InitialSequencer) > 0 { + i -= len(m.InitialSequencer) + copy(dAtA[i:], m.InitialSequencer) + i = encodeVarintTx(dAtA, i, uint64(len(m.InitialSequencer))) + i-- + dAtA[i] = 0x1a + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateRollappInformationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateRollappInformationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateRollappInformationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Last { + i-- + if m.Last { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + { + size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.DAPath) > 0 { + i -= len(m.DAPath) + copy(dAtA[i:], m.DAPath) + i = encodeVarintTx(dAtA, i, uint64(len(m.DAPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateStateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RotationInProgress { + i-- + if m.RotationInProgress { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.NextProposerAddr) > 0 { + i -= len(m.NextProposerAddr) + copy(dAtA[i:], m.NextProposerAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.NextProposerAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferOwnership) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTransferOwnership) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x1a + } + if len(m.NewOwner) > 0 { + i -= len(m.NewOwner) + copy(dAtA[i:], m.NewOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewOwner))) + i-- + dAtA[i] = 0x12 + } + if len(m.CurrentOwner) > 0 { + i -= len(m.CurrentOwner) + copy(dAtA[i:], m.CurrentOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.CurrentOwner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferOwnershipResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTransferOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateRollapp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.InitialSequencer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Bech32Prefix) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Alias) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.GenesisChecksum) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.VmType != 0 { + n += 2 + sovTx(uint64(m.VmType)) + } + return n +} + +func (m *MsgCreateRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateRollappInformation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.InitialSequencer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.GenesisChecksum) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateRollappInformationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovTx(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovTx(uint64(m.NumBlocks)) + } + l = len(m.DAPath) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.BDs.Size() + n += 1 + l + sovTx(uint64(l)) + if m.Last { + n += 2 + } + return n +} + +func (m *MsgUpdateStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NextProposerAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.RotationInProgress { + n += 2 + } + return n +} + +func (m *MsgTransferOwnership) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CurrentOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTransferOwnershipResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateRollapp) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateRollapp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollapp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialSequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialSequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bech32Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bech32Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Alias", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Alias = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisChecksum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisChecksum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &RollappMetadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VmType", wireType) + } + m.VmType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VmType |= Rollapp_VMType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateRollappResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateRollappInformation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateRollappInformation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateRollappInformation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialSequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialSequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisChecksum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisChecksum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &RollappMetadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateRollappInformationResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateRollappInformationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateRollappInformationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DAPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Last", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Last = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateStateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextProposerAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextProposerAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RotationInProgress", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RotationInProgress = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTransferOwnership) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTransferOwnership: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTransferOwnershipResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTransferOwnershipResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/rollapp/types/types.go b/third_party/dymension/rollapp/types/types.go new file mode 100644 index 000000000..308c44e6a --- /dev/null +++ b/third_party/dymension/rollapp/types/types.go @@ -0,0 +1,7 @@ +package types + +import ( + common "github.com/dymensionxyz/dymension/v3/x/common/types" +) + +type StateStatus common.Status diff --git a/third_party/dymension/sequencer/types/description.pb.go b/third_party/dymension/sequencer/types/description.pb.go new file mode 100644 index 000000000..1d45971a9 --- /dev/null +++ b/third_party/dymension/sequencer/types/description.pb.go @@ -0,0 +1,531 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/description.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Description defines a sequencer description. +type Description struct { + // moniker defines a human-readable name for the sequencer. + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity defines an optional identity signature (ex. UPort or Keybase). + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + // website defines an optional website link. + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` + // securityContact defines an optional email for security contact. + SecurityContact string `protobuf:"bytes,4,opt,name=securityContact,proto3" json:"securityContact,omitempty"` + // details define other optional details. + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *Description) Reset() { *m = Description{} } +func (m *Description) String() string { return proto.CompactTextString(m) } +func (*Description) ProtoMessage() {} +func (*Description) Descriptor() ([]byte, []int) { + return fileDescriptor_91de4c32465eb7e7, []int{0} +} +func (m *Description) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Description) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Description.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Description) XXX_Merge(src proto.Message) { + xxx_messageInfo_Description.Merge(m, src) +} +func (m *Description) XXX_Size() int { + return m.Size() +} +func (m *Description) XXX_DiscardUnknown() { + xxx_messageInfo_Description.DiscardUnknown(m) +} + +var xxx_messageInfo_Description proto.InternalMessageInfo + +func (m *Description) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Description) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Description) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Description) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *Description) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +func init() { + proto.RegisterType((*Description)(nil), "dymensionxyz.dymension.sequencer.Description") +} + +func init() { + proto.RegisterFile("dymension/sequencer/description.proto", fileDescriptor_91de4c32465eb7e7) +} + +var fileDescriptor_91de4c32465eb7e7 = []byte{ + // 239 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xa9, 0xcc, 0x4d, + 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0xd3, 0x2f, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, 0xd2, + 0x4f, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x52, 0x80, 0x2b, 0xab, 0xa8, 0xac, 0xd2, 0x83, 0x73, 0xf4, 0xe0, 0x7a, 0x94, 0x16, + 0x32, 0x72, 0x71, 0xbb, 0x20, 0xf4, 0x09, 0x49, 0x70, 0xb1, 0xe7, 0xe6, 0xe7, 0x65, 0x66, 0xa7, + 0x16, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xc1, 0xb8, 0x42, 0x52, 0x5c, 0x1c, 0x99, 0x29, + 0xa9, 0x79, 0x25, 0x99, 0x25, 0x95, 0x12, 0x4c, 0x60, 0x29, 0x38, 0x1f, 0xa4, 0xab, 0x3c, 0x35, + 0xa9, 0x38, 0xb3, 0x24, 0x55, 0x82, 0x19, 0xa2, 0x0b, 0xca, 0x15, 0xd2, 0xe0, 0xe2, 0x2f, 0x4e, + 0x4d, 0x2e, 0x2d, 0xca, 0x2c, 0xa9, 0x74, 0xce, 0xcf, 0x2b, 0x49, 0x4c, 0x2e, 0x91, 0x60, 0x01, + 0xab, 0x40, 0x17, 0x06, 0x99, 0x91, 0x92, 0x5a, 0x92, 0x98, 0x99, 0x53, 0x2c, 0xc1, 0x0a, 0x31, + 0x03, 0xca, 0x75, 0x0a, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xb3, + 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x64, 0xaf, 0x22, 0x38, 0xfa, + 0x65, 0xc6, 0xfa, 0x15, 0x48, 0x61, 0x54, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x1e, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xcd, 0xd6, 0xb4, 0x47, 0x01, 0x00, 0x00, +} + +func (m *Description) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Description) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintDescription(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintDescription(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintDescription(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintDescription(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintDescription(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintDescription(dAtA []byte, offset int, v uint64) int { + offset -= sovDescription(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Description) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovDescription(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovDescription(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovDescription(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovDescription(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovDescription(uint64(l)) + } + return n +} + +func sovDescription(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDescription(x uint64) (n int) { + return sovDescription(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Description) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDescription + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Description: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDescription + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDescription + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDescription + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDescription + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDescription + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDescription + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDescription + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDescription + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDescription + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDescription + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDescription + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDescription + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDescription + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDescription + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDescription + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDescription(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDescription + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDescription(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDescription + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDescription + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDescription + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthDescription + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDescription + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDescription + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDescription = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDescription = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDescription = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/events.go b/third_party/dymension/sequencer/types/events.go new file mode 100644 index 000000000..3977bbee5 --- /dev/null +++ b/third_party/dymension/sequencer/types/events.go @@ -0,0 +1,27 @@ +package types + +// Incentive module event types. +const ( + // EventTypeCreateSequencer is emitted when a sequencer is created + EventTypeCreateSequencer = "create_sequencer" + AttributeKeyRollappId = "rollapp_id" + AttributeKeySequencer = "sequencer" + AttributeKeyBond = "bond" + AttributeKeyProposer = "proposer" + + // EventTypeUnbonding is emitted when a sequencer is unbonding + EventTypeUnbonding = "unbonding" + AttributeKeyCompletionTime = "completion_time" + + // EventTypeNoBondedSequencer is emitted when no bonded sequencer is found for a rollapp + EventTypeNoBondedSequencer = "no_bonded_sequencer" + + // EventTypeProposerRotated is emitted when a proposer is rotated + EventTypeProposerRotated = "proposer_rotated" + + // EventTypeUnbonded is emitted when a sequencer is unbonded + EventTypeUnbonded = "unbonded" + + // EventTypeSlashed is emitted when a sequencer is slashed + EventTypeSlashed = "slashed" +) diff --git a/third_party/dymension/sequencer/types/events.pb.go b/third_party/dymension/sequencer/types/events.pb.go new file mode 100644 index 000000000..0cfb2da09 --- /dev/null +++ b/third_party/dymension/sequencer/types/events.pb.go @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/events.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventIncreasedBond is an event emitted when a sequencer's bond is increased. +type EventIncreasedBond struct { + // sequencer is the bech32-encoded address of the sequencer which increased its bond + Sequencer string `protobuf:"bytes,1,opt,name=sequencer,proto3" json:"sequencer,omitempty"` + // added_amount is the amount of coins added to the sequencer's bond + AddedAmount types.Coin `protobuf:"bytes,2,opt,name=added_amount,json=addedAmount,proto3" json:"added_amount"` + // bond is the new active bond amount of the sequencer + Bond github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=bond,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"bond"` +} + +func (m *EventIncreasedBond) Reset() { *m = EventIncreasedBond{} } +func (m *EventIncreasedBond) String() string { return proto.CompactTextString(m) } +func (*EventIncreasedBond) ProtoMessage() {} +func (*EventIncreasedBond) Descriptor() ([]byte, []int) { + return fileDescriptor_8c4c85909720061b, []int{0} +} +func (m *EventIncreasedBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventIncreasedBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventIncreasedBond.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventIncreasedBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventIncreasedBond.Merge(m, src) +} +func (m *EventIncreasedBond) XXX_Size() int { + return m.Size() +} +func (m *EventIncreasedBond) XXX_DiscardUnknown() { + xxx_messageInfo_EventIncreasedBond.DiscardUnknown(m) +} + +var xxx_messageInfo_EventIncreasedBond proto.InternalMessageInfo + +func (m *EventIncreasedBond) GetSequencer() string { + if m != nil { + return m.Sequencer + } + return "" +} + +func (m *EventIncreasedBond) GetAddedAmount() types.Coin { + if m != nil { + return m.AddedAmount + } + return types.Coin{} +} + +func (m *EventIncreasedBond) GetBond() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Bond + } + return nil +} + +func init() { + proto.RegisterType((*EventIncreasedBond)(nil), "dymensionxyz.dymension.sequencer.EventIncreasedBond") +} + +func init() { proto.RegisterFile("dymension/sequencer/events.proto", fileDescriptor_8c4c85909720061b) } + +var fileDescriptor_8c4c85909720061b = []byte{ + // 337 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xb1, 0x6e, 0xea, 0x30, + 0x14, 0x86, 0xe3, 0x0b, 0xba, 0x12, 0xe1, 0x4e, 0x11, 0xd2, 0x0d, 0x0c, 0x26, 0xea, 0xc4, 0x82, + 0x5d, 0x8a, 0xc4, 0x4e, 0xaa, 0x0e, 0xdd, 0x2a, 0xba, 0x75, 0x41, 0x49, 0x6c, 0xa5, 0x51, 0x15, + 0x1f, 0x9a, 0x63, 0x22, 0xe8, 0x53, 0xf4, 0x39, 0x3a, 0xf7, 0x21, 0x18, 0x51, 0xa7, 0x4e, 0x6d, + 0x05, 0x4f, 0xd0, 0x37, 0xa8, 0xe2, 0x58, 0xc0, 0xd4, 0xc9, 0x3e, 0xe7, 0xfc, 0xdf, 0xaf, 0x5f, + 0xe7, 0xb8, 0x81, 0x58, 0xe7, 0x52, 0x61, 0x06, 0x8a, 0xa3, 0x7c, 0x5c, 0x4a, 0x95, 0xc8, 0x82, + 0xcb, 0x52, 0x2a, 0x8d, 0x6c, 0x51, 0x80, 0x06, 0xef, 0xa8, 0x58, 0xad, 0x9f, 0xd8, 0xa1, 0x60, + 0x07, 0x79, 0xaf, 0x9b, 0x00, 0xe6, 0x80, 0x73, 0xa3, 0xe7, 0x75, 0x51, 0xc3, 0xbd, 0x4e, 0x0a, + 0x29, 0xd4, 0xfd, 0xea, 0x67, 0xbb, 0xb4, 0xd6, 0xf0, 0x38, 0x42, 0xc9, 0xcb, 0x51, 0x2c, 0x75, + 0x34, 0xe2, 0x09, 0x64, 0xca, 0xce, 0xff, 0xdb, 0x79, 0x8e, 0x29, 0x2f, 0x47, 0xd5, 0x53, 0x0f, + 0xce, 0xbe, 0x89, 0xeb, 0x5d, 0x55, 0xe1, 0xae, 0x55, 0x52, 0xc8, 0x08, 0xa5, 0x08, 0x41, 0x09, + 0x6f, 0xe2, 0xb6, 0x0e, 0x69, 0x7c, 0x12, 0x90, 0x41, 0x2b, 0xf4, 0xdf, 0x5e, 0x87, 0x1d, 0x1b, + 0x65, 0x2a, 0x44, 0x21, 0x11, 0x6f, 0x75, 0x91, 0xa9, 0x74, 0x76, 0x94, 0x7a, 0xa1, 0xfb, 0x2f, + 0x12, 0x42, 0x8a, 0x79, 0x94, 0xc3, 0x52, 0x69, 0xff, 0x4f, 0x40, 0x06, 0xed, 0x8b, 0x2e, 0xb3, + 0x5c, 0x15, 0x8f, 0xd9, 0x78, 0xec, 0x12, 0x32, 0x15, 0x36, 0x37, 0x1f, 0x7d, 0x67, 0xd6, 0x36, + 0xd0, 0xd4, 0x30, 0xde, 0xdc, 0x6d, 0xc6, 0xa0, 0x84, 0xdf, 0x08, 0x1a, 0xbf, 0xb3, 0xe7, 0x15, + 0xfb, 0xf2, 0xd9, 0x1f, 0xa4, 0x99, 0xbe, 0x5f, 0xc6, 0x2c, 0x81, 0xdc, 0xee, 0xca, 0x3e, 0x43, + 0x14, 0x0f, 0x5c, 0xaf, 0x17, 0x12, 0x0d, 0x80, 0x33, 0x63, 0x1c, 0xde, 0x6c, 0x76, 0x94, 0x6c, + 0x77, 0x94, 0x7c, 0xed, 0x28, 0x79, 0xde, 0x53, 0x67, 0xbb, 0xa7, 0xce, 0xfb, 0x9e, 0x3a, 0x77, + 0x93, 0x13, 0xa7, 0xd3, 0x23, 0x1d, 0x0b, 0x5e, 0x8e, 0xf9, 0xea, 0xe4, 0xb0, 0xc6, 0x3d, 0xfe, + 0x6b, 0x96, 0x39, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x7a, 0xac, 0x07, 0x3b, 0xfc, 0x01, 0x00, + 0x00, +} + +func (m *EventIncreasedBond) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventIncreasedBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventIncreasedBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bond) > 0 { + for iNdEx := len(m.Bond) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bond[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.AddedAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sequencer) > 0 { + i -= len(m.Sequencer) + copy(dAtA[i:], m.Sequencer) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Sequencer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventIncreasedBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sequencer) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = m.AddedAmount.Size() + n += 1 + l + sovEvents(uint64(l)) + if len(m.Bond) > 0 { + for _, e := range m.Bond { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventIncreasedBond) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventIncreasedBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventIncreasedBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddedAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AddedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bond", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bond = append(m.Bond, types.Coin{}) + if err := m.Bond[len(m.Bond)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/genesis.pb.go b/third_party/dymension/sequencer/types/genesis.pb.go new file mode 100644 index 000000000..28e75b87a --- /dev/null +++ b/third_party/dymension/sequencer/types/genesis.pb.go @@ -0,0 +1,740 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the sequencer module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // sequencerList is a list of all defined sequencers + SequencerList []Sequencer `protobuf:"bytes,2,rep,name=sequencerList,proto3" json:"sequencerList"` + // genesisProposers is a list of the defined genesis proposers + GenesisProposers []GenesisProposer `protobuf:"bytes,3,rep,name=genesisProposers,proto3" json:"genesisProposers"` + // bondReductions is a list of all bond reductions + BondReductions []BondReduction `protobuf:"bytes,4,rep,name=bondReductions,proto3" json:"bondReductions"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_52f5d9dc91070770, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetSequencerList() []Sequencer { + if m != nil { + return m.SequencerList + } + return nil +} + +func (m *GenesisState) GetGenesisProposers() []GenesisProposer { + if m != nil { + return m.GenesisProposers + } + return nil +} + +func (m *GenesisState) GetBondReductions() []BondReduction { + if m != nil { + return m.BondReductions + } + return nil +} + +type GenesisProposer struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + RollappId string `protobuf:"bytes,2,opt,name=rollappId,proto3" json:"rollappId,omitempty"` +} + +func (m *GenesisProposer) Reset() { *m = GenesisProposer{} } +func (m *GenesisProposer) String() string { return proto.CompactTextString(m) } +func (*GenesisProposer) ProtoMessage() {} +func (*GenesisProposer) Descriptor() ([]byte, []int) { + return fileDescriptor_52f5d9dc91070770, []int{1} +} +func (m *GenesisProposer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisProposer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisProposer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisProposer) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisProposer.Merge(m, src) +} +func (m *GenesisProposer) XXX_Size() int { + return m.Size() +} +func (m *GenesisProposer) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisProposer.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisProposer proto.InternalMessageInfo + +func (m *GenesisProposer) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *GenesisProposer) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "dymensionxyz.dymension.sequencer.GenesisState") + proto.RegisterType((*GenesisProposer)(nil), "dymensionxyz.dymension.sequencer.GenesisProposer") +} + +func init() { proto.RegisterFile("dymension/sequencer/genesis.proto", fileDescriptor_52f5d9dc91070770) } + +var fileDescriptor_52f5d9dc91070770 = []byte{ + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xa9, 0xcc, 0x4d, + 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0xd3, 0x2f, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, 0xd2, + 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x80, + 0x2b, 0xa9, 0xa8, 0xac, 0xd2, 0x83, 0x73, 0xf4, 0xe0, 0xea, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, + 0xc1, 0x8a, 0xf5, 0x41, 0x2c, 0x88, 0x3e, 0x29, 0x05, 0x6c, 0x46, 0x17, 0x24, 0x16, 0x25, 0xe6, + 0x42, 0x4d, 0x96, 0x52, 0xc6, 0xa6, 0x02, 0xce, 0x82, 0x28, 0x52, 0xfa, 0xcc, 0xc4, 0xc5, 0xe3, + 0x0e, 0x71, 0x50, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x1b, 0x17, 0x1b, 0xc4, 0x14, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x0d, 0x3d, 0x42, 0x0e, 0xd4, 0x0b, 0x00, 0xab, 0x77, 0x62, 0x39, + 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0x5b, 0x28, 0x9c, 0x8b, 0x17, 0xae, 0xc2, 0x27, 0xb3, 0xb8, + 0x44, 0x82, 0x49, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x9b, 0xb0, 0x71, 0xc1, 0x30, 0x16, 0xd4, 0x44, + 0x54, 0x73, 0x84, 0x92, 0xb9, 0x04, 0xa0, 0x21, 0x18, 0x50, 0x94, 0x5f, 0x90, 0x5f, 0x9c, 0x5a, + 0x54, 0x2c, 0xc1, 0x0c, 0x36, 0xdb, 0x90, 0xb0, 0xd9, 0xee, 0xa8, 0x3a, 0xa1, 0x36, 0x60, 0x18, + 0x28, 0x14, 0xcb, 0xc5, 0x97, 0x94, 0x9f, 0x97, 0x12, 0x94, 0x9a, 0x52, 0x9a, 0x5c, 0x92, 0x99, + 0x9f, 0x57, 0x2c, 0xc1, 0x02, 0xb6, 0x42, 0x9f, 0xb0, 0x15, 0x4e, 0xc8, 0xfa, 0xa0, 0x16, 0xa0, + 0x19, 0xa6, 0xe4, 0xc9, 0xc5, 0x8f, 0xe6, 0x12, 0x21, 0x09, 0x2e, 0xf6, 0xc4, 0x94, 0x94, 0xa2, + 0xd4, 0x62, 0x48, 0xc0, 0x73, 0x06, 0xc1, 0xb8, 0x42, 0x32, 0x5c, 0x9c, 0x45, 0xf9, 0x39, 0x39, + 0x89, 0x05, 0x05, 0x9e, 0x29, 0x12, 0x4c, 0x60, 0x39, 0x84, 0x80, 0x53, 0xc0, 0x89, 0x47, 0x72, + 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, + 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x99, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, + 0xe7, 0xe7, 0xea, 0x23, 0xbb, 0x1a, 0xc1, 0xd1, 0x2f, 0x33, 0xd6, 0xaf, 0x40, 0x4a, 0x1c, 0x25, + 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x94, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb5, + 0xf3, 0x81, 0x1b, 0xbd, 0x02, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BondReductions) > 0 { + for iNdEx := len(m.BondReductions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BondReductions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.GenesisProposers) > 0 { + for iNdEx := len(m.GenesisProposers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GenesisProposers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.SequencerList) > 0 { + for iNdEx := len(m.SequencerList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SequencerList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GenesisProposer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisProposer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisProposer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.SequencerList) > 0 { + for _, e := range m.SequencerList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GenesisProposers) > 0 { + for _, e := range m.GenesisProposers { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BondReductions) > 0 { + for _, e := range m.BondReductions { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *GenesisProposer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequencerList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequencerList = append(m.SequencerList, Sequencer{}) + if err := m.SequencerList[len(m.SequencerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisProposers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisProposers = append(m.GenesisProposers, GenesisProposer{}) + if err := m.GenesisProposers[len(m.GenesisProposers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondReductions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondReductions = append(m.BondReductions, BondReduction{}) + if err := m.BondReductions[len(m.BondReductions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisProposer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisProposer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisProposer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/keys.go b/third_party/dymension/sequencer/types/keys.go new file mode 100644 index 000000000..80310719d --- /dev/null +++ b/third_party/dymension/sequencer/types/keys.go @@ -0,0 +1,104 @@ +package types + +import ( + "encoding/binary" + fmt "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ binary.ByteOrder + +const ( + // ModuleName defines the module name + ModuleName = "sequencer" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_sequencer" +) + +var ( + // KeySeparator defines the separator for keys + KeySeparator = "/" + + // SequencersKeyPrefix is the prefix to retrieve all Sequencers by their address + SequencersKeyPrefix = []byte{0x00} // prefix/seqAddr + + // SequencersByRollappKeyPrefix is the prefix to retrieve all SequencersByRollapp + SequencersByRollappKeyPrefix = []byte{0x01} // prefix/rollappId + BondedSequencersKeyPrefix = []byte{0xa1} + UnbondedSequencersKeyPrefix = []byte{0xa2} + UnbondingSequencersKeyPrefix = []byte{0xa3} + + UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue +) + +/* --------------------- specific sequencer address keys -------------------- */ +func SequencerKey(sequencerAddress string) []byte { + sequencerAddrBytes := []byte(sequencerAddress) + return []byte(fmt.Sprintf("%s%s%s", SequencersKeyPrefix, KeySeparator, sequencerAddrBytes)) +} + +// SequencerByRollappByStatusKey returns the store key to retrieve a SequencersByRollapp from the index fields +func SequencerByRollappByStatusKey(rollappId, seqAddr string, status OperatingStatus) []byte { + return append(SequencersByRollappByStatusKey(rollappId, status), []byte(seqAddr)...) +} + +/* ------------------------- multiple sequencers keys ------------------------ */ +func SequencersKey() []byte { + return SequencersKeyPrefix +} + +// SequencersByRollappKey returns the store key to retrieve a SequencersByRollapp from the index fields +func SequencersByRollappKey(rollappId string) []byte { + rollappIdBytes := []byte(rollappId) + return []byte(fmt.Sprintf("%s%s%s", SequencersByRollappKeyPrefix, KeySeparator, rollappIdBytes)) +} + +// SequencersByRollappByStatusKey returns the store key to retrieve a SequencersByRollappByStatus from the index fields +func SequencersByRollappByStatusKey(rollappId string, status OperatingStatus) []byte { + // Get the relevant key prefix based on the packet status + var prefix []byte + switch status { + case Bonded: + prefix = BondedSequencersKeyPrefix + case Unbonded: + prefix = UnbondedSequencersKeyPrefix + case Unbonding: + prefix = UnbondingSequencersKeyPrefix + } + + return []byte(fmt.Sprintf("%s%s%s", SequencersByRollappKey(rollappId), KeySeparator, prefix)) +} + +/* -------------------------- unbonding queue keys -------------------------- */ +func UnbondingQueueByTimeKey(endTime time.Time) []byte { + timeBz := sdk.FormatTimeBytes(endTime) + prefixL := len(UnbondingQueueKey) + + bz := make([]byte, prefixL+len(timeBz)) + + // copy the prefix + copy(bz[:prefixL], UnbondingQueueKey) + // copy the encoded time bytes + copy(bz[prefixL:prefixL+len(timeBz)], timeBz) + + return bz +} + +func UnbondingSequencerKey(sequencerAddress string, endTime time.Time) []byte { + key := UnbondingQueueByTimeKey(endTime) + key = append(key, KeySeparator...) + key = append(key, []byte(sequencerAddress)...) + return key +} diff --git a/third_party/dymension/sequencer/types/metadata.pb.go b/third_party/dymension/sequencer/types/metadata.pb.go new file mode 100644 index 000000000..47fd6b928 --- /dev/null +++ b/third_party/dymension/sequencer/types/metadata.pb.go @@ -0,0 +1,1494 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/metadata.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Metadata defines rollapp/sequencer extra information. +type SequencerMetadata struct { + // moniker defines a human-readable name for the sequencer. + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + // details define other optional details. + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` + // bootstrap nodes list + P2PSeeds []string `protobuf:"bytes,6,rep,name=p2p_seeds,json=p2pSeeds,proto3" json:"p2p_seeds,omitempty"` + // RPCs list + Rpcs []string `protobuf:"bytes,7,rep,name=rpcs,proto3" json:"rpcs,omitempty"` + // evm RPCs list + EvmRpcs []string `protobuf:"bytes,8,rep,name=evm_rpcs,json=evmRpcs,proto3" json:"evm_rpcs,omitempty"` + // REST API URLs + RestApiUrls []string `protobuf:"bytes,9,rep,name=rest_api_urls,json=restApiUrls,proto3" json:"rest_api_urls,omitempty"` + // block explorer URL + ExplorerUrl string `protobuf:"bytes,10,opt,name=explorer_url,json=explorerUrl,proto3" json:"explorer_url,omitempty"` + // genesis URLs + GenesisUrls []string `protobuf:"bytes,11,rep,name=genesis_urls,json=genesisUrls,proto3" json:"genesis_urls,omitempty"` + // contact details + ContactDetails *ContactDetails `protobuf:"bytes,12,opt,name=contact_details,json=contactDetails,proto3" json:"contact_details,omitempty"` + // json dump the sequencer can add (limited by size) + ExtraData []byte `protobuf:"bytes,13,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` + // snapshots of the sequencer + Snapshots []*SnapshotInfo `protobuf:"bytes,14,rep,name=snapshots,proto3" json:"snapshots,omitempty"` + // gas_price defines the value for each gas unit + GasPrice *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,15,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price,omitempty"` +} + +func (m *SequencerMetadata) Reset() { *m = SequencerMetadata{} } +func (m *SequencerMetadata) String() string { return proto.CompactTextString(m) } +func (*SequencerMetadata) ProtoMessage() {} +func (*SequencerMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_b236c92093bea103, []int{0} +} +func (m *SequencerMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SequencerMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SequencerMetadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SequencerMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_SequencerMetadata.Merge(m, src) +} +func (m *SequencerMetadata) XXX_Size() int { + return m.Size() +} +func (m *SequencerMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_SequencerMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_SequencerMetadata proto.InternalMessageInfo + +func (m *SequencerMetadata) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *SequencerMetadata) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +func (m *SequencerMetadata) GetP2PSeeds() []string { + if m != nil { + return m.P2PSeeds + } + return nil +} + +func (m *SequencerMetadata) GetRpcs() []string { + if m != nil { + return m.Rpcs + } + return nil +} + +func (m *SequencerMetadata) GetEvmRpcs() []string { + if m != nil { + return m.EvmRpcs + } + return nil +} + +func (m *SequencerMetadata) GetRestApiUrls() []string { + if m != nil { + return m.RestApiUrls + } + return nil +} + +func (m *SequencerMetadata) GetExplorerUrl() string { + if m != nil { + return m.ExplorerUrl + } + return "" +} + +func (m *SequencerMetadata) GetGenesisUrls() []string { + if m != nil { + return m.GenesisUrls + } + return nil +} + +func (m *SequencerMetadata) GetContactDetails() *ContactDetails { + if m != nil { + return m.ContactDetails + } + return nil +} + +func (m *SequencerMetadata) GetExtraData() []byte { + if m != nil { + return m.ExtraData + } + return nil +} + +func (m *SequencerMetadata) GetSnapshots() []*SnapshotInfo { + if m != nil { + return m.Snapshots + } + return nil +} + +type ContactDetails struct { + // website URL + Website string `protobuf:"bytes,11,opt,name=website,proto3" json:"website,omitempty"` + // telegram link + Telegram string `protobuf:"bytes,1,opt,name=telegram,proto3" json:"telegram,omitempty"` + // twitter link + X string `protobuf:"bytes,2,opt,name=x,proto3" json:"x,omitempty"` +} + +func (m *ContactDetails) Reset() { *m = ContactDetails{} } +func (m *ContactDetails) String() string { return proto.CompactTextString(m) } +func (*ContactDetails) ProtoMessage() {} +func (*ContactDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_b236c92093bea103, []int{1} +} +func (m *ContactDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContactDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ContactDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ContactDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContactDetails.Merge(m, src) +} +func (m *ContactDetails) XXX_Size() int { + return m.Size() +} +func (m *ContactDetails) XXX_DiscardUnknown() { + xxx_messageInfo_ContactDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_ContactDetails proto.InternalMessageInfo + +func (m *ContactDetails) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *ContactDetails) GetTelegram() string { + if m != nil { + return m.Telegram + } + return "" +} + +func (m *ContactDetails) GetX() string { + if m != nil { + return m.X + } + return "" +} + +type SnapshotInfo struct { + // the snapshot url + SnapshotUrl string `protobuf:"bytes,1,opt,name=snapshot_url,json=snapshotUrl,proto3" json:"snapshot_url,omitempty"` + // The snapshot height + Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + // sha-256 checksum value for the snapshot file + Checksum string `protobuf:"bytes,3,opt,name=checksum,proto3" json:"checksum,omitempty"` +} + +func (m *SnapshotInfo) Reset() { *m = SnapshotInfo{} } +func (m *SnapshotInfo) String() string { return proto.CompactTextString(m) } +func (*SnapshotInfo) ProtoMessage() {} +func (*SnapshotInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_b236c92093bea103, []int{2} +} +func (m *SnapshotInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SnapshotInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SnapshotInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SnapshotInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SnapshotInfo.Merge(m, src) +} +func (m *SnapshotInfo) XXX_Size() int { + return m.Size() +} +func (m *SnapshotInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SnapshotInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SnapshotInfo proto.InternalMessageInfo + +func (m *SnapshotInfo) GetSnapshotUrl() string { + if m != nil { + return m.SnapshotUrl + } + return "" +} + +func (m *SnapshotInfo) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *SnapshotInfo) GetChecksum() string { + if m != nil { + return m.Checksum + } + return "" +} + +func init() { + proto.RegisterType((*SequencerMetadata)(nil), "dymensionxyz.dymension.sequencer.SequencerMetadata") + proto.RegisterType((*ContactDetails)(nil), "dymensionxyz.dymension.sequencer.ContactDetails") + proto.RegisterType((*SnapshotInfo)(nil), "dymensionxyz.dymension.sequencer.SnapshotInfo") +} + +func init() { + proto.RegisterFile("dymension/sequencer/metadata.proto", fileDescriptor_b236c92093bea103) +} + +var fileDescriptor_b236c92093bea103 = []byte{ + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xc1, 0x6f, 0xd3, 0x3e, + 0x18, 0x6d, 0xd6, 0xae, 0x4d, 0x9c, 0xae, 0xfb, 0xfd, 0x22, 0x84, 0xcc, 0x10, 0x21, 0xf4, 0x80, + 0x2a, 0x24, 0x12, 0xd4, 0x49, 0xdc, 0x19, 0x93, 0xd0, 0x10, 0x48, 0x53, 0xca, 0x0e, 0x70, 0x89, + 0xdc, 0xf4, 0x23, 0x8d, 0x9a, 0xc4, 0xc6, 0x76, 0x4b, 0xca, 0x5f, 0xc1, 0x81, 0x3f, 0x8a, 0xe3, + 0x8e, 0x88, 0x03, 0x42, 0xed, 0x3f, 0x82, 0xec, 0x24, 0x5d, 0x77, 0xda, 0x29, 0x7e, 0xef, 0xfb, + 0xde, 0xb3, 0xfd, 0xbe, 0x18, 0x0d, 0x67, 0xeb, 0x1c, 0x0a, 0x91, 0xd2, 0x22, 0x10, 0xf0, 0x65, + 0x09, 0x45, 0x0c, 0x3c, 0xc8, 0x41, 0x92, 0x19, 0x91, 0xc4, 0x67, 0x9c, 0x4a, 0xea, 0x78, 0xbb, + 0x9e, 0x72, 0xfd, 0xcd, 0xdf, 0x01, 0x7f, 0x27, 0x38, 0xb9, 0x97, 0xd0, 0x84, 0xea, 0xe6, 0x40, + 0xad, 0x2a, 0xdd, 0xf0, 0x47, 0x07, 0xfd, 0x3f, 0x69, 0x7a, 0xde, 0xd7, 0x9e, 0x0e, 0x46, 0xbd, + 0x9c, 0x16, 0xe9, 0x02, 0x38, 0x36, 0x3c, 0x63, 0x64, 0x85, 0x0d, 0x54, 0x95, 0x19, 0x48, 0x92, + 0x66, 0x02, 0x1f, 0x56, 0x95, 0x1a, 0x3a, 0x0f, 0x91, 0xc5, 0xc6, 0x2c, 0x12, 0x00, 0x33, 0x81, + 0xbb, 0x5e, 0x7b, 0x64, 0x85, 0x26, 0x1b, 0xb3, 0x89, 0xc2, 0x8e, 0x83, 0x3a, 0x9c, 0xc5, 0x02, + 0xf7, 0x34, 0xaf, 0xd7, 0xce, 0x03, 0x64, 0xc2, 0x2a, 0x8f, 0x34, 0x6f, 0x6a, 0xbe, 0x07, 0xab, + 0x3c, 0x54, 0xa5, 0x21, 0x3a, 0xe2, 0x20, 0x64, 0x44, 0x58, 0x1a, 0x2d, 0x79, 0x26, 0xb0, 0xa5, + 0xeb, 0xb6, 0x22, 0x5f, 0xb1, 0xf4, 0x8a, 0x67, 0xc2, 0x79, 0x82, 0xfa, 0x50, 0xb2, 0x8c, 0x72, + 0xe0, 0xaa, 0x07, 0x23, 0x7d, 0x1c, 0xbb, 0xe1, 0xae, 0x78, 0xa6, 0x5a, 0x12, 0x28, 0x40, 0xa4, + 0xa2, 0x72, 0xb1, 0x2b, 0x97, 0x9a, 0xd3, 0x2e, 0x1f, 0xd1, 0x71, 0x4c, 0x0b, 0x49, 0x62, 0x19, + 0x35, 0xf7, 0xea, 0x7b, 0xc6, 0xc8, 0x1e, 0xbf, 0xf0, 0xef, 0x4a, 0xd4, 0x7f, 0x5d, 0x09, 0xcf, + 0x2b, 0x5d, 0x38, 0x88, 0x6f, 0x61, 0xe7, 0x11, 0x42, 0x50, 0x4a, 0x4e, 0x22, 0x15, 0x29, 0x3e, + 0xf2, 0x8c, 0x51, 0x3f, 0xb4, 0x34, 0x73, 0xae, 0x32, 0x7e, 0x87, 0x2c, 0x51, 0x10, 0x26, 0xe6, + 0x54, 0x0a, 0x3c, 0xf0, 0xda, 0x23, 0x7b, 0xec, 0xdf, 0xbd, 0xe7, 0xa4, 0x96, 0x5c, 0x14, 0x9f, + 0x69, 0x78, 0x63, 0xe0, 0xbc, 0x41, 0x56, 0x42, 0x44, 0xc4, 0x78, 0x1a, 0x03, 0x3e, 0x56, 0x51, + 0x9c, 0x3d, 0xfb, 0xfd, 0xe7, 0xf1, 0xd3, 0x24, 0x95, 0xf3, 0xe5, 0xd4, 0x8f, 0x69, 0x1e, 0xc4, + 0x54, 0xe4, 0x54, 0xd4, 0x9f, 0xe7, 0x62, 0xb6, 0x08, 0xe4, 0x9a, 0x81, 0xf0, 0x2f, 0x0a, 0x19, + 0x9a, 0x09, 0x11, 0x97, 0x4a, 0xfb, 0xb6, 0x63, 0x1e, 0xfc, 0x77, 0x38, 0xfc, 0x80, 0x06, 0xb7, + 0x6f, 0xa7, 0x06, 0xff, 0x15, 0xa6, 0x22, 0x95, 0x80, 0xed, 0x6a, 0xf0, 0x35, 0x74, 0x4e, 0x90, + 0x29, 0x21, 0x83, 0x84, 0x93, 0xbc, 0xfe, 0x5b, 0x76, 0xd8, 0xe9, 0x23, 0xa3, 0xc4, 0x07, 0x9a, + 0x34, 0xca, 0x21, 0xa0, 0xfe, 0xfe, 0xf9, 0xd5, 0x7c, 0x9a, 0x1b, 0xe8, 0x11, 0x56, 0x6a, 0xbb, + 0xe1, 0xd4, 0x08, 0xef, 0xa3, 0xee, 0x1c, 0xd2, 0x64, 0x2e, 0xb5, 0x4b, 0x27, 0xac, 0x91, 0xda, + 0x34, 0x9e, 0x43, 0xbc, 0x10, 0xcb, 0x1c, 0xb7, 0xab, 0x4d, 0x1b, 0x7c, 0x76, 0xf9, 0x73, 0xe3, + 0x1a, 0xd7, 0x1b, 0xd7, 0xf8, 0xbb, 0x71, 0x8d, 0xef, 0x5b, 0xb7, 0x75, 0xbd, 0x75, 0x5b, 0xbf, + 0xb6, 0x6e, 0xeb, 0xd3, 0xcb, 0xbd, 0x38, 0xf6, 0xa3, 0xbe, 0x01, 0xc1, 0xea, 0x34, 0x28, 0xf7, + 0x9e, 0x99, 0x8e, 0x68, 0xda, 0xd5, 0x8f, 0xe5, 0xf4, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, + 0x6a, 0x04, 0x3d, 0x8a, 0x03, 0x00, 0x00, +} + +func (m *SequencerMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SequencerMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SequencerMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasPrice != nil { + { + size := m.GasPrice.Size() + i -= size + if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintMetadata(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + } + if len(m.Snapshots) > 0 { + for iNdEx := len(m.Snapshots) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Snapshots[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetadata(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + } + if len(m.ExtraData) > 0 { + i -= len(m.ExtraData) + copy(dAtA[i:], m.ExtraData) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.ExtraData))) + i-- + dAtA[i] = 0x6a + } + if m.ContactDetails != nil { + { + size, err := m.ContactDetails.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetadata(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + if len(m.GenesisUrls) > 0 { + for iNdEx := len(m.GenesisUrls) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.GenesisUrls[iNdEx]) + copy(dAtA[i:], m.GenesisUrls[iNdEx]) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.GenesisUrls[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } + if len(m.ExplorerUrl) > 0 { + i -= len(m.ExplorerUrl) + copy(dAtA[i:], m.ExplorerUrl) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.ExplorerUrl))) + i-- + dAtA[i] = 0x52 + } + if len(m.RestApiUrls) > 0 { + for iNdEx := len(m.RestApiUrls) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RestApiUrls[iNdEx]) + copy(dAtA[i:], m.RestApiUrls[iNdEx]) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.RestApiUrls[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if len(m.EvmRpcs) > 0 { + for iNdEx := len(m.EvmRpcs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.EvmRpcs[iNdEx]) + copy(dAtA[i:], m.EvmRpcs[iNdEx]) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.EvmRpcs[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.Rpcs) > 0 { + for iNdEx := len(m.Rpcs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Rpcs[iNdEx]) + copy(dAtA[i:], m.Rpcs[iNdEx]) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Rpcs[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if len(m.P2PSeeds) > 0 { + for iNdEx := len(m.P2PSeeds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.P2PSeeds[iNdEx]) + copy(dAtA[i:], m.P2PSeeds[iNdEx]) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.P2PSeeds[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ContactDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContactDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContactDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x5a + } + if len(m.X) > 0 { + i -= len(m.X) + copy(dAtA[i:], m.X) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.X))) + i-- + dAtA[i] = 0x12 + } + if len(m.Telegram) > 0 { + i -= len(m.Telegram) + copy(dAtA[i:], m.Telegram) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Telegram))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SnapshotInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SnapshotInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Checksum) > 0 { + i -= len(m.Checksum) + copy(dAtA[i:], m.Checksum) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Checksum))) + i-- + dAtA[i] = 0x1a + } + if m.Height != 0 { + i = encodeVarintMetadata(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.SnapshotUrl) > 0 { + i -= len(m.SnapshotUrl) + copy(dAtA[i:], m.SnapshotUrl) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.SnapshotUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMetadata(dAtA []byte, offset int, v uint64) int { + offset -= sovMetadata(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SequencerMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + if len(m.P2PSeeds) > 0 { + for _, s := range m.P2PSeeds { + l = len(s) + n += 1 + l + sovMetadata(uint64(l)) + } + } + if len(m.Rpcs) > 0 { + for _, s := range m.Rpcs { + l = len(s) + n += 1 + l + sovMetadata(uint64(l)) + } + } + if len(m.EvmRpcs) > 0 { + for _, s := range m.EvmRpcs { + l = len(s) + n += 1 + l + sovMetadata(uint64(l)) + } + } + if len(m.RestApiUrls) > 0 { + for _, s := range m.RestApiUrls { + l = len(s) + n += 1 + l + sovMetadata(uint64(l)) + } + } + l = len(m.ExplorerUrl) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + if len(m.GenesisUrls) > 0 { + for _, s := range m.GenesisUrls { + l = len(s) + n += 1 + l + sovMetadata(uint64(l)) + } + } + if m.ContactDetails != nil { + l = m.ContactDetails.Size() + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.ExtraData) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + if len(m.Snapshots) > 0 { + for _, e := range m.Snapshots { + l = e.Size() + n += 1 + l + sovMetadata(uint64(l)) + } + } + if m.GasPrice != nil { + l = m.GasPrice.Size() + n += 1 + l + sovMetadata(uint64(l)) + } + return n +} + +func (m *ContactDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Telegram) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.X) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + return n +} + +func (m *SnapshotInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SnapshotUrl) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovMetadata(uint64(m.Height)) + } + l = len(m.Checksum) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + return n +} + +func sovMetadata(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMetadata(x uint64) (n int) { + return sovMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SequencerMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SequencerMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SequencerMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field P2PSeeds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.P2PSeeds = append(m.P2PSeeds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rpcs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rpcs = append(m.Rpcs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EvmRpcs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EvmRpcs = append(m.EvmRpcs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RestApiUrls", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RestApiUrls = append(m.RestApiUrls, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExplorerUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExplorerUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisUrls", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisUrls = append(m.GenesisUrls, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContactDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContactDetails == nil { + m.ContactDetails = &ContactDetails{} + } + if err := m.ContactDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraData = append(m.ExtraData[:0], dAtA[iNdEx:postIndex]...) + if m.ExtraData == nil { + m.ExtraData = []byte{} + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Snapshots", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Snapshots = append(m.Snapshots, &SnapshotInfo{}) + if err := m.Snapshots[len(m.Snapshots)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.GasPrice = &v + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMetadata + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContactDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContactDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContactDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Telegram", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Telegram = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field X", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.X = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMetadata + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SnapshotUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SnapshotUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Checksum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMetadata + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMetadata(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMetadata + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMetadata + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMetadata + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMetadata = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetadata = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMetadata = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/operating_status.pb.go b/third_party/dymension/sequencer/types/operating_status.pb.go new file mode 100644 index 000000000..a3dae80b5 --- /dev/null +++ b/third_party/dymension/sequencer/types/operating_status.pb.go @@ -0,0 +1,85 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/operating_status.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// OperatingStatus defines the operating status of a sequencer +type OperatingStatus int32 + +const ( + // OPERATING_STATUS_UNBONDED defines a sequencer that is not active and won't + // be scheduled + Unbonded OperatingStatus = 0 + // UNBONDING defines a sequencer that is currently unbonding. + Unbonding OperatingStatus = 1 + // OPERATING_STATUS_BONDED defines a sequencer that is bonded and can be + // scheduled + Bonded OperatingStatus = 2 +) + +var OperatingStatus_name = map[int32]string{ + 0: "OPERATING_STATUS_UNBONDED", + 1: "OPERATING_STATUS_UNBONDING", + 2: "OPERATING_STATUS_BONDED", +} + +var OperatingStatus_value = map[string]int32{ + "OPERATING_STATUS_UNBONDED": 0, + "OPERATING_STATUS_UNBONDING": 1, + "OPERATING_STATUS_BONDED": 2, +} + +func (x OperatingStatus) String() string { + return proto.EnumName(OperatingStatus_name, int32(x)) +} + +func (OperatingStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_406c52b8df3dd90f, []int{0} +} + +func init() { + proto.RegisterEnum("dymensionxyz.dymension.sequencer.OperatingStatus", OperatingStatus_name, OperatingStatus_value) +} + +func init() { + proto.RegisterFile("dymension/sequencer/operating_status.proto", fileDescriptor_406c52b8df3dd90f) +} + +var fileDescriptor_406c52b8df3dd90f = []byte{ + // 259 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4a, 0xa9, 0xcc, 0x4d, + 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0xd3, 0x2f, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, 0xd2, + 0xcf, 0x2f, 0x48, 0x2d, 0x4a, 0x2c, 0xc9, 0xcc, 0x4b, 0x8f, 0x2f, 0x2e, 0x49, 0x2c, 0x29, 0x2d, + 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x80, 0xab, 0xad, 0xa8, 0xac, 0xd2, 0x83, 0x73, + 0xf4, 0xe0, 0x1a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x8a, 0xf5, 0x41, 0x2c, 0x88, 0x3e, + 0xad, 0x39, 0x8c, 0x5c, 0xfc, 0xfe, 0x30, 0x23, 0x83, 0xc1, 0x26, 0x0a, 0x69, 0x73, 0x49, 0xfa, + 0x07, 0xb8, 0x06, 0x39, 0x86, 0x78, 0xfa, 0xb9, 0xc7, 0x07, 0x87, 0x38, 0x86, 0x84, 0x06, 0xc7, + 0x87, 0xfa, 0x39, 0xf9, 0xfb, 0xb9, 0xb8, 0xba, 0x08, 0x30, 0x48, 0xf1, 0x74, 0xcd, 0x55, 0xe0, + 0x08, 0xcd, 0x4b, 0xca, 0xcf, 0x4b, 0x49, 0x4d, 0x11, 0xd2, 0xe5, 0x92, 0xc2, 0xa1, 0xd8, 0xd3, + 0xcf, 0x5d, 0x80, 0x51, 0x8a, 0xb7, 0x6b, 0xae, 0x02, 0x27, 0x44, 0x75, 0x66, 0x5e, 0xba, 0x90, + 0x3a, 0x97, 0x38, 0x86, 0x72, 0xa8, 0xc9, 0x4c, 0x52, 0x5c, 0x5d, 0x73, 0x15, 0xd8, 0x9c, 0xc0, + 0xe6, 0x4a, 0xb1, 0x74, 0x2c, 0x96, 0x63, 0x70, 0x0a, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, + 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, + 0x63, 0x39, 0x86, 0x28, 0xb3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, + 0x64, 0xbf, 0x23, 0x38, 0xfa, 0x65, 0xc6, 0xfa, 0x15, 0x48, 0x21, 0x57, 0x52, 0x59, 0x90, 0x5a, + 0x9c, 0xc4, 0x06, 0xf6, 0xb7, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x7a, 0x7d, 0xf3, 0x5d, + 0x01, 0x00, 0x00, +} diff --git a/third_party/dymension/sequencer/types/params.go b/third_party/dymension/sequencer/types/params.go new file mode 100644 index 000000000..2c89595f9 --- /dev/null +++ b/third_party/dymension/sequencer/types/params.go @@ -0,0 +1,11 @@ +package types + +import ( + "gopkg.in/yaml.v2" +) + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/third_party/dymension/sequencer/types/params.pb.go b/third_party/dymension/sequencer/types/params.pb.go new file mode 100644 index 000000000..26ea35e1d --- /dev/null +++ b/third_party/dymension/sequencer/types/params.pb.go @@ -0,0 +1,527 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/params.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { + MinBond types.Coin `protobuf:"bytes,1,opt,name=min_bond,json=minBond,proto3" json:"min_bond,omitempty"` + // unbonding_time is the time duration of unbonding. + UnbondingTime time.Duration `protobuf:"bytes,2,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time"` + // notice_period is the time duration of notice period. + // notice period is the duration between the unbond request and the actual + // unbonding starting. the proposer is still bonded during this period. + NoticePeriod time.Duration `protobuf:"bytes,3,opt,name=notice_period,json=noticePeriod,proto3,stdduration" json:"notice_period"` + // LivenessSlashMultiplier multiplies with the tokens of the slashed sequencer to compute the burn amount. + LivenessSlashMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=liveness_slash_multiplier,json=livenessSlashMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liveness_slash_multiplier" yaml:"liveness_slash_multiplier"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_d06545e8924ecfea, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMinBond() types.Coin { + if m != nil { + return m.MinBond + } + return types.Coin{} +} + +func (m *Params) GetUnbondingTime() time.Duration { + if m != nil { + return m.UnbondingTime + } + return 0 +} + +func (m *Params) GetNoticePeriod() time.Duration { + if m != nil { + return m.NoticePeriod + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "dymensionxyz.dymension.sequencer.Params") +} + +func init() { proto.RegisterFile("dymension/sequencer/params.proto", fileDescriptor_d06545e8924ecfea) } + +var fileDescriptor_d06545e8924ecfea = []byte{ + // 421 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x3f, 0x8b, 0xd4, 0x40, + 0x18, 0xc6, 0x33, 0x9e, 0x9c, 0x6b, 0xf4, 0x2c, 0x82, 0xe0, 0xde, 0x16, 0x49, 0xd8, 0x42, 0xae, + 0xd0, 0x19, 0xce, 0x03, 0x8b, 0x2b, 0xe3, 0x15, 0x22, 0x08, 0x21, 0x5a, 0xd9, 0x84, 0xfc, 0x79, + 0xcd, 0x0d, 0x66, 0xe6, 0x8d, 0x99, 0xc9, 0x72, 0xf1, 0x2b, 0x08, 0x62, 0x79, 0xe5, 0x7d, 0x9c, + 0x2b, 0xaf, 0x14, 0x8b, 0x28, 0xbb, 0x8d, 0x58, 0xfa, 0x09, 0x24, 0x7f, 0x77, 0x1b, 0xc1, 0x2a, + 0x79, 0xe7, 0x79, 0x9e, 0x1f, 0x0f, 0x2f, 0xaf, 0xe9, 0xa6, 0xb5, 0x00, 0xa9, 0x38, 0x4a, 0xa6, + 0xe0, 0x63, 0x05, 0x32, 0x81, 0x92, 0x15, 0x51, 0x19, 0x09, 0x45, 0x8b, 0x12, 0x35, 0x5a, 0x5b, + 0xc7, 0x45, 0xfd, 0x89, 0x4e, 0x03, 0x9d, 0xec, 0x8b, 0x87, 0x19, 0x66, 0xd8, 0x99, 0x59, 0xfb, + 0xd7, 0xe7, 0x16, 0x76, 0x82, 0x4a, 0xa0, 0x62, 0x71, 0xa4, 0x80, 0xad, 0x8e, 0x63, 0xd0, 0xd1, + 0x31, 0x4b, 0x90, 0xcb, 0x51, 0xcf, 0x10, 0xb3, 0x1c, 0x58, 0x37, 0xc5, 0xd5, 0x7b, 0x96, 0x56, + 0x65, 0xa4, 0x5b, 0x72, 0xf7, 0xb2, 0xfc, 0xbc, 0x67, 0xee, 0xfb, 0x5d, 0x11, 0xcb, 0x37, 0x67, + 0x82, 0xcb, 0x30, 0x46, 0x99, 0xce, 0x89, 0x4b, 0x8e, 0xee, 0x3d, 0x3b, 0xa4, 0x3d, 0x9d, 0xb6, + 0x74, 0x3a, 0xd0, 0xe9, 0x0b, 0xe4, 0xd2, 0x5b, 0x5c, 0x37, 0x8e, 0xf1, 0xbb, 0x71, 0xac, 0x31, + 0xf2, 0x04, 0x05, 0xd7, 0x20, 0x0a, 0x5d, 0x07, 0x77, 0x04, 0x97, 0x1e, 0xca, 0xd4, 0x7a, 0x65, + 0x3e, 0xa8, 0x64, 0x2b, 0x72, 0x99, 0x85, 0x9a, 0x0b, 0x98, 0xdf, 0x1a, 0xb8, 0x7d, 0x2b, 0x3a, + 0xb6, 0xa2, 0x67, 0x43, 0x2b, 0x6f, 0xd6, 0x72, 0x2f, 0x7f, 0x38, 0x24, 0x38, 0x98, 0xa2, 0x6f, + 0xb9, 0x00, 0xeb, 0xa5, 0x79, 0x20, 0x51, 0xf3, 0x04, 0xc2, 0x02, 0x4a, 0x8e, 0xe9, 0x7c, 0xef, + 0xff, 0x51, 0xf7, 0xfb, 0xa4, 0xdf, 0x05, 0xad, 0x2f, 0xc4, 0x3c, 0xcc, 0xf9, 0x0a, 0x24, 0x28, + 0x15, 0xaa, 0x3c, 0x52, 0xe7, 0xa1, 0xa8, 0x72, 0xcd, 0x8b, 0x9c, 0x43, 0x39, 0xbf, 0xed, 0x92, + 0xa3, 0xbb, 0x5e, 0xd0, 0x66, 0xbf, 0x37, 0xce, 0xe3, 0x8c, 0xeb, 0xf3, 0x2a, 0xa6, 0x09, 0x0a, + 0x36, 0x6c, 0xba, 0xff, 0x3c, 0x55, 0xe9, 0x07, 0xa6, 0xeb, 0x02, 0x14, 0x3d, 0x83, 0xe4, 0x4f, + 0xe3, 0xb8, 0x75, 0x24, 0xf2, 0xd3, 0xe5, 0x3f, 0xc1, 0xcb, 0xe0, 0xd1, 0xa8, 0xbd, 0x69, 0xa5, + 0xd7, 0x93, 0x72, 0x3a, 0xbb, 0xbc, 0x72, 0x8c, 0x5f, 0x57, 0x0e, 0xf1, 0xfc, 0xeb, 0xb5, 0x4d, + 0x6e, 0xd6, 0x36, 0xf9, 0xb9, 0xb6, 0xc9, 0xd7, 0x8d, 0x6d, 0xdc, 0x6c, 0x6c, 0xe3, 0xdb, 0xc6, + 0x36, 0xde, 0x3d, 0xdf, 0x29, 0xb2, 0x7b, 0x2a, 0xdb, 0x81, 0xad, 0x4e, 0xd8, 0xc5, 0xce, 0x79, + 0x75, 0xe5, 0xe2, 0xfd, 0x6e, 0x2f, 0x27, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x44, 0xa8, 0x10, + 0x6e, 0x82, 0x02, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.MinBond.Equal(&that1.MinBond) { + return false + } + if this.UnbondingTime != that1.UnbondingTime { + return false + } + if this.NoticePeriod != that1.NoticePeriod { + return false + } + if !this.LivenessSlashMultiplier.Equal(that1.LivenessSlashMultiplier) { + return false + } + return true +} +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.LivenessSlashMultiplier.Size() + i -= size + if _, err := m.LivenessSlashMultiplier.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.NoticePeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.NoticePeriod):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintParams(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintParams(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + { + size, err := m.MinBond.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MinBond.Size() + n += 1 + l + sovParams(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) + n += 1 + l + sovParams(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.NoticePeriod) + n += 1 + l + sovParams(uint64(l)) + l = m.LivenessSlashMultiplier.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBond", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinBond.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoticePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.NoticePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LivenessSlashMultiplier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LivenessSlashMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/query.pb.go b/third_party/dymension/sequencer/types/query.pb.go new file mode 100644 index 000000000..d104fe6a2 --- /dev/null +++ b/third_party/dymension/sequencer/types/query.pb.go @@ -0,0 +1,3031 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryGetSequencerRequest struct { + SequencerAddress string `protobuf:"bytes,1,opt,name=sequencerAddress,proto3" json:"sequencerAddress,omitempty"` +} + +func (m *QueryGetSequencerRequest) Reset() { *m = QueryGetSequencerRequest{} } +func (m *QueryGetSequencerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetSequencerRequest) ProtoMessage() {} +func (*QueryGetSequencerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{2} +} +func (m *QueryGetSequencerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetSequencerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetSequencerRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetSequencerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSequencerRequest.Merge(m, src) +} +func (m *QueryGetSequencerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetSequencerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSequencerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetSequencerRequest proto.InternalMessageInfo + +func (m *QueryGetSequencerRequest) GetSequencerAddress() string { + if m != nil { + return m.SequencerAddress + } + return "" +} + +type QueryGetSequencerResponse struct { + Sequencer Sequencer `protobuf:"bytes,1,opt,name=sequencer,proto3" json:"sequencer"` +} + +func (m *QueryGetSequencerResponse) Reset() { *m = QueryGetSequencerResponse{} } +func (m *QueryGetSequencerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetSequencerResponse) ProtoMessage() {} +func (*QueryGetSequencerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{3} +} +func (m *QueryGetSequencerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetSequencerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetSequencerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetSequencerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSequencerResponse.Merge(m, src) +} +func (m *QueryGetSequencerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetSequencerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSequencerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetSequencerResponse proto.InternalMessageInfo + +func (m *QueryGetSequencerResponse) GetSequencer() Sequencer { + if m != nil { + return m.Sequencer + } + return Sequencer{} +} + +type QuerySequencersRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySequencersRequest) Reset() { *m = QuerySequencersRequest{} } +func (m *QuerySequencersRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySequencersRequest) ProtoMessage() {} +func (*QuerySequencersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{4} +} +func (m *QuerySequencersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySequencersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySequencersRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySequencersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySequencersRequest.Merge(m, src) +} +func (m *QuerySequencersRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySequencersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySequencersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySequencersRequest proto.InternalMessageInfo + +func (m *QuerySequencersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QuerySequencersResponse struct { + Sequencers []Sequencer `protobuf:"bytes,1,rep,name=sequencers,proto3" json:"sequencers"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySequencersResponse) Reset() { *m = QuerySequencersResponse{} } +func (m *QuerySequencersResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySequencersResponse) ProtoMessage() {} +func (*QuerySequencersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{5} +} +func (m *QuerySequencersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySequencersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySequencersResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySequencersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySequencersResponse.Merge(m, src) +} +func (m *QuerySequencersResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySequencersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySequencersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySequencersResponse proto.InternalMessageInfo + +func (m *QuerySequencersResponse) GetSequencers() []Sequencer { + if m != nil { + return m.Sequencers + } + return nil +} + +func (m *QuerySequencersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetSequencersByRollappRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` +} + +func (m *QueryGetSequencersByRollappRequest) Reset() { *m = QueryGetSequencersByRollappRequest{} } +func (m *QueryGetSequencersByRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetSequencersByRollappRequest) ProtoMessage() {} +func (*QueryGetSequencersByRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{6} +} +func (m *QueryGetSequencersByRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetSequencersByRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetSequencersByRollappRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetSequencersByRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSequencersByRollappRequest.Merge(m, src) +} +func (m *QueryGetSequencersByRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetSequencersByRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSequencersByRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetSequencersByRollappRequest proto.InternalMessageInfo + +func (m *QueryGetSequencersByRollappRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type QueryGetSequencersByRollappResponse struct { + Sequencers []Sequencer `protobuf:"bytes,1,rep,name=sequencers,proto3" json:"sequencers"` +} + +func (m *QueryGetSequencersByRollappResponse) Reset() { *m = QueryGetSequencersByRollappResponse{} } +func (m *QueryGetSequencersByRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetSequencersByRollappResponse) ProtoMessage() {} +func (*QueryGetSequencersByRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{7} +} +func (m *QueryGetSequencersByRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetSequencersByRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetSequencersByRollappResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetSequencersByRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSequencersByRollappResponse.Merge(m, src) +} +func (m *QueryGetSequencersByRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetSequencersByRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSequencersByRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetSequencersByRollappResponse proto.InternalMessageInfo + +func (m *QueryGetSequencersByRollappResponse) GetSequencers() []Sequencer { + if m != nil { + return m.Sequencers + } + return nil +} + +type QueryGetSequencersByRollappByStatusRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Status OperatingStatus `protobuf:"varint,2,opt,name=status,proto3,enum=dymensionxyz.dymension.sequencer.OperatingStatus" json:"status,omitempty"` +} + +func (m *QueryGetSequencersByRollappByStatusRequest) Reset() { + *m = QueryGetSequencersByRollappByStatusRequest{} +} +func (m *QueryGetSequencersByRollappByStatusRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetSequencersByRollappByStatusRequest) ProtoMessage() {} +func (*QueryGetSequencersByRollappByStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{8} +} +func (m *QueryGetSequencersByRollappByStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetSequencersByRollappByStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetSequencersByRollappByStatusRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetSequencersByRollappByStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSequencersByRollappByStatusRequest.Merge(m, src) +} +func (m *QueryGetSequencersByRollappByStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetSequencersByRollappByStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSequencersByRollappByStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetSequencersByRollappByStatusRequest proto.InternalMessageInfo + +func (m *QueryGetSequencersByRollappByStatusRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetSequencersByRollappByStatusRequest) GetStatus() OperatingStatus { + if m != nil { + return m.Status + } + return Unbonded +} + +type QueryGetSequencersByRollappByStatusResponse struct { + Sequencers []Sequencer `protobuf:"bytes,1,rep,name=sequencers,proto3" json:"sequencers"` +} + +func (m *QueryGetSequencersByRollappByStatusResponse) Reset() { + *m = QueryGetSequencersByRollappByStatusResponse{} +} +func (m *QueryGetSequencersByRollappByStatusResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetSequencersByRollappByStatusResponse) ProtoMessage() {} +func (*QueryGetSequencersByRollappByStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{9} +} +func (m *QueryGetSequencersByRollappByStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetSequencersByRollappByStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetSequencersByRollappByStatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetSequencersByRollappByStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetSequencersByRollappByStatusResponse.Merge(m, src) +} +func (m *QueryGetSequencersByRollappByStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetSequencersByRollappByStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetSequencersByRollappByStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetSequencersByRollappByStatusResponse proto.InternalMessageInfo + +func (m *QueryGetSequencersByRollappByStatusResponse) GetSequencers() []Sequencer { + if m != nil { + return m.Sequencers + } + return nil +} + +// Request type for the GetProposerByRollapp RPC method. +type QueryGetProposerByRollappRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` +} + +func (m *QueryGetProposerByRollappRequest) Reset() { *m = QueryGetProposerByRollappRequest{} } +func (m *QueryGetProposerByRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetProposerByRollappRequest) ProtoMessage() {} +func (*QueryGetProposerByRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{10} +} +func (m *QueryGetProposerByRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetProposerByRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetProposerByRollappRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetProposerByRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetProposerByRollappRequest.Merge(m, src) +} +func (m *QueryGetProposerByRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetProposerByRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetProposerByRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetProposerByRollappRequest proto.InternalMessageInfo + +func (m *QueryGetProposerByRollappRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +// Response type for the GetProposerByRollapp RPC method. +type QueryGetProposerByRollappResponse struct { + ProposerAddr string `protobuf:"bytes,1,opt,name=proposerAddr,proto3" json:"proposerAddr,omitempty"` +} + +func (m *QueryGetProposerByRollappResponse) Reset() { *m = QueryGetProposerByRollappResponse{} } +func (m *QueryGetProposerByRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetProposerByRollappResponse) ProtoMessage() {} +func (*QueryGetProposerByRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{11} +} +func (m *QueryGetProposerByRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetProposerByRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetProposerByRollappResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetProposerByRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetProposerByRollappResponse.Merge(m, src) +} +func (m *QueryGetProposerByRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetProposerByRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetProposerByRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetProposerByRollappResponse proto.InternalMessageInfo + +func (m *QueryGetProposerByRollappResponse) GetProposerAddr() string { + if m != nil { + return m.ProposerAddr + } + return "" +} + +// Request type for the GetNextProposerByRollapp RPC method. +type QueryGetNextProposerByRollappRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` +} + +func (m *QueryGetNextProposerByRollappRequest) Reset() { *m = QueryGetNextProposerByRollappRequest{} } +func (m *QueryGetNextProposerByRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetNextProposerByRollappRequest) ProtoMessage() {} +func (*QueryGetNextProposerByRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{12} +} +func (m *QueryGetNextProposerByRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNextProposerByRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNextProposerByRollappRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNextProposerByRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNextProposerByRollappRequest.Merge(m, src) +} +func (m *QueryGetNextProposerByRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNextProposerByRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNextProposerByRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNextProposerByRollappRequest proto.InternalMessageInfo + +func (m *QueryGetNextProposerByRollappRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +// Response type for the GetNextProposerByRollapp RPC method. +type QueryGetNextProposerByRollappResponse struct { + NextProposerAddr string `protobuf:"bytes,1,opt,name=nextProposerAddr,proto3" json:"nextProposerAddr,omitempty"` + RotationInProgress bool `protobuf:"varint,2,opt,name=rotationInProgress,proto3" json:"rotationInProgress,omitempty"` +} + +func (m *QueryGetNextProposerByRollappResponse) Reset() { *m = QueryGetNextProposerByRollappResponse{} } +func (m *QueryGetNextProposerByRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetNextProposerByRollappResponse) ProtoMessage() {} +func (*QueryGetNextProposerByRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d09222b66a78a447, []int{13} +} +func (m *QueryGetNextProposerByRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNextProposerByRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNextProposerByRollappResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNextProposerByRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNextProposerByRollappResponse.Merge(m, src) +} +func (m *QueryGetNextProposerByRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNextProposerByRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNextProposerByRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNextProposerByRollappResponse proto.InternalMessageInfo + +func (m *QueryGetNextProposerByRollappResponse) GetNextProposerAddr() string { + if m != nil { + return m.NextProposerAddr + } + return "" +} + +func (m *QueryGetNextProposerByRollappResponse) GetRotationInProgress() bool { + if m != nil { + return m.RotationInProgress + } + return false +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "dymensionxyz.dymension.sequencer.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "dymensionxyz.dymension.sequencer.QueryParamsResponse") + proto.RegisterType((*QueryGetSequencerRequest)(nil), "dymensionxyz.dymension.sequencer.QueryGetSequencerRequest") + proto.RegisterType((*QueryGetSequencerResponse)(nil), "dymensionxyz.dymension.sequencer.QueryGetSequencerResponse") + proto.RegisterType((*QuerySequencersRequest)(nil), "dymensionxyz.dymension.sequencer.QuerySequencersRequest") + proto.RegisterType((*QuerySequencersResponse)(nil), "dymensionxyz.dymension.sequencer.QuerySequencersResponse") + proto.RegisterType((*QueryGetSequencersByRollappRequest)(nil), "dymensionxyz.dymension.sequencer.QueryGetSequencersByRollappRequest") + proto.RegisterType((*QueryGetSequencersByRollappResponse)(nil), "dymensionxyz.dymension.sequencer.QueryGetSequencersByRollappResponse") + proto.RegisterType((*QueryGetSequencersByRollappByStatusRequest)(nil), "dymensionxyz.dymension.sequencer.QueryGetSequencersByRollappByStatusRequest") + proto.RegisterType((*QueryGetSequencersByRollappByStatusResponse)(nil), "dymensionxyz.dymension.sequencer.QueryGetSequencersByRollappByStatusResponse") + proto.RegisterType((*QueryGetProposerByRollappRequest)(nil), "dymensionxyz.dymension.sequencer.QueryGetProposerByRollappRequest") + proto.RegisterType((*QueryGetProposerByRollappResponse)(nil), "dymensionxyz.dymension.sequencer.QueryGetProposerByRollappResponse") + proto.RegisterType((*QueryGetNextProposerByRollappRequest)(nil), "dymensionxyz.dymension.sequencer.QueryGetNextProposerByRollappRequest") + proto.RegisterType((*QueryGetNextProposerByRollappResponse)(nil), "dymensionxyz.dymension.sequencer.QueryGetNextProposerByRollappResponse") +} + +func init() { proto.RegisterFile("dymension/sequencer/query.proto", fileDescriptor_d09222b66a78a447) } + +var fileDescriptor_d09222b66a78a447 = []byte{ + // 842 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x4e, 0x13, 0x5b, + 0x14, 0xee, 0x70, 0xce, 0x69, 0x4e, 0xd7, 0x21, 0x27, 0x64, 0x43, 0xce, 0xc1, 0x91, 0x94, 0x3a, + 0xf8, 0x43, 0x4a, 0x9c, 0x11, 0x50, 0x82, 0x12, 0x09, 0x16, 0x68, 0x43, 0x44, 0x28, 0xc5, 0x2b, + 0x13, 0x53, 0xa7, 0x74, 0x67, 0x6c, 0xd2, 0xce, 0x1e, 0x66, 0x4f, 0x49, 0x2b, 0x21, 0x31, 0xfa, + 0x02, 0x24, 0xc4, 0x67, 0xf0, 0x09, 0xf4, 0x19, 0xb8, 0xf0, 0x82, 0xc4, 0x1b, 0xaf, 0xd4, 0x80, + 0xf7, 0xfa, 0x08, 0x66, 0xf6, 0xec, 0x99, 0xb6, 0x74, 0xda, 0xe9, 0x0f, 0xdc, 0x4d, 0xf7, 0xac, + 0xf5, 0xad, 0xef, 0x5b, 0x6b, 0xd6, 0xb7, 0x0b, 0xe3, 0xf9, 0x6a, 0x09, 0xeb, 0xb4, 0x40, 0x74, + 0x85, 0xe2, 0xdd, 0x32, 0xd6, 0x77, 0xb0, 0xa9, 0xec, 0x96, 0xb1, 0x59, 0x95, 0x0d, 0x93, 0x58, + 0x04, 0xc5, 0xbc, 0x80, 0x4a, 0xf5, 0x95, 0xec, 0xfd, 0x90, 0xbd, 0x68, 0x71, 0x44, 0x23, 0x1a, + 0x61, 0xc1, 0x8a, 0xfd, 0xe4, 0xe4, 0x89, 0x63, 0x1a, 0x21, 0x5a, 0x11, 0x2b, 0xaa, 0x51, 0x50, + 0x54, 0x5d, 0x27, 0x96, 0x6a, 0x15, 0x88, 0x4e, 0xf9, 0xdb, 0xf8, 0x0e, 0xa1, 0x25, 0x42, 0x95, + 0x9c, 0x4a, 0xb1, 0x53, 0x4e, 0xd9, 0x9b, 0xce, 0x61, 0x4b, 0x9d, 0x56, 0x0c, 0x55, 0x2b, 0xe8, + 0x2c, 0x98, 0xc7, 0xc6, 0xfc, 0x28, 0x1a, 0xaa, 0xa9, 0x96, 0x5c, 0xb4, 0x09, 0xbf, 0x08, 0xef, + 0xc9, 0x2d, 0xe9, 0x17, 0x44, 0x0c, 0x6c, 0xaa, 0x56, 0x41, 0xd7, 0xb2, 0xd4, 0x52, 0xad, 0x32, + 0x07, 0x94, 0x46, 0x00, 0x6d, 0xd9, 0xa4, 0xd2, 0xac, 0x4a, 0xc6, 0x0e, 0xa7, 0x96, 0xf4, 0x1c, + 0x86, 0x1b, 0x4e, 0xa9, 0x41, 0x74, 0x8a, 0x51, 0x12, 0xc2, 0x0e, 0x9b, 0x51, 0x21, 0x26, 0x4c, + 0xfe, 0x33, 0x33, 0x29, 0x07, 0xb5, 0x4c, 0x76, 0x10, 0x12, 0x7f, 0x1e, 0x7f, 0x1d, 0x0f, 0x65, + 0x78, 0xb6, 0x94, 0x84, 0x51, 0x06, 0x9f, 0xc2, 0xd6, 0xb6, 0x1b, 0xc9, 0x4b, 0xa3, 0x38, 0x0c, + 0x79, 0xd9, 0x8f, 0xf2, 0x79, 0x13, 0x53, 0xa7, 0x5a, 0x24, 0xd3, 0x74, 0x2e, 0x15, 0xe1, 0x8a, + 0x0f, 0x0e, 0x27, 0xbb, 0x09, 0x11, 0x2f, 0x81, 0xf3, 0x9d, 0x0a, 0xe6, 0xeb, 0xe1, 0x70, 0xca, + 0x35, 0x0c, 0xe9, 0x05, 0xfc, 0xc7, 0xaa, 0x79, 0x21, 0x6e, 0xbb, 0x50, 0x12, 0xa0, 0x36, 0x4b, + 0x5e, 0xeb, 0xa6, 0xec, 0x0c, 0x5e, 0xb6, 0x07, 0x2f, 0x3b, 0xdf, 0x19, 0x1f, 0xbc, 0x9c, 0x56, + 0x35, 0xcc, 0x73, 0x33, 0x75, 0x99, 0xd2, 0x07, 0x01, 0xfe, 0x6f, 0x2a, 0xc1, 0xe5, 0x6c, 0x01, + 0x78, 0x54, 0xec, 0x8e, 0xfc, 0xd1, 0x9b, 0x9e, 0x3a, 0x10, 0x94, 0x6a, 0xa0, 0x3d, 0xc0, 0x68, + 0xdf, 0x0a, 0xa4, 0xed, 0xf0, 0x69, 0xe0, 0x9d, 0x00, 0xa9, 0x69, 0x0e, 0x34, 0x51, 0xcd, 0x90, + 0x62, 0x51, 0x35, 0x0c, 0xb7, 0x4b, 0x63, 0x10, 0x31, 0x9d, 0x93, 0xb5, 0x3c, 0x1f, 0x69, 0xed, + 0x40, 0xaa, 0xc0, 0x44, 0x5b, 0x8c, 0x4b, 0x6b, 0x83, 0xf4, 0x4e, 0x80, 0x78, 0x9b, 0xd2, 0x89, + 0xea, 0x36, 0x5b, 0x98, 0x8e, 0x64, 0xa0, 0x35, 0x08, 0x3b, 0xfb, 0xc5, 0xfa, 0xf9, 0xef, 0xcc, + 0x74, 0x30, 0xb7, 0x4d, 0x77, 0x33, 0x79, 0x1d, 0x0e, 0x20, 0xbd, 0x16, 0x60, 0xaa, 0x23, 0x5e, + 0x97, 0xd7, 0x9a, 0x25, 0x88, 0xb9, 0x0c, 0xd2, 0x26, 0x31, 0x08, 0xc5, 0x66, 0x97, 0x63, 0x4d, + 0xc1, 0xb5, 0x36, 0x08, 0x9c, 0xb9, 0x04, 0x83, 0x06, 0x7f, 0x69, 0xaf, 0x36, 0x47, 0x69, 0x38, + 0x93, 0x56, 0xe0, 0xba, 0x0b, 0xb4, 0x81, 0x2b, 0xbd, 0xd2, 0x79, 0x2b, 0xc0, 0x8d, 0x00, 0x18, + 0xce, 0x29, 0x0e, 0x43, 0x7a, 0x5d, 0x40, 0x1d, 0xaf, 0xa6, 0x73, 0x24, 0x03, 0x32, 0xb9, 0xed, + 0xaf, 0xe9, 0x69, 0x93, 0x68, 0xcc, 0xb5, 0xec, 0x0f, 0xe0, 0xef, 0x8c, 0xcf, 0x9b, 0x99, 0xa3, + 0x41, 0xf8, 0x8b, 0xb1, 0x40, 0xef, 0x05, 0x08, 0x3b, 0x16, 0x89, 0xee, 0x06, 0x8f, 0xaa, 0xd9, + 0xa9, 0xc5, 0x7b, 0x5d, 0x66, 0x39, 0xea, 0xa4, 0x3b, 0x6f, 0x3e, 0xff, 0x38, 0x1a, 0x88, 0xa3, + 0x49, 0xa5, 0x3e, 0x5d, 0x69, 0x7d, 0xff, 0xa0, 0x4f, 0x02, 0x44, 0xbc, 0x4f, 0x05, 0x3d, 0xe8, + 0xb0, 0xac, 0x8f, 0xc3, 0x8b, 0x0b, 0x3d, 0xe5, 0x72, 0xe2, 0x49, 0x46, 0x7c, 0x09, 0x2d, 0x06, + 0x13, 0xaf, 0x3d, 0xed, 0x9f, 0xbf, 0x39, 0x0e, 0xd0, 0x47, 0x01, 0xa0, 0xb6, 0x54, 0x68, 0xbe, + 0x43, 0x4e, 0x4d, 0xde, 0x2f, 0xde, 0xef, 0x21, 0x93, 0x6b, 0x99, 0x65, 0x5a, 0x6e, 0xa3, 0xa9, + 0x2e, 0xb4, 0xa0, 0x9f, 0x02, 0x0c, 0xfb, 0xb8, 0x01, 0x5a, 0xe9, 0xa1, 0xab, 0x4d, 0x1e, 0x2d, + 0xae, 0xf6, 0x89, 0xc2, 0x95, 0x3d, 0x66, 0xca, 0x56, 0xd1, 0x72, 0x17, 0xca, 0x68, 0x36, 0x57, + 0xcd, 0xf2, 0x4d, 0x55, 0xf6, 0xbd, 0x95, 0x3d, 0x40, 0x87, 0x03, 0x70, 0xb5, 0x8d, 0xff, 0xa1, + 0xf5, 0xbe, 0x38, 0x9f, 0xb3, 0x77, 0xf1, 0xc9, 0x05, 0xa1, 0xf1, 0x4e, 0x3c, 0x65, 0x9d, 0xd8, + 0x40, 0xeb, 0x17, 0xd0, 0x09, 0x65, 0xdf, 0xb9, 0x19, 0x0e, 0xd0, 0x37, 0x01, 0x46, 0xfc, 0x1c, + 0x15, 0x25, 0x3a, 0x67, 0xdf, 0xca, 0x41, 0xc5, 0xe5, 0xbe, 0x30, 0xb8, 0xee, 0x45, 0xa6, 0x7b, + 0x1e, 0xcd, 0x75, 0x60, 0x30, 0x1c, 0xa4, 0x61, 0xe8, 0xbf, 0x04, 0x18, 0x6d, 0xe5, 0xd1, 0x28, + 0xd9, 0x39, 0xc3, 0x76, 0x77, 0x85, 0x98, 0xea, 0x1b, 0x87, 0xab, 0x5d, 0x66, 0x6a, 0x1f, 0xa2, + 0x85, 0x60, 0xb5, 0xf6, 0xe5, 0x91, 0xf5, 0x93, 0x9c, 0x48, 0x1f, 0x9f, 0x46, 0x85, 0x93, 0xd3, + 0xa8, 0xf0, 0xfd, 0x34, 0x2a, 0x1c, 0x9e, 0x45, 0x43, 0x27, 0x67, 0xd1, 0xd0, 0x97, 0xb3, 0x68, + 0xe8, 0xd9, 0x9c, 0x56, 0xb0, 0x5e, 0x96, 0x73, 0xf2, 0x0e, 0x29, 0xb5, 0x2a, 0xb0, 0x37, 0xab, + 0x54, 0xea, 0xaa, 0x58, 0x55, 0x03, 0xd3, 0x5c, 0x98, 0xfd, 0xc7, 0x9f, 0xfd, 0x1d, 0x00, 0x00, + 0xff, 0xff, 0x0f, 0xf5, 0x03, 0x5e, 0xfb, 0x0c, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a Sequencer by address. + Sequencer(ctx context.Context, in *QueryGetSequencerRequest, opts ...grpc.CallOption) (*QueryGetSequencerResponse, error) + // Queries a list of Sequencer items. + Sequencers(ctx context.Context, in *QuerySequencersRequest, opts ...grpc.CallOption) (*QuerySequencersResponse, error) + // Queries a SequencersByRollapp by rollappId. + SequencersByRollapp(ctx context.Context, in *QueryGetSequencersByRollappRequest, opts ...grpc.CallOption) (*QueryGetSequencersByRollappResponse, error) + // Queries a SequencersByRollappByStatus + SequencersByRollappByStatus(ctx context.Context, in *QueryGetSequencersByRollappByStatusRequest, opts ...grpc.CallOption) (*QueryGetSequencersByRollappByStatusResponse, error) + // Queries the current proposer by rollappId. + GetProposerByRollapp(ctx context.Context, in *QueryGetProposerByRollappRequest, opts ...grpc.CallOption) (*QueryGetProposerByRollappResponse, error) + // Queries the next proposer by rollappId. + GetNextProposerByRollapp(ctx context.Context, in *QueryGetNextProposerByRollappRequest, opts ...grpc.CallOption) (*QueryGetNextProposerByRollappResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Sequencer(ctx context.Context, in *QueryGetSequencerRequest, opts ...grpc.CallOption) (*QueryGetSequencerResponse, error) { + out := new(QueryGetSequencerResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/Sequencer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Sequencers(ctx context.Context, in *QuerySequencersRequest, opts ...grpc.CallOption) (*QuerySequencersResponse, error) { + out := new(QuerySequencersResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/Sequencers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SequencersByRollapp(ctx context.Context, in *QueryGetSequencersByRollappRequest, opts ...grpc.CallOption) (*QueryGetSequencersByRollappResponse, error) { + out := new(QueryGetSequencersByRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/SequencersByRollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SequencersByRollappByStatus(ctx context.Context, in *QueryGetSequencersByRollappByStatusRequest, opts ...grpc.CallOption) (*QueryGetSequencersByRollappByStatusResponse, error) { + out := new(QueryGetSequencersByRollappByStatusResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/SequencersByRollappByStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetProposerByRollapp(ctx context.Context, in *QueryGetProposerByRollappRequest, opts ...grpc.CallOption) (*QueryGetProposerByRollappResponse, error) { + out := new(QueryGetProposerByRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/GetProposerByRollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetNextProposerByRollapp(ctx context.Context, in *QueryGetNextProposerByRollappRequest, opts ...grpc.CallOption) (*QueryGetNextProposerByRollappResponse, error) { + out := new(QueryGetNextProposerByRollappResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Query/GetNextProposerByRollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a Sequencer by address. + Sequencer(context.Context, *QueryGetSequencerRequest) (*QueryGetSequencerResponse, error) + // Queries a list of Sequencer items. + Sequencers(context.Context, *QuerySequencersRequest) (*QuerySequencersResponse, error) + // Queries a SequencersByRollapp by rollappId. + SequencersByRollapp(context.Context, *QueryGetSequencersByRollappRequest) (*QueryGetSequencersByRollappResponse, error) + // Queries a SequencersByRollappByStatus + SequencersByRollappByStatus(context.Context, *QueryGetSequencersByRollappByStatusRequest) (*QueryGetSequencersByRollappByStatusResponse, error) + // Queries the current proposer by rollappId. + GetProposerByRollapp(context.Context, *QueryGetProposerByRollappRequest) (*QueryGetProposerByRollappResponse, error) + // Queries the next proposer by rollappId. + GetNextProposerByRollapp(context.Context, *QueryGetNextProposerByRollappRequest) (*QueryGetNextProposerByRollappResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Sequencer(ctx context.Context, req *QueryGetSequencerRequest) (*QueryGetSequencerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sequencer not implemented") +} +func (*UnimplementedQueryServer) Sequencers(ctx context.Context, req *QuerySequencersRequest) (*QuerySequencersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sequencers not implemented") +} +func (*UnimplementedQueryServer) SequencersByRollapp(ctx context.Context, req *QueryGetSequencersByRollappRequest) (*QueryGetSequencersByRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SequencersByRollapp not implemented") +} +func (*UnimplementedQueryServer) SequencersByRollappByStatus(ctx context.Context, req *QueryGetSequencersByRollappByStatusRequest) (*QueryGetSequencersByRollappByStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SequencersByRollappByStatus not implemented") +} +func (*UnimplementedQueryServer) GetProposerByRollapp(ctx context.Context, req *QueryGetProposerByRollappRequest) (*QueryGetProposerByRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProposerByRollapp not implemented") +} +func (*UnimplementedQueryServer) GetNextProposerByRollapp(ctx context.Context, req *QueryGetNextProposerByRollappRequest) (*QueryGetNextProposerByRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNextProposerByRollapp not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Sequencer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetSequencerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Sequencer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/Sequencer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Sequencer(ctx, req.(*QueryGetSequencerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Sequencers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySequencersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Sequencers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/Sequencers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Sequencers(ctx, req.(*QuerySequencersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SequencersByRollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetSequencersByRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SequencersByRollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/SequencersByRollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SequencersByRollapp(ctx, req.(*QueryGetSequencersByRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SequencersByRollappByStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetSequencersByRollappByStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SequencersByRollappByStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/SequencersByRollappByStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SequencersByRollappByStatus(ctx, req.(*QueryGetSequencersByRollappByStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetProposerByRollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetProposerByRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetProposerByRollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/GetProposerByRollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetProposerByRollapp(ctx, req.(*QueryGetProposerByRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetNextProposerByRollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNextProposerByRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetNextProposerByRollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Query/GetNextProposerByRollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetNextProposerByRollapp(ctx, req.(*QueryGetNextProposerByRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dymensionxyz.dymension.sequencer.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Sequencer", + Handler: _Query_Sequencer_Handler, + }, + { + MethodName: "Sequencers", + Handler: _Query_Sequencers_Handler, + }, + { + MethodName: "SequencersByRollapp", + Handler: _Query_SequencersByRollapp_Handler, + }, + { + MethodName: "SequencersByRollappByStatus", + Handler: _Query_SequencersByRollappByStatus_Handler, + }, + { + MethodName: "GetProposerByRollapp", + Handler: _Query_GetProposerByRollapp_Handler, + }, + { + MethodName: "GetNextProposerByRollapp", + Handler: _Query_GetNextProposerByRollapp_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dymension/sequencer/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetSequencerRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetSequencerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetSequencerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SequencerAddress) > 0 { + i -= len(m.SequencerAddress) + copy(dAtA[i:], m.SequencerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SequencerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetSequencerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetSequencerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetSequencerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Sequencer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QuerySequencersRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySequencersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySequencersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySequencersResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySequencersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySequencersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Sequencers) > 0 { + for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetSequencersByRollappRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetSequencersByRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetSequencersByRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetSequencersByRollappResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetSequencersByRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetSequencersByRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sequencers) > 0 { + for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetSequencersByRollappByStatusRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetSequencersByRollappByStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetSequencersByRollappByStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetSequencersByRollappByStatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetSequencersByRollappByStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetSequencersByRollappByStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sequencers) > 0 { + for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetProposerByRollappRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetProposerByRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetProposerByRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetProposerByRollappResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetProposerByRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetProposerByRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProposerAddr) > 0 { + i -= len(m.ProposerAddr) + copy(dAtA[i:], m.ProposerAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposerAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetNextProposerByRollappRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetNextProposerByRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNextProposerByRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetNextProposerByRollappResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetNextProposerByRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNextProposerByRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RotationInProgress { + i-- + if m.RotationInProgress { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.NextProposerAddr) > 0 { + i -= len(m.NextProposerAddr) + copy(dAtA[i:], m.NextProposerAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NextProposerAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetSequencerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SequencerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetSequencerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sequencer.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QuerySequencersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySequencersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Sequencers) > 0 { + for _, e := range m.Sequencers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetSequencersByRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetSequencersByRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Sequencers) > 0 { + for _, e := range m.Sequencers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryGetSequencersByRollappByStatusRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovQuery(uint64(m.Status)) + } + return n +} + +func (m *QueryGetSequencersByRollappByStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Sequencers) > 0 { + for _, e := range m.Sequencers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryGetProposerByRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetProposerByRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProposerAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNextProposerByRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNextProposerByRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NextProposerAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.RotationInProgress { + n += 2 + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSequencerRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetSequencerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetSequencerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequencerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequencerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSequencerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetSequencerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetSequencerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sequencer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySequencersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySequencersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySequencersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySequencersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySequencersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySequencersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencers = append(m.Sequencers, Sequencer{}) + if err := m.Sequencers[len(m.Sequencers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSequencersByRollappRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetSequencersByRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetSequencersByRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSequencersByRollappResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetSequencersByRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetSequencersByRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencers = append(m.Sequencers, Sequencer{}) + if err := m.Sequencers[len(m.Sequencers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSequencersByRollappByStatusRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetSequencersByRollappByStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetSequencersByRollappByStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= OperatingStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetSequencersByRollappByStatusResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetSequencersByRollappByStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetSequencersByRollappByStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencers = append(m.Sequencers, Sequencer{}) + if err := m.Sequencers[len(m.Sequencers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetProposerByRollappRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetProposerByRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetProposerByRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetProposerByRollappResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetProposerByRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetProposerByRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProposerAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetNextProposerByRollappRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNextProposerByRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNextProposerByRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetNextProposerByRollappResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNextProposerByRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNextProposerByRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextProposerAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextProposerAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RotationInProgress", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RotationInProgress = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/query.pb.gw.go b/third_party/dymension/sequencer/types/query.pb.gw.go new file mode 100644 index 000000000..9429bb4c2 --- /dev/null +++ b/third_party/dymension/sequencer/types/query.pb.gw.go @@ -0,0 +1,769 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: dymension/sequencer/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Sequencer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSequencerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["sequencerAddress"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sequencerAddress") + } + + protoReq.SequencerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sequencerAddress", err) + } + + msg, err := client.Sequencer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Sequencer_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSequencerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["sequencerAddress"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sequencerAddress") + } + + protoReq.SequencerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sequencerAddress", err) + } + + msg, err := server.Sequencer(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Sequencers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Sequencers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySequencersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Sequencers_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Sequencers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Sequencers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySequencersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Sequencers_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Sequencers(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_SequencersByRollapp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSequencersByRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := client.SequencersByRollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SequencersByRollapp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSequencersByRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := server.SequencersByRollapp(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_SequencersByRollappByStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSequencersByRollappByStatusRequest + var metadata runtime.ServerMetadata + + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["status"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") + } + + e, err = runtime.Enum(val, OperatingStatus_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) + } + + protoReq.Status = OperatingStatus(e) + + msg, err := client.SequencersByRollappByStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SequencersByRollappByStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetSequencersByRollappByStatusRequest + var metadata runtime.ServerMetadata + + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["status"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") + } + + e, err = runtime.Enum(val, OperatingStatus_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) + } + + protoReq.Status = OperatingStatus(e) + + msg, err := server.SequencersByRollappByStatus(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetProposerByRollapp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetProposerByRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := client.GetProposerByRollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetProposerByRollapp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetProposerByRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := server.GetProposerByRollapp(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetNextProposerByRollapp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNextProposerByRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := client.GetNextProposerByRollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetNextProposerByRollapp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNextProposerByRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := server.GetNextProposerByRollapp(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Sequencer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Sequencer_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Sequencer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Sequencers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Sequencers_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Sequencers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SequencersByRollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SequencersByRollapp_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SequencersByRollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SequencersByRollappByStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SequencersByRollappByStatus_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SequencersByRollappByStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetProposerByRollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetProposerByRollapp_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetProposerByRollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetNextProposerByRollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetNextProposerByRollapp_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetNextProposerByRollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Sequencer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Sequencer_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Sequencer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Sequencers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Sequencers_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Sequencers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SequencersByRollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SequencersByRollapp_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SequencersByRollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SequencersByRollappByStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SequencersByRollappByStatus_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SequencersByRollappByStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetProposerByRollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetProposerByRollapp_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetProposerByRollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetNextProposerByRollapp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetNextProposerByRollapp_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetNextProposerByRollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension", "sequencer", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Sequencer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dymensionxyz", "dymension", "sequencer", "sequencerAddress"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Sequencers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2}, []string{"dymensionxyz", "dymension", "sequencer"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SequencersByRollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "sequencer", "sequencers_by_rollapp", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SequencersByRollappByStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"dymensionxyz", "dymension", "sequencer", "sequencers_by_rollapp", "rollappId", "status"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetProposerByRollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "sequencer", "proposer", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetNextProposerByRollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "sequencer", "next_proposer", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Sequencer_0 = runtime.ForwardResponseMessage + + forward_Query_Sequencers_0 = runtime.ForwardResponseMessage + + forward_Query_SequencersByRollapp_0 = runtime.ForwardResponseMessage + + forward_Query_SequencersByRollappByStatus_0 = runtime.ForwardResponseMessage + + forward_Query_GetProposerByRollapp_0 = runtime.ForwardResponseMessage + + forward_Query_GetNextProposerByRollapp_0 = runtime.ForwardResponseMessage +) diff --git a/third_party/dymension/sequencer/types/sequencer.pb.go b/third_party/dymension/sequencer/types/sequencer.pb.go new file mode 100644 index 000000000..f4a55aedc --- /dev/null +++ b/third_party/dymension/sequencer/types/sequencer.pb.go @@ -0,0 +1,1087 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/sequencer.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Sequencer defines a sequencer identified by its' address (sequencerAddress). +// The sequencer could be attached to only one rollapp (rollappId). +type Sequencer struct { + // address is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // pubkey is the public key of the sequencers' dymint client, as a Protobuf Any. + DymintPubKey *types.Any `protobuf:"bytes,2,opt,name=dymintPubKey,proto3" json:"dymintPubKey,omitempty"` + // rollappId defines the rollapp to which the sequencer belongs. + RollappId string `protobuf:"bytes,3,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // metadata defines the extra information for the sequencer. + Metadata SequencerMetadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata"` + // jailed defined whether the sequencer has been jailed from bonded status or not. + Jailed bool `protobuf:"varint,5,opt,name=jailed,proto3" json:"jailed,omitempty"` + // status is the sequencer status (bonded/unbonding/unbonded). + Status OperatingStatus `protobuf:"varint,7,opt,name=status,proto3,enum=dymensionxyz.dymension.sequencer.OperatingStatus" json:"status,omitempty"` + // tokens define the delegated tokens (incl. self-delegation). + Tokens github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,8,rep,name=tokens,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tokens"` + // unbond_request_height stores the height at which this sequencer has + // requested to unbond. + UnbondRequestHeight int64 `protobuf:"varint,9,opt,name=unbond_request_height,json=unbondRequestHeight,proto3" json:"unbond_request_height,omitempty"` + // unbond_time defines, if unbonding, the min time for the sequencer to + // complete unbonding. + UnbondTime time.Time `protobuf:"bytes,10,opt,name=unbond_time,json=unbondTime,proto3,stdtime" json:"unbond_time"` + // notice_period_time defines the time when the sequencer will finish it's notice period if started + NoticePeriodTime time.Time `protobuf:"bytes,11,opt,name=notice_period_time,json=noticePeriodTime,proto3,stdtime" json:"notice_period_time"` +} + +func (m *Sequencer) Reset() { *m = Sequencer{} } +func (m *Sequencer) String() string { return proto.CompactTextString(m) } +func (*Sequencer) ProtoMessage() {} +func (*Sequencer) Descriptor() ([]byte, []int) { + return fileDescriptor_17d99b644bf09274, []int{0} +} +func (m *Sequencer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sequencer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sequencer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Sequencer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sequencer.Merge(m, src) +} +func (m *Sequencer) XXX_Size() int { + return m.Size() +} +func (m *Sequencer) XXX_DiscardUnknown() { + xxx_messageInfo_Sequencer.DiscardUnknown(m) +} + +var xxx_messageInfo_Sequencer proto.InternalMessageInfo + +func (m *Sequencer) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Sequencer) GetDymintPubKey() *types.Any { + if m != nil { + return m.DymintPubKey + } + return nil +} + +func (m *Sequencer) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *Sequencer) GetMetadata() SequencerMetadata { + if m != nil { + return m.Metadata + } + return SequencerMetadata{} +} + +func (m *Sequencer) GetJailed() bool { + if m != nil { + return m.Jailed + } + return false +} + +func (m *Sequencer) GetStatus() OperatingStatus { + if m != nil { + return m.Status + } + return Unbonded +} + +func (m *Sequencer) GetTokens() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Tokens + } + return nil +} + +func (m *Sequencer) GetUnbondRequestHeight() int64 { + if m != nil { + return m.UnbondRequestHeight + } + return 0 +} + +func (m *Sequencer) GetUnbondTime() time.Time { + if m != nil { + return m.UnbondTime + } + return time.Time{} +} + +func (m *Sequencer) GetNoticePeriodTime() time.Time { + if m != nil { + return m.NoticePeriodTime + } + return time.Time{} +} + +// BondReduction defines an object which holds the information about the sequencer and its queued unbonding amount +type BondReduction struct { + // sequencer_address is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + SequencerAddress string `protobuf:"bytes,1,opt,name=sequencer_address,json=sequencerAddress,proto3" json:"sequencer_address,omitempty"` + // decrease_bond_amount is the amount of tokens to be unbonded. + DecreaseBondAmount types1.Coin `protobuf:"bytes,2,opt,name=decrease_bond_amount,json=decreaseBondAmount,proto3" json:"decrease_bond_amount"` + // decrease_bond_time defines, if unbonding, the min time for the sequencer to complete unbonding. + DecreaseBondTime time.Time `protobuf:"bytes,3,opt,name=decrease_bond_time,json=decreaseBondTime,proto3,stdtime" json:"decrease_bond_time"` +} + +func (m *BondReduction) Reset() { *m = BondReduction{} } +func (m *BondReduction) String() string { return proto.CompactTextString(m) } +func (*BondReduction) ProtoMessage() {} +func (*BondReduction) Descriptor() ([]byte, []int) { + return fileDescriptor_17d99b644bf09274, []int{1} +} +func (m *BondReduction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BondReduction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BondReduction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BondReduction) XXX_Merge(src proto.Message) { + xxx_messageInfo_BondReduction.Merge(m, src) +} +func (m *BondReduction) XXX_Size() int { + return m.Size() +} +func (m *BondReduction) XXX_DiscardUnknown() { + xxx_messageInfo_BondReduction.DiscardUnknown(m) +} + +var xxx_messageInfo_BondReduction proto.InternalMessageInfo + +func (m *BondReduction) GetSequencerAddress() string { + if m != nil { + return m.SequencerAddress + } + return "" +} + +func (m *BondReduction) GetDecreaseBondAmount() types1.Coin { + if m != nil { + return m.DecreaseBondAmount + } + return types1.Coin{} +} + +func (m *BondReduction) GetDecreaseBondTime() time.Time { + if m != nil { + return m.DecreaseBondTime + } + return time.Time{} +} + +func init() { + proto.RegisterType((*Sequencer)(nil), "dymensionxyz.dymension.sequencer.Sequencer") + proto.RegisterType((*BondReduction)(nil), "dymensionxyz.dymension.sequencer.BondReduction") +} + +func init() { + proto.RegisterFile("dymension/sequencer/sequencer.proto", fileDescriptor_17d99b644bf09274) +} + +var fileDescriptor_17d99b644bf09274 = []byte{ + // 635 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xc1, 0x6e, 0xd3, 0x4a, + 0x14, 0x8d, 0x5f, 0xda, 0x34, 0x99, 0x3c, 0x50, 0x19, 0x02, 0xb8, 0x15, 0x72, 0xac, 0xb2, 0xb1, + 0x40, 0x1d, 0x93, 0x54, 0x62, 0xdf, 0x20, 0x24, 0x0a, 0x42, 0x14, 0x17, 0x36, 0x6c, 0xac, 0xb1, + 0x3d, 0xb8, 0xa6, 0xf1, 0x8c, 0xf1, 0x8c, 0xab, 0x9a, 0x5f, 0x60, 0xd3, 0xef, 0x60, 0xcd, 0x47, + 0x54, 0xac, 0xba, 0x64, 0x45, 0x51, 0xf3, 0x23, 0xc8, 0x33, 0x63, 0x37, 0x81, 0x8a, 0xaa, 0x2b, + 0xfb, 0xfa, 0x9e, 0x73, 0xe6, 0x9e, 0x3b, 0xc7, 0xe0, 0x41, 0x54, 0xa6, 0x84, 0xf2, 0x84, 0x51, + 0x97, 0x93, 0x4f, 0x05, 0xa1, 0x21, 0xc9, 0x2f, 0xde, 0x50, 0x96, 0x33, 0xc1, 0xa0, 0xdd, 0x80, + 0x8e, 0xca, 0xcf, 0xa8, 0x29, 0x50, 0x83, 0x5b, 0x5f, 0x0b, 0x19, 0x4f, 0x19, 0xf7, 0x25, 0xde, + 0x55, 0x85, 0x22, 0xaf, 0xaf, 0xc5, 0x8c, 0xc5, 0x53, 0xe2, 0xca, 0x2a, 0x28, 0x3e, 0xb8, 0x98, + 0x96, 0xba, 0x35, 0x88, 0x59, 0xcc, 0x14, 0xa5, 0x7a, 0xd3, 0x5f, 0x87, 0x7f, 0x12, 0x44, 0x92, + 0x12, 0x2e, 0x70, 0x9a, 0x69, 0x80, 0xa5, 0xf4, 0xdd, 0x00, 0x73, 0xe2, 0x1e, 0x8e, 0x02, 0x22, + 0xf0, 0xc8, 0x0d, 0x59, 0x42, 0x75, 0xff, 0x9e, 0xee, 0xa7, 0x3c, 0x76, 0x0f, 0x47, 0xd5, 0x43, + 0x37, 0x36, 0x2e, 0x33, 0x9b, 0x12, 0x81, 0x23, 0x2c, 0xb0, 0xc6, 0x3c, 0xbc, 0x0c, 0xc3, 0x32, + 0x92, 0x63, 0x91, 0xd0, 0xd8, 0xe7, 0x02, 0x8b, 0x42, 0x5b, 0xdb, 0xf8, 0xb2, 0x0c, 0x7a, 0x7b, + 0x35, 0x08, 0x9a, 0x60, 0x05, 0x47, 0x51, 0x4e, 0x38, 0x37, 0x0d, 0xdb, 0x70, 0x7a, 0x5e, 0x5d, + 0x42, 0x0f, 0xfc, 0x1f, 0x95, 0x69, 0x42, 0xc5, 0x6e, 0x11, 0xbc, 0x24, 0xa5, 0xf9, 0x9f, 0x6d, + 0x38, 0xfd, 0xf1, 0x00, 0x29, 0xa3, 0xa8, 0x36, 0x8a, 0xb6, 0x69, 0x39, 0x31, 0xbf, 0x7f, 0xdb, + 0x1c, 0xe8, 0x05, 0x86, 0x79, 0x99, 0x09, 0x86, 0x14, 0xcb, 0x5b, 0xd0, 0x80, 0xf7, 0x41, 0x2f, + 0x67, 0xd3, 0x29, 0xce, 0xb2, 0x9d, 0xc8, 0x6c, 0xcb, 0xf3, 0x2e, 0x3e, 0xc0, 0x77, 0xa0, 0x5b, + 0xfb, 0x32, 0x97, 0xe4, 0x69, 0x5b, 0xe8, 0xaa, 0x4b, 0x44, 0x8d, 0x95, 0x57, 0x9a, 0x3a, 0x59, + 0x3a, 0xf9, 0x39, 0x6c, 0x79, 0x8d, 0x14, 0xbc, 0x0b, 0x3a, 0x1f, 0x71, 0x32, 0x25, 0x91, 0xb9, + 0x6c, 0x1b, 0x4e, 0xd7, 0xd3, 0x15, 0xdc, 0x01, 0x1d, 0xb5, 0x18, 0x73, 0xc5, 0x36, 0x9c, 0x9b, + 0xe3, 0xd1, 0xd5, 0x87, 0xbd, 0xae, 0x57, 0xba, 0x27, 0x89, 0x9e, 0x16, 0x80, 0x21, 0xe8, 0x08, + 0x76, 0x40, 0x28, 0x37, 0xbb, 0x76, 0xdb, 0xe9, 0x8f, 0xd7, 0x90, 0x5e, 0x46, 0x75, 0xdb, 0x48, + 0xdf, 0x36, 0x7a, 0xca, 0x12, 0x3a, 0x79, 0x5c, 0x4d, 0xf7, 0xf5, 0x6c, 0xe8, 0xc4, 0x89, 0xd8, + 0x2f, 0x02, 0x14, 0xb2, 0x54, 0x47, 0x4f, 0x3f, 0x36, 0x79, 0x74, 0xe0, 0x8a, 0x32, 0x23, 0x5c, + 0x12, 0xb8, 0xa7, 0xa5, 0xe1, 0x18, 0xdc, 0x29, 0x68, 0xc0, 0x68, 0xe4, 0xe7, 0xd5, 0x40, 0x5c, + 0xf8, 0xfb, 0x24, 0x89, 0xf7, 0x85, 0xd9, 0xb3, 0x0d, 0xa7, 0xed, 0xdd, 0x56, 0x4d, 0x4f, 0xf5, + 0x9e, 0xcb, 0x16, 0x7c, 0x06, 0xfa, 0x9a, 0x53, 0xe5, 0xd1, 0x04, 0x72, 0xab, 0xeb, 0x7f, 0xdd, + 0xe1, 0xdb, 0x3a, 0xac, 0x93, 0x6e, 0x35, 0xde, 0xf1, 0xd9, 0xd0, 0xf0, 0x80, 0x22, 0x56, 0x2d, + 0xe8, 0x01, 0x48, 0x99, 0x48, 0x42, 0xe2, 0x67, 0x24, 0x4f, 0x98, 0x56, 0xeb, 0x5f, 0x43, 0x6d, + 0x55, 0xf1, 0x77, 0x25, 0xbd, 0x02, 0xbc, 0x58, 0xea, 0x76, 0x56, 0x57, 0x36, 0x66, 0x06, 0xb8, + 0x31, 0x91, 0x63, 0x47, 0x45, 0x28, 0x12, 0x46, 0xe1, 0x23, 0x70, 0xab, 0x59, 0xb8, 0xbf, 0x98, + 0xcd, 0xd5, 0xa6, 0xb1, 0xad, 0x43, 0xfa, 0x06, 0x0c, 0x22, 0x12, 0xe6, 0x04, 0x73, 0xe2, 0x4b, + 0x9b, 0x38, 0x65, 0x05, 0x15, 0x3a, 0xac, 0xff, 0xb8, 0x06, 0x15, 0x12, 0x58, 0x93, 0xab, 0x11, + 0xb6, 0x25, 0xb5, 0xf2, 0xba, 0x28, 0x29, 0xbd, 0xb6, 0xaf, 0xe3, 0x75, 0x5e, 0xb5, 0x02, 0x4c, + 0x76, 0x4f, 0xce, 0x2d, 0xe3, 0xf4, 0xdc, 0x32, 0x7e, 0x9d, 0x5b, 0xc6, 0xf1, 0xcc, 0x6a, 0x9d, + 0xce, 0xac, 0xd6, 0x8f, 0x99, 0xd5, 0x7a, 0xff, 0x64, 0x2e, 0x06, 0xf3, 0xf1, 0xbb, 0x28, 0xdc, + 0xc3, 0x2d, 0xf7, 0x68, 0xee, 0xb7, 0x96, 0xd1, 0x08, 0x3a, 0x72, 0x82, 0xad, 0xdf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xdd, 0x3f, 0x85, 0xd1, 0x0b, 0x05, 0x00, 0x00, +} + +func (m *Sequencer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Sequencer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sequencer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.NoticePeriodTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.NoticePeriodTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintSequencer(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x5a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintSequencer(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x52 + if m.UnbondRequestHeight != 0 { + i = encodeVarintSequencer(dAtA, i, uint64(m.UnbondRequestHeight)) + i-- + dAtA[i] = 0x48 + } + if len(m.Tokens) > 0 { + for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSequencer(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.Status != 0 { + i = encodeVarintSequencer(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x38 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSequencer(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintSequencer(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x1a + } + if m.DymintPubKey != nil { + { + size, err := m.DymintPubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSequencer(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintSequencer(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BondReduction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BondReduction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BondReduction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DecreaseBondTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DecreaseBondTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintSequencer(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x1a + { + size, err := m.DecreaseBondAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSequencer(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.SequencerAddress) > 0 { + i -= len(m.SequencerAddress) + copy(dAtA[i:], m.SequencerAddress) + i = encodeVarintSequencer(dAtA, i, uint64(len(m.SequencerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSequencer(dAtA []byte, offset int, v uint64) int { + offset -= sovSequencer(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Sequencer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovSequencer(uint64(l)) + } + if m.DymintPubKey != nil { + l = m.DymintPubKey.Size() + n += 1 + l + sovSequencer(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovSequencer(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovSequencer(uint64(l)) + if m.Jailed { + n += 2 + } + if m.Status != 0 { + n += 1 + sovSequencer(uint64(m.Status)) + } + if len(m.Tokens) > 0 { + for _, e := range m.Tokens { + l = e.Size() + n += 1 + l + sovSequencer(uint64(l)) + } + } + if m.UnbondRequestHeight != 0 { + n += 1 + sovSequencer(uint64(m.UnbondRequestHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondTime) + n += 1 + l + sovSequencer(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.NoticePeriodTime) + n += 1 + l + sovSequencer(uint64(l)) + return n +} + +func (m *BondReduction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SequencerAddress) + if l > 0 { + n += 1 + l + sovSequencer(uint64(l)) + } + l = m.DecreaseBondAmount.Size() + n += 1 + l + sovSequencer(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DecreaseBondTime) + n += 1 + l + sovSequencer(uint64(l)) + return n +} + +func sovSequencer(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSequencer(x uint64) (n int) { + return sovSequencer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Sequencer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Sequencer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sequencer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DymintPubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DymintPubKey == nil { + m.DymintPubKey = &types.Any{} + } + if err := m.DymintPubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= OperatingStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tokens = append(m.Tokens, types1.Coin{}) + if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondRequestHeight", wireType) + } + m.UnbondRequestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondRequestHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoticePeriodTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.NoticePeriodTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSequencer(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSequencer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BondReduction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BondReduction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BondReduction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequencerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequencerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DecreaseBondAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DecreaseBondAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DecreaseBondTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DecreaseBondTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSequencer(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSequencer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSequencer(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSequencer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSequencer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSequencer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSequencer + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSequencer + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSequencer + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSequencer = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSequencer = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSequencer = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third_party/dymension/sequencer/types/tx.pb.go b/third_party/dymension/sequencer/types/tx.pb.go new file mode 100644 index 000000000..599478313 --- /dev/null +++ b/third_party/dymension/sequencer/types/tx.pb.go @@ -0,0 +1,2569 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dymension/sequencer/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgCreateSequencer struct { + // creator is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // pubkey is the public key of the sequencers' dymint client, as a Protobuf Any. + DymintPubKey *types.Any `protobuf:"bytes,2,opt,name=dymintPubKey,proto3" json:"dymintPubKey,omitempty"` + // rollapp_id defines the rollapp to which the sequencer belongs. + RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // metadata defines the extra information for the sequencer. + Metadata SequencerMetadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata"` + // entry bond for the sequencer. + Bond types1.Coin `protobuf:"bytes,5,opt,name=bond,proto3" json:"bond"` +} + +func (m *MsgCreateSequencer) Reset() { *m = MsgCreateSequencer{} } +func (m *MsgCreateSequencer) String() string { return proto.CompactTextString(m) } +func (*MsgCreateSequencer) ProtoMessage() {} +func (*MsgCreateSequencer) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{0} +} +func (m *MsgCreateSequencer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateSequencer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateSequencer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateSequencer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateSequencer.Merge(m, src) +} +func (m *MsgCreateSequencer) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateSequencer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateSequencer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateSequencer proto.InternalMessageInfo + +func (m *MsgCreateSequencer) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateSequencer) GetDymintPubKey() *types.Any { + if m != nil { + return m.DymintPubKey + } + return nil +} + +func (m *MsgCreateSequencer) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgCreateSequencer) GetMetadata() SequencerMetadata { + if m != nil { + return m.Metadata + } + return SequencerMetadata{} +} + +func (m *MsgCreateSequencer) GetBond() types1.Coin { + if m != nil { + return m.Bond + } + return types1.Coin{} +} + +type MsgCreateSequencerResponse struct { +} + +func (m *MsgCreateSequencerResponse) Reset() { *m = MsgCreateSequencerResponse{} } +func (m *MsgCreateSequencerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateSequencerResponse) ProtoMessage() {} +func (*MsgCreateSequencerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{1} +} +func (m *MsgCreateSequencerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateSequencerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateSequencerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateSequencerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateSequencerResponse.Merge(m, src) +} +func (m *MsgCreateSequencerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateSequencerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateSequencerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateSequencerResponse proto.InternalMessageInfo + +type MsgUpdateSequencerInformation struct { + // creator is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollapp_id defines the rollapp to which the sequencer belongs. + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // metadata defines the extra information for the sequencer. + Metadata SequencerMetadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata"` +} + +func (m *MsgUpdateSequencerInformation) Reset() { *m = MsgUpdateSequencerInformation{} } +func (m *MsgUpdateSequencerInformation) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSequencerInformation) ProtoMessage() {} +func (*MsgUpdateSequencerInformation) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{2} +} +func (m *MsgUpdateSequencerInformation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSequencerInformation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSequencerInformation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateSequencerInformation) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSequencerInformation.Merge(m, src) +} +func (m *MsgUpdateSequencerInformation) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSequencerInformation) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSequencerInformation.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSequencerInformation proto.InternalMessageInfo + +func (m *MsgUpdateSequencerInformation) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateSequencerInformation) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgUpdateSequencerInformation) GetMetadata() SequencerMetadata { + if m != nil { + return m.Metadata + } + return SequencerMetadata{} +} + +type MsgUpdateSequencerInformationResponse struct { +} + +func (m *MsgUpdateSequencerInformationResponse) Reset() { *m = MsgUpdateSequencerInformationResponse{} } +func (m *MsgUpdateSequencerInformationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSequencerInformationResponse) ProtoMessage() {} +func (*MsgUpdateSequencerInformationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{3} +} +func (m *MsgUpdateSequencerInformationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSequencerInformationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSequencerInformationResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateSequencerInformationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSequencerInformationResponse.Merge(m, src) +} +func (m *MsgUpdateSequencerInformationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSequencerInformationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSequencerInformationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSequencerInformationResponse proto.InternalMessageInfo + +// MsgUnbond defines a SDK message for performing an undelegation from a +// bond and a sequencer. +type MsgUnbond struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgUnbond) Reset() { *m = MsgUnbond{} } +func (m *MsgUnbond) String() string { return proto.CompactTextString(m) } +func (*MsgUnbond) ProtoMessage() {} +func (*MsgUnbond) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{4} +} +func (m *MsgUnbond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnbond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnbond.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnbond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnbond.Merge(m, src) +} +func (m *MsgUnbond) XXX_Size() int { + return m.Size() +} +func (m *MsgUnbond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnbond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnbond proto.InternalMessageInfo + +func (m *MsgUnbond) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +// MsgUnbondResponse defines the Msg/Unbond response type. +type MsgUnbondResponse struct { + // completion_time defines the time at which the unbonding will be completed. + // If unbonding the proposer, the completion time is the time at which the notice period will be completed. + // + // Types that are valid to be assigned to CompletionTime: + // *MsgUnbondResponse_UnbondingCompletionTime + // *MsgUnbondResponse_NoticePeriodCompletionTime + CompletionTime isMsgUnbondResponse_CompletionTime `protobuf_oneof:"completion_time"` +} + +func (m *MsgUnbondResponse) Reset() { *m = MsgUnbondResponse{} } +func (m *MsgUnbondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnbondResponse) ProtoMessage() {} +func (*MsgUnbondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{5} +} +func (m *MsgUnbondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnbondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnbondResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnbondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnbondResponse.Merge(m, src) +} +func (m *MsgUnbondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnbondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnbondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnbondResponse proto.InternalMessageInfo + +type isMsgUnbondResponse_CompletionTime interface { + isMsgUnbondResponse_CompletionTime() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUnbondResponse_UnbondingCompletionTime struct { + UnbondingCompletionTime *time.Time `protobuf:"bytes,1,opt,name=unbonding_completion_time,json=unbondingCompletionTime,proto3,oneof,stdtime" json:"unbonding_completion_time,omitempty"` +} +type MsgUnbondResponse_NoticePeriodCompletionTime struct { + NoticePeriodCompletionTime *time.Time `protobuf:"bytes,2,opt,name=notice_period_completion_time,json=noticePeriodCompletionTime,proto3,oneof,stdtime" json:"notice_period_completion_time,omitempty"` +} + +func (*MsgUnbondResponse_UnbondingCompletionTime) isMsgUnbondResponse_CompletionTime() {} +func (*MsgUnbondResponse_NoticePeriodCompletionTime) isMsgUnbondResponse_CompletionTime() {} + +func (m *MsgUnbondResponse) GetCompletionTime() isMsgUnbondResponse_CompletionTime { + if m != nil { + return m.CompletionTime + } + return nil +} + +func (m *MsgUnbondResponse) GetUnbondingCompletionTime() *time.Time { + if x, ok := m.GetCompletionTime().(*MsgUnbondResponse_UnbondingCompletionTime); ok { + return x.UnbondingCompletionTime + } + return nil +} + +func (m *MsgUnbondResponse) GetNoticePeriodCompletionTime() *time.Time { + if x, ok := m.GetCompletionTime().(*MsgUnbondResponse_NoticePeriodCompletionTime); ok { + return x.NoticePeriodCompletionTime + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUnbondResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUnbondResponse_UnbondingCompletionTime)(nil), + (*MsgUnbondResponse_NoticePeriodCompletionTime)(nil), + } +} + +// MsgIncreaseBond defines a SDK message for increasing the bond amount of a sequencer. +type MsgIncreaseBond struct { + // creator is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // add_amount is the amount of coins to be added to the sequencer's bond. + AddAmount types1.Coin `protobuf:"bytes,2,opt,name=add_amount,json=addAmount,proto3" json:"add_amount"` +} + +func (m *MsgIncreaseBond) Reset() { *m = MsgIncreaseBond{} } +func (m *MsgIncreaseBond) String() string { return proto.CompactTextString(m) } +func (*MsgIncreaseBond) ProtoMessage() {} +func (*MsgIncreaseBond) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{6} +} +func (m *MsgIncreaseBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIncreaseBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIncreaseBond.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgIncreaseBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIncreaseBond.Merge(m, src) +} +func (m *MsgIncreaseBond) XXX_Size() int { + return m.Size() +} +func (m *MsgIncreaseBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIncreaseBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIncreaseBond proto.InternalMessageInfo + +func (m *MsgIncreaseBond) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgIncreaseBond) GetAddAmount() types1.Coin { + if m != nil { + return m.AddAmount + } + return types1.Coin{} +} + +// MsgIncreaseBondResponse defines the Msg/IncreaseBond response type. +type MsgIncreaseBondResponse struct { +} + +func (m *MsgIncreaseBondResponse) Reset() { *m = MsgIncreaseBondResponse{} } +func (m *MsgIncreaseBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgIncreaseBondResponse) ProtoMessage() {} +func (*MsgIncreaseBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{7} +} +func (m *MsgIncreaseBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIncreaseBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIncreaseBondResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgIncreaseBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIncreaseBondResponse.Merge(m, src) +} +func (m *MsgIncreaseBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgIncreaseBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIncreaseBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIncreaseBondResponse proto.InternalMessageInfo + +// MsgDecreaseBond defines a SDK message for decreasing the bond of a sequencer. +type MsgDecreaseBond struct { + // creator is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // decrease_amount is the amount of coins to decrease the bond by. + DecreaseAmount types1.Coin `protobuf:"bytes,2,opt,name=decrease_amount,json=decreaseAmount,proto3" json:"decrease_amount"` +} + +func (m *MsgDecreaseBond) Reset() { *m = MsgDecreaseBond{} } +func (m *MsgDecreaseBond) String() string { return proto.CompactTextString(m) } +func (*MsgDecreaseBond) ProtoMessage() {} +func (*MsgDecreaseBond) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{8} +} +func (m *MsgDecreaseBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDecreaseBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDecreaseBond.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDecreaseBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDecreaseBond.Merge(m, src) +} +func (m *MsgDecreaseBond) XXX_Size() int { + return m.Size() +} +func (m *MsgDecreaseBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDecreaseBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDecreaseBond proto.InternalMessageInfo + +func (m *MsgDecreaseBond) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgDecreaseBond) GetDecreaseAmount() types1.Coin { + if m != nil { + return m.DecreaseAmount + } + return types1.Coin{} +} + +// MsgDecreaseBondResponse defines the Msg/DecreaseBond response type. +type MsgDecreaseBondResponse struct { + CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` +} + +func (m *MsgDecreaseBondResponse) Reset() { *m = MsgDecreaseBondResponse{} } +func (m *MsgDecreaseBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDecreaseBondResponse) ProtoMessage() {} +func (*MsgDecreaseBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_26d679aa996065f1, []int{9} +} +func (m *MsgDecreaseBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDecreaseBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDecreaseBondResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDecreaseBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDecreaseBondResponse.Merge(m, src) +} +func (m *MsgDecreaseBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDecreaseBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDecreaseBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDecreaseBondResponse proto.InternalMessageInfo + +func (m *MsgDecreaseBondResponse) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +func init() { + proto.RegisterType((*MsgCreateSequencer)(nil), "dymensionxyz.dymension.sequencer.MsgCreateSequencer") + proto.RegisterType((*MsgCreateSequencerResponse)(nil), "dymensionxyz.dymension.sequencer.MsgCreateSequencerResponse") + proto.RegisterType((*MsgUpdateSequencerInformation)(nil), "dymensionxyz.dymension.sequencer.MsgUpdateSequencerInformation") + proto.RegisterType((*MsgUpdateSequencerInformationResponse)(nil), "dymensionxyz.dymension.sequencer.MsgUpdateSequencerInformationResponse") + proto.RegisterType((*MsgUnbond)(nil), "dymensionxyz.dymension.sequencer.MsgUnbond") + proto.RegisterType((*MsgUnbondResponse)(nil), "dymensionxyz.dymension.sequencer.MsgUnbondResponse") + proto.RegisterType((*MsgIncreaseBond)(nil), "dymensionxyz.dymension.sequencer.MsgIncreaseBond") + proto.RegisterType((*MsgIncreaseBondResponse)(nil), "dymensionxyz.dymension.sequencer.MsgIncreaseBondResponse") + proto.RegisterType((*MsgDecreaseBond)(nil), "dymensionxyz.dymension.sequencer.MsgDecreaseBond") + proto.RegisterType((*MsgDecreaseBondResponse)(nil), "dymensionxyz.dymension.sequencer.MsgDecreaseBondResponse") +} + +func init() { proto.RegisterFile("dymension/sequencer/tx.proto", fileDescriptor_26d679aa996065f1) } + +var fileDescriptor_26d679aa996065f1 = []byte{ + // 784 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6b, 0x13, 0x4d, + 0x18, 0xce, 0xa6, 0x69, 0xbf, 0x66, 0x5a, 0x9a, 0xaf, 0x4b, 0xa1, 0x9b, 0xa5, 0x4d, 0x4a, 0x40, + 0x2c, 0x8a, 0xbb, 0x24, 0x11, 0xc1, 0x22, 0x4a, 0x53, 0xc1, 0x16, 0x09, 0xd4, 0xd4, 0x5e, 0x3c, + 0x18, 0x36, 0x3b, 0xd3, 0xed, 0x4a, 0x76, 0x66, 0xdd, 0x99, 0x94, 0xae, 0x78, 0x12, 0xbc, 0x17, + 0x3c, 0x2b, 0x9e, 0x3c, 0x7b, 0xf0, 0x26, 0xde, 0x8b, 0xa7, 0xe2, 0xc9, 0x93, 0x4a, 0x7b, 0xd0, + 0x8b, 0xff, 0x83, 0xec, 0xee, 0xec, 0x34, 0x3f, 0x6a, 0xba, 0x6d, 0x3d, 0x25, 0x33, 0xf3, 0xbe, + 0xcf, 0xf3, 0xbc, 0xcf, 0xbc, 0xef, 0xb0, 0x60, 0x0e, 0xfa, 0x0e, 0xc2, 0xd4, 0x26, 0x58, 0xa7, + 0xe8, 0x69, 0x07, 0x61, 0x13, 0x79, 0x3a, 0xdb, 0xd5, 0x5c, 0x8f, 0x30, 0x22, 0x2f, 0x88, 0xd3, + 0x5d, 0xff, 0x99, 0x26, 0x16, 0x9a, 0x08, 0x55, 0xf3, 0x16, 0x21, 0x56, 0x1b, 0xe9, 0x61, 0x7c, + 0xab, 0xb3, 0xa5, 0x1b, 0xd8, 0x8f, 0x92, 0xd5, 0xbc, 0x49, 0xa8, 0x43, 0x68, 0x33, 0x5c, 0xe9, + 0xd1, 0x82, 0x1f, 0xcd, 0x58, 0xc4, 0x22, 0xd1, 0x7e, 0xf0, 0x8f, 0xef, 0x16, 0xa2, 0x18, 0xbd, + 0x65, 0x50, 0xa4, 0xef, 0x94, 0x5b, 0x88, 0x19, 0x65, 0xdd, 0x24, 0x36, 0xe6, 0xe7, 0xc5, 0x7e, + 0x2e, 0x66, 0x3b, 0x88, 0x32, 0xc3, 0x71, 0x79, 0xc0, 0x2c, 0x07, 0x70, 0xa8, 0xa5, 0xef, 0x94, + 0x83, 0x1f, 0x7e, 0x50, 0x3a, 0xa9, 0x4a, 0x07, 0x31, 0x03, 0x1a, 0xcc, 0x88, 0x62, 0x4a, 0x1f, + 0xd3, 0x40, 0xae, 0x53, 0x6b, 0xc5, 0x43, 0x06, 0x43, 0x1b, 0x71, 0x94, 0xac, 0x80, 0xff, 0xcc, + 0x60, 0x8b, 0x78, 0x8a, 0xb4, 0x20, 0x2d, 0x66, 0x1b, 0xf1, 0x52, 0x6e, 0x80, 0x49, 0xe8, 0x3b, + 0x36, 0x66, 0xeb, 0x9d, 0xd6, 0x7d, 0xe4, 0x2b, 0xe9, 0x05, 0x69, 0x71, 0xa2, 0x32, 0xa3, 0x45, + 0x2a, 0xb5, 0x58, 0xa5, 0xb6, 0x8c, 0xfd, 0x9a, 0xf2, 0xf9, 0xc3, 0xb5, 0x19, 0x6e, 0x81, 0xe9, + 0xf9, 0x2e, 0x23, 0x5a, 0x94, 0xd5, 0xe8, 0xc1, 0x90, 0xe7, 0x01, 0xf0, 0x48, 0xbb, 0x6d, 0xb8, + 0x6e, 0xd3, 0x86, 0xca, 0x48, 0x48, 0x98, 0xe5, 0x3b, 0x6b, 0x50, 0xde, 0x04, 0xe3, 0xb1, 0x6a, + 0x25, 0x13, 0xd2, 0x55, 0xb5, 0xd3, 0xae, 0x48, 0x13, 0xb5, 0xd4, 0x79, 0x6a, 0x2d, 0xb3, 0xff, + 0xad, 0x98, 0x6a, 0x08, 0x28, 0xb9, 0x0a, 0x32, 0x2d, 0x82, 0xa1, 0x32, 0x1a, 0x42, 0xe6, 0x35, + 0x2e, 0x34, 0xb8, 0x07, 0x8d, 0xdf, 0x83, 0xb6, 0x42, 0x6c, 0xcc, 0x13, 0xc3, 0xe0, 0xa5, 0xc9, + 0x17, 0x3f, 0xdf, 0x5f, 0x89, 0xcd, 0x28, 0xcd, 0x01, 0x75, 0xd0, 0xbc, 0x06, 0xa2, 0x2e, 0xc1, + 0x14, 0x95, 0x3e, 0x49, 0x60, 0xbe, 0x4e, 0xad, 0x4d, 0x17, 0x76, 0x1f, 0xaf, 0xe1, 0x2d, 0xe2, + 0x39, 0x06, 0xb3, 0x09, 0x1e, 0x62, 0x73, 0xaf, 0x25, 0xe9, 0x61, 0x96, 0x8c, 0xfc, 0x33, 0x4b, + 0xfa, 0xaa, 0xbb, 0x0c, 0x2e, 0x0d, 0x95, 0x2f, 0x0a, 0x7d, 0x00, 0xb2, 0x41, 0x20, 0x0e, 0x1c, + 0x92, 0x2b, 0x7d, 0x35, 0xd5, 0x94, 0x2f, 0xc7, 0x5d, 0xb0, 0x0c, 0xa1, 0x87, 0x28, 0xdd, 0x60, + 0x9e, 0x8d, 0x2d, 0x51, 0xed, 0xd2, 0xff, 0xbf, 0xde, 0x16, 0x53, 0x3d, 0xdc, 0xbf, 0x25, 0x30, + 0x2d, 0x30, 0x63, 0x22, 0xf9, 0x31, 0xc8, 0x77, 0xc2, 0x1d, 0x1b, 0x5b, 0x4d, 0x93, 0x38, 0x6e, + 0x1b, 0x05, 0x42, 0x9a, 0xc1, 0x48, 0x84, 0x6c, 0x13, 0x15, 0x75, 0xa0, 0x13, 0x1f, 0xc6, 0xf3, + 0x52, 0xcb, 0xec, 0x7d, 0x2f, 0x4a, 0xab, 0xa9, 0xc6, 0xac, 0x00, 0x59, 0x11, 0x18, 0x41, 0x94, + 0x8c, 0xc0, 0x3c, 0x26, 0xcc, 0x36, 0x51, 0xd3, 0x45, 0x9e, 0x4d, 0xe0, 0x00, 0x47, 0x3a, 0x31, + 0x87, 0x1a, 0x01, 0xad, 0x87, 0x38, 0xbd, 0x34, 0xb5, 0x69, 0x90, 0xeb, 0x03, 0x2e, 0xbd, 0x92, + 0x40, 0xae, 0x4e, 0xad, 0x35, 0x1c, 0x18, 0x40, 0x51, 0xed, 0x9c, 0x4e, 0xca, 0xb7, 0x01, 0x30, + 0x20, 0x6c, 0x1a, 0x0e, 0xe9, 0x60, 0xc6, 0xe5, 0x9e, 0xda, 0xda, 0x59, 0x03, 0xc2, 0xe5, 0x30, + 0xa3, 0xaf, 0x03, 0xf2, 0x60, 0xb6, 0x4f, 0x94, 0xb8, 0xf3, 0xd7, 0x91, 0xe0, 0xbb, 0xe8, 0x82, + 0x82, 0x57, 0x41, 0x0e, 0x72, 0x8c, 0x33, 0xaa, 0x9e, 0x8a, 0xf3, 0x4e, 0x94, 0xbe, 0x1d, 0x4a, + 0xef, 0x96, 0x27, 0xba, 0xa8, 0x3e, 0x60, 0x7f, 0x82, 0xde, 0x19, 0x0f, 0x38, 0x83, 0xbb, 0x6d, + 0x4c, 0x99, 0x3d, 0xb7, 0x59, 0x79, 0x33, 0x0a, 0x46, 0xea, 0xd4, 0x92, 0x5f, 0x4a, 0x20, 0xd7, + 0xff, 0x8e, 0x5e, 0x3f, 0x7d, 0x2a, 0x07, 0x1f, 0x10, 0xf5, 0xd6, 0x79, 0xb2, 0x44, 0x79, 0xef, + 0x24, 0xa0, 0x0e, 0x79, 0x73, 0xee, 0x24, 0x02, 0xff, 0x3b, 0x80, 0x7a, 0xef, 0x82, 0x00, 0x42, + 0xe8, 0x13, 0x30, 0xc6, 0xdf, 0x8c, 0xab, 0xc9, 0x20, 0xc3, 0x60, 0xb5, 0x7a, 0x86, 0x60, 0xc1, + 0xf5, 0x1c, 0x4c, 0xf6, 0xcc, 0x56, 0x39, 0x11, 0x48, 0x77, 0x8a, 0x7a, 0xf3, 0xcc, 0x29, 0xdd, + 0xec, 0x3d, 0x83, 0x92, 0x8c, 0xbd, 0x3b, 0x25, 0x21, 0xfb, 0x49, 0xfd, 0x5e, 0x5b, 0xdf, 0x3f, + 0x2c, 0x48, 0x07, 0x87, 0x05, 0xe9, 0xc7, 0x61, 0x41, 0xda, 0x3b, 0x2a, 0xa4, 0x0e, 0x8e, 0x0a, + 0xa9, 0xaf, 0x47, 0x85, 0xd4, 0xa3, 0x1b, 0x96, 0xcd, 0xb6, 0x3b, 0x2d, 0xcd, 0x24, 0x8e, 0xde, + 0x0d, 0x7f, 0xbc, 0xd0, 0x77, 0xaa, 0xfa, 0x6e, 0xf7, 0x47, 0x92, 0xef, 0x22, 0xda, 0x1a, 0x0b, + 0x07, 0xa4, 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0x14, 0xb6, 0xa0, 0xf9, 0x48, 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateSequencer defines a method for creating a new sequencer. + CreateSequencer(ctx context.Context, in *MsgCreateSequencer, opts ...grpc.CallOption) (*MsgCreateSequencerResponse, error) + // UpdateSequencerInformation defines a method for updating the sequencer's metadata. + UpdateSequencerInformation(ctx context.Context, in *MsgUpdateSequencerInformation, opts ...grpc.CallOption) (*MsgUpdateSequencerInformationResponse, error) + // Unbond defines a method for removing coins from sequencer's bond + Unbond(ctx context.Context, in *MsgUnbond, opts ...grpc.CallOption) (*MsgUnbondResponse, error) + // IncreaseBond defines a method for increasing a sequencer's bond amount + IncreaseBond(ctx context.Context, in *MsgIncreaseBond, opts ...grpc.CallOption) (*MsgIncreaseBondResponse, error) + // DecreaseBond defines a method for decreasing the bond of a sequencer. + DecreaseBond(ctx context.Context, in *MsgDecreaseBond, opts ...grpc.CallOption) (*MsgDecreaseBondResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateSequencer(ctx context.Context, in *MsgCreateSequencer, opts ...grpc.CallOption) (*MsgCreateSequencerResponse, error) { + out := new(MsgCreateSequencerResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Msg/CreateSequencer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateSequencerInformation(ctx context.Context, in *MsgUpdateSequencerInformation, opts ...grpc.CallOption) (*MsgUpdateSequencerInformationResponse, error) { + out := new(MsgUpdateSequencerInformationResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Msg/UpdateSequencerInformation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Unbond(ctx context.Context, in *MsgUnbond, opts ...grpc.CallOption) (*MsgUnbondResponse, error) { + out := new(MsgUnbondResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Msg/Unbond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) IncreaseBond(ctx context.Context, in *MsgIncreaseBond, opts ...grpc.CallOption) (*MsgIncreaseBondResponse, error) { + out := new(MsgIncreaseBondResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Msg/IncreaseBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DecreaseBond(ctx context.Context, in *MsgDecreaseBond, opts ...grpc.CallOption) (*MsgDecreaseBondResponse, error) { + out := new(MsgDecreaseBondResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Msg/DecreaseBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateSequencer defines a method for creating a new sequencer. + CreateSequencer(context.Context, *MsgCreateSequencer) (*MsgCreateSequencerResponse, error) + // UpdateSequencerInformation defines a method for updating the sequencer's metadata. + UpdateSequencerInformation(context.Context, *MsgUpdateSequencerInformation) (*MsgUpdateSequencerInformationResponse, error) + // Unbond defines a method for removing coins from sequencer's bond + Unbond(context.Context, *MsgUnbond) (*MsgUnbondResponse, error) + // IncreaseBond defines a method for increasing a sequencer's bond amount + IncreaseBond(context.Context, *MsgIncreaseBond) (*MsgIncreaseBondResponse, error) + // DecreaseBond defines a method for decreasing the bond of a sequencer. + DecreaseBond(context.Context, *MsgDecreaseBond) (*MsgDecreaseBondResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateSequencer(ctx context.Context, req *MsgCreateSequencer) (*MsgCreateSequencerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSequencer not implemented") +} +func (*UnimplementedMsgServer) UpdateSequencerInformation(ctx context.Context, req *MsgUpdateSequencerInformation) (*MsgUpdateSequencerInformationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSequencerInformation not implemented") +} +func (*UnimplementedMsgServer) Unbond(ctx context.Context, req *MsgUnbond) (*MsgUnbondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Unbond not implemented") +} +func (*UnimplementedMsgServer) IncreaseBond(ctx context.Context, req *MsgIncreaseBond) (*MsgIncreaseBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IncreaseBond not implemented") +} +func (*UnimplementedMsgServer) DecreaseBond(ctx context.Context, req *MsgDecreaseBond) (*MsgDecreaseBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DecreaseBond not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateSequencer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateSequencer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateSequencer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Msg/CreateSequencer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateSequencer(ctx, req.(*MsgCreateSequencer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateSequencerInformation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateSequencerInformation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateSequencerInformation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Msg/UpdateSequencerInformation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateSequencerInformation(ctx, req.(*MsgUpdateSequencerInformation)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Unbond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnbond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Unbond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Msg/Unbond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Unbond(ctx, req.(*MsgUnbond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_IncreaseBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgIncreaseBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).IncreaseBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Msg/IncreaseBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).IncreaseBond(ctx, req.(*MsgIncreaseBond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DecreaseBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDecreaseBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DecreaseBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Msg/DecreaseBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DecreaseBond(ctx, req.(*MsgDecreaseBond)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dymensionxyz.dymension.sequencer.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateSequencer", + Handler: _Msg_CreateSequencer_Handler, + }, + { + MethodName: "UpdateSequencerInformation", + Handler: _Msg_UpdateSequencerInformation_Handler, + }, + { + MethodName: "Unbond", + Handler: _Msg_Unbond_Handler, + }, + { + MethodName: "IncreaseBond", + Handler: _Msg_IncreaseBond_Handler, + }, + { + MethodName: "DecreaseBond", + Handler: _Msg_DecreaseBond_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dymension/sequencer/tx.proto", +} + +func (m *MsgCreateSequencer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateSequencer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateSequencer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Bond.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x1a + } + if m.DymintPubKey != nil { + { + size, err := m.DymintPubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateSequencerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateSequencerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateSequencerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSequencerInformation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateSequencerInformation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSequencerInformation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSequencerInformationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateSequencerInformationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSequencerInformationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUnbond) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnbond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUnbondResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnbondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CompletionTime != nil { + { + size := m.CompletionTime.Size() + i -= size + if _, err := m.CompletionTime.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *MsgUnbondResponse_UnbondingCompletionTime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondResponse_UnbondingCompletionTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.UnbondingCompletionTime != nil { + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.UnbondingCompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.UnbondingCompletionTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTx(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *MsgUnbondResponse_NoticePeriodCompletionTime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondResponse_NoticePeriodCompletionTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.NoticePeriodCompletionTime != nil { + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.NoticePeriodCompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.NoticePeriodCompletionTime):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintTx(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *MsgIncreaseBond) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgIncreaseBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIncreaseBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.AddAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgIncreaseBondResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgIncreaseBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIncreaseBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDecreaseBond) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDecreaseBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDecreaseBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.DecreaseAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDecreaseBondResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDecreaseBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDecreaseBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintTx(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateSequencer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.DymintPubKey != nil { + l = m.DymintPubKey.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Bond.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateSequencerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateSequencerInformation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateSequencerInformationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUnbond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUnbondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CompletionTime != nil { + n += m.CompletionTime.Size() + } + return n +} + +func (m *MsgUnbondResponse_UnbondingCompletionTime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.UnbondingCompletionTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.UnbondingCompletionTime) + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgUnbondResponse_NoticePeriodCompletionTime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NoticePeriodCompletionTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.NoticePeriodCompletionTime) + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgIncreaseBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.AddAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgIncreaseBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDecreaseBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.DecreaseAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDecreaseBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(l)) + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateSequencer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateSequencer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateSequencer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DymintPubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DymintPubKey == nil { + m.DymintPubKey = &types.Any{} + } + if err := m.DymintPubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bond", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Bond.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateSequencerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateSequencerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateSequencerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSequencerInformation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateSequencerInformation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateSequencerInformation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSequencerInformationResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateSequencerInformationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateSequencerInformationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnbond) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnbond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnbond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnbondResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnbondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnbondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingCompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := new(time.Time) + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(v, dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CompletionTime = &MsgUnbondResponse_UnbondingCompletionTime{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoticePeriodCompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := new(time.Time) + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(v, dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CompletionTime = &MsgUnbondResponse_NoticePeriodCompletionTime{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgIncreaseBond) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgIncreaseBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIncreaseBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AddAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgIncreaseBondResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgIncreaseBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIncreaseBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDecreaseBond) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDecreaseBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDecreaseBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DecreaseAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DecreaseAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDecreaseBondResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDecreaseBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDecreaseBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/batch.go b/types/batch.go index 0611fb7a7..2476df5a3 100644 --- a/types/batch.go +++ b/types/batch.go @@ -7,8 +7,47 @@ const ( // Batch defines a struct for block aggregation for support of batching. // TODO: maybe change to BlockBatch type Batch struct { - StartHeight uint64 - EndHeight uint64 - Blocks []*Block - Commits []*Commit + Blocks []*Block + Commits []*Commit + // LastBatch is true if this is the last batch of the sequencer (i.e completes it's rotation flow). + LastBatch bool +} + +// StartHeight is the height of the first block in the batch. +func (b Batch) StartHeight() uint64 { + if len(b.Blocks) == 0 { + return 0 + } + return b.Blocks[0].Header.Height +} + +// EndHeight is the height of the last block in the batch +func (b Batch) EndHeight() uint64 { + if len(b.Blocks) == 0 { + return 0 + } + return b.Blocks[len(b.Blocks)-1].Header.Height +} + +// NumBlocks is the number of blocks in the batch +func (b Batch) NumBlocks() uint64 { + return uint64(len(b.Blocks)) +} + +// SizeBlockAndCommitBytes returns the sum of the size of bytes of the blocks and commits +// The actual size of the batch may be different due to additional metadata and protobuf +// optimizations. +func (b Batch) SizeBlockAndCommitBytes() int { + cnt := 0 + for _, block := range b.Blocks { + cnt += block.SizeBytes() + } + for _, commit := range b.Commits { + cnt += commit.SizeBytes() + } + return cnt +} + +func (b Batch) SizeBytes() int { + return b.ToProto().Size() } diff --git a/types/batch_test.go b/types/batch_test.go new file mode 100644 index 000000000..1aa00f7e3 --- /dev/null +++ b/types/batch_test.go @@ -0,0 +1,14 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestBatchSerialization(t *testing.T) { + batch := Batch{} + bz, err := batch.MarshalBinary() + require.Nil(t, err) + require.Empty(t, bz) +} diff --git a/types/block.go b/types/block.go index 8fdc1d0e4..cc63f55db 100644 --- a/types/block.go +++ b/types/block.go @@ -2,6 +2,7 @@ package types import ( "encoding" + "time" tmtypes "github.com/tendermint/tendermint/types" ) @@ -10,10 +11,6 @@ import ( type Header struct { // Block and App version Version Version - // NamespaceID identifies this chain e.g. when connected to other rollups via IBC. - // TODO(ismail): figure out if we want to use namespace.ID here instead (downside is that it isn't fixed size) - // at least extract the used constants (32, 8) as package variables though. - NamespaceID [8]byte Height uint64 Time uint64 // time in tai64 format @@ -38,13 +35,19 @@ type Header struct { // pubkey can't be recovered by the signature (e.g. ed25519). ProposerAddress []byte // original proposer of the block - // Hash of block sequencer set, at a time of block creation - SequencersHash [32]byte + // Hash of proposer validatorSet (compatible with tendermint) + SequencerHash [32]byte + // Hash of the next proposer validatorSet (compatible with tendermint) + NextSequencersHash [32]byte // The Chain ID ChainID string } +func (h Header) GetTimestamp() time.Time { + return time.Unix(0, int64(h.Time)) +} + var ( _ encoding.BinaryMarshaler = &Header{} _ encoding.BinaryUnmarshaler = &Header{} @@ -66,6 +69,10 @@ type Block struct { LastCommit Commit } +func (b Block) SizeBytes() int { + return b.ToProto().Size() +} + var ( _ encoding.BinaryMarshaler = &Block{} _ encoding.BinaryUnmarshaler = &Block{} @@ -92,6 +99,10 @@ type Commit struct { TMSignature tmtypes.CommitSig } +func (c Commit) SizeBytes() int { + return c.ToProto().Size() +} + // Signature represents signature of block creator. type Signature []byte @@ -100,3 +111,16 @@ type Signature []byte type IntermediateStateRoots struct { RawRootsList [][]byte } + +func GetLastCommitHash(lastCommit *Commit, header *Header) []byte { + lastABCICommit := ToABCICommit(lastCommit, header) + return lastABCICommit.Hash() +} + +// GetDataHash returns the hash of the block data to be set in the block header. +func GetDataHash(block *Block) []byte { + abciData := tmtypes.Data{ + Txs: ToABCIBlockDataTxs(&block.Data), + } + return abciData.Hash() +} diff --git a/types/block_source.go b/types/block_source.go new file mode 100644 index 000000000..26c24cdea --- /dev/null +++ b/types/block_source.go @@ -0,0 +1,42 @@ +package types + +import ( + "github.com/libp2p/go-libp2p/core/crypto" + tmcrypto "github.com/tendermint/tendermint/crypto" +) + +type BlockSource uint64 + +const ( + _ BlockSource = iota + Produced + Gossiped + BlockSync + DA + LocalDb +) + +func (s BlockSource) String() string { + return AllSources[s] +} + +var AllSources = []string{"none", "produced", "gossip", "blocksync", "da", "local_db"} + +type BlockMetaData struct { + Source BlockSource + DAHeight uint64 +} + +type CachedBlock struct { + Block *Block + Commit *Commit + Source BlockSource +} + +func GetAddress(key crypto.PrivKey) ([]byte, error) { + rawKey, err := key.GetPublic().Raw() + if err != nil { + return nil, err + } + return tmcrypto.AddressHash(rawKey), nil +} diff --git a/types/conv.go b/types/conv.go index 0efd04b98..bddb98547 100644 --- a/types/conv.go +++ b/types/conv.go @@ -11,31 +11,8 @@ import ( // ToABCIHeaderPB converts Dymint header to Header format defined in ABCI. // Caller should fill all the fields that are not available in Dymint header (like ChainID). func ToABCIHeaderPB(header *Header) types.Header { - return types.Header{ - Version: version.Consensus{ - Block: header.Version.Block, - App: header.Version.App, - }, - Height: int64(header.Height), - Time: time.Unix(0, int64(header.Time)), - LastBlockId: types.BlockID{ - Hash: header.LastHeaderHash[:], - PartSetHeader: types.PartSetHeader{ - Total: 1, - Hash: header.LastHeaderHash[:], - }, - }, - LastCommitHash: header.LastCommitHash[:], - DataHash: header.DataHash[:], - ValidatorsHash: header.SequencersHash[:], - NextValidatorsHash: header.SequencersHash[:], - ConsensusHash: header.ConsensusHash[:], - AppHash: header.AppHash[:], - LastResultsHash: header.LastResultsHash[:], - EvidenceHash: new(tmtypes.EvidenceData).Hash(), - ProposerAddress: header.ProposerAddress, - ChainID: header.ChainID, - } + tmheader := ToABCIHeader(header) + return *tmheader.ToProto() } // ToABCIHeader converts Dymint header to Header format defined in ABCI. @@ -57,8 +34,8 @@ func ToABCIHeader(header *Header) tmtypes.Header { }, LastCommitHash: header.LastCommitHash[:], DataHash: header.DataHash[:], - ValidatorsHash: header.SequencersHash[:], - NextValidatorsHash: header.SequencersHash[:], + ValidatorsHash: header.SequencerHash[:], + NextValidatorsHash: header.NextSequencersHash[:], ConsensusHash: header.ConsensusHash[:], AppHash: header.AppHash[:], LastResultsHash: header.LastResultsHash[:], diff --git a/types/errors.go b/types/errors.go index 7c8154e25..cfabbe0b1 100644 --- a/types/errors.go +++ b/types/errors.go @@ -1,11 +1,17 @@ package types -import "errors" +import ( + "errors" + "fmt" + + "github.com/dymensionxyz/gerr-cosmos/gerrc" +) var ( ErrInvalidSignature = errors.New("invalid signature") ErrNoStateFound = errors.New("no state found") - ErrSkippedEmptyBlock = errors.New("skipped empty block") + ErrEmptyBlock = errors.New("block has no transactions and is not allowed to be empty") ErrInvalidBlockHeight = errors.New("invalid block height") ErrInvalidHeaderDataHash = errors.New("header not matching block data") + ErrMissingProposerPubKey = fmt.Errorf("missing proposer public key: %w", gerrc.ErrNotFound) ) diff --git a/types/hashing.go b/types/hashing.go index 1500658e8..17162ee0e 100644 --- a/types/hashing.go +++ b/types/hashing.go @@ -1,40 +1,9 @@ package types -import ( - "time" - - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - tmtypes "github.com/tendermint/tendermint/types" -) - // Hash returns ABCI-compatible hash of a header. func (h *Header) Hash() [32]byte { - abciHeader := tmtypes.Header{ - Version: tmversion.Consensus{ - Block: h.Version.Block, - App: h.Version.App, - }, - Height: int64(h.Height), - Time: time.Unix(0, int64(h.Time)), - LastBlockID: tmtypes.BlockID{ - Hash: h.LastHeaderHash[:], - PartSetHeader: tmtypes.PartSetHeader{ - Total: 1, - Hash: h.LastHeaderHash[:], - }, - }, - LastCommitHash: h.LastCommitHash[:], - DataHash: h.DataHash[:], - ValidatorsHash: h.SequencersHash[:], - NextValidatorsHash: h.SequencersHash[:], - ConsensusHash: h.ConsensusHash[:], - AppHash: h.AppHash[:], - LastResultsHash: h.LastResultsHash[:], - EvidenceHash: new(tmtypes.EvidenceData).Hash(), - ProposerAddress: h.ProposerAddress, - ChainID: h.ChainID, - } var hash [32]byte + abciHeader := ToABCIHeader(h) copy(hash[:], abciHeader.Hash()) return hash } diff --git a/types/metrics.go b/types/metrics.go index a53ff3c65..5ad097313 100644 --- a/types/metrics.go +++ b/types/metrics.go @@ -24,3 +24,62 @@ var RollappBlockSizeTxsGauge = promauto.NewGauge(prometheus.GaugeOpts{ Name: "rollapp_block_size_txs", Help: "Rollapp ", }) + +var RollappPendingSubmissionsSkewBlocks = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "rollapp_pending_submissions_skew_blocks", + Help: "The number of blocks which have been accumulated but not yet submitted.", +}) + +var RollappPendingSubmissionsSkewBatches = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "rollapp_pending_submissions_skew_batches", + Help: "The number of batches which have been accumulated but not yet submitted.", +}) + +var RollappPendingSubmissionsSkewBytes = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "rollapp_pending_submissions_skew_bytes", + Help: "The number of bytes (of blocks and commits) which have been accumulated but not yet submitted.", +}) + +var LastBatchSubmittedBytes = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "last_batch_submitted_bytes", + Help: "The size in bytes of the last batch submitted to DA.", +}) + +var LastReceivedP2PHeightGauge = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "last_received_p2p_height", + Help: "The height of the last block received from P2P.", +}) + +var LastReceivedDAHeightGauge = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "last_received_da_height", + Help: "The height of the last block received from DA.", +}) + +const SourceLabel = "source" + +func init() { + LastAppliedBlockSource.With(prometheus.Labels{SourceLabel: "none"}).Set(0) +} + +var LastAppliedBlockSource = promauto.NewGaugeVec( + prometheus.GaugeOpts{ + Name: "last_applied_block_source", + Help: "The source of the last applied block", + }, + []string{SourceLabel}, +) + +func SetLastAppliedBlockSource(source string) { + LastAppliedBlockSource.Reset() + LastAppliedBlockSource.With(prometheus.Labels{SourceLabel: source}).Set(0) +} + +var BlockCacheSizeGauge = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "block_cache_size", + Help: "The number of blocks in the cache.", +}) + +var RollappConsecutiveFailedDASubmission = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "rollapp_consecutive_failed_da_submissions", + Help: "The number of consecutive times the da fails to submit.", +}) diff --git a/types/pb/dymint/dymint.pb.go b/types/pb/dymint/dymint.pb.go index b40004d72..f3894f5d5 100644 --- a/types/pb/dymint/dymint.pb.go +++ b/types/pb/dymint/dymint.pb.go @@ -84,7 +84,7 @@ type Header struct { // Block and App version Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // NamespaceID identifies this chain e.g. when connected to other rollups via IBC. - NamespaceId []byte `protobuf:"bytes,2,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` + NamespaceId []byte `protobuf:"bytes,2,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` // Deprecated: Do not use. // Block height Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` // Block creation time @@ -109,8 +109,10 @@ type Header struct { // We keep this in case users choose another signature format where the // pubkey can't be recovered by the signature (e.g. ed25519). ProposerAddress []byte `protobuf:"bytes,11,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` - // Hash of block sequencer set, at a time of block creation - SequencersHash []byte `protobuf:"bytes,12,opt,name=sequencers_hash,json=sequencersHash,proto3" json:"sequencers_hash,omitempty"` + // Hash of proposer validatorSet (compatible with tendermint) + SequencerHash []byte `protobuf:"bytes,12,opt,name=sequencer_hash,json=sequencerHash,proto3" json:"sequencer_hash,omitempty"` + // Hash of the next proposer validatorSet (compatible with tendermint) + NextSequencerHash []byte `protobuf:"bytes,14,opt,name=next_sequencer_hash,json=nextSequencerHash,proto3" json:"next_sequencer_hash,omitempty"` // Chain ID the block belongs to ChainId string `protobuf:"bytes,13,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } @@ -155,6 +157,7 @@ func (m *Header) GetVersion() *Version { return nil } +// Deprecated: Do not use. func (m *Header) GetNamespaceId() []byte { if m != nil { return m.NamespaceId @@ -225,9 +228,16 @@ func (m *Header) GetProposerAddress() []byte { return nil } -func (m *Header) GetSequencersHash() []byte { +func (m *Header) GetSequencerHash() []byte { if m != nil { - return m.SequencersHash + return m.SequencerHash + } + return nil +} + +func (m *Header) GetNextSequencerHash() []byte { + if m != nil { + return m.NextSequencerHash } return nil } @@ -496,6 +506,110 @@ func (m *Batch) GetCommits() []*Commit { return nil } +type Sequencer struct { + SettlementAddress string `protobuf:"bytes,1,opt,name=settlement_address,json=settlementAddress,proto3" json:"settlement_address,omitempty"` + Validator *types.Validator `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"` +} + +func (m *Sequencer) Reset() { *m = Sequencer{} } +func (m *Sequencer) String() string { return proto.CompactTextString(m) } +func (*Sequencer) ProtoMessage() {} +func (*Sequencer) Descriptor() ([]byte, []int) { + return fileDescriptor_fe69c538ded4b87f, []int{6} +} +func (m *Sequencer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sequencer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sequencer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Sequencer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sequencer.Merge(m, src) +} +func (m *Sequencer) XXX_Size() int { + return m.Size() +} +func (m *Sequencer) XXX_DiscardUnknown() { + xxx_messageInfo_Sequencer.DiscardUnknown(m) +} + +var xxx_messageInfo_Sequencer proto.InternalMessageInfo + +func (m *Sequencer) GetSettlementAddress() string { + if m != nil { + return m.SettlementAddress + } + return "" +} + +func (m *Sequencer) GetValidator() *types.Validator { + if m != nil { + return m.Validator + } + return nil +} + +type SequencerSet struct { + Sequencers []*Sequencer `protobuf:"bytes,1,rep,name=sequencers,proto3" json:"sequencers,omitempty"` + Proposer *Sequencer `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` +} + +func (m *SequencerSet) Reset() { *m = SequencerSet{} } +func (m *SequencerSet) String() string { return proto.CompactTextString(m) } +func (*SequencerSet) ProtoMessage() {} +func (*SequencerSet) Descriptor() ([]byte, []int) { + return fileDescriptor_fe69c538ded4b87f, []int{7} +} +func (m *SequencerSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SequencerSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SequencerSet.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SequencerSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_SequencerSet.Merge(m, src) +} +func (m *SequencerSet) XXX_Size() int { + return m.Size() +} +func (m *SequencerSet) XXX_DiscardUnknown() { + xxx_messageInfo_SequencerSet.DiscardUnknown(m) +} + +var xxx_messageInfo_SequencerSet proto.InternalMessageInfo + +func (m *SequencerSet) GetSequencers() []*Sequencer { + if m != nil { + return m.Sequencers + } + return nil +} + +func (m *SequencerSet) GetProposer() *Sequencer { + if m != nil { + return m.Proposer + } + return nil +} + func init() { proto.RegisterType((*Version)(nil), "dymint.Version") proto.RegisterType((*Header)(nil), "dymint.Header") @@ -503,55 +617,64 @@ func init() { proto.RegisterType((*Data)(nil), "dymint.Data") proto.RegisterType((*Block)(nil), "dymint.Block") proto.RegisterType((*Batch)(nil), "dymint.Batch") + proto.RegisterType((*Sequencer)(nil), "dymint.Sequencer") + proto.RegisterType((*SequencerSet)(nil), "dymint.SequencerSet") } func init() { proto.RegisterFile("types/dymint/dymint.proto", fileDescriptor_fe69c538ded4b87f) } var fileDescriptor_fe69c538ded4b87f = []byte{ - // 686 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x94, 0xbd, 0x6f, 0xd3, 0x4e, - 0x18, 0xc7, 0xeb, 0x26, 0x75, 0x92, 0xc7, 0xe9, 0xcb, 0xef, 0xf4, 0x53, 0xe5, 0xb6, 0xc2, 0xa4, - 0x96, 0x0a, 0x29, 0x83, 0x2b, 0x82, 0x90, 0x98, 0x90, 0x28, 0x20, 0xa5, 0xab, 0x2b, 0x31, 0xb0, - 0x44, 0x17, 0xfb, 0x14, 0x9f, 0xa8, 0x5f, 0xb8, 0xbb, 0x54, 0x2d, 0x23, 0x1b, 0x1b, 0x33, 0x1b, - 0xff, 0x0d, 0x63, 0x47, 0x46, 0xd4, 0xfc, 0x23, 0xe8, 0x9e, 0x3b, 0xc7, 0x06, 0x96, 0xc4, 0xf7, - 0xfd, 0x7e, 0x7c, 0x7e, 0xee, 0x79, 0x39, 0x38, 0x50, 0xb7, 0x15, 0x93, 0x67, 0xe9, 0x6d, 0xce, - 0x0b, 0x65, 0xff, 0xa2, 0x4a, 0x94, 0xaa, 0x24, 0xae, 0x59, 0x1d, 0x1e, 0x1b, 0x44, 0xb1, 0x22, - 0x65, 0x02, 0x31, 0x3a, 0x4f, 0xf8, 0x19, 0xaa, 0x06, 0x3d, 0x0c, 0xff, 0x41, 0xac, 0xd0, 0x30, - 0xe1, 0x53, 0xe8, 0xbd, 0x63, 0x42, 0xf2, 0xb2, 0x20, 0xff, 0xc3, 0xd6, 0xfc, 0xaa, 0x4c, 0x3e, - 0xf8, 0xce, 0xc8, 0x19, 0x77, 0x63, 0xb3, 0x20, 0x7b, 0xd0, 0xa1, 0x55, 0xe5, 0x6f, 0xa2, 0xa6, - 0x1f, 0xc3, 0xbb, 0x0e, 0xb8, 0x53, 0x46, 0x53, 0x26, 0xc8, 0x29, 0xf4, 0xae, 0xcd, 0xdb, 0xf8, - 0x92, 0x37, 0xd9, 0x8d, 0x6c, 0xb0, 0x76, 0xd3, 0xb8, 0xf6, 0xc9, 0x31, 0x0c, 0x0b, 0x9a, 0x33, - 0x59, 0xd1, 0x84, 0xcd, 0x78, 0x8a, 0x1b, 0x0e, 0x63, 0x6f, 0xad, 0x5d, 0xa4, 0x64, 0x1f, 0xdc, - 0x8c, 0xf1, 0x45, 0xa6, 0xfc, 0x0e, 0x7e, 0xcd, 0xae, 0x08, 0x81, 0xae, 0xe2, 0x39, 0xf3, 0xbb, - 0xa8, 0xe2, 0x33, 0x19, 0xc3, 0xde, 0x15, 0x95, 0x6a, 0x96, 0x61, 0x20, 0xb3, 0x8c, 0xca, 0xcc, - 0xdf, 0xc2, 0x2d, 0x77, 0xb4, 0x6e, 0xe2, 0x9b, 0x52, 0x99, 0xad, 0xc9, 0xa4, 0xcc, 0x73, 0xae, - 0x0c, 0xe9, 0x36, 0xe4, 0x6b, 0x94, 0x91, 0x3c, 0x82, 0x41, 0x4a, 0x15, 0x35, 0x48, 0x0f, 0x91, - 0xbe, 0x16, 0xd0, 0x3c, 0x81, 0x9d, 0xa4, 0x2c, 0x24, 0x2b, 0xe4, 0x52, 0x1a, 0xa2, 0x8f, 0xc4, - 0xf6, 0x5a, 0x45, 0xec, 0x00, 0xfa, 0xb4, 0xaa, 0x0c, 0x30, 0x40, 0xa0, 0x47, 0xab, 0x0a, 0xad, - 0x27, 0xf0, 0x1f, 0x06, 0x22, 0x98, 0x5c, 0x5e, 0x29, 0xbb, 0x09, 0x20, 0xb3, 0xab, 0x8d, 0xd8, - 0xe8, 0xc8, 0x9e, 0xc2, 0x5e, 0x25, 0xca, 0xaa, 0x94, 0x4c, 0xcc, 0x68, 0x9a, 0x0a, 0x26, 0xa5, - 0xef, 0x19, 0xb4, 0xd6, 0x5f, 0x19, 0x99, 0x3c, 0x86, 0x5d, 0xc9, 0x3e, 0x2e, 0x59, 0x91, 0x30, - 0x61, 0x37, 0x1d, 0x9a, 0xe3, 0x35, 0x72, 0x1d, 0x5a, 0x92, 0x51, 0x5e, 0xe8, 0xec, 0x6f, 0x8f, - 0x9c, 0xf1, 0x20, 0xee, 0xe1, 0xfa, 0x22, 0x0d, 0xbf, 0x3b, 0xe0, 0x9a, 0x44, 0xb4, 0x8a, 0xe0, - 0xfc, 0x51, 0x84, 0x87, 0xe0, 0xb5, 0x73, 0x6d, 0xca, 0x07, 0x59, 0x93, 0xe7, 0x00, 0x40, 0xf2, - 0x45, 0x41, 0xd5, 0x52, 0x30, 0xe9, 0x77, 0x46, 0x1d, 0xed, 0x37, 0x0a, 0x79, 0x09, 0x43, 0x95, - 0xcf, 0xd6, 0x02, 0x56, 0xd3, 0x9b, 0x1c, 0x45, 0x4d, 0x7b, 0x46, 0xa6, 0x31, 0x4d, 0x20, 0x97, - 0x7c, 0x11, 0x7b, 0x2a, 0xbf, 0xac, 0xf9, 0xf0, 0x8b, 0x03, 0xdd, 0x37, 0x54, 0x51, 0xdd, 0x91, - 0xea, 0x46, 0xfa, 0x0e, 0x7e, 0x41, 0x3f, 0x92, 0x17, 0xe0, 0xf3, 0x42, 0x31, 0x91, 0xb3, 0x94, - 0x53, 0xc5, 0x66, 0x52, 0xe9, 0x5f, 0x51, 0x96, 0x4a, 0xfa, 0x9b, 0x88, 0xed, 0xb7, 0xfd, 0x4b, - 0x6d, 0xc7, 0xda, 0x25, 0xcf, 0xa1, 0xcf, 0xae, 0x79, 0xaa, 0xb3, 0x84, 0x21, 0x7b, 0x93, 0x83, - 0x76, 0x40, 0x7a, 0xa4, 0xa2, 0xb7, 0x16, 0x88, 0xd7, 0x68, 0xf8, 0xd9, 0x81, 0xad, 0x73, 0x1c, - 0x8f, 0x47, 0x3a, 0x5d, 0x3a, 0x07, 0x76, 0x00, 0x76, 0xea, 0x01, 0x30, 0x1d, 0x18, 0x5b, 0x97, - 0x8c, 0xa0, 0xab, 0x5b, 0x09, 0xf3, 0xe6, 0x4d, 0x86, 0x35, 0xa5, 0x0f, 0x14, 0xa3, 0x43, 0xce, - 0xc0, 0x6b, 0xf5, 0x29, 0x8e, 0x40, 0x6b, 0x3b, 0x93, 0x94, 0x18, 0x9a, 0x96, 0x0d, 0xbf, 0xe9, - 0x20, 0xa8, 0x4a, 0x32, 0x3d, 0x5b, 0x52, 0x51, 0xa1, 0xa7, 0xa1, 0x55, 0x39, 0x0f, 0xb5, 0xa9, - 0x29, 0xdf, 0x03, 0x00, 0x56, 0xa4, 0x35, 0x60, 0xa6, 0x79, 0xc0, 0x8a, 0xd4, 0xda, 0x27, 0xe0, - 0xe2, 0xb8, 0x4b, 0x9b, 0x85, 0xed, 0xfa, 0xbb, 0x78, 0xca, 0xd8, 0x9a, 0x64, 0x0c, 0x3d, 0x13, - 0x9e, 0xf4, 0xbb, 0xc8, 0xfd, 0x1d, 0x5f, 0x6d, 0x9f, 0x4f, 0x7f, 0xdc, 0x07, 0xce, 0xdd, 0x7d, - 0xe0, 0xfc, 0xba, 0x0f, 0x9c, 0xaf, 0xab, 0x60, 0xe3, 0x6e, 0x15, 0x6c, 0xfc, 0x5c, 0x05, 0x1b, - 0xef, 0xa3, 0x05, 0x57, 0xd9, 0x72, 0x1e, 0x25, 0x65, 0xae, 0x6f, 0x36, 0x56, 0xe8, 0xeb, 0xe1, - 0xe6, 0xf6, 0x53, 0x7d, 0xdb, 0x99, 0x3b, 0xaa, 0x9a, 0xdb, 0xf5, 0xdc, 0xc5, 0x8b, 0xea, 0xd9, - 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x81, 0x13, 0x49, 0x14, 0x05, 0x00, 0x00, + // 797 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0x4d, 0x4f, 0xdb, 0x48, + 0x18, 0xc7, 0x31, 0x09, 0x79, 0x79, 0x1c, 0x02, 0x99, 0x5d, 0x21, 0x07, 0xb4, 0xd9, 0x60, 0x09, + 0x14, 0x56, 0xc2, 0x88, 0xac, 0x56, 0xda, 0xbd, 0xac, 0xb4, 0x6c, 0x2b, 0x85, 0xeb, 0x44, 0xe2, + 0xd0, 0x4b, 0x34, 0xb1, 0x47, 0xb1, 0xd5, 0xf8, 0xa5, 0x9e, 0x09, 0x82, 0x1e, 0xb9, 0xf5, 0xd6, + 0x73, 0x6f, 0xfd, 0x36, 0x3d, 0x72, 0xec, 0xb1, 0x82, 0x2f, 0x52, 0xcd, 0x33, 0x63, 0xc7, 0x50, + 0x7a, 0x01, 0xcf, 0xff, 0xff, 0xf3, 0xcc, 0xe3, 0xe7, 0x65, 0x02, 0x7d, 0x79, 0x9b, 0x71, 0x71, + 0x16, 0xdc, 0xc6, 0x51, 0x22, 0xcd, 0x3f, 0x2f, 0xcb, 0x53, 0x99, 0x92, 0x86, 0x5e, 0xed, 0x1f, + 0x6a, 0x44, 0xf2, 0x24, 0xe0, 0x39, 0x62, 0x6c, 0xee, 0x47, 0x67, 0xa8, 0x6a, 0x74, 0xdf, 0xfd, + 0x01, 0x31, 0x42, 0x85, 0x39, 0xfe, 0x09, 0x73, 0xcd, 0x96, 0x51, 0xc0, 0x64, 0x9a, 0x6b, 0xce, + 0x3d, 0x87, 0xe6, 0x15, 0xcf, 0x45, 0x94, 0x26, 0xe4, 0x57, 0xd8, 0x9a, 0x2f, 0x53, 0xff, 0xad, + 0x63, 0x0d, 0xad, 0x51, 0x9d, 0xea, 0x05, 0xd9, 0x85, 0x1a, 0xcb, 0x32, 0x67, 0x13, 0x35, 0xf5, + 0xe8, 0xde, 0xd5, 0xa1, 0x31, 0xe1, 0x2c, 0xe0, 0x39, 0x39, 0x81, 0xe6, 0xb5, 0x7e, 0x1b, 0x5f, + 0xb2, 0xc7, 0x3b, 0x9e, 0xf9, 0x28, 0xb3, 0x29, 0x2d, 0x7c, 0x72, 0x04, 0x9d, 0x84, 0xc5, 0x5c, + 0x64, 0xcc, 0xe7, 0xb3, 0x28, 0xc0, 0x0d, 0x3b, 0x17, 0x9b, 0x8e, 0x45, 0xed, 0x52, 0xbf, 0x0c, + 0xc8, 0x1e, 0x34, 0x42, 0x1e, 0x2d, 0x42, 0xe9, 0xd4, 0xf0, 0x44, 0xb3, 0x22, 0x04, 0xea, 0x32, + 0x8a, 0xb9, 0x53, 0x47, 0x15, 0x9f, 0xc9, 0x08, 0x76, 0x97, 0x4c, 0xc8, 0x59, 0x88, 0xc1, 0xcc, + 0x42, 0x26, 0x42, 0x67, 0x4b, 0x6d, 0x4b, 0xbb, 0x4a, 0xd7, 0x31, 0x4e, 0x98, 0x08, 0x4b, 0xd2, + 0x4f, 0xe3, 0x38, 0x92, 0x9a, 0x6c, 0xac, 0xc9, 0xff, 0x51, 0x46, 0xf2, 0x00, 0xda, 0x01, 0x93, + 0x4c, 0x23, 0x4d, 0x44, 0x5a, 0x4a, 0x40, 0xf3, 0x08, 0xba, 0x7e, 0x9a, 0x08, 0x9e, 0x88, 0x95, + 0xd0, 0x44, 0x0b, 0x89, 0xed, 0x52, 0x45, 0xac, 0x0f, 0x2d, 0x96, 0x65, 0x1a, 0x68, 0x23, 0xd0, + 0x64, 0x59, 0x86, 0xd6, 0x1f, 0xd0, 0xc3, 0x40, 0x72, 0x2e, 0x56, 0x4b, 0x69, 0x36, 0x01, 0x64, + 0x76, 0x94, 0x41, 0xb5, 0x8e, 0xec, 0x09, 0xec, 0x66, 0x79, 0x9a, 0xa5, 0x82, 0xe7, 0x33, 0x16, + 0x04, 0x39, 0x17, 0xc2, 0xb1, 0x35, 0x5a, 0xe8, 0xff, 0x69, 0x59, 0x05, 0x26, 0xf8, 0xbb, 0x15, + 0x4f, 0xfc, 0x22, 0x0f, 0x1d, 0x1d, 0x58, 0xa9, 0xe2, 0x8e, 0x1e, 0xfc, 0x92, 0xf0, 0x1b, 0x39, + 0x7b, 0xc6, 0x76, 0x91, 0xed, 0x29, 0x6b, 0xfa, 0x84, 0xef, 0x43, 0xcb, 0x0f, 0x59, 0x94, 0xa8, + 0x7a, 0x6d, 0x0f, 0xad, 0x51, 0x9b, 0x36, 0x71, 0x7d, 0x19, 0xb8, 0x9f, 0x2d, 0x68, 0xe8, 0xb4, + 0x55, 0x4a, 0x66, 0x3d, 0x29, 0xd9, 0xef, 0x60, 0x57, 0x2b, 0x83, 0x05, 0xa7, 0x10, 0xae, 0xab, + 0x32, 0x00, 0x10, 0xd1, 0x22, 0x61, 0x72, 0x95, 0x73, 0xe1, 0xd4, 0x86, 0x35, 0xe5, 0xaf, 0x15, + 0xf2, 0x2f, 0x74, 0x64, 0x3c, 0x2b, 0x05, 0xac, 0xbd, 0x3d, 0x3e, 0xf0, 0xd6, 0x4d, 0xed, 0xe9, + 0x96, 0xd7, 0x81, 0x4c, 0xa3, 0x05, 0xb5, 0x65, 0x3c, 0x2d, 0x78, 0xf7, 0x83, 0x05, 0xf5, 0x57, + 0x4c, 0x32, 0xd5, 0xc3, 0xf2, 0x46, 0x38, 0x16, 0x9e, 0xa0, 0x1e, 0xc9, 0xdf, 0xe0, 0x44, 0x89, + 0xe4, 0x79, 0xcc, 0x83, 0x88, 0x49, 0x3e, 0x13, 0x52, 0xfd, 0xcd, 0xd3, 0x54, 0x0a, 0x67, 0x13, + 0xb1, 0xbd, 0xaa, 0x3f, 0x55, 0x36, 0x55, 0x2e, 0xf9, 0x0b, 0x5a, 0xfc, 0x3a, 0x0a, 0x54, 0x92, + 0x30, 0x64, 0x7b, 0xdc, 0xaf, 0x06, 0xa4, 0x86, 0xd5, 0x7b, 0x6d, 0x00, 0x5a, 0xa2, 0xee, 0x9d, + 0x05, 0x5b, 0x17, 0x38, 0x50, 0xc7, 0x2a, 0x5d, 0x2a, 0x07, 0x66, 0x64, 0xba, 0xc5, 0xc8, 0xe8, + 0x7e, 0xa5, 0xc6, 0x25, 0x43, 0xa8, 0xab, 0xc6, 0xc3, 0xbc, 0xd9, 0xe3, 0x4e, 0x41, 0xa9, 0x0f, + 0xa2, 0xe8, 0x90, 0x33, 0xb0, 0x2b, 0x5d, 0x8d, 0x03, 0x53, 0xd9, 0x4e, 0x27, 0x85, 0xc2, 0xba, + 0xc1, 0xdd, 0x4f, 0x2a, 0x08, 0x26, 0xfd, 0x90, 0x1c, 0x42, 0x47, 0x48, 0x96, 0xab, 0xd9, 0xa9, + 0x54, 0xce, 0x46, 0x6d, 0xa2, 0xcb, 0xf7, 0x1b, 0x00, 0x4f, 0x82, 0x02, 0xd0, 0xf3, 0xdf, 0xe6, + 0x49, 0x60, 0xec, 0x23, 0x68, 0xe0, 0x05, 0x21, 0x4c, 0x16, 0xb6, 0x8b, 0x73, 0xf1, 0x2b, 0xa9, + 0x31, 0xc9, 0x08, 0x9a, 0x3a, 0x3c, 0xe1, 0xd4, 0x91, 0x7b, 0x1e, 0x5f, 0x61, 0xbb, 0x2b, 0x68, + 0x97, 0xdd, 0x47, 0x4e, 0x81, 0x08, 0x2e, 0xe5, 0x92, 0xc7, 0x3c, 0x91, 0x65, 0xf7, 0x5b, 0xd8, + 0x83, 0xbd, 0xb5, 0x53, 0xf4, 0xff, 0x3f, 0xd0, 0x2e, 0x2f, 0x36, 0x93, 0xb0, 0x17, 0xda, 0xe4, + 0xaa, 0x40, 0xe8, 0x9a, 0x76, 0x33, 0xe8, 0x94, 0xc7, 0x4e, 0xb9, 0x24, 0xe7, 0x00, 0xe5, 0x78, + 0xe8, 0x96, 0xb1, 0xc7, 0xbd, 0x22, 0xe6, 0x92, 0xa4, 0x15, 0x88, 0x9c, 0x42, 0xab, 0x18, 0x48, + 0x73, 0xf8, 0x0b, 0x2f, 0x94, 0xc8, 0xc5, 0xe4, 0xcb, 0xc3, 0xc0, 0xba, 0x7f, 0x18, 0x58, 0xdf, + 0x1e, 0x06, 0xd6, 0xc7, 0xc7, 0xc1, 0xc6, 0xfd, 0xe3, 0x60, 0xe3, 0xeb, 0xe3, 0x60, 0xe3, 0x8d, + 0xb7, 0x88, 0x64, 0xb8, 0x9a, 0x7b, 0x7e, 0x1a, 0xab, 0x1f, 0x07, 0x9e, 0xa8, 0x9b, 0xf3, 0xe6, + 0xf6, 0x7d, 0xf1, 0x83, 0xa1, 0xaf, 0xf0, 0x6c, 0x6e, 0xd6, 0xf3, 0x06, 0xde, 0xe1, 0x7f, 0x7e, + 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xde, 0x10, 0x30, 0x57, 0x06, 0x00, 0x00, } func (m *Version) Marshal() (dAtA []byte, err error) { @@ -607,6 +730,13 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NextSequencerHash) > 0 { + i -= len(m.NextSequencerHash) + copy(dAtA[i:], m.NextSequencerHash) + i = encodeVarintDymint(dAtA, i, uint64(len(m.NextSequencerHash))) + i-- + dAtA[i] = 0x72 + } if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -614,10 +744,10 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x6a } - if len(m.SequencersHash) > 0 { - i -= len(m.SequencersHash) - copy(dAtA[i:], m.SequencersHash) - i = encodeVarintDymint(dAtA, i, uint64(len(m.SequencersHash))) + if len(m.SequencerHash) > 0 { + i -= len(m.SequencerHash) + copy(dAtA[i:], m.SequencerHash) + i = encodeVarintDymint(dAtA, i, uint64(len(m.SequencerHash))) i-- dAtA[i] = 0x62 } @@ -933,6 +1063,97 @@ func (m *Batch) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Sequencer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Sequencer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sequencer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Validator != nil { + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDymint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.SettlementAddress) > 0 { + i -= len(m.SettlementAddress) + copy(dAtA[i:], m.SettlementAddress) + i = encodeVarintDymint(dAtA, i, uint64(len(m.SettlementAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SequencerSet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SequencerSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SequencerSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proposer != nil { + { + size, err := m.Proposer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDymint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Sequencers) > 0 { + for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDymint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintDymint(dAtA []byte, offset int, v uint64) int { offset -= sovDymint(v) base := offset @@ -1007,7 +1228,7 @@ func (m *Header) Size() (n int) { if l > 0 { n += 1 + l + sovDymint(uint64(l)) } - l = len(m.SequencersHash) + l = len(m.SequencerHash) if l > 0 { n += 1 + l + sovDymint(uint64(l)) } @@ -1015,6 +1236,10 @@ func (m *Header) Size() (n int) { if l > 0 { n += 1 + l + sovDymint(uint64(l)) } + l = len(m.NextSequencerHash) + if l > 0 { + n += 1 + l + sovDymint(uint64(l)) + } return n } @@ -1119,6 +1344,42 @@ func (m *Batch) Size() (n int) { return n } +func (m *Sequencer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SettlementAddress) + if l > 0 { + n += 1 + l + sovDymint(uint64(l)) + } + if m.Validator != nil { + l = m.Validator.Size() + n += 1 + l + sovDymint(uint64(l)) + } + return n +} + +func (m *SequencerSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Sequencers) > 0 { + for _, e := range m.Sequencers { + l = e.Size() + n += 1 + l + sovDymint(uint64(l)) + } + } + if m.Proposer != nil { + l = m.Proposer.Size() + n += 1 + l + sovDymint(uint64(l)) + } + return n +} + func sovDymint(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1590,7 +1851,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SequencersHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SequencerHash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -1617,9 +1878,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SequencersHash = append(m.SequencersHash[:0], dAtA[iNdEx:postIndex]...) - if m.SequencersHash == nil { - m.SequencersHash = []byte{} + m.SequencerHash = append(m.SequencerHash[:0], dAtA[iNdEx:postIndex]...) + if m.SequencerHash == nil { + m.SequencerHash = []byte{} } iNdEx = postIndex case 13: @@ -1654,6 +1915,40 @@ func (m *Header) Unmarshal(dAtA []byte) error { } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextSequencerHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDymint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDymint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextSequencerHash = append(m.NextSequencerHash[:0], dAtA[iNdEx:postIndex]...) + if m.NextSequencerHash == nil { + m.NextSequencerHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDymint(dAtA[iNdEx:]) @@ -2308,6 +2603,244 @@ func (m *Batch) Unmarshal(dAtA []byte) error { } return nil } +func (m *Sequencer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Sequencer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sequencer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SettlementAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDymint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDymint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SettlementAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDymint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDymint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Validator == nil { + m.Validator = &types.Validator{} + } + if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDymint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDymint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SequencerSet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SequencerSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SequencerSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDymint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDymint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencers = append(m.Sequencers, &Sequencer{}) + if err := m.Sequencers[len(m.Sequencers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDymint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDymint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDymint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposer == nil { + m.Proposer = &Sequencer{} + } + if err := m.Proposer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDymint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDymint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipDymint(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/pb/dymint/state.pb.go b/types/pb/dymint/state.pb.go index a5dbdefee..1cb1dfca9 100644 --- a/types/pb/dymint/state.pb.go +++ b/types/pb/dymint/state.pb.go @@ -37,9 +37,7 @@ type State struct { LastBlockHeight int64 `protobuf:"varint,4,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` LastBlockID types.BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` LastBlockTime time.Time `protobuf:"bytes,6,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` - NextValidators *types.ValidatorSet `protobuf:"bytes,8,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` - Validators *types.ValidatorSet `protobuf:"bytes,9,opt,name=validators,proto3" json:"validators,omitempty"` - LastValidators *types.ValidatorSet `protobuf:"bytes,10,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` + Validators *types.ValidatorSet `protobuf:"bytes,9,opt,name=validators,proto3" json:"validators,omitempty"` // Deprecated: Do not use. LastHeightValidatorsChanged int64 `protobuf:"varint,11,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` ConsensusParams types.ConsensusParams `protobuf:"bytes,12,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` LastHeightConsensusParamsChanged int64 `protobuf:"varint,13,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` @@ -47,6 +45,8 @@ type State struct { AppHash []byte `protobuf:"bytes,15,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` LastStoreHeight uint64 `protobuf:"varint,16,opt,name=last_store_height,json=lastStoreHeight,proto3" json:"last_store_height,omitempty"` BaseHeight uint64 `protobuf:"varint,17,opt,name=base_height,json=baseHeight,proto3" json:"base_height,omitempty"` + SequencerSet SequencerSet `protobuf:"bytes,18,opt,name=sequencerSet,proto3" json:"sequencerSet"` + RollappParams RollappParams `protobuf:"bytes,19,opt,name=rollapp_params,json=rollappParams,proto3" json:"rollapp_params"` } func (m *State) Reset() { *m = State{} } @@ -124,13 +124,7 @@ func (m *State) GetLastBlockTime() time.Time { return time.Time{} } -func (m *State) GetNextValidators() *types.ValidatorSet { - if m != nil { - return m.NextValidators - } - return nil -} - +// Deprecated: Do not use. func (m *State) GetValidators() *types.ValidatorSet { if m != nil { return m.Validators @@ -138,13 +132,6 @@ func (m *State) GetValidators() *types.ValidatorSet { return nil } -func (m *State) GetLastValidators() *types.ValidatorSet { - if m != nil { - return m.LastValidators - } - return nil -} - func (m *State) GetLastHeightValidatorsChanged() int64 { if m != nil { return m.LastHeightValidatorsChanged @@ -194,53 +181,127 @@ func (m *State) GetBaseHeight() uint64 { return 0 } +func (m *State) GetSequencerSet() SequencerSet { + if m != nil { + return m.SequencerSet + } + return SequencerSet{} +} + +func (m *State) GetRollappParams() RollappParams { + if m != nil { + return m.RollappParams + } + return RollappParams{} +} + +//rollapp params defined in genesis and updated via gov proposal +type RollappParams struct { + //data availability type (e.g. celestia) used in the rollapp + Da string `protobuf:"bytes,1,opt,name=da,proto3" json:"da,omitempty"` + //commit used for the rollapp executable + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *RollappParams) Reset() { *m = RollappParams{} } +func (m *RollappParams) String() string { return proto.CompactTextString(m) } +func (*RollappParams) ProtoMessage() {} +func (*RollappParams) Descriptor() ([]byte, []int) { + return fileDescriptor_4b679420add07272, []int{1} +} +func (m *RollappParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollappParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollappParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RollappParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappParams.Merge(m, src) +} +func (m *RollappParams) XXX_Size() int { + return m.Size() +} +func (m *RollappParams) XXX_DiscardUnknown() { + xxx_messageInfo_RollappParams.DiscardUnknown(m) +} + +var xxx_messageInfo_RollappParams proto.InternalMessageInfo + +func (m *RollappParams) GetDa() string { + if m != nil { + return m.Da + } + return "" +} + +func (m *RollappParams) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + func init() { proto.RegisterType((*State)(nil), "dymint.State") + proto.RegisterType((*RollappParams)(nil), "dymint.RollappParams") } func init() { proto.RegisterFile("types/dymint/state.proto", fileDescriptor_4b679420add07272) } var fileDescriptor_4b679420add07272 = []byte{ - // 617 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcd, 0x6e, 0x9b, 0x40, - 0x14, 0x85, 0x4d, 0xe3, 0xc4, 0xce, 0x38, 0x0e, 0x09, 0xe9, 0x82, 0xa4, 0x12, 0x90, 0xf4, 0x47, - 0x56, 0x17, 0x20, 0x35, 0xfb, 0x56, 0x22, 0x91, 0x6a, 0x57, 0x51, 0x55, 0xe1, 0x2a, 0x8b, 0x6e, - 0xd0, 0x00, 0x53, 0x18, 0x15, 0x33, 0x88, 0x19, 0x47, 0x71, 0x9f, 0x22, 0x4f, 0xd3, 0x67, 0xc8, - 0x32, 0xcb, 0xae, 0xdc, 0xca, 0x7e, 0x91, 0x6a, 0x66, 0x00, 0xd3, 0x58, 0x96, 0xb2, 0x33, 0xe7, - 0x7e, 0xf7, 0x70, 0x86, 0x7b, 0x3d, 0x40, 0x67, 0xb3, 0x1c, 0x51, 0x27, 0x9a, 0x4d, 0x70, 0xc6, - 0x1c, 0xca, 0x20, 0x43, 0x76, 0x5e, 0x10, 0x46, 0xb4, 0x1d, 0xa9, 0x9d, 0x3c, 0x8f, 0x49, 0x4c, - 0x84, 0xe4, 0xf0, 0x5f, 0xb2, 0x7a, 0x62, 0xc6, 0x84, 0xc4, 0x29, 0x72, 0xc4, 0x53, 0x30, 0xfd, - 0xee, 0x30, 0x3c, 0x41, 0x94, 0xc1, 0x49, 0x5e, 0x02, 0xa7, 0xd2, 0x98, 0xa1, 0x2c, 0x42, 0x85, - 0x30, 0x87, 0x41, 0x88, 0x1d, 0xa1, 0x96, 0xc8, 0xd9, 0x1a, 0x52, 0x0a, 0x0d, 0xe6, 0xcd, 0x06, - 0xe6, 0x06, 0xa6, 0x38, 0x82, 0x8c, 0x14, 0x25, 0xf7, 0x72, 0x03, 0x97, 0xc3, 0x02, 0x4e, 0x36, - 0xbf, 0x50, 0x1c, 0xb8, 0xf9, 0xc2, 0xb3, 0x5f, 0x1d, 0xb0, 0x3d, 0xe6, 0xaa, 0x76, 0x0e, 0x3a, - 0x37, 0xa8, 0xa0, 0x98, 0x64, 0xba, 0x62, 0x29, 0x83, 0xde, 0xbb, 0x63, 0x7b, 0xd5, 0x69, 0xcb, - 0x4f, 0x75, 0x2d, 0x01, 0xaf, 0x22, 0xb5, 0x63, 0xd0, 0x0d, 0x13, 0x88, 0x33, 0x1f, 0x47, 0xfa, - 0x33, 0x4b, 0x19, 0xec, 0x7a, 0x1d, 0xf1, 0x3c, 0x8a, 0xb4, 0xd7, 0x60, 0x1f, 0x67, 0x98, 0x61, - 0x98, 0xfa, 0x09, 0xc2, 0x71, 0xc2, 0xf4, 0x2d, 0x4b, 0x19, 0x6c, 0x79, 0xfd, 0x52, 0x1d, 0x0a, - 0x51, 0x7b, 0x0b, 0x0e, 0x53, 0x48, 0x99, 0x1f, 0xa4, 0x24, 0xfc, 0x51, 0x91, 0x6d, 0x41, 0xaa, - 0xbc, 0xe0, 0x72, 0xbd, 0x64, 0x3d, 0xd0, 0x6f, 0xb0, 0x38, 0xd2, 0xb7, 0xd7, 0x83, 0xca, 0xc3, - 0x89, 0xae, 0xd1, 0xa5, 0x7b, 0x74, 0x3f, 0x37, 0x5b, 0x8b, 0xb9, 0xd9, 0xbb, 0xaa, 0xac, 0x46, - 0x97, 0x5e, 0xaf, 0xf6, 0x1d, 0x45, 0xda, 0x15, 0x50, 0x1b, 0x9e, 0x7c, 0xac, 0xfa, 0x8e, 0x70, - 0x3d, 0xb1, 0xe5, 0xcc, 0xed, 0x6a, 0xe6, 0xf6, 0xd7, 0x6a, 0xe6, 0x6e, 0x97, 0xdb, 0xde, 0xfd, - 0x31, 0x15, 0xaf, 0x5f, 0x7b, 0xf1, 0xaa, 0xf6, 0x11, 0xa8, 0x19, 0xba, 0x65, 0x7e, 0x3d, 0x2f, - 0xaa, 0x77, 0x85, 0x9b, 0xb1, 0x9e, 0xf1, 0xba, 0x62, 0xc6, 0x88, 0x79, 0xfb, 0xbc, 0xad, 0x56, - 0xa8, 0xf6, 0x1e, 0x80, 0x86, 0xc7, 0xee, 0x93, 0x3c, 0x1a, 0x1d, 0x3c, 0x88, 0x38, 0x56, 0xc3, - 0x04, 0x3c, 0x2d, 0x08, 0x6f, 0x6b, 0x04, 0xb9, 0x00, 0x86, 0x30, 0x92, 0x93, 0x69, 0xf8, 0xf9, - 0x61, 0x02, 0xb3, 0x18, 0x45, 0x7a, 0x4f, 0x0c, 0xeb, 0x05, 0xa7, 0xe4, 0x9c, 0x56, 0xdd, 0x17, - 0x12, 0xd1, 0x3c, 0x70, 0x10, 0x92, 0x8c, 0xa2, 0x8c, 0x4e, 0xa9, 0x2f, 0x77, 0x54, 0xdf, 0x13, - 0x71, 0x4e, 0xd7, 0xe3, 0x5c, 0x54, 0xe4, 0x17, 0x01, 0xba, 0x6d, 0xfe, 0xb1, 0x3d, 0x35, 0xfc, - 0x5f, 0xd6, 0x3e, 0x83, 0x57, 0xcd, 0x60, 0x8f, 0xfd, 0xeb, 0x78, 0x7d, 0x11, 0xcf, 0x5a, 0xc5, - 0x7b, 0xe4, 0x5f, 0x65, 0xac, 0x16, 0xb1, 0x40, 0x74, 0x9a, 0x32, 0xea, 0x27, 0x90, 0x26, 0xfa, - 0xbe, 0xa5, 0x0c, 0xf6, 0xe4, 0x22, 0x7a, 0x52, 0x1f, 0x42, 0x9a, 0xf0, 0xb5, 0x87, 0x79, 0x2e, - 0x11, 0x55, 0x20, 0x1d, 0x98, 0xe7, 0xa2, 0xf4, 0xa1, 0xb4, 0xa1, 0x8c, 0x14, 0xa8, 0xda, 0xe7, - 0x03, 0x4b, 0x19, 0xb4, 0xdd, 0xa3, 0xc5, 0xdc, 0x54, 0xf9, 0x22, 0x8e, 0x79, 0x4d, 0x86, 0x91, - 0xde, 0x0d, 0x41, 0x33, 0x41, 0x2f, 0x80, 0xb4, 0x6e, 0x3d, 0xe4, 0xad, 0x1e, 0xe0, 0x92, 0x04, - 0x3e, 0xb5, 0xbb, 0x9d, 0x83, 0xae, 0x3b, 0xbc, 0x5f, 0x18, 0xca, 0xc3, 0xc2, 0x50, 0xfe, 0x2e, - 0x0c, 0xe5, 0x6e, 0x69, 0xb4, 0x1e, 0x96, 0x46, 0xeb, 0xf7, 0xd2, 0x68, 0x7d, 0xb3, 0x63, 0xcc, - 0x92, 0x69, 0x60, 0x87, 0x64, 0xc2, 0x2f, 0x3a, 0x94, 0xf1, 0x7f, 0xea, 0xed, 0xec, 0x67, 0x75, - 0xeb, 0x95, 0x37, 0x45, 0x50, 0x3e, 0x07, 0x3b, 0x62, 0xc1, 0xcf, 0xff, 0x05, 0x00, 0x00, 0xff, - 0xff, 0xaf, 0x47, 0xf8, 0xdf, 0x1c, 0x05, 0x00, 0x00, + // 685 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0xcb, 0x4e, 0xdb, 0x4c, + 0x14, 0xc7, 0xe3, 0x10, 0x88, 0x33, 0x21, 0x17, 0x06, 0x3e, 0xc9, 0xf0, 0x49, 0x4e, 0xe0, 0xbb, + 0x28, 0xea, 0xc2, 0x91, 0xca, 0xaa, 0x9b, 0x56, 0x32, 0x2c, 0x08, 0x42, 0x55, 0xe5, 0x54, 0x2c, + 0xba, 0xb1, 0xc6, 0xf6, 0xd4, 0x1e, 0xd5, 0xf1, 0xb8, 0x9e, 0x09, 0x2a, 0x7d, 0x0a, 0x1e, 0xa7, + 0x8f, 0xc0, 0x92, 0x65, 0x57, 0xb4, 0x0a, 0x2f, 0x52, 0xcd, 0xc5, 0x89, 0x43, 0xc4, 0x2a, 0x99, + 0xff, 0xf9, 0xcd, 0xdf, 0x67, 0xce, 0x39, 0x33, 0xc0, 0xe2, 0xb7, 0x39, 0x66, 0xe3, 0xe8, 0x76, + 0x46, 0x32, 0x3e, 0x66, 0x1c, 0x71, 0xec, 0xe4, 0x05, 0xe5, 0x14, 0xee, 0x28, 0xed, 0xe8, 0x20, + 0xa6, 0x31, 0x95, 0xd2, 0x58, 0xfc, 0x53, 0xd1, 0xa3, 0x41, 0x4c, 0x69, 0x9c, 0xe2, 0xb1, 0x5c, + 0x05, 0xf3, 0xcf, 0x63, 0x4e, 0x66, 0x98, 0x71, 0x34, 0xcb, 0x35, 0x70, 0xac, 0x8c, 0x39, 0xce, + 0x22, 0x5c, 0x48, 0x73, 0x14, 0x84, 0x64, 0x2c, 0x55, 0x8d, 0x9c, 0x6c, 0x20, 0x5a, 0xa8, 0x30, + 0xff, 0xbf, 0xc0, 0xdc, 0xa0, 0x94, 0x44, 0x88, 0xd3, 0x42, 0x73, 0xff, 0xbc, 0xc0, 0xe5, 0xa8, + 0x40, 0xb3, 0x97, 0x3f, 0x28, 0x0f, 0xbc, 0xf6, 0xc1, 0xc3, 0xb5, 0x82, 0xa8, 0x1f, 0x15, 0x3a, + 0xf9, 0xd1, 0x04, 0xdb, 0x53, 0xb1, 0x01, 0x9e, 0x82, 0xe6, 0x0d, 0x2e, 0x18, 0xa1, 0x99, 0x65, + 0x0c, 0x8d, 0x51, 0xfb, 0xf5, 0xa1, 0xb3, 0x32, 0x75, 0x54, 0x15, 0xaf, 0x15, 0xe0, 0x95, 0x24, + 0x3c, 0x04, 0x66, 0x98, 0x20, 0x92, 0xf9, 0x24, 0xb2, 0xea, 0x43, 0x63, 0xd4, 0xf2, 0x9a, 0x72, + 0x3d, 0x89, 0xe0, 0x7f, 0xa0, 0x4b, 0x32, 0xc2, 0x09, 0x4a, 0xfd, 0x04, 0x93, 0x38, 0xe1, 0xd6, + 0xd6, 0xd0, 0x18, 0x6d, 0x79, 0x1d, 0xad, 0x5e, 0x48, 0x11, 0xbe, 0x02, 0x7b, 0x29, 0x62, 0xdc, + 0x0f, 0x52, 0x1a, 0x7e, 0x29, 0xc9, 0x86, 0x24, 0x7b, 0x22, 0xe0, 0x0a, 0x5d, 0xb3, 0x1e, 0xe8, + 0x54, 0x58, 0x12, 0x59, 0xdb, 0x9b, 0x89, 0xaa, 0x73, 0xcb, 0x5d, 0x93, 0x73, 0x77, 0xff, 0xfe, + 0x71, 0x50, 0x5b, 0x3c, 0x0e, 0xda, 0x57, 0xa5, 0xd5, 0xe4, 0xdc, 0x6b, 0x2f, 0x7d, 0x27, 0x11, + 0xbc, 0x02, 0xbd, 0x8a, 0xa7, 0xe8, 0xb8, 0xb5, 0x23, 0x5d, 0x8f, 0x1c, 0x35, 0x0e, 0x4e, 0x39, + 0x0e, 0xce, 0xc7, 0x72, 0x1c, 0x5c, 0x53, 0xd8, 0xde, 0xfd, 0x1a, 0x18, 0x5e, 0x67, 0xe9, 0x25, + 0xa2, 0xd0, 0x05, 0x60, 0xd9, 0x45, 0x66, 0xb5, 0xa4, 0x91, 0xbd, 0x99, 0xde, 0x75, 0xc9, 0x4c, + 0x31, 0x77, 0xeb, 0x96, 0xe1, 0x55, 0x76, 0xc1, 0x33, 0x60, 0xcb, 0x8c, 0x54, 0x2d, 0xfc, 0x55, + 0xc4, 0x0f, 0x13, 0x94, 0xc5, 0x38, 0xb2, 0xda, 0xb2, 0x3c, 0x7f, 0x0b, 0x4a, 0x55, 0x66, 0xe9, + 0xc7, 0xce, 0x14, 0x02, 0x3d, 0xd0, 0x0f, 0x69, 0xc6, 0x70, 0xc6, 0xe6, 0xcc, 0x57, 0x03, 0x63, + 0xed, 0xca, 0x74, 0x8e, 0x37, 0xd3, 0x39, 0x2b, 0xc9, 0x0f, 0x12, 0x74, 0x1b, 0xe2, 0x78, 0x5e, + 0x2f, 0x5c, 0x97, 0xe1, 0x7b, 0xf0, 0x6f, 0x35, 0xb1, 0xe7, 0xfe, 0xcb, 0xf4, 0x3a, 0x32, 0xbd, + 0xe1, 0x2a, 0xbd, 0x67, 0xfe, 0x65, 0x8e, 0x65, 0xeb, 0x0b, 0xcc, 0xe6, 0x29, 0x67, 0x7e, 0x82, + 0x58, 0x62, 0x75, 0x87, 0xc6, 0x68, 0x57, 0xb5, 0xde, 0x53, 0xfa, 0x05, 0x62, 0x89, 0x18, 0x34, + 0x94, 0xe7, 0x0a, 0xe9, 0x49, 0xa4, 0x89, 0xf2, 0x5c, 0x86, 0xde, 0x69, 0x1b, 0xc6, 0x69, 0x81, + 0xcb, 0x09, 0xea, 0x0f, 0x8d, 0x51, 0xc3, 0xdd, 0x5f, 0x3c, 0x0e, 0x7a, 0xa2, 0xf5, 0x53, 0x11, + 0x53, 0xc9, 0x28, 0xef, 0x8a, 0x00, 0x07, 0xa0, 0x1d, 0x20, 0xb6, 0xdc, 0xba, 0x27, 0xb6, 0x7a, + 0x40, 0x48, 0x1a, 0x78, 0x0b, 0x76, 0x19, 0xfe, 0x3a, 0xc7, 0x59, 0x88, 0x45, 0xc7, 0x2c, 0x28, + 0x0b, 0x79, 0xe0, 0xe8, 0x9b, 0x34, 0xad, 0xc4, 0x74, 0xed, 0xd6, 0x78, 0xe8, 0x82, 0x6e, 0x41, + 0xd3, 0x54, 0x1c, 0x40, 0xb7, 0x62, 0x5f, 0x3a, 0xfc, 0x55, 0x3a, 0x78, 0x2a, 0xba, 0x56, 0xfe, + 0x4e, 0x51, 0x15, 0x2f, 0x1b, 0x66, 0xb3, 0x6f, 0x5e, 0x36, 0x4c, 0xb3, 0xdf, 0xba, 0x6c, 0x98, + 0xa0, 0xdf, 0x3e, 0x79, 0x03, 0x3a, 0x6b, 0xfb, 0x60, 0x17, 0xd4, 0x23, 0x24, 0x2f, 0x6f, 0xcb, + 0xab, 0x47, 0x08, 0x5a, 0xab, 0x1b, 0xad, 0xef, 0xa6, 0x5e, 0xba, 0x17, 0xf7, 0x0b, 0xdb, 0x78, + 0x58, 0xd8, 0xc6, 0xef, 0x85, 0x6d, 0xdc, 0x3d, 0xd9, 0xb5, 0x87, 0x27, 0xbb, 0xf6, 0xf3, 0xc9, + 0xae, 0x7d, 0x72, 0x62, 0xc2, 0x93, 0x79, 0xe0, 0x84, 0x74, 0x26, 0x1e, 0x0a, 0x9c, 0x09, 0xfe, + 0xdb, 0xed, 0xf7, 0xf2, 0xf1, 0xd0, 0x2f, 0x50, 0xa0, 0xd7, 0xc1, 0x8e, 0xbc, 0x1d, 0xa7, 0x7f, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x4d, 0xfd, 0x88, 0x74, 0x05, 0x00, 0x00, } func (m *State) Marshal() (dAtA []byte, err error) { @@ -263,6 +324,30 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.RollappParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + { + size, err := m.SequencerSet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 if m.BaseHeight != 0 { i = encodeVarintState(dAtA, i, uint64(m.BaseHeight)) i-- @@ -311,18 +396,6 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x58 } - if m.LastValidators != nil { - { - size, err := m.LastValidators.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintState(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } if m.Validators != nil { { size, err := m.Validators.MarshalToSizedBuffer(dAtA[:i]) @@ -335,18 +408,6 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x4a } - if m.NextValidators != nil { - { - size, err := m.NextValidators.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintState(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) if err5 != nil { return 0, err5 @@ -397,6 +458,43 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RollappParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RollappParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollappParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintState(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if len(m.Da) > 0 { + i -= len(m.Da) + copy(dAtA[i:], m.Da) + i = encodeVarintState(dAtA, i, uint64(len(m.Da))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintState(dAtA []byte, offset int, v uint64) int { offset -= sovState(v) base := offset @@ -432,18 +530,10 @@ func (m *State) Size() (n int) { n += 1 + l + sovState(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime) n += 1 + l + sovState(uint64(l)) - if m.NextValidators != nil { - l = m.NextValidators.Size() - n += 1 + l + sovState(uint64(l)) - } if m.Validators != nil { l = m.Validators.Size() n += 1 + l + sovState(uint64(l)) } - if m.LastValidators != nil { - l = m.LastValidators.Size() - n += 1 + l + sovState(uint64(l)) - } if m.LastHeightValidatorsChanged != 0 { n += 1 + sovState(uint64(m.LastHeightValidatorsChanged)) } @@ -466,6 +556,27 @@ func (m *State) Size() (n int) { if m.BaseHeight != 0 { n += 2 + sovState(uint64(m.BaseHeight)) } + l = m.SequencerSet.Size() + n += 2 + l + sovState(uint64(l)) + l = m.RollappParams.Size() + n += 2 + l + sovState(uint64(l)) + return n +} + +func (m *RollappParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Da) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } return n } @@ -676,42 +787,6 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextValidators", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthState - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NextValidators == nil { - m.NextValidators = &types.ValidatorSet{} - } - if err := m.NextValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) @@ -748,42 +823,6 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastValidators", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthState - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LastValidators == nil { - m.LastValidators = &types.ValidatorSet{} - } - if err := m.LastValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LastHeightValidatorsChanged", wireType) @@ -961,6 +1000,186 @@ func (m *State) Unmarshal(dAtA []byte) error { break } } + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequencerSet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SequencerSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RollappParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RollappParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RollappParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollappParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Da", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Da = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipState(dAtA[iNdEx:]) diff --git a/types/sequencer.go b/types/sequencer.go deleted file mode 100644 index 95aec1278..000000000 --- a/types/sequencer.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import crypto "github.com/cosmos/cosmos-sdk/crypto/types" - -// TODO: remove this, as we can use the sequencers objects directly - -// SequencerStatus defines the operating status of a sequencer -type SequencerStatus int32 - -const ( - // Proposer defines a sequencer that is currently the proposer - Proposer SequencerStatus = iota - // Inactive defines a sequencer that is currently inactive - Inactive -) - -// Sequencer represents a sequencer of the rollapp -type Sequencer struct { - // PublicKey is the public key of the sequencer - PublicKey crypto.PubKey - // Status is status of the sequencer - Status SequencerStatus -} diff --git a/types/sequencer_set.go b/types/sequencer_set.go new file mode 100644 index 000000000..45ab8447b --- /dev/null +++ b/types/sequencer_set.go @@ -0,0 +1,164 @@ +package types + +import ( + "bytes" + "fmt" + + tmcrypto "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/types" +) + +// sequencer is a struct that holds the sequencer's settlement address and tendermint validator +// it's populated from the SL client +// uses tendermint's validator types for compatibility +type Sequencer struct { + // SettlementAddress is the address of the sequencer in the settlement layer (bech32 string) + SettlementAddress string `json:"settlement_address"` + // tendermint validator type for compatibility. holds the public key and cons address + val types.Validator +} + +func NewSequencer(pubKey tmcrypto.PubKey, settlementAddress string) *Sequencer { + if pubKey == nil { + return nil + } + return &Sequencer{ + SettlementAddress: settlementAddress, + val: *types.NewValidator(pubKey, 1), + } +} + +// IsEmpty returns true if the sequencer is empty +// we check if the pubkey is nil +func (s Sequencer) IsEmpty() bool { + return s.val.PubKey == nil +} + +func (s Sequencer) TMValidator() (*types.Validator, error) { + return &s.val, nil +} + +func (s Sequencer) ConsAddress() string { + return s.val.Address.String() +} + +func (s Sequencer) PubKey() tmcrypto.PubKey { + return s.val.PubKey +} + +// Hash returns tendermint compatible hash of the sequencer +func (s Sequencer) Hash() []byte { + tempProposerSet := types.NewValidatorSet([]*types.Validator{&s.val}) + return tempProposerSet.Hash() +} + +// SequencerSet is a set of rollapp sequencers and a proposer. +type SequencerSet struct { + // Sequencers is the set of sequencers registered in the settlement layer + // it holds the entire set of sequencers, including unbonded sequencers + Sequencers []Sequencer `json:"sequencers"` + // Proposer is the sequencer that is the proposer for the current sequencer set + // can be nil if no proposer is set + // proposer is also included in the sequencers set + Proposer *Sequencer `json:"proposer"` +} + +func (s *SequencerSet) GetProposerPubKey() tmcrypto.PubKey { + if s.Proposer == nil { + return nil + } + return s.Proposer.PubKey() +} + +// ProposerHash returns the hash of the proposer +func (s *SequencerSet) ProposerHash() []byte { + if s.Proposer == nil { + return make([]byte, 0, 32) + } + return s.Proposer.Hash() +} + +// SetProposerByHash sets the proposer by hash. +// It returns an error if the hash is not found in the sequencer set +// Used when updating proposer from the L2 blocks (nextSequencerHash header field) +func (s *SequencerSet) SetProposerByHash(hash []byte) error { + for _, seq := range s.Sequencers { + if bytes.Equal(seq.Hash(), hash) { + s.SetProposer(&seq) + return nil + } + } + // can't find the proposer in the sequencer set + // can happen in cases where the node is not synced with the SL and the sequencer array in the set is not updated + return ErrMissingProposerPubKey +} + +// SetProposer sets the proposer and adds it to the sequencer set if not already present. +func (s *SequencerSet) SetProposer(proposer *Sequencer) { + if proposer == nil { + s.Proposer = nil + return + } + s.Proposer = proposer + + // Add proposer to bonded set if not already present + // can happen in cases where the node is not synced with the SL and the sequencer array in the set is not updated + if s.GetByConsAddress(proposer.val.Address) == nil { + s.Sequencers = append(s.Sequencers, *proposer) + } +} + +// SetSequencers sets the sequencers of the sequencer set. +func (s *SequencerSet) SetSequencers(sequencers []Sequencer) { + s.Sequencers = sequencers +} + +// GetByAddress returns the sequencer with the given settlement address. +// used when handling events from the settlement, where the settlement address is used +func (s *SequencerSet) GetByAddress(settlement_address string) *Sequencer { + for _, seq := range s.Sequencers { + if seq.SettlementAddress == settlement_address { + return &seq + } + } + return nil +} + +// GetByConsAddress returns the sequencer with the given consensus address. +func (s *SequencerSet) GetByConsAddress(cons_addr []byte) *Sequencer { + for _, seq := range s.Sequencers { + if bytes.Equal(seq.val.Address, cons_addr) { + return &seq + } + } + return nil +} + +func (s *SequencerSet) String() string { + return fmt.Sprintf("SequencerSet: %v", s.Sequencers) +} + +/* -------------------------- backward compatibility ------------------------- */ +// old dymint version used tendermint.ValidatorSet for sequencers +// these methods are used for backward compatibility +func NewSequencerFromValidator(val types.Validator) *Sequencer { + return &Sequencer{ + SettlementAddress: "", + val: val, + } +} + +// LoadFromValSet sets the sequencers from a tendermint validator set. +// used for backward compatibility. should be used only for queries (used by rpc/client) +func (s *SequencerSet) LoadFromValSet(valSet *types.ValidatorSet) { + if valSet == nil { + return + } + + sequencers := make([]Sequencer, len(valSet.Validators)) + for i, val := range valSet.Validators { + sequencers[i] = *NewSequencerFromValidator(*val) + } + s.SetSequencers(sequencers) + s.SetProposer(NewSequencerFromValidator(*valSet.Proposer)) +} diff --git a/types/serialization.go b/types/serialization.go index 0892c946b..1ccabd1ff 100644 --- a/types/serialization.go +++ b/types/serialization.go @@ -2,7 +2,9 @@ package types import ( "errors" + "fmt" + "github.com/dymensionxyz/gerr-cosmos/gerrc" abci "github.com/tendermint/tendermint/abci/types" prototypes "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" @@ -82,22 +84,20 @@ func (c *Commit) UnmarshalBinary(data []byte) error { // ToProto converts Header into protobuf representation and returns it. func (h *Header) ToProto() *pb.Header { return &pb.Header{ - Version: &pb.Version{ - Block: h.Version.Block, - App: h.Version.App, - }, - NamespaceId: h.NamespaceID[:], - Height: h.Height, - Time: h.Time, - ChainId: h.ChainID, - LastHeaderHash: h.LastHeaderHash[:], - LastCommitHash: h.LastCommitHash[:], - DataHash: h.DataHash[:], - ConsensusHash: h.ConsensusHash[:], - AppHash: h.AppHash[:], - LastResultsHash: h.LastResultsHash[:], - ProposerAddress: h.ProposerAddress[:], - SequencersHash: h.SequencersHash[:], + Version: &pb.Version{Block: h.Version.Block, App: h.Version.App}, + NamespaceId: []byte{}, + Height: h.Height, + Time: h.Time, + LastHeaderHash: h.LastHeaderHash[:], + LastCommitHash: h.LastCommitHash[:], + DataHash: h.DataHash[:], + ConsensusHash: h.ConsensusHash[:], + AppHash: h.AppHash[:], + LastResultsHash: h.LastResultsHash[:], + ProposerAddress: h.ProposerAddress[:], + SequencerHash: h.SequencerHash[:], + NextSequencerHash: h.NextSequencersHash[:], + ChainId: h.ChainID, } } @@ -106,9 +106,6 @@ func (h *Header) FromProto(other *pb.Header) error { h.Version.Block = other.Version.Block h.Version.App = other.Version.App h.ChainID = other.ChainId - if !safeCopy(h.NamespaceID[:], other.NamespaceId) { - return errors.New("invalid length of 'NamespaceId'") - } h.Height = other.Height h.Time = other.Time if !safeCopy(h.LastHeaderHash[:], other.LastHeaderHash) { @@ -129,7 +126,10 @@ func (h *Header) FromProto(other *pb.Header) error { if !safeCopy(h.LastResultsHash[:], other.LastResultsHash) { return errors.New("invalid length of 'LastResultsHash'") } - if !safeCopy(h.SequencersHash[:], other.SequencersHash) { + if !safeCopy(h.SequencerHash[:], other.SequencerHash) { + return errors.New("invalid length of 'SequencerHash'") + } + if !safeCopy(h.NextSequencersHash[:], other.NextSequencerHash) { return errors.New("invalid length of 'SequencersHash'") } if len(other.ProposerAddress) > 0 { @@ -162,8 +162,8 @@ func (b *Block) ToProto() *pb.Block { // ToProto converts Batch into protobuf representation and returns it. func (b *Batch) ToProto() *pb.Batch { return &pb.Batch{ - StartHeight: b.StartHeight, - EndHeight: b.EndHeight, + StartHeight: b.StartHeight(), + EndHeight: b.EndHeight(), Blocks: blocksToProto(b.Blocks), Commits: commitsToProto(b.Commits), } @@ -199,8 +199,15 @@ func (b *Block) FromProto(other *pb.Block) error { // FromProto fills Batch with data from its protobuf representation. func (b *Batch) FromProto(other *pb.Batch) error { - b.StartHeight = other.StartHeight - b.EndHeight = other.EndHeight + n := len(other.Blocks) + start := other.StartHeight + end := other.EndHeight + if 0 < n && start != other.Blocks[0].Header.GetHeight() { + return fmt.Errorf("start height does not match first block height: %w", gerrc.ErrInvalidArgument) + } + if 0 < n && end != other.Blocks[n-1].Header.GetHeight() { + return fmt.Errorf("end height does not match last block height: %w", gerrc.ErrInvalidArgument) + } b.Blocks = protoToBlocks(other.Blocks) b.Commits = protoToCommits(other.Commits) return nil @@ -243,11 +250,7 @@ func (c *Commit) FromProto(other *pb.Commit) error { // ToProto converts State into protobuf representation and returns it. func (s *State) ToProto() (*pb.State, error) { - nextValidators, err := s.NextValidators.ToProto() - if err != nil { - return nil, err - } - validators, err := s.Validators.ToProto() + seqsProto, err := s.Sequencers.ToProto() if err != nil { return nil, err } @@ -256,15 +259,14 @@ func (s *State) ToProto() (*pb.State, error) { Version: &s.Version, ChainId: s.ChainID, InitialHeight: int64(s.InitialHeight), - LastBlockHeight: int64(s.LastBlockHeight.Load()), - NextValidators: nextValidators, - Validators: validators, + LastBlockHeight: int64(s.Height()), + SequencerSet: *seqsProto, BaseHeight: s.BaseHeight, - LastHeightValidatorsChanged: s.LastHeightValidatorsChanged, ConsensusParams: s.ConsensusParams, LastHeightConsensusParamsChanged: s.LastHeightConsensusParamsChanged, LastResultsHash: s.LastResultsHash[:], AppHash: s.AppHash[:], + RollappParams: s.RollappParams, }, nil } @@ -274,23 +276,76 @@ func (s *State) FromProto(other *pb.State) error { s.Version = *other.Version s.ChainID = other.ChainId s.InitialHeight = uint64(other.InitialHeight) - s.LastBlockHeight.Store(uint64(other.LastBlockHeight)) + s.SetHeight(uint64(other.LastBlockHeight)) s.BaseHeight = other.BaseHeight - s.NextValidators, err = types.ValidatorSetFromProto(other.NextValidators) + err = s.Sequencers.FromProto(other.SequencerSet) if err != nil { return err } - s.Validators, err = types.ValidatorSetFromProto(other.Validators) - if err != nil { - return err - } - s.LastHeightValidatorsChanged = other.LastHeightValidatorsChanged + s.ConsensusParams = other.ConsensusParams s.LastHeightConsensusParamsChanged = other.LastHeightConsensusParamsChanged copy(s.LastResultsHash[:], other.LastResultsHash) copy(s.AppHash[:], other.AppHash) + s.RollappParams = other.RollappParams + return nil +} + +// ToProto converts SequencerSet into protobuf representation and returns it. +func (s *SequencerSet) ToProto() (*pb.SequencerSet, error) { + protoSet := new(pb.SequencerSet) + + seqsProto := make([]*pb.Sequencer, len(s.Sequencers)) + for i := 0; i < len(s.Sequencers); i++ { + valp, err := s.Sequencers[i].val.ToProto() + if err != nil { + return nil, fmt.Errorf("ToProto: SequencerSet: %w", err) + } + seq := new(pb.Sequencer) + seq.SettlementAddress = s.Sequencers[i].SettlementAddress + seq.Validator = valp + seqsProto[i] = seq + } + protoSet.Sequencers = seqsProto + + if s.Proposer != nil { + valp, err := s.Proposer.val.ToProto() + if err != nil { + return nil, fmt.Errorf("ToProto: SequencerSet: %w", err) + } + seq := new(pb.Sequencer) + seq.Validator = valp + seq.SettlementAddress = s.Proposer.SettlementAddress + protoSet.Proposer = seq + } + + return protoSet, nil +} + +// FromProto fills SequencerSet with data from its protobuf representation. +func (s *SequencerSet) FromProto(protoSet pb.SequencerSet) error { + seqs := make([]Sequencer, len(protoSet.Sequencers)) + for i, seqProto := range protoSet.Sequencers { + val, err := types.ValidatorFromProto(seqProto.Validator) + if err != nil { + return fmt.Errorf("fromProto: SequencerSet: %w", err) + } + seqs[i].val = *val + seqs[i].SettlementAddress = seqProto.SettlementAddress + } + s.Sequencers = seqs + if protoSet.Proposer != nil { + valProposer, err := types.ValidatorFromProto(protoSet.Proposer.Validator) + if err != nil { + return fmt.Errorf("fromProto: SequencerSet proposer: %w", err) + } + proposer := new(Sequencer) + proposer.val = *valProposer + proposer.SettlementAddress = protoSet.Proposer.SettlementAddress + s.Proposer = proposer + } return nil } @@ -323,7 +378,7 @@ func evidenceToProto(evidence EvidenceData) []*abci.Evidence { return ret } -func evidenceFromProto(evidence []*abci.Evidence) EvidenceData { +func evidenceFromProto([]*abci.Evidence) EvidenceData { var ret EvidenceData // TODO(tzdybal): right now Evidence is just an interface without implementations return ret diff --git a/types/serialization_test.go b/types/serialization_test.go index 355aaa95c..ca1218c2e 100644 --- a/types/serialization_test.go +++ b/types/serialization_test.go @@ -7,14 +7,14 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - tmtypes "github.com/tendermint/tendermint/types" + "github.com/dymensionxyz/dymint/testutil" "github.com/dymensionxyz/dymint/types" pb "github.com/dymensionxyz/dymint/types/pb/dymint" + "github.com/dymensionxyz/dymint/version" ) func TestBlockSerializationRoundTrip(t *testing.T) { @@ -43,17 +43,16 @@ func TestBlockSerializationRoundTrip(t *testing.T) { Block: 1, App: 2, }, - NamespaceID: [8]byte{0, 1, 2, 3, 4, 5, 6, 7}, - Height: 3, - Time: 4567, - LastHeaderHash: h[0], - LastCommitHash: h[1], - DataHash: h[2], - ConsensusHash: h[3], - AppHash: h[4], - LastResultsHash: h[5], - ProposerAddress: []byte{4, 3, 2, 1}, - SequencersHash: h[6], + Height: 3, + Time: 4567, + LastHeaderHash: h[0], + LastCommitHash: h[1], + DataHash: h[2], + ConsensusHash: h[3], + AppHash: h[4], + LastResultsHash: h[5], + ProposerAddress: []byte{4, 3, 2, 1}, + NextSequencersHash: h[6], }, Data: types.Data{ Txs: nil, @@ -88,7 +87,7 @@ func TestBlockSerializationRoundTrip(t *testing.T) { func TestStateRoundTrip(t *testing.T) { t.Parallel() - valSet := getRandomValidatorSet() + valSet := testutil.GenerateRandomValidatorSet() cases := []struct { name string @@ -97,8 +96,6 @@ func TestStateRoundTrip(t *testing.T) { { "with max bytes", types.State{ - Validators: valSet, - NextValidators: valSet, ConsensusParams: tmproto.ConsensusParams{ Block: tmproto.BlockParams{ MaxBytes: 123, @@ -118,11 +115,8 @@ func TestStateRoundTrip(t *testing.T) { }, Software: "dymint", }, - ChainID: "testchain", - InitialHeight: 987, - NextValidators: valSet, - Validators: valSet, - LastHeightValidatorsChanged: 8272, + ChainID: "testchain", + InitialHeight: 987, ConsensusParams: tmproto.ConsensusParams{ Block: tmproto.BlockParams{ MaxBytes: 12345, @@ -141,6 +135,10 @@ func TestStateRoundTrip(t *testing.T) { AppVersion: 42, }, }, + RollappParams: pb.RollappParams{ + Da: "mock", + Version: version.Commit, + }, LastHeightConsensusParamsChanged: 12345, LastResultsHash: [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}, AppHash: [32]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1}, @@ -153,8 +151,10 @@ func TestStateRoundTrip(t *testing.T) { require := require.New(t) assert := assert.New(t) + c.state.Sequencers.LoadFromValSet(valSet) + if c.state.InitialHeight != 0 { - c.state.LastBlockHeight.Store(986321) + c.state.SetHeight(986321) } pState, err := c.state.ToProto() @@ -177,14 +177,3 @@ func TestStateRoundTrip(t *testing.T) { }) } } - -// copied from store_test.go -func getRandomValidatorSet() *tmtypes.ValidatorSet { - pubKey := ed25519.GenPrivKey().PubKey() - return &tmtypes.ValidatorSet{ - Proposer: &tmtypes.Validator{PubKey: pubKey, Address: pubKey.Address()}, - Validators: []*tmtypes.Validator{ - {PubKey: pubKey, Address: pubKey.Address()}, - }, - } -} diff --git a/types/state.go b/types/state.go index 8e7afc2d0..d4a6c87f0 100644 --- a/types/state.go +++ b/types/state.go @@ -1,15 +1,15 @@ package types import ( + "encoding/json" "fmt" "sync/atomic" // TODO(tzdybal): copy to local project? + + "github.com/dymensionxyz/dymint/types/pb/dymint" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/types" - "github.com/tendermint/tendermint/version" ) // State contains information about current state of the blockchain. @@ -26,9 +26,8 @@ type State struct { // BaseHeight is the height of the first block we have in store after pruning. BaseHeight uint64 - NextValidators *types.ValidatorSet - Validators *types.ValidatorSet - LastHeightValidatorsChanged int64 + // Sequencers is the set of sequencers that are currently active on the rollapp. + Sequencers SequencerSet // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. @@ -40,51 +39,19 @@ type State struct { // the latest AppHash we've received from calling abci.Commit() AppHash [32]byte -} - -// NewStateFromGenesis reads blockchain State from genesis. -func NewStateFromGenesis(genDoc *types.GenesisDoc) (*State, error) { - err := genDoc.ValidateAndComplete() - if err != nil { - return nil, fmt.Errorf("in genesis doc: %w", err) - } - - // InitStateVersion sets the Consensus.Block and Software versions, - // but leaves the Consensus.App version blank. - // The Consensus.App version will be set during the Handshake, once - // we hear from the app what protocol version it is running. - InitStateVersion := tmstate.Version{ - Consensus: tmversion.Consensus{ - Block: version.BlockProtocol, - App: 0, - }, - Software: version.TMCoreSemVer, - } - - s := State{ - Version: InitStateVersion, - ChainID: genDoc.ChainID, - InitialHeight: uint64(genDoc.InitialHeight), - - BaseHeight: uint64(genDoc.InitialHeight), - - NextValidators: types.NewValidatorSet(nil), - Validators: types.NewValidatorSet(nil), - LastHeightValidatorsChanged: genDoc.InitialHeight, - - ConsensusParams: *genDoc.ConsensusParams, - LastHeightConsensusParamsChanged: genDoc.InitialHeight, - } - s.LastBlockHeight.Store(0) - copy(s.AppHash[:], genDoc.AppHash) - return &s, nil + // New rollapp parameters . + RollappParams dymint.RollappParams } func (s *State) IsGenesis() bool { return s.Height() == 0 } +type RollappParams struct { + Params *dymint.RollappParams +} + // SetHeight sets the height saved in the Store if it is higher than the existing height // returns OK if the value was updated successfully or did not need to be updated func (s *State) SetHeight(height uint64) { @@ -103,3 +70,24 @@ func (s *State) NextHeight() uint64 { } return s.Height() + 1 } + +// SetRollappParamsFromGenesis sets the rollapp consensus params from genesis +func (s *State) SetRollappParamsFromGenesis(appState json.RawMessage) error { + var objmap map[string]json.RawMessage + err := json.Unmarshal(appState, &objmap) + if err != nil { + return err + } + params, ok := objmap["rollappparams"] + if !ok { + return fmt.Errorf("rollappparams not defined in genesis") + } + + var rollappParams RollappParams + err = json.Unmarshal(params, &rollappParams) + if err != nil { + return err + } + s.RollappParams = *rollappParams.Params + return nil +} diff --git a/types/validation.go b/types/validation.go index 8e84f68e1..100091807 100644 --- a/types/validation.go +++ b/types/validation.go @@ -5,15 +5,16 @@ import ( "errors" "fmt" + tmcrypto "github.com/tendermint/tendermint/crypto" tmtypes "github.com/tendermint/tendermint/types" ) -func ValidateProposedTransition(state *State, block *Block, commit *Commit, proposer *Sequencer) error { +func ValidateProposedTransition(state *State, block *Block, commit *Commit, proposerPubKey tmcrypto.PubKey) error { if err := block.ValidateWithState(state); err != nil { return fmt.Errorf("block: %w", err) } - if err := commit.ValidateWithHeader(proposer, &block.Header); err != nil { + if err := commit.ValidateWithHeader(proposerPubKey, &block.Header); err != nil { return fmt.Errorf("commit: %w", err) } return nil @@ -36,6 +37,9 @@ func (b *Block) ValidateBasic() error { return err } + if b.Header.DataHash != [32]byte(GetDataHash(b)) { + return ErrInvalidHeaderDataHash + } return nil } @@ -91,25 +95,18 @@ func (c *Commit) ValidateBasic() error { return nil } -// Validate performs full validation of a commit. -func (c *Commit) Validate(proposer *Sequencer, abciHeaderBytes []byte) error { +func (c *Commit) ValidateWithHeader(proposerPubKey tmcrypto.PubKey, header *Header) error { if err := c.ValidateBasic(); err != nil { return err } - if !proposer.PublicKey.VerifySignature(abciHeaderBytes, c.Signatures[0]) { - return ErrInvalidSignature - } - return nil -} - -func (c *Commit) ValidateWithHeader(proposer *Sequencer, header *Header) error { abciHeaderPb := ToABCIHeaderPB(header) abciHeaderBytes, err := abciHeaderPb.Marshal() if err != nil { return err } - if err = c.Validate(proposer, abciHeaderBytes); err != nil { - return err + // commit is validated to have single signature + if !proposerPubKey.VerifySignature(abciHeaderBytes, c.Signatures[0]) { + return ErrInvalidSignature } return nil } diff --git a/utils/atomic/funcs.go b/utils/atomic/funcs.go new file mode 100644 index 000000000..1812d0959 --- /dev/null +++ b/utils/atomic/funcs.go @@ -0,0 +1,15 @@ +package atomic + +import ( + "sync/atomic" +) + +/* +TODO: move to sdk-utils +*/ + +// Uint64Sub does x := x-y and returns the new value of x +func Uint64Sub(x *atomic.Uint64, y uint64) uint64 { + // Uses math + return x.Add(^(y - 1)) +} diff --git a/utils/atomic/funcs_test.go b/utils/atomic/funcs_test.go new file mode 100644 index 000000000..f0155893f --- /dev/null +++ b/utils/atomic/funcs_test.go @@ -0,0 +1,35 @@ +package atomic + +import ( + "flag" + "sync/atomic" + "testing" + + "github.com/stretchr/testify/require" + "pgregory.net/rapid" +) + +func TestUint64Sub(t *testing.T) { + _ = flag.Set("rapid.checks", "50") + _ = flag.Set("rapid.steps", "50") + + rapid.Check(t, func(r *rapid.T) { + exp := uint64(0) + got := atomic.Uint64{} + r.Repeat(map[string]func(r *rapid.T){ + "": func(r *rapid.T) { + require.Equal(t, exp, got.Load()) + }, + "add": func(r *rapid.T) { + d := rapid.Uint64().Draw(r, "d") + exp += d + got.Add(d) + }, + "sub": func(r *rapid.T) { + d := rapid.Uint64().Draw(r, "d") + exp -= d + Uint64Sub(&got, d) + }, + }) + }) +} diff --git a/utils/channel/funcs.go b/utils/channel/funcs.go new file mode 100644 index 000000000..614414a3f --- /dev/null +++ b/utils/channel/funcs.go @@ -0,0 +1,31 @@ +package channel + +// DrainForever will drain the channels in separate go routines in a loop forever +// Intended for tests only +func DrainForever[T any](chs ...<-chan T) { + for _, ch := range chs { + go func() { + for { + <-ch + } + }() + } +} + +// Nudger can be used to make a goroutine ('A') sleep, and have another goroutine ('B') wake him up +// A will not block if B is not asleep. +type Nudger struct { + C chan struct{} // Receive on C to sleep +} + +func NewNudger() *Nudger { + return &Nudger{make(chan struct{})} +} + +// Nudge wakes up the waiting thread if any. Non blocking. +func (w Nudger) Nudge() { + select { + case w.C <- struct{}{}: + default: + } +} diff --git a/utils/errors/err_group.go b/utils/errors/err_group.go new file mode 100644 index 000000000..c4d82409a --- /dev/null +++ b/utils/errors/err_group.go @@ -0,0 +1,24 @@ +package errors + +import ( + "github.com/dymensionxyz/dymint/types" + "golang.org/x/sync/errgroup" +) + +/* +TODO: move to sdk-utils +*/ + +// ErrGroupGoLog calls eg.Go on the errgroup but it will log the error immediately when it occurs +// instead of waiting for all goroutines in the group to finish first. This has the advantage of making sure all +// errors are logged, not just the first one, and it is more immediate. Also, it is guaranteed, in case that +// of the goroutines is not properly context aware. +func ErrGroupGoLog(eg *errgroup.Group, logger types.Logger, fn func() error) { + eg.Go(func() error { + err := fn() + if err != nil { + logger.Error("ErrGroup goroutine.", "err", err) + } + return err + }) +} diff --git a/utils/event/funcs.go b/utils/event/funcs.go index 0bfe9c965..8b76b7ce0 100644 --- a/utils/event/funcs.go +++ b/utils/event/funcs.go @@ -2,6 +2,7 @@ package event import ( "context" + "errors" "fmt" "github.com/dymensionxyz/dymint/types" @@ -13,6 +14,7 @@ import ( // MustSubscribe subscribes to events and sends back a callback // clientID is essentially the subscriber id, see https://pkg.go.dev/github.com/tendermint/tendermint/libs/pubsub#pkg-overview +// - will not panic on context cancel or deadline exceeded func MustSubscribe( ctx context.Context, pubsubServer *pubsub.Server, @@ -23,8 +25,12 @@ func MustSubscribe( ) { subscription, err := pubsubServer.SubscribeUnbuffered(ctx, clientID, eventQuery) if err != nil { - logger.Error("subscribe to events") - panic(err) + err = fmt.Errorf("subscribe unbuffered: %w", err) + if !errors.Is(err, context.Canceled) { + logger.Error("Must subscribe.", "err", err) + panic(err) + } + return } for { @@ -40,10 +46,10 @@ func MustSubscribe( } } -// MustPublish submits an event or panics +// MustPublish submits an event or panics - will not panic on context cancel or deadline exceeded func MustPublish(ctx context.Context, pubsubServer *pubsub.Server, msg interface{}, events map[string][]string) { err := pubsubServer.PublishWithEvents(ctx, msg, events) - if err != nil { + if err != nil && !errors.Is(err, context.Canceled) { panic(err) } } diff --git a/version/version.go b/version/version.go index 2cdc4204a..f7eb1ede0 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,6 @@ package version -var BuildVersion = "" +var ( + BuildVersion = "" + Commit = "" +)