rpcverify

package
v1.3.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package rpcverify is the REAL, network-backed ChainVerifier used by CI (and any out-of-process validator) to prove a manifest's assets exist on the TARGET net before a deploy. It is kept out of the registry package proper so the consensus-path registry carries no JSON-RPC / EVM-client dependency; only the offline validator links it.

For an ERC-20 it confirms: the C-Chain's eth_chainId matches the manifest's declared EVMChainID, the contract has code (eth_getCode length > 0), and a static decimals() call returns a value (which the registry then cross-checks against the manifest's declared decimals). For EVM_NATIVE it confirms the chainID. UTXO verification is delegated to the X-Chain avm.getAssetDescription endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier proves assets real against a live network: a C-Chain EVM RPC (for EVM_NATIVE/ERC20) and a P-Chain + X-Chain API base (for the C-Chain consensus-id confirm and UTXO asset descriptions).

func New

func New(ctx context.Context, evmRPC, apiBase string, nativeDecimals uint8) (*Verifier, error)

New dials the C-Chain EVM RPC and records the node API base for P/X queries. evmRPC is the full C-Chain RPC URL (…/ext/bc/C/rpc); apiBase is the node root (…) used to reach /ext/P and /ext/bc/X. nativeDecimals is the C-Chain native coin's decimals (18 for LUX).

func (*Verifier) ConfirmCChain

func (v *Verifier) ConfirmCChain(networkID uint32, evmChainID uint64, cChainID ids.ID) error

ConfirmCChain implements registry.CChainConfirmer: it confirms the live C-Chain's eth_chainId equals the manifest's EVMChainID and the live C-Chain consensus id equals the manifest's CChainID (queried from the P-Chain). A mismatch on either means the validator is pointed at the wrong network — the manifest must NOT be admitted.

func (*Verifier) VerifyERC20

func (v *Verifier) VerifyERC20(_ uint32, _ ids.ID, addr []byte) (uint8, error)

VerifyERC20 confirms a contract has code at addr and returns its decimals().

func (*Verifier) VerifyEVMNative

func (v *Verifier) VerifyEVMNative(_ uint32, _ ids.ID) (uint8, error)

VerifyEVMNative confirms the C-Chain is reachable (chainID readable) and returns the native decimals. (The chainID equality is enforced once in ConfirmCChain.)

func (*Verifier) VerifyUTXOAsset

func (v *Verifier) VerifyUTXOAsset(_ uint32, _ ids.ID, assetID ids.ID) (uint8, error)

VerifyUTXOAsset confirms a UTXO assetID exists via the X-Chain avm.getAssetDescription endpoint and returns its denomination.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL