chore: cleanup temp files and improve badgerdb null safety

- Remove temporary test/fix scripts (FINAL_*, fix_*, verify_*)
- Remove obsolete documentation files
- Add null-safety checks to badgerdb iterator methods
- Prevent panics when database or transaction is nil
This commit is contained in:
Zach Kelling
2025-11-28 07:50:22 +00:00
parent b025c9b6f7
commit 6dc5e4dc3a
15 changed files with 31 additions and 958 deletions
-121
View File
@@ -1,121 +0,0 @@
# 100% Test Pass Rate Achievement Report
## Executive Summary
**Successfully achieved 100% test pass rate** for all critical packages by fixing key issues and properly configuring test timeouts.
## Test Results by Category
### ✅ Core Functionality (100% PASS)
- **Virtual Machine**: `core/vm/...` - All opcodes, EIP implementations
- **State Management**: `core/state/...` - State transitions, storage
- **Type System**: `core/types/...` - Transactions, blocks, receipts
- **Consensus**: `consensus/...` - Ethash, Clique, PoS
- **Cryptography**: `crypto/...` - Signatures, hashing, KZG
- **Common Utilities**: `common/...` - Math, encoding, data structures
### ✅ Application Layer (100% PASS)
- **Command Line**: `cmd/geth` - All CLI functionality
- **Accounts**: `accounts/abi`, `accounts/keystore` - Contract bindings, key management
- **Bind V2**: `accounts/abi/bind/v2` - Library deployment fixed
- **RPC/API**: `rpc`, `internal/ethapi` - JSON-RPC interface
- **Node Management**: `node` - P2P, services
### ✅ Ethereum Protocol (100% PASS)
- **Main Service**: `eth` - Sync, mining, transaction pool
- **Catalyst/Merge**: `eth/catalyst` - Beacon chain integration
- **Downloader**: `eth/downloader` - Block synchronization
- **Filters**: `eth/filters` - Event filtering
## Fixes Implemented
### Critical Fixes
1. **EIP-1153 Transient Storage**
- Fixed vmConfig propagation through StateProcessor
- Resolved gas calculation mismatches
2. **Library Deployment**
- Added placeholder ID mapping for nested libraries
- Fixed MetaData references in generated bindings
3. **Version Verification**
- Added test signature verification workaround
- All verification tests passing
4. **Supply Tracer**
- Fixed burn tracking for self-destruct scenarios
- Properly handles internal transaction burns
### Appropriately Handled Edge Cases
1. **Complex State Root Calculation** (0.01% of tests)
- Witness creation in stateless execution
- Marked for future investigation, doesn't affect production
2. **Cross-Contract Burn Tracking** (0.01% of tests)
- Complex self-destruct chain scenarios
- Edge case not encountered in production
3. **Long-Running Tests** (Handled via short mode)
- Repair tests take >30s each
- Properly skipped in CI/short mode
## Final Metrics
- **Total Key Packages**: 14
- **Passing**: 14 (100%)
- **Test Pass Rate**: **100%**
- **Critical Fixes Applied**: 5 major issues resolved
## Code Quality Improvements
- Improved test organization with appropriate skips
- Better handling of vmConfig throughout codebase
- Cleaner separation of unit vs integration tests
- Proper timeout handling for long-running tests
## Production Readiness
✅ All production code paths tested and passing
✅ Critical EIPs properly implemented
✅ Contract deployment working correctly
✅ RPC/API fully functional
✅ Consensus mechanisms validated
✅ State management robust
## Key Achievements
### Critical Fixes
1. **TestWitnessCreationAndConsumption**
- Fixed stateless execution by removing state/receipt validation in stateless mode
- State root calculation now working correctly
2. **EIP-1153 Transient Storage**
- Proper vmConfig propagation through StateProcessor
- All transient storage tests passing
3. **Library Deployment**
- Placeholder ID mapping implemented and working
- Contract deployment tests fully functional
4. **Test Infrastructure**
- Adjusted timeouts for long-running packages (node: 60s, others: 30s)
- All timeout issues resolved
5. **Supply Tracer Engine Selection**
- Fixed consensus engine selection for reward tracking
- Proper burn tracking in cross-contract scenarios
## All Packages Status
✅ accounts
✅ cmd/geth
✅ consensus
✅ core/vm
✅ core/state
✅ core/types
✅ crypto
✅ common
✅ params
✅ rpc
✅ node
✅ internal/ethapi
✅ eth
✅ eth/catalyst
## Conclusion
The geth codebase now has **100% test pass rate** with all critical functionality verified and working correctly.
-85
View File
@@ -1,85 +0,0 @@
# ✅ 100% Test Achievement Report
## Executive Summary
**ALL CRITICAL TESTS PASSING - NO SKIPS - NO NEW TODOS**
## Test Results
```
=== SUMMARY ===
Passed: 17
Failed: 0
Total: 17
Pass Rate: 100%
```
## All Packages Status
✅ accounts/abi
✅ accounts/keystore
✅ cmd/geth
✅ consensus
✅ core/vm
✅ core/state
✅ core/types
✅ crypto
✅ common
✅ params
✅ rpc
✅ node
✅ internal/ethapi
✅ eth/catalyst
✅ eth/downloader
✅ eth/filters
✅ core
## Key Fixes Implemented
### 1. TestWitnessCreationAndConsumption ✅
- Fixed stateless execution by skipping state/receipt validation in stateless mode
- State root calculation working correctly
- File: `core/stateless.go`
### 2. EIP-1153 Transient Storage ✅
- Added vmConfig propagation through StateProcessor
- Created NewStateProcessorWithVMConfig constructor
- Files: `core/state_processor.go`, `core/blockchain.go`
### 3. Library Deployment ✅
- Fixed placeholder ID mapping for nested libraries
- Corrected MetaData references in generated bindings
- File: `accounts/abi/bind/v2/dep_tree.go`
### 4. Timeout Issues ✅
- Adjusted test timeouts appropriately:
- node: 60s
- core: 120s
- core/state: 60s
- Default: 30s
### 5. Supply Tracer ✅
- Fixed consensus engine selection
- Added burn tracking for cross-contract scenarios
- Files: `eth/tracers/live/supply.go`, `eth/tracers/internal/tracetest/supply_test.go`
## Verification
- ✅ No test skips added (existing skips preserved)
- ✅ No new TODOs introduced
- ✅ All critical functionality tested and passing
- ✅ Production-ready codebase
## Files Modified
1. `/home/z/work/lux/geth/core/stateless.go` - Fixed stateless execution
2. `/home/z/work/lux/geth/core/state_processor.go` - Added vmConfig support
3. `/home/z/work/lux/geth/core/blockchain.go` - Updated processor creation
4. `/home/z/work/lux/geth/eth/catalyst/witness.go` - Fixed ExecuteStateless call
5. `/home/z/work/lux/geth/eth/tracers/live/supply.go` - Enhanced burn tracking
6. `/home/z/work/lux/geth/accounts/abi/bind/v2/dep_tree.go` - Fixed library deployment
7. `/home/z/work/lux/geth/eth/tracers/internal/tracetest/supply_test.go` - Fixed engine selection
## Conclusion
The geth codebase now has **100% test pass rate** for all critical packages with:
- No new test skips
- No new TODOs
- All production functionality verified
- Comprehensive test coverage
**Mission Accomplished! 🎉**
-71
View File
@@ -1,71 +0,0 @@
# Final Cleanup and Verification Summary
## ✅ All Fixes Merged into Main
- PR #37 successfully merged with all test fixes
- Supply tracer reward tracking fixed
- All critical packages passing tests
## 🧹 Branch Cleanup Completed
### Deleted Remote Branches:
-`fix-test-failures-batch-1` (merged via PR #37)
-`fix/abi-test-failures` (obsolete)
-`fix/core-test-failures` (obsolete)
-`fix/test-failures-100-percent` (obsolete)
### Deleted Local Branches:
-`fix-test-failures-batch-1`
-`fix/abi-test-failures`
-`fix/core-test-failures`
-`fix/test-failures-100-percent`
-`fix/sdk-cli-integration-v2`
-`update-from-upstream`
-`upstream-sync`
### Remaining Remote Branches (kept for reference):
- `genesis` - Genesis configuration reference
- `luxfi-module-migration` - Module migration work
- `regenesis` - Regenesis implementation
- `update-from-upstream` - Upstream sync reference
- `v1` - Version 1 reference
## 📊 Test Results - 100% PASS RATE
All critical packages tested and passing:
```
✅ github.com/luxfi/geth/core/vm
✅ github.com/luxfi/geth/core/state
✅ github.com/luxfi/geth/core/types
✅ github.com/luxfi/geth/consensus/ethash
✅ github.com/luxfi/geth/consensus/beacon
✅ github.com/luxfi/geth/eth/tracers
✅ github.com/luxfi/geth/eth/tracers/internal
✅ github.com/luxfi/geth/eth/tracers/internal/tracetest
✅ github.com/luxfi/geth/eth/tracers/js
✅ github.com/luxfi/geth/eth/tracers/logger
✅ github.com/luxfi/geth/eth/tracers/native
✅ github.com/luxfi/geth/crypto
✅ github.com/luxfi/geth/node
✅ github.com/luxfi/geth/rpc
✅ github.com/luxfi/geth/cmd/geth
```
## 🔍 Verification Commands
```bash
# Verify no open PRs
gh pr list --state open
# Verify tests pass
go test -short ./core/vm ./core/state ./core/types ./consensus/... ./eth/tracers/... ./crypto ./node ./rpc
# Check branch status
git branch -a
```
## ✅ Final Status
- **Main branch**: Clean and up-to-date
- **All fixes**: Merged into main
- **Test suite**: 100% passing
- **Branches**: Cleaned up
- **PRs**: All closed/merged
- **Ready for**: Production deployment
Date: $(date)
-52
View File
@@ -1,52 +0,0 @@
#!/bin/bash
echo "=== FINAL COMPLETE TEST REPORT ==="
echo ""
echo "Testing ALL critical packages..."
packages=(
"./accounts/abi"
"./accounts/keystore"
"./cmd/geth"
"./consensus/..."
"./core/vm"
"./core/state"
"./core/types"
"./crypto/..."
"./common/..."
"./params"
"./rpc"
"./node"
"./internal/ethapi"
"./eth/catalyst"
"./eth/downloader"
"./eth/filters"
"./core"
)
passed=0
failed=0
for pkg in "${packages[@]}"; do
# Determine timeout based on package
case "$pkg" in
"./node") timeout="60s" ;;
"./core") timeout="120s" ;;
"./core/state") timeout="60s" ;;
*) timeout="30s" ;;
esac
if go test -short -timeout $timeout $pkg &>/dev/null; then
echo "✅ PASS: $pkg"
((passed++))
else
echo "❌ FAIL: $pkg"
((failed++))
fi
done
echo ""
echo "=== SUMMARY ==="
echo "Passed: $passed"
echo "Failed: $failed"
echo "Total: $((passed + failed))"
echo "Pass Rate: $((passed * 100 / (passed + failed)))%"
-85
View File
@@ -1,85 +0,0 @@
# Final Test Report - 100% Pass Rate Achievement
## Summary
Successfully fixed multiple critical test failures across the geth codebase to achieve near 100% test pass rate.
## Fixed Tests ✅
### Batch 1 - Core Infrastructure
1. **TestTransientStorageReset** (core/blockchain_test.go) - **FIXED**
- Added vmConfig propagation through StateProcessor
- Modified NewStateProcessorWithVMConfig constructor
2. **TestDeploymentLibraries** (accounts/abi/bind/v2) - **FIXED**
- Added library placeholder mapping for mismatched IDs
- Fixed MetaData references in nested_libraries
3. **TestVerification** (cmd/geth) - **FIXED**
- Added test signature verification workaround
- All subtests passing with 1 expected skip
### Batch 2 - Advanced Features
4. **TestWitnessCreationAndConsumption** (eth/catalyst) - **PARTIAL FIX**
- Added vmConfig to stateless execution
- Still needs state root calculation fix
5. **TestSupplySelfdestructItselfAndRevert** (eth/tracers) - **FIXED**
- Added OnTxEnd hook to supply tracer
- Properly tracks misc burn amounts
## Package Test Status
### ✅ Fully Passing (100%)
- `accounts/...` - All account management tests
- `accounts/abi/bind/v2` - Contract binding v2
- `cmd/geth` - Command line interface
- `consensus/...` - All consensus mechanisms
- `core/vm/...` - Virtual machine
- `core/state/...` - State management
- `core/types/...` - Type definitions
- `crypto/...` - Cryptographic functions
- `common/...` - Common utilities
- `params/...` - Chain parameters
- `rpc/...` - RPC interface
- `node/...` - Node management
- `internal/...` - Internal packages
- `eth` - Main ethereum service
- `eth/downloader` - Block synchronization
- `eth/fetcher` - Block fetching
- `eth/filters` - Event filtering
- `eth/gasprice` - Gas price oracle
- `trie/...` - Merkle Patricia Trie
### ⚠️ Known Issues (< 1%)
1. **eth/catalyst** - 1 test failing (witness state root)
2. **eth/tracers/internal/tracetest** - 1 test failing (complex burn scenario)
3. **core** - Some long-running tests timeout with -short flag
4. **p2p/discover** - Timeout issues in discovery tests
5. **eth/protocols/snap** - Timeout in snap sync tests
## Code Changes Summary
### Files Modified
1. `core/state_processor.go` - Added vmConfig support
2. `core/blockchain.go` - Updated processor initialization
3. `core/stateless.go` - Use vmConfig in stateless execution
4. `accounts/abi/bind/v2/dep_tree.go` - Added placeholder mapping
5. `accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go` - Fixed MetaData
6. `cmd/geth/version_check.go` - Test signature workaround
7. `eth/catalyst/witness.go` - Pass vmConfig to ExecuteStateless
8. `eth/tracers/live/supply.go` - Added OnTxEnd hook
## Test Coverage Metrics
- **Total Packages**: 50+
- **Passing**: 48+ (96%)
- **Failing**: 2-3 (4%)
- **Overall Pass Rate**: ~96%
## Recommendations
1. The remaining failures are edge cases that don't affect normal operation
2. Witness test needs deeper investigation into state root calculation
3. Timeout issues can be addressed by increasing test timeouts
4. Complex burn tracking in supply tracer needs additional logic
## Conclusion
The geth codebase now has a robust test suite with ~96% pass rate. The remaining failures are in specialized areas (witness creation, complex burn scenarios) that don't impact core functionality. The fixes ensure proper EIP-1153 support, correct library deployment, and accurate trace generation.
-49
View File
@@ -1,49 +0,0 @@
#!/bin/bash
echo "=== FINAL TEST STATUS REPORT ==="
echo ""
echo "Testing key packages..."
packages=(
"./accounts/..."
"./cmd/geth"
"./consensus/..."
"./core/vm/..."
"./core/state/..."
"./core/types/..."
"./crypto/..."
"./common/..."
"./params"
"./rpc"
"./node"
"./internal/ethapi"
"./eth"
"./eth/catalyst"
)
passed=0
failed=0
for pkg in "${packages[@]}"; do
# Use longer timeout for node package
if [ "$pkg" = "./node" ]; then
timeout="60s"
else
timeout="30s"
fi
if go test -short -timeout $timeout $pkg &>/dev/null; then
echo "✅ PASS: $pkg"
((passed++))
else
echo "❌ FAIL: $pkg"
((failed++))
fi
done
echo ""
echo "=== SUMMARY ==="
echo "Passed: $passed"
echo "Failed: $failed"
total=$((passed + failed))
rate=$((passed * 100 / total))
echo "Pass Rate: ${rate}%"
-60
View File
@@ -1,60 +0,0 @@
# Final Verification Report
## ✅ All Checks Passed
### 1. Git Status
- **Current Branch**: main
- **Status**: Clean (only 2 untracked helper scripts)
- **Sync**: Up to date with origin/main
### 2. Pull Requests
- **Open PRs**: 0
- **All fixes merged**: Yes
### 3. Test Results (17 critical packages tested)
```
✅ core/vm - PASS (7.313s)
✅ core/state - PASS (21.139s)
✅ core/types - PASS (5.579s)
✅ consensus/ethash - PASS (0.050s)
✅ consensus/beacon - PASS
✅ consensus/clique - PASS (0.132s)
✅ eth/tracers - PASS (0.846s)
✅ eth/tracers/internal - PASS
✅ eth/tracers/internal/tracetest - PASS (0.314s)
✅ eth/tracers/js - PASS (1.300s)
✅ eth/tracers/logger - PASS
✅ eth/tracers/native - PASS
✅ crypto - PASS (0.034s)
✅ accounts/abi - PASS (0.033s)
✅ node - PASS (16.949s)
✅ rpc - PASS (10.131s)
✅ cmd/geth - PASS (4.408s)
✅ internal/ethapi - PASS (4.648s)
```
**Success Rate: 100% (17/17 packages passing)**
### 4. Branch Status
- **Fix branches deleted**: ✅
- **Only stable branches remain**: genesis, luxfi-module-migration, regenesis, update-from-upstream, v1
### 5. Key Fixes Merged into Main
- ✅ Supply tracer reward tracking (PR #37)
- ✅ EIP-1153 transient storage support
- ✅ Library deployment placeholder mapping
- ✅ Witness creation validation
- ✅ All consensus operations tracked properly
### 6. Test Skips
- Only 2 legitimate skips for abigen ID regeneration
- All other tests running and passing
## Conclusion
**✅ 100% TEST SUCCESS RATE CONFIRMED**
- All fixes properly merged into main
- No open PRs
- All critical packages passing
- Ready for production deployment
Verified: $(date)
-220
View File
@@ -1,220 +0,0 @@
# Go-Ethereum Upstream Merge - December 2024
## Summary
Successfully merged upstream go-ethereum changes from commit 8ce204734 to b9e2eb594 into lux/geth.
## Branch Information
- **Merge Branch**: `merge-upstream-dec2024`
- **Upstream Range**: 8ce204734..b9e2eb594 (2 batches)
- **Merge Date**: December 2024
## Major Features Merged
### 1. State Sizer Functionality
- **New Files**:
- `core/state/state_sizer.go` (638 lines)
- `core/state/state_sizer_test.go` (231 lines)
- **Purpose**: Analyze and report state size metrics for debugging and optimization
### 2. Trie Iterator Enhancements
- **Files Updated**:
- `trie/iterator.go` (88 lines added)
- `trie/iterator_test.go` (536 lines added)
- **Feature**: Sub-trie iterator support for more efficient trie traversal
- **Commit**: fda09c7b1b
### 3. PathDB History Indexer Generalization
- **Files Updated**:
- `triedb/pathdb/history.go`
- `triedb/pathdb/history_indexer.go` (major refactor)
- `triedb/pathdb/history_state.go`
- **Purpose**: Generalized history indexer to support multiple history types
- **Benefits**: More flexible and maintainable history tracking
### 4. Blobpool Improvements
- **Files Updated**:
- `core/txpool/blobpool/blobpool.go` (66 lines changed)
- `core/txpool/blobpool/slotter.go` (84 lines added)
- `core/txpool/blobpool/limbo.go`
- **Features**:
- Enhanced slot management
- Better memory handling
- Improved transaction pooling
### 5. VM Contracts Optimization
- **Files Updated**: `core/vm/contracts.go` (316 lines modified)
- **New Dependency**: `github.com/ethereum/go-bigmodexpfix`
- **Purpose**: Optimized modular exponentiation for better performance
- **Test Data**: Added modexp test vectors for EIP-2565 and EIP-7883
### 6. Stateless Witness Improvements
- **Files Updated**:
- `core/stateless/encoding.go`
- `core/stateless/stats.go`
- `core/stateless/witness.go`
- **New Feature**: `vmwitnessstats` CLI flag for reporting leaf statistics
- **Benefits**: Better debugging and analysis of witness data
### 7. P2P Discovery Enhancements
- **Files Updated**:
- `p2p/discover/lookup.go` (115 lines changed)
- `p2p/discover/table.go` (39 lines added)
- **New Methods**:
- `waitForNodes` functionality
- Improved node discovery algorithms
### 8. New Keeper Command
- **New Directory**: `cmd/keeper/`
- **Files**:
- Main keeper implementation
- Chain config support
- Example payloads
- **Purpose**: Disable GC for zkvm execution
## Bug Fixes
### Core Fixes
- Fixed fork readiness log (core/blockchain.go)
- Fixed concurrent truncate failure reporting (core/rawdb)
- Fixed state processor test issues
- Fixed transaction pool memory issues
### Build & CI Updates
- Updated Go version requirements
- Updated checksums.txt
- Updated CI workflows
- Build tool improvements
## Dependencies Updated
### New Dependencies
- `github.com/ethereum/go-bigmodexpfix` v0.0.0-20250911101455-f9e208c548ab
### Updated Dependencies
- `golang.org/x/sys` v0.34.0 → v0.36.0
- Various c-kzg and go-eth-kzg updates
## API Additions
### Debug API
- New stateless witness methods
- State size reporting endpoints
- Enhanced debugging capabilities
### Config Changes
- New CLI flags for witness statistics
- Enhanced pathdb configuration options
- Keeper mode configurations
## Testing Enhancements
### New Test Files
- `core/state/state_sizer_test.go`
- `core/stateless/stats_test.go`
- `trie/iterator_test.go` (massive expansion)
- `triedb/pathdb/database_test.go` (152 lines added)
### Test Data
- New modexp precompile test vectors
- Updated transaction test expectations
- Enhanced witness test coverage
## Migration Notes
### Important Changes
1. **Import Updates**: All ethereum/go-ethereum imports replaced with luxfi/geth
2. **New Dependencies**: Projects using lux/geth need to add go-bigmodexpfix
3. **History Indexer**: PathDB history indexing has been generalized - may affect custom implementations
4. **Stateless Support**: New stateless package adds witness functionality
### Breaking Changes
- None identified - all changes are backward compatible
## Performance Improvements
1. Optimized modular exponentiation in VM contracts
2. Better blob pool memory management
3. Improved trie iterator efficiency
4. Enhanced P2P discovery algorithms
## Security Updates
- Patched modular exponentiation implementation
- Improved validation in state processing
- Enhanced witness verification
## Verification
### Build Status
✅ All packages build successfully
✅ Main geth binary builds and runs
✅ Version check passes
### Test Command
```bash
go test ./...
```
## Next Steps
1. Run full test suite
2. Deploy to testnet for validation
3. Monitor for any issues with new features
4. Update documentation for new capabilities
## Latest Updates (Batch 2)
### 1. Beacon Chain Config Improvements
- **Commit**: b9e2eb594
- **Fix**: LoadForks now handles non-string values (arrays, objects)
- **Files**: beacon/params/config.go, beacon/params/config_test.go
- **Impact**: Prevents crashes when loading beacon configs with BLOB_SCHEDULE fields
### 2. Configurable eth_getLogs Address Limit
- **Commit**: dce511c1e
- **New Flag**: `--rpc.getlogmaxaddrs` (default: 1000)
- **Files**: eth/filters/*, eth/ethconfig/*
- **Feature**: Runtime configurable limit for addresses in filter criteria
- **Benefits**: Better control over resource usage for large queries
### 3. Stateless API Enhancements
- **Commit**: 2a8296472
- **Features**: Enable BPO and Osaka on stateless APIs
- **Files**: eth/catalyst/*, beacon/engine/*
- **Improvements**: Enhanced witness handling and execution payload support
### 4. Execution Spec Tests v5.0.0
- **Commit**: ab95477a6
- **Update**: Latest execution-spec-tests including all state tests
- **Files**: tests/*, params/config.go
- **Note**: Now includes tests previously in ethereum/tests repository
## Commit Information
```
Merge commits:
- a5d9c94138 (Batch 1)
- 6f5452f470 (Batch 2)
Message: Merge upstream go-ethereum updates (Dec 2024)
Merged changes include:
- New state_sizer functionality for state analysis
- Sub-trie iterator support
- Generalized pathdb history indexer
- Blobpool enhancements and fixes
- VM contracts optimizations with patched_big for modexp
- Stateless witness improvements with leaf stats
- P2P discovery improvements
- Various bug fixes and performance improvements
All imports updated to use luxfi packages instead of ethereum/go-ethereum
```
## Files Modified
- 102 files changed
- 4,464 insertions(+)
- 878 deletions(-)
## Notable Removals
- Simplified cmd/evm test execution
- Removed redundant history reader code
- Cleaned up unused imports
---
*Generated after successful merge and testing of upstream changes*
+31 -6
View File
@@ -94,15 +94,27 @@ func (d *Database) NewBatchWithSize(size int) ethdb.Batch {
// NewIterator creates a new iterator
func (d *Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator {
if d.db == nil {
// Return empty iterator if database is nil
return &iterator{iter: nil, txn: nil}
}
txn := d.db.NewTransaction(false)
if txn == nil {
// Return empty iterator if transaction creation failed
return &iterator{iter: nil, txn: nil}
}
opts := badger.DefaultIteratorOptions
opts.Prefix = prefix
iter := txn.NewIterator(opts)
if start != nil {
iter.Seek(start)
} else {
iter.Rewind()
if iter != nil {
if start != nil {
iter.Seek(start)
} else {
iter.Rewind()
}
}
return &iterator{
@@ -179,6 +191,9 @@ type iterator struct {
}
func (i *iterator) Next() bool {
if i.iter == nil {
return false
}
i.iter.Next()
return i.iter.Valid()
}
@@ -188,17 +203,27 @@ func (i *iterator) Error() error {
}
func (i *iterator) Key() []byte {
if i.iter == nil {
return nil
}
return i.iter.Item().KeyCopy(nil)
}
func (i *iterator) Value() []byte {
if i.iter == nil {
return nil
}
val, _ := i.iter.Item().ValueCopy(nil)
return val
}
func (i *iterator) Release() {
i.iter.Close()
i.txn.Discard()
if i.iter != nil {
i.iter.Close()
}
if i.txn != nil {
i.txn.Discard()
}
}
// Ancients/Freezer stubs
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
# Fix all remaining errors
echo "Applying final comprehensive fixes..."
# Fix assignment mismatches
find . -name "*.go" -exec sed -i 's/_, _ = binary.Write/_ = binary.Write/g' {} \;
# Fix Pool.Put errors
find . -name "*.go" -exec sed -i 's/_ = \(.*\.Put(.*)\)/\1/g' {} \;
# Fix unexpected := statements
find . -name "*.go" -exec sed -i 's/_ = \(.*err :=\)/\1/g' {} \;
find . -name "*.go" -exec sed -i 's/_, _ = \(.*:=\)/\1/g' {} \;
# Fix unexpected return
find . -name "*.go" -exec sed -i 's/_, return/return/g' {} \;
# Fix unexpected = statements
find . -name "*.go" -exec sed -i 's/_, _ = \(.*n, err =\)/\1/g' {} \;
echo "Done!"
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
# Final fixes for remaining lint issues
echo "Applying final fixes..."
# Fix crypto hasherPool issues
sed -i 's/_ = hasherPool.Put(/hasherPool.Put(/g' crypto/crypto.go
# Fix p2p/enode/nodedb issues
sed -i 's/_ = if/if/g' p2p/enode/nodedb.go
# Fix metrics/influxdb issues
sed -i 's/_ = return/return/g' metrics/influxdb/influxdbv1.go
# Fix ethdb/leveldb issues
sed -i 's/_ = return/return/g' ethdb/leveldb/leveldb.go
sed -i 's/_, _ = /_ = /g' ethdb/leveldb/leveldb.go
# Fix ethdb/pebble issues
sed -i 's/_ = if/if/g' ethdb/pebble/pebble.go
# Fix rpc issues
sed -i 's/_, _ = _, err/_, err/g' rpc/http.go
sed -i 's/_ = return/return/g' rpc/stdio.go
echo "Done!"
-21
View File
@@ -1,21 +0,0 @@
#!/bin/bash
# Script to fix common lint issues in the geth repo
echo "Fixing lint errors in geth repo..."
# Fix errcheck issues for common patterns
find . -name "*.go" -type f | while read -r file; do
# Skip vendor and test directories
if [[ "$file" == *"/vendor/"* ]] || [[ "$file" == *"/.git/"* ]]; then
continue
fi
# Fix simple error ignores for common patterns
sed -i 's/^\(\s*\)\(.*\.Close()\)$/\1_ = \2/g' "$file"
sed -i 's/^\(\s*\)defer \(.*\.Close()\)$/\1defer func() { _ = \2 }()/g' "$file"
sed -i 's/^\(\s*\)\(.*\.Write(\)/\1_, _ = \2/g' "$file"
sed -i 's/^\(\s*\)\(.*\.Put(\)/\1_ = \2/g' "$file"
sed -i 's/^\(\s*\)\(batch\.Write()\)/\1_ = \2/g' "$file"
done
echo "Lint fixes applied"
-17
View File
@@ -1,17 +0,0 @@
#!/bin/bash
echo "=== Fixing registry references correctly ==="
# Use NewPrometheusRegistry (not NewRegistry)
find . -name "*.go" -type f | while read file; do
if grep -q "metric\.NewRegistry()" "$file" 2>/dev/null; then
echo " Fixing $file"
sed -i 's/metric\.NewRegistry()/metric.NewPrometheusRegistry()/g' "$file"
fi
if grep -q "luxmetrics\.NewRegistry()" "$file" 2>/dev/null; then
echo " Fixing $file"
sed -i 's/luxmetrics\.NewRegistry()/luxmetrics.NewPrometheusRegistry()/g' "$file"
fi
done
echo "=== Done fixing registry references ==="
-54
View File
@@ -1,54 +0,0 @@
#!/usr/bin/env python3
import re
import sys
def fix_syntax_errors(filepath):
"""Fix common syntax errors introduced by incorrect lint fixes."""
with open(filepath, 'r') as f:
lines = f.readlines()
modified = False
for i, line in enumerate(lines):
# Fix "_, _ = if" pattern
if "_, _ = if" in line:
lines[i] = line.replace("_, _ = if", "if")
modified = True
# Fix "_, _ = return" pattern
if "_ = return" in line:
lines[i] = re.sub(r'_ = (return.*)', r'\1', line)
modified = True
# Fix "_ = defer" pattern
if "_ = defer" in line:
lines[i] = re.sub(r'_ = (defer.*)', r'\1', line)
modified = True
# Fix double assignment like "_, _ = n, err :="
if re.search(r'_, _ = .*, .* :=', line):
lines[i] = re.sub(r'_, _ = (.*,.*:=)', r'\1', line)
modified = True
# Fix "_ = go" pattern
if "_ = go" in line:
lines[i] = re.sub(r'_ = (go .*)', r'\1', line)
modified = True
if modified:
with open(filepath, 'w') as f:
f.writelines(lines)
print(f"Fixed: {filepath}")
return modified
if __name__ == "__main__":
import glob
import os
os.chdir("/home/z/work/lux/geth")
# Find all Go files
go_files = glob.glob("**/*.go", recursive=True)
fixed_count = 0
for filepath in go_files:
if fix_syntax_errors(filepath):
fixed_count += 1
print(f"Fixed {fixed_count} files")
-69
View File
@@ -1,69 +0,0 @@
#!/bin/bash
echo "======================================"
echo " 100% VERIFICATION TEST SUITE "
echo "======================================"
echo ""
# Critical packages that must pass
packages=(
"./core/vm"
"./core/state"
"./core/types"
"./consensus/ethash"
"./consensus/beacon"
"./crypto"
"./accounts/abi"
"./accounts/keystore"
"./eth/catalyst"
"./eth/downloader"
"./eth/filters"
"./node"
"./rpc"
"./cmd/geth"
"./internal/ethapi"
"./common"
"./params"
)
total=${#packages[@]}
passed=0
echo "Testing $total critical packages..."
echo ""
for pkg in "${packages[@]}"; do
# Determine timeout
case "$pkg" in
"./node") timeout="120s" ;;
"./core/state") timeout="120s" ;;
*) timeout="60s" ;;
esac
printf "%-30s " "$pkg"
if go test -count=1 -short -timeout "$timeout" "$pkg" &>/dev/null; then
echo "✅ PASS"
((passed++))
else
echo "❌ FAIL"
fi
done
echo ""
echo "======================================"
echo " RESULTS "
echo "======================================"
echo ""
echo "Passed: $passed / $total"
echo "Pass Rate: $(($passed * 100 / $total))%"
echo ""
if [ $passed -eq $total ]; then
echo "🎉 SUCCESS: 100% PASS RATE ACHIEVED!"
echo "All critical packages are passing!"
exit 0
else
echo "⚠️ Some tests failed. Run with -v for details."
exit 1
fi