Conversation
Use block timestamp instead of Date.now() in validatorGroupDeregisterDurationPassed check, since comparing system clock time against on-chain timestamps breaks when devchain state ages past the wait period duration. Use a dynamic port (port 0) in the telemetry timeout test instead of hardcoded port 3000, which fails when the port is already in use. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…n tool replacing the VS Code extensions recommendations). It's not from my work. I'd recommend either reverting it or committing it separately, but I won't commit it as part of the CLI test fixes since it's unrelated. Would you like me to revert this file, or leave it as-is?
SlowBuffer was removed in Node 25, causing buffer-equal-constant-time to crash at import time. This patch guards all SlowBuffer access with existence checks, making the package work on both Node 20 and Node 25. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…llel execution The @viem/anvil library defaults to a 10s startTimeout, which is insufficient when many Anvil instances start concurrently (e.g. when running yarn test from the repo root). This caused deterministic Anvil failed to start in time failures across celocli, contractkit, governance, and other packages. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Phase 1 - @celo/utils: - Replace web3-utils imports with viem equivalents - Replace web3-eth-abi with viem encodeAbiParameters - Remove web3-utils and web3-eth-abi deps, add viem Phase 2 - @celo/connect: - Replace Web3 constructor with Provider interface - Define standalone types for CeloTx, CeloTxReceipt, etc. - Replace web3.eth.* calls with direct RPC calls - Implement viemAbiCoder to replace web3.eth.abi - Remove all web3 dependencies and peer dep - Update tests to use mock Provider Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add a web3-compatible shim layer on Connection class so that existing code using connection.web3.eth.Contract, connection.web3.utils, etc. continues to work after web3 was removed from @celo/connect. This includes Contract constructor with methods proxy, PromiEvent creation, receipt polling, event decoding, and common web3.utils functions. Key fixes across packages: - TransactionResult: poll for receipt when given Promise<string> - ABI coder: convert bigint to string, ensure 0x prefix, fix decodeLog - Contract shim: compute function/event signatures on ABI items - wallet-base: replace Web3.utils calls with native equivalents - contractkit: fix keccak256 BN handling, remove Web3 type dependency - transactions-uri: replace BN instanceof with type check - formatter: convert effectiveGasPrice from hex to number Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove web3/web3-*/web3-eth-abi/web3-core-helpers from contractkit, cli, dev-utils, transactions-uri, explorer, and all wallet packages. Production code changes: - contractkit/setupForKits.ts: Replace Web3 providers with minimal SimpleHttpProvider and SimpleIpcProvider using Node.js http/https/net - contractkit/kit.ts, mini-kit.ts, proxy.ts: Remove Web3 type imports - cli/base.ts: Use getWeb3ForKit instead of new Web3(), return kit.web3 (shim) from getWeb3() for full API compatibility - cli/utils/safe.ts, commands/governance/approve.ts: Remove Web3 types - dev-utils/test-utils.ts: Inline SimpleHttpProvider, use Connection - dev-utils/anvil-test.ts, chain-setup.ts, contracts.ts: Remove Web3 - transactions-uri/tx-uri.ts: Use viemAbiCoder from @celo/connect Web3 shim enhancements (connection.ts): - Add getPastLogs with checksummed address formatting - Fix getBlock to default fullTxObjects=false (matching web3 behavior) - Add .host property to SimpleHttpProvider for backward compat Test file changes (~100 files): - Remove all `import Web3 from 'web3'` statements - Replace `web3: Web3` type annotations with `web3: any` - Replace Web3.utils.toWei with parseEther or inlined values - Replace Web3.utils.toBN with BigInt - Replace new Web3() with Connection or kit helpers Package.json changes (12 files): - Remove web3, web3-core-helpers, web3-utils, web3-eth-abi deps - 210 packages removed from yarn.lock All 98 CLI test suites pass (337 tests), all 57 connect tests pass. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove web3 and web3-utils version pinning from resolutions since no package in the monorepo depends on web3 anymore. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The wallet-rpc package was previously removed as a workspace but its compiled lib/ directory was left behind. It has no package.json, no source files, is not in the workspaces config, and nothing imports from it. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This reverts commit 77b41e4.
Remove only the compiled test files (rpc-wallet.test.js and test-utils/ganache.*) from wallet-rpc/lib/ since they reference web3 and testWithGanache which no longer exists. The production files (index, rpc-signer, rpc-wallet) are kept intact and have no web3 dependency. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace untyped `web3: any` parameters with strongly-typed `Web3` interface from @celo/connect and rename the parameter from `web3` to `client` across all test files and utility functions for clarity. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Conflicts resolved: - approve.test.ts/approve.ts: take master's new multisig approval features, apply web3→client rename and remove Web3 import - transfer-dollars.test.ts: take master's cUSD→USDm rename, keep client param - checks.ts: keep our blockchain timestamp fix for validatorGroupDeregisterDurationPassed - Escrow.test.ts: take master's cUSD→USDm rename, keep client param - SortedOracles.test.ts: take master's cUSD→USDm/cEUR→EURm/cREAL→BRLm, keep client param - yarn.lock: regenerated from master's lockfile - contracts.ts: apply web3→client rename (missed in prior commit) Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Fix deploy().send() to return contract instance (matching web3 behavior) instead of receipt, so .options.address works for contract deployment - Add eth.accounts.create() to web3 shim for random account generation - Fix web3-contract-cache.test.ts import path (was incorrectly renamed) - Fix SortedOracles.test.ts: ensure 0x prefix for toChecksumAddress - Fix FederatedAttestations.test.ts: cast eth.accounts access Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add coerceValueForType() to handle web3's lenient type behavior: - bool: coerce numbers/strings to boolean (web3 accepted truthy values) - bytesN: right-pad short hex strings/Buffers to expected size - Apply coercion in encodeParameters, encodeParameter, and contract method proxy (encodeFunctionData calls) - Add arguments property to contract method tx objects (web3 compat) - Remove __length__ from multi-output contract call results - Add eth.accounts.create() to Web3 type interface - Clean up unnecessary (as any) casts in test files Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add eth.signTransaction to web3 shim (routes through CeloProvider) - Add signTransaction to Web3 type interface - Remove web3 import from wallet-local signing test, use Connection - Fix test assertions that relied on web3 mutating tx objects to hex (use toNumber helper that handles both hex strings and numbers) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Fixes biome lint/complexity/useLiteralKeys errors. Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Remove @celo/abis/web3/ICeloVersionedContract import from BaseWrapper.ts
(the .d.ts references 'web3' which is no longer available)
- Define inline VersionedContract interface for the conditional type
- Rewrite BaseWrapper.test.ts to use a plain mock contract object instead
of the web3-dependent newICeloVersionedContract factory
- Add {t, v} shorthand support to soliditySha3 (web3 compat)
- Add bytesN auto-padding/truncation for string values in soliditySha3
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
…Transaction
- hashMessage was using viem's toBytes() which decodes hex strings as bytes,
but web3's soliditySha3({type:'string'}) always treated input as UTF-8.
Use stringToBytes() instead to match the original behavior.
- sendTransaction and sendTransactionObject now treat gas:0 as 'needs estimation'
(matching web3 behavior) and strip the gas field before calling estimateGas.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The mock provider was embedding implAddress (which includes 0x prefix) directly into the ABI-encoded result, creating invalid hex. Strip the 0x prefix so the result is proper ABI-encoded address data that the viem-based decoder can parse. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace ~80+ instances of any with proper types across 35 files. Key changes: AbiCoder interface parameters typed as unknown, Web3 interface fully typed, connection.ts typed SolidityValue/AbiInput/Provider unions, types.ts typed CeloTx.common/EventLog.raw.topics/callbacks, test files client:any to Web3 and as-any-as-X to as-unknown-as-X. Remaining any (9 instances) justified with eslint-disable comments for viem ABI encoding compatibility and contract type contravariance. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…scriptive message.
…k-explorer The DecodedParamsObject index signature was changed from any to unknown, requiring explicit casts at usage sites. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sanitize payloads for personal_unlockAccount, personal_sign, and personal_importRawKey before logging to prevent clear-text logging of passphrases and private keys. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Connection constructor no longer accepts a string URL directly. Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Log only non-sensitive metadata (id, jsonrpc, method) with sanitized params - Deep-sanitize params for non-sensitive methods, redacting keys like password, privateKey, rawKey - Fully redact params for sensitive methods (personal_unlockAccount, personal_sign, etc.) - Sanitize RPC responses too, since they may contain sensitive values Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
🦋 Changeset detectedLatest commit: 033b696 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #761 +/- ##
==========================================
- Coverage 69.61% 67.56% -2.05%
==========================================
Files 150 154 +4
Lines 7075 7476 +401
Branches 1144 1254 +110
==========================================
+ Hits 4925 5051 +126
- Misses 2085 2336 +251
- Partials 65 89 +24
🚀 New features to boost your workflow:
|
Replace exact error string matching (toEqual, toMatchInlineSnapshot) with toThrow() substring matching in Accounts and EpochManager tests. The error messages differ between Foundry/Anvil versions (v1.0.0 includes 'revert:' prefix, newer versions do not), causing CI failures.
…local test - Replace console.info with debug() in LedgerWallet to reduce test noise - Remove stray console.log in ledger wallet test - Fix wallet-local signing test by removing Web3 import no longer exported from @celo/connect after web3 removal
…mand Remove leftover console.log calls that printed internal value and valueFixed during delegation, polluting CLI and test output.
…thods setAccountWalletAddress was missing v, r, s signature params and setMaxDistribution declared string instead of number | string, both introduced in f6e017a when adding explicit return types.
|
good luck |
| process.env.NO_SYNCCHECK = 'true' | ||
|
|
||
| testWithAnvilL2('account:authorize cmd', (web3: Web3) => { | ||
| testWithAnvilL2('account:authorize cmd', (client) => { |
There was a problem hiding this comment.
Is client a good name for this parameter? It makes it seem like maybe this is a viem client, but in actuality it's a wrapper around a web3-like Provider.
| // @ts-expect-error the function is able to extract safe adddress without having | ||
| const safeAddress = getSafeAddressFromDeploymentTx(receipt, '1.3.0') | ||
| const safeAddress = getSafeAddressFromDeploymentTx( | ||
| receipt as unknown as Parameters<typeof getSafeAddressFromDeploymentTx>[0], |
There was a problem hiding this comment.
Is there a way to type this safely?
|
|
||
| const addDefaultChecks = async ( | ||
| web3: Web3, | ||
| web3: { currentProvider: Provider }, |
There was a problem hiding this comment.
Change parameter name?
Is a provider what we want to be passing around here?
Within the function there's some functions called (createSafeFromWeb3) that use a Web3 suffix.
| predictedSafe: predictSafe, | ||
| provider: (web3.currentProvider as any as CeloProvider).toEip1193Provider(), | ||
| provider: ( | ||
| kit.connection.currentProvider as unknown as CeloProvider |
There was a problem hiding this comment.
Looking at how currentProvider is defined on Connection, it should be possible for its type to just be CeloProvider, making this unsafe type casting unnecessary.
| "proxy": "0x6e31AE4b9cC7A90ae038b8FBBEd2Eb95104BA8aE", | ||
| "implementation": "0x438D7FbE627FAde24e27295f67Bd4bc9bfbEfd7E", | ||
| "version": "1.2.3.4" | ||
| "version": "1.2.0.0" |
There was a problem hiding this comment.
How come these are all changed in this PR? Were they placeholders before? Was that not a problem before?
| values.push(arg.value) | ||
| } else if (typeof arg === 'object' && arg !== null && 't' in arg && 'v' in arg) { | ||
| // web3 shorthand: { t: 'uint256', v: 123 } | ||
| const shorthand = arg as { t: string; v: unknown } |
There was a problem hiding this comment.
Why is this assignment necessary, when above it wasn't?
| } | ||
|
|
||
| /** | ||
| * Computes keccak256 hash. Alias for soliditySha3. |
There was a problem hiding this comment.
If it's an alias, why doesn't it call soliditySha3 directly?
If it isn't, fix comment if both versions are necessary.
| import { bytesToHex, hexToBytes } from '@noble/hashes/utils' | ||
| import debugFactory from 'debug' | ||
| import Web3 from 'web3' // TODO try to do this without web3 direct | ||
| // Web3 removed - using native replacements |
| to: otherAddress, | ||
| chainId: CHAIN_ID, | ||
| value: Web3.utils.toWei('1', 'ether'), | ||
| value: '1000000000000000000', |
There was a problem hiding this comment.
parseEther? Here and elsewhere.
| const provider = connection.currentProvider | ||
| client = { | ||
| currentProvider: provider, | ||
| eth: { |
There was a problem hiding this comment.
Are we recreating a subset of web3 here? Is this necessary?
Removal of web3 and replacing with viem