Skip to content

Indexer assertion#196

Merged
NiranjanaBinoy merged 29 commits into
mainfrom
feat/indexer-assertion
May 19, 2026
Merged

Indexer assertion#196
NiranjanaBinoy merged 29 commits into
mainfrom
feat/indexer-assertion

Conversation

@NiranjanaBinoy
Copy link
Copy Markdown
Contributor

@NiranjanaBinoy NiranjanaBinoy commented Apr 30, 2026

Pull Request

Description

Indexer assertion

  • New /indexer-assertion route and page wiring through page components.
  • Form for assertion fields (including 32-character delegate digest, wallet Sign for digest → signature, submit path).
  • .env.example documents client-side env vars used for assertion RPC / signing where applicable.

Registration

  • Separate routes: host-registration and indexer-registration (plus existing registration entry) with shared registration page shell.
  • Entity is path-driven for v2: Host vs indexer comes from the URL; users switch flows via header navigation, not in-form role toggles. V1 registration still uses the Host/Indexer radio when v2 flag is off.
  • RegistrationContext exposes registrationEntity, derived from usePathname() in the provider.
  • useRegistrationFormV2 resets form state when route-driven entity changes; handleInputChange ignores entity so it cannot be overridden from inputs.
  • Indexer connection string: regex validation + helper, integrated into indexer field validation.
  • Transaction v2 hook and register ABIs aligned with host/indexer registration payloads; shared types updates for v2 form data.

Widgets

  • Added a shared InputField (widget) used from registration (and related flows); optional description + tooltip pattern where needed.
  • Header uses menu componentry for register / nav; popover / theme tokens adjusted where menus looked transparent.
  • Menubar styling for selected/hover states (bg-muted-foreground / text-muted) where applicable.

Related Issue

fixes #184
The landing page is currently blank it will be updated in the next PR.

Steps to Test

  1. Pull branch locally
  2. Add the admin key and cosmos rpc url to the .env
  3. Run the app or service

Checklist

  • Code compiles / runs
  • Tests added / updated
  • Documentation updated if needed
  • PR is self-contained and focused
  • Code does not break any existing features
  • Code passes personal internal testing

Notes

@NiranjanaBinoy NiranjanaBinoy self-assigned this Apr 30, 2026
@NiranjanaBinoy NiranjanaBinoy added the enhancement New feature or request label Apr 30, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 30, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
shinzo-webapp-staging f5c9969 Commit Preview URL

Branch Preview URL
May 15 2026, 08:12 PM

@NiranjanaBinoy NiranjanaBinoy force-pushed the feat/indexer-assertion branch from 903b85c to cdbf344 Compare May 4, 2026 06:42
@NiranjanaBinoy NiranjanaBinoy changed the base branch from main to feat/registration-form-v2 May 4, 2026 07:04
@NiranjanaBinoy NiranjanaBinoy linked an issue May 4, 2026 that may be closed by this pull request
@NiranjanaBinoy NiranjanaBinoy marked this pull request as ready for review May 4, 2026 07:29
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 4, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
shinzo-webapp-staging 8a88e45 May 06 2026, 08:34 PM

@NiranjanaBinoy NiranjanaBinoy force-pushed the feat/indexer-assertion branch from 119dd26 to 8cb652e Compare May 6, 2026 19:33
Base automatically changed from feat/registration-form-v2 to main May 6, 2026 20:11
@NiranjanaBinoy NiranjanaBinoy force-pushed the feat/indexer-assertion branch from 8cb652e to 8a88e45 Compare May 6, 2026 20:32
Comment on lines 27 to 29
@@ -28,6 +28,25 @@ export const isRegistrationV2 = () => {
return process.env.NEXT_PUBLIC_SHINZOHUB_V2_REGISTRATION_FLAG === "true";
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: add NEXT_PUBLIC_SHINZOHUB_V2_REGISTRATION_FLAG to env.example to not lose it

Comment thread apps/webapp/src/widget/menu/ui/header-menu.tsx
if (!isRegistrationV2()) {
return redirect("/registration");
}
return <Header />;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: #200

import { isRegistrationV2 } from "@/shared/lib";
import { AddressCopy } from "@/widget";

export default function IndexerAssertion() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feedback (ui): it'd be nice to rethink the page structure the way we present and explain the form to users.

  1. User address could go to header to be a standard connection button that transforms into an address. Copy button is probably redundant as users know their address and can take it from the wallet.
  2. Subtitle on the page could be more informative and explain what an assertion actually is and why people might need it.
  3. Delegate address is prefilled automatically on connection – maybe then hide it from UI? Plus, its tooltip says it should accept "shinzo_"-prefixed addresses, and we prefill a EVM address - UI mismatch.
  4. "Source chain" field - should it have Sepolia/Poligon that we already support?
  5. Source chain ID is prefilled - can easily be removed
  6. Consensus public key should probably have a tooltip that explains in simple language what it is
  7. "Sign and submit" - can it be a non-red button please? :)
Image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great feedback Max

Comment on lines +81 to +85
async function getChainId(rpc: string): Promise<string> {
const res = await fetch(`${rpc}/status`);
const json = (await res.json()) as any;
return json.result.node_info.network;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: do we need it? ShinzoHub chain is static and doesn't change often. Can be an env var

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concur: there will be between 2 & 3 different options that we can use for the chain id and can be set in an env var.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is returning the chainId for the Shinzohub, so I have moved that to a constant variable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't see the changes. Did you commit them?

Comment on lines +123 to +125
export async function adminIndexerAssertion(
opts: AdminIndexerAssertionOptions
) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: that function seems super complicated and is extremely difficult to read, mostly because the tx encoding is done manually here. Why not use Viem/Wagmi as you had in v1? Creating and sending transaction is much easier with it. At least it could remove much of the logic from the file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The registration transactions are evm based transactions that is why we are using viem/wagmi there. But the request for assertion is on cosmos, I have switched all the conversions to use viem but still we need to use cosmos sdk for creating and sending the request.

@dvncan
Copy link
Copy Markdown
Collaborator

dvncan commented May 11, 2026

Extra: we are going to need to remove the references to v1 after migrating to v2. Good to keep in mind and not focus on both working at the same time.

import { isRegistrationV2 } from "@/shared/lib";
import { AddressCopy } from "@/widget";

export default function IndexerAssertion() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great feedback Max

Comment on lines +81 to +85
async function getChainId(rpc: string): Promise<string> {
const res = await fetch(`${rpc}/status`);
const json = (await res.json()) as any;
return json.result.node_info.network;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concur: there will be between 2 & 3 different options that we can use for the chain id and can be set in an env var.

return {
consensusPubKey: "",
delegateAddress: connectedAddress,
sourceChain: "ethereum" as SOURCE_CHAIN,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: should be a env var

try {
const preDigest = randomHexString32();
const msgBytes = stringToBytes(preDigest);
const prefix = `\x19Ethereum Signed Message:\n${msgBytes.length}`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the Ethereum ENV to build this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have discussed, I have added this comment #196 (comment)

/** Delegate digest is a fixed-length payload (32 characters). */
export const DELEGATE_DIGEST_MAX_LENGTH = 32;

export type SOURCE_CHAIN = "ethereum" | "shinzohub";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this type as we can extract the type from SOURCE_CHAIN_ID_MAP

Comment on lines +13 to +16
export const SOURCE_CHAIN_ID_MAP: Record<SOURCE_CHAIN, number> = {
ethereum: 1,
shinzohub: 91273002,
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: consider a separate file which can be used across the app

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to constants in shared folder

"host-registration": {
title: "/ Register Host on the Shinzo Network",
description:
"Sign up your host to be recognized by the Shinzo Network and contribute to the ecosystem.",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: sentence structure is awkward.

suggestion: Register your host to participate within the Shinzo Network

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for below

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soniasingla or @johnnymatthews can you review the grammar/sentences before we deploy? I am going to create an issue.

@NiranjanaBinoy
Copy link
Copy Markdown
Contributor Author

While submitting assertion request, we are including a evm signature along with the digest (string that is used for sigining) and the address, which will be verifies in the cosmos env. In a evm wallet according to EIP-191, the messages that has to signed need to be prefixed with \x19Ethereum Signed Message:\n${msgBytes.length} , for a successful verification of teh signature currently we are prefixing the digest we are sending the reuest with the above prefix string. This will ensure the verification will be successful evm wallets following EIP-191 - verified this in MetaMask and Rabby- but there is a potential of it might failure for a wallet that does not follow this. We would want to make a note of this in the docs.
@dvncan @johnnymatthews

@NiranjanaBinoy NiranjanaBinoy force-pushed the feat/indexer-assertion branch from 31fedd3 to f0d0b89 Compare May 13, 2026 21:06
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
shinzo-studio 5e03fff May 13 2026, 09:26 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
faucet 5e03fff May 13 2026, 09:26 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
shinzo-explorer 5e03fff May 13 2026, 09:26 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
metrics-dashboard 5e03fff May 13 2026, 09:26 PM

@NiranjanaBinoy NiranjanaBinoy force-pushed the feat/indexer-assertion branch from f0d0b89 to 5e03fff Compare May 13, 2026 21:26
Comment on lines +40 to +42
export const getSourceChainMap = () => {
return JSON.parse(process.env.NEXT_PUBLIC_AVAILABLE_SOURCE_CHAINS ?? "{}");
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: add return type to the functions, default value returns, and example of this env in the .env.example

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: it's really unexpected to have a stringified JSON as an env. To me it can be a static value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made that update based on a review comment. I think whether it is in env or static, we would have to update when we add a new chain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved chain related constant values to a separate constant file

label: "Consensus Public Key",
isTextarea: false,
isSelect: false,
description: "The consensus public key of the indexer",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: update description to make the text useful and let users understand where to get this data from in case they don't come with a link

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need some help with proper the titles and tooltips texts, so I have created a separate Pr to track that #210.
I have left a message in the fe channel for the same.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can have @johnnymatthews + @soniasingla review for titles, grammar and general sentence structure. I created a ticket here: #213

Copy link
Copy Markdown
Collaborator

@VanishMax VanishMax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go! I didn't go through all the user journey, but it is definitely time to go forward and fix outstanding issues (if any) in the future work.

@dvncan need your approval too to remove "changes requested" badge

"host-registration": {
title: "/ Register Host on the Shinzo Network",
description:
"Sign up your host to be recognized by the Shinzo Network and contribute to the ecosystem.",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soniasingla or @johnnymatthews can you review the grammar/sentences before we deploy? I am going to create an issue.

label: "Consensus Public Key",
isTextarea: false,
isSelect: false,
description: "The consensus public key of the indexer",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can have @johnnymatthews + @soniasingla review for titles, grammar and general sentence structure. I created a ticket here: #213

@NiranjanaBinoy NiranjanaBinoy merged commit 38280ff into main May 19, 2026
2 checks passed
@NiranjanaBinoy NiranjanaBinoy deleted the feat/indexer-assertion branch May 19, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabling Indexer assertion

3 participants