From 14bbf104a3cd6882871acdc24a8f61e05cd7f091 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Tue, 18 Jun 2024 18:50:34 +0300 Subject: [PATCH 1/9] docs: fix URLs in the syncing issue template (#2346) --- .github/ISSUE_TEMPLATE/syncing.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/syncing.yaml b/.github/ISSUE_TEMPLATE/syncing.yaml index 2db27f7291..17884a3b32 100644 --- a/.github/ISSUE_TEMPLATE/syncing.yaml +++ b/.github/ISSUE_TEMPLATE/syncing.yaml @@ -10,14 +10,14 @@ body: - type: dropdown attributes: label: Does your machine match the technical requirements? - description: See https://www.zetachain.com/docs/validators/requirements/ + description: See https://www.zetachain.com/docs/nodes/start-here/requirements/ options: - "Yes" - "No" - type: dropdown attributes: label: Have you completed the setup? - description: See https://www.zetachain.com/docs/validators/setup/ + description: See https://www.zetachain.com/docs/nodes/start-here/setup/ options: - "Yes" - "No" From e822112711b58af1011966ba8e3b852a41639d1c Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:09:00 -0500 Subject: [PATCH 2/9] fix: created btc dust amount constant and renaming (#2327) * renamed BtcDustOffset as BtcNonceMarkOffset and created constant BTCWithdrawalDustAmount * added changelog entry --- changelog.md | 1 + pkg/chains/chains.go | 3 ++- pkg/chains/conversion.go | 2 +- pkg/constant/constant.go | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 1dfe34192d..41d63adac2 100644 --- a/changelog.md +++ b/changelog.md @@ -66,6 +66,7 @@ * [2233](https://github.com/zeta-chain/node/pull/2233) - fix `IsSupported` flag not properly updated in zetaclient's context * [2243](https://github.com/zeta-chain/node/pull/2243) - fix incorrect bitcoin outbound height in the CCTX outbound parameter * [2256](https://github.com/zeta-chain/node/pull/2256) - fix rate limiter falsely included reverted non-withdraw cctxs +* [2327](https://github.com/zeta-chain/node/pull/2327) - partially cherry picked the fix to Bitcoin outbound dust amount ### CI diff --git a/pkg/chains/chains.go b/pkg/chains/chains.go index 61fffece76..11c6f952f0 100644 --- a/pkg/chains/chains.go +++ b/pkg/chains/chains.go @@ -265,7 +265,8 @@ var ( } ) -func BtcDustOffset() int64 { +// BtcNonceMarkOffset is the offset satoshi amount to calculate the nonce mark output +func BtcNonceMarkOffset() int64 { return 2000 } diff --git a/pkg/chains/conversion.go b/pkg/chains/conversion.go index 6a6a6f4091..200061c3ae 100644 --- a/pkg/chains/conversion.go +++ b/pkg/chains/conversion.go @@ -11,7 +11,7 @@ import ( // A very special value to mark current nonce in UTXO func NonceMarkAmount(nonce uint64) int64 { // #nosec G701 always in range - return int64(nonce) + BtcDustOffset() // +2000 to avoid being a dust rejection + return int64(nonce) + BtcNonceMarkOffset() } // HashToString convert hash bytes to string diff --git a/pkg/constant/constant.go b/pkg/constant/constant.go index 9a81e1d8b2..62f898e85d 100644 --- a/pkg/constant/constant.go +++ b/pkg/constant/constant.go @@ -10,4 +10,7 @@ const ( // CmdMigrateTssFunds is used for CCTX of type cmd to give the instruction to the TSS to transfer its funds on a new address CmdMigrateTssFunds = "cmd_migrate_tss_funds" + + // BTCWithdrawalDustAmount is the minimum satoshis that can be withdrawn from zEVM to avoid outbound dust output + BTCWithdrawalDustAmount = 1000 ) From d4a9f7dfb454e5498b577085b7afe6f48c4c2021 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Wed, 19 Jun 2024 08:14:35 -0700 Subject: [PATCH 3/9] chore: delete static zetacore/zetaclient config/keys (#2351) --- Dockerfile-localnet | 2 - .../preparams/PreParams_zetaclient0.json | 1 - .../preparams/PreParams_zetaclient1.json | 1 - .../preparams/PreParams_zetaclient2.json | 1 - .../preparams/PreParams_zetaclient3.json | 1 - contrib/localnet/scripts/start-zetaclientd.sh | 3 - .../tss/zetaclient0/address_book.seed | 2 - ...m5ly33l0j6sze64l265meggyw3wph6sv064me.json | 1 - .../tss/zetaclient1/address_book.seed | 2 - ...m5ly33l0j6sze64l265meggyw3wph6sv064me.json | 1 - .../zetacored_zetacore0/config/app.toml | 283 ------ .../zetacored_zetacore0/config/client.toml | 17 - .../zetacored_zetacore0/config/config.toml | 463 ---------- .../zetacored_zetacore0/config/genesis.json | 810 ------------------ ...f847b3c8b4fc599b4434b1f234a95de70cdc2.json | 1 - ...33926bd0e54244bd5189f64be9a5bd3754599.json | 1 - .../zetacored_zetacore0/config/node_key.json | 1 - .../config/priv_validator_key.json | 11 - ...afb7adbea65fde95a1a3e084a203227060.address | 1 - ...2a61491655e2786ae0d127d6990bfbfbde.address | 1 - .../keyring-test/val_grantee_observer.info | 1 - .../keyring-test/val_tss_signer.info | 1 - .../keyring-test/val_zetaclient_grantee.info | 1 - .../priv_validator_state.json | 5 - .../zetacored_zetacore1/config/app.toml | 283 ------ .../zetacored_zetacore1/config/client.toml | 17 - .../zetacored_zetacore1/config/config.toml | 463 ---------- .../zetacored_zetacore1/config/genesis.json | 810 ------------------ ...33926bd0e54244bd5189f64be9a5bd3754599.json | 61 -- .../zetacored_zetacore1/config/node_key.json | 1 - .../config/priv_validator_key.json | 11 - ...f1884bbf3bbfc6a689cc0d1afc550c320d.address | 1 - ...ec16513118d598d336d70834837292224a.address | 1 - .../keyring-test/val_grantee_observer.info | 1 - .../keyring-test/val_tss_signer.info | 1 - .../keyring-test/val_zetaclient_grantee.info | 1 - .../priv_validator_state.json | 5 - .../keyring-test/val_grantee_observer.info | 1 - .../keyring-test/val_grantee_observer.info | 1 - 39 files changed, 3270 deletions(-) delete mode 100644 contrib/localnet/preparams/PreParams_zetaclient0.json delete mode 100644 contrib/localnet/preparams/PreParams_zetaclient1.json delete mode 100644 contrib/localnet/preparams/PreParams_zetaclient2.json delete mode 100644 contrib/localnet/preparams/PreParams_zetaclient3.json delete mode 100644 contrib/localnet/tss/zetaclient0/address_book.seed delete mode 100644 contrib/localnet/tss/zetaclient0/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json delete mode 100644 contrib/localnet/tss/zetaclient1/address_book.seed delete mode 100644 contrib/localnet/tss/zetaclient1/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/app.toml delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/client.toml delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-baef847b3c8b4fc599b4434b1f234a95de70cdc2.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/node_key.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/config/priv_validator_key.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/2b8526afb7adbea65fde95a1a3e084a203227060.address delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/813ac22a61491655e2786ae0d127d6990bfbfbde.address delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_grantee_observer.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_tss_signer.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_zetaclient_grantee.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore0/priv_validator_state.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/app.toml delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/client.toml delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/node_key.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/config/priv_validator_key.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/dbfe49f1884bbf3bbfc6a689cc0d1afc550c320d.address delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/ffae40ec16513118d598d336d70834837292224a.address delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_grantee_observer.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_tss_signer.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_zetaclient_grantee.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore1/priv_validator_state.json delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore2/keyring-test/val_grantee_observer.info delete mode 100644 contrib/localnet/zetacored/zetacored_zetacore3/keyring-test/val_grantee_observer.info diff --git a/Dockerfile-localnet b/Dockerfile-localnet index ee16e6282b..40ab112af1 100644 --- a/Dockerfile-localnet +++ b/Dockerfile-localnet @@ -44,10 +44,8 @@ RUN mkdir -p /root/.zetacored/cosmovisor/genesis/bin && \ ENV PATH /root/.zetacored/cosmovisor/current/bin/:/root/.zetaclientd/upgrades/current/:${PATH} COPY contrib/localnet/scripts /root -COPY contrib/localnet/preparams /root/preparams COPY contrib/localnet/ssh_config /root/.ssh/config COPY contrib/localnet/zetacored /root/zetacored -COPY contrib/localnet/tss /root/tss RUN chmod 755 /root/*.sh diff --git a/contrib/localnet/preparams/PreParams_zetaclient0.json b/contrib/localnet/preparams/PreParams_zetaclient0.json deleted file mode 100644 index 1658607f55..0000000000 --- a/contrib/localnet/preparams/PreParams_zetaclient0.json +++ /dev/null @@ -1 +0,0 @@ -{"PaillierSK":{"N":21904019810316554615180853778019346893657404209216283461609033688814436234120092105916095611677205183538599487765134141173912794311741457265350340439546270166426989419797064519971531768290032333491309520641961972683208865660072415581591938831176157899248009350581460600167235833025504925830756606485113622052718059533565408418057298520893768615410816660423449864631064561539262015863384428833122993905598067825766793095119101127861017044997730367322950572508461683163619101445165409205064698881287927199542272004244189566165714604550516594909749903344129429793068478538464446848820212727866101844857827426421299044137,"LambdaN":10952009905158277307590426889009673446828702104608141730804516844407218117060046052958047805838602591769299743882567070586956397155870728632675170219773135083213494709898532259985765884145016166745654760320980986341604432830036207790795969415588078949624004675290730300083617916512752462915378303242556811026210892184132197492599772746468767839954977647117939051747118398200521290427810736437411397854788761338046871347767465739422954313895260797616579589818242988770479872522949764062085332302357502846752265528051567166469601079681006656057479399141791971947734325567142594629283847761003076786773404570524278896258,"PhiN":21904019810316554615180853778019346893657404209216283461609033688814436234120092105916095611677205183538599487765134141173912794311741457265350340439546270166426989419797064519971531768290032333491309520641961972683208865660072415581591938831176157899248009350581460600167235833025504925830756606485113622052421784368264394985199545492937535679909955294235878103494236796401042580855621472874822795709577522676093742695534931478845908627790521595233159179636485977540959745045899528124170664604715005693504531056103134332939202159362013312114958798283583943895468651134285189258567695522006153573546809141048557792516},"NTildei":28611679819871826710887371529215487705595764493797659050881815203076316252020259342857903569357961559870987893292520051012002190003169912272939843636915944869123311829188271046875034636027521187849685736951378303879886288579478612117158044356445770321229778647118254940336776308010756643634617931124774718502157142512925938956792452417206255658576012563588155546113550196738102821059206970732382430480269079741734037010384164605109851585552133971056693023703698610328223040022368448888402732597048724431552710645710274191985991438015845964382790125094655343061801698917889034274794677660031348696495517768112395830741,"H1i":485017103277658489814913905829618981958261308300045007738040341636889405473289925315700153994593802473245056475227060927655263425235470243287837812362429087136072476964134334260435187081973792221938289583440932728980704672849813085907424010152380604885552734022743616120550112226856328317797301420673950308129999616069168147893859295703910421801887585722413840739674236338373722953932444007719043018837716695818264705757943709141757252224635296818993123602862860546550690995845983167307149672707089629795404084546425310958466789354703197443054651992495495383093781909607620201366613685635383931135819933506352177625,"H2i":9762770588330279569061983974817538499629373683475991784895950382529434618056574839906399899799580892746197253019739520199918417157334156538145650396015276613637599518464263750369229083362727921947750542416617325666598740004157868410256901446088412800224219719371952968321496318510170732801761070049010226460003034393745942815605950790391873888556154300587540500224353478595439385508031181767252071752825177391017676928039264600331688350767109297945539125043653437871146573181476252816504345479106356177498812478762235413588771495062664696094947877236428301688894980410229390509963054978049320044984611525519428895194,"Alpha":3923069068910587811759886839259866063479445282165924520728472757889727408052475597113922916290809945769280995538645696380392628461512025656232034879542974665002996959663147467377717916161890211873064786092044066337393080989152382562208757814414646033416726436543446926197995096133760807893658708134260601611283084403920766043661934504385706163901813501198782234257549013661826867285807605439526550000696311495681106950211680655758210351714117738836311186014809290716845919296850051691555726818392124317949599120731496530085866110361306283980180704787829228202949824539589700848566375320625593385688490391466284829294,"Beta":3047426629555310780352598709864457466463110666069957314638775476683862811499879218386375606595624424692813435196101577035153365049926654156313314807998882195121620021542850588001845737255585421006872962476925039385448354407345211700106380577591081910499770015289441377190790376011472314137621601344988551613109620180297894641173881459580629449580087230127100225561901742692415167135719878270584637468446931499166393093931095762083519672243751735707937057943187672529552296521000643763726919827700416735433774935376302464423946895574621899718309274592338640101458381735101153383163195185944813099787870087479822244015,"P":87913587681936920731117143755014343842297665562480345511248527003425508633602781670842552655761727350595186069373032907582296702854206795118764144842929460087418934588905537300149040015498451276787482447436751904827805278752497505905070394775619820571427800308639533829417553155944968490003853204132309294453,"Q":81363076443274585836028702215040175434111537701853171194310900757585930773295982811994451250025996920407027372440515444847067768055611972985068892595597610056411071825587389602611622175134221148308374450543478472530648915697541335665322806406541129479345222413121255071035937712148479713072420973827924486431} diff --git a/contrib/localnet/preparams/PreParams_zetaclient1.json b/contrib/localnet/preparams/PreParams_zetaclient1.json deleted file mode 100644 index a28762c501..0000000000 --- a/contrib/localnet/preparams/PreParams_zetaclient1.json +++ /dev/null @@ -1 +0,0 @@ -{"PaillierSK":{"N":23950384858094511553436315358520965722590165448190156522327831221398150200540950661693041172777518279623646044978150971495419705450324596019747379578962255559229118582822958115767794657766455443220017894643511956226554642119496874921444603118121297655763420494222309630007136196440326864437508301569054126596494283920430288917553844473492734349517877424426764143720882609663933412885099436112127307977238685323605565588765806982082194873869647171435980833887426543830551370302820106847478812769597196123845801454541740592138426121113081030060721468596428686211135256588962932154645290900406171158630703601711408818301,"LambdaN":11975192429047255776718157679260482861295082724095078261163915610699075100270475330846520586388759139811823022489075485747709852725162298009873689789481127779614559291411479057883897328883227721610008947321755978113277321059748437460722301559060648827881710247111154815003568098220163432218754150784527063298091429825541707811361878880871834418994585601761036070250907878947837762925838882077363550651356241074880926163937181864030138179563299562886034262553660885688080028871420035177783501807456895998896897972780595644853268799720271692473609594668806490823344736424590934035325801688917366456232531994007444757086,"PhiN":23950384858094511553436315358520965722590165448190156522327831221398150200540950661693041172777518279623646044978150971495419705450324596019747379578962255559229118582822958115767794657766455443220017894643511956226554642119496874921444603118121297655763420494222309630007136196440326864437508301569054126596182859651083415622723757761743668837989171203522072140501815757895675525851677764154727101302712482149761852327874363728060276359126599125772068525107321771376160057742840070355567003614913791997793795945561191289706537599440543384947219189337612981646689472849181868070651603377834732912465063988014889514172},"NTildei":28279495343513500834135175666178643616564489831794048004719806118040378549233247091287720476568323991454355597863847765209470226085707089949701577227799232989776752071182322723549179376371202676118305757212780626426798368563788677977377093567967462290780872705344555278207990939758855369568602448908586203736446037903587426329519298600786387227234343152175355472577125675245793508879542394445383706998788865691974980673900927230425796366625227730777644985536945600577310207718811979980133131845641189439545297020731273155639959212210999779789556259429057132422213858887105005698064500862923006262348552650039825169173,"H1i":19162703757723491814501898440167107808688891112704792798342467276795312217495499920722224457838012406453452328757338150758842255047640433322141467118840414922526091590381458445476975802201212175761183843317843427031152262373569926308908222733452120708273581985729585194893203205301592223895927198191971932281525287352132186176001678775982830374263546868892448841779004817865504733372517356888072783643526264321834565233560262212984358857422646302256388910005538239846618996141193796753010639175439420606583079078523528286224342368712587203998302074102717200586915058022245351784637762252844778892424881908227576782279,"H2i":19315502741580888195772649878037148542759507162553276060508901168051412557826772079589679544264177752596822422572175413289477303180064084298293033612411639342867997610252718810102341324283775236721196394745457202162301858866442315394176420550068093758483621208659347157042302798071056441231096669329426349349628389120983569489393401825147308079079062634593191918687437531462533444728595098107782436761018474261845751443604153644815279798859780153040361257691184267869408617536441450582676595580494424079224565450778231022219395470505160668136672368005198570140673467793290641994239899243929117495944950156678978705490,"Alpha":27835615213329968841289050438654818005496694944630515953754512786564014864093637340488759057676644160061734483875004803138440665924881924299753556899240241079152229244897459681889527467760414904811824453489848346545785908223201924657557328896285148608676237630300820215143306660284371346462791418460794556252372251645958226107056958494964017738712582686606214640321027203767366851209133042255856763570266123404393185477889205093174132908716096426123418968154989419647054042737970050051373435245927332794200187632245564833702439266199852508335523420272458789411213782648671405493717652010685018976432010219670591758393,"Beta":1747616609853958502785494310882970629542087984732732475105362616872371192886816095838386801999552130435853102474621009326633867569508322069042648157816720150024170971303277613054498028497302230087623399896811080741801332623114334913649993736464260250689320136005204966908784474986856269386641834688277249261457169875188022675531773061791822216794465325219775482362852264198764580912359649655631733360087299871471671668202024594116799036419190595327402906891759775107957746348330758155964844272600377926402549773105698696460596300218013430252039167256435715093122581449937975994274083985405623297967790169486124765579,"P":83719913001974500076663726685773729406578946826189117106878750675158134737081690011577693447614299765484937059327129991048282331452789518256129680208622096220524008231345310188242138100415736790953989974617425196880689767000664675821109192257889429262185087098302140194423511465660144880009334064871704137573,"Q":84446741311253334811046952611741075201763027805713703870742099395568410001375396217756919314834569008060034770897265058808211043881366686858566929288230567431400870589246808334514606439581691297755555676039190711697816305457707450130476616081428639823780133373072697078763892358740649414011848519028737923279} diff --git a/contrib/localnet/preparams/PreParams_zetaclient2.json b/contrib/localnet/preparams/PreParams_zetaclient2.json deleted file mode 100644 index 794d2a444a..0000000000 --- a/contrib/localnet/preparams/PreParams_zetaclient2.json +++ /dev/null @@ -1 +0,0 @@ -{"PaillierSK":{"N":26800269192333731798225075628572483939659983541124242266361990202106304028427985562619139641936581670726050677384943670430296743355905622845473349668345180758922153903742725338797929539566869382629385015437126766824806445587598320646759070168316793855767355161121402405504522207539430577823689080239734999127764004735961667326105811497368608497690592792084604778682820548237362392309181922248663028701614335608154598289025851099969952464758928168030093371461988324343462258078867425569129514941846904190531057630993892174313906089400605454953247608751966567492964904932120727427674103283083017576503035436413188463889,"LambdaN":13400134596166865899112537814286241969829991770562121133180995101053152014213992781309569820968290835363025338692471835215148371677952811422736674834172590379461076951871362669398964769783434691314692507718563383412403222793799160323379535084158396927883677580560701202752261103769715288911844540119867499563717709912325995366229904999697837744228415930643870545395362375900517511072996155182916571986494745247650350215347849387881789701709869511949784054703366216753276611695377742456023735417876610614448545359473493931269431282759755202903586916440638560912105037247946161491782970216160169546032071414161815388178,"PhiN":26800269192333731798225075628572483939659983541124242266361990202106304028427985562619139641936581670726050677384943670430296743355905622845473349668345180758922153903742725338797929539566869382629385015437126766824806445587598320646759070168316793855767355161121402405504522207539430577823689080239734999127435419824651990732459809999395675488456831861287741090790724751801035022145992310365833143972989490495300700430695698775763579403419739023899568109406732433506553223390755484912047470835753221228897090718946987862538862565519510405807173832881277121824210074495892322983565940432320339092064142828323630776356},"NTildei":28707366834501976507008202510873871474130864070852444645151123622509800510614836621989284542218228757396502789229007651717970650643677522155592324361232632011970594712581467576712474461551748942062087069938761232177442100947883514236717786790156800514190243273808778203103647862810039595511215402248452598470872802013761784540278514768530542792270327406669352269975870959914550913235433975446936744372645056025251517500190380641053362775879626661982215813966738363180233824732944980155473074149171160584786089889325114507816901977529514259306355107505673084546229269375642307740165028766398869131967137873629015644273,"H1i":23549168524511130624684862084992675240190121634728686328877191700114407120672509814576418745437357979535497267006959288496207674637734807042105243161614488626794864611445722621445519650061099338617396419198250478097012868524588420798077217154885318824897342457367430461542104595530285061394481561527045107659653243453987048596141536007242667284892760467707320839505936312930825228328656092912929745789780954804613579686480676214026263770995714015230439908380874988530652959565558316033425852324618120013503862674294588858012580518895232081857781531955768378929560668405073478089357964868700677720196080075576028481827,"H2i":1031987050538387415880889519211314938612103915112763658522354589015613502383575208698202664786821261225356372729751466897603753009047801078064123357961023084322414324318993161843254674019796193596417856055933914640382597876607963787635287197813028967635255981120388613603791327020861480607491721793008948095196693030195771221969744032535728580235350323231463170652343358759682300056950740182537742348737518485784960582117081359660455641221803047754166007696692345114466471416069512955062888512478907314815103582350618309186835246904773324403888250195806949054219350467793929284681780322167973971895495785251016239795,"Alpha":17052585165389290957989237813773751095015843241687647858182811523622733375636659344746299062055708996123302761737792573256874214315030852824921637570008580018078284334425904560272380386191764745733098772210979967769442547697186391283062948838228993227484037436142326604312274357821476885510159324512123629208467295343877310570808237887552935764860271986680595503852893440493755419008105528231682738492258481974865226745198362979023897928534930117420298624629869706330672486309041715778895324945845009249044525687315175556601444157159728231726013388848872162666444213195493170773710081783374681970775359700210157212893,"Beta":3479656292232416850580708378111206629845195513152367880728976100189473377776441096464623882435977004915460316750060310348187806911236761767355523822293099926876656540941819456062441781504457594582064933290499508866129609823593559756733731503034727727977106458420841875205244975716660020093839387462870004745769458875404478356244397275257971080689290566976671773014411840480256990588637145055594099102479277208221989776909937304657071595892091194946246222890629708221435730531897869226166956466076261296961516620093314592454560334108549313904892083722746642676524592189921926396101407174979463509025069548517707412077,"P":85782671812849456794746268617301041726371960672254368556485229843213966066274903311395767472200336545790951248892731881640435298314354993925104958593521290322432736606687880781995977199635613157100360073445193099376431125652417445283524895131201925608425503623827222470103714613838179771649621493976803680063,"Q":83663070372569919402812268686668160367595112677516920173938288676975193948435793411429973419400628580774679760036264353001967092674506090332409319296499441158948527385607614236826644776447879527733896043293296644945076930060194975861757872586438051079256640103219670117233426387168584987176458553027867838599} diff --git a/contrib/localnet/preparams/PreParams_zetaclient3.json b/contrib/localnet/preparams/PreParams_zetaclient3.json deleted file mode 100644 index bd9410c1b8..0000000000 --- a/contrib/localnet/preparams/PreParams_zetaclient3.json +++ /dev/null @@ -1 +0,0 @@ -{"PaillierSK":{"N":23170141009787538416620669915491940543607295133700842877123118664009582578924276213239953404636247204788537830520061266029391249189912247167248599196894216266871809388660933042769615173333523407618369009900537223255162240635370209121919240829309258477195934041411379690061328315785938464827668861415009595321814498684661185312316421608403814578537421313318178181282273449487748120966450511910855027963526956484478515437674662855665583075804332487932053565309219381053382265362966160191238474733382544177971629890222092466927582927673803533678578821270589461527336164213779737509390040931433595128764805793460354247641,"LambdaN":11585070504893769208310334957745970271803647566850421438561559332004791289462138106619976702318123602394268915260030633014695624594956123583624299598447108133435904694330466521384807586666761703809184504950268611627581120317685104560959620414654629238597967020705689845030664157892969232413834430707504797660754273680215211898007549028129515894183368144554247194744204155954995749468799349489185680438985023181154612295340391171845510691110107797053420188147574240707841869206170546961369047660500067237388535291949666888738474737834158000921040337108672473553074606274189998357355764439382643246740493006164046980442,"PhiN":23170141009787538416620669915491940543607295133700842877123118664009582578924276213239953404636247204788537830520061266029391249189912247167248599196894216266871809388660933042769615173333523407618369009900537223255162240635370209121919240829309258477195934041411379690061328315785938464827668861415009595321508547360430423796015098056259031788366736289108494389488408311909991498937598698978371360877970046362309224590680782343691021382220215594106840376295148481415683738412341093922738095321000134474777070583899333777476949475668316001842080674217344947106149212548379996714711528878765286493480986012328093960884},"NTildei":26418498767143792668297633830819558028045374285893440712825862648034256541019576843451764004592590094274655607372897827528692306017363289238612872015696000791436482898709005475031119292088126400925190092256710546025712709943646680162245681957165565742734460837855001253620475359690212291853796621218854694492012750417723166688314017149907365148180772203381396485476156952735177632697909824822933503214816003444203531012550110780310139555284886477789425250040066395274239181125076638624822858454130582387895742796628788655254707716866708504395587136137561118906788445680050972719536072811173268658325973855108963466997,"H1i":8416495191724937518844926057190825085549151953750872059928011268099113335117835077695974443056165649303101080820102244067381797365482153091087523059581806610402727947038507730066946461080522916649392556844142795628912186062480607591187629499492218157625963238360186762003775822673808553693827200873064109542742048091862928103023256153069955635478736641766529472809817667987886409243299936772757741807477857926820968608502134855395788624956539128160555378578648019392160769772453950385666205380648436280072094430070722519785888540883689824983549566722241221526644959113517860235210075332337501781722589127414237425107,"H2i":14219816599888359771757267474687164569450673722924861872275762779747573650084726940385245146911532243143378666498657880757352493091907894345090689620696354102549351845479221744887813290231109007704856853626120434658155525504662448775008546800576311246115930929306262111712267678957680676825475376029499235657254998543602629655996846523289829054842621155622387297445701134104136409224935331537252782342143114448335439662008514246884532746748013074505013737320488270459960219068693254230662024979535276177814830207192952969994685314563796497564978611846056145702266564388272573807102596467048009816460633906304221435164,"Alpha":26327565959899689871373223909868315071538806070429306675228914374737146857981937585800074512767578959993905769782927675240932650800711390052371266630149081669661430100504521195895363134940398876188689973778313663971290025367211634348389179756977564067200341001906639377320605017710823988593664264133428582627331856701469725102936018109810358785611004470965462883388627330744088705636724762395113371299467630644489554122288849428376432148481495787275327085296811623819917472447426912272348959644382697214113415794510738449837125990653549263337456961571414668887045590963347394302197017479341137180832286705957625625602,"Beta":5054672313013884526125326898724778082666136006099521445754658425947939109635210461834482328674887001810272957974842728176884186847692904549275503956803245497837960377513468125321931161321438767362413789281990246803385278334448086478077645477567119532355441360104131284550229229924515063941266865314947917579287901234983110505384325438282377034030892031728922632292922403302123860580102403217498233280945032577297829946889393724173390305277740887841987620259511141508383284365780224413458520399013652698191875726829683624263199733847139246817675960384181666038691551484251915049285322323167366196254677810529880207492,"P":85943076678103860270707054752836725634408468705966354056055256768592689783301780096151108020240912342504919763910150736806223910796814597910349006585468225312481174215504473505406722684162173061925357343260840274816656494366378411105731012470344941131592722748879866959770169079780055978939267799224371419231,"Q":76848827701657565122546525348717882189386347427780138237493802932715235539241825220093539887952010147008820444725634388468667117782256451404059476050559397069713639760757539979183414437217413624661119595018034831751382230778407747325931133099268129168363462767539026811796426860324701947903258991152183788709} diff --git a/contrib/localnet/scripts/start-zetaclientd.sh b/contrib/localnet/scripts/start-zetaclientd.sh index 32271a30b5..ff2a3b9b99 100755 --- a/contrib/localnet/scripts/start-zetaclientd.sh +++ b/contrib/localnet/scripts/start-zetaclientd.sh @@ -27,7 +27,6 @@ if [ "$HOTKEY_BACKEND" == "file" ]; then BACKEND="file" fi -cp /root/preparams/PreParams_$HOSTNAME.json /root/preParams.json num=$(echo $HOSTNAME | tr -dc '0-9') node="zetacore$num" @@ -42,7 +41,6 @@ echo "Start zetaclientd" # skip initialization if the config file already exists (zetaclientd init has already been run) if [[ $HOSTNAME == "zetaclient0" && ! -f ~/.zetacored/config/zetaclient_config.json ]] then - rm ~/.tss/* MYIP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) zetaclientd init --zetacore-url zetacore0 --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --keyring-backend "$BACKEND" @@ -63,7 +61,6 @@ then do SEED=$(curl --retry 10 --retry-delay 5 --retry-connrefused -s zetaclient0:8123/p2p) done - rm ~/.tss/* zetaclientd init --peer "/ip4/172.20.0.21/tcp/6668/p2p/${SEED}" --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 1 --keyring-backend "$BACKEND" # check if the option is additional-evm diff --git a/contrib/localnet/tss/zetaclient0/address_book.seed b/contrib/localnet/tss/zetaclient0/address_book.seed deleted file mode 100644 index 4c5b9969f7..0000000000 --- a/contrib/localnet/tss/zetaclient0/address_book.seed +++ /dev/null @@ -1,2 +0,0 @@ -/ip4/172.20.0.21/tcp/6668/p2p/16Uiu2HAmPAxG9Qg4PaGNFKWZ9rAaiC1HYydAaEUZNx9CRaKwZGgN -/ip4/172.20.0.22/tcp/6668/p2p/16Uiu2HAmTsQh84fvHmv9kDYWEKn1c5dthvB1JRFr4872mJ3GQTFU diff --git a/contrib/localnet/tss/zetaclient0/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json b/contrib/localnet/tss/zetaclient0/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json deleted file mode 100644 index 462026549f..0000000000 --- a/contrib/localnet/tss/zetaclient0/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json +++ /dev/null @@ -1 +0,0 @@ -{"pub_key":"zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me","local_data":{"PaillierSK":{"N":21904019810316554615180853778019346893657404209216283461609033688814436234120092105916095611677205183538599487765134141173912794311741457265350340439546270166426989419797064519971531768290032333491309520641961972683208865660072415581591938831176157899248009350581460600167235833025504925830756606485113622052718059533565408418057298520893768615410816660423449864631064561539262015863384428833122993905598067825766793095119101127861017044997730367322950572508461683163619101445165409205064698881287927199542272004244189566165714604550516594909749903344129429793068478538464446848820212727866101844857827426421299044137,"LambdaN":10952009905158277307590426889009673446828702104608141730804516844407218117060046052958047805838602591769299743882567070586956397155870728632675170219773135083213494709898532259985765884145016166745654760320980986341604432830036207790795969415588078949624004675290730300083617916512752462915378303242556811026210892184132197492599772746468767839954977647117939051747118398200521290427810736437411397854788761338046871347767465739422954313895260797616579589818242988770479872522949764062085332302357502846752265528051567166469601079681006656057479399141791971947734325567142594629283847761003076786773404570524278896258,"PhiN":21904019810316554615180853778019346893657404209216283461609033688814436234120092105916095611677205183538599487765134141173912794311741457265350340439546270166426989419797064519971531768290032333491309520641961972683208865660072415581591938831176157899248009350581460600167235833025504925830756606485113622052421784368264394985199545492937535679909955294235878103494236796401042580855621472874822795709577522676093742695534931478845908627790521595233159179636485977540959745045899528124170664604715005693504531056103134332939202159362013312114958798283583943895468651134285189258567695522006153573546809141048557792516},"NTildei":28611679819871826710887371529215487705595764493797659050881815203076316252020259342857903569357961559870987893292520051012002190003169912272939843636915944869123311829188271046875034636027521187849685736951378303879886288579478612117158044356445770321229778647118254940336776308010756643634617931124774718502157142512925938956792452417206255658576012563588155546113550196738102821059206970732382430480269079741734037010384164605109851585552133971056693023703698610328223040022368448888402732597048724431552710645710274191985991438015845964382790125094655343061801698917889034274794677660031348696495517768112395830741,"H1i":485017103277658489814913905829618981958261308300045007738040341636889405473289925315700153994593802473245056475227060927655263425235470243287837812362429087136072476964134334260435187081973792221938289583440932728980704672849813085907424010152380604885552734022743616120550112226856328317797301420673950308129999616069168147893859295703910421801887585722413840739674236338373722953932444007719043018837716695818264705757943709141757252224635296818993123602862860546550690995845983167307149672707089629795404084546425310958466789354703197443054651992495495383093781909607620201366613685635383931135819933506352177625,"H2i":9762770588330279569061983974817538499629373683475991784895950382529434618056574839906399899799580892746197253019739520199918417157334156538145650396015276613637599518464263750369229083362727921947750542416617325666598740004157868410256901446088412800224219719371952968321496318510170732801761070049010226460003034393745942815605950790391873888556154300587540500224353478595439385508031181767252071752825177391017676928039264600331688350767109297945539125043653437871146573181476252816504345479106356177498812478762235413588771495062664696094947877236428301688894980410229390509963054978049320044984611525519428895194,"Alpha":3923069068910587811759886839259866063479445282165924520728472757889727408052475597113922916290809945769280995538645696380392628461512025656232034879542974665002996959663147467377717916161890211873064786092044066337393080989152382562208757814414646033416726436543446926197995096133760807893658708134260601611283084403920766043661934504385706163901813501198782234257549013661826867285807605439526550000696311495681106950211680655758210351714117738836311186014809290716845919296850051691555726818392124317949599120731496530085866110361306283980180704787829228202949824539589700848566375320625593385688490391466284829294,"Beta":3047426629555310780352598709864457466463110666069957314638775476683862811499879218386375606595624424692813435196101577035153365049926654156313314807998882195121620021542850588001845737255585421006872962476925039385448354407345211700106380577591081910499770015289441377190790376011472314137621601344988551613109620180297894641173881459580629449580087230127100225561901742692415167135719878270584637468446931499166393093931095762083519672243751735707937057943187672529552296521000643763726919827700416735433774935376302464423946895574621899718309274592338640101458381735101153383163195185944813099787870087479822244015,"P":87913587681936920731117143755014343842297665562480345511248527003425508633602781670842552655761727350595186069373032907582296702854206795118764144842929460087418934588905537300149040015498451276787482447436751904827805278752497505905070394775619820571427800308639533829417553155944968490003853204132309294453,"Q":81363076443274585836028702215040175434111537701853171194310900757585930773295982811994451250025996920407027372440515444847067768055611972985068892595597610056411071825587389602611622175134221148308374450543478472530648915697541335665322806406541129479345222413121255071035937712148479713072420973827924486431,"Xi":56774107943966615426951430026875659716595644731956693348586023329959665046586,"ShareID":342409110680041407191060322991861574572518913179665609952469570928863452858922,"Ks":[342409110680041407191060322991861574572518913179665609952469570928863452858922,380624581728967305192433926382347750023221814331370139622681594024401299292970],"NTildej":[28611679819871826710887371529215487705595764493797659050881815203076316252020259342857903569357961559870987893292520051012002190003169912272939843636915944869123311829188271046875034636027521187849685736951378303879886288579478612117158044356445770321229778647118254940336776308010756643634617931124774718502157142512925938956792452417206255658576012563588155546113550196738102821059206970732382430480269079741734037010384164605109851585552133971056693023703698610328223040022368448888402732597048724431552710645710274191985991438015845964382790125094655343061801698917889034274794677660031348696495517768112395830741,28279495343513500834135175666178643616564489831794048004719806118040378549233247091287720476568323991454355597863847765209470226085707089949701577227799232989776752071182322723549179376371202676118305757212780626426798368563788677977377093567967462290780872705344555278207990939758855369568602448908586203736446037903587426329519298600786387227234343152175355472577125675245793508879542394445383706998788865691974980673900927230425796366625227730777644985536945600577310207718811979980133131845641189439545297020731273155639959212210999779789556259429057132422213858887105005698064500862923006262348552650039825169173],"H1j":[485017103277658489814913905829618981958261308300045007738040341636889405473289925315700153994593802473245056475227060927655263425235470243287837812362429087136072476964134334260435187081973792221938289583440932728980704672849813085907424010152380604885552734022743616120550112226856328317797301420673950308129999616069168147893859295703910421801887585722413840739674236338373722953932444007719043018837716695818264705757943709141757252224635296818993123602862860546550690995845983167307149672707089629795404084546425310958466789354703197443054651992495495383093781909607620201366613685635383931135819933506352177625,19162703757723491814501898440167107808688891112704792798342467276795312217495499920722224457838012406453452328757338150758842255047640433322141467118840414922526091590381458445476975802201212175761183843317843427031152262373569926308908222733452120708273581985729585194893203205301592223895927198191971932281525287352132186176001678775982830374263546868892448841779004817865504733372517356888072783643526264321834565233560262212984358857422646302256388910005538239846618996141193796753010639175439420606583079078523528286224342368712587203998302074102717200586915058022245351784637762252844778892424881908227576782279],"H2j":[9762770588330279569061983974817538499629373683475991784895950382529434618056574839906399899799580892746197253019739520199918417157334156538145650396015276613637599518464263750369229083362727921947750542416617325666598740004157868410256901446088412800224219719371952968321496318510170732801761070049010226460003034393745942815605950790391873888556154300587540500224353478595439385508031181767252071752825177391017676928039264600331688350767109297945539125043653437871146573181476252816504345479106356177498812478762235413588771495062664696094947877236428301688894980410229390509963054978049320044984611525519428895194,19315502741580888195772649878037148542759507162553276060508901168051412557826772079589679544264177752596822422572175413289477303180064084298293033612411639342867997610252718810102341324283775236721196394745457202162301858866442315394176420550068093758483621208659347157042302798071056441231096669329426349349628389120983569489393401825147308079079062634593191918687437531462533444728595098107782436761018474261845751443604153644815279798859780153040361257691184267869408617536441450582676595580494424079224565450778231022219395470505160668136672368005198570140673467793290641994239899243929117495944950156678978705490],"BigXj":[{"Coords":[25556310624282451990158308285704716036592912486627176674881833449861046772142,12021832626355086734901921262922005846353785553025711942205699336575534448]},{"Coords":[13779544062761923114354529985763858659367848164176712409557547304551403561378,90602354381154158171569879211993096742414757692802966747135488720684281563368]}],"PaillierPKs":[{"N":21904019810316554615180853778019346893657404209216283461609033688814436234120092105916095611677205183538599487765134141173912794311741457265350340439546270166426989419797064519971531768290032333491309520641961972683208865660072415581591938831176157899248009350581460600167235833025504925830756606485113622052718059533565408418057298520893768615410816660423449864631064561539262015863384428833122993905598067825766793095119101127861017044997730367322950572508461683163619101445165409205064698881287927199542272004244189566165714604550516594909749903344129429793068478538464446848820212727866101844857827426421299044137},{"N":23950384858094511553436315358520965722590165448190156522327831221398150200540950661693041172777518279623646044978150971495419705450324596019747379578962255559229118582822958115767794657766455443220017894643511956226554642119496874921444603118121297655763420494222309630007136196440326864437508301569054126596494283920430288917553844473492734349517877424426764143720882609663933412885099436112127307977238685323605565588765806982082194873869647171435980833887426543830551370302820106847478812769597196123845801454541740592138426121113081030060721468596428686211135256588962932154645290900406171158630703601711408818301}],"ECDSAPub":{"Coords":[92013584491262216752842125890853345602556369070997758499633422574351415275432,65071031647501722780675635548052306379731712380879028996731047039505007483730]}},"participant_keys":["zetapub1addwnpepqdycrc8usnjh0yk7cd532ushualgsderdqj8jr9m2rzy8stqrlpj5drvw6u","zetapub1addwnpepqt6sfvz3mwetudyaxjn958kztxz9j8rvrlsu55fw6fjkjyac2s9z53lsz4t"],"local_party_key":"zetapub1addwnpepqt6sfvz3mwetudyaxjn958kztxz9j8rvrlsu55fw6fjkjyac2s9z53lsz4t"} \ No newline at end of file diff --git a/contrib/localnet/tss/zetaclient1/address_book.seed b/contrib/localnet/tss/zetaclient1/address_book.seed deleted file mode 100644 index 2128207a26..0000000000 --- a/contrib/localnet/tss/zetaclient1/address_book.seed +++ /dev/null @@ -1,2 +0,0 @@ -/ip4/172.20.0.22/tcp/6668/p2p/16Uiu2HAmTsQh84fvHmv9kDYWEKn1c5dthvB1JRFr4872mJ3GQTFU -/ip4/172.20.0.21/tcp/6668/p2p/16Uiu2HAmPAxG9Qg4PaGNFKWZ9rAaiC1HYydAaEUZNx9CRaKwZGgN diff --git a/contrib/localnet/tss/zetaclient1/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json b/contrib/localnet/tss/zetaclient1/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json deleted file mode 100644 index 4c4895f881..0000000000 --- a/contrib/localnet/tss/zetaclient1/localstate-zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me.json +++ /dev/null @@ -1 +0,0 @@ -{"pub_key":"zetapub1addwnpepqt9km47ldtun5nemm5nuusm5ly33l0j6sze64l265meggyw3wph6sv064me","local_data":{"PaillierSK":{"N":23950384858094511553436315358520965722590165448190156522327831221398150200540950661693041172777518279623646044978150971495419705450324596019747379578962255559229118582822958115767794657766455443220017894643511956226554642119496874921444603118121297655763420494222309630007136196440326864437508301569054126596494283920430288917553844473492734349517877424426764143720882609663933412885099436112127307977238685323605565588765806982082194873869647171435980833887426543830551370302820106847478812769597196123845801454541740592138426121113081030060721468596428686211135256588962932154645290900406171158630703601711408818301,"LambdaN":11975192429047255776718157679260482861295082724095078261163915610699075100270475330846520586388759139811823022489075485747709852725162298009873689789481127779614559291411479057883897328883227721610008947321755978113277321059748437460722301559060648827881710247111154815003568098220163432218754150784527063298091429825541707811361878880871834418994585601761036070250907878947837762925838882077363550651356241074880926163937181864030138179563299562886034262553660885688080028871420035177783501807456895998896897972780595644853268799720271692473609594668806490823344736424590934035325801688917366456232531994007444757086,"PhiN":23950384858094511553436315358520965722590165448190156522327831221398150200540950661693041172777518279623646044978150971495419705450324596019747379578962255559229118582822958115767794657766455443220017894643511956226554642119496874921444603118121297655763420494222309630007136196440326864437508301569054126596182859651083415622723757761743668837989171203522072140501815757895675525851677764154727101302712482149761852327874363728060276359126599125772068525107321771376160057742840070355567003614913791997793795945561191289706537599440543384947219189337612981646689472849181868070651603377834732912465063988014889514172},"NTildei":28279495343513500834135175666178643616564489831794048004719806118040378549233247091287720476568323991454355597863847765209470226085707089949701577227799232989776752071182322723549179376371202676118305757212780626426798368563788677977377093567967462290780872705344555278207990939758855369568602448908586203736446037903587426329519298600786387227234343152175355472577125675245793508879542394445383706998788865691974980673900927230425796366625227730777644985536945600577310207718811979980133131845641189439545297020731273155639959212210999779789556259429057132422213858887105005698064500862923006262348552650039825169173,"H1i":19162703757723491814501898440167107808688891112704792798342467276795312217495499920722224457838012406453452328757338150758842255047640433322141467118840414922526091590381458445476975802201212175761183843317843427031152262373569926308908222733452120708273581985729585194893203205301592223895927198191971932281525287352132186176001678775982830374263546868892448841779004817865504733372517356888072783643526264321834565233560262212984358857422646302256388910005538239846618996141193796753010639175439420606583079078523528286224342368712587203998302074102717200586915058022245351784637762252844778892424881908227576782279,"H2i":19315502741580888195772649878037148542759507162553276060508901168051412557826772079589679544264177752596822422572175413289477303180064084298293033612411639342867997610252718810102341324283775236721196394745457202162301858866442315394176420550068093758483621208659347157042302798071056441231096669329426349349628389120983569489393401825147308079079062634593191918687437531462533444728595098107782436761018474261845751443604153644815279798859780153040361257691184267869408617536441450582676595580494424079224565450778231022219395470505160668136672368005198570140673467793290641994239899243929117495944950156678978705490,"Alpha":27835615213329968841289050438654818005496694944630515953754512786564014864093637340488759057676644160061734483875004803138440665924881924299753556899240241079152229244897459681889527467760414904811824453489848346545785908223201924657557328896285148608676237630300820215143306660284371346462791418460794556252372251645958226107056958494964017738712582686606214640321027203767366851209133042255856763570266123404393185477889205093174132908716096426123418968154989419647054042737970050051373435245927332794200187632245564833702439266199852508335523420272458789411213782648671405493717652010685018976432010219670591758393,"Beta":1747616609853958502785494310882970629542087984732732475105362616872371192886816095838386801999552130435853102474621009326633867569508322069042648157816720150024170971303277613054498028497302230087623399896811080741801332623114334913649993736464260250689320136005204966908784474986856269386641834688277249261457169875188022675531773061791822216794465325219775482362852264198764580912359649655631733360087299871471671668202024594116799036419190595327402906891759775107957746348330758155964844272600377926402549773105698696460596300218013430252039167256435715093122581449937975994274083985405623297967790169486124765579,"P":83719913001974500076663726685773729406578946826189117106878750675158134737081690011577693447614299765484937059327129991048282331452789518256129680208622096220524008231345310188242138100415736790953989974617425196880689767000664675821109192257889429262185087098302140194423511465660144880009334064871704137573,"Q":84446741311253334811046952611741075201763027805713703870742099395568410001375396217756919314834569008060034770897265058808211043881366686858566929288230567431400870589246808334514606439581691297755555676039190711697816305457707450130476616081428639823780133373072697078763892358740649414011848519028737923279,"Xi":23420217484349216560513006403381137596159063122644723813408260900123754749897,"ShareID":380624581728967305192433926382347750023221814331370139622681594024401299292970,"Ks":[342409110680041407191060322991861574572518913179665609952469570928863452858922,380624581728967305192433926382347750023221814331370139622681594024401299292970],"NTildej":[28611679819871826710887371529215487705595764493797659050881815203076316252020259342857903569357961559870987893292520051012002190003169912272939843636915944869123311829188271046875034636027521187849685736951378303879886288579478612117158044356445770321229778647118254940336776308010756643634617931124774718502157142512925938956792452417206255658576012563588155546113550196738102821059206970732382430480269079741734037010384164605109851585552133971056693023703698610328223040022368448888402732597048724431552710645710274191985991438015845964382790125094655343061801698917889034274794677660031348696495517768112395830741,28279495343513500834135175666178643616564489831794048004719806118040378549233247091287720476568323991454355597863847765209470226085707089949701577227799232989776752071182322723549179376371202676118305757212780626426798368563788677977377093567967462290780872705344555278207990939758855369568602448908586203736446037903587426329519298600786387227234343152175355472577125675245793508879542394445383706998788865691974980673900927230425796366625227730777644985536945600577310207718811979980133131845641189439545297020731273155639959212210999779789556259429057132422213858887105005698064500862923006262348552650039825169173],"H1j":[485017103277658489814913905829618981958261308300045007738040341636889405473289925315700153994593802473245056475227060927655263425235470243287837812362429087136072476964134334260435187081973792221938289583440932728980704672849813085907424010152380604885552734022743616120550112226856328317797301420673950308129999616069168147893859295703910421801887585722413840739674236338373722953932444007719043018837716695818264705757943709141757252224635296818993123602862860546550690995845983167307149672707089629795404084546425310958466789354703197443054651992495495383093781909607620201366613685635383931135819933506352177625,19162703757723491814501898440167107808688891112704792798342467276795312217495499920722224457838012406453452328757338150758842255047640433322141467118840414922526091590381458445476975802201212175761183843317843427031152262373569926308908222733452120708273581985729585194893203205301592223895927198191971932281525287352132186176001678775982830374263546868892448841779004817865504733372517356888072783643526264321834565233560262212984358857422646302256388910005538239846618996141193796753010639175439420606583079078523528286224342368712587203998302074102717200586915058022245351784637762252844778892424881908227576782279],"H2j":[9762770588330279569061983974817538499629373683475991784895950382529434618056574839906399899799580892746197253019739520199918417157334156538145650396015276613637599518464263750369229083362727921947750542416617325666598740004157868410256901446088412800224219719371952968321496318510170732801761070049010226460003034393745942815605950790391873888556154300587540500224353478595439385508031181767252071752825177391017676928039264600331688350767109297945539125043653437871146573181476252816504345479106356177498812478762235413588771495062664696094947877236428301688894980410229390509963054978049320044984611525519428895194,19315502741580888195772649878037148542759507162553276060508901168051412557826772079589679544264177752596822422572175413289477303180064084298293033612411639342867997610252718810102341324283775236721196394745457202162301858866442315394176420550068093758483621208659347157042302798071056441231096669329426349349628389120983569489393401825147308079079062634593191918687437531462533444728595098107782436761018474261845751443604153644815279798859780153040361257691184267869408617536441450582676595580494424079224565450778231022219395470505160668136672368005198570140673467793290641994239899243929117495944950156678978705490],"BigXj":[{"Coords":[25556310624282451990158308285704716036592912486627176674881833449861046772142,12021832626355086734901921262922005846353785553025711942205699336575534448]},{"Coords":[13779544062761923114354529985763858659367848164176712409557547304551403561378,90602354381154158171569879211993096742414757692802966747135488720684281563368]}],"PaillierPKs":[{"N":21904019810316554615180853778019346893657404209216283461609033688814436234120092105916095611677205183538599487765134141173912794311741457265350340439546270166426989419797064519971531768290032333491309520641961972683208865660072415581591938831176157899248009350581460600167235833025504925830756606485113622052718059533565408418057298520893768615410816660423449864631064561539262015863384428833122993905598067825766793095119101127861017044997730367322950572508461683163619101445165409205064698881287927199542272004244189566165714604550516594909749903344129429793068478538464446848820212727866101844857827426421299044137},{"N":23950384858094511553436315358520965722590165448190156522327831221398150200540950661693041172777518279623646044978150971495419705450324596019747379578962255559229118582822958115767794657766455443220017894643511956226554642119496874921444603118121297655763420494222309630007136196440326864437508301569054126596494283920430288917553844473492734349517877424426764143720882609663933412885099436112127307977238685323605565588765806982082194873869647171435980833887426543830551370302820106847478812769597196123845801454541740592138426121113081030060721468596428686211135256588962932154645290900406171158630703601711408818301}],"ECDSAPub":{"Coords":[92013584491262216752842125890853345602556369070997758499633422574351415275432,65071031647501722780675635548052306379731712380879028996731047039505007483730]}},"participant_keys":["zetapub1addwnpepqdycrc8usnjh0yk7cd532ushualgsderdqj8jr9m2rzy8stqrlpj5drvw6u","zetapub1addwnpepqt6sfvz3mwetudyaxjn958kztxz9j8rvrlsu55fw6fjkjyac2s9z53lsz4t"],"local_party_key":"zetapub1addwnpepqdycrc8usnjh0yk7cd532ushualgsderdqj8jr9m2rzy8stqrlpj5drvw6u"} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/app.toml b/contrib/localnet/zetacored/zetacored_zetacore0/config/app.toml deleted file mode 100644 index 624e89d40c..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/app.toml +++ /dev/null @@ -1,283 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0azeta" - -# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-keep-recent = "0" -pruning-keep-every = "0" -pruning-interval = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from Tendermint. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning Tendermint blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: Tendermint block pruning is dependant on this parameter in conunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs Tendermint what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -# IavlCacheSize set the size of the iavl tree cache. -# Default cache size is 50mb. -iavl-cache-size = 781250 - -# IAVLDisableFastNode enables or disables the fast node feature of IAVL. -# Default is true. -iavl-disable-fastnode = true - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [ -] - -############################################################################### -### API Configuration ### -############################################################################### - -[api] - -# Enable defines if the API server should be enabled. -enable = true - -# Swagger defines if swagger documentation should automatically be registered. -swagger = true - -# Address defines the API server to listen on. -address = "tcp://0.0.0.0:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = true - -############################################################################### -### Rosetta Configuration ### -############################################################################### - -[rosetta] - -# Enable defines if the Rosetta API server should be enabled. -enable = false - -# Address defines the Rosetta API server to listen on. -address = ":8080" - -# Network defines the name of the blockchain that will be returned by Rosetta. -blockchain = "app" - -# Network defines the name of the network that will be returned by Rosetta. -network = "network" - -# Retries defines the number of retries when connecting to the node before failing. -retries = 3 - -# Offline defines if Rosetta server should run in offline mode. -offline = false - -############################################################################### -### gRPC Configuration ### -############################################################################### - -[grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "0.0.0.0:9090" - -############################################################################### -### gRPC Web Configuration ### -############################################################################### - -[grpc-web] - -# GRPCWebEnable defines if the gRPC-web should be enabled. -# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. -enable = true - -# Address defines the gRPC-web server address to bind to. -address = "0.0.0.0:9091" - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enable-unsafe-cors = false - -############################################################################### -### State Sync Configuration ### -############################################################################### - -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. -[state-sync] - -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). Must be a multiple of pruning-keep-every. -snapshot-interval = 0 - -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 - -############################################################################### -### EVM Configuration ### -############################################################################### - -[evm] - -# Tracer defines the 'vm.Tracer' type that the EVM will use when the node is run in -# debug mode. To enable tracing use the '--evm.tracer' flag when starting your node. -# Valid types are: json|struct|access_list|markdown -tracer = "" - -# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. -max-tx-gas-wanted = 0 - -############################################################################### -### JSON RPC Configuration ### -############################################################################### - -[json-rpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the EVM RPC HTTP server address to bind to. -address = "0.0.0.0:8545" - -# Address defines the EVM WebSocket server address to bind to. -ws-address = "0.0.0.0:8546" - -# API defines a list of JSON-RPC namespaces that should be enabled -# Example: "eth,txpool,personal,net,debug,web3" -api = "eth,net,web3" - -# GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000. -gas-cap = 25000000 - -# EVMTimeout is the global timeout for eth_call. Default: 5s. -evm-timeout = "5s" - -# TxFeeCap is the global tx-fee cap for send transaction. Default: 1eth. -txfee-cap = 1 - -# FilterCap sets the global cap for total number of filters that can be created -filter-cap = 200 - -# FeeHistoryCap sets the global cap for total number of blocks that can be fetched -feehistory-cap = 100 - -# LogsCap defines the max number of results can be returned from single 'eth_getLogs' query. -logs-cap = 10000 - -# BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. -block-range-cap = 10000 - -# HTTPTimeout is the read/write timeout of http json-rpc server. -http-timeout = "30s" - -# HTTPIdleTimeout is the idle timeout of http json-rpc server. -http-idle-timeout = "2m0s" - -# AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via -# the node's RPC when the global parameter is disabled. -allow-unprotected-txs = false - -# MaxOpenConnections sets the maximum number of simultaneous connections -# for the server listener. -max-open-connections = 0 - -# EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions). -enable-indexer = false - -############################################################################### -### TLS Configuration ### -############################################################################### - -[tls] - -# Certificate path defines the cert.pem file path for the TLS configuration. -certificate-path = "" - -# Key path defines the key.pem file path for the TLS configuration. -key-path = "" \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/client.toml b/contrib/localnet/zetacored/zetacored_zetacore0/config/client.toml deleted file mode 100644 index f2b86d8fa5..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/client.toml +++ /dev/null @@ -1,17 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Client Configuration ### -############################################################################### - -# The network chain ID -chain-id = "athens_101-1" -# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) -keyring-backend = "test" -# CLI output format (text|json) -output = "text" -# : to Tendermint RPC interface for this chain -node = "tcp://localhost:26657" -# Transaction broadcasting mode (sync|async|block) -broadcast-mode = "sync" diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml b/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml deleted file mode 100644 index c8004b37af..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml +++ /dev/null @@ -1,463 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or -# relative to the home directory (e.g. "data"). The home directory is -# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable -# or --home cmd flag. - -####################################################################### -### Main Base Config Options ### -####################################################################### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "zetachain" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb -# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) -# - pure go -# - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) -db_backend = "pebbledb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "info" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_key_file = "config/priv_validator_key.json" - -# Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "data/priv_validator_state.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - - -####################################################################### -### Advanced Configuration Options ### -####################################################################### - -####################################################### -### RPC Server Configuration Options ### -####################################################### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://0.0.0.0:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = [] - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = ["HEAD", "GET", "POST", ] - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ] - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -# Maximum number of unique clientIDs that can /subscribe -# If you're using /broadcast_tx_commit, set to the estimated maximum number -# of broadcast_tx_commit calls per block. -max_subscription_clients = 100 - -# Maximum number of unique queries a given client can /subscribe to -# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to -# the estimated # maximum number of broadcast_tx_commit calls per block. -max_subscriptions_per_client = 5 - -# Experimental parameter to specify the maximum number of events a node will -# buffer, per subscription, before returning an error and closing the -# subscription. Must be set to at least 100, but higher values will accommodate -# higher event throughput rates (and will use more memory). -experimental_subscription_buffer_size = 200 - -# Experimental parameter to specify the maximum number of RPC responses that -# can be buffered per WebSocket client. If clients cannot read from the -# WebSocket endpoint fast enough, they will be disconnected, so increasing this -# parameter may reduce the chances of them being disconnected (but will cause -# the node to use more memory). -# -# Must be at least the same as "experimental_subscription_buffer_size", -# otherwise connections could be dropped unnecessarily. This value should -# ideally be somewhat higher than "experimental_subscription_buffer_size" to -# accommodate non-subscription-related RPC responses. -experimental_websocket_write_buffer_size = 200 - -# If a WebSocket client cannot read fast enough, at present we may -# silently drop events instead of generating an error or disconnecting the -# client. -# -# Enabling this experimental parameter will cause the WebSocket connection to -# be closed instead if it cannot read fast enough, allowing for greater -# predictability in subscription behaviour. -experimental_close_on_slow_client = false - -# How long to wait for a tx to be committed during /broadcast_tx_commit. -# WARNING: Using a value larger than 10s will result in increasing the -# global HTTP write timeout, which applies to all connections and endpoints. -# See https://github.com/tendermint/tendermint/issues/3435 -timeout_broadcast_tx_commit = "10s" - -# Maximum size of request body, in bytes -max_body_bytes = 1000000 - -# Maximum size of request header, in bytes -max_header_bytes = 1048576 - -# The path to a file containing certificate that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# If the certificate is signed by a certificate authority, -# the certFile should be the concatenation of the server's certificate, any intermediates, -# and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_cert_file = "" - -# The path to a file containing matching private key that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_key_file = "" - -# pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "0.0.0.0:6060" - -####################################################### -### P2P Configuration Options ### -####################################################### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. ip and port are required -# example: 159.89.10.97:26656 -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "c9733926bd0e54244bd5189f64be9a5bd3754599@zetacore1:26656" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# List of node IDs, to which a connection will be (re)established ignoring any existing limits -unconditional_peer_ids = "" - -# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) -persistent_peers_max_dial_period = "0s" - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = false - -# Peer connection configuration. -handshake_timeout = "20s" -dial_timeout = "3s" - -####################################################### -### Mempool Configuration Option ### -####################################################### -[mempool] - -# Mempool version to use: -# 1) "v0" - (default) FIFO mempool. -# 2) "v1" - prioritized mempool. -version = "v0" - -recheck = true -broadcast = true -wal_dir = "" - -# Maximum number of transactions in the mempool -size = 5000 - -# Limit the total size of all txs in the mempool. -# This only accounts for raw transactions (e.g. given 1MB transactions and -# max_txs_bytes=5MB, mempool will only accept 5 transactions). -max_txs_bytes = 1073741824 - -# Size of the cache (used to filter transactions we saw earlier) in transactions -cache_size = 10000 - -# Do not remove invalid transactions from the cache (default: false) -# Set to true if it's not possible for any invalid transaction to become valid -# again in the future. -keep-invalid-txs-in-cache = false - -# Maximum size of a single transaction. -# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. -max_tx_bytes = 1048576 - -# Maximum size of a batch of transactions to send to a peer -# Including space needed by encoding (one varint per transaction). -# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 -max_batch_bytes = 0 - -# ttl-duration, if non-zero, defines the maximum amount of time a transaction -# can exist for in the mempool. -# -# Note, if ttl-num-blocks is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if it's -# insertion time into the mempool is beyond ttl-duration. -ttl-duration = "0s" - -# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction -# can exist for in the mempool. -# -# Note, if ttl-duration is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if -# it's insertion time into the mempool is beyond ttl-duration. -ttl-num-blocks = 0 - -####################################################### -### State Sync Configuration Options ### -####################################################### -[statesync] -# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine -# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in -# the network to take and serve state machine snapshots. State sync is not attempted if the node -# has any local state (LastBlockHeight > 0). The node will have a truncated block history, -# starting from the height of the snapshot. -enable = false - -# RPC servers (comma-separated) for light client verification of the synced state machine and -# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding -# header hash obtained from a trusted source, and a period during which validators can be trusted. -# -# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 -# weeks) during which they can be financially punished (slashed) for misbehavior. -rpc_servers = "" -trust_height = 0 -trust_hash = "" -trust_period = "168h0m0s" - -# Time to spend discovering snapshots before initiating a restore. -discovery_time = "15s" - -# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). -# Will create a new, randomly named directory within, and remove it when done. -temp_dir = "" - -# The timeout duration before re-requesting a chunk, possibly from a different -# peer (default: 1 minute). -chunk_request_timeout = "10s" - -# The number of concurrent chunk fetchers to run (default: 1). -chunk_fetchers = "4" - -####################################################### -### Fast Sync Configuration Connections ### -####################################################### -[fastsync] - -# Fast Sync version to use: -# 1) "v0" (default) - the legacy fast sync implementation -# 2) "v1" - refactor of v0 version for better testability -# 2) "v2" - complete redesign of v0, optimized for testability & readability -version = "v0" - -####################################################### -### Consensus Configuration Options ### -####################################################### -[consensus] - -wal_file = "data/cs.wal/wal" - -# How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" -# How much timeout_propose increases with each round -timeout_propose_delta = "500ms" -# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) -timeout_prevote = "1s" -# How much the timeout_prevote increases with each round -timeout_prevote_delta = "500ms" -# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) -timeout_precommit = "1s" -# How much the timeout_precommit increases with each round -timeout_precommit_delta = "500ms" -# How long we wait after committing a block, before starting on the new -# height (this gives us a chance to receive some more precommits, even -# though we already have +2/3). -timeout_commit = "2s" - -# How many blocks to look back to check existence of the node's consensus votes before joining consensus -# When non-zero, the node will panic upon restart -# if the same consensus key was used to sign {double_sign_check_height} last blocks. -# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. -double_sign_check_height = 0 - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -####################################################### -### Storage Configuration Options ### -####################################################### -[storage] - -# Set to true to discard ABCI responses from the state store, which can save a -# considerable amount of disk space. Set to false to ensure ABCI responses are -# persisted. ABCI responses are required for /block_results RPC queries, and to -# reindex events in the command-line tool. -discard_abci_responses = false - -####################################################### -### Transaction Indexer Configuration Options ### -####################################################### -[tx_index] - -# What indexer to use for transactions -# -# The application will set which txs to index. In some cases a node operator will be able -# to decide which txs to index based on configuration set in the application. -# -# Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. -# 3) "psql" - the indexer services backed by PostgreSQL. -# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. -indexer = "kv" - -# The PostgreSQL connection configuration, the connection format: -# postgresql://:@:/? -psql-conn = "" - -####################################################### -### Instrumentation Configuration Options ### -####################################################### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json deleted file mode 100644 index 65ed217f6d..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json +++ /dev/null @@ -1,810 +0,0 @@ -{ - "genesis_time": "2023-01-16T04:54:06.919538199Z", - "chain_id": "athens_101-1", - "initial_height": "1", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "100000000", - "time_iota_ms": "1000" - }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "1048576" - }, - "validator": { - "pub_key_types": [ - "ed25519" - ] - }, - "version": {} - }, - "app_hash": "", - "app_state": { - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" - }, - "accounts": [ - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "pub_key": { - "@type":"/cosmos.crypto.secp256k1.PubKey", - "key":"AvUEsFHbsr40nTSmWh7CWYRZHGwf4cpRLtJlaRO4VAoq" - }, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "pub_key": { - "@type":"/cosmos.crypto.secp256k1.PubKey", - "key":"A0mB4PyE5XeS3sNpFXIX536INyNoJHkMu1DEQ8FgH8Mq" - }, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1h4m2lf04kpzn4c6fj7tfcnr29fmgk2vfpkjma6", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - } - ] - }, - "bank": { - "params": { - "send_enabled": [], - "default_send_enabled": true - }, - "balances": [ - { - "address": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1h4m2lf04kpzn4c6fj7tfcnr29fmgk2vfpkjma6", - "coins": [ - { - "denom": "azeta", - "amount": "10000000000000000000000" - } - ] - }, - { - "address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - } - ], - "supply": [ - { - "denom": "azeta", - "amount": "500010000000000000000000000" - } - ], - "denom_metadata": [] - }, - "crisis": { - "constant_fee": { - "denom": "azeta", - "amount": "1000" - } - }, - "crosschain": { - "params": { - "enabled": false - }, - "outboundTrackerList": [], - "keygen": null, - "tSSVoterList": [], - "tSSList": [], - "gasPriceList": [], - "chainNoncesList": [], - "CrossChainTxs": [], - "nodeAccountList": [ - { - "creator": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "tssSignerAddress": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "pubkeySet": { - "secp256k1": "zetapub1addwnpepqt6sfvz3mwetudyaxjn958kztxz9j8rvrlsu55fw6fjkjyac2s9z53lsz4t" - } - }, - { - "creator": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "tssSignerAddress": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "pubkeySet": { - "secp256k1": "zetapub1addwnpepqdycrc8usnjh0yk7cd532ushualgsderdqj8jr9m2rzy8stqrlpj5drvw6u" - } - } - ], - "lastBlockHeightList": [] - }, - "distribution": { - "params": { - "community_tax": "0.020000000000000000", - "base_proposer_reward": "0.010000000000000000", - "bonus_proposer_reward": "0.040000000000000000", - "withdraw_addr_enabled": true - }, - "fee_pool": { - "community_pool": [] - }, - "delegator_withdraw_infos": [], - "previous_proposer": "", - "outstanding_rewards": [], - "validator_accumulated_commissions": [], - "validator_historical_rewards": [], - "validator_current_rewards": [], - "delegator_starting_infos": [], - "validator_slash_events": [] - }, - "emissions": { - "params": { - "max_bond_factor": "1.25", - "min_bond_factor": "0.75", - "avg_block_time": "6.00", - "target_bond_ratio": "00.67", - "validator_emission_percentage": "00.50", - "observer_emission_percentage": "00.25", - "tss_signer_emission_percentage": "00.25", - "duration_factor_constant": "0.001877876953694702" - }, - "withdrawableEmissions": [] - }, - "evidence": { - "evidence": [] - }, - "evm": { - "accounts": [], - "params": { - "evm_denom": "azeta", - "enable_create": true, - "enable_call": true, - "extra_eips": [], - "chain_config": { - "homestead_block": "0", - "dao_fork_block": "0", - "dao_fork_support": true, - "eip150_block": "0", - "eip150_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155_block": "0", - "eip158_block": "0", - "byzantium_block": "0", - "constantinople_block": "0", - "petersburg_block": "0", - "istanbul_block": "0", - "muir_glacier_block": "0", - "berlin_block": "0", - "london_block": "0", - "arrow_glacier_block": "0", - "gray_glacier_block": "0", - "merge_netsplit_block": "0" - }, - "allow_unprotected_txs": false - } - }, - "feemarket": { - "params": { - "no_base_fee": false, - "base_fee_change_denominator": 8, - "elasticity_multiplier": 2, - "enable_height": "0", - "base_fee": "1000000000", - "min_gas_price": "10000000000.0", - "min_gas_multiplier": "0.500000000000000000" - }, - "block_gas": "0" - }, - "fungible": { - "params": {}, - "foreignCoinsList": [], - "systemContract": null - }, - "genutil": { - "gen_txs": [ - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "zetachain", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "validator_address": "zetavaloper1z46tdw75jvh4h39y3vu758ctv34rw5z9jmut95", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "cnOc/39ATQw+bYKG56pL8A2aMO6M8sBxXO3OVJHbhdA=" - }, - "value": { - "denom": "azeta", - "amount": "10000000000000000000000000" - } - } - ], - "memo": "baef847b3c8b4fc599b4434b1f234a95de70cdc2@172.20.0.11:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A5xB7o1mDrL/KygJY5y45rWkMlplJlKpUtAxFIpoLyLn" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "xo+pCyqUVhYyDoZiL0lZmwgdoyESaD/GXwX3dYyOfb0XcX72p/VcVPAH8LKb4rRp3WNg+0e0ge0ps5sn4cinbg==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "zetacore1", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "validator_address": "zetavaloper1lz2fqwzjnk6qy48fgj753h48444fxtt7newaeu", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "TpCVIVP20iVz5vE7OY6R78HvIzP22Je0zHHnjJAcBnY=" - }, - "value": { - "denom": "azeta", - "amount": "10000000000000000000000000" - } - } - ], - "memo": "c9733926bd0e54244bd5189f64be9a5bd3754599@zetacore1:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A+INzBCKz8TVJ0QBabAGIUKXMKyQTalQ761JBBQSYfr3" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "db3f3P/7BMMiH+Sh+WCflVYk69Zi659fXsJ0DHtQPJ1KaNorFVf8j1TZ0dnBYy7XyeDKtmu6b52OpnPT86W7SQ==" - ] - } - ] - }, - "gov": { - "starting_proposal_id": "1", - "deposits": [], - "votes": [], - "proposals": [], - "deposit_params": { - "min_deposit": [ - { - "denom": "azeta", - "amount": "10000000" - } - ], - "max_deposit_period": "100s" - }, - "voting_params": { - "voting_period": "100s" - }, - "tally_params": { - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto_threshold": "0.334000000000000000" - } - }, - "ibc": { - "client_genesis": { - "clients": [], - "clients_consensus": [], - "clients_metadata": [], - "params": { - "allowed_clients": [ - "06-solomachine", - "07-tendermint" - ] - }, - "create_localhost": false, - "next_client_sequence": "0" - }, - "connection_genesis": { - "connections": [], - "client_connection_paths": [], - "next_connection_sequence": "0", - "params": { - "max_expected_time_per_block": "30000000000" - } - }, - "channel_genesis": { - "channels": [], - "acknowledgements": [], - "commitments": [], - "receipts": [], - "send_sequences": [], - "recv_sequences": [], - "ack_sequences": [], - "next_channel_sequence": "0" - } - }, - "mint": { - "minter": { - "inflation": "0.130000000000000000", - "annual_provisions": "0.000000000000000000" - }, - "params": { - "mint_denom": "azeta", - "inflation_rate_change": "0.130000000000000000", - "inflation_max": "0.200000000000000000", - "inflation_min": "0.070000000000000000", - "goal_bonded": "0.670000000000000000", - "blocks_per_year": "6311520" - } - }, - "observer": { - "core_params_list": [], - "observers": [ - { - "observer_chain": { - "chain_name": 14, - "chain_id": 1337 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - }, - { - "observer_chain": { - "chain_name": 14, - "chain_id": 1337 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - }, - { - "observer_chain": { - "chain_name": 15, - "chain_id": 18444 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - }, - { - "observer_chain": { - "chain_name": 15, - "chain_id": 18444 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - } - ], - "params": { - "observer_params": [ - { - "chain": { - "chain_name": 15, - "chain_id": 18444 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 12, - "chain_id": 18332 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 3, - "chain_id": 8332 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 4, - "chain_id": 137 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 7, - "chain_id": 80001 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 9, - "chain_id": 1001 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 10, - "chain_id": 97 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 5, - "chain_id": 56 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 1, - "chain_id": 1 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 6, - "chain_id": 5 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 14, - "chain_id": 1337 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 2, - "chain_id": 101 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - } - ] - } - }, - "params": null, - "slashing": { - "params": { - "signed_blocks_window": "100", - "min_signed_per_window": "0.500000000000000000", - "downtime_jail_duration": "600s", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" - }, - "signing_infos": [], - "missed_blocks": [] - }, - "authz": { - "authorization": [ - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgNonceVoter" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteGasPrice" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteInbound" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteOutbound" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgSetNodeKeys" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgCreateTSSVoter" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgAddOutboundTracker" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgNonceVoter" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteGasPrice" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteInbound" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteOutbound" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgSetNodeKeys" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgCreateTSSVoter" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgAddOutboundTracker" - }, - "expiration": null - } - ] - }, - "staking": { - "params": { - "unbonding_time": "1814400s", - "max_validators": 100, - "max_entries": 7, - "historical_entries": 10000, - "bond_denom": "azeta", - "min_commission_rate": "0.000000000000000000" - }, - "last_total_power": "0", - "last_validator_powers": [], - "validators": [], - "delegations": [], - "unbonding_delegations": [], - "redelegations": [], - "exported": false - }, - "transfer": { - "port_id": "transfer", - "denom_traces": [], - "params": { - "send_enabled": true, - "receive_enabled": true - } - }, - "upgrade": {}, - "vesting": {} - } -} diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-baef847b3c8b4fc599b4434b1f234a95de70cdc2.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-baef847b3c8b4fc599b4434b1f234a95de70cdc2.json deleted file mode 100644 index 9bfa456278..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-baef847b3c8b4fc599b4434b1f234a95de70cdc2.json +++ /dev/null @@ -1 +0,0 @@ -{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"zetachain","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz","validator_address":"zetavaloper1z46tdw75jvh4h39y3vu758ctv34rw5z9jmut95","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"cnOc/39ATQw+bYKG56pL8A2aMO6M8sBxXO3OVJHbhdA="},"value":{"denom":"azeta","amount":"10000000000000000000000000"}}],"memo":"baef847b3c8b4fc599b4434b1f234a95de70cdc2@172.20.0.11:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5xB7o1mDrL/KygJY5y45rWkMlplJlKpUtAxFIpoLyLn"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["xo+pCyqUVhYyDoZiL0lZmwgdoyESaD/GXwX3dYyOfb0XcX72p/VcVPAH8LKb4rRp3WNg+0e0ge0ps5sn4cinbg=="]} diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json deleted file mode 100644 index a52901f54e..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json +++ /dev/null @@ -1 +0,0 @@ -{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"zetacore1","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52","validator_address":"zetavaloper1lz2fqwzjnk6qy48fgj753h48444fxtt7newaeu","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"TpCVIVP20iVz5vE7OY6R78HvIzP22Je0zHHnjJAcBnY="},"value":{"denom":"azeta","amount":"10000000000000000000000000"}}],"memo":"c9733926bd0e54244bd5189f64be9a5bd3754599@zetacore1:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+INzBCKz8TVJ0QBabAGIUKXMKyQTalQ761JBBQSYfr3"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["db3f3P/7BMMiH+Sh+WCflVYk69Zi659fXsJ0DHtQPJ1KaNorFVf8j1TZ0dnBYy7XyeDKtmu6b52OpnPT86W7SQ=="]} diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/node_key.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/node_key.json deleted file mode 100644 index 731eb33633..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/node_key.json +++ /dev/null @@ -1 +0,0 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"reRJzAw+jUfqYEW5oVNhLk294qbxjl7Eif84LmVFiJ8QszriQQwepdGcVDglM+sI0p78GDfau9785f0ESHsxwg=="}} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/priv_validator_key.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/priv_validator_key.json deleted file mode 100644 index a7827e9035..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/priv_validator_key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "address": "B3378A91E00C34CD41B92013B2C63402AE7048F6", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "cnOc/39ATQw+bYKG56pL8A2aMO6M8sBxXO3OVJHbhdA=" - }, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "gFdcR+5UpH8hMECL1vTzj0BwEJR4CXdsz7S9lJ+Xu8Ryc5z/f0BNDD5tgobnqkvwDZow7ozywHFc7c5UkduF0A==" - } -} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/2b8526afb7adbea65fde95a1a3e084a203227060.address b/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/2b8526afb7adbea65fde95a1a3e084a203227060.address deleted file mode 100644 index 4b157c8c62..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/2b8526afb7adbea65fde95a1a3e084a203227060.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0NTo0My40MDk3NDMgLTA0MDAgRURUIG09KzAuMDUyODI0MDQzIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiQ1V3M2pOVU5QN0U0N1BhdSJ9.BmnnkUiIA1G6bb1lvMA_bzYIaMFp5OyBuhvgfTdSZzMfBa850pkdLg.lyJnCfBkryIRMDlu.LryBCZHOWfigEAslXZ7AG3Dlynat-BTFg7yYHnQP6IuImOIqYewSdYsh1YhWL9dF_6gIoNKnLb4PdrUTPOIxbRtOq-Ql1lmrsLSmuREPRRAcvwu_MkXl3H6bAWwu4LSqFCLk5rUSOqNVPm0w5KwGEaQmMJ3I364Y3-Zkz5R_GaBPcQrBv-RV4b-QgEcNe11QcO03L5-y7GcULYhdA8dsXIXRsBflZa-KDWroqW-mAH5IWepAJqJnF_msl_ZGFs6Rd0M.BCXGB5dCitR62OeQbqfXFw \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/813ac22a61491655e2786ae0d127d6990bfbfbde.address b/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/813ac22a61491655e2786ae0d127d6990bfbfbde.address deleted file mode 100644 index 6aff7bc819..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/813ac22a61491655e2786ae0d127d6990bfbfbde.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0MjoxOC41NDcyMjEgLTA0MDAgRURUIG09KzAuMDQ2NDQ5NTg0IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoid0FFeDRXQXJQQTdZY2paQSJ9.mBrylq7naOtZ4oTeJZGAIu17-yoa4fxuWxAKKzNgfPbNJpqDljWESg.hNC-7MQLaWisi4pm.aAqj7J5-5GwNwWdfJhdjtgCkG7yVVeLYIqATWF2M7jIrJ7L-nTneXMKIHvUsGjyOvQIMPRslF_oUSCljtsGYntEtxLPZskWeMSDotK0izDgJ1tT4uTOAHJcvHA0-RLgWW_F2AgtL4T8lI4NOrHWLrHDScIq5NaGnNxp8sn0EAXt0FVRsEmnNmfZTEBo9YYwd8xThIm0TJPliyH7FSMEFmHek4zhf9oFIFYq2dEz9PovoGHJDgxabFzGJ5uDccXs2VhNj-zYxlida_Q.MNJrUnSVeOc7csB_a45ElA \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_grantee_observer.info b/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_grantee_observer.info deleted file mode 100644 index ce52801545..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_grantee_observer.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0MjoxOC41NDU3NDMgLTA0MDAgRURUIG09KzAuMDQ0OTcxNTAxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiNXRCNjNMTFJ6UlVRemtUcSJ9.fJHzCAKqMML_lQrmwV3yCaeSgAoYXif9JKnmyVULDjn0Fv_0O64ThQ.IGtCyHZroJ3BdqxT.e-fdeRZEJexxUWFTAcG28qg1-wBEeaCkfpYHXWgjPXCCyFW1Kxro-Ife2MWMBcZYRu0tBTkfOtpIChXmVwD-VuFyg1K2MBmWdcPr426fdBgQBVmshf7fOhxACF777fe8xrAjntZN_eXg5_RfDKFuICCDKs9aL6ifRsFL3A0cPRC8Evgvkc23J7Bd1XB7IOmr7sO4VG4JtWS4a23vnuAK2hxz9O0j61yyKZz121j7SM-VS8xXOC3kdoJrI9s_iZJDcTqVc3M0BMOCNmDs4aU5aDLtWBRh3d_snoLFHVCUL05ww46c2k4-laiKgPTlpLrGddQQs5uMjqE4d6jChN-3wh3OkZ-QTv3yRw4yJNSeeZhpU_P-JziitutKOFR-q1o75NMrsBE3I5ONPOA5yLuvWMshuK_TKwR12yIhIzwSUoG5DTOVeG77JGZs2QK1ntMckahjpcwBk8Dca2QVEHxF_e6l5EImcmLIoDanUK7bVw.UwTtpJim6K4UiE2FLuBHBQ \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_tss_signer.info b/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_tss_signer.info deleted file mode 100644 index 10f8acbd9e..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_tss_signer.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0NTo0My40MDgyNjYgLTA0MDAgRURUIG09KzAuMDUxMzQ3NjI2IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiN2hGVlNEUlZNYThDRXBXTiJ9.jE5cAZvDrhO3KrtEN9qlJBFEQYJA3iKxf_N7uf1NM7K_ZnpGVFcjMw.vwgpBb6R-luPYEmU.Q1nHt9EQtMOs-NKSAVuyWKfn-SBAPfX5qoGoE8oRQRG2OWKi-68fTsZdS3ufc2Sg_ezsOXrwm_MIZiwO8ebupsfEdwtm3EYf_KcMTW69PhHEsZ_16wS8DEZW9IO4JHPS1PF6wLVcK-LhmIg1BIn7KuoAC4a9Va2e2DfyroePnlci--_qeJq8IYgJVTtvyi-ITock9LiZnxsKWsQ02PcIt0KYrfCc5gnUl11Qf1F8b1E7TwaT2hopVBTRZvPg0pl11_e6iiKS3NQFujbM1V0qQVrpYv1o_IFzl25_qsxOaOtqozKiJMW6tJ301a5BDgVAtcpTGvRNivGh7G5O-vAta-wsq3DN-PcPMhgbypy-MfGLR5pwCUYQZdb6JTguOiOqOmhFUQM9VMmPPUx5K_GqN2FKLT3dabqO5AWL647QktNCu5cEf-_nOa-tjELuEjZjraO_OiOV1fzxmSZBtdeprHk.PfEq2htzLC4uKUzVaUhJmA \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_zetaclient_grantee.info b/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_zetaclient_grantee.info deleted file mode 100644 index ce52801545..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/keyring-test/val_zetaclient_grantee.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0MjoxOC41NDU3NDMgLTA0MDAgRURUIG09KzAuMDQ0OTcxNTAxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiNXRCNjNMTFJ6UlVRemtUcSJ9.fJHzCAKqMML_lQrmwV3yCaeSgAoYXif9JKnmyVULDjn0Fv_0O64ThQ.IGtCyHZroJ3BdqxT.e-fdeRZEJexxUWFTAcG28qg1-wBEeaCkfpYHXWgjPXCCyFW1Kxro-Ife2MWMBcZYRu0tBTkfOtpIChXmVwD-VuFyg1K2MBmWdcPr426fdBgQBVmshf7fOhxACF777fe8xrAjntZN_eXg5_RfDKFuICCDKs9aL6ifRsFL3A0cPRC8Evgvkc23J7Bd1XB7IOmr7sO4VG4JtWS4a23vnuAK2hxz9O0j61yyKZz121j7SM-VS8xXOC3kdoJrI9s_iZJDcTqVc3M0BMOCNmDs4aU5aDLtWBRh3d_snoLFHVCUL05ww46c2k4-laiKgPTlpLrGddQQs5uMjqE4d6jChN-3wh3OkZ-QTv3yRw4yJNSeeZhpU_P-JziitutKOFR-q1o75NMrsBE3I5ONPOA5yLuvWMshuK_TKwR12yIhIzwSUoG5DTOVeG77JGZs2QK1ntMckahjpcwBk8Dca2QVEHxF_e6l5EImcmLIoDanUK7bVw.UwTtpJim6K4UiE2FLuBHBQ \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/priv_validator_state.json b/contrib/localnet/zetacored/zetacored_zetacore0/priv_validator_state.json deleted file mode 100644 index 48f3b67e3f..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore0/priv_validator_state.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "height": "0", - "round": 0, - "step": 0 -} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/app.toml b/contrib/localnet/zetacored/zetacored_zetacore1/config/app.toml deleted file mode 100644 index 9d64d38476..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/app.toml +++ /dev/null @@ -1,283 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0azeta" - -# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-keep-recent = "0" -pruning-keep-every = "0" -pruning-interval = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from Tendermint. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning Tendermint blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: Tendermint block pruning is dependant on this parameter in conunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs Tendermint what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -# IavlCacheSize set the size of the iavl tree cache. -# Default cache size is 50mb. -iavl-cache-size = 781250 - -# IAVLDisableFastNode enables or disables the fast node feature of IAVL. -# Default is true. -iavl-disable-fastnode = true - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [ -] - -############################################################################### -### API Configuration ### -############################################################################### - -[api] - -# Enable defines if the API server should be enabled. -enable = true - -# Swagger defines if swagger documentation should automatically be registered. -swagger = true - -# Address defines the API server to listen on. -address = "tcp://0.0.0.0:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = true - -############################################################################### -### Rosetta Configuration ### -############################################################################### - -[rosetta] - -# Enable defines if the Rosetta API server should be enabled. -enable = true - -# Address defines the Rosetta API server to listen on. -address = ":8080" - -# Network defines the name of the blockchain that will be returned by Rosetta. -blockchain = "app" - -# Network defines the name of the network that will be returned by Rosetta. -network = "network" - -# Retries defines the number of retries when connecting to the node before failing. -retries = 3 - -# Offline defines if Rosetta server should run in offline mode. -offline = false - -############################################################################### -### gRPC Configuration ### -############################################################################### - -[grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "0.0.0.0:9090" - -############################################################################### -### gRPC Web Configuration ### -############################################################################### - -[grpc-web] - -# GRPCWebEnable defines if the gRPC-web should be enabled. -# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. -enable = true - -# Address defines the gRPC-web server address to bind to. -address = "0.0.0.0:9091" - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enable-unsafe-cors = false - -############################################################################### -### State Sync Configuration ### -############################################################################### - -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. -[state-sync] - -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). Must be a multiple of pruning-keep-every. -snapshot-interval = 0 - -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 - -############################################################################### -### EVM Configuration ### -############################################################################### - -[evm] - -# Tracer defines the 'vm.Tracer' type that the EVM will use when the node is run in -# debug mode. To enable tracing use the '--evm.tracer' flag when starting your node. -# Valid types are: json|struct|access_list|markdown -tracer = "" - -# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. -max-tx-gas-wanted = 0 - -############################################################################### -### JSON RPC Configuration ### -############################################################################### - -[json-rpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the EVM RPC HTTP server address to bind to. -address = "0.0.0.0:8545" - -# Address defines the EVM WebSocket server address to bind to. -ws-address = "0.0.0.0:8546" - -# API defines a list of JSON-RPC namespaces that should be enabled -# Example: "eth,txpool,personal,net,debug,web3" -api = "eth,net,web3" - -# GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000. -gas-cap = 25000000 - -# EVMTimeout is the global timeout for eth_call. Default: 5s. -evm-timeout = "5s" - -# TxFeeCap is the global tx-fee cap for send transaction. Default: 1eth. -txfee-cap = 1 - -# FilterCap sets the global cap for total number of filters that can be created -filter-cap = 200 - -# FeeHistoryCap sets the global cap for total number of blocks that can be fetched -feehistory-cap = 100 - -# LogsCap defines the max number of results can be returned from single 'eth_getLogs' query. -logs-cap = 10000 - -# BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. -block-range-cap = 10000 - -# HTTPTimeout is the read/write timeout of http json-rpc server. -http-timeout = "30s" - -# HTTPIdleTimeout is the idle timeout of http json-rpc server. -http-idle-timeout = "2m0s" - -# AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via -# the node's RPC when the global parameter is disabled. -allow-unprotected-txs = false - -# MaxOpenConnections sets the maximum number of simultaneous connections -# for the server listener. -max-open-connections = 0 - -# EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions). -enable-indexer = false - -############################################################################### -### TLS Configuration ### -############################################################################### - -[tls] - -# Certificate path defines the cert.pem file path for the TLS configuration. -certificate-path = "" - -# Key path defines the key.pem file path for the TLS configuration. -key-path = "" \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/client.toml b/contrib/localnet/zetacored/zetacored_zetacore1/config/client.toml deleted file mode 100644 index f2b86d8fa5..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/client.toml +++ /dev/null @@ -1,17 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Client Configuration ### -############################################################################### - -# The network chain ID -chain-id = "athens_101-1" -# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) -keyring-backend = "test" -# CLI output format (text|json) -output = "text" -# : to Tendermint RPC interface for this chain -node = "tcp://localhost:26657" -# Transaction broadcasting mode (sync|async|block) -broadcast-mode = "sync" diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml b/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml deleted file mode 100644 index 1f1c63c074..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml +++ /dev/null @@ -1,463 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or -# relative to the home directory (e.g. "data"). The home directory is -# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable -# or --home cmd flag. - -####################################################################### -### Main Base Config Options ### -####################################################################### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "zetacore1" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb -# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) -# - pure go -# - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) -db_backend = "pebbledb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "info" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_key_file = "config/priv_validator_key.json" - -# Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "data/priv_validator_state.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - - -####################################################################### -### Advanced Configuration Options ### -####################################################################### - -####################################################### -### RPC Server Configuration Options ### -####################################################### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://0.0.0.0:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = [] - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = ["HEAD", "GET", "POST", ] - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ] - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -# Maximum number of unique clientIDs that can /subscribe -# If you're using /broadcast_tx_commit, set to the estimated maximum number -# of broadcast_tx_commit calls per block. -max_subscription_clients = 100 - -# Maximum number of unique queries a given client can /subscribe to -# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to -# the estimated # maximum number of broadcast_tx_commit calls per block. -max_subscriptions_per_client = 5 - -# Experimental parameter to specify the maximum number of events a node will -# buffer, per subscription, before returning an error and closing the -# subscription. Must be set to at least 100, but higher values will accommodate -# higher event throughput rates (and will use more memory). -experimental_subscription_buffer_size = 200 - -# Experimental parameter to specify the maximum number of RPC responses that -# can be buffered per WebSocket client. If clients cannot read from the -# WebSocket endpoint fast enough, they will be disconnected, so increasing this -# parameter may reduce the chances of them being disconnected (but will cause -# the node to use more memory). -# -# Must be at least the same as "experimental_subscription_buffer_size", -# otherwise connections could be dropped unnecessarily. This value should -# ideally be somewhat higher than "experimental_subscription_buffer_size" to -# accommodate non-subscription-related RPC responses. -experimental_websocket_write_buffer_size = 200 - -# If a WebSocket client cannot read fast enough, at present we may -# silently drop events instead of generating an error or disconnecting the -# client. -# -# Enabling this experimental parameter will cause the WebSocket connection to -# be closed instead if it cannot read fast enough, allowing for greater -# predictability in subscription behaviour. -experimental_close_on_slow_client = false - -# How long to wait for a tx to be committed during /broadcast_tx_commit. -# WARNING: Using a value larger than 10s will result in increasing the -# global HTTP write timeout, which applies to all connections and endpoints. -# See https://github.com/tendermint/tendermint/issues/3435 -timeout_broadcast_tx_commit = "10s" - -# Maximum size of request body, in bytes -max_body_bytes = 1000000 - -# Maximum size of request header, in bytes -max_header_bytes = 1048576 - -# The path to a file containing certificate that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# If the certificate is signed by a certificate authority, -# the certFile should be the concatenation of the server's certificate, any intermediates, -# and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_cert_file = "" - -# The path to a file containing matching private key that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_key_file = "" - -# pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "0.0.0.0:6060" - -####################################################### -### P2P Configuration Options ### -####################################################### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. ip and port are required -# example: 159.89.10.97:26656 -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# List of node IDs, to which a connection will be (re)established ignoring any existing limits -unconditional_peer_ids = "" - -# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) -persistent_peers_max_dial_period = "0s" - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = false - -# Peer connection configuration. -handshake_timeout = "20s" -dial_timeout = "3s" - -####################################################### -### Mempool Configuration Option ### -####################################################### -[mempool] - -# Mempool version to use: -# 1) "v0" - (default) FIFO mempool. -# 2) "v1" - prioritized mempool. -version = "v0" - -recheck = true -broadcast = true -wal_dir = "" - -# Maximum number of transactions in the mempool -size = 5000 - -# Limit the total size of all txs in the mempool. -# This only accounts for raw transactions (e.g. given 1MB transactions and -# max_txs_bytes=5MB, mempool will only accept 5 transactions). -max_txs_bytes = 1073741824 - -# Size of the cache (used to filter transactions we saw earlier) in transactions -cache_size = 10000 - -# Do not remove invalid transactions from the cache (default: false) -# Set to true if it's not possible for any invalid transaction to become valid -# again in the future. -keep-invalid-txs-in-cache = false - -# Maximum size of a single transaction. -# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. -max_tx_bytes = 1048576 - -# Maximum size of a batch of transactions to send to a peer -# Including space needed by encoding (one varint per transaction). -# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 -max_batch_bytes = 0 - -# ttl-duration, if non-zero, defines the maximum amount of time a transaction -# can exist for in the mempool. -# -# Note, if ttl-num-blocks is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if it's -# insertion time into the mempool is beyond ttl-duration. -ttl-duration = "0s" - -# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction -# can exist for in the mempool. -# -# Note, if ttl-duration is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if -# it's insertion time into the mempool is beyond ttl-duration. -ttl-num-blocks = 0 - -####################################################### -### State Sync Configuration Options ### -####################################################### -[statesync] -# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine -# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in -# the network to take and serve state machine snapshots. State sync is not attempted if the node -# has any local state (LastBlockHeight > 0). The node will have a truncated block history, -# starting from the height of the snapshot. -enable = false - -# RPC servers (comma-separated) for light client verification of the synced state machine and -# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding -# header hash obtained from a trusted source, and a period during which validators can be trusted. -# -# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 -# weeks) during which they can be financially punished (slashed) for misbehavior. -rpc_servers = "" -trust_height = 0 -trust_hash = "" -trust_period = "168h0m0s" - -# Time to spend discovering snapshots before initiating a restore. -discovery_time = "15s" - -# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). -# Will create a new, randomly named directory within, and remove it when done. -temp_dir = "" - -# The timeout duration before re-requesting a chunk, possibly from a different -# peer (default: 1 minute). -chunk_request_timeout = "10s" - -# The number of concurrent chunk fetchers to run (default: 1). -chunk_fetchers = "4" - -####################################################### -### Fast Sync Configuration Connections ### -####################################################### -[fastsync] - -# Fast Sync version to use: -# 1) "v0" (default) - the legacy fast sync implementation -# 2) "v1" - refactor of v0 version for better testability -# 2) "v2" - complete redesign of v0, optimized for testability & readability -version = "v0" - -####################################################### -### Consensus Configuration Options ### -####################################################### -[consensus] - -wal_file = "data/cs.wal/wal" - -# How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" -# How much timeout_propose increases with each round -timeout_propose_delta = "500ms" -# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) -timeout_prevote = "1s" -# How much the timeout_prevote increases with each round -timeout_prevote_delta = "500ms" -# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) -timeout_precommit = "1s" -# How much the timeout_precommit increases with each round -timeout_precommit_delta = "500ms" -# How long we wait after committing a block, before starting on the new -# height (this gives us a chance to receive some more precommits, even -# though we already have +2/3). -timeout_commit = "2s" - -# How many blocks to look back to check existence of the node's consensus votes before joining consensus -# When non-zero, the node will panic upon restart -# if the same consensus key was used to sign {double_sign_check_height} last blocks. -# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. -double_sign_check_height = 0 - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -####################################################### -### Storage Configuration Options ### -####################################################### -[storage] - -# Set to true to discard ABCI responses from the state store, which can save a -# considerable amount of disk space. Set to false to ensure ABCI responses are -# persisted. ABCI responses are required for /block_results RPC queries, and to -# reindex events in the command-line tool. -discard_abci_responses = false - -####################################################### -### Transaction Indexer Configuration Options ### -####################################################### -[tx_index] - -# What indexer to use for transactions -# -# The application will set which txs to index. In some cases a node operator will be able -# to decide which txs to index based on configuration set in the application. -# -# Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. -# 3) "psql" - the indexer services backed by PostgreSQL. -# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. -indexer = "kv" - -# The PostgreSQL connection configuration, the connection format: -# postgresql://:@:/? -psql-conn = "" - -####################################################### -### Instrumentation Configuration Options ### -####################################################### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json deleted file mode 100644 index 65ed217f6d..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json +++ /dev/null @@ -1,810 +0,0 @@ -{ - "genesis_time": "2023-01-16T04:54:06.919538199Z", - "chain_id": "athens_101-1", - "initial_height": "1", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "100000000", - "time_iota_ms": "1000" - }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "1048576" - }, - "validator": { - "pub_key_types": [ - "ed25519" - ] - }, - "version": {} - }, - "app_hash": "", - "app_state": { - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" - }, - "accounts": [ - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "pub_key": { - "@type":"/cosmos.crypto.secp256k1.PubKey", - "key":"AvUEsFHbsr40nTSmWh7CWYRZHGwf4cpRLtJlaRO4VAoq" - }, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "pub_key": { - "@type":"/cosmos.crypto.secp256k1.PubKey", - "key":"A0mB4PyE5XeS3sNpFXIX536INyNoJHkMu1DEQ8FgH8Mq" - }, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1h4m2lf04kpzn4c6fj7tfcnr29fmgk2vfpkjma6", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "@type": "/ethermint.types.v1.EthAccount", - "base_account": { - "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", - "pub_key": null, - "account_number": "0", - "sequence": "0" - }, - "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - } - ] - }, - "bank": { - "params": { - "send_enabled": [], - "default_send_enabled": true - }, - "balances": [ - { - "address": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1h4m2lf04kpzn4c6fj7tfcnr29fmgk2vfpkjma6", - "coins": [ - { - "denom": "azeta", - "amount": "10000000000000000000000" - } - ] - }, - { - "address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - }, - { - "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", - "coins": [ - { - "denom": "azeta", - "amount": "100000000000000000000000000" - } - ] - } - ], - "supply": [ - { - "denom": "azeta", - "amount": "500010000000000000000000000" - } - ], - "denom_metadata": [] - }, - "crisis": { - "constant_fee": { - "denom": "azeta", - "amount": "1000" - } - }, - "crosschain": { - "params": { - "enabled": false - }, - "outboundTrackerList": [], - "keygen": null, - "tSSVoterList": [], - "tSSList": [], - "gasPriceList": [], - "chainNoncesList": [], - "CrossChainTxs": [], - "nodeAccountList": [ - { - "creator": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "tssSignerAddress": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "pubkeySet": { - "secp256k1": "zetapub1addwnpepqt6sfvz3mwetudyaxjn958kztxz9j8rvrlsu55fw6fjkjyac2s9z53lsz4t" - } - }, - { - "creator": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "tssSignerAddress": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "pubkeySet": { - "secp256k1": "zetapub1addwnpepqdycrc8usnjh0yk7cd532ushualgsderdqj8jr9m2rzy8stqrlpj5drvw6u" - } - } - ], - "lastBlockHeightList": [] - }, - "distribution": { - "params": { - "community_tax": "0.020000000000000000", - "base_proposer_reward": "0.010000000000000000", - "bonus_proposer_reward": "0.040000000000000000", - "withdraw_addr_enabled": true - }, - "fee_pool": { - "community_pool": [] - }, - "delegator_withdraw_infos": [], - "previous_proposer": "", - "outstanding_rewards": [], - "validator_accumulated_commissions": [], - "validator_historical_rewards": [], - "validator_current_rewards": [], - "delegator_starting_infos": [], - "validator_slash_events": [] - }, - "emissions": { - "params": { - "max_bond_factor": "1.25", - "min_bond_factor": "0.75", - "avg_block_time": "6.00", - "target_bond_ratio": "00.67", - "validator_emission_percentage": "00.50", - "observer_emission_percentage": "00.25", - "tss_signer_emission_percentage": "00.25", - "duration_factor_constant": "0.001877876953694702" - }, - "withdrawableEmissions": [] - }, - "evidence": { - "evidence": [] - }, - "evm": { - "accounts": [], - "params": { - "evm_denom": "azeta", - "enable_create": true, - "enable_call": true, - "extra_eips": [], - "chain_config": { - "homestead_block": "0", - "dao_fork_block": "0", - "dao_fork_support": true, - "eip150_block": "0", - "eip150_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155_block": "0", - "eip158_block": "0", - "byzantium_block": "0", - "constantinople_block": "0", - "petersburg_block": "0", - "istanbul_block": "0", - "muir_glacier_block": "0", - "berlin_block": "0", - "london_block": "0", - "arrow_glacier_block": "0", - "gray_glacier_block": "0", - "merge_netsplit_block": "0" - }, - "allow_unprotected_txs": false - } - }, - "feemarket": { - "params": { - "no_base_fee": false, - "base_fee_change_denominator": 8, - "elasticity_multiplier": 2, - "enable_height": "0", - "base_fee": "1000000000", - "min_gas_price": "10000000000.0", - "min_gas_multiplier": "0.500000000000000000" - }, - "block_gas": "0" - }, - "fungible": { - "params": {}, - "foreignCoinsList": [], - "systemContract": null - }, - "genutil": { - "gen_txs": [ - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "zetachain", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "validator_address": "zetavaloper1z46tdw75jvh4h39y3vu758ctv34rw5z9jmut95", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "cnOc/39ATQw+bYKG56pL8A2aMO6M8sBxXO3OVJHbhdA=" - }, - "value": { - "denom": "azeta", - "amount": "10000000000000000000000000" - } - } - ], - "memo": "baef847b3c8b4fc599b4434b1f234a95de70cdc2@172.20.0.11:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A5xB7o1mDrL/KygJY5y45rWkMlplJlKpUtAxFIpoLyLn" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "xo+pCyqUVhYyDoZiL0lZmwgdoyESaD/GXwX3dYyOfb0XcX72p/VcVPAH8LKb4rRp3WNg+0e0ge0ps5sn4cinbg==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "zetacore1", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "validator_address": "zetavaloper1lz2fqwzjnk6qy48fgj753h48444fxtt7newaeu", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "TpCVIVP20iVz5vE7OY6R78HvIzP22Je0zHHnjJAcBnY=" - }, - "value": { - "denom": "azeta", - "amount": "10000000000000000000000000" - } - } - ], - "memo": "c9733926bd0e54244bd5189f64be9a5bd3754599@zetacore1:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A+INzBCKz8TVJ0QBabAGIUKXMKyQTalQ761JBBQSYfr3" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "db3f3P/7BMMiH+Sh+WCflVYk69Zi659fXsJ0DHtQPJ1KaNorFVf8j1TZ0dnBYy7XyeDKtmu6b52OpnPT86W7SQ==" - ] - } - ] - }, - "gov": { - "starting_proposal_id": "1", - "deposits": [], - "votes": [], - "proposals": [], - "deposit_params": { - "min_deposit": [ - { - "denom": "azeta", - "amount": "10000000" - } - ], - "max_deposit_period": "100s" - }, - "voting_params": { - "voting_period": "100s" - }, - "tally_params": { - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto_threshold": "0.334000000000000000" - } - }, - "ibc": { - "client_genesis": { - "clients": [], - "clients_consensus": [], - "clients_metadata": [], - "params": { - "allowed_clients": [ - "06-solomachine", - "07-tendermint" - ] - }, - "create_localhost": false, - "next_client_sequence": "0" - }, - "connection_genesis": { - "connections": [], - "client_connection_paths": [], - "next_connection_sequence": "0", - "params": { - "max_expected_time_per_block": "30000000000" - } - }, - "channel_genesis": { - "channels": [], - "acknowledgements": [], - "commitments": [], - "receipts": [], - "send_sequences": [], - "recv_sequences": [], - "ack_sequences": [], - "next_channel_sequence": "0" - } - }, - "mint": { - "minter": { - "inflation": "0.130000000000000000", - "annual_provisions": "0.000000000000000000" - }, - "params": { - "mint_denom": "azeta", - "inflation_rate_change": "0.130000000000000000", - "inflation_max": "0.200000000000000000", - "inflation_min": "0.070000000000000000", - "goal_bonded": "0.670000000000000000", - "blocks_per_year": "6311520" - } - }, - "observer": { - "core_params_list": [], - "observers": [ - { - "observer_chain": { - "chain_name": 14, - "chain_id": 1337 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - }, - { - "observer_chain": { - "chain_name": 14, - "chain_id": 1337 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - }, - { - "observer_chain": { - "chain_name": 15, - "chain_id": 18444 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - }, - { - "observer_chain": { - "chain_name": 15, - "chain_id": 18444 - }, - "observer_list": [ - "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52" - ] - } - ], - "params": { - "observer_params": [ - { - "chain": { - "chain_name": 15, - "chain_id": 18444 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 12, - "chain_id": 18332 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 3, - "chain_id": 8332 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 4, - "chain_id": 137 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 7, - "chain_id": 80001 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 9, - "chain_id": 1001 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 10, - "chain_id": 97 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 5, - "chain_id": 56 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 1, - "chain_id": 1 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 6, - "chain_id": 5 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 14, - "chain_id": 1337 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 2, - "chain_id": 101 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - } - ] - } - }, - "params": null, - "slashing": { - "params": { - "signed_blocks_window": "100", - "min_signed_per_window": "0.500000000000000000", - "downtime_jail_duration": "600s", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" - }, - "signing_infos": [], - "missed_blocks": [] - }, - "authz": { - "authorization": [ - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgNonceVoter" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteGasPrice" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteInbound" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteOutbound" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgSetNodeKeys" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgCreateTSSVoter" - }, - "expiration": null - }, - { - "granter": "zeta1z46tdw75jvh4h39y3vu758ctv34rw5z9kmyhgz", - "grantee": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgAddOutboundTracker" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgNonceVoter" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteGasPrice" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteInbound" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgVoteOutbound" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgSetNodeKeys" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgCreateTSSVoter" - }, - "expiration": null - }, - { - "granter": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "grantee": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "authorization": { - "@type": "/cosmos.authz.v1beta1.GenericAuthorization", - "msg": "/zetachain.zetacore.crosschain.MsgAddOutboundTracker" - }, - "expiration": null - } - ] - }, - "staking": { - "params": { - "unbonding_time": "1814400s", - "max_validators": 100, - "max_entries": 7, - "historical_entries": 10000, - "bond_denom": "azeta", - "min_commission_rate": "0.000000000000000000" - }, - "last_total_power": "0", - "last_validator_powers": [], - "validators": [], - "delegations": [], - "unbonding_delegations": [], - "redelegations": [], - "exported": false - }, - "transfer": { - "port_id": "transfer", - "denom_traces": [], - "params": { - "send_enabled": true, - "receive_enabled": true - } - }, - "upgrade": {}, - "vesting": {} - } -} diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json deleted file mode 100644 index 5cce662ea6..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/gentx/gentx-c9733926bd0e54244bd5189f64be9a5bd3754599.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "zetacore1", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52", - "validator_address": "zetavaloper1lz2fqwzjnk6qy48fgj753h48444fxtt7newaeu", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "TpCVIVP20iVz5vE7OY6R78HvIzP22Je0zHHnjJAcBnY=" - }, - "value": { - "denom": "azeta", - "amount": "10000000000000000000000000" - } - } - ], - "memo": "c9733926bd0e54244bd5189f64be9a5bd3754599@zetacore1:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A+INzBCKz8TVJ0QBabAGIUKXMKyQTalQ761JBBQSYfr3" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "db3f3P/7BMMiH+Sh+WCflVYk69Zi659fXsJ0DHtQPJ1KaNorFVf8j1TZ0dnBYy7XyeDKtmu6b52OpnPT86W7SQ==" - ] -} diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/node_key.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/node_key.json deleted file mode 100644 index 2920207364..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/node_key.json +++ /dev/null @@ -1 +0,0 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"W371xKZXOcZNMOuVcVv+aJvylep0V7aBbqgF2iCHC0wit8nUl67Iqhnv6dTQu3OR9E3pysh06zkmYezdDyql2w=="}} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/priv_validator_key.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/priv_validator_key.json deleted file mode 100644 index ed33e0de85..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/priv_validator_key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "address": "AEABDEA088421C8621C7C2900E87D5D337F1B43E", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "TpCVIVP20iVz5vE7OY6R78HvIzP22Je0zHHnjJAcBnY=" - }, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "yCXNjiRWr+8z7sh3Qnpa4DplOdvxBbVP6rp6Md4ZKYlOkJUhU/bSJXPm8Ts5jpHvwe8jM/bYl7TMceeMkBwGdg==" - } -} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/dbfe49f1884bbf3bbfc6a689cc0d1afc550c320d.address b/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/dbfe49f1884bbf3bbfc6a689cc0d1afc550c320d.address deleted file mode 100644 index 12423f8269..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/dbfe49f1884bbf3bbfc6a689cc0d1afc550c320d.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0Njo0NC4wNjI3MTMgLTA0MDAgRURUIG09KzAuMDUxNzA4MjUxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiQ3Z4ell0ZUJnSjlNd2MycyJ9.JgkexsaNDqeDWs-U17aIgic2TU252vMATcw8W3HYmLiYI5MZ4XsJkQ.6OBPdK8TW67G_1s1.5qLTmafak6KB3SLqckh-UJ_ekK4FCrsSjOxKtz2Z-AWwj2RJkbv3yxIXm1RSypNXLPzOHNc6TIc0ZQ8y46y9BBq7_oPaSPxVf0kXHpCE9CVkYz0qP2wFJDVX8w1cNZmZIAP9D8_qLOdXHnfSQTUVS0uZNZtHKclOqykwmOuhR80bwx6XAWQXKEcgB8VQAu8xxIFtzXDsFqfMFRm12jAHIDNzDFGUAEeMDKLxcRyCAXrvRHV98Ak1JoWzJ7eQO4YmATQ.HVuBSfHhr86GXt6k-UckmQ \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/ffae40ec16513118d598d336d70834837292224a.address b/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/ffae40ec16513118d598d336d70834837292224a.address deleted file mode 100644 index 97630a4799..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/ffae40ec16513118d598d336d70834837292224a.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0MzowMS43NjcxNzEgLTA0MDAgRURUIG09KzAuMDU3MDY0MDAxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoidUlocDFGRG1xZ1MxNUlSeCJ9.nPkgYwqVQEax6qHnMb-NfQKH7KvObRpPeor_pQ_Ak9arcQnvk8NfNA.9SeIIqtYINWlAS8z.r6dOtQdbmYeurJCv8dSH3TcsZAU4DD3tcjejyrwIh1ICAUD6kTbXqArgbH6yy293HFHW5osGYzF0VzMdSQ77THlAk3HKg809BGdX4uWI76Bgz2i5m5x4x0yAzq4G4lcPQ8GJK8QBKqgVcPaA7TWZ_cTRIUN8KOFTmQUeBKBOa_JYFOxFEYuleSJo258pPuD94hIljp_HlVhg981_U7bO8GIRCeQ9LgA1Q7KH7iigAXp0iIDqjVlhZQnlGx7RrffDKAAx9gPSCpWchA.A8Bwywzvu6TbSpAujfyc7Q \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_grantee_observer.info b/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_grantee_observer.info deleted file mode 100644 index 02a5d09534..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_grantee_observer.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0MzowMS43NjMxOSAtMDQwMCBFRFQgbT0rMC4wNTMwODM2MjYiLCJlbmMiOiJBMjU2R0NNIiwicDJjIjo4MTkyLCJwMnMiOiIyTTl6cUt0LXJ5SHI0bWQ4In0.JPSrRojRa4o-XnLFdwlYXMNt9ambBj2dk8x6MrcTgYqDN8mc5pVxyA.a1DfAB-caPcTJGCf._qj_0WQkA0w5RksGsCLu843ZSf3dEhyTUkgcRmKHzCSDlhWBrNYWyH3F08BynLBilXhEtlVNwVPkw0KUuJQpBgXKeqG3SVZmmVCG3ya74KhLKkGclj1vTAV29BRYPCBiVoW4FzuGHMXaY7wmK7p9IzHpAvM2o9guXyHAfFSI3Cu7ApaK6J_Hi4dm5JO878ut5WfUFTKbHfL7Ug0agdOZLxWWgS0Cl3j2dbzPGu6__ZEt3cAuC1HCiM-ZT_TsXg22JwLPXZrF6Tkc8YHZ88OyJB1f-Oj3hDJjclnyrrrrYhveJQWm-j7n04e8IzPVya_awnYcx1lnNllmNjdbrwhddV_OrKWiCHwbf01Nxh7FEitbZ-BueJGZC3vyPNZ8D1QvxpfscPtAVyUp1gGg8zOB4oZSPyC1GxSpV5H9SSY7So40z3ZRASfBTnT4MyINfpMRNxZNWAZ9cgjbuN1eTkQbM6tEWwfrO2Pb8hPwkhqoig.GPVPZvsAfFUbkMq8ZC0xMA \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_tss_signer.info b/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_tss_signer.info deleted file mode 100644 index 39d27f565c..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_tss_signer.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0Njo0NC4wNjEyMTIgLTA0MDAgRURUIG09KzAuMDUwMjA3MjA5IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiV3lxaFBFQjZ6WXJzM2RPXyJ9.290M1SfpJK48RxlDlhZbEwKtM4I-g83cXSMBMoUCXmBQxB5lZ-JmqQ.K8mYyNIe0l8igkff.k0ZwxItS5K1ju26RIqtGLsz4VhRZtYMuUrdE-QtW17Jv1nPZoaA6OJAmefQ6wzFvvw4ibfB-BywLnL4kneCZUvra3gaUorYB4mPCqD3SG5Fc0JSjbxtQddqE0_u8yVbR1OriQp3c8ISD8d-EnOtsFnOKppXZkZKdtMDZaS3KlWbYQZlbI2wmsF2PWpVlAtUmVSRoSr1jVxgcxyah_IhTrgkdr4ut5LwLtq53lbaDYLWLapdgEh7BZkiGe_pcCDLA0vA4DnytilMRwJOJGdtuKTLUePtFJKvZ3yBhl7Apft5KTJkNKpADDhsOwwXCjRixgNeq7RPPEFLvrPiiXFI0756IWQkx1ClYAu3YqFxqEE_BA8_9aILLqstsVFLoCRreESeMrj6LVR17Dw85c4aGWrJheiP2kW4LjFDfOLz_Dlt4dfrPFViadoy8OVQnQd6WvQisV96RhDYvPXJ7WNzi4rw.4-ZdET4cTohzRvJkKgzysw \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_zetaclient_grantee.info b/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_zetaclient_grantee.info deleted file mode 100644 index 02a5d09534..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/keyring-test/val_zetaclient_grantee.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMy0xNCAxMzo0MzowMS43NjMxOSAtMDQwMCBFRFQgbT0rMC4wNTMwODM2MjYiLCJlbmMiOiJBMjU2R0NNIiwicDJjIjo4MTkyLCJwMnMiOiIyTTl6cUt0LXJ5SHI0bWQ4In0.JPSrRojRa4o-XnLFdwlYXMNt9ambBj2dk8x6MrcTgYqDN8mc5pVxyA.a1DfAB-caPcTJGCf._qj_0WQkA0w5RksGsCLu843ZSf3dEhyTUkgcRmKHzCSDlhWBrNYWyH3F08BynLBilXhEtlVNwVPkw0KUuJQpBgXKeqG3SVZmmVCG3ya74KhLKkGclj1vTAV29BRYPCBiVoW4FzuGHMXaY7wmK7p9IzHpAvM2o9guXyHAfFSI3Cu7ApaK6J_Hi4dm5JO878ut5WfUFTKbHfL7Ug0agdOZLxWWgS0Cl3j2dbzPGu6__ZEt3cAuC1HCiM-ZT_TsXg22JwLPXZrF6Tkc8YHZ88OyJB1f-Oj3hDJjclnyrrrrYhveJQWm-j7n04e8IzPVya_awnYcx1lnNllmNjdbrwhddV_OrKWiCHwbf01Nxh7FEitbZ-BueJGZC3vyPNZ8D1QvxpfscPtAVyUp1gGg8zOB4oZSPyC1GxSpV5H9SSY7So40z3ZRASfBTnT4MyINfpMRNxZNWAZ9cgjbuN1eTkQbM6tEWwfrO2Pb8hPwkhqoig.GPVPZvsAfFUbkMq8ZC0xMA \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/priv_validator_state.json b/contrib/localnet/zetacored/zetacored_zetacore1/priv_validator_state.json deleted file mode 100644 index 48f3b67e3f..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore1/priv_validator_state.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "height": "0", - "round": 0, - "step": 0 -} \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore2/keyring-test/val_grantee_observer.info b/contrib/localnet/zetacored/zetacored_zetacore2/keyring-test/val_grantee_observer.info deleted file mode 100644 index e3b234b8f7..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore2/keyring-test/val_grantee_observer.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wNC0yNSAyMzowNjoyMC4zMzMyMzIgLTA1MDAgQ0RUIG09KzIuNTMzMDEwNTg0IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiVWw5LUR0ZEdZem1PM3NjUCJ9.k1WnRjLpq8FSfVIeoVC63cLg3O7MD6hrr73Jqjo_QjJb6NN72XmVfg.39eUA-phLevsiuPv.ABfiTwSU6yD5p9FoaoGOIY4nR5N7VSutP22ril2fY_uR-4xSk53t8QvEjmhYIc2fSsCpwTy-eMl7ojrnVaVWBkYW7Od90sDcOIMuBDmMD9ZL7yyVwJpncOhgTBIxqjDEPrmbWj9Up95312LYNMALlK5OvPHYCcs4D-RqPoXiG0tSbbFHzJzwfliHco_ykN_VyjK-phynFM-bz7F2YKCB6jSr_DDqqBSfQvgW6h6vrElziXYknXbKIAogBDlJui77WhzTUBq147jW50dQ4TQNozmlFEFqDz8a0CSViQnaZo6MZv7yWWVZ6XcrwNZ0wEIpY-9eFvsoJVT0xStlByj8Oyz5MS5fK-R4p3nPm_N4IF3Q1qN66_MiTUUwCciomHq_IY79u-5EZdQvyybPg3kR49wAChGZnDmDRNh4Ub-UzXl8KW2G460hnnnrFG4GjaHSnSRtYOyQ76fj_O9oSyEjs17q4HYwDDiCxKj5yBUbig.awpOYDjuZsLQfUZeB0CLSg \ No newline at end of file diff --git a/contrib/localnet/zetacored/zetacored_zetacore3/keyring-test/val_grantee_observer.info b/contrib/localnet/zetacored/zetacored_zetacore3/keyring-test/val_grantee_observer.info deleted file mode 100644 index 699f776d90..0000000000 --- a/contrib/localnet/zetacored/zetacored_zetacore3/keyring-test/val_grantee_observer.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wNC0yNSAyMzowNjo1NS4zODY0NDkgLTA1MDAgQ0RUIG09KzEuMzM4MDkwMTI2IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiS0Q4X0lSalpXc1F2SUQxNyJ9.KBqjE_t5slsBRq7FlezI_ijmrMGL5QPdRxRscl4eUQqF820s5G0J8w.d6G3oiMff6D6GRZH.EmCB_wYAZxa4jSTr4cbdEvCjMmFGFGO6Ag0lGRxhptmMPvMHMp_jek0cB-EZ8YJ3lpIeaOucXW-fD_CJCB5sfOJfaSOLP7Kk44FSJDoGoGeFNq0JkqYO_97Q0jBZRfx9Vkph_0NNF3VqpazgsUZppZ3V5GwbxccYroFIERSyO8Q8aPB75i7i7LFaPVZvGiZTjJ0Ms-Ba1REBBj10ehqbAZ5-qCNDVRakKKGM5SSP4gC2YAoa1LHDIr-uwyvrCRaNyYbZWxqc19fzUAEdPDq6fmlWIEJUitidyjUnDy0eTS08ilKJBOpltpQ9X_cKS9X-0feDqhnXNq_eEdIV1JnhzXME6JqbpnkmfmsTEH1OtGEdv6mZCi_OcTtgrZOTRQIUFCxF2SbM8BziimBmEKKnYJ-ozk47GDl92pHRbMgbh1rJMHQlQulV_1UzPgxA9MxWmkoe3HBTffUR0F_sD3G9NWue1WKyR29hwmB1_FMKZA.xNk2jOBJDKxYGUI7CmY3ew \ No newline at end of file From 2c76429ac3b19f9ada74ea22b194de1a78e5acae Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:46:25 -0500 Subject: [PATCH 4/9] refactor: create base signer and signer structs to group common data of EVM/Bitcoin signer and observer (#2344) * save local new files to remote * initiated base observer * move base to chains folder * moved logger to base package * added base signer and logger * added changelog entry * added metrics server to base signer/observer * added more descriptions for constants and base structs --------- Co-authored-by: Lucas Bertrand --- changelog.md | 1 + cmd/zetaclientd/main.go | 64 ---- cmd/zetaclientd/start.go | 9 +- cmd/zetaclientd/utils.go | 26 +- zetaclient/chains/base/logger.go | 109 ++++++ zetaclient/chains/base/logger_test.go | 97 +++++ zetaclient/chains/base/observer.go | 343 +++++++++++++++++ zetaclient/chains/base/observer_test.go | 359 ++++++++++++++++++ zetaclient/chains/base/signer.go | 96 +++++ zetaclient/chains/base/signer_test.go | 74 ++++ .../chains/bitcoin/observer/live_test.go | 4 +- .../chains/bitcoin/observer/observer.go | 8 +- .../chains/bitcoin/observer/observer_test.go | 6 +- zetaclient/chains/bitcoin/signer/signer.go | 8 +- .../chains/bitcoin/signer/signer_test.go | 8 +- zetaclient/chains/evm/observer/observer.go | 10 +- .../chains/evm/observer/observer_test.go | 4 +- zetaclient/chains/evm/signer/signer.go | 12 +- zetaclient/chains/evm/signer/signer_test.go | 6 +- zetaclient/common/logger.go | 20 - zetaclient/context/zetacore_context_test.go | 8 +- zetaclient/types/defs.go | 5 - 22 files changed, 1133 insertions(+), 144 deletions(-) create mode 100644 zetaclient/chains/base/logger.go create mode 100644 zetaclient/chains/base/logger_test.go create mode 100644 zetaclient/chains/base/observer.go create mode 100644 zetaclient/chains/base/observer_test.go create mode 100644 zetaclient/chains/base/signer.go create mode 100644 zetaclient/chains/base/signer_test.go delete mode 100644 zetaclient/common/logger.go delete mode 100644 zetaclient/types/defs.go diff --git a/changelog.md b/changelog.md index 41d63adac2..970f77a4da 100644 --- a/changelog.md +++ b/changelog.md @@ -46,6 +46,7 @@ * [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags * [2306](https://github.com/zeta-chain/node/pull/2306) - refactor zetaclient outbound transaction signing logic * [2296](https://github.com/zeta-chain/node/pull/2296) - move `testdata` package to `testutil` to organize test-related utilities +* [2344](https://github.com/zeta-chain/node/pull/2344) - group common data of EVM/Bitcoin signer and observer using base structs ### Tests diff --git a/cmd/zetaclientd/main.go b/cmd/zetaclientd/main.go index fdac54a7d0..99aaf55c10 100644 --- a/cmd/zetaclientd/main.go +++ b/cmd/zetaclientd/main.go @@ -3,24 +3,15 @@ package main import ( "math/rand" "os" - "path/filepath" "time" ecdsakeygen "github.com/binance-chain/tss-lib/ecdsa/keygen" "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/types" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" - "github.com/zeta-chain/zetacore/zetaclient/config" -) - -const ( - ComplianceLogFile = "compliance.log" ) var ( @@ -53,58 +44,3 @@ func SetupConfigForTest() { rand.Seed(time.Now().UnixNano()) } - -func InitLogger(cfg config.Config) (clientcommon.ClientLogger, error) { - // open compliance log file - file, err := OpenComplianceLogFile(cfg) - if err != nil { - return clientcommon.DefaultLoggers(), err - } - - var logger zerolog.Logger - var loggerCompliance zerolog.Logger - switch cfg.LogFormat { - case "json": - logger = zerolog.New(os.Stdout).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger() - loggerCompliance = zerolog.New(file).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger() - case "text": - logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}). - Level(zerolog.Level(cfg.LogLevel)). - With(). - Timestamp(). - Logger() - loggerCompliance = zerolog.New(file).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger() - default: - logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}) - loggerCompliance = zerolog.New(file).With().Timestamp().Logger() - } - - if cfg.LogSampler { - logger = logger.Sample(&zerolog.BasicSampler{N: 5}) - } - log.Logger = logger // set global logger - - return clientcommon.ClientLogger{ - Std: log.Logger, - Compliance: loggerCompliance, - }, nil -} - -func OpenComplianceLogFile(cfg config.Config) (*os.File, error) { - // use zetacore home as default - logPath := cfg.ZetaCoreHome - if cfg.ComplianceConfig.LogPath != "" { - logPath = cfg.ComplianceConfig.LogPath - } - - // clean file name - name := filepath.Join(logPath, ComplianceLogFile) - name, err := filepath.Abs(name) - if err != nil { - return nil, err - } - name = filepath.Clean(name) - - // open (or create) compliance log file - return os.OpenFile(name, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) -} diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index 9c964ea26e..c815b616c0 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -24,6 +24,7 @@ import ( "github.com/zeta-chain/zetacore/pkg/authz" "github.com/zeta-chain/zetacore/pkg/constant" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -61,7 +62,7 @@ func start(_ *cobra.Command, _ []string) error { if err != nil { return err } - loggers, err := InitLogger(cfg) + logger, err := base.InitLogger(cfg) if err != nil { log.Error().Err(err).Msg("InitLogger failed") return err @@ -76,7 +77,7 @@ func start(_ *cobra.Command, _ []string) error { } } - masterLogger := loggers.Std + masterLogger := logger.Std startLogger := masterLogger.With().Str("module", "startup").Logger() // Wait until zetacore is up @@ -267,7 +268,7 @@ func start(_ *cobra.Command, _ []string) error { } // CreateSignerMap: This creates a map of all signers for each chain . Each signer is responsible for signing transactions for a particular chain - signerMap, err := CreateSignerMap(appContext, tss, loggers, telemetryServer) + signerMap, err := CreateSignerMap(appContext, tss, logger, telemetryServer) if err != nil { log.Error().Err(err).Msg("CreateSignerMap") return err @@ -281,7 +282,7 @@ func start(_ *cobra.Command, _ []string) error { dbpath := filepath.Join(userDir, ".zetaclient/chainobserver") // Creates a map of all chain observers for each chain. Each chain observer is responsible for observing events on the chain and processing them. - observerMap, err := CreateChainObserverMap(appContext, zetacoreClient, tss, dbpath, loggers, telemetryServer) + observerMap, err := CreateChainObserverMap(appContext, zetacoreClient, tss, dbpath, logger, telemetryServer) if err != nil { startLogger.Err(err).Msg("CreateChainObserverMap") return err diff --git a/cmd/zetaclientd/utils.go b/cmd/zetaclientd/utils.go index 7c37c00380..521c6dc858 100644 --- a/cmd/zetaclientd/utils.go +++ b/cmd/zetaclientd/utils.go @@ -5,12 +5,12 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/zetacore/zetaclient/authz" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" btcobserver "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin/observer" btcsigner "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin/signer" evmobserver "github.com/zeta-chain/zetacore/zetaclient/chains/evm/observer" evmsigner "github.com/zeta-chain/zetacore/zetaclient/chains/evm/signer" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/keys" @@ -57,7 +57,7 @@ func CreateZetacoreClient( func CreateSignerMap( appContext *context.AppContext, tss interfaces.TSSSigner, - loggers clientcommon.ClientLogger, + logger base.Logger, ts *metrics.TelemetryServer, ) (map[int64]interfaces.ChainSigner, error) { coreContext := appContext.ZetacoreContext() @@ -70,7 +70,7 @@ func CreateSignerMap( } evmChainParams, found := coreContext.GetEVMChainParams(evmConfig.Chain.ChainId) if !found { - loggers.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String()) + logger.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String()) continue } mpiAddress := ethcommon.HexToAddress(evmChainParams.ConnectorContractAddress) @@ -84,10 +84,10 @@ func CreateSignerMap( mpiAddress, erc20CustodyAddress, coreContext, - loggers, + logger, ts) if err != nil { - loggers.Std.Error().Err(err).Msgf("NewEVMSigner error for chain %s", evmConfig.Chain.String()) + logger.Std.Error().Err(err).Msgf("NewEVMSigner error for chain %s", evmConfig.Chain.String()) continue } signerMap[evmConfig.Chain.ChainId] = signer @@ -95,9 +95,9 @@ func CreateSignerMap( // BTC signer btcChain, btcConfig, enabled := appContext.GetBTCChainAndConfig() if enabled { - signer, err := btcsigner.NewSigner(btcConfig, tss, loggers, ts, coreContext) + signer, err := btcsigner.NewSigner(btcConfig, tss, logger, ts, coreContext) if err != nil { - loggers.Std.Error().Err(err).Msgf("NewBTCSigner error for chain %s", btcChain.String()) + logger.Std.Error().Err(err).Msgf("NewBTCSigner error for chain %s", btcChain.String()) } else { signerMap[btcChain.ChainId] = signer } @@ -112,7 +112,7 @@ func CreateChainObserverMap( zetacoreClient *zetacore.Client, tss interfaces.TSSSigner, dbpath string, - loggers clientcommon.ClientLogger, + logger base.Logger, ts *metrics.TelemetryServer, ) (map[int64]interfaces.ChainObserver, error) { observerMap := make(map[int64]interfaces.ChainObserver) @@ -123,12 +123,12 @@ func CreateChainObserverMap( } _, found := appContext.ZetacoreContext().GetEVMChainParams(evmConfig.Chain.ChainId) if !found { - loggers.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String()) + logger.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String()) continue } - co, err := evmobserver.NewObserver(appContext, zetacoreClient, tss, dbpath, loggers, evmConfig, ts) + co, err := evmobserver.NewObserver(appContext, zetacoreClient, tss, dbpath, logger, evmConfig, ts) if err != nil { - loggers.Std.Error().Err(err).Msgf("NewObserver error for evm chain %s", evmConfig.Chain.String()) + logger.Std.Error().Err(err).Msgf("NewObserver error for evm chain %s", evmConfig.Chain.String()) continue } observerMap[evmConfig.Chain.ChainId] = co @@ -136,9 +136,9 @@ func CreateChainObserverMap( // BTC observer btcChain, btcConfig, enabled := appContext.GetBTCChainAndConfig() if enabled { - co, err := btcobserver.NewObserver(appContext, btcChain, zetacoreClient, tss, dbpath, loggers, btcConfig, ts) + co, err := btcobserver.NewObserver(appContext, btcChain, zetacoreClient, tss, dbpath, logger, btcConfig, ts) if err != nil { - loggers.Std.Error().Err(err).Msgf("NewObserver error for bitcoin chain %s", btcChain.String()) + logger.Std.Error().Err(err).Msgf("NewObserver error for bitcoin chain %s", btcChain.String()) } else { observerMap[btcChain.ChainId] = co diff --git a/zetaclient/chains/base/logger.go b/zetaclient/chains/base/logger.go new file mode 100644 index 0000000000..eeffcfab3b --- /dev/null +++ b/zetaclient/chains/base/logger.go @@ -0,0 +1,109 @@ +package base + +import ( + "os" + "path/filepath" + "time" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "github.com/zeta-chain/zetacore/zetaclient/config" +) + +const ( + ComplianceLogFile = "compliance.log" +) + +// Logger contains the base loggers +type Logger struct { + Std zerolog.Logger + Compliance zerolog.Logger +} + +// DefaultLoggers creates default base loggers for tests +func DefaultLogger() Logger { + return Logger{ + Std: log.Logger, + Compliance: log.Logger, + } +} + +// ObserverLogger contains the loggers for chain observers +type ObserverLogger struct { + // the parent logger for the chain observer + Chain zerolog.Logger + + // the logger for inbound transactions + Inbound zerolog.Logger + + // the logger for outbound transactions + Outbound zerolog.Logger + + // the logger for the chain's gas price + GasPrice zerolog.Logger + + // the logger for block headers + Headers zerolog.Logger + + // the logger for the compliance check + Compliance zerolog.Logger +} + +// InitLogger initializes the base loggers +func InitLogger(cfg config.Config) (Logger, error) { + // open compliance log file + file, err := openComplianceLogFile(cfg) + if err != nil { + return DefaultLogger(), err + } + + // create loggers based on configured level and format + var std zerolog.Logger + var compliance zerolog.Logger + switch cfg.LogFormat { + case "json": + std = zerolog.New(os.Stdout).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger() + compliance = zerolog.New(file).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger() + case "text": + std = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}). + Level(zerolog.Level(cfg.LogLevel)). + With(). + Timestamp(). + Logger() + compliance = zerolog.New(file).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger() + default: + std = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}) + compliance = zerolog.New(file).With().Timestamp().Logger() + } + + if cfg.LogSampler { + std = std.Sample(&zerolog.BasicSampler{N: 5}) + } + log.Logger = std // set global logger + + return Logger{ + Std: std, + Compliance: compliance, + }, nil +} + +// openComplianceLogFile opens the compliance log file +func openComplianceLogFile(cfg config.Config) (*os.File, error) { + // use zetacore home as default + logPath := cfg.ZetaCoreHome + if cfg.ComplianceConfig.LogPath != "" { + logPath = cfg.ComplianceConfig.LogPath + } + + // clean file name + name := filepath.Join(logPath, ComplianceLogFile) + name, err := filepath.Abs(name) + if err != nil { + return nil, err + } + name = filepath.Clean(name) + + // open (or create) compliance log file + return os.OpenFile(name, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) +} diff --git a/zetaclient/chains/base/logger_test.go b/zetaclient/chains/base/logger_test.go new file mode 100644 index 0000000000..07c2859b0e --- /dev/null +++ b/zetaclient/chains/base/logger_test.go @@ -0,0 +1,97 @@ +package base_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/zetaclient/chains/base" + "github.com/zeta-chain/zetacore/zetaclient/config" +) + +func TestInitLogger(t *testing.T) { + // test cases + tests := []struct { + name string + t *testing.T + cfg config.Config + fail bool + }{ + { + name: "should be able to initialize json formatted logger", + cfg: config.Config{ + LogFormat: "json", + LogLevel: 1, // zerolog.InfoLevel, + ComplianceConfig: config.ComplianceConfig{ + LogPath: createTempDir(t), + }, + }, + fail: false, + }, + { + name: "should be able to initialize plain text logger", + cfg: config.Config{ + LogFormat: "text", + LogLevel: 2, // zerolog.WarnLevel, + ComplianceConfig: config.ComplianceConfig{ + LogPath: createTempDir(t), + }, + }, + fail: false, + }, + { + name: "should be able to initialize default formatted logger", + cfg: config.Config{ + LogFormat: "unknown", + LogLevel: 3, // zerolog.ErrorLevel, + ComplianceConfig: config.ComplianceConfig{ + LogPath: createTempDir(t), + }, + }, + fail: false, + }, + { + name: "should be able to initialize sampled logger", + cfg: config.Config{ + LogFormat: "json", + LogLevel: 4, // zerolog.DebugLevel, + LogSampler: true, + ComplianceConfig: config.ComplianceConfig{ + LogPath: createTempDir(t), + }, + }, + }, + { + name: "should fail on invalid compliance log path", + cfg: config.Config{ + LogFormat: "json", + LogLevel: 1, // zerolog.InfoLevel, + ComplianceConfig: config.ComplianceConfig{ + LogPath: "/invalid/123path", + }, + }, + fail: true, + }, + } + + // run tests + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // init logger + logger, err := base.InitLogger(tt.cfg) + + // check if error is expected + if tt.fail { + require.Error(t, err) + return + } + + // check if logger is initialized + require.NoError(t, err) + + // should be able to print log + logger.Std.Info().Msg("print standard log") + logger.Compliance.Info().Msg("print compliance log") + }) + } +} diff --git a/zetaclient/chains/base/observer.go b/zetaclient/chains/base/observer.go new file mode 100644 index 0000000000..905775b2b2 --- /dev/null +++ b/zetaclient/chains/base/observer.go @@ -0,0 +1,343 @@ +package base + +import ( + "fmt" + "os" + "strconv" + "sync/atomic" + + lru "github.com/hashicorp/golang-lru" + "github.com/pkg/errors" + "github.com/rs/zerolog" + "gorm.io/driver/sqlite" + "gorm.io/gorm" + + "github.com/zeta-chain/zetacore/pkg/chains" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" + "github.com/zeta-chain/zetacore/zetaclient/context" + "github.com/zeta-chain/zetacore/zetaclient/metrics" + clienttypes "github.com/zeta-chain/zetacore/zetaclient/types" +) + +const ( + // EnvVarLatestBlock is the environment variable that forces the observer to scan from the latest block + EnvVarLatestBlock = "latest" + + // DefaultBlockCacheSize is the default number of blocks that the observer will keep in cache for performance (without RPC calls) + // Cached blocks can be used to get block information and verify transactions + DefaultBlockCacheSize = 1000 + + // DefaultHeadersCacheSize is the default number of headers that the observer will keep in cache for performance (without RPC calls) + // Cached headers can be used to get header information + DefaultHeadersCacheSize = 1000 +) + +// Observer is the base structure for chain observers, grouping the common logic for each chain observer client. +// The common logic includes: chain, chainParams, contexts, zetacore client, tss, lastBlock, db, metrics, loggers etc. +type Observer struct { + // chain contains static information about the observed chain + chain chains.Chain + + // chainParams contains the dynamic chain parameters of the observed chain + chainParams observertypes.ChainParams + + // coreContext contains context data of ZetaChain + zetacoreContext *context.ZetacoreContext + + // zetacoreClient is the client to interact with ZetaChain + zetacoreClient interfaces.ZetacoreClient + + // tss is the TSS signer + tss interfaces.TSSSigner + + // lastBlock is the last block height of the observed chain + lastBlock uint64 + + // lastBlockScanned is the last block height scanned by the observer + lastBlockScanned uint64 + + // blockCache is the cache for blocks + blockCache *lru.Cache + + // headerCache is the cache for headers + headerCache *lru.Cache + + // db is the database to persist data + db *gorm.DB + + // ts is the telemetry server for metrics + ts *metrics.TelemetryServer + + // logger contains the loggers used by observer + logger ObserverLogger + + // stop is the channel to signal the observer to stop + stop chan struct{} +} + +// NewObserver creates a new base observer. +func NewObserver( + chain chains.Chain, + chainParams observertypes.ChainParams, + zetacoreContext *context.ZetacoreContext, + zetacoreClient interfaces.ZetacoreClient, + tss interfaces.TSSSigner, + blockCacheSize int, + headersCacheSize int, + dbPath string, + ts *metrics.TelemetryServer, + logger Logger, +) (*Observer, error) { + ob := Observer{ + chain: chain, + chainParams: chainParams, + zetacoreContext: zetacoreContext, + zetacoreClient: zetacoreClient, + tss: tss, + lastBlock: 0, + lastBlockScanned: 0, + ts: ts, + stop: make(chan struct{}), + } + + // setup loggers + ob.WithLogger(logger) + + // create block cache + var err error + ob.blockCache, err = lru.New(blockCacheSize) + if err != nil { + return nil, errors.Wrap(err, "error creating block cache") + } + + // create header cache + ob.headerCache, err = lru.New(headersCacheSize) + if err != nil { + return nil, errors.Wrap(err, "error creating header cache") + } + + // open database + err = ob.OpenDB(dbPath) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("error opening observer db for chain: %s", chain.ChainName)) + } + + return &ob, nil +} + +// Chain returns the chain for the observer. +func (ob *Observer) Chain() chains.Chain { + return ob.chain +} + +// WithChain attaches a new chain to the observer. +func (ob *Observer) WithChain(chain chains.Chain) *Observer { + ob.chain = chain + return ob +} + +// ChainParams returns the chain params for the observer. +func (ob *Observer) ChainParams() observertypes.ChainParams { + return ob.chainParams +} + +// WithChainParams attaches a new chain params to the observer. +func (ob *Observer) WithChainParams(params observertypes.ChainParams) *Observer { + ob.chainParams = params + return ob +} + +// ZetacoreContext returns the zetacore context for the observer. +func (ob *Observer) ZetacoreContext() *context.ZetacoreContext { + return ob.zetacoreContext +} + +// WithZetacoreContext attaches a new zetacore context to the observer. +func (ob *Observer) WithZetacoreContext(context *context.ZetacoreContext) *Observer { + ob.zetacoreContext = context + return ob +} + +// ZetacoreClient returns the zetacore client for the observer. +func (ob *Observer) ZetacoreClient() interfaces.ZetacoreClient { + return ob.zetacoreClient +} + +// WithZetacoreClient attaches a new zetacore client to the observer. +func (ob *Observer) WithZetacoreClient(client interfaces.ZetacoreClient) *Observer { + ob.zetacoreClient = client + return ob +} + +// Tss returns the tss signer for the observer. +func (ob *Observer) TSS() interfaces.TSSSigner { + return ob.tss +} + +// WithTSS attaches a new tss signer to the observer. +func (ob *Observer) WithTSS(tss interfaces.TSSSigner) *Observer { + ob.tss = tss + return ob +} + +// LastBlock get external last block height. +func (ob *Observer) LastBlock() uint64 { + return atomic.LoadUint64(&ob.lastBlock) +} + +// WithLastBlock set external last block height. +func (ob *Observer) WithLastBlock(lastBlock uint64) *Observer { + atomic.StoreUint64(&ob.lastBlock, lastBlock) + return ob +} + +// LastBlockScanned get last block scanned (not necessarily caught up with the chain; could be slow/paused). +func (ob *Observer) LastBlockScanned() uint64 { + height := atomic.LoadUint64(&ob.lastBlockScanned) + return height +} + +// WithLastBlockScanned set last block scanned (not necessarily caught up with the chain; could be slow/paused). +func (ob *Observer) WithLastBlockScanned(blockNumber uint64) *Observer { + atomic.StoreUint64(&ob.lastBlockScanned, blockNumber) + metrics.LastScannedBlockNumber.WithLabelValues(ob.chain.ChainName.String()).Set(float64(blockNumber)) + return ob +} + +// BlockCache returns the block cache for the observer. +func (ob *Observer) BlockCache() *lru.Cache { + return ob.blockCache +} + +// WithBlockCache attaches a new block cache to the observer. +func (ob *Observer) WithBlockCache(cache *lru.Cache) *Observer { + ob.blockCache = cache + return ob +} + +// HeaderCache returns the header cache for the observer. +func (ob *Observer) HeaderCache() *lru.Cache { + return ob.headerCache +} + +// WithHeaderCache attaches a new header cache to the observer. +func (ob *Observer) WithHeaderCache(cache *lru.Cache) *Observer { + ob.headerCache = cache + return ob +} + +// DB returns the database for the observer. +func (ob *Observer) DB() *gorm.DB { + return ob.db +} + +// Logger returns the logger for the observer. +func (ob *Observer) Logger() ObserverLogger { + return ob.logger +} + +// WithLogger attaches a new logger to the observer. +func (ob *Observer) WithLogger(logger Logger) *Observer { + chainLogger := logger.Std.With().Int64("chain", ob.chain.ChainId).Logger() + ob.logger = ObserverLogger{ + Chain: chainLogger, + Inbound: chainLogger.With().Str("module", "inbound").Logger(), + Outbound: chainLogger.With().Str("module", "outbound").Logger(), + GasPrice: chainLogger.With().Str("module", "gasprice").Logger(), + Headers: chainLogger.With().Str("module", "headers").Logger(), + Compliance: logger.Compliance, + } + return ob +} + +// Stop returns the stop channel for the observer. +func (ob *Observer) Stop() chan struct{} { + return ob.stop +} + +// OpenDB open sql database in the given path. +func (ob *Observer) OpenDB(dbPath string) error { + if dbPath != "" { + // create db path if not exist + if _, err := os.Stat(dbPath); os.IsNotExist(err) { + err := os.MkdirAll(dbPath, os.ModePerm) + if err != nil { + return errors.Wrap(err, "error creating db path") + } + } + + // open db by chain name + chainName := ob.chain.ChainName.String() + path := fmt.Sprintf("%s/%s", dbPath, chainName) + db, err := gorm.Open(sqlite.Open(path), &gorm.Config{}) + if err != nil { + return errors.Wrap(err, "error opening db") + } + + // migrate db + err = db.AutoMigrate(&clienttypes.ReceiptSQLType{}, + &clienttypes.TransactionSQLType{}, + &clienttypes.LastBlockSQLType{}) + if err != nil { + return errors.Wrap(err, "error migrating db") + } + ob.db = db + } + return nil +} + +// LoadLastBlockScanned loads last scanned block from environment variable or from database. +// The last scanned block is the height from which the observer should continue scanning. +func (ob *Observer) LoadLastBlockScanned(logger zerolog.Logger) (fromLatest bool, err error) { + // get environment variable + envvar := EnvVarLatestBlockByChain(ob.chain) + scanFromBlock := os.Getenv(envvar) + + // load from environment variable if set + if scanFromBlock != "" { + logger.Info(). + Msgf("LoadLastBlockScanned: envvar %s is set; scan from block %s", envvar, scanFromBlock) + if scanFromBlock == EnvVarLatestBlock { + return true, nil + } + blockNumber, err := strconv.ParseUint(scanFromBlock, 10, 64) + if err != nil { + return false, err + } + ob.WithLastBlockScanned(blockNumber) + return false, nil + } + + // load from DB otherwise. If not found, start from latest block + blockNumber, err := ob.ReadLastBlockScannedFromDB() + if err != nil { + logger.Info().Msgf("LoadLastBlockScanned: chain %d starts scanning from latest block", ob.chain.ChainId) + return true, nil + } + ob.WithLastBlockScanned(blockNumber) + logger.Info(). + Msgf("LoadLastBlockScanned: chain %d starts scanning from block %d", ob.chain.ChainId, ob.LastBlockScanned()) + + return false, nil +} + +// WriteLastBlockScannedToDB saves the last scanned block to the database. +func (ob *Observer) WriteLastBlockScannedToDB(lastScannedBlock uint64) error { + return ob.db.Save(clienttypes.ToLastBlockSQLType(lastScannedBlock)).Error +} + +// ReadLastBlockScannedFromDB reads the last scanned block from the database. +func (ob *Observer) ReadLastBlockScannedFromDB() (uint64, error) { + var lastBlock clienttypes.LastBlockSQLType + if err := ob.db.First(&lastBlock, clienttypes.LastBlockNumID).Error; err != nil { + // record not found + return 0, err + } + return lastBlock.Num, nil +} + +// EnvVarLatestBlock returns the environment variable for the latest block by chain. +func EnvVarLatestBlockByChain(chain chains.Chain) string { + return chain.ChainName.String() + "_SCAN_FROM" +} diff --git a/zetaclient/chains/base/observer_test.go b/zetaclient/chains/base/observer_test.go new file mode 100644 index 0000000000..7dd2f18081 --- /dev/null +++ b/zetaclient/chains/base/observer_test.go @@ -0,0 +1,359 @@ +package base_test + +import ( + "os" + "testing" + + lru "github.com/hashicorp/golang-lru" + "github.com/rs/zerolog/log" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/testutil/sample" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" + "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" + "github.com/zeta-chain/zetacore/zetaclient/config" + "github.com/zeta-chain/zetacore/zetaclient/context" + "github.com/zeta-chain/zetacore/zetaclient/testutils/mocks" +) + +// create a temporary directory for testing +func createTempDir(t *testing.T) string { + tempPath, err := os.MkdirTemp("", "tempdir-") + require.NoError(t, err) + return tempPath +} + +// createObserver creates a new observer for testing +func createObserver(t *testing.T, dbPath string) *base.Observer { + // constructor parameters + chain := chains.Ethereum + chainParams := *sample.ChainParams(chain.ChainId) + zetacoreContext := context.NewZetacoreContext(config.NewConfig()) + zetacoreClient := mocks.NewMockZetacoreClient() + tss := mocks.NewTSSMainnet() + + // create observer + logger := base.DefaultLogger() + ob, err := base.NewObserver( + chain, + chainParams, + zetacoreContext, + zetacoreClient, + tss, + base.DefaultBlockCacheSize, + base.DefaultHeadersCacheSize, + dbPath, + nil, + logger, + ) + require.NoError(t, err) + + return ob +} + +func TestNewObserver(t *testing.T) { + // constructor parameters + chain := chains.Ethereum + chainParams := *sample.ChainParams(chain.ChainId) + zetacoreContext := context.NewZetacoreContext(config.NewConfig()) + zetacoreClient := mocks.NewMockZetacoreClient() + tss := mocks.NewTSSMainnet() + blockCacheSize := base.DefaultBlockCacheSize + headersCacheSize := base.DefaultHeadersCacheSize + dbPath := createTempDir(t) + + // test cases + tests := []struct { + name string + chain chains.Chain + chainParams observertypes.ChainParams + zetacoreContext *context.ZetacoreContext + zetacoreClient interfaces.ZetacoreClient + tss interfaces.TSSSigner + blockCacheSize int + headersCacheSize int + dbPath string + fail bool + message string + }{ + { + name: "should be able to create new observer", + chain: chain, + chainParams: chainParams, + zetacoreContext: zetacoreContext, + zetacoreClient: zetacoreClient, + tss: tss, + blockCacheSize: blockCacheSize, + headersCacheSize: headersCacheSize, + dbPath: dbPath, + fail: false, + }, + { + name: "should return error on invalid block cache size", + chain: chain, + chainParams: chainParams, + zetacoreContext: zetacoreContext, + zetacoreClient: zetacoreClient, + tss: tss, + blockCacheSize: 0, + headersCacheSize: headersCacheSize, + dbPath: dbPath, + fail: true, + message: "error creating block cache", + }, + { + name: "should return error on invalid header cache size", + chain: chain, + chainParams: chainParams, + zetacoreContext: zetacoreContext, + zetacoreClient: zetacoreClient, + tss: tss, + blockCacheSize: blockCacheSize, + headersCacheSize: 0, + dbPath: dbPath, + fail: true, + message: "error creating header cache", + }, + { + name: "should return error on invalid db path", + chain: chain, + chainParams: chainParams, + zetacoreContext: zetacoreContext, + zetacoreClient: zetacoreClient, + tss: tss, + blockCacheSize: blockCacheSize, + headersCacheSize: headersCacheSize, + dbPath: "/invalid/123db", + fail: true, + message: "error opening observer db", + }, + } + + // run tests + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ob, err := base.NewObserver( + tt.chain, + tt.chainParams, + tt.zetacoreContext, + tt.zetacoreClient, + tt.tss, + tt.blockCacheSize, + tt.headersCacheSize, + tt.dbPath, + nil, + base.DefaultLogger(), + ) + if tt.fail { + require.ErrorContains(t, err, tt.message) + require.Nil(t, ob) + return + } + + require.NoError(t, err) + require.NotNil(t, ob) + }) + } +} + +func TestObserverGetterAndSetter(t *testing.T) { + dbPath := createTempDir(t) + + t.Run("should be able to update chain", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update chain + newChain := chains.BscMainnet + ob = ob.WithChain(chains.BscMainnet) + require.Equal(t, newChain, ob.Chain()) + }) + t.Run("should be able to update chain params", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update chain params + newChainParams := *sample.ChainParams(chains.BscMainnet.ChainId) + ob = ob.WithChainParams(newChainParams) + require.True(t, observertypes.ChainParamsEqual(newChainParams, ob.ChainParams())) + }) + t.Run("should be able to update zetacore context", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update zetacore context + newZetacoreContext := context.NewZetacoreContext(config.NewConfig()) + ob = ob.WithZetacoreContext(newZetacoreContext) + require.Equal(t, newZetacoreContext, ob.ZetacoreContext()) + }) + t.Run("should be able to update zetacore client", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update zetacore client + newZetacoreClient := mocks.NewMockZetacoreClient() + ob = ob.WithZetacoreClient(newZetacoreClient) + require.Equal(t, newZetacoreClient, ob.ZetacoreClient()) + }) + t.Run("should be able to update tss", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update tss + newTSS := mocks.NewTSSAthens3() + ob = ob.WithTSS(newTSS) + require.Equal(t, newTSS, ob.TSS()) + }) + t.Run("should be able to update last block", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update last block + newLastBlock := uint64(100) + ob = ob.WithLastBlock(newLastBlock) + require.Equal(t, newLastBlock, ob.LastBlock()) + }) + t.Run("should be able to update last block scanned", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update last block scanned + newLastBlockScanned := uint64(100) + ob = ob.WithLastBlockScanned(newLastBlockScanned) + require.Equal(t, newLastBlockScanned, ob.LastBlockScanned()) + }) + t.Run("should be able to replace block cache", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update block cache + newBlockCache, err := lru.New(200) + require.NoError(t, err) + + ob = ob.WithBlockCache(newBlockCache) + require.Equal(t, newBlockCache, ob.BlockCache()) + }) + t.Run("should be able to replace headers cache", func(t *testing.T) { + ob := createObserver(t, dbPath) + + // update headers cache + newHeadersCache, err := lru.New(200) + require.NoError(t, err) + + ob = ob.WithHeaderCache(newHeadersCache) + require.Equal(t, newHeadersCache, ob.HeaderCache()) + }) + t.Run("should be able to get database", func(t *testing.T) { + ob := createObserver(t, dbPath) + + db := ob.DB() + require.NotNil(t, db) + }) + t.Run("should be able to get logger", func(t *testing.T) { + ob := createObserver(t, dbPath) + logger := ob.Logger() + + // should be able to print log + logger.Chain.Info().Msg("print chain log") + logger.Inbound.Info().Msg("print inbound log") + logger.Outbound.Info().Msg("print outbound log") + logger.GasPrice.Info().Msg("print gasprice log") + logger.Headers.Info().Msg("print headers log") + logger.Compliance.Info().Msg("print compliance log") + }) +} + +func TestOpenDB(t *testing.T) { + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + + t.Run("should be able to open db", func(t *testing.T) { + err := ob.OpenDB(dbPath) + require.NoError(t, err) + }) + t.Run("should return error on invalid db path", func(t *testing.T) { + err := ob.OpenDB("/invalid/123db") + require.ErrorContains(t, err, "error creating db path") + }) +} + +func TestLoadLastBlockScanned(t *testing.T) { + chain := chains.Ethereum + envvar := base.EnvVarLatestBlockByChain(chain) + + t.Run("should be able to load last block scanned", func(t *testing.T) { + // create db and write 100 as last block scanned + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + ob.WriteLastBlockScannedToDB(100) + + // read last block scanned + fromLatest, err := ob.LoadLastBlockScanned(log.Logger) + require.NoError(t, err) + require.EqualValues(t, 100, ob.LastBlockScanned()) + require.False(t, fromLatest) + }) + t.Run("should use latest block if last block scanned not found", func(t *testing.T) { + // create empty db + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + + // read last block scanned + fromLatest, err := ob.LoadLastBlockScanned(log.Logger) + require.NoError(t, err) + require.True(t, fromLatest) + }) + t.Run("should overwrite last block scanned if env var is set", func(t *testing.T) { + // create db and write 100 as last block scanned + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + ob.WriteLastBlockScannedToDB(100) + + // set env var + os.Setenv(envvar, "101") + + // read last block scanned + fromLatest, err := ob.LoadLastBlockScanned(log.Logger) + require.NoError(t, err) + require.EqualValues(t, 101, ob.LastBlockScanned()) + require.False(t, fromLatest) + + // set env var to 'latest' + os.Setenv(envvar, base.EnvVarLatestBlock) + + // read last block scanned + fromLatest, err = ob.LoadLastBlockScanned(log.Logger) + require.NoError(t, err) + require.True(t, fromLatest) + }) + t.Run("should return error on invalid env var", func(t *testing.T) { + // create db and write 100 as last block scanned + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + + // set invalid env var + os.Setenv(envvar, "invalid") + + // read last block scanned + fromLatest, err := ob.LoadLastBlockScanned(log.Logger) + require.Error(t, err) + require.False(t, fromLatest) + }) +} + +func TestReadWriteLastBlockScannedToDB(t *testing.T) { + t.Run("should be able to write and read last block scanned to db", func(t *testing.T) { + // create db and write 100 as last block scanned + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + err := ob.WriteLastBlockScannedToDB(100) + require.NoError(t, err) + + lastBlockScanned, err := ob.ReadLastBlockScannedFromDB() + require.NoError(t, err) + require.EqualValues(t, 100, lastBlockScanned) + }) + t.Run("should return error when last block scanned not found in db", func(t *testing.T) { + // create empty db + dbPath := createTempDir(t) + ob := createObserver(t, dbPath) + + lastScannedBlock, err := ob.ReadLastBlockScannedFromDB() + require.Error(t, err) + require.Zero(t, lastScannedBlock) + }) +} diff --git a/zetaclient/chains/base/signer.go b/zetaclient/chains/base/signer.go new file mode 100644 index 0000000000..2585218767 --- /dev/null +++ b/zetaclient/chains/base/signer.go @@ -0,0 +1,96 @@ +package base + +import ( + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" + "github.com/zeta-chain/zetacore/zetaclient/context" + "github.com/zeta-chain/zetacore/zetaclient/metrics" +) + +// Signer is the base structure for grouping the common logic between chain signers. +// The common logic includes: chain, chainParams, contexts, tss, metrics, loggers etc. +type Signer struct { + // chain contains static information about the external chain + chain chains.Chain + + // zetacoreContext is the Zetacore client to interact with ZetaChain + zetacoreContext *context.ZetacoreContext + + // tss is the TSS signer + tss interfaces.TSSSigner + + // ts is the telemetry server for metrics + ts *metrics.TelemetryServer + + // logger contains the loggers used by signer + logger Logger +} + +// NewSigner creates a new base signer +func NewSigner( + chain chains.Chain, + zetacoreContext *context.ZetacoreContext, + tss interfaces.TSSSigner, + ts *metrics.TelemetryServer, + logger Logger, +) *Signer { + return &Signer{ + chain: chain, + zetacoreContext: zetacoreContext, + tss: tss, + ts: ts, + logger: Logger{ + Std: logger.Std.With().Int64("chain", chain.ChainId).Str("module", "signer").Logger(), + Compliance: logger.Compliance, + }, + } +} + +// Chain returns the chain for the signer +func (s *Signer) Chain() chains.Chain { + return s.chain +} + +// WithChain attaches a new chain to the signer +func (s *Signer) WithChain(chain chains.Chain) *Signer { + s.chain = chain + return s +} + +// ZetacoreContext returns the zetacore context for the signer +func (s *Signer) ZetacoreContext() *context.ZetacoreContext { + return s.zetacoreContext +} + +// WithZetacoreContext attaches a new zetacore context to the signer +func (s *Signer) WithZetacoreContext(context *context.ZetacoreContext) *Signer { + s.zetacoreContext = context + return s +} + +// Tss returns the tss signer for the signer +func (s *Signer) TSS() interfaces.TSSSigner { + return s.tss +} + +// WithTSS attaches a new tss signer to the signer +func (s *Signer) WithTSS(tss interfaces.TSSSigner) *Signer { + s.tss = tss + return s +} + +// TelemetryServer returns the telemetry server for the signer +func (s *Signer) TelemetryServer() *metrics.TelemetryServer { + return s.ts +} + +// WithTelemetryServer attaches a new telemetry server to the signer +func (s *Signer) WithTelemetryServer(ts *metrics.TelemetryServer) *Signer { + s.ts = ts + return s +} + +// Logger returns the logger for the signer +func (s *Signer) Logger() *Logger { + return &s.logger +} diff --git a/zetaclient/chains/base/signer_test.go b/zetaclient/chains/base/signer_test.go new file mode 100644 index 0000000000..960c508d6e --- /dev/null +++ b/zetaclient/chains/base/signer_test.go @@ -0,0 +1,74 @@ +package base_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" + "github.com/zeta-chain/zetacore/zetaclient/config" + "github.com/zeta-chain/zetacore/zetaclient/context" + "github.com/zeta-chain/zetacore/zetaclient/metrics" + "github.com/zeta-chain/zetacore/zetaclient/testutils/mocks" +) + +// createSigner creates a new signer for testing +func createSigner(_ *testing.T) *base.Signer { + // constructor parameters + chain := chains.Ethereum + zetacoreContext := context.NewZetacoreContext(config.NewConfig()) + tss := mocks.NewTSSMainnet() + logger := base.DefaultLogger() + + // create signer + return base.NewSigner(chain, zetacoreContext, tss, nil, logger) +} + +func TestNewSigner(t *testing.T) { + signer := createSigner(t) + require.NotNil(t, signer) +} + +func TestSignerGetterAndSetter(t *testing.T) { + t.Run("should be able to update chain", func(t *testing.T) { + signer := createSigner(t) + + // update chain + newChain := chains.BscMainnet + signer = signer.WithChain(chains.BscMainnet) + require.Equal(t, newChain, signer.Chain()) + }) + t.Run("should be able to update zetacore context", func(t *testing.T) { + signer := createSigner(t) + + // update zetacore context + newZetacoreContext := context.NewZetacoreContext(config.NewConfig()) + signer = signer.WithZetacoreContext(newZetacoreContext) + require.Equal(t, newZetacoreContext, signer.ZetacoreContext()) + }) + t.Run("should be able to update tss", func(t *testing.T) { + signer := createSigner(t) + + // update tss + newTSS := mocks.NewTSSAthens3() + signer = signer.WithTSS(newTSS) + require.Equal(t, newTSS, signer.TSS()) + }) + t.Run("should be able to update telemetry server", func(t *testing.T) { + signer := createSigner(t) + + // update telemetry server + newTs := metrics.NewTelemetryServer() + signer = signer.WithTelemetryServer(newTs) + require.Equal(t, newTs, signer.TelemetryServer()) + }) + t.Run("should be able to get logger", func(t *testing.T) { + ob := createSigner(t) + logger := ob.Logger() + + // should be able to print log + logger.Std.Info().Msg("print standard log") + logger.Compliance.Info().Msg("print compliance log") + }) +} diff --git a/zetaclient/chains/bitcoin/observer/live_test.go b/zetaclient/chains/bitcoin/observer/live_test.go index 51bedbf1ef..dd1053f620 100644 --- a/zetaclient/chains/bitcoin/observer/live_test.go +++ b/zetaclient/chains/bitcoin/observer/live_test.go @@ -21,8 +21,8 @@ import ( "github.com/stretchr/testify/suite" "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" clientcontext "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/testutils" @@ -49,7 +49,7 @@ func (suite *BitcoinObserverTestSuite) SetupTest() { } appContext := clientcontext.NewAppContext(&clientcontext.ZetacoreContext{}, config.Config{}) client, err := NewObserver(appContext, chains.BitcoinRegtest, nil, tss, tempSQLiteDbPath, - clientcommon.DefaultLoggers(), config.BTCConfig{}, nil) + base.DefaultLogger(), config.BTCConfig{}, nil) suite.Require().NoError(err) suite.rpcClient, err = getRPCClient(18332) suite.Require().NoError(err) diff --git a/zetaclient/chains/bitcoin/observer/observer.go b/zetaclient/chains/bitcoin/observer/observer.go index 062f00c2c7..6b93ba12cd 100644 --- a/zetaclient/chains/bitcoin/observer/observer.go +++ b/zetaclient/chains/bitcoin/observer/observer.go @@ -28,9 +28,9 @@ import ( "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/proofs" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -138,7 +138,7 @@ func NewObserver( zetacoreClient interfaces.ZetacoreClient, tss interfaces.TSSSigner, dbpath string, - loggers clientcommon.ClientLogger, + logger base.Logger, btcCfg config.BTCConfig, ts *metrics.TelemetryServer, ) (*Observer, error) { @@ -158,14 +158,14 @@ func NewObserver( ob.Mu = &sync.Mutex{} - chainLogger := loggers.Std.With().Str("chain", chain.ChainName.String()).Logger() + chainLogger := logger.Std.With().Str("chain", chain.ChainName.String()).Logger() ob.logger = Logger{ Chain: chainLogger, Inbound: chainLogger.With().Str("module", "WatchInbound").Logger(), Outbound: chainLogger.With().Str("module", "WatchOutbound").Logger(), UTXOs: chainLogger.With().Str("module", "WatchUTXOs").Logger(), GasPrice: chainLogger.With().Str("module", "WatchGasPrice").Logger(), - Compliance: loggers.Compliance, + Compliance: logger.Compliance, } ob.zetacoreClient = zetacoreClient diff --git a/zetaclient/chains/bitcoin/observer/observer_test.go b/zetaclient/chains/bitcoin/observer/observer_test.go index dfba6b3dbc..2d2494dd16 100644 --- a/zetaclient/chains/bitcoin/observer/observer_test.go +++ b/zetaclient/chains/bitcoin/observer/observer_test.go @@ -14,7 +14,7 @@ import ( "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" observertypes "github.com/zeta-chain/zetacore/x/observer/types" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -75,11 +75,11 @@ func TestNewBitcoinObserver(t *testing.T) { chain := chains.BitcoinMainnet zetacoreClient := mocks.NewMockZetacoreClient() tss := mocks.NewMockTSS(chains.BitcoinTestnet, sample.EthAddress().String(), "") - loggers := clientcommon.ClientLogger{} + logger := base.Logger{} btcCfg := cfg.BitcoinConfig ts := metrics.NewTelemetryServer() - client, err := NewObserver(appContext, chain, zetacoreClient, tss, tempSQLiteDbPath, loggers, btcCfg, ts) + client, err := NewObserver(appContext, chain, zetacoreClient, tss, tempSQLiteDbPath, logger, btcCfg, ts) require.ErrorContains(t, err, "btc chains params not initialized") require.Nil(t, client) }) diff --git a/zetaclient/chains/bitcoin/signer/signer.go b/zetaclient/chains/bitcoin/signer/signer.go index 12c5b2b100..f2d47fd988 100644 --- a/zetaclient/chains/bitcoin/signer/signer.go +++ b/zetaclient/chains/bitcoin/signer/signer.go @@ -21,10 +21,10 @@ import ( "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin" "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin/observer" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/compliance" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" @@ -56,7 +56,7 @@ type Signer struct { func NewSigner( cfg config.BTCConfig, tssSigner interfaces.TSSSigner, - loggers clientcommon.ClientLogger, + logger base.Logger, ts *metrics.TelemetryServer, coreContext *context.ZetacoreContext) (*Signer, error) { connCfg := &rpcclient.ConnConfig{ @@ -75,8 +75,8 @@ func NewSigner( return &Signer{ tssSigner: tssSigner, rpcClient: client, - logger: loggers.Std.With().Str("chain", "BTC").Str("module", "BTCSigner").Logger(), - loggerCompliance: loggers.Compliance, + logger: logger.Std.With().Str("chain", "BTC").Str("module", "BTCSigner").Logger(), + loggerCompliance: logger.Compliance, ts: ts, coreContext: coreContext, }, nil diff --git a/zetaclient/chains/bitcoin/signer/signer_test.go b/zetaclient/chains/bitcoin/signer/signer_test.go index 6d048c7bba..74628211a4 100644 --- a/zetaclient/chains/bitcoin/signer/signer_test.go +++ b/zetaclient/chains/bitcoin/signer/signer_test.go @@ -18,8 +18,8 @@ import ( . "gopkg.in/check.v1" "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -52,7 +52,7 @@ func (s *BTCSignerSuite) SetUpTest(c *C) { s.btcSigner, err = NewSigner( config.BTCConfig{}, tss, - clientcommon.DefaultLoggers(), + base.DefaultLogger(), &metrics.TelemetryServer{}, context.NewZetacoreContext(cfg)) c.Assert(err, IsNil) @@ -233,7 +233,7 @@ func TestAddWithdrawTxOutputs(t *testing.T) { signer, err := NewSigner( config.BTCConfig{}, mocks.NewTSSMainnet(), - clientcommon.DefaultLoggers(), + base.DefaultLogger(), &metrics.TelemetryServer{}, nil, ) @@ -396,7 +396,7 @@ func TestNewBTCSigner(t *testing.T) { btcSigner, err := NewSigner( config.BTCConfig{}, tss, - clientcommon.DefaultLoggers(), + base.DefaultLogger(), &metrics.TelemetryServer{}, context.NewZetacoreContext(cfg)) require.NoError(t, err) diff --git a/zetaclient/chains/evm/observer/observer.go b/zetaclient/chains/evm/observer/observer.go index 795aa3b13b..99db258f5a 100644 --- a/zetaclient/chains/evm/observer/observer.go +++ b/zetaclient/chains/evm/observer/observer.go @@ -30,9 +30,9 @@ import ( "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/proofs" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/evm" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" clientcontext "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -93,7 +93,7 @@ func NewObserver( zetacoreClient interfaces.ZetacoreClient, tss interfaces.TSSSigner, dbpath string, - loggers clientcommon.ClientLogger, + logger base.Logger, evmCfg config.EVMConfig, ts *metrics.TelemetryServer, ) (*Observer, error) { @@ -101,13 +101,13 @@ func NewObserver( ts: ts, } - chainLogger := loggers.Std.With().Str("chain", evmCfg.Chain.ChainName.String()).Logger() + chainLogger := logger.Std.With().Str("chain", evmCfg.Chain.ChainName.String()).Logger() ob.logger = Logger{ Chain: chainLogger, Inbound: chainLogger.With().Str("module", "WatchInbound").Logger(), Outbound: chainLogger.With().Str("module", "WatchOutbound").Logger(), GasPrice: chainLogger.With().Str("module", "WatchGasPrice").Logger(), - Compliance: loggers.Compliance, + Compliance: logger.Compliance, } ob.coreContext = appContext.ZetacoreContext() @@ -581,7 +581,7 @@ func (ob *Observer) LoadLastScannedBlock() error { if scanFromBlock != "" { ob.logger.Chain.Info(). Msgf("LoadLastScannedBlock: envvar %s is set; scan from block %s", envvar, scanFromBlock) - if scanFromBlock == clienttypes.EnvVarLatest { + if scanFromBlock == base.EnvVarLatestBlock { header, err := ob.evmClient.HeaderByNumber(context.Background(), nil) if err != nil { return err diff --git a/zetaclient/chains/evm/observer/observer_test.go b/zetaclient/chains/evm/observer/observer_test.go index bfc85e15e1..0601c083f2 100644 --- a/zetaclient/chains/evm/observer/observer_test.go +++ b/zetaclient/chains/evm/observer/observer_test.go @@ -15,9 +15,9 @@ import ( "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/evm/observer" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/keys" @@ -83,7 +83,7 @@ func MockEVMObserver( appCtx, evmCfg := getAppContext(chain, ¶ms) // create chain observer - client, err := observer.NewObserver(appCtx, zetacoreClient, tss, "", common.ClientLogger{}, evmCfg, nil) + client, err := observer.NewObserver(appCtx, zetacoreClient, tss, "", base.Logger{}, evmCfg, nil) require.NoError(t, err) client.WithEvmClient(evmClient) client.WithEvmJSONRPC(evmJSONRPC) diff --git a/zetaclient/chains/evm/signer/signer.go b/zetaclient/chains/evm/signer/signer.go index 00f6f35fd5..d49895e2a3 100644 --- a/zetaclient/chains/evm/signer/signer.go +++ b/zetaclient/chains/evm/signer/signer.go @@ -27,10 +27,10 @@ import ( crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/evm" "github.com/zeta-chain/zetacore/zetaclient/chains/evm/observer" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/compliance" clientcontext "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -52,7 +52,7 @@ type Signer struct { chain *chains.Chain tssSigner interfaces.TSSSigner ethSigner ethtypes.Signer - logger clientcommon.ClientLogger + logger base.Logger ts *metrics.TelemetryServer coreContext *clientcontext.ZetacoreContext @@ -74,7 +74,7 @@ func NewSigner( zetaConnectorAddress ethcommon.Address, erc20CustodyAddress ethcommon.Address, coreContext *clientcontext.ZetacoreContext, - loggers clientcommon.ClientLogger, + logger base.Logger, ts *metrics.TelemetryServer, ) (*Signer, error) { client, ethSigner, err := getEVMRPC(endpoint) @@ -100,9 +100,9 @@ func NewSigner( zetaConnectorAddress: zetaConnectorAddress, er20CustodyAddress: erc20CustodyAddress, coreContext: coreContext, - logger: clientcommon.ClientLogger{ - Std: loggers.Std.With().Str("chain", chain.ChainName.String()).Str("module", "EVMSigner").Logger(), - Compliance: loggers.Compliance, + logger: base.Logger{ + Std: logger.Std.With().Str("chain", chain.ChainName.String()).Str("module", "EVMSigner").Logger(), + Compliance: logger.Compliance, }, ts: ts, mu: &sync.Mutex{}, diff --git a/zetaclient/chains/evm/signer/signer_test.go b/zetaclient/chains/evm/signer/signer_test.go index 06e33571a5..186582dd24 100644 --- a/zetaclient/chains/evm/signer/signer_test.go +++ b/zetaclient/chains/evm/signer/signer_test.go @@ -15,9 +15,9 @@ import ( "github.com/zeta-chain/zetacore/pkg/constant" "github.com/zeta-chain/zetacore/testutil/sample" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/evm/observer" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" - "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/keys" @@ -42,7 +42,7 @@ func getNewEvmSigner(tss interfaces.TSSSigner) (*Signer, error) { mpiAddress := ConnectorAddress erc20CustodyAddress := ERC20CustodyAddress - logger := common.ClientLogger{} + logger := base.Logger{} ts := &metrics.TelemetryServer{} cfg := config.NewConfig() @@ -66,7 +66,7 @@ func getNewEvmChainObserver(tss interfaces.TSSSigner) (*observer.Observer, error tss = mocks.NewTSSMainnet() } - logger := common.ClientLogger{} + logger := base.Logger{} ts := &metrics.TelemetryServer{} cfg := config.NewConfig() diff --git a/zetaclient/common/logger.go b/zetaclient/common/logger.go deleted file mode 100644 index ebe773abfc..0000000000 --- a/zetaclient/common/logger.go +++ /dev/null @@ -1,20 +0,0 @@ -package common - -import ( - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" -) - -// ClientLogger is a struct that contains the logger for a chain observer -type ClientLogger struct { - Std zerolog.Logger - Compliance zerolog.Logger -} - -// DefaultLoggers returns the default loggers for a chain observer -func DefaultLoggers() ClientLogger { - return ClientLogger{ - Std: log.Logger, - Compliance: log.Logger, - } -} diff --git a/zetaclient/context/zetacore_context_test.go b/zetaclient/context/zetacore_context_test.go index 0ee7d5bc8a..d8117e124b 100644 --- a/zetaclient/context/zetacore_context_test.go +++ b/zetaclient/context/zetacore_context_test.go @@ -4,13 +4,13 @@ import ( "testing" "github.com/rs/zerolog" + "github.com/rs/zerolog/log" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" - clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" context "github.com/zeta-chain/zetacore/zetaclient/context" ) @@ -179,7 +179,6 @@ func TestUpdateZetacoreContext(t *testing.T) { ChainId: 3, } tssPubKeyToUpdate := "tsspubkeytest" - loggers := clientcommon.DefaultLoggers() crosschainFlags := sample.CrosschainFlags() verificationFlags := sample.HeaderSupportedChains() @@ -193,7 +192,7 @@ func TestUpdateZetacoreContext(t *testing.T) { *crosschainFlags, verificationFlags, false, - loggers.Std, + log.Logger, ) // assert keygen updated @@ -285,7 +284,6 @@ func TestUpdateZetacoreContext(t *testing.T) { crosschainFlags := sample.CrosschainFlags() verificationFlags := sample.HeaderSupportedChains() require.NotNil(t, crosschainFlags) - loggers := clientcommon.DefaultLoggers() zetaContext.Update( &keyGenToUpdate, enabledChainsToUpdate, @@ -295,7 +293,7 @@ func TestUpdateZetacoreContext(t *testing.T) { *crosschainFlags, verificationFlags, false, - loggers.Std, + log.Logger, ) // assert keygen updated diff --git a/zetaclient/types/defs.go b/zetaclient/types/defs.go deleted file mode 100644 index 8bc79913fe..0000000000 --- a/zetaclient/types/defs.go +++ /dev/null @@ -1,5 +0,0 @@ -package types - -const ( - EnvVarLatest = "latest" -) From c667168df943a4016225dfd70e5472a4c18725ec Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Wed, 19 Jun 2024 20:12:10 +0300 Subject: [PATCH 5/9] ci: add infra label to issue form (#2352) * ci: add infra label to issue form * move link to description * formatting --------- Co-authored-by: Alex Gartner --- .github/ISSUE_TEMPLATE/syncing.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/syncing.yaml b/.github/ISSUE_TEMPLATE/syncing.yaml index 17884a3b32..6519c730f9 100644 --- a/.github/ISSUE_TEMPLATE/syncing.yaml +++ b/.github/ISSUE_TEMPLATE/syncing.yaml @@ -1,5 +1,6 @@ name: Having difficulties setting up or syncing a node description: Please fill out the following form to help us understand and resolve your issue with setting up or syncing a node. Provide as much detail as possible to ensure a quick and accurate resolution. +labels: ["infra"] body: - type: dropdown attributes: @@ -30,10 +31,10 @@ body: - KSYNC - type: dropdown attributes: - label: Did you build your binary from source or download it from the Releases[https://github.com/zeta-chain/node/releases] page? - description: We recommend using binaries from our releases page. + label: Did you build your binary from source or download it from the Releases page? + description: "We recommend using binaries from our Releases page: https://github.com/zeta-chain/node/releases" options: - - "Downloaded from releases page" + - "Downloaded from Releases page" - "Built locally" - type: textarea attributes: From a292450e4eb6bbd0b24bdcc0e0cf71b42c9915f7 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 19 Jun 2024 18:40:29 +0100 Subject: [PATCH 6/9] test: fix TODOs in rpc unit tests (#2329) --- changelog.md | 1 + rpc/backend/account_info_test.go | 55 +++++++------ rpc/backend/backend_suite_test.go | 1 + rpc/backend/call_tx.go | 2 +- rpc/backend/client_test.go | 27 ++++++- rpc/backend/node_info_test.go | 123 +++++++++++++++--------------- rpc/backend/sign_tx_test.go | 26 ++++++- 7 files changed, 149 insertions(+), 86 deletions(-) diff --git a/changelog.md b/changelog.md index 970f77a4da..02fe0dacd0 100644 --- a/changelog.md +++ b/changelog.md @@ -57,6 +57,7 @@ * [2240](https://github.com/zeta-chain/node/pull/2240) - removed hard-coded Bitcoin regnet chainID in E2E withdraw tests * [2266](https://github.com/zeta-chain/node/pull/2266) - try fixing E2E test `crosschain_swap` failure `btc transaction not signed` * [2294](https://github.com/zeta-chain/node/pull/2294) - add and fix existing ethermint rpc unit test +* [2329](https://github.com/zeta-chain/node/pull/2329) - fix TODOs in rpc unit tests * [2299](https://github.com/zeta-chain/node/pull/2299) - add `zetae2e` command to deploy test contracts ### Fixes diff --git a/rpc/backend/account_info_test.go b/rpc/backend/account_info_test.go index f54b743d5f..111b6bfb4f 100644 --- a/rpc/backend/account_info_test.go +++ b/rpc/backend/account_info_test.go @@ -5,6 +5,7 @@ import ( "math/big" tmrpcclient "github.com/cometbft/cometbft/rpc/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" @@ -82,6 +83,7 @@ func (suite *BackendTestSuite) TestGetProof() { blockNrInvalid := rpctypes.NewBlockNumber(big.NewInt(1)) blockNr := rpctypes.NewBlockNumber(big.NewInt(4)) address1 := tests.GenerateAddress() + expProofValue := big.NewInt(2) testCases := []struct { name string @@ -93,7 +95,7 @@ func (suite *BackendTestSuite) TestGetProof() { expAccRes *rpctypes.AccountResult }{ { - "fail - BlockNumeber = 1 (invalidBlockNumber)", + "fail - BlockNumber = 1 (invalidBlockNumber)", address1, []string{}, rpctypes.BlockNumberOrHash{BlockNumber: &blockNrInvalid}, @@ -139,6 +141,7 @@ func (suite *BackendTestSuite) TestGetProof() { "store/evm/key", evmtypes.StateKey(address1, common.HexToHash("0x0").Bytes()), tmrpcclient.ABCIQueryOptions{Height: iavlHeight, Prove: true}, + expProofValue.Bytes(), ) RegisterABCIQueryWithOptions( client, @@ -146,6 +149,7 @@ func (suite *BackendTestSuite) TestGetProof() { "store/acc/key", authtypes.AddressStoreKey(sdk.AccAddress(address1.Bytes())), tmrpcclient.ABCIQueryOptions{Height: iavlHeight, Prove: true}, + expProofValue.Bytes(), ) }, true, @@ -159,7 +163,7 @@ func (suite *BackendTestSuite) TestGetProof() { StorageProof: []rpctypes.StorageResult{ { Key: "0x0", - Value: (*hexutil.Big)(big.NewInt(2)), + Value: (*hexutil.Big)(expProofValue), Proof: []string{""}, }, }, @@ -415,27 +419,32 @@ func (suite *BackendTestSuite) TestGetTransactionCount() { false, hexutil.Uint64(0), }, - // TODO (https://github.com/zeta-chain/node/issues/2302): Error mocking the GetAccount call - problem with Any type - //{ - // "pass - returns the number of transactions at the given address up to the given block number", - // true, - // rpctypes.NewBlockNumber(big.NewInt(1)), - // func(addr common.Address, bn rpctypes.BlockNumber) { - // client := suite.backend.clientCtx.Client.(*mocks.Client) - // account, err := suite.backend.clientCtx.AccountRetriever.GetAccount(suite.backend.clientCtx, suite.acc) - // suite.Require().NoError(err) - // request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(suite.acc.Bytes()).String()} - // requestMarshal, _ := request.Marshal() - // RegisterABCIQueryAccount( - // client, - // requestMarshal, - // tmrpcclient.ABCIQueryOptions{Height: int64(1), Prove: false}, - // account, - // ) - // }, - // true, - // hexutil.Uint64(0), - //}, + { + "pass - returns the number of transactions at the given address up to the given block number", + true, + rpctypes.NewBlockNumber(big.NewInt(1)), + func(addr common.Address, bn rpctypes.BlockNumber) { + var header metadata.MD + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + RegisterParams(queryClient, &header, 1) + suite.backend.clientCtx = suite.backend.clientCtx.WithInterfaceRegistry( + codectypes.NewInterfaceRegistry(), + ) + client := suite.backend.clientCtx.Client.(*mocks.Client) + account, err := suite.backend.clientCtx.AccountRetriever.GetAccount(suite.backend.clientCtx, suite.acc) + suite.Require().NoError(err) + request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(suite.acc.Bytes()).String()} + requestMarshal, _ := request.Marshal() + RegisterABCIQueryAccount( + client, + requestMarshal, + tmrpcclient.ABCIQueryOptions{Height: int64(1), Prove: false}, + account, + ) + }, + true, + hexutil.Uint64(1), + }, } for _, tc := range testCases { suite.Run(fmt.Sprintf("Case %s", tc.name), func() { diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index 0194d5902f..18a74edfd8 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -55,6 +55,7 @@ func (suite *BackendTestSuite) SetupTest() { } // Create Account with set sequence + suite.acc = sdk.AccAddress(tests.GenerateAddress().Bytes()) accounts := map[string]client.TestAccount{} accounts[suite.acc.String()] = client.TestAccount{ diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 9df59ffd06..95bedf5a42 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -252,7 +252,7 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac } if args.Nonce == nil { // get the nonce from the account retriever - // ignore error in case tge account doesn't exist yet + // ignore error in case the account doesn't exist yet nonce, err := b.getAccountNonce(*args.From, true, 0, b.logger) if err != nil { nonce = 0 diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index 74d6ae0bfd..c94c7cc0e0 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -11,7 +11,9 @@ import ( "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" evmtypes "github.com/evmos/ethermint/x/evm/types" @@ -52,6 +54,11 @@ func RegisterBroadcastTx(client *mocks.Client, tx types.Tx) { Return(&tmrpctypes.ResultBroadcastTx{}, nil) } +func RegisterBroadcastTxAny(client *mocks.Client) { + client.On("BroadcastTxSync", context.Background(), mock.Anything). + Return(&tmrpctypes.ResultBroadcastTx{}, nil) +} + func RegisterBroadcastTxError(client *mocks.Client, tx types.Tx) { client.On("BroadcastTxSync", context.Background(), tx). Return(nil, errortypes.ErrInvalidRequest) @@ -274,11 +281,12 @@ func RegisterABCIQueryWithOptions( path string, data bytes.HexBytes, opts tmrpcclient.ABCIQueryOptions, + respValue []byte, ) { client.On("ABCIQueryWithOptions", context.Background(), path, data, opts). Return(&tmrpctypes.ResultABCIQuery{ Response: abci.ResponseQuery{ - Value: []byte{2}, // TODO (https://github.com/zeta-chain/node/issues/2302) replace with data.Bytes(), + Value: respValue, Height: height, }, }, nil) @@ -317,3 +325,20 @@ func RegisterABCIQueryAccount( }, }, nil) } + +func RegisterABCIQuerySimulate( + clients *mocks.Client, + opts tmrpcclient.ABCIQueryOptions, +) { + simResp := &tx.SimulateResponse{ + GasInfo: &sdk.GasInfo{GasWanted: uint64(21000), GasUsed: uint64(21000)}, + } + respBz, _ := simResp.Marshal() + clients.On("ABCIQueryWithOptions", context.Background(), "/cosmos.tx.v1beta1.Service/Simulate", mock.Anything, opts). + Return(&tmrpctypes.ResultABCIQuery{ + Response: abci.ResponseQuery{ + Value: respBz, + Height: 1, + }, + }, nil) +} diff --git a/rpc/backend/node_info_test.go b/rpc/backend/node_info_test.go index a98c433f11..7931cf4230 100644 --- a/rpc/backend/node_info_test.go +++ b/rpc/backend/node_info_test.go @@ -5,6 +5,9 @@ import ( "math/big" tmrpcclient "github.com/cometbft/cometbft/rpc/client" + "github.com/cosmos/cosmos-sdk/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" @@ -96,48 +99,24 @@ func (suite *BackendTestSuite) TestSetGasPrice() { } } -// TODO (https://github.com/zeta-chain/node/issues/2302): Combine these 2 into one test since the code is identical -func (suite *BackendTestSuite) TestListAccounts() { +func (suite *BackendTestSuite) TestAccounts() { testCases := []struct { - name string - registerMock func() - expAddr []common.Address - expPass bool + name string + accountsRetrievalMethod func() ([]common.Address, error) + registerMock func() + expAddr []common.Address + expPass bool }{ { - "pass - returns empty address", + "pass - returns acc from keyring from ListAccounts", + suite.backend.ListAccounts, func() {}, []common.Address{}, true, }, - } - - for _, tc := range testCases { - suite.Run(fmt.Sprintf("case %s", tc.name), func() { - suite.SetupTest() // reset test and queries - tc.registerMock() - - output, err := suite.backend.ListAccounts() - - if tc.expPass { - suite.Require().NoError(err) - suite.Require().Equal(tc.expAddr, output) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *BackendTestSuite) TestAccounts() { - testCases := []struct { - name string - registerMock func() - expAddr []common.Address - expPass bool - }{ { - "pass - returns empty address", + "pass - returns acc from keyring from Accounts", + suite.backend.Accounts, func() {}, []common.Address{}, true, @@ -149,7 +128,7 @@ func (suite *BackendTestSuite) TestAccounts() { suite.SetupTest() // reset test and queries tc.registerMock() - output, err := suite.backend.Accounts() + output, err := tc.accountsRetrievalMethod() if tc.expPass { suite.Require().NoError(err) @@ -272,31 +251,55 @@ func (suite *BackendTestSuite) TestSetEtherbase() { common.Address{}, false, }, - // TODO (https://github.com/zeta-chain/node/issues/2302): Finish this test case once ABCIQuery GetAccount is fixed - //{ - // "pass - set the etherbase for the miner", - // func() { - // client := suite.backend.clientCtx.Client.(*mocks.Client) - // queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) - // RegisterStatus(client) - // RegisterValidatorAccount(queryClient, suite.acc) - // c := sdk.NewDecCoin("azeta", sdk.NewIntFromBigInt(big.NewInt(1))) - // suite.backend.cfg.SetMinGasPrices(sdk.DecCoins{c}) - // delAddr, _ := suite.backend.GetCoinbase() - // account, _ := suite.backend.clientCtx.AccountRetriever.GetAccount(suite.backend.clientCtx, delAddr) - // delCommonAddr := common.BytesToAddress(delAddr.Bytes()) - // request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(delCommonAddr.Bytes()).String()} - // requestMarshal, _ := request.Marshal() - // RegisterABCIQueryAccount( - // client, - // requestMarshal, - // tmrpcclient.ABCIQueryOptions{Height: int64(1), Prove: false}, - // account, - // ) - // }, - // common.Address{}, - // false, - //}, + { + "pass - set the etherbase for the miner", + func() { + priv, err := ethsecp256k1.GenerateKey() + suite.Require().NoError(err) + + armor := crypto.EncryptArmorPrivKey(priv, "", "eth_secp256k1") + suite.backend.clientCtx.Keyring.ImportPrivKey("test_key", armor, "") + + suite.acc = sdk.AccAddress(priv.PubKey().Address().Bytes()) + accounts := map[string]client.TestAccount{} + accounts[suite.acc.String()] = client.TestAccount{ + Address: suite.acc, + Num: uint64(1), + Seq: uint64(1), + } + + suite.backend.clientCtx = suite.backend.clientCtx.WithAccountRetriever( + client.TestAccountRetriever{Accounts: accounts}, + ) + var header metadata.MD + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + RegisterParams(queryClient, &header, 1) + suite.backend.clientCtx = suite.backend.clientCtx.WithInterfaceRegistry( + codectypes.NewInterfaceRegistry(), + ) + client := suite.backend.clientCtx.Client.(*mocks.Client) + RegisterStatus(client) + RegisterValidatorAccount(queryClient, suite.acc) + c := sdk.NewDecCoin("azeta", sdk.NewIntFromBigInt(big.NewInt(1))) + suite.backend.cfg.SetMinGasPrices(sdk.DecCoins{c}) + delAddr, _ := suite.backend.GetCoinbase() + account, _ := suite.backend.clientCtx.AccountRetriever.GetAccount(suite.backend.clientCtx, delAddr) + delCommonAddr := common.BytesToAddress(delAddr.Bytes()) + request := &authtypes.QueryAccountRequest{Address: sdk.AccAddress(delCommonAddr.Bytes()).String()} + requestMarshal, _ := request.Marshal() + RegisterUnconfirmedTxsEmpty(client, nil) + RegisterABCIQueryAccount( + client, + requestMarshal, + tmrpcclient.ABCIQueryOptions{Height: int64(1), Prove: false}, + account, + ) + RegisterABCIQuerySimulate(client, tmrpcclient.ABCIQueryOptions{Height: int64(1), Prove: false}) + RegisterBroadcastTxAny(client) + }, + common.Address{}, + true, + }, } for _, tc := range testCases { diff --git a/rpc/backend/sign_tx_test.go b/rpc/backend/sign_tx_test.go index 153e326cd6..d50f6fb6bd 100644 --- a/rpc/backend/sign_tx_test.go +++ b/rpc/backend/sign_tx_test.go @@ -5,12 +5,15 @@ import ( "github.com/cosmos/cosmos-sdk/crypto" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" goethcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/evmos/ethermint/crypto/ethsecp256k1" + "github.com/evmos/ethermint/ethereum/eip712" "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" "google.golang.org/grpc/metadata" @@ -221,6 +224,18 @@ func (suite *BackendTestSuite) TestSign() { } func (suite *BackendTestSuite) TestSignTypedData() { + data := legacytx.StdSignBytes( + "0", + 1, + 1, + 0, + legacytx.StdFee{Gas: 10, Amount: sdk.Coins{}}, + []sdk.Msg{&banktypes.MsgSend{}}, + "", + nil, + ) + typedData, err := eip712.WrapTxToTypedData(0, data) + suite.Require().NoError(err) from, priv := tests.NewAddrKey() testCases := []struct { name string @@ -246,7 +261,16 @@ func (suite *BackendTestSuite) TestSignTypedData() { apitypes.TypedData{}, false, }, - // TODO (https://github.com/zeta-chain/node/issues/2302): Generate a TypedData msg + { + "sucess - valid typed data", + func() { + armor := crypto.EncryptArmorPrivKey(priv, "", "eth_secp256k1") + suite.backend.clientCtx.Keyring.ImportPrivKey("test_key", armor, "") + }, + from, + typedData, + true, + }, } for _, tc := range testCases { From f5a7aae561b9d43ec767f6772adc271636dc0e04 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 19 Jun 2024 19:07:01 +0100 Subject: [PATCH 7/9] test: synthetic eth txs unit tests (#2342) --- changelog.md | 1 + rpc/backend/backend_suite_test.go | 53 +++++++++ rpc/backend/blocks_test.go | 119 ++++++++++++++++++-- rpc/backend/call_tx_test.go | 5 +- rpc/backend/client_test.go | 34 +++--- rpc/backend/evm_query_client_test.go | 15 ++- rpc/backend/tracing_test.go | 4 +- rpc/backend/tx_info_test.go | 155 +++++++++++++++++++++++++-- rpc/types/events.go | 2 + x/fungible/keeper/evm.go | 2 +- 10 files changed, 351 insertions(+), 39 deletions(-) diff --git a/changelog.md b/changelog.md index 02fe0dacd0..ac1225b0c0 100644 --- a/changelog.md +++ b/changelog.md @@ -58,6 +58,7 @@ * [2266](https://github.com/zeta-chain/node/pull/2266) - try fixing E2E test `crosschain_swap` failure `btc transaction not signed` * [2294](https://github.com/zeta-chain/node/pull/2294) - add and fix existing ethermint rpc unit test * [2329](https://github.com/zeta-chain/node/pull/2329) - fix TODOs in rpc unit tests +* [2342](https://github.com/zeta-chain/node/pull/2342) - extend rpc unit tests with testing extension to include synthetic ethereum txs * [2299](https://github.com/zeta-chain/node/pull/2299) - add `zetae2e` command to deploy test contracts ### Fixes diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index 18a74edfd8..1abd882fd2 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -8,6 +8,7 @@ import ( "testing" dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -35,6 +36,30 @@ type BackendTestSuite struct { signer keyring.Signer } +// testTx is a dummy implementation of cosmos Tx used for testing. +type testTx struct { +} + +func (tx testTx) GetMsgs() []sdk.Msg { return nil } +func (tx testTx) GetSigners() []sdk.AccAddress { return nil } + +func (tx testTx) ValidateBasic() error { return nil } +func (t testTx) ProtoMessage() { panic("not implemented") } +func (t testTx) Reset() { panic("not implemented") } + +func (t testTx) String() string { panic("not implemented") } + +func (t testTx) Bytes() []byte { panic("not implemented") } + +func (t testTx) VerifySignature(msg []byte, sig []byte) bool { panic("not implemented") } + +func (t testTx) Type() string { panic("not implemented") } + +var ( + _ sdk.Tx = (*testTx)(nil) + _ sdk.Msg = (*testTx)(nil) +) + func TestBackendTestSuite(t *testing.T) { suite.Run(t, new(BackendTestSuite)) } @@ -118,6 +143,34 @@ func (suite *BackendTestSuite) buildEthereumTx() (*evmtypes.MsgEthereumTx, []byt return msgEthereumTx, bz } +func (suite *BackendTestSuite) buildSyntheticTxResult(txHash string) ([]byte, abci.ResponseDeliverTx) { + testTx := &testTx{} + txBuilder := suite.backend.clientCtx.TxConfig.NewTxBuilder() + txBuilder.SetSignatures() + txBuilder.SetMsgs(testTx) + bz, _ := suite.backend.clientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + return bz, abci.ResponseDeliverTx{ + Code: 0, + Events: []abci.Event{ + {Type: evmtypes.EventTypeEthereumTx, Attributes: []abci.EventAttribute{ + {Key: "ethereumTxHash", Value: txHash}, + {Key: "txIndex", Value: "8888"}, + {Key: "amount", Value: "1000"}, + {Key: "txGasUsed", Value: "21000"}, + {Key: "txHash", Value: ""}, + {Key: "recipient", Value: "0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7"}, + }}, + { + Type: "message", Attributes: []abci.EventAttribute{ + {Key: "sender", Value: "0x735b14BB79463307AAcBED86DAf3322B1e6226aB"}, + {Key: "txType", Value: "88"}, + {Key: "txNonce", Value: "1"}, + }, + }, + }, + } +} + // buildFormattedBlock returns a formatted block for testing func (suite *BackendTestSuite) buildFormattedBlock( blockRes *tmrpctypes.ResultBlockResults, diff --git a/rpc/backend/blocks_test.go b/rpc/backend/blocks_test.go index 218680ebe5..bec50ff5a5 100644 --- a/rpc/backend/blocks_test.go +++ b/rpc/backend/blocks_test.go @@ -6,6 +6,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/bytes" tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -19,6 +20,7 @@ import ( "github.com/zeta-chain/zetacore/rpc/backend/mocks" ethrpc "github.com/zeta-chain/zetacore/rpc/types" + "github.com/zeta-chain/zetacore/testutil/sample" ) func (suite *BackendTestSuite) TestBlockNumber() { @@ -140,7 +142,7 @@ func (suite *BackendTestSuite) TestGetBlockByNumber() { func(blockNum ethrpc.BlockNumber, baseFee sdkmath.Int, validator sdk.AccAddress, txBz []byte) { height := blockNum.Int64() client := suite.backend.clientCtx.Client.(*mocks.Client) - resBlock, _ = RegisterBlock(client, height, txBz) + resBlock, _ = RegisterBlock(client, height, []tmtypes.Tx{txBz}) RegisterBlockResultsError(client, blockNum.Int64()) }, true, @@ -157,7 +159,7 @@ func (suite *BackendTestSuite) TestGetBlockByNumber() { func(blockNum ethrpc.BlockNumber, baseFee sdkmath.Int, validator sdk.AccAddress, txBz []byte) { height := blockNum.Int64() client := suite.backend.clientCtx.Client.(*mocks.Client) - resBlock, _ = RegisterBlock(client, height, txBz) + resBlock, _ = RegisterBlock(client, height, []tmtypes.Tx{txBz}) blockRes, _ = RegisterBlockResults(client, blockNum.Int64()) RegisterConsensusParams(client, height) @@ -179,7 +181,7 @@ func (suite *BackendTestSuite) TestGetBlockByNumber() { func(blockNum ethrpc.BlockNumber, baseFee sdkmath.Int, validator sdk.AccAddress, txBz []byte) { height := blockNum.Int64() client := suite.backend.clientCtx.Client.(*mocks.Client) - resBlock, _ = RegisterBlock(client, height, txBz) + resBlock, _ = RegisterBlock(client, height, []tmtypes.Tx{txBz}) blockRes, _ = RegisterBlockResults(client, blockNum.Int64()) RegisterConsensusParams(client, height) @@ -497,7 +499,7 @@ func (suite *BackendTestSuite) TestGetBlockTransactionCountByNumber() { func(blockNum ethrpc.BlockNumber) { height := blockNum.Int64() client := suite.backend.clientCtx.Client.(*mocks.Client) - RegisterBlock(client, height, bz) + RegisterBlock(client, height, []tmtypes.Tx{bz}) RegisterBlockResults(client, height) }, hexutil.Uint(1), @@ -1268,7 +1270,7 @@ func (suite *BackendTestSuite) TestHeaderByNumber() { func(blockNum ethrpc.BlockNumber, baseFee sdkmath.Int) { height := blockNum.Int64() client := suite.backend.clientCtx.Client.(*mocks.Client) - expResultBlock, _ = RegisterBlock(client, height, bz) + expResultBlock, _ = RegisterBlock(client, height, []tmtypes.Tx{bz}) RegisterBlockResults(client, height) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) @@ -1471,7 +1473,7 @@ func (suite *BackendTestSuite) TestEthBlockByNumber() { func(blockNum ethrpc.BlockNumber) { height := blockNum.Int64() client := suite.backend.clientCtx.Client.(*mocks.Client) - RegisterBlock(client, height, bz) + RegisterBlock(client, height, []tmtypes.Tx{bz}) RegisterBlockResults(client, blockNum.Int64()) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) @@ -1613,3 +1615,108 @@ func (suite *BackendTestSuite) TestEthBlockFromTendermintBlock() { }) } } + +func (suite *BackendTestSuite) TestEthAndSyntheticMsgsFromTendermintBlock() { + // synthetic tx + hash := sample.Hash().Hex() + tx, txRes := suite.buildSyntheticTxResult(hash) + + // real tx + msgEthereumTx, _ := suite.buildEthereumTx() + realTx := suite.signAndEncodeEthTx(msgEthereumTx) + + suite.backend.indexer = nil + // block contains block real and synthetic tx + emptyBlock := tmtypes.MakeBlock(1, []tmtypes.Tx{realTx, tx}, nil, nil) + emptyBlock.ChainID = ChainID + blockHash := common.BigToHash(big.NewInt(1)).Bytes() + resBlock := &tmrpctypes.ResultBlock{Block: emptyBlock, BlockID: tmtypes.BlockID{Hash: bytes.HexBytes(blockHash)}} + blockRes := &tmrpctypes.ResultBlockResults{ + Height: 1, + TxsResults: []*types.ResponseDeliverTx{{}, &txRes}, + } + + // both real and synthetic should be returned + msgs, additionals := suite.backend.EthMsgsFromTendermintBlock(resBlock, blockRes) + suite.Require().Equal(2, len(msgs)) + suite.Require().Equal(2, len(additionals)) + + suite.Require().Nil(additionals[0]) + suite.Require().NotNil(additionals[1]) + + suite.Require().Equal(msgEthereumTx.Hash, msgs[0].Hash) + suite.Require().Equal(hash, msgs[1].Hash) +} + +func (suite *BackendTestSuite) TestEthAndSyntheticEthBlockByNumber() { + // synthetic tx + hash := sample.Hash().Hex() + tx, txRes := suite.buildSyntheticTxResult(hash) + + // real tx + msgEthereumTx, _ := suite.buildEthereumTx() + realTx := suite.signAndEncodeEthTx(msgEthereumTx) + + suite.backend.indexer = nil + client := suite.backend.clientCtx.Client.(*mocks.Client) + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + // block contains block real and synthetic tx + RegisterBlock(client, 1, []tmtypes.Tx{realTx, tx}) + RegisterBlockResultsWithTxResults(client, 1, []*types.ResponseDeliverTx{{}, &txRes}) + RegisterBaseFee(queryClient, sdk.NewInt(1)) + + // only real should be returned + block, err := suite.backend.EthBlockByNumber(1) + suite.Require().NoError(err) + suite.Require().Equal(1, len(block.Transactions())) + suite.Require().Equal(msgEthereumTx.Hash, block.Transactions()[0].Hash().String()) +} + +func (suite *BackendTestSuite) TestEthAndSyntheticGetBlockByNumber() { + // synthetic tx + hash := sample.Hash().Hex() + tx, txRes := suite.buildSyntheticTxResult(hash) + + // real tx + msgEthereumTx, _ := suite.buildEthereumTx() + realTx := suite.signAndEncodeEthTx(msgEthereumTx) + + suite.backend.indexer = nil + client := suite.backend.clientCtx.Client.(*mocks.Client) + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + // block contains block real and synthetic tx + RegisterBlock(client, 1, []tmtypes.Tx{realTx, tx}) + RegisterBlockResultsWithTxResults(client, 1, []*types.ResponseDeliverTx{{}, &txRes}) + RegisterBaseFee(queryClient, sdk.NewInt(1)) + RegisterValidatorAccount(queryClient, sdk.AccAddress(common.Address{}.Bytes())) + RegisterConsensusParams(client, 1) + + // both real and synthetic should be returned + block, err := suite.backend.GetBlockByNumber(1, false) + suite.Require().NoError(err) + + transactions := block["transactions"].([]interface{}) + suite.Require().Equal(2, len(transactions)) + suite.Require().Equal(common.HexToHash(msgEthereumTx.Hash), transactions[0]) + suite.Require().Equal(common.HexToHash(hash), transactions[1]) + + // both real and synthetic should be returned + block, err = suite.backend.GetBlockByNumber(1, true) + suite.Require().NoError(err) + + transactions = block["transactions"].([]interface{}) + suite.Require().Equal(2, len(transactions)) + resRealTx := transactions[0].(*ethrpc.RPCTransaction) + suite.Require().Equal(common.HexToHash(msgEthereumTx.Hash), resRealTx.Hash) + resSyntheticTx := transactions[1].(*ethrpc.RPCTransaction) + suite.Require().Equal(common.HexToHash(hash), resSyntheticTx.Hash) + + suite.Require().Equal(hash, resSyntheticTx.Hash.Hex()) + suite.Require().Equal("0x735b14BB79463307AAcBED86DAf3322B1e6226aB", resSyntheticTx.From.Hex()) + suite.Require().Equal("0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7", resSyntheticTx.To.Hex()) + suite.Require().Equal("0x58", resSyntheticTx.Type.String()) + suite.Require().Equal("0x1", resSyntheticTx.Nonce.String()) + suite.Require().Nil(resSyntheticTx.V) + suite.Require().Nil(resSyntheticTx.R) + suite.Require().Nil(resSyntheticTx.S) +} diff --git a/rpc/backend/call_tx_test.go b/rpc/backend/call_tx_test.go index e0c7158ceb..a30ef6a941 100644 --- a/rpc/backend/call_tx_test.go +++ b/rpc/backend/call_tx_test.go @@ -5,6 +5,7 @@ import ( "fmt" "math/big" + tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -400,7 +401,7 @@ func (suite *BackendTestSuite) TestDoCall() { func() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) - RegisterBlock(client, 1, bz) + RegisterBlock(client, 1, []tmtypes.Tx{bz}) RegisterEthCallError( queryClient, &evmtypes.EthCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64()}, @@ -416,7 +417,7 @@ func (suite *BackendTestSuite) TestDoCall() { func() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) - RegisterBlock(client, 1, bz) + RegisterBlock(client, 1, []tmtypes.Tx{bz}) RegisterEthCall( queryClient, &evmtypes.EthCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64()}, diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index c94c7cc0e0..952bc215b7 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -2,6 +2,7 @@ package backend import ( "context" + "math/big" "testing" abci "github.com/cometbft/cometbft/abci/types" @@ -38,6 +39,12 @@ func RegisterTxSearch(client *mocks.Client, query string, txBz []byte) { Return(&tmrpctypes.ResultTxSearch{Txs: resulTxs, TotalCount: 1}, nil) } +func RegisterTxSearchWithTxResult(client *mocks.Client, query string, txBz []byte, res abci.ResponseDeliverTx) { + resulTxs := []*tmrpctypes.ResultTx{{Tx: txBz, Height: 1, TxResult: res}} + client.On("TxSearch", rpc.ContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). + Return(&tmrpctypes.ResultTxSearch{Txs: resulTxs, TotalCount: 1}, nil) +} + func RegisterTxSearchEmpty(client *mocks.Client, query string) { client.On("TxSearch", rpc.ContextWithHeight(1), query, false, (*int)(nil), (*int)(nil), ""). Return(&tmrpctypes.ResultTxSearch{}, nil) @@ -94,36 +101,26 @@ func RegisterStatusError(client *mocks.Client) { } // Block -func RegisterBlockMultipleTxs( - client *mocks.Client, - height int64, - txs []types.Tx, -) (*tmrpctypes.ResultBlock, error) { - block := types.MakeBlock(height, txs, nil, nil) - block.ChainID = ChainID - resBlock := &tmrpctypes.ResultBlock{Block: block} - client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) - return resBlock, nil -} - func RegisterBlock( client *mocks.Client, height int64, - tx []byte, + txs []types.Tx, ) (*tmrpctypes.ResultBlock, error) { // without tx - if tx == nil { + if len(txs) == 0 { emptyBlock := types.MakeBlock(height, []types.Tx{}, nil, nil) emptyBlock.ChainID = ChainID - resBlock := &tmrpctypes.ResultBlock{Block: emptyBlock} + blockHash := common.BigToHash(big.NewInt(height)).Bytes() + resBlock := &tmrpctypes.ResultBlock{Block: emptyBlock, BlockID: types.BlockID{Hash: bytes.HexBytes(blockHash)}} client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) return resBlock, nil } // with tx - block := types.MakeBlock(height, []types.Tx{tx}, nil, nil) + block := types.MakeBlock(height, txs, nil, nil) block.ChainID = ChainID - resBlock := &tmrpctypes.ResultBlock{Block: block} + blockHash := common.BigToHash(big.NewInt(height)).Bytes() + resBlock := &tmrpctypes.ResultBlock{Block: block, BlockID: types.BlockID{Hash: bytes.HexBytes(blockHash)}} client.On("Block", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")).Return(resBlock, nil) return resBlock, nil } @@ -154,7 +151,8 @@ func TestRegisterBlock(t *testing.T) { emptyBlock := types.MakeBlock(height, []types.Tx{}, nil, nil) emptyBlock.ChainID = ChainID - resBlock := &tmrpctypes.ResultBlock{Block: emptyBlock} + blockHash := common.BigToHash(big.NewInt(height)).Bytes() + resBlock := &tmrpctypes.ResultBlock{Block: emptyBlock, BlockID: types.BlockID{Hash: blockHash}} require.Equal(t, resBlock, res) require.NoError(t, err) } diff --git a/rpc/backend/evm_query_client_test.go b/rpc/backend/evm_query_client_test.go index 24b32b1328..de50ef7ca6 100644 --- a/rpc/backend/evm_query_client_test.go +++ b/rpc/backend/evm_query_client_test.go @@ -39,14 +39,23 @@ func RegisterTraceTransactionWithPredecessors( predecessors []*evmtypes.MsgEthereumTx, ) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} - queryClient.On("TraceTx", rpc.ContextWithHeight(1), - &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, Predecessors: predecessors, ChainId: 7001}). + queryClient.On( + "TraceTx", + rpc.ContextWithHeight(1), + &evmtypes.QueryTraceTxRequest{ + Msg: msgEthTx, + BlockHash: "0000000000000000000000000000000000000000000000000000000000000001", + BlockNumber: 1, + Predecessors: predecessors, + ChainId: 7001, + }, + ). Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil) } func RegisterTraceTransaction(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} - queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, Predecessors: []*evmtypes.MsgEthereumTx{}, ChainId: 7001}). + queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockHash: "0000000000000000000000000000000000000000000000000000000000000001", BlockNumber: 1, Predecessors: []*evmtypes.MsgEthereumTx{}, ChainId: 7001}). Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil) } diff --git a/rpc/backend/tracing_test.go b/rpc/backend/tracing_test.go index feb6ca2c42..1abae1818b 100644 --- a/rpc/backend/tracing_test.go +++ b/rpc/backend/tracing_test.go @@ -117,7 +117,7 @@ func (suite *BackendTestSuite) TestTraceTransaction() { func() { queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) client := suite.backend.clientCtx.Client.(*mocks.Client) - RegisterBlockMultipleTxs(client, 1, []types.Tx{txBz, txBz2}) + RegisterBlock(client, 1, []types.Tx{txBz, txBz2}) RegisterTraceTransactionWithPredecessors( queryClient, msgEthereumTx2, @@ -195,7 +195,7 @@ func (suite *BackendTestSuite) TestTraceTransaction() { func() { queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) client := suite.backend.clientCtx.Client.(*mocks.Client) - RegisterBlock(client, 1, txBz) + RegisterBlock(client, 1, []types.Tx{txBz}) RegisterTraceTransaction(queryClient, msgEthereumTx) txResults := []*abci.ResponseDeliverTx{ { diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index 9827c6eff1..c76a26ead8 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -19,8 +19,149 @@ import ( "github.com/zeta-chain/zetacore/rpc/backend/mocks" rpctypes "github.com/zeta-chain/zetacore/rpc/types" + "github.com/zeta-chain/zetacore/testutil/sample" ) +func (suite *BackendTestSuite) TestGetSyntheticTransactionByHash() { + hash := sample.Hash().Hex() + _, txRes := suite.buildSyntheticTxResult(hash) + + suite.backend.indexer = nil + client := suite.backend.clientCtx.Client.(*mocks.Client) + query := fmt.Sprintf( + "%s.%s='%s'", + evmtypes.TypeMsgEthereumTx, + evmtypes.AttributeKeyEthereumTxHash, + common.HexToHash(hash).Hex(), + ) + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + RegisterBaseFee(queryClient, sdk.NewInt(1)) + RegisterTxSearchWithTxResult(client, query, []byte{}, txRes) + RegisterBlock(client, 1, nil) + RegisterBlockResultsWithTxResults(client, 1, []*abci.ResponseDeliverTx{&txRes}) + + res, err := suite.backend.GetTransactionByHash(common.HexToHash(hash)) + suite.Require().NoError(err) + + // assert fields + suite.Require().Equal(hash, res.Hash.Hex()) + nonce, _ := hexutil.DecodeUint64(res.Nonce.String()) + suite.Require().Equal(uint64(1), nonce) + suite.Require().Equal(int64(1), res.BlockNumber.ToInt().Int64()) + suite.Require().Equal("0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7", res.To.Hex()) + suite.Require().Equal("0x735b14BB79463307AAcBED86DAf3322B1e6226aB", res.From.Hex()) + txIndex, _ := hexutil.DecodeUint64(res.TransactionIndex.String()) + suite.Require().Equal(uint64(8888), txIndex) + txType, _ := hexutil.DecodeUint64(res.Type.String()) + suite.Require().Equal(uint64(88), txType) + suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) + suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) + suite.Require().Nil(res.V) + suite.Require().Nil(res.R) + suite.Require().Nil(res.S) +} + +func (suite *BackendTestSuite) TestGetSyntheticTransactionReceiptByHash() { + hash := sample.Hash().Hex() + _, txRes := suite.buildSyntheticTxResult(hash) + + suite.backend.indexer = nil + client := suite.backend.clientCtx.Client.(*mocks.Client) + query := fmt.Sprintf( + "%s.%s='%s'", + evmtypes.TypeMsgEthereumTx, + evmtypes.AttributeKeyEthereumTxHash, + common.HexToHash(hash).Hex(), + ) + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + var header metadata.MD + RegisterParams(queryClient, &header, 1) + RegisterParamsWithoutHeader(queryClient, 1) + RegisterTxSearchWithTxResult(client, query, []byte{}, txRes) + RegisterBlock(client, 1, nil) + RegisterBlockResultsWithTxResults(client, 1, []*abci.ResponseDeliverTx{&txRes}) + + res, err := suite.backend.GetTransactionReceipt(common.HexToHash(hash)) + suite.Require().NoError(err) + + // assert fields + suite.Require().Equal(common.HexToHash(hash), res["transactionHash"]) + blockNumber, _ := hexutil.DecodeUint64(res["blockNumber"].(hexutil.Uint64).String()) + suite.Require().Equal(uint64(1), blockNumber) + toAddress := common.HexToAddress("0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7") + fromAddress := common.HexToAddress("0x735b14BB79463307AAcBED86DAf3322B1e6226aB") + suite.Require().Equal(&toAddress, res["to"]) + suite.Require().Equal(fromAddress, res["from"]) + status, _ := hexutil.DecodeUint64(res["status"].(hexutil.Uint).String()) + suite.Require().Equal(uint64(1), status) + txType, _ := hexutil.DecodeUint64(res["type"].(hexutil.Uint).String()) + suite.Require().Equal(uint64(88), txType) + txIndex, _ := hexutil.DecodeUint64(res["transactionIndex"].(hexutil.Uint64).String()) + suite.Require().Equal(uint64(8888), txIndex) +} + +func (suite *BackendTestSuite) TestGetSyntheticTransactionByBlockNumberAndIndex() { + hash := sample.Hash().Hex() + tx, txRes := suite.buildSyntheticTxResult(hash) + + suite.backend.indexer = nil + client := suite.backend.clientCtx.Client.(*mocks.Client) + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + RegisterBlock(client, 1, []types.Tx{tx}) + RegisterBlockResultsWithTxResults(client, 1, []*abci.ResponseDeliverTx{&txRes}) + RegisterBaseFee(queryClient, sdk.NewInt(1)) + + res, err := suite.backend.GetTransactionByBlockNumberAndIndex(rpctypes.BlockNumber(1), 0) + suite.Require().NoError(err) + + // assert fields + suite.Require().Equal(hash, res.Hash.Hex()) + nonce, _ := hexutil.DecodeUint64(res.Nonce.String()) + suite.Require().Equal(uint64(1), nonce) + suite.Require().Equal("0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7", res.To.Hex()) + suite.Require().Equal("0x735b14BB79463307AAcBED86DAf3322B1e6226aB", res.From.Hex()) + txType, _ := hexutil.DecodeUint64(res.Type.String()) + suite.Require().Equal(uint64(88), txType) + suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) + suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) + suite.Require().Nil(res.V) + suite.Require().Nil(res.R) + suite.Require().Nil(res.S) +} + +func (suite *BackendTestSuite) TestGetSyntheticTransactionByBlockNumberAndIndexWithRealTransaction() { + hash := sample.Hash().Hex() + tx, txRes := suite.buildSyntheticTxResult(hash) + msgEthereumTx, _ := suite.buildEthereumTx() + + realTx := suite.signAndEncodeEthTx(msgEthereumTx) + + suite.backend.indexer = nil + client := suite.backend.clientCtx.Client.(*mocks.Client) + queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) + // synthetic tx with real MsgEthereumTx + RegisterBlock(client, 1, []types.Tx{realTx, tx}) + RegisterBlockResultsWithTxResults(client, 1, []*abci.ResponseDeliverTx{{}, &txRes}) + RegisterBaseFee(queryClient, sdk.NewInt(1)) + + res, err := suite.backend.GetTransactionByBlockNumberAndIndex(rpctypes.BlockNumber(1), 1) + suite.Require().NoError(err) + + // assert fields + suite.Require().Equal(hash, res.Hash.Hex()) + nonce, _ := hexutil.DecodeUint64(res.Nonce.String()) + suite.Require().Equal(uint64(1), nonce) + suite.Require().Equal("0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7", res.To.Hex()) + suite.Require().Equal("0x735b14BB79463307AAcBED86DAf3322B1e6226aB", res.From.Hex()) + txType, _ := hexutil.DecodeUint64(res.Type.String()) + suite.Require().Equal(uint64(88), txType) + suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) + suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) + suite.Require().Nil(res.V) + suite.Require().Nil(res.R) + suite.Require().Nil(res.S) +} + func (suite *BackendTestSuite) TestGetTransactionByHash() { msgEthereumTx, _ := suite.buildEthereumTx() txHash := msgEthereumTx.AsTransaction().Hash() @@ -45,8 +186,8 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { rpcTransaction, err := rpctypes.NewRPCTransaction( msgEthereumTx.AsTransaction(), - common.Hash{}, - 0, + common.HexToHash("0x1"), + 1, 0, big.NewInt(1), suite.backend.chainID, @@ -74,7 +215,7 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { "fail - Block Result error", func() { client := suite.backend.clientCtx.Client.(*mocks.Client) - RegisterBlock(client, 1, txBz) + RegisterBlock(client, 1, []types.Tx{txBz}) RegisterBlockResultsError(client, 1) }, msgEthereumTx, @@ -86,7 +227,7 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { func() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) - RegisterBlock(client, 1, txBz) + RegisterBlock(client, 1, []types.Tx{txBz}) RegisterBlockResults(client, 1) RegisterBaseFeeError(queryClient) }, @@ -99,7 +240,7 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { func() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) - RegisterBlock(client, 1, txBz) + RegisterBlock(client, 1, []types.Tx{txBz}) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, sdk.NewInt(1)) }, @@ -459,7 +600,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockNumberAndIndex() { func() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) - RegisterBlock(client, 1, bz) + RegisterBlock(client, 1, []types.Tx{bz}) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, sdk.NewInt(1)) }, @@ -592,7 +733,7 @@ func (suite *BackendTestSuite) TestGetTransactionReceipt() { client := suite.backend.clientCtx.Client.(*mocks.Client) RegisterParams(queryClient, &header, 1) RegisterParamsWithoutHeader(queryClient, 1) - RegisterBlock(client, 1, txBz) + RegisterBlock(client, 1, []types.Tx{txBz}) RegisterBlockResults(client, 1) }, msgEthereumTx, diff --git a/rpc/types/events.go b/rpc/types/events.go index 3839fb84df..4a265f2c6d 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -240,6 +240,8 @@ func ParseTxIndexerResult( Type: parsedTx.Type, Recipient: parsedTx.Recipient, Sender: parsedTx.Sender, + Data: parsedTx.Data, + Nonce: parsedTx.Nonce, }, nil } return ðermint.TxResult{ diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index 9a7ed00d5b..43bffb6e75 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -680,7 +680,7 @@ func (k Keeper) CallEVM( // value is the amount of wei to send; gaslimit is the custom gas limit, if nil EstimateGas is used // to bisect the correct gas limit (this may sometimes result in insufficient gas limit; not sure why) // -// noEthereumTxEvent flag is used to control if ethereum_tx eventsshould emitted +// noEthereumTxEvent flag is used to control if ethereum_tx events should be emitted // which will mean these txs are indexed and available in rpc methods // // returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts From 38e1753be0dfd3edbbc9ee2befcab9417b1be169 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 19 Jun 2024 19:25:13 +0100 Subject: [PATCH 8/9] refactor: cctx validate outbound (#2317) --- changelog.md | 1 + testutil/keeper/crosschain.go | 19 +- x/crosschain/keeper/cctx_gateway_observers.go | 1 - x/crosschain/keeper/cctx_gateway_zevm.go | 76 +------ ...=> cctx_orchestrator_validate_outbound.go} | 157 +++++++++----- ...tx_orchestrator_validate_outbound_test.go} | 192 +++++++++++++----- x/crosschain/keeper/cctx_utils_test.go | 28 ++- x/crosschain/keeper/initiate_outbound.go | 1 + x/crosschain/keeper/initiate_outbound_test.go | 30 ++- .../msg_server_add_inbound_tracker_test.go | 18 +- .../msg_server_add_outbound_tracker_test.go | 27 ++- .../keeper/msg_server_vote_gas_price_test.go | 13 +- .../keeper/msg_server_vote_outbound_tx.go | 2 +- .../msg_server_vote_outbound_tx_test.go | 7 +- 14 files changed, 348 insertions(+), 224 deletions(-) rename x/crosschain/keeper/{process_outbound.go => cctx_orchestrator_validate_outbound.go} (64%) rename x/crosschain/keeper/{process_outbound_test.go => cctx_orchestrator_validate_outbound_test.go} (76%) diff --git a/changelog.md b/changelog.md index ac1225b0c0..d7bd6e96d7 100644 --- a/changelog.md +++ b/changelog.md @@ -47,6 +47,7 @@ * [2306](https://github.com/zeta-chain/node/pull/2306) - refactor zetaclient outbound transaction signing logic * [2296](https://github.com/zeta-chain/node/pull/2296) - move `testdata` package to `testutil` to organize test-related utilities * [2344](https://github.com/zeta-chain/node/pull/2344) - group common data of EVM/Bitcoin signer and observer using base structs +* [2317](https://github.com/zeta-chain/node/pull/2317) - add ValidateOutbound method for cctx orchestrator ### Tests diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index 693234ab77..11fda8128f 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -270,9 +270,23 @@ func GetCrosschainFungibleMock(t testing.TB, keeper *keeper.Keeper) *crosschainm } func MockGetSupportedChainFromChainID(m *crosschainmocks.CrosschainObserverKeeper, senderChain *chains.Chain) { - m.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). - Return(senderChain).Once() + if senderChain != nil { + m.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). + Return(senderChain).Once() + } else { + m.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything). + Return(&chains.Chain{}).Once() + } +} +func MockFailedGetSupportedChainFromChainID(m *crosschainmocks.CrosschainObserverKeeper, senderChain *chains.Chain) { + if senderChain != nil { + m.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). + Return(nil).Once() + } else { + m.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything). + Return(nil).Once() + } } func MockGetRevertGasLimitForERC20( @@ -329,7 +343,6 @@ func MockPayGasAndUpdateCCTX( Once() m.On("CallZRC20Burn", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(nil).Once() - } func MockUpdateNonce(m *crosschainmocks.CrosschainObserverKeeper, senderChain chains.Chain) (nonce uint64) { diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index 556d242214..e9603b3903 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -55,6 +55,5 @@ func (c CCTXGatewayObservers) InitiateOutbound( return types.CctxStatus_Aborted } commit() - cctx.SetPendingOutbound("") return types.CctxStatus_PendingOutbound } diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index 8e158c1172..c6cadf7f8f 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -20,81 +18,21 @@ func NewCCTXGatewayZEVM(crosschainKeeper Keeper) CCTXGatewayZEVM { } } -/* -InitiateOutbound handles evm deposit and call ValidateOutbound. -TODO (https://github.com/zeta-chain/node/issues/2278): move remaining of this comment to ValidateOutbound once it's added. - - - If the deposit is successful, the CCTX status is changed to OutboundMined. - - - If the deposit returns an internal error i.e if HandleEVMDeposit() returns an error, but isContractReverted is false, the CCTX status is changed to Aborted. - - - If the deposit is reverted, the function tries to create a revert cctx with status PendingRevert. - - - If the creation of revert tx also fails it changes the status to Aborted. - -Note : Aborted CCTXs are not refunded in this function. The refund is done using a separate refunding mechanism. -We do not return an error from this function , as all changes need to be persisted to the state. -Instead we use a temporary context to make changes and then commit the context on for the happy path ,i.e cctx is set to OutboundMined. -New CCTX status after preprocessing is returned. -*/ +// InitiateOutbound handles evm deposit and immediately validates pending outbound func (c CCTXGatewayZEVM) InitiateOutbound(ctx sdk.Context, cctx *types.CrossChainTx) (newCCTXStatus types.CctxStatus) { tmpCtx, commit := ctx.CacheContext() isContractReverted, err := c.crosschainKeeper.HandleEVMDeposit(tmpCtx, cctx) - // TODO (https://github.com/zeta-chain/node/issues/2278): further processing will be in validateOutbound(...), for now keeping it here if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX cctx.SetAbort(err.Error()) return types.CctxStatus_Aborted - } else if err != nil && isContractReverted { - // contract call reverted; should refund via a revert tx - revertMessage := err.Error() - senderChain := c.crosschainKeeper.zetaObserverKeeper.GetSupportedChainFromChainID(ctx, cctx.InboundParams.SenderChainId) - if senderChain == nil { - cctx.SetAbort(fmt.Sprintf("invalid sender chain id %d", cctx.InboundParams.SenderChainId)) - return types.CctxStatus_Aborted - } - gasLimit, err := c.crosschainKeeper.GetRevertGasLimit(ctx, *cctx) - if err != nil { - cctx.SetAbort(fmt.Sprintf("revert gas limit error: %s", err.Error())) - return types.CctxStatus_Aborted - } - if gasLimit == 0 { - // use same gas limit of outbound as a fallback -- should not be required - gasLimit = cctx.GetCurrentOutboundParam().GasLimit - } + } - err = cctx.AddRevertOutbound(gasLimit) - if err != nil { - cctx.SetAbort(fmt.Sprintf("revert outbound error: %s", err.Error())) - return types.CctxStatus_Aborted - } - // we create a new cached context, and we don't commit the previous one with EVM deposit - tmpCtxRevert, commitRevert := ctx.CacheContext() - err = func() error { - err := c.crosschainKeeper.PayGasAndUpdateCctx( - tmpCtxRevert, - senderChain.ChainId, - cctx, - cctx.InboundParams.Amount, - false, - ) - if err != nil { - return err - } - // Update nonce using senderchain id as this is a revert tx and would go back to the original sender - return c.crosschainKeeper.UpdateNonce(tmpCtxRevert, senderChain.ChainId, cctx) - }() - if err != nil { - cctx.SetAbort(fmt.Sprintf("deposit revert message: %s err : %s", revertMessage, err.Error())) - return types.CctxStatus_Aborted - } - commitRevert() - cctx.SetPendingRevert(revertMessage) - return types.CctxStatus_PendingRevert + newCCTXStatus = c.crosschainKeeper.ValidateOutboundZEVM(ctx, cctx, err, isContractReverted) + if newCCTXStatus == types.CctxStatus_OutboundMined { + commit() } - // successful HandleEVMDeposit; - commit() - cctx.SetOutboundMined("Remote omnichain contract call completed") - return types.CctxStatus_OutboundMined + + return newCCTXStatus } diff --git a/x/crosschain/keeper/process_outbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go similarity index 64% rename from x/crosschain/keeper/process_outbound.go rename to x/crosschain/keeper/cctx_orchestrator_validate_outbound.go index f0b4127f3e..16b61a3a0a 100644 --- a/x/crosschain/keeper/process_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -5,6 +5,7 @@ import ( "fmt" cosmoserrors "cosmossdk.io/errors" + "cosmossdk.io/math" tmbytes "github.com/cometbft/cometbft/libs/bytes" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,9 +18,54 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -// ProcessOutbound processes the finalization of an outbound transaction based on the ballot status -// The state is committed only if the individual steps are successful -func (k Keeper) ProcessOutbound( +/* +ValidateOutboundZEVM processes the finalization of an outbound transaction if receiver is ZEVM. +It takes deposit error and information if contract revert happened during deposit, to make a decision: + +- If the deposit was successful, the CCTX status is changed to OutboundMined. + +- If the deposit returned an internal error, but isContractReverted is false, the CCTX status is changed to Aborted. + +- If the deposit is reverted, the function tries to create a revert cctx with status PendingRevert. + +- If the creation of revert tx also fails it changes the status to Aborted. + +Note : Aborted CCTXs are not refunded in this function. The refund is done using a separate refunding mechanism. +We do not return an error from this function, as all changes need to be persisted to the state. +Instead we use a temporary context to make changes and then commit the context on for the happy path, i.e cctx is set to OutboundMined. +New CCTX status after preprocessing is returned. +*/ +func (k Keeper) ValidateOutboundZEVM( + ctx sdk.Context, + cctx *types.CrossChainTx, + depositErr error, + isContractReverted bool, +) (newCCTXStatus types.CctxStatus) { + if depositErr != nil && isContractReverted { + tmpCtxRevert, commitRevert := ctx.CacheContext() + // contract call reverted; should refund via a revert tx + err := k.validateFailedOutbound( + tmpCtxRevert, + cctx, + types.CctxStatus_PendingOutbound, + depositErr.Error(), + cctx.InboundParams.Amount, + ) + if err != nil { + cctx.SetAbort(err.Error()) + return types.CctxStatus_Aborted + } + + commitRevert() + return types.CctxStatus_PendingRevert + } + k.validateSuccessfulOutbound(ctx, cctx, "", false) + return types.CctxStatus_OutboundMined +} + +// ValidateOutboundObservers processes the finalization of an outbound transaction based on the ballot status. +// The state is committed only if the individual steps are successful. +func (k Keeper) ValidateOutboundObservers( ctx sdk.Context, cctx *types.CrossChainTx, ballotStatus observertypes.BallotStatus, @@ -29,9 +75,9 @@ func (k Keeper) ProcessOutbound( err := func() error { switch ballotStatus { case observertypes.BallotStatus_BallotFinalized_SuccessObservation: - k.ProcessSuccessfulOutbound(tmpCtx, cctx, valueReceived) + k.validateSuccessfulOutbound(tmpCtx, cctx, valueReceived, true) case observertypes.BallotStatus_BallotFinalized_FailureObservation: - err := k.ProcessFailedOutbound(tmpCtx, cctx, valueReceived) + err := k.validateFailedOutboundObservers(tmpCtx, cctx, valueReceived) if err != nil { return err } @@ -49,35 +95,7 @@ func (k Keeper) ProcessOutbound( return nil } -// ProcessSuccessfulOutbound processes a successful outbound transaction. It does the following things in one function: -// -// 1. Change the status of the CCTX from -// - PendingRevert to Reverted -// - PendingOutbound to OutboundMined -// -// 2. Set the finalization status of the current outbound tx to executed -// -// 3. Emit an event for the successful outbound transaction -// -// This function sets CCTX status , in cases where the outbound tx is successful, but tx itself fails -// This is done because SaveSuccessfulOutbound does not set the cctx status -// For cases where the outbound tx is unsuccessful, the cctx status is automatically set to Aborted in the ProcessFailedOutbound function, so we can just return and error to trigger that -func (k Keeper) ProcessSuccessfulOutbound(ctx sdk.Context, cctx *types.CrossChainTx, valueReceived string) { - oldStatus := cctx.CctxStatus.Status - switch oldStatus { - case types.CctxStatus_PendingRevert: - cctx.SetReverted("Outbound succeeded, revert executed") - case types.CctxStatus_PendingOutbound: - cctx.SetOutboundMined("Outbound succeeded, mined") - default: - return - } - cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - newStatus := cctx.CctxStatus.Status.String() - EmitOutboundSuccess(ctx, valueReceived, oldStatus.String(), newStatus, cctx.Index) -} - -// ProcessFailedOutbound processes a failed outbound transaction. It does the following things in one function: +// validateFailedOutboundObservers processes a failed outbound transaction for observers. It does the following things in one function: // // 1. For Admin Tx or a withdrawal from Zeta chain, it aborts the CCTX // @@ -91,12 +109,12 @@ func (k Keeper) ProcessSuccessfulOutbound(ctx sdk.Context, cctx *types.CrossChai // // This function sets CCTX status , in cases where the outbound tx is successful, but tx itself fails // This is done because SaveSuccessfulOutbound does not set the cctx status -// For cases where the outbound tx is unsuccessful, the cctx status is automatically set to Aborted in the ProcessFailedOutbound function, so we can just return and error to trigger that -func (k Keeper) ProcessFailedOutbound(ctx sdk.Context, cctx *types.CrossChainTx, valueReceived string) error { +// For cases where the outbound tx is unsuccessful, the cctx status is automatically set to Aborted in the validateFailedOutboundObservers function, so we can just return and error to trigger that +func (k Keeper) validateFailedOutboundObservers(ctx sdk.Context, cctx *types.CrossChainTx, valueReceived string) error { oldStatus := cctx.CctxStatus.Status // The following logic is used to handler the mentioned conditions separately. The reason being - // All admin tx is created using a policy message , there is no associated inbound tx , therefore we do not need any revert logic - // For transactions which originated from ZEVM , we can process the outbound in the same block as there is no TSS signing required for the revert + // All admin tx is created using a policy message, there is no associated inbound tx, therefore we do not need any revert logic + // For transactions which originated from ZEVM, we can process the outbound in the same block as there is no TSS signing required for the revert // For all other transactions we need to create a revert tx and set the status to pending revert if cctx.InboundParams.CoinType == coin.CoinType_Cmd { @@ -108,9 +126,9 @@ func (k Keeper) ProcessFailedOutbound(ctx sdk.Context, cctx *types.CrossChainTx, // Try revert if the coin-type is ZETA case coin.CoinType_Zeta: { - err := k.processFailedOutboundForZEVM(ctx, cctx) + err := k.validateFailedOutboundObserversForZEVM(ctx, cctx) if err != nil { - return cosmoserrors.Wrap(err, "ProcessFailedOutboundForZEVMTx") + return cosmoserrors.Wrap(err, "validateFailedOutboundObserversForZEVMTx") } } // For all other coin-types, we do not revert, the cctx is aborted @@ -121,9 +139,9 @@ func (k Keeper) ProcessFailedOutbound(ctx sdk.Context, cctx *types.CrossChainTx, } } } else { - err := k.processFailedOutboundForExternalChainTx(ctx, cctx, oldStatus) + err := k.validateFailedOutbound(ctx, cctx, oldStatus, "Outbound failed, start revert", cctx.GetCurrentOutboundParam().Amount) if err != nil { - return cosmoserrors.Wrap(err, "ProcessFailedOutboundForExternalChainTx") + return cosmoserrors.Wrap(err, "validateFailedOutbound") } } newStatus := cctx.CctxStatus.Status.String() @@ -131,14 +149,20 @@ func (k Keeper) ProcessFailedOutbound(ctx sdk.Context, cctx *types.CrossChainTx, return nil } -// processFailedOutboundForExternalChainTx processes the failed outbound transaction for external chain tx -func (k Keeper) processFailedOutboundForExternalChainTx( +// validateFailedOutbound processes the failed outbound transaction +func (k Keeper) validateFailedOutbound( ctx sdk.Context, cctx *types.CrossChainTx, oldStatus types.CctxStatus, + revertMsg string, + inputAmount math.Uint, ) error { switch oldStatus { case types.CctxStatus_PendingOutbound: + senderChain := k.zetaObserverKeeper.GetSupportedChainFromChainID(ctx, cctx.InboundParams.SenderChainId) + if senderChain == nil { + return observertypes.ErrSupportedChains + } gasLimit, err := k.GetRevertGasLimit(ctx, *cctx) if err != nil { @@ -159,7 +183,7 @@ func (k Keeper) processFailedOutboundForExternalChainTx( ctx, cctx.InboundParams.SenderChainId, cctx, - cctx.OutboundParams[0].Amount, + inputAmount, false, ) if err != nil { @@ -170,7 +194,7 @@ func (k Keeper) processFailedOutboundForExternalChainTx( return err } // Not setting the finalization status here, the required changes have been made while creating the revert tx - cctx.SetPendingRevert("Outbound failed, start revert") + cctx.SetPendingRevert(revertMsg) case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed cctx.SetAbort("Outbound failed: revert failed; abort TX") @@ -178,11 +202,46 @@ func (k Keeper) processFailedOutboundForExternalChainTx( return nil } -// processFailedOutboundForZEVM processes the failed outbound transaction for ZEVM -func (k Keeper) processFailedOutboundForZEVM(ctx sdk.Context, cctx *types.CrossChainTx) error { +// validateSuccessfulOutbound processes a successful outbound transaction. It does the following things in one function: +// +// 1. Change the status of the CCTX from +// - PendingRevert to Reverted +// - PendingOutbound to OutboundMined +// +// 2. Set the finalization status of the current outbound tx to executed +// +// 3. Emit an event for the successful outbound transaction if flag is provided +// +// This function sets CCTX status, in cases where the outbound tx is successful, but tx itself fails +// This is done because SaveSuccessfulOutbound does not set the cctx status +// For cases where the outbound tx is unsuccessful, the cctx status is automatically set to Aborted in the validateFailedOutboundObservers function, so we can just return and error to trigger that +func (k Keeper) validateSuccessfulOutbound( + ctx sdk.Context, + cctx *types.CrossChainTx, + valueReceived string, + emitEvent bool, +) { + oldStatus := cctx.CctxStatus.Status + switch oldStatus { + case types.CctxStatus_PendingRevert: + cctx.SetReverted("Outbound succeeded, revert executed") + case types.CctxStatus_PendingOutbound: + cctx.SetOutboundMined("Outbound succeeded, mined") + default: + return + } + cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed + newStatus := cctx.CctxStatus.Status.String() + if emitEvent { + EmitOutboundSuccess(ctx, valueReceived, oldStatus.String(), newStatus, cctx.Index) + } +} + +// validateFailedOutboundObserversForZEVM processes the failed outbound transaction for ZEVM +func (k Keeper) validateFailedOutboundObserversForZEVM(ctx sdk.Context, cctx *types.CrossChainTx) error { indexBytes, err := cctx.GetCCTXIndexBytes() if err != nil { - // Return err to save the failed outbound ad set to aborted + // Return err to save the failed outbound and set to aborted return fmt.Errorf("failed reverting GetCCTXIndexBytes: %s", err.Error()) } // Finalize the older outbound tx diff --git a/x/crosschain/keeper/process_outbound_test.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go similarity index 76% rename from x/crosschain/keeper/process_outbound_test.go rename to x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go index ee734341df..fff52e599a 100644 --- a/x/crosschain/keeper/process_outbound_test.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go @@ -21,28 +21,51 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func TestKeeper_ProcessSuccessfulOutbound(t *testing.T) { +func TestKeeper_ValidateSuccessfulOutbound(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := sample.CrossChainTx(t, "test") // transition to reverted if pending revert cctx.CctxStatus.Status = types.CctxStatus_PendingRevert - k.ProcessSuccessfulOutbound(ctx, cctx, sample.String()) + k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_SuccessObservation, + sample.String(), + ) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_Reverted) // transition to outbound mined if pending outbound cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - k.ProcessSuccessfulOutbound(ctx, cctx, sample.String()) + k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_SuccessObservation, + sample.String(), + ) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_OutboundMined) // do nothing if it's in any other state - k.ProcessSuccessfulOutbound(ctx, cctx, sample.String()) + k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_SuccessObservation, + sample.String(), + ) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_OutboundMined) } -func TestKeeper_ProcessFailedOutbound(t *testing.T) { - t.Run("successfully process failed outbound set to aborted for type cmd", func(t *testing.T) { +func TestKeeper_ValidateFailedOutbound(t *testing.T) { + t.Run("successfully validates failed outbound set to aborted for type cmd", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := sample.CrossChainTx(t, "test") cctx.InboundParams.CoinType = coin.CoinType_Cmd - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + cctx.InboundParams.SenderChainId = chains.Ethereum.ChainId + cctx.OutboundParams[0].ReceiverChainId = chains.Ethereum.ChainId + cctx.OutboundParams[1].ReceiverChainId = chains.Ethereum.ChainId + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_Aborted) require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_Executed) @@ -53,7 +76,14 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.InboundParams.CoinType = coin.CoinType_ERC20 cctx.InboundParams.SenderChainId = chains.ZetaChainMainnet.ChainId - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + cctx.OutboundParams[0].ReceiverChainId = chains.Ethereum.ChainId + cctx.OutboundParams[1].ReceiverChainId = chains.Ethereum.ChainId + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_Aborted) require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_Executed) @@ -64,13 +94,20 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.InboundParams.CoinType = coin.CoinType_Gas cctx.InboundParams.SenderChainId = chains.ZetaChainMainnet.ChainId - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + cctx.OutboundParams[0].ReceiverChainId = chains.Ethereum.ChainId + cctx.OutboundParams[1].ReceiverChainId = chains.Ethereum.ChainId + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_Aborted) require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_Executed) }) - t.Run("successfully process failed outbound if original sender is a address", func(t *testing.T) { + t.Run("successfully validate failed outbound if original sender is a address", func(t *testing.T) { k, ctx, sdkk, _ := keepertest.CrosschainKeeper(t) receiver := sample.EthAddress() cctx := GetERC20Cctx(t, receiver, chains.Goerli, "", big.NewInt(42)) @@ -82,32 +119,47 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { ) require.NoError(t, err) cctx.InboundParams.SenderChainId = chains.ZetaChainMainnet.ChainId - err = k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err = k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_Executed) }) - t.Run("unable to process failed outbound if GetCCTXIndexBytes fails", func(t *testing.T) { + t.Run("unable to validate failed outbound if GetCCTXIndexBytes fails", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) receiver := sample.EthAddress() cctx := GetERC20Cctx(t, receiver, chains.Goerli, "", big.NewInt(42)) cctx.InboundParams.CoinType = coin.CoinType_Zeta cctx.Index = "" cctx.InboundParams.SenderChainId = chains.ZetaChainMainnet.ChainId - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.ErrorContains(t, err, "failed reverting GetCCTXIndexBytes") }) - t.Run("unable to process failed outbound if Adding Revert fails", func(t *testing.T) { + t.Run("unable to validate failed outbound if Adding Revert fails", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := sample.CrossChainTx(t, "test") cctx.InboundParams.SenderChainId = chains.ZetaChainMainnet.ChainId cctx.InboundParams.CoinType = coin.CoinType_Zeta - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.ErrorContains(t, err, "failed AddRevertOutbound") }) - t.Run("unable to process failed outbound if ZETARevertAndCallContract fails", func(t *testing.T) { + t.Run("unable to validate failed outbound if ZETARevertAndCallContract fails", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, }) @@ -125,7 +177,12 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { cctx.GetCurrentOutboundParam().Amount.BigInt(), mock.Anything, mock.Anything).Return(nil, errorFailedZETARevertAndCallContract).Once() - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.ErrorContains(t, err, "failed ZETARevertAndCallContract") }) @@ -144,7 +201,12 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { cctx.InboundParams.Sender = dAppContract.String() cctx.InboundParams.SenderChainId = chains.ZetaChainMainnet.ChainId - err = k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err = k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_Executed) @@ -171,7 +233,7 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { require.Equal(t, dAppContract.Bytes(), valSenderAddress) }) - t.Run("successfully process failed outbound set to pending revert", func(t *testing.T) { + t.Run("successfully validate failed outbound set to pending revert", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, UseObserverMock: true, @@ -191,19 +253,27 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { // mock successful PayGasAndUpdateCctx keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) + // mock successful UpdateNonce _ = keepertest.MockUpdateNonce(observerMock, *senderChain) cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_PendingRevert) require.Equal(t, types.TxFinalizationStatus_NotFinalized, cctx.GetCurrentOutboundParam().TxFinalizationStatus) require.Equal(t, types.TxFinalizationStatus_Executed, cctx.OutboundParams[0].TxFinalizationStatus) }) - t.Run("successfully process failed outbound set to pending revert if gas limit is 0", func(t *testing.T) { + t.Run("successfully validate failed outbound set to pending revert if gas limit is 0", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, UseObserverMock: true, @@ -223,19 +293,27 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { // mock successful PayGasAndUpdateCctx keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) + // mock successful UpdateNonce _ = keepertest.MockUpdateNonce(observerMock, *senderChain) cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.NoError(t, err) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_PendingRevert) require.Equal(t, types.TxFinalizationStatus_NotFinalized, cctx.GetCurrentOutboundParam().TxFinalizationStatus) require.Equal(t, types.TxFinalizationStatus_Executed, cctx.OutboundParams[0].TxFinalizationStatus) }) - t.Run("unable to process revert when update nonce fails", func(t *testing.T) { + t.Run("unable to validate revert when update nonce fails", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, UseObserverMock: true, @@ -255,18 +333,26 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { // mock successful PayGasAndUpdateCctx keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) + // mock failed UpdateNonce observerMock.On("GetChainNonces", mock.Anything, senderChain.ChainName.String()). Return(observertypes.ChainNonces{}, false) cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.ErrorIs(t, err, types.ErrCannotFindReceiverNonce) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_PendingOutbound) }) - t.Run("unable to process revert when PayGasAndUpdateCctx fails", func(t *testing.T) { + t.Run("unable to validate revert when PayGasAndUpdateCctx fails", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, UseObserverMock: true, @@ -283,18 +369,25 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { // mock successful GetRevertGasLimit for ERC20 keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 100) - // mock successful PayGasAndUpdateCctx - observerMock.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). - Return(nil).Once() + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) + + // mock failed failed GetSupportedChainFromChainID to fail PayGasAndUpdateCctx + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, senderChain) cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.ErrorIs(t, err, observertypes.ErrSupportedChains) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_PendingOutbound) }) - t.Run("unable to process revert when GetRevertGasLimit fails", func(t *testing.T) { + t.Run("unable to validate revert when GetRevertGasLimit fails", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, }) @@ -314,18 +407,23 @@ func TestKeeper_ProcessFailedOutbound(t *testing.T) { cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - err := k.ProcessFailedOutbound(ctx, cctx, sample.String()) + err := k.ValidateOutboundObservers( + ctx, + cctx, + observertypes.BallotStatus_BallotFinalized_FailureObservation, + sample.String(), + ) require.ErrorIs(t, err, types.ErrForeignCoinNotFound) require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_PendingOutbound) }) } -func TestKeeper_ProcessOutbound(t *testing.T) { - t.Run("successfully process outbound with ballot finalized to success", func(t *testing.T) { +func TestKeeper_ValidateOutboundObservers(t *testing.T) { + t.Run("successfully validate outbound with ballot finalized to success", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := GetERC20Cctx(t, sample.EthAddress(), chains.Goerli, "", big.NewInt(42)) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - err := k.ProcessOutbound( + err := k.ValidateOutboundObservers( ctx, cctx, observertypes.BallotStatus_BallotFinalized_SuccessObservation, @@ -335,13 +433,12 @@ func TestKeeper_ProcessOutbound(t *testing.T) { require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_OutboundMined) }) - t.Run( - "successfully process outbound with ballot finalized to failed and old status is Pending Revert", + t.Run("successfully validate outbound with ballot finalized to failed and old status is Pending Revert", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := GetERC20Cctx(t, sample.EthAddress(), chains.Goerli, "", big.NewInt(42)) cctx.CctxStatus.Status = types.CctxStatus_PendingRevert - err := k.ProcessOutbound( + err := k.ValidateOutboundObservers( ctx, cctx, observertypes.BallotStatus_BallotFinalized_FailureObservation, @@ -353,12 +450,12 @@ func TestKeeper_ProcessOutbound(t *testing.T) { }, ) - t.Run("successfully process outbound with ballot finalized to failed and coin-type is CMD", func(t *testing.T) { + t.Run("successfully validate outbound with ballot finalized to failed and coin-type is CMD", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := GetERC20Cctx(t, sample.EthAddress(), chains.Goerli, "", big.NewInt(42)) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound cctx.InboundParams.CoinType = coin.CoinType_Cmd - err := k.ProcessOutbound( + err := k.ValidateOutboundObservers( ctx, cctx, observertypes.BallotStatus_BallotFinalized_FailureObservation, @@ -369,16 +466,16 @@ func TestKeeper_ProcessOutbound(t *testing.T) { require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_Executed) }) - t.Run("do not process if cctx invalid", func(t *testing.T) { + t.Run("do not validate if cctx invalid", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) cctx := GetERC20Cctx(t, sample.EthAddress(), chains.Goerli, "", big.NewInt(42)) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound cctx.InboundParams = nil - err := k.ProcessOutbound(ctx, cctx, observertypes.BallotStatus_BallotInProgress, sample.String()) + err := k.ValidateOutboundObservers(ctx, cctx, observertypes.BallotStatus_BallotInProgress, sample.String()) require.Error(t, err) }) - t.Run("do not process outbound on error, no new outbound created", func(t *testing.T) { + t.Run("do not validate outbound on error, no new outbound created", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, }) @@ -399,7 +496,7 @@ func TestKeeper_ProcessOutbound(t *testing.T) { Zrc20ContractAddress: sample.EthAddress().String(), }, false).Once() - err := k.ProcessOutbound( + err := k.ValidateOutboundObservers( ctx, cctx, observertypes.BallotStatus_BallotFinalized_FailureObservation, @@ -412,7 +509,7 @@ func TestKeeper_ProcessOutbound(t *testing.T) { require.Equal(t, cctx.GetCurrentOutboundParam().TxFinalizationStatus, types.TxFinalizationStatus_NotFinalized) }) - t.Run("do not process outbound if the cctx has already been reverted once", func(t *testing.T) { + t.Run("do not validate outbound if the cctx has already been reverted once", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, }) @@ -434,7 +531,7 @@ func TestKeeper_ProcessOutbound(t *testing.T) { // mock successful GetRevertGasLimit for ERC20 keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 100) - err := k.ProcessOutbound( + err := k.ValidateOutboundObservers( ctx, cctx, observertypes.BallotStatus_BallotFinalized_FailureObservation, @@ -466,10 +563,13 @@ func TestKeeper_ProcessOutbound(t *testing.T) { // mock successful PayGasAndUpdateCctx keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) + // mock successful UpdateNonce _ = keepertest.MockUpdateNonce(observerMock, *senderChain) - err := k.ProcessOutbound( + err := k.ValidateOutboundObservers( ctx, cctx, observertypes.BallotStatus_BallotFinalized_FailureObservation, diff --git a/x/crosschain/keeper/cctx_utils_test.go b/x/crosschain/keeper/cctx_utils_test.go index d466c1f1c3..edeefabfa1 100644 --- a/x/crosschain/keeper/cctx_utils_test.go +++ b/x/crosschain/keeper/cctx_utils_test.go @@ -233,7 +233,8 @@ func TestKeeper_UpdateNonce(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(nil) + // mock failed GetSupportedChainFromChainID + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, nil) err := k.UpdateNonce(ctx, 5, nil) require.Error(t, err) @@ -245,10 +246,13 @@ func TestKeeper_UpdateNonce(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainName: 5, ChainId: 5, }) + observerMock.On("GetChainNonces", mock.Anything, mock.Anything).Return(observertypes.ChainNonces{}, false) cctx := types.CrossChainTx{ InboundParams: &types.InboundParams{ @@ -268,10 +272,13 @@ func TestKeeper_UpdateNonce(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainName: 5, ChainId: 5, }) + observerMock.On("GetChainNonces", mock.Anything, mock.Anything).Return(observertypes.ChainNonces{ Nonce: 100, }, true) @@ -295,10 +302,13 @@ func TestKeeper_UpdateNonce(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainName: 5, ChainId: 5, }) + observerMock.On("GetChainNonces", mock.Anything, mock.Anything).Return(observertypes.ChainNonces{ Nonce: 100, }, true) @@ -324,10 +334,13 @@ func TestKeeper_UpdateNonce(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainName: 5, ChainId: 5, }) + observerMock.On("GetChainNonces", mock.Anything, mock.Anything).Return(observertypes.ChainNonces{ Nonce: 100, }, true) @@ -355,10 +368,13 @@ func TestKeeper_UpdateNonce(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + + // mock successful GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainName: 5, ChainId: 5, }) + observerMock.On("GetChainNonces", mock.Anything, mock.Anything).Return(observertypes.ChainNonces{ Nonce: 100, }, true) diff --git a/x/crosschain/keeper/initiate_outbound.go b/x/crosschain/keeper/initiate_outbound.go index 8174f6ec4e..dc3fcf4c24 100644 --- a/x/crosschain/keeper/initiate_outbound.go +++ b/x/crosschain/keeper/initiate_outbound.go @@ -35,5 +35,6 @@ func (k Keeper) InitiateOutbound(ctx sdk.Context, cctx *types.CrossChainTx) (typ ) } + cctx.SetPendingOutbound("") return cctxGateway.InitiateOutbound(ctx, cctx), nil } diff --git a/x/crosschain/keeper/initiate_outbound_test.go b/x/crosschain/keeper/initiate_outbound_test.go index 59d0eaee0b..25032e4a09 100644 --- a/x/crosschain/keeper/initiate_outbound_test.go +++ b/x/crosschain/keeper/initiate_outbound_test.go @@ -100,8 +100,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { keepertest.MockRevertForHandleEVMDeposit(fungibleMock, receiver, amount, senderChain.ChainId, errDeposit) // mock unsuccessful GetSupportedChainFromChainID - observerMock.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). - Return(nil) + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, senderChain) // call InitiateOutbound cctx := GetERC20Cctx(t, receiver, *senderChain, "", amount) @@ -112,13 +111,13 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Equal( t, - fmt.Sprintf("invalid sender chain id %d", cctx.InboundParams.SenderChainId), + "chain not supported", cctx.CctxStatus.StatusMessage, ) }, ) - t.Run("unable to process zevm deposit HandleEVMDeposit revert fails at and GetRevertGasLimit", func(t *testing.T) { + t.Run("unable to process zevm deposit HandleEVMDeposit revert fails at GetRevertGasLimit", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, UseObserverMock: true, @@ -152,13 +151,12 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Equal( t, - fmt.Sprintf("revert gas limit error: %s", types.ErrForeignCoinNotFound), + "GetRevertGasLimit: foreign coin not found for sender chain", cctx.CctxStatus.StatusMessage, ) }) - t.Run( - "unable to process zevm deposit HandleEVMDeposit revert fails at PayGasInERC20AndUpdateCctx", + t.Run("unable to process zevm deposit HandleEVMDeposit revert fails at PayGasInERC20AndUpdateCctx", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, @@ -185,8 +183,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 100) // mock unsuccessful PayGasInERC20AndUpdateCctx - observerMock.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). - Return(nil).Once() + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, senderChain) // call InitiateOutbound cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) @@ -197,7 +194,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Equal( t, - fmt.Sprintf("deposit revert message: %s err : %s", errDeposit, observertypes.ErrSupportedChains), + "chain not supported", cctx.CctxStatus.StatusMessage, ) }, @@ -231,8 +228,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 0) // mock unsuccessful PayGasInERC20AndUpdateCctx - observerMock.On("GetSupportedChainFromChainID", mock.Anything, senderChain.ChainId). - Return(nil).Once() + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, senderChain) // call InitiateOutbound cctx := GetERC20Cctx(t, receiver, *senderChain, asset, amount) @@ -243,7 +239,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Equal( t, - fmt.Sprintf("deposit revert message: %s err : %s", errDeposit, observertypes.ErrSupportedChains), + "chain not supported", cctx.CctxStatus.StatusMessage, ) }, @@ -332,8 +328,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, updatedNonce, cctx.GetCurrentOutboundParam().TssNonce) }) - t.Run( - "unable to process zevm deposit HandleEVMDeposit revert fails as the cctx has already been reverted", + t.Run("unable to process zevm deposit HandleEVMDeposit revert fails as the cctx has already been reverted", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, @@ -370,7 +365,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Contains( t, cctx.CctxStatus.StatusMessage, - fmt.Sprintf("revert outbound error: %s", "cannot revert a revert tx"), + "cannot revert a revert tx", ) }, ) @@ -418,8 +413,7 @@ func TestKeeper_InitiateOutboundProcessCrosschainMsgPassing(t *testing.T) { receiverChain := getValidEthChain() // mock unsuccessful PayGasAndUpdateCctx - observerMock.On("GetSupportedChainFromChainID", mock.Anything, receiverChain.ChainId). - Return(nil).Once() + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, nil) // call InitiateOutbound cctx := GetERC20Cctx(t, receiver, *receiverChain, "", amount) diff --git a/x/crosschain/keeper/msg_server_add_inbound_tracker_test.go b/x/crosschain/keeper/msg_server_add_inbound_tracker_test.go index 94773a302b..394ea622f4 100644 --- a/x/crosschain/keeper/msg_server_add_inbound_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_inbound_tracker_test.go @@ -32,7 +32,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, nonAdmin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) txHash := "string" @@ -60,7 +60,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { msgServer := keeper.NewMsgServerImpl(*k) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(nil) + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, nil) txHash := "string" chainID := getValidEthChainID() @@ -91,7 +91,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) txHash := "string" @@ -124,7 +124,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, mock.Anything, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(true) txHash := "string" @@ -158,7 +158,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, mock.Anything, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) lightclientMock.On("VerifyProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(nil, errors.New("error")) @@ -192,7 +192,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, mock.Anything, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) lightclientMock.On("VerifyProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(sample.Bytes(), nil) @@ -227,7 +227,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, mock.Anything, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) lightclientMock.On("VerifyProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(sample.Bytes(), nil) @@ -265,7 +265,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, mock.Anything, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) observerMock.On("GetChainParamsByChainID", mock.Anything, mock.Anything). Return(sample.ChainParams(chains.Ethereum.ChainId), true) @@ -313,7 +313,7 @@ func TestMsgServer_AddToInboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, mock.Anything, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) observerMock.On("GetChainParamsByChainID", mock.Anything, mock.Anything). Return(sample.ChainParams(chains.Ethereum.ChainId), true) diff --git a/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go b/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go index 070d97a30f..b8a213ee36 100644 --- a/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/proofs" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" @@ -38,7 +37,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) @@ -73,7 +72,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(true) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) @@ -108,7 +107,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) @@ -153,7 +152,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { admin := sample.AccAddress() observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) // set cctx status to outbound mined keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_OutboundMined, false) @@ -187,7 +186,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { admin := sample.AccAddress() observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(nil) + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, nil) chainID := getEthereumChainID() @@ -214,7 +213,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, true) chainID := getEthereumChainID() @@ -244,7 +243,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) @@ -289,7 +288,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock := keepertest.GetCrosschainObserverMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) @@ -340,7 +339,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) observerMock.On("GetTssAddress", mock.Anything, mock.Anything).Return(&observertypes.QueryGetTssAddressResponse{ @@ -383,7 +382,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) observerMock.On("GetTssAddress", mock.Anything, mock.Anything).Return(&observertypes.QueryGetTssAddressResponse{ @@ -442,7 +441,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) lightclientMock.On("VerifyProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). @@ -478,7 +477,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) lightclientMock.On("VerifyProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). @@ -517,7 +516,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { lightclientMock := keepertest.GetCrosschainLightclientMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) observerMock.On("GetTssAddress", mock.Anything, mock.Anything).Return(&observertypes.QueryGetTssAddressResponse{ diff --git a/x/crosschain/keeper/msg_server_vote_gas_price_test.go b/x/crosschain/keeper/msg_server_vote_gas_price_test.go index 06400a3dbc..a876e2582c 100644 --- a/x/crosschain/keeper/msg_server_vote_gas_price_test.go +++ b/x/crosschain/keeper/msg_server_vote_gas_price_test.go @@ -21,8 +21,7 @@ func TestMsgServer_VoteGasPrice(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(nil) - + keepertest.MockFailedGetSupportedChainFromChainID(observerMock, nil) msgServer := keeper.NewMsgServerImpl(*k) res, err := msgServer.VoteGasPrice(ctx, &types.MsgVoteGasPrice{ @@ -38,7 +37,7 @@ func TestMsgServer_VoteGasPrice(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{}) + keepertest.MockGetSupportedChainFromChainID(observerMock, nil) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) msgServer := keeper.NewMsgServerImpl(*k) @@ -57,7 +56,7 @@ func TestMsgServer_VoteGasPrice(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainId: 5, }) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(true) @@ -82,7 +81,7 @@ func TestMsgServer_VoteGasPrice(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainId: 5, }) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(true) @@ -119,7 +118,7 @@ func TestMsgServer_VoteGasPrice(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainId: 5, }) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(true) @@ -165,7 +164,7 @@ func TestMsgServer_VoteGasPrice(t *testing.T) { }) observerMock := keepertest.GetCrosschainObserverMock(t, k) - observerMock.On("GetSupportedChainFromChainID", mock.Anything, mock.Anything).Return(&chains.Chain{ + keepertest.MockGetSupportedChainFromChainID(observerMock, &chains.Chain{ ChainId: 5, }) observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(true) diff --git a/x/crosschain/keeper/msg_server_vote_outbound_tx.go b/x/crosschain/keeper/msg_server_vote_outbound_tx.go index 4c5d3b0d13..3445d32cfb 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx.go @@ -95,7 +95,7 @@ func (k msgServer) VoteOutbound( // Fund the gas stability pool with the remaining funds k.FundStabilityPool(ctx, &cctx) - err = k.ProcessOutbound(ctx, &cctx, ballot.BallotStatus, msg.ValueReceived.String()) + err = k.ValidateOutboundObservers(ctx, &cctx, ballot.BallotStatus, msg.ValueReceived.String()) if err != nil { k.SaveFailedOutbound(ctx, &cctx, err.Error(), ballotIndex) return &types.MsgVoteOutboundResponse{}, nil diff --git a/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go index ca7661a3e1..1fe87d98ea 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go @@ -203,6 +203,7 @@ func TestKeeper_VoteOutbound(t *testing.T) { // Successfully mock ProcessOutbound keepertest.MockGetRevertGasLimitForERC20(fungibleMock, asset, *senderChain, 100) keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) _ = keepertest.MockUpdateNonce(observerMock, *senderChain) //Successfully mock SaveOutbound @@ -264,8 +265,9 @@ func TestKeeper_VoteOutbound(t *testing.T) { keepertest.MockPayGasAndUpdateCCTX(fungibleMock, observerMock, ctx, *k, *senderChain, asset) observerMock.On("GetChainNonces", mock.Anything, senderChain.ChainName.String()). Return(observertypes.ChainNonces{}, false) + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) - //Successfully mock SaveOutbound + //Successfully mock SaveOutBound keepertest.MockSaveOutbound(observerMock, ctx, cctx, tss) oldParamsLen := len(cctx.OutboundParams) msgServer := keeper.NewMsgServerImpl(*k) @@ -328,6 +330,9 @@ func TestKeeper_VoteOutbound(t *testing.T) { fungibleMock.On("GetForeignCoinFromAsset", mock.Anything, mock.Anything, mock.Anything). Return(fungibletypes.ForeignCoins{}, false) + // Successfully mock GetSupportedChainFromChainID + keepertest.MockGetSupportedChainFromChainID(observerMock, senderChain) + //Successfully mock SaveFailedOutbound keepertest.MockSaveOutbound(observerMock, ctx, cctx, tss) From 3c4ea9768c9136d896912cc5c5fc7bfa0324696c Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Wed, 19 Jun 2024 11:44:12 -0700 Subject: [PATCH 9/9] refactor(e2e): use private key rather than mnemonic in admin tests (#2350) * refactor(e2e): use private key rather than pnemonic admin tests * move TestERC20DepositAndCallRefund back to erc20 test routine --- cmd/zetae2e/balances.go | 4 --- cmd/zetae2e/bitcoin_address.go | 4 --- cmd/zetae2e/config/config.go | 17 ++------- cmd/zetae2e/local/accounts.go | 4 ++- cmd/zetae2e/local/admin.go | 1 + cmd/zetae2e/local/erc20.go | 1 + cmd/zetae2e/local/local.go | 15 ++++++-- cmd/zetae2e/local/test_runner.go | 5 ++- cmd/zetae2e/run.go | 4 --- cmd/zetae2e/setup_bitcoin.go | 4 --- cmd/zetae2e/show_tss.go | 4 --- cmd/zetae2e/stress.go | 2 -- contrib/localnet/docker-compose-admin.yml | 3 +- contrib/localnet/scripts/start-zetacored.sh | 8 ++--- e2e/e2etests/e2etests.go | 14 ++++---- e2e/e2etests/test_migrate_chain_support.go | 3 +- e2e/runner/runner.go | 40 +++++++++++++-------- e2e/txserver/zeta_tx_server.go | 33 +++++++++-------- 18 files changed, 80 insertions(+), 86 deletions(-) diff --git a/cmd/zetae2e/balances.go b/cmd/zetae2e/balances.go index a325621621..bf1b543227 100644 --- a/cmd/zetae2e/balances.go +++ b/cmd/zetae2e/balances.go @@ -10,10 +10,8 @@ import ( "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" - "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" ) const flagSkipBTC = "skip-btc" @@ -71,8 +69,6 @@ func runBalances(cmd *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.FungibleAdminName, // placeholder value, not used - local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/bitcoin_address.go b/cmd/zetae2e/bitcoin_address.go index b2a4525637..63eb26d386 100644 --- a/cmd/zetae2e/bitcoin_address.go +++ b/cmd/zetae2e/bitcoin_address.go @@ -10,10 +10,8 @@ import ( "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" - "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" ) const flagPrivKey = "privkey" @@ -71,8 +69,6 @@ func runBitcoinAddress(cmd *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.FungibleAdminName, // placeholder value, not used - local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/config/config.go b/cmd/zetae2e/config/config.go index b18ca9922b..7918a9a9ae 100644 --- a/cmd/zetae2e/config/config.go +++ b/cmd/zetae2e/config/config.go @@ -8,7 +8,6 @@ import ( "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/txserver" ) // RunnerFromConfig create test runner from config @@ -19,9 +18,8 @@ func RunnerFromConfig( conf config.Config, evmUserAddr ethcommon.Address, evmUserPrivKey string, - zetaUserName string, - zetaUserMnemonic string, logger *runner.Logger, + opts ...runner.E2ERunnerOption, ) (*runner.E2ERunner, error) { // initialize clients btcRPCClient, @@ -39,16 +37,6 @@ func RunnerFromConfig( if err != nil { return nil, fmt.Errorf("failed to get clients from config: %w", err) } - // initialize client to send messages to ZetaChain - zetaTxServer, err := txserver.NewZetaTxServer( - conf.RPCs.ZetaCoreRPC, - []string{zetaUserName}, - []string{zetaUserMnemonic}, - conf.ZetaChainID, - ) - if err != nil { - return nil, fmt.Errorf("failed to initialize ZetaChain tx server: %w", err) - } // initialize E2E test runner newRunner := runner.NewE2ERunner( @@ -57,11 +45,9 @@ func RunnerFromConfig( ctxCancel, evmUserAddr, evmUserPrivKey, - zetaUserMnemonic, evmClient, zevmClient, cctxClient, - zetaTxServer, fungibleClient, authClient, bankClient, @@ -71,6 +57,7 @@ func RunnerFromConfig( zevmAuth, btcRPCClient, logger, + opts..., ) // set contracts diff --git a/cmd/zetae2e/local/accounts.go b/cmd/zetae2e/local/accounts.go index daf10eabc2..16ab7d97a4 100644 --- a/cmd/zetae2e/local/accounts.go +++ b/cmd/zetae2e/local/accounts.go @@ -38,5 +38,7 @@ var ( UserAdminAddress = ethcommon.HexToAddress("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266") UserAdminPrivateKey = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" // #nosec G101 - used for testing - FungibleAdminMnemonic = "snow grace federal cupboard arrive fancy gym lady uniform rotate exercise either leave alien grass" // #nosec G101 - used for testing + // FungibleAdminAddress is the address of the account for testing the fungible admin functions + UserFungibleAdminAddress = ethcommon.HexToAddress("0x8305C114Ea73cAc4A88f39A173803F94741b9055") + UserFungibleAdminPrivateKey = "d88d09a7d6849c15a36eb6931f9dd616091a63e9849a2cc86f309ba11fb8fec5" // #nosec G101 - used for testing ) diff --git a/cmd/zetae2e/local/admin.go b/cmd/zetae2e/local/admin.go index 6b360ecb7d..1ac4cb6b60 100644 --- a/cmd/zetae2e/local/admin.go +++ b/cmd/zetae2e/local/admin.go @@ -39,6 +39,7 @@ func adminTestRoutine( UserAdminAddress, UserAdminPrivateKey, runner.NewLogger(verbose, color.FgHiGreen, "admin"), + runner.WithZetaTxServer(deployerRunner.ZetaTxServer), ) if err != nil { return err diff --git a/cmd/zetae2e/local/erc20.go b/cmd/zetae2e/local/erc20.go index 5d0e7a5ac9..b7fd74f0d8 100644 --- a/cmd/zetae2e/local/erc20.go +++ b/cmd/zetae2e/local/erc20.go @@ -40,6 +40,7 @@ func erc20TestRoutine( UserERC20Address, UserERC20PrivateKey, runner.NewLogger(verbose, color.FgGreen, "erc20"), + runner.WithZetaTxServer(deployerRunner.ZetaTxServer), ) if err != nil { return err diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index c1ab0f4431..d791621170 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -2,6 +2,7 @@ package local import ( "context" + "fmt" "os" "path/filepath" "time" @@ -14,6 +15,7 @@ import ( "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/e2etests" "github.com/zeta-chain/zetacore/e2e/runner" + "github.com/zeta-chain/zetacore/e2e/txserver" "github.com/zeta-chain/zetacore/e2e/utils" "github.com/zeta-chain/zetacore/pkg/chains" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -166,6 +168,16 @@ func localE2ETest(cmd *cobra.Command, _ []string) { time.Sleep(70 * time.Second) } + zetaTxServer, err := txserver.NewZetaTxServer( + conf.RPCs.ZetaCoreRPC, + []string{utils.FungibleAdminName}, + []string{UserFungibleAdminPrivateKey}, + conf.ZetaChainID, + ) + if err != nil { + panic(fmt.Errorf("failed to initialize ZetaChain tx server: %w", err)) + } + // initialize deployer runner with config deployerRunner, err := zetae2econfig.RunnerFromConfig( ctx, @@ -174,9 +186,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) { conf, DeployerAddress, DeployerPrivateKey, - utils.FungibleAdminName, - FungibleAdminMnemonic, logger, + runner.WithZetaTxServer(zetaTxServer), ) if err != nil { panic(err) diff --git a/cmd/zetae2e/local/test_runner.go b/cmd/zetae2e/local/test_runner.go index 6896c4c865..f2fe0ae811 100644 --- a/cmd/zetae2e/local/test_runner.go +++ b/cmd/zetae2e/local/test_runner.go @@ -6,7 +6,6 @@ import ( zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" ) // initTestRunner initializes a runner form tests @@ -18,6 +17,7 @@ func initTestRunner( userAddress ethcommon.Address, userPrivKey string, logger *runner.Logger, + opts ...runner.E2ERunnerOption, ) (*runner.E2ERunner, error) { // initialize runner for test testRunner, err := zetae2econfig.RunnerFromConfig( @@ -27,9 +27,8 @@ func initTestRunner( conf, userAddress, userPrivKey, - utils.FungibleAdminName, - FungibleAdminMnemonic, logger, + opts..., ) if err != nil { return nil, err diff --git a/cmd/zetae2e/run.go b/cmd/zetae2e/run.go index e97e9e576b..5ed6babf6b 100644 --- a/cmd/zetae2e/run.go +++ b/cmd/zetae2e/run.go @@ -12,11 +12,9 @@ import ( "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" - "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/e2etests" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" ) const flagVerbose = "verbose" @@ -93,8 +91,6 @@ func runE2ETest(cmd *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.FungibleAdminName, // placeholder value, not used - local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/setup_bitcoin.go b/cmd/zetae2e/setup_bitcoin.go index 407a80e429..f77924e768 100644 --- a/cmd/zetae2e/setup_bitcoin.go +++ b/cmd/zetae2e/setup_bitcoin.go @@ -10,10 +10,8 @@ import ( "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" - "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" ) // NewSetupBitcoinCmd sets up bitcoin wallet for e2e tests @@ -58,8 +56,6 @@ func runSetupBitcoin(_ *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.FungibleAdminName, // placeholder value, not used - local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/show_tss.go b/cmd/zetae2e/show_tss.go index 6c1ed0092c..780a525b19 100644 --- a/cmd/zetae2e/show_tss.go +++ b/cmd/zetae2e/show_tss.go @@ -10,10 +10,8 @@ import ( "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" - "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" ) // NewShowTSSCmd returns the show TSS command @@ -59,8 +57,6 @@ func runShowTSS(_ *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.FungibleAdminName, // placeholder value, not used - local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/stress.go b/cmd/zetae2e/stress.go index 20e7ff494f..c6a5353fd1 100644 --- a/cmd/zetae2e/stress.go +++ b/cmd/zetae2e/stress.go @@ -149,8 +149,6 @@ func StressTest(cmd *cobra.Command, _ []string) { conf, local.DeployerAddress, local.DeployerPrivateKey, - utils.FungibleAdminName, - local.FungibleAdminMnemonic, logger, ) if err != nil { diff --git a/contrib/localnet/docker-compose-admin.yml b/contrib/localnet/docker-compose-admin.yml index 23503cf305..19a478100e 100644 --- a/contrib/localnet/docker-compose-admin.yml +++ b/contrib/localnet/docker-compose-admin.yml @@ -13,6 +13,7 @@ services: context: ./anvil container_name: eth2 hostname: eth2 + platform: linux/amd64 ports: - "8546:8545" networks: @@ -23,4 +24,4 @@ services: entrypoint: [ "/root/start-zetaclientd.sh", "additional-evm" ] zetaclient1: - entrypoint: [ "/root/start-zetaclientd.sh", "additional-evm" ] \ No newline at end of file + entrypoint: [ "/root/start-zetaclientd.sh", "additional-evm" ] diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index 278ecd778b..1791742e66 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -219,11 +219,11 @@ then fi # set admin account - zetacored add-genesis-account zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk 100000000000000000000000000azeta + zetacored add-genesis-account zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3 100000000000000000000000000azeta zetacored add-genesis-account zeta1n0rn6sne54hv7w2uu93fl48ncyqz97d3kty6sh 100000000000000000000000000azeta # Funds the localnet_gov_admin account - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][0]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][1]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][2]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][0]["address"]="zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][1]["address"]="zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][2]["address"]="zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # give balance to runner accounts to deploy contracts directly on zEVM # deployer diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index 348a2a7ef1..71edc76c5d 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -48,8 +48,8 @@ const ( TestERC20DepositName = "erc20_deposit" TestMultipleERC20DepositName = "erc20_multiple_deposit" TestMultipleERC20WithdrawsName = "erc20_multiple_withdraw" - TestERC20DepositAndCallRefundName = "erc20_deposit_and_call_refund" TestERC20DepositRestrictedName = "erc20_deposit_restricted" // #nosec G101: Potential hardcoded credentials (gosec), not a credential + TestERC20DepositAndCallRefundName = "erc20_deposit_and_call_refund" /* Bitcoin tests @@ -307,12 +307,6 @@ var AllE2ETests = []runner.E2ETest{ }, TestMultipleERC20Withdraws, ), - runner.NewE2ETest( - TestERC20DepositAndCallRefundName, - "deposit a non-gas ZRC20 into ZEVM and call a contract that reverts", - []runner.ArgDefinition{}, - TestERC20DepositAndCallRefund, - ), runner.NewE2ETest( TestERC20DepositRestrictedName, "deposit ERC20 into ZEVM restricted address", @@ -321,6 +315,12 @@ var AllE2ETests = []runner.E2ETest{ }, TestERC20DepositRestricted, ), + runner.NewE2ETest( + TestERC20DepositAndCallRefundName, + "deposit a non-gas ZRC20 into ZEVM and call a contract that reverts", + []runner.ArgDefinition{}, + TestERC20DepositAndCallRefund, + ), /* Bitcoin tests */ diff --git a/e2e/e2etests/test_migrate_chain_support.go b/e2e/e2etests/test_migrate_chain_support.go index 4d0435623d..f39bcbc2a3 100644 --- a/e2e/e2etests/test_migrate_chain_support.go +++ b/e2e/e2etests/test_migrate_chain_support.go @@ -238,11 +238,9 @@ func configureEVM2(r *runner.E2ERunner) (*runner.E2ERunner, error) { r.CtxCancel, r.DeployerAddress, r.DeployerPrivateKey, - r.FungibleAdminMnemonic, r.EVMClient, r.ZEVMClient, r.CctxClient, - r.ZetaTxServer, r.FungibleClient, r.AuthClient, r.BankClient, @@ -252,6 +250,7 @@ func configureEVM2(r *runner.E2ERunner) (*runner.E2ERunner, error) { r.ZEVMAuth, r.BtcRPCClient, runner.NewLogger(true, color.FgHiYellow, "admin-evm2"), + runner.WithZetaTxServer(r.ZetaTxServer), ) // All existing fields of the runner are the same except for the RPC URL and client for EVM diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index d8df023057..03d05a0aab 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -33,17 +33,24 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) +type E2ERunnerOption func(*E2ERunner) + +func WithZetaTxServer(txServer *txserver.ZetaTxServer) E2ERunnerOption { + return func(r *E2ERunner) { + r.ZetaTxServer = txServer + } +} + // E2ERunner stores all the clients and addresses needed for E2E test // Exposes a method to run E2E test // It also provides some helper functions type E2ERunner struct { // accounts - DeployerAddress ethcommon.Address - DeployerPrivateKey string - TSSAddress ethcommon.Address - BTCTSSAddress btcutil.Address - BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash - FungibleAdminMnemonic string + DeployerAddress ethcommon.Address + DeployerPrivateKey string + TSSAddress ethcommon.Address + BTCTSSAddress btcutil.Address + BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash // rpc clients ZEVMClient *ethclient.Client @@ -58,8 +65,10 @@ type E2ERunner struct { ObserverClient observertypes.QueryClient LightclientClient lightclienttypes.QueryClient - // zeta client - ZetaTxServer txserver.ZetaTxServer + // optional zeta (cosmos) client + // typically only in test runners that need it + // (like admin tests) + ZetaTxServer *txserver.ZetaTxServer // evm auth EVMAuth *bind.TransactOpts @@ -119,11 +128,9 @@ func NewE2ERunner( ctxCancel context.CancelFunc, deployerAddress ethcommon.Address, deployerPrivateKey string, - fungibleAdminMnemonic string, evmClient *ethclient.Client, zevmClient *ethclient.Client, cctxClient crosschaintypes.QueryClient, - zetaTxServer txserver.ZetaTxServer, fungibleClient fungibletypes.QueryClient, authClient authtypes.QueryClient, bankClient banktypes.QueryClient, @@ -133,19 +140,18 @@ func NewE2ERunner( zevmAuth *bind.TransactOpts, btcRPCClient *rpcclient.Client, logger *Logger, + opts ...E2ERunnerOption, ) *E2ERunner { - return &E2ERunner{ + r := &E2ERunner{ Name: name, Ctx: ctx, CtxCancel: ctxCancel, - DeployerAddress: deployerAddress, - DeployerPrivateKey: deployerPrivateKey, - FungibleAdminMnemonic: fungibleAdminMnemonic, + DeployerAddress: deployerAddress, + DeployerPrivateKey: deployerPrivateKey, ZEVMClient: zevmClient, EVMClient: evmClient, - ZetaTxServer: zetaTxServer, CctxClient: cctxClient, FungibleClient: fungibleClient, AuthClient: authClient, @@ -161,6 +167,10 @@ func NewE2ERunner( WG: sync.WaitGroup{}, } + for _, opt := range opts { + opt(r) + } + return r } // CopyAddressesFrom copies addresses from another E2ETestRunner that initialized the contracts diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index 24478e78dd..fb2c403ada 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" @@ -34,9 +33,11 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/evmos/ethermint/crypto/hd" etherminttypes "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" @@ -63,43 +64,47 @@ type ZetaTxServer struct { } // NewZetaTxServer returns a new TxServer with provided account -func NewZetaTxServer(rpcAddr string, names []string, mnemonics []string, chainID string) (ZetaTxServer, error) { +func NewZetaTxServer(rpcAddr string, names []string, privateKeys []string, chainID string) (*ZetaTxServer, error) { ctx := context.Background() if len(names) == 0 { - return ZetaTxServer{}, errors.New("no account provided") + return nil, errors.New("no account provided") } - if len(names) != len(mnemonics) { - return ZetaTxServer{}, errors.New("invalid names and mnemonics") + if len(names) != len(privateKeys) { + return nil, errors.New("invalid names and privateKeys") } // initialize rpc and check status rpc, err := rpchttp.New(rpcAddr, "/websocket") if err != nil { - return ZetaTxServer{}, fmt.Errorf("failed to initialize rpc: %s", err.Error()) + return nil, fmt.Errorf("failed to initialize rpc: %s", err.Error()) } if _, err = rpc.Status(ctx); err != nil { - return ZetaTxServer{}, fmt.Errorf("failed to query rpc: %s", err.Error()) + return nil, fmt.Errorf("failed to query rpc: %s", err.Error()) } // initialize codec cdc, reg := newCodec() // initialize keyring - kr := keyring.NewInMemory(cdc) + kr := keyring.NewInMemory(cdc, hd.EthSecp256k1Option()) addresses := make([]string, 0, len(names)) // create accounts for i := range names { - r, err := kr.NewAccount(names[i], mnemonics[i], "", sdktypes.FullFundraiserPath, hd.Secp256k1) + err = kr.ImportPrivKeyHex(names[i], privateKeys[i], string(hd.EthSecp256k1Type)) if err != nil { - return ZetaTxServer{}, fmt.Errorf("failed to create account: %s", err.Error()) + return nil, fmt.Errorf("failed to create account: %w", err) + } + r, err := kr.Key(names[i]) + if err != nil { + return nil, fmt.Errorf("failed to get account key: %w", err) } accAddr, err := r.GetAddress() if err != nil { - return ZetaTxServer{}, fmt.Errorf("failed to get account address: %s", err.Error()) + return nil, fmt.Errorf("failed to get account address: %w", err) } addresses = append(addresses, accAddr.String()) @@ -108,11 +113,10 @@ func NewZetaTxServer(rpcAddr string, names []string, mnemonics []string, chainID clientCtx := newContext(rpc, cdc, reg, kr, chainID) txf := newFactory(clientCtx) - return ZetaTxServer{ + return &ZetaTxServer{ clientCtx: clientCtx, txFactory: txf, name: names, - mnemonic: mnemonics, address: addresses, blockTimeout: 1 * time.Minute, }, nil @@ -425,7 +429,8 @@ func (zts ZetaTxServer) FundEmissionsPool(account string, amount *big.Int) error // newCodec returns the codec for msg server func newCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry) { - interfaceRegistry := codectypes.NewInterfaceRegistry() + encodingConfig := app.MakeEncodingConfig() + interfaceRegistry := encodingConfig.InterfaceRegistry cdc := codec.NewProtoCodec(interfaceRegistry) sdktypes.RegisterInterfaces(interfaceRegistry)