Skip to content

[Do not merge] Simple Giga RPC check - #4197

Open
philipsu522 wants to merge 1 commit into
giga-1from
correctness-check-script
Open

philipsu522 wants to merge 1 commit into
giga-1from
correctness-check-script

Conversation

@philipsu522

Copy link
Copy Markdown
Contributor

Describe your changes and provide context


   Test                                      Expected result
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   EIP-1559 self-transfer                    Success; nonce +1; balance decreases by gas fee only
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   EIP-1559 transfer                         Recipient gains exactly 12,345 wei; gas = 21,000
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Legacy transfer                           Recipient gains exactly 67,890 wei; receipt type = 0
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Deploy counter contract                   Success; non-null contract address
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Increment counter, send 11 wei            Log contains 1; contract balance becomes 11 wei
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Increment then REVERT, send 17 wei        Failed receipt; no logs; value and storage changes roll back; gas charged
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Increment again                           Log contains 2, proving reverted storage did not persist
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Call with only 21,000 gas, send 19 wei    Failed receipt; all gas consumed; value rolled back
  ────────────────────────────────────────  ───────────────────────────────────────────────────────────────────────────
   Increment again                           Log contains 3, proving state remains correct

Testing performed to validate your change

@cursor

cursor Bot commented Sep 16, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Adds an optional manual E2E test script only; no changes to node, RPC server, or CI wiring in this diff.

Overview
Adds giga-rpc-check.py, a standalone Python harness that validates sei-chain giga-1’s minimal EVM JSON-RPC by broadcasting nine real transactions (via rtk proxy cast) against EVM_RPC using EVM_KEY, EVM_FROM, and EVM_CHAIN_ID.

The script exercises EIP-1559 and legacy transfers, contract creation from hand-written bytecode (counter with SSTORE/LOG0, revert, and out-of-gas), and strict receipt checks (status, type, gas, logs, logs bloom, balances, and nonce). It also asserts RPC semantics: latest/safe/finalized/pending tag aliasing, rejection of historical block tags, null receipts for unknown hashes, and errors on malformed eth_sendRawTransaction. Run artifacts (redacted send output and receipt JSON) land in a timestamped giga-check-* directory.

Reviewed by Cursor Bugbot for commit 41c91db. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 16, 2026, 10:21 AM

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adds a standalone Python end-to-end RPC checker for giga-1; the transaction sequencing, receipt assertions, hand-written counter bytecode and LOG0 bloom reconstruction all check out, but the private key is printed verbatim when a cast invocation times out, defeating the redaction the script otherwise applies.

Findings: 1 blocking | 3 non-blocking | 3 posted inline

Blockers

  • None at the file/PR level.
  • 1 blocking issue(s) flagged inline on specific lines.

Non-blocking

  • [suggestion] The script lands at the repo root, while every other Python tool in the tree lives under a package or scripts/ directory (scripts/seid_problems_detector.py, loadtest/scripts/, giga/tests/). Consider moving it next to the giga tests or under scripts/, and adding a short usage note (even a docstring block) listing the required environment variables — EVM_KEY, EVM_FROM, EVM_CHAIN_ID, plus optional EVM_RPC/EVM_CHECK_TIMEOUT — and the rtk/foundry prerequisites. Right now nothing in the repo tells an operator how to run it, and the script hard-fails with a bare KeyError if one variable is missing.
  • 2 suggestion(s)/nit(s) flagged inline on specific lines.

Comment thread giga-rpc-check.py

def cast(*args):
result = subprocess.run(["rtk", "proxy", "cast", *map(str, args)],
capture_output=True, text=True, timeout=TIMEOUT)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[blocker] subprocess.run(..., timeout=TIMEOUT) raises subprocess.TimeoutExpired on a stalled cast, and that exception's __str__ is "Command '%s' timed out after %s seconds" % (self.cmd, self.timeout)self.cmd is the full argv, which includes --private-key <EVM_KEY>. Since nothing catches it, the traceback prints the raw private key to stdout/stderr, which is the one thing line 54 and line 98 go out of their way to redact. A node that stops responding is exactly the failure this script exists to surface, so this is a likely path, not a corner case.

Wrap the call and sanitize before re-raising, e.g.:

try:
    result = subprocess.run(["rtk", "proxy", "cast", *map(str, args)],
                            capture_output=True, text=True, timeout=TIMEOUT)
except subprocess.TimeoutExpired as expired:
    raise AssertionError(f"cast timed out after {TIMEOUT}s: {str(expired).replace(KEY, '[REDACTED]')}") from None

While here: the failure message on line 62 interpolates raw cast stdout without the replace(KEY, "[REDACTED]") that the evidence file on line 98 applies — worth routing both through one redaction helper so a new call site can't miss it.

Comment thread giga-rpc-check.py


def cast(*args):
result = subprocess.run(["rtk", "proxy", "cast", *map(str, args)],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] The rtk proxy prefix is hardcoded, and rtk appears nowhere else in this repo. An operator with foundry installed still gets an immediate FileNotFoundError without it, and there is no way to point the script at a plain cast. Reading the command from the environment keeps both setups working:

CAST = os.environ.get("EVM_CAST", "rtk proxy cast").split()

and then subprocess.run([*CAST, *map(str, args)], ...).

Comment thread giga-rpc-check.py
CHAIN = int(os.environ["EVM_CHAIN_ID"], 0)
TIMEOUT = int(os.environ.get("EVM_CHECK_TIMEOUT", "90"))
OUT = Path("giga-check-" + time.strftime("%Y%m%d-%H%M%S") + "-" + secrets.token_hex(2))
OUT.mkdir()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] OUT.mkdir() runs at import, before any of the preflight checks on lines 149-151, so every misconfigured or aborted run leaves an empty giga-check-<timestamp>-<rand>/ directory behind in the working directory. giga-check-* is not in .gitignore either, so running this from the repo root (the natural place, given the file lives there) pollutes git status with untracked directories. Creating the directory lazily after the preflight checks pass, and adding a .gitignore entry for the evidence directories, would avoid both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant