Repository navigation
Conversation
There was a problem hiding this comment.
📋 Review Summary
This pull request modernises gochain/web3 into a zero-CGO, pure-Go EVM SDK and CLI by removing the heavy gochain/v4, did, vc, and vyper dependencies and implementing native primitives, RLP encoding, secp256k1 signing, V3 keystore handling, EIP-1559/legacy transactions, an HTTP/WebSocket JSON-RPC client, a full Solidity ABI engine with revert decoding and Go binding generation, OpenZeppelin v5 contract templates, and an EIP-1967 proxy. The overall architecture is clean and well-tested against viem reference vectors and mock RPC servers, though there are a few correctness and panic bugs to address in the ABI parser/binder, keystore decryption, CLI global flag normalisation, and the GitHub Actions Docker release condition.
🔍 General Feedback
- Replacing the external gochain/v4 dependency with a focused, pure-Go implementation (CGO_ENABLED=0) dramatically trims go.mod and enables clean cross-platform builds across Linux, macOS, and Windows.
- The new test suite in web3_test.go, client_test.go, assets/assets_test.go, and cmd/web3/cli_test.go provides strong regression coverage, including cryptographic and ABI encoding checks against viem reference vectors.
- Migration to OpenZeppelin v5 templates, EIP-1967 proxies, and urfave/cli/v2 (eliminating shared mutable flag variables) significantly improves maintainability and standards compliance.
- The README.md, Dockerfile, Makefile, and install.sh updates are clear and consistent with the new CLI surface, aside from the inline signature shorthand noted in the abi_parse.go comment.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 3,686 |
| Input Tokens (cached) | 513,639 (⚡ 99.3% cached) |
| Thinking / Reasoning Tokens | 24,310 |
| Output Tokens | 1,754 |
| Total Session Tokens | 543,389 |
| Cost (uncached input) | $0.0055 |
| Cost (cached input) | $0.0385 |
| Cost (thinking / reasoning) | $0.1823 |
| Cost (response output) | $0.0132 |
| Estimated Total Cost | $0.2395 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
There was a problem hiding this comment.
📋 Review Summary
This pull request replaces the go-ethereum/gochain dependency stack with a pure-Go, zero-CGO EVM library and CLI (gochain/web3), covering RLP encoding, secp256k1 transaction signing (Legacy, EIP-2930, and EIP-1559), JSON-RPC over HTTP(S)/WS(S), Solidity ABI parsing/packing/unpacking/revert decoding, V3 keystore encryption/decryption, EIP-1967 proxy management, OpenZeppelin v5 contract templates, and Go binding generation. All eight previously raised review issues have been resolved, and the PR introduces thorough unit and CLI test suites verified against viem reference vectors and mock JSON-RPC servers. Documentation in README.md and CI/build configurations (Dockerfile, Makefile, GitHub Actions, and install.sh) have been updated to match the pure-Go architecture and expanded CLI surface. A few minor-to-high edge cases remain around Windows/invalid-path handling in GetABI, hex address validation in contract calls, CSV tuple fallback parsing, multi-line Solidity imports in the flattener, and a WebSocket close race.
✅ Resolved Items from Prior Reviews
- goBindingType in abi_bind.go now returns web3.HexBytes for BytesTy, matching the ABI unpacker's return type. (
abi_bind.go:167) - ParseHumanSignature now tokenises only the modifier segment before returns or ':' and defaults colon-shorthand signatures with outputs to view. (
abi_parse.go:323) - DecryptKeystore and deriveKeystoreKey now validate IV length, dklen >= 32, and derivedKey length >= 32 before slicing or initialising AES-CTR. (
keystore.go:92) - normalizeCLIArgs now hoists trailing global app flags before the subcommand path rather than placing them in leafFlags. (
cmd/web3/main.go:339) - The DOCKER_USER secret check in the Docker release step now executes inside the run shell script rather than a step-level if condition. (
.github/workflows/main.yml:82) - safeParamName in abi_bind.go now includes res, zero, err, and v in its reserved identifier map. (
abi_bind.go:239) - Erc20Params now includes DecimalsSet so zero-decimal ERC-20 tokens are preserved instead of defaulting to 18. (
assets/erc20.go:111) - contractUpgradeCmd now calls upgradeTo rather than upgrade for compatibility with standard EIP-1967 and UUPS proxies. (
cmd/web3/contracts.go:735)
🔍 General Feedback
- Replacing gochain/v4 with pure-Go primitives, RLP, secp256k1 signing, and ABI encoding dramatically reduces transitive dependencies and enables clean CGO_ENABLED=0 cross-compilation across Linux, macOS, and Windows.
- Testing against viem reference vectors for EIP-191 personal_sign, EIP-155 legacy transactions, EIP-1559 dynamic fee transactions, dynamic ABI tuples/slices, and custom error decoding provides strong verification of cryptographic and ABI wire compatibility.
- Updating the proxy contract to standard EIP-1967 storage slots (assets/EIP1967Proxy.sol) and upgrading the contract generators to OpenZeppelin v5 templates aligns the CLI with modern EVM tooling and block explorers.
- README.md has been cleanly updated to reflect the new subcommands, built-in network presets, EIP-1967 proxy workflow, and JSON output mode.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 2,550 |
| Input Tokens (cached) | 518,351 (⚡ 99.3% cached) |
| PR Comments History Tokens | 1,133 |
| Thinking / Reasoning Tokens | 23,272 |
| Output Tokens | 2,601 |
| Total Session Tokens | 547,907 |
| Cost (uncached input) | $0.0055 |
| Cost (cached input) | $0.0389 |
| Cost (thinking / reasoning) | $0.1745 |
| Cost (response output) | $0.0195 |
| Estimated Total Cost | $0.2384 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
There was a problem hiding this comment.
📋 Review Summary
This pull request replaces the heavy gochain/v4 dependency with a pure-Go, zero-CGO implementation of EVM primitives, RLP encoding, secp256k1 signing (Legacy EIP-155 and EIP-1559 Type 2), JSON-RPC 2.0 HTTP/WebSocket transport, V3 keystore handling, Solidity ABI parsing/packing/unpacking/revert decoding, Go contract bindings, OpenZeppelin v5 templates, and standard EIP-1967 upgradeable proxies. It also modernises the CLI with urfave/cli/v2, adds new offline and chain-inspection commands, updates README.md, install.sh, Dockerfile, Makefile, and GitHub Actions workflows, and introduces comprehensive unit and mock-RPC tests. Eight previously raised review issues have been resolved, while five prior comments and two additional issues (an integer-overflow bounds bypass in ABI dynamic-bytes decoding and unreserved package/import identifiers in Go binding generation) remain to be addressed.
✅ Resolved Items from Prior Reviews
- goBindingType in abi_bind.go now returns web3.HexBytes for BytesTy, matching the unpacker's return type. (
abi_bind.go:167) - ParseHumanSignature in abi_parse.go now parses mutability tokens only from the modifier segment and defaults colon-shorthand signatures with outputs to view. (
abi_parse.go:323) - DecryptKeystore and deriveKeystoreKey in keystore.go now validate IV length (16 bytes) and derived key / dklen length (>= 32 bytes) before slicing or constructing the AES-CTR stream. (
keystore.go:92) - normalizeCLIArgs in cmd/web3/main.go now hoists trailing global flags into globalFlags before the subcommand path. (
cmd/web3/main.go:339) - Removed .github/workflows/main.yml in favour of .github/workflows/release.yml, where DOCKER_USER is defined at job-level env. (
.github/workflows/main.yml:82) - Added res, zero, err, and v to the reserved parameter-name map in safeParamName. (
abi_bind.go:239) - Added DecimalsSet to Erc20Params so explicit 0-decimal ERC-20 tokens are preserved instead of defaulting to 18. (
assets/erc20.go:111) - contract upgrade now calls upgradeTo for compatibility with standard EIP-1967 and UUPS proxies. (
cmd/web3/contracts.go:735)
🔍 General Feedback
- Removing the gochain/v4 dependency yields a clean, zero-CGO module graph with fast cross-platform static builds and significantly improved testability via httptest mock servers and viem reference vectors.
- The documentation in README.md, build configuration in Dockerfile/Makefile, and release/install scripts (release.yml, test.yml, install.sh) are well aligned with the updated CLI commands, flags, and release artefact names.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 1,150 |
| Input Tokens (cached) | 520,473 (⚡ 99.3% cached) |
| PR Comments History Tokens | 2,568 |
| Thinking / Reasoning Tokens | 14,711 |
| Output Tokens | 2,867 |
| Total Session Tokens | 541,769 |
| Cost (uncached input) | $0.0056 |
| Cost (cached input) | $0.0390 |
| Cost (thinking / reasoning) | $0.1103 |
| Cost (response output) | $0.0215 |
| Estimated Total Cost | $0.1764 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
…lti-line imports, and WS locking
There was a problem hiding this comment.
📋 Review Summary
This pull request replaces the external gochain/v4 dependency with a pure-Go (CGO_ENABLED=0) EVM SDK and modernises the CLI using urfave/cli/v2. It introduces native RLP encoding/decoding, secp256k1 signing (EIP-155, EIP-1559, EIP-191), V3 keystore management, a full Solidity ABI parser/packer/unpacker/revert decoder, Go binding generation, OpenZeppelin v5 contract templates, an EIP-1967 upgradeable proxy, and updated multi-network presets, workflows, and documentation. All previously raised review issues—including ABI edge cases, integer overflow protection, keystore validation, Windows inline-signature handling, WebSocket locking, multi-line Solidity flattening, and CLI flag normalisation—have been resolved and covered by unit tests.
✅ Resolved Items from Prior Reviews
- Updated goBindingType in abi_bind.go to return web3.HexBytes for BytesTy so generated constant-function type assertions match the unpacker's return type. (
abi_bind.go:167) - Updated ParseHumanSignature to tokenise only the modifier segment before returns/colon and default colon-shorthand signatures with outputs to view. (
abi_parse.go:323) - Added dklen >= 32, len(derivedKey) >= 32, and len(iv) == aes.BlockSize checks in DecryptKeystore and deriveKeystoreKey to prevent panics on malformed keystores. (
keystore.go:92) - Updated normalizeCLIArgs to hoist trailing global flags before the first subcommand so urfave/cli/v2 parses them cleanly. (
cmd/web3/main.go:339) - Moved DOCKER_USER to job-level env in the replacement release workflow so Docker login and push step conditions evaluate accurately. (
.github/workflows/main.yml:82) - Added zero, res, err, and v to the reserved parameter map in safeParamName. (
abi_bind.go:239) - Added DecimalsSet to Erc20Params so GenERC20 respects explicit 0-decimal tokens instead of defaulting to 18. (
assets/erc20.go:111) - Updated contractUpgradeCmd to invoke upgradeTo for compatibility with standard EIP-1967 and UUPS proxies. (
cmd/web3/contracts.go:735) - Checked os.Stat before calling ABIOpenFile in GetABI so colon-containing inline function signatures fall through reliably on Windows. (
abi_wrapper.go:52) - Validated IsHexAddress at the entry of CallConstantFunction, CallFunctionWithOpts, and CallFunctionWithDataOpts. (
web3.go:85) - Restricted JSON decoding in convertTupleInput to inputs starting with '{' or '[' so CSV tuples fall through cleanly. (
abi_pack.go:521) - Updated FlattenSourceFile to accumulate and parse multi-line Solidity import statements. (
cmd/web3/flatten.go:14) - Added an immutable isWS flag on RPCClient and checked it before acquiring wsMu in roundTrip to eliminate the data race with Close(). (
rpc_client.go:246) - Changed the bounds check in readDynamicBytes to length > len(tail)-32 to prevent integer overflow on malformed ABI payloads. (
abi_unpack.go:239) - Added web3, context, and big to the reserved map in safeParamName to prevent imported package shadowing. (
abi_bind.go:240)
🔍 General Feedback
- Strong architectural improvement: removing the heavy gochain/v4 dependency significantly reduces go.mod transitive dependencies and enables clean CGO_ENABLED=0 static builds across Linux, macOS, and Windows.
- Good test coverage across viem reference vectors (EIP-191, EIP-155, EIP-1559, ABI tuples/slices, custom error decoding), mock JSON-RPC servers, CLI flag normalisation, and OpenZeppelin v5 templates.
- Documentation updates in README.md and example contracts in contracts/ align well with the new CLI subcommands, global flags, and EIP-1967 proxy workflow.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 0 |
| Input Tokens (cached) | 523,790 (⚡ 99.3% cached) |
| PR Comments History Tokens | 4,220 |
| Thinking / Reasoning Tokens | 25,962 |
| Output Tokens | 1,906 |
| Total Session Tokens | 555,339 |
| Cost (uncached input) | $0.0063 |
| Cost (cached input) | $0.0393 |
| Cost (thinking / reasoning) | $0.1947 |
| Cost (response output) | $0.0143 |
| Estimated Total Cost | $0.2546 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
There was a problem hiding this comment.
📋 Review Summary
This pull request modernises gochain/web3 into a pure-Go (CGO_ENABLED=0) CLI tool and SDK by removing the legacy gochain/gochain/v4, Vyper, DID, and VC dependencies and replacing them with native implementations for EVM primitives, secp256k1 signing, RLP encoding, JSON-RPC (HTTP/WS), V3 keystores, Solidity ABI packing/unpacking, revert decoding, and Go binding generation. It also upgrades smart contract templates to OpenZeppelin v5 (ERC-20, ERC-721, and ERC-1155), replaces the custom upgradeable proxy with a standard EIP-1967 proxy, refactors the CLI onto urfave/cli/v2 with EIP-1559 auto-detection and new inspection/utility commands, and updates the Dockerfile, install script, GitHub Actions workflows, and README to align with these changes. Prior review feedback has largely been addressed across recent commits, leaving only a few minor items outstanding.
✅ Resolved Items from Prior Reviews
- Updated goBindingType for BytesTy to return web3.HexBytes so generated constant-function type assertions match the ABI unpacker output. (
abi_bind.go:167) - Fixed ParseHumanSignature mutability parsing to tokenise only the modifier segment before returns or ':' and default colon-shorthand signatures with outputs to view. (
abi_parse.go:323) - Added IV block-size validation and derived key / dklen bounds checks (>= 32 bytes) in DecryptKeystore. (
keystore.go:92) - Updated normalizeCLIArgs to hoist trailing global flags before the first subcommand for urfave/cli/v2 compatibility. (
cmd/web3/main.go:339) - Replaced main.yml with release.yml and moved DOCKER_USER to job-level env so step conditionals evaluate as expected. (
.github/workflows/main.yml:82) - Added local variable names (res, zero, err, v) to the reserved parameter map in safeParamName. (
abi_bind.go:239) - Added DecimalsSet to Erc20Params so explicitly configured 0-decimal ERC-20 tokens are not overridden to 18. (
assets/erc20.go:111) - Updated contractUpgradeCmd to call upgradeTo (or upgradeToAndCall when init-data is given) for standard EIP-1967 compatibility. (
cmd/web3/contracts.go:735) - Updated GetABI to check os.Stat before opening a file path so inline signatures containing colons work reliably on Windows. (
abi_wrapper.go:52) - Added IsHexAddress validation to CallConstantFunction, CallFunctionWithOpts, and CallFunctionWithDataOpts. (
web3.go:85) - Restricted JSON decoding in convertTupleInput to inputs starting with '{' or '[' so unbracketed CSV tuples fall back cleanly. (
abi_pack.go:521) - Updated FlattenSourceFile to accumulate and parse multi-line Solidity import statements. (
cmd/web3/flatten.go:14) - Added an immutable isWS flag to RPCClient checked before locking wsMu, eliminating the data race with Close(). (
rpc_client.go:253) - Fixed the integer-overflowable bounds check in readDynamicBytes to compare length > len(tail)-32. (
abi_unpack.go:239) - Added imported package names (web3, context, big) to safeParamName's reserved identifier map. (
abi_bind.go:240)
🔍 General Feedback
- Strong pure-Go replacement of gochain/gochain/v4 with thorough unit tests verified against viem reference vectors for EIP-55 addresses, EIP-191 personal_sign, EIP-155 legacy transactions, EIP-1559 transactions, dynamic ABI tuples/slices, and custom Solidity error decoding.
- The CLI reorganisation and mock-RPC / offline CLI test suites in cmd/web3/cli_test.go and client_test.go provide solid regression coverage for flag normalisation, gas estimation, proxy slot inspection, and multi-line Solidity flattening.
- README.md, Dockerfile, and install.sh are cleanly updated to match the pure-Go build, OpenZeppelin v5 templates, EIP-1967 proxy commands, and expanded network presets.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 0 |
| Input Tokens (cached) | 524,560 (⚡ 99.3% cached) |
| PR Comments History Tokens | 4,911 |
| Thinking / Reasoning Tokens | 12,751 |
| Output Tokens | 1,971 |
| Total Session Tokens | 542,998 |
| Cost (uncached input) | $0.0074 |
| Cost (cached input) | $0.0393 |
| Cost (thinking / reasoning) | $0.0956 |
| Cost (response output) | $0.0148 |
| Estimated Total Cost | $0.1571 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
There was a problem hiding this comment.
📋 Review Summary
This pull request modernises gochain/web3 into a zero-CGO, pure-Go SDK and CLI (Go 1.26) by removing the github.com/gochain/gochain/v4, did, vc, and vyper dependencies and implementing native EVM primitives, RLP encoding, secp256k1/EIP-1559 transaction signing, Web3 Secret Storage V3 keystores, full Solidity ABI encoding/decoding/revert parsing, Go binding generation, and standard EIP-1967 upgradeable proxy support. The CLI has been refactored onto urfave/cli/v2 with expanded inspection and offline utility commands (storage, logs, cancel, sign, verify-sig, keccak, encode, decode, units), OpenZeppelin v5 contract generators (erc20, erc721, erc1155), and multi-line Solidity flattening. The build infrastructure (Dockerfile, Makefile, install.sh, GitHub Actions workflows) and README.md documentation are well aligned with the refactored architecture and new commands. Most issues raised in previous review rounds have been resolved with accompanying unit and mock-RPC tests, leaving a small number of minor unresolved items and two modest edge cases to address.
✅ Resolved Items from Prior Reviews
- Aligned
BytesTyin Go binding generation to returnweb3.HexBytesso generated constant methods matchabi_unpack.gooutput types. (abi_bind.go:167) - Fixed
ParseHumanSignaturemutability detection to tokenise only the modifier segment beforereturns/:and default colon-shorthand signatures with outputs toview. (abi_parse.go:323) - Added
dkLen >= 32,len(derivedKey) >= 32, andlen(iv) == aes.BlockSizevalidation inkeystore.goto prevent panics on malformed V3 keystores. (keystore.go:92) - Updated
normalizeCLIArgsto hoist trailing global flags before the first subcommand sourfave/cli/v2parses them properly. (cmd/web3/main.go:339) - Replaced the legacy release workflow with
release.yml, definingDOCKER_USERat job-levelenvso Docker publishing conditions evaluate as expected. - Added
res,zero,err, andvtosafeParamName's reserved map inabi_bind.go. (abi_bind.go:239) - Added
DecimalsSettoErc20Paramsso 0-decimal ERC-20 tokens are preserved instead of defaulting to 18. (assets/erc20.go:111) - Updated proxy upgrades to invoke
upgradeTofor compatibility with standard EIP-1967 / UUPS proxies as well asEIP1967UpgradeableProxy. (cmd/web3/contracts.go:735) - Updated
GetABIto checkos.Statbefore opening a path so inline signatures containing colons work reliably on Windows. (abi_wrapper.go:52) - Added
IsHexAddressvalidation at the entry ofCallConstantFunction,CallFunctionWithOpts, andCallFunctionWithDataOpts. (web3.go:85) - Restricted JSON decoding in
convertTupleInputto inputs starting with{or[so unbracketed CSV tuples fall back cleanly tosplitTopLevelCSV. (abi_pack.go:521) - Updated Solidity flattening in
FlattenSourceFileto parse multi-lineimport ...;statements. (cmd/web3/flatten.go:14) - Added an immutable
isWSfield onRPCClientsoroundTripchecks transport type without racing againstClose(). - Fixed the slice bounds check in
readDynamicBytes(length > len(tail)-32) to prevent integer overflow. (abi_unpack.go:239) - Added imported package identifiers (
web3,context,big) tosafeParamName's reserved map inabi_bind.go. (abi_bind.go:240)
🔍 General Feedback
- Removing the heavy
gochain/v4dependency in favour of pure-Go primitives, RLP, secp256k1 signing, and ABI handling significantly shrinks the dependency footprint and enables clean cross-platform static builds (CGO_ENABLED=0) across Linux, macOS, and Windows. - The new test suites (
web3_test.go,client_test.go,assets/assets_test.go,cmd/web3/cli_test.go) provide strong offline coverage using reference vectors (EIP-55, EIP-191, legacy EIP-155, EIP-1559, ABI tuples, custom errors) as well as mock HTTP JSON-RPC integration tests. README.md,install.sh,Dockerfile, andMakefilehave been cleanly updated to reflect the new CLI subcommands, network presets, OpenZeppelin v5 templates, and Go 1.26 toolchain.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 0 |
| Input Tokens (cached) | 525,020 (⚡ 99.3% cached) |
| PR Comments History Tokens | 5,363 |
| Thinking / Reasoning Tokens | 17,367 |
| Output Tokens | 2,216 |
| Total Session Tokens | 548,301 |
| Cost (uncached input) | $0.0080 |
| Cost (cached input) | $0.0394 |
| Cost (thinking / reasoning) | $0.1303 |
| Cost (response output) | $0.0166 |
| Estimated Total Cost | $0.1943 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
…vert offset, and release bump
There was a problem hiding this comment.
📋 Review Summary
This pull request modernises gochain/web3 into a pure-Go, zero-CGO SDK and CLI (Go 1.26) by removing the gochain/v4, Vyper, DID, and VC dependencies and implementing native secp256k1 crypto, RLP encoding, EIP-155/EIP-2930/EIP-1559 transaction signing, HTTP/WebSocket JSON-RPC, a full Solidity ABI engine with revert decoding and Go binding generation, V3 keystore encryption/decryption, OpenZeppelin v5 contract templates, and an EIP-1967 upgradeable proxy. All previously raised review issues across ABI parsing/packing/unpacking, bindings, keystore validation, Windows signature resolution, multi-line Solidity flattening, CLI flag hoisting, proxy selector collisions, and CI release security have been resolved. Test coverage is thorough with viem reference vectors, mock RPC integration tests, and CLI tests, leaving only one minor improvement for tag pushing in the release workflow.
✅ Resolved Items from Prior Reviews
- Updated goBindingType in abi_bind.go to return web3.HexBytes for BytesTy so constant-function type assertions match DecodeDynamicValue. (
abi_bind.go:167) - Added local variable and imported package identifiers (res, zero, err, v, web3, context, big) to safeParamName's reserved map in abi_bind.go. (
abi_bind.go:240) - Updated ParseHumanSignature in abi_parse.go to tokenise only the modifier segment before returns/: and default colon shorthand with outputs to view. (
abi_parse.go:323) - Added dklen >= 32, derivedKey length >= 32, and AES block-size IV checks in keystore.go to prevent panics on malformed V3 keystores. (
keystore.go:92) - Fixed normalizeCLIArgs in cmd/web3/main.go to hoist trailing global flags before the first subcommand. (
cmd/web3/main.go:339) - Moved DOCKER_USER to job-level env in the new release workflow (.github/workflows/release.yml) replacing .github/workflows/main.yml. (
.github/workflows/main.yml:82) - Added DecimalsSet to Erc20Params in assets/erc20.go so 0-decimal tokens can be generated from the CLI without being overridden to 18. (
assets/erc20.go:111) - Updated contractUpgradeCmd in cmd/web3/contracts.go to invoke upgradeTo on EIP-1967 proxies. (
cmd/web3/contracts.go:735) - Updated GetABI in abi_wrapper.go to check os.Stat before opening files so inline signatures containing colons work on Windows. (
abi_wrapper.go:52) - Added IsHexAddress validation in CallConstantFunction, CallFunctionWithOpts, CallFunctionWithDataOpts, and ERC-20 CLI handlers. (
web3.go:85) - Restricted JSON decoding in convertTupleInput (abi_pack.go) to inputs starting with '{' or '[' so CSV tuples fall through cleanly. (
abi_pack.go:521) - Updated FlattenSourceFile in cmd/web3/flatten.go to accumulate and parse multi-line Solidity import statements. (
cmd/web3/flatten.go:14) - Added an immutable isWS flag on RPCClient in rpc_client.go and checked it before locking wsMu to avoid a data race with Close(). (
rpc_client.go:246) - Fixed integer overflow in readDynamicBytes bounds check in abi_unpack.go using length > len(tail)-32. (
abi_unpack.go:239) - Handled web3.Hash alongside web3.HexBytes when --to-string is passed in cmd/web3/contracts.go. (
cmd/web3/contracts.go:537) - Added non-negative amount validation in transferCommand (cmd/web3/transactions.go). (
cmd/web3/transactions.go:48) - Replaced the remote gitbump.sh script execution in .github/workflows/release.yml with an inline version-bumping step. (
.github/workflows/release.yml:42) - Removed paused() and storage view methods from EIP1967UpgradeableProxy (and recompiled EIP1967ProxyBin/ABI) so implementation calls such as ERC20Pausable.paused() are delegated properly. (
assets/EIP1967Proxy.sol:56) - Updated FormatRPCError in abi_revert.go to search directly for the 0x08c379a0 and 0x4e487b71 revert selectors rather than the first 0x in the error message. (
abi_revert.go:107)
🔍 General Feedback
- Removing the heavy gochain/v4 dependency in favour of a pure-Go, CGO_ENABLED=0 architecture significantly simplifies cross-compilation (Linux, macOS, Windows) and lowers the maintenance footprint.
- The addition of TestViemReferenceVectors (verifying EIP-55 addresses, EIP-191 personal_sign, EIP-155 and EIP-1559 transaction encoding/hashing, complex ABI tuple/slice packing, and custom error decoding), mock RPC tests, and offline/online CLI tests provides strong verification across the new components.
- The documentation in README.md and the installation script (install.sh) are clear and aligned with the updated CLI commands, flags, networks, and OpenZeppelin v5 templates.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 521,993 |
| PR Comments History Tokens | 6,266 |
| Thinking / Reasoning Tokens | 15,581 |
| Output Tokens | 1,810 |
| Total Session Tokens | 545,650 |
| Cost (uncached input) | $0.7924 |
| Cost (thinking / reasoning) | $0.1169 |
| Cost (response output) | $0.0136 |
| Estimated Total Cost | $0.9228 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
There was a problem hiding this comment.
📋 Review Summary
This pull request modernises gochain/web3 into a pure-Go (zero-CGO) EVM SDK and CLI targeting Go 1.26, replacing the external gochain/v4 dependency with native implementations of RLP encoding, secp256k1 transaction signing, EIP-191 personal signatures, V3 keystores, JSON-RPC over HTTP(S)/WS(S), and Solidity ABI packing/unpacking/revert decoding. It also adds EIP-1559 fee auto-detection, automatic gas estimation, standard EIP-1967 upgradeable proxy support, OpenZeppelin v5 contract generators, Go ABI binding generation, expanded network presets, updated GitHub Actions workflows, and comprehensive unit and CLI tests alongside a refreshed README.
✅ Resolved Items from Prior Reviews
- Mapped BytesTy to web3.HexBytes in GenerateGoBinding so constant functions returning bytes do not fail type assertions. (
abi_bind.go:167) - Added generated local helper identifiers and imported package names to the reserved parameter list in safeParamName. (
abi_bind.go:240) - Restricted ParseHumanSignature mutability parsing to the modifier segment and defaulted colon-shorthand signatures with outputs to view. (
abi_parse.go:323) - Validated derived key length (>= 32) and AES-CTR IV length (16 bytes) in DecryptKeystore and deriveKeystoreKey. (
keystore.go:92) - Updated normalizeCLIArgs to hoist trailing global flags before the first subcommand for urfave/cli/v2 compatibility. (
cmd/web3/main.go:339) - Moved DOCKER_USER to job-level env in the release workflow so step conditions evaluate correctly. (
.github/workflows/main.yml:82) - Added DecimalsSet to Erc20Params so --decimals 0 is preserved instead of defaulting to 18. (
assets/erc20.go:111) - Updated proxy upgrade calls to invoke upgradeTo on EIP1967UpgradeableProxy. (
cmd/web3/contracts.go:735) - Checked os.Stat before falling through to ParseHumanSignature in GetABI so inline colon signatures work on Windows. (
abi_wrapper.go:52) - Added IsHexAddress validation at the entry points of CallConstantFunction, CallFunctionWithOpts, and CallFunctionWithDataOpts. (
web3.go:85) - Restricted JSON decoding in convertTupleInput to inputs starting with '{' or '[' so CSV tuples fall through cleanly. (
abi_pack.go:521) - Updated FlattenSourceFile to parse multi-line Solidity import statements across line breaks. (
cmd/web3/flatten.go:14) - Added an immutable isWS flag on RPCClient so roundTrip acquires wsMu before inspecting wsConn. (
rpc_client.go:246) - Fixed potential integer overflow in readDynamicBytes by checking length > len(tail)-32. (
abi_unpack.go:239) - Handled web3.Hash outputs alongside web3.HexBytes when --to-string is passed to contract call. (
cmd/web3/contracts.go:537) - Rejected negative transfer amounts during CLI argument validation in transferCommand. (
cmd/web3/transactions.go:48) - Replaced the remote gitbump.sh curl-to-bash invocation in the release workflow with an inline semver bump step. (
.github/workflows/release.yml:42) - Removed view getters such as paused() from EIP1967UpgradeableProxy and recompiled EIP1967ProxyBin so implementation calls delegate cleanly. (
assets/EIP1967Proxy.sol:56) - Updated FormatRPCError to locate revert/panic selectors directly rather than matching the first 0x prefix in the error string. (
abi_revert.go:107)
🔍 General Feedback
- Replacing gochain/v4 with self-contained RLP, secp256k1 signing, ABI, and JSON-RPC implementations achieves clean zero-CGO builds across Linux, macOS, and Windows while substantially trimming transitive dependencies in go.mod.
- The new test suite provides strong coverage across viem reference vectors (EIP-191, EIP-155, EIP-1559, dynamic tuples, custom errors), keystore edge cases, OpenZeppelin v5 templates, mock JSON-RPC flows, and CLI argument normalisation.
- Documentation in README.md and install.sh is well aligned with the updated CLI commands, flags, bundled ABIs, EIP-1967 proxy workflow, and OpenZeppelin v5 generators.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 0 |
| Input Tokens (cached) | 525,858 (⚡ 99.3% cached) |
| PR Comments History Tokens | 6,560 |
| Thinking / Reasoning Tokens | 15,406 |
| Output Tokens | 1,592 |
| Total Session Tokens | 546,566 |
| Cost (uncached input) | $0.0098 |
| Cost (cached input) | $0.0394 |
| Cost (thinking / reasoning) | $0.1155 |
| Cost (response output) | $0.0119 |
| Estimated Total Cost | $0.1768 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
There was a problem hiding this comment.
📋 Review Summary
This pull request modernises the repository into a pure-Go (CGO_ENABLED=0) EVM SDK and CLI targeting Go 1.26, removing the legacy gochain/v4, Vyper, and DID/VC dependencies. It introduces native RLP encoding/decoding, secp256k1 transaction signing (Legacy, EIP-2930, and EIP-1559), an HTTP/WebSocket JSON-RPC client, a full Solidity ABI encoder/decoder with revert decoding, V3 keystore encryption/decryption, Go binding generation, OpenZeppelin v5 contract templates, and an EIP-1967 upgradeable proxy, alongside updated unit/CLI tests, workflows, and documentation. All previously raised security, correctness, and cross-platform issues from earlier review iterations have been addressed cleanly, leaving only two minor edge cases around unused math/big imports in generated Go bindings and local solc patch version matching.
✅ Resolved Items from Prior Reviews
- Updated goBindingType for BytesTy to return web3.HexBytes so constant-function type assertions match DecodeDynamicValue output. (
abi_bind.go:167) - Added local helper and imported package identifiers (res, zero, err, v, web3, context, big) to safeParamName's reserved map in Go binding generation. (
abi_bind.go:240) - Fixed ParseHumanSignature mutability tokenisation and defaulted colon-shorthand signatures with outputs to view. (
abi_parse.go:323) - Added os.Stat check before opening ABI files in GetABI so inline colon signatures resolve reliably on Windows. (
abi_wrapper.go:52) - Restricted JSON decoding in convertTupleInput to inputs starting with '{' or '[' so CSV tuples fall through to splitTopLevelCSV. (
abi_pack.go:521) - Fixed integer overflow in readDynamicBytes bounds check by comparing against len(tail)-32. (
abi_unpack.go:239) - Updated FormatRPCError to locate the revert/panic selector index directly rather than the first '0x' substring. (
abi_revert.go:107) - Validated IV length and derived key / dklen length (>= 32 bytes) in DecryptKeystore and deriveKeystoreKey. (
keystore.go:92) - Added an immutable isWS field on RPCClient to eliminate the wsConn data race with Close(). (
rpc_client.go:253) - Validated contract addresses with IsHexAddress at entry points in web3.go and CLI helpers. (
web3.go:85) - Added DecimalsSet on Erc20Params so 0-decimal ERC-20 contracts can be generated without defaulting to 18. (
assets/erc20.go:111) - Removed colliding view functions (such as paused()) from EIP1967UpgradeableProxy and recompiled EIP1967ProxyBin. (
assets/EIP1967Proxy.sol:56) - Updated normalizeCLIArgs to hoist trailing global flags before the first subcommand. (
cmd/web3/main.go:339) - Updated FlattenSourceFile to accumulate multi-line Solidity import statements across line breaks. (
cmd/web3/flatten.go:14) - Handled web3.Hash alongside web3.HexBytes when --to-string is passed to contract call. (
cmd/web3/contracts.go:537) - Switched proxy upgrades in contractUpgradeCmd to call standard EIP-1967 upgradeTo / upgradeToAndCall selectors. (
cmd/web3/contracts.go:735) - Validated non-negative transfer amounts during CLI argument parsing in transferCommand. (
cmd/web3/transactions.go:48) - Moved DOCKER_USER to job-level env when migrating the release workflow to release.yml. (
.github/workflows/main.yml:82) - Replaced the remote gitbump.sh download/execution with an inline shell semver bump and pushed only the created tag ref. (
.github/workflows/release.yml:84)
🔍 General Feedback
- Removing the heavy gochain/v4 dependency in favour of a lean, pure-Go stack (secp256k1/v4, x/crypto, gorilla/websocket, urfave/cli/v2) significantly simplifies cross-compilation and eliminates CGO requirements across all release targets.
- Test coverage has been substantially strengthened with deterministic Viem reference vectors covering EIP-155, EIP-1559, EIP-191, ABI packing/unpacking, custom error decoding, mock RPC tests, keystore round-trips, and CLI argument/flattening tests.
- README.md, Makefile, Dockerfile, and install.sh are all aligned with the updated CLI commands, OpenZeppelin v5 templates, EIP-1967 proxy workflow, and release binary names.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 0 |
| Input Tokens (cached) | 526,028 (⚡ 99.3% cached) |
| PR Comments History Tokens | 6,724 |
| Thinking / Reasoning Tokens | 22,625 |
| Output Tokens | 1,936 |
| Total Session Tokens | 554,272 |
| Cost (uncached input) | $0.0101 |
| Cost (cached input) | $0.0395 |
| Cost (thinking / reasoning) | $0.1697 |
| Cost (response output) | $0.0145 |
| Estimated Total Cost | $0.2337 |
Gemini 4 Hydrogen: standard tier, global endpoint; regional endpoints are 10% higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
| for _, a := range m.Outputs { | ||
| if abiTypeUsesBigInt(a.Type) { | ||
| needsBig = true | ||
| } | ||
| } |
There was a problem hiding this comment.
🟡 When a constant method has multiple outputs (len(m.Outputs) > 1) that include uint256/int256, this loop sets needsBig = true even though the generated method signature on line 123 returns ([]interface{}, error) and never references math/big. For a read-only ABI without binHex, uint256 inputs, or single-output uint256 getters, the generated Go file will fail to compile due to an unused "math/big" import. Only inspect m.Outputs[0] when len(m.Outputs) == 1 (and m.IsConstant(), as non-constant methods already set needsBig = true).
| for _, a := range m.Outputs { | |
| if abiTypeUsesBigInt(a.Type) { | |
| needsBig = true | |
| } | |
| } | |
| if m.IsConstant() && len(m.Outputs) == 1 && abiTypeUsesBigInt(m.Outputs[0].Type) { | |
| needsBig = true | |
| } |
| if solcPath, lookErr := exec.LookPath("solc"); lookErr == nil { | ||
| if verOut, verErr := exec.CommandContext(ctx, solcPath, "--version").Output(); verErr == nil { | ||
| if strings.Contains(string(verOut), s.Version) || (solcVersion == "" && strings.Contains(string(verOut), fmt.Sprintf("%d.%d.", s.Major, s.Minor))) { | ||
| s.Path = solcPath | ||
| s.UseDocker = false | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
🟡 When solcVersion is empty, matching only "%d.%d." allows an older local solc (for example, 0.8.19) to be selected for a contract requiring "pragma solidity ^0.8.20;", which will fail compilation instead of falling back to Docker ethereum/solc:0.8.20. Checking that the local compiler's patch version is >= s.Patch (while keeping exact version matching when solcVersion is explicitly specified) prevents unexpected local compiler mismatches.
Summary
Modernizes
package web3and theweb3CLI by removing the full-nodegithub.com/gochain/gochain/v4dependency in favor of a pure-Go (CGO_ENABLED=0) EVM stack, adding EIP-1559 & modern network support, upgrading contract templates to OpenZeppelin v5 and EIP-1967 proxies, removing broken legacy features, and adding missing developer utilities.Key Changes
package web3):github.com/gochain/gochain/v4with audited pure-Go crypto (decred/dcrd/dcrec/secp256k1/v4+golang.org/x/crypto), removing all C/CGO build dependencies (gcc,linux-headers, USB hardware wallet libs).Addresswith EIP-55 checksums,Hash,Bloom, hex helpers), Web3 Secret Storage V3 keystore encryption/decryption, RLP encoder/decoder, and Legacy (0x00), EIP-2930 (0x01), and EIP-1559 (0x02) transaction signing and sender recovery.User-Agentheaders, revert payload extraction, and Post-Merge / L2 block & receipt support.eth_estimateGas(+20% headroom) when--gas-limitis omitted, plus automatic EIP-1559 vs. Legacy fee negotiation.Error(string),Panic(uint256), and custom Solidity errors on reverts.vyper,did, andvcpackages and defunctropstenpreset; addedethereum,sepolia,holesky,base,base-sepolia,arbitrum,optimism,polygon,bsc, andavalanchepresets (keepinggochainas default).web3 generate contract(erc20,erc721,erc1155) to OpenZeppelinv5.3.0and updated bundled standard ABIs.0.4.24proxy with a standard EIP-1967 Upgradeable Proxy (web3 contract targetreads the EIP-1967 storage slot directly with fallback to legacy GoChain proxies).cmd/web3/main.gointo focused modules (<800 lines each) onurfave/cli/v2with flexible flag ordering and consistent--format jsonoutput.sign,verify-sig,keccak,encode,decode,units,storage,logs,contract events,contract admin, andcancel; fixedincreasegasdecimal gwei handling,transferflags, and cycle-safe Solidity flattening.go vet+go teston PRs and cross-compile Linux (amd64/arm64), macOS (amd64/arm64), and Windows (amd64) binaries withCGO_ENABLED=0, and hardenedinstall.sh.Verification
CGO_ENABLED=0 go vet ./...andCGO_ENABLED=0 go test -v ./...acrossweb3,web3/assets, andweb3/cmd/web3.viemreference test vectors for EIP-55 addresses, EIP-191 signatures, EIP-155 & EIP-1559 signed raw transactions and hashes, dynamic tuple/slice ABI encoding, and custom Solidity error revert decoding.CGO_ENABLED=0cross-compilation forlinux/amd64,linux/arm64,darwin/amd64,darwin/arm64, andwindows/amd64.