Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
dff6d51
Enable PlatformIO git URL consumption with v1.45
cursoragent Nov 15, 2026
666f30f
Add comprehensive PlatformIO Unity test suite
cursoragent Nov 15, 2026
fcc306d
Add WiFiConnection and Web3Log from GarageDoor copy
cursoragent Nov 15, 2026
e6aaadc
Fix crypto test vectors and add comprehensive network tests
cursoragent Nov 15, 2026
8a2e9f0
Complete example WiFiConnection conversion and add network transactio…
cursoragent Nov 15, 2026
9cfa3cf
Add documentation for Wallet Bridge testing future work
cursoragent Nov 15, 2026
056a91b
Fix test failures in test_util and test_transaction with better diagn…
cursoragent Nov 15, 2026
308691c
Add comprehensive root cause analysis documentation for test fixes
cursoragent Nov 15, 2026
b3fe0e8
Fix uint256_t constructor bug and implement Rob's test configuration …
cursoragent Nov 15, 2026
3f1bcab
Add comprehensive hardware test fixes documentation
cursoragent Nov 15, 2026
99719ee
Update tests README with Rob's configuration changes
cursoragent Nov 15, 2026
cdad9a8
Fix compilation errors in network tests (web3 pointer/object, method …
cursoragent Nov 15, 2026
3abe611
Fix remaining web3-> references in test_network_tx
cursoragent Nov 15, 2026
76bfdfa
Fix all remaining web3-> references (use sed)
cursoragent Nov 15, 2026
7781332
Add missing Web3 declaration in test_send_eth_transaction
cursoragent Nov 15, 2026
63e0d41
Fix Crypto::Sign return value check
cursoragent Nov 15, 2026
cf95d58
Fix Crypto::Sign to return false when no private key is set
cursoragent Nov 15, 2026
2a13fa1
Fix network test Wi-Fi credentials and add connection timeout
cursoragent Nov 15, 2026
030dc6e
Fix network test RPC errors and stack overflow
cursoragent Nov 15, 2026
bc1d421
Add build-time RPC node updater
cursoragent Nov 15, 2026
9dfa492
Fix TLS certificate mismatch and flash size issues
cursoragent Nov 15, 2026
e55014c
Fix compilation error: replace 'undefined' with NULL in nodes.h
cursoragent Nov 15, 2026
a9d3162
Remove node_modules, fix generator, implement chain removal
cursoragent Nov 15, 2026
cd8aa76
Implement USING_INFURA opt-in system
cursoragent Nov 15, 2026
373885f
Fix USING_INFURA test workflow: remove invalid extra arguments
cursoragent Nov 15, 2026
10a6747
Add 6 new chains: Base, Linea, Sei, and Monad with explicit chains.js…
cursoragent Nov 15, 2026
bd6b13e
Fix INFURA_API_KEY escaping in CI workflow
cursoragent Nov 15, 2026
595f2c6
Fix INFURA_API_KEY string literal escaping in CI
cursoragent Nov 15, 2026
4c31821
Simplify USING_INFURA CI test - remove API key
cursoragent Nov 15, 2026
8c6f50f
Remove public node certificates, keep only Infura root CA (opt-in)
cursoragent Nov 16, 2026
4ce2cb6
Fix USING_INFURA compilation: add missing nodes.h include
cursoragent Nov 16, 2026
e36b370
Fix critical HTTP response handling bug on ESP32
cursoragent Nov 16, 2026
02ce247
Exclude test_http_parser from ESP32 test suite
cursoragent Nov 16, 2026
97e39d5
Add test_http_parser to test_ignore for network tests environment
cursoragent Nov 16, 2026
d0eed6a
Fix critical unsigned underflow bug in ABI string decoding
cursoragent Nov 16, 2026
8e6de3c
Fix hardware test issues from run 14
cursoragent Nov 16, 2026
7b7dd38
Add ERC721_NFT_TEST_ADDRESS config and rename ERC721 test
cursoragent Nov 16, 2026
0cfc28c
Fix multiple definition linker errors in headers
cursoragent Nov 16, 2026
9db2497
Fix getNode NULL return causing UB in std::string construction
cursoragent Nov 16, 2026
092bed4
Add native test CI job for test_http_parser
cursoragent Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .github/workflows/platformio-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: PlatformIO CI

on:
pull_request:
branches: [ master, Development ]
push:
branches: [ master, Development ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
include:
# Test consumer project - verifies library can be consumed from git
- project: test-consumer
name: "Test Consumer (Git Dependency)"
type: build

# Example projects - verify examples still build
- project: examples/Wallet Bridge 1
name: "Example: Wallet Bridge 1"
type: build

- project: examples/Wallet Bridge 2
name: "Example: Wallet Bridge 2"
type: build

# Test suite - verify tests compile (offline tests)
- project: tests
name: "Test Suite (Offline)"
type: test
env: esp32dev

# Test suite - verify network tests compile (not run, just build)
- project: tests
name: "Test Suite (Network - compile only)"
type: test
env: esp32dev_network

# Test with Infura opt-in flag (verifies USING_INFURA compiles)
- project: tests
name: "Test Suite (Offline - USING_INFURA flag)"
type: test
env: esp32dev
extra_flags: '-DUSING_INFURA'

# Native tests - actually run on CI (not just compile)
- project: tests/test_http_parser
name: "Native Tests (HTTP Parser)"
type: native_test

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-platformio-

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio

- name: Build ${{ matrix.name }}
if: matrix.type == 'build'
run: |
cd "${{ matrix.project }}"
# For examples, install Web3E from local repository instead of registry
if [[ "${{ matrix.project }}" == examples/* ]]; then
pio pkg install --library "file://$GITHUB_WORKSPACE"
fi
pio run --environment esp32dev

- name: Compile Tests ${{ matrix.name }}
if: matrix.type == 'test'
run: |
cd "${{ matrix.project }}"
# Compile tests without uploading or running them
# Apply extra build flags if specified
if [ -n "${{ matrix.extra_flags }}" ]; then
export PLATFORMIO_BUILD_FLAGS="${{ matrix.extra_flags }}"
fi
pio test --environment ${{ matrix.env }} --without-uploading --without-testing

- name: Run Native Tests ${{ matrix.name }}
if: matrix.type == 'native_test'
run: |
cd "${{ matrix.project }}"
# Run native tests (they execute on the CI runner)
pio test -e native

- name: Show build artifacts size
if: success() && matrix.type == 'build'
run: |
cd "${{ matrix.project }}"
if [ -f .pio/build/esp32dev/firmware.bin ]; then
ls -lh .pio/build/esp32dev/firmware.bin
fi
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# Visual Studio Code project files
.vscode/
.vscode/

# PlatformIO build artifacts
.pio/
.pioenvs/
.piolibdeps/

# Test credentials (never commit!)
tests/test_config.ini

# Node.js
node_modules/
package-lock.json

# Other build artifacts
*.o
*.a
*.bin
*.elf
124 changes: 118 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
## [![PlatformIO Registry](https://badges.registry.platformio.org/packages/alphawallet/library/Web3E.svg)](https://registry.platformio.org/libraries/alphawallet/Web3E)

What's New:
v1.45:
- Fix case-sensitive include issues for Linux/PlatformIO builds.
- Fix `byte` type ambiguity with modern C++ compilers.
- Add CI testing to verify library packaging.
- Enable consumption via git URL with version tags.

v1.44:
- Fix type conversion ambiguity.
- Add required method in TcpBridge.
Expand Down Expand Up @@ -80,28 +86,116 @@ It is possible that as Ethereum runs natively on embedded devices a new revoluti

## Installation

- It is recommended to use [Platformio](https://platformio.org/install/) for best experience. Web3E is now part of the Platformio libraries so no need to clone the repo.
- Using Web3E is a one step process:
1. Create a new project in Platformio and edit the platformio.ini so it looks similar to:
- It is recommended to use [Platformio](https://platformio.org/install/) for best experience.
- Web3E can be consumed in three ways:

```
### Option 1: PlatformIO Registry (Stable Releases)

Web3E is part of the PlatformIO registry. Simply reference it by name:

```ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

; Serial Monitor options
monitor_speed = 115200

lib_ldf_mode = deep
lib_deps =
# Using a library name
Web3E
```

### Option 2: Git URL with Version Tag (Recommended for Reproducible Builds)

Pin to a specific version for reproducible builds:

```ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

monitor_speed = 115200

lib_ldf_mode = deep
lib_deps =
https://github.com/AlphaWallet/Web3E.git#v1.45
```

### Option 3: Git URL with Commit Hash (For Testing or Specific Fixes)

Pin to a specific commit:

```ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

monitor_speed = 115200

lib_ldf_mode = deep
lib_deps =
https://github.com/AlphaWallet/Web3E.git#abc1234
```

Replace `abc1234` with the full commit hash you want to use.

**Please note: you may need to use 'lib_ldf_mode = deep' to locate some ESP32 libraries like 'EEPROM.h'**
**also: if you use many other libraries in your application you may need to add 'board_build.partitions = no_ota.csv' to fit your firmware**

### ESP32 Requirements

Web3E uses TLS/SSL for secure RPC connections, which requires adequate stack space and flash storage.

**Stack Size:** Increase the loop stack size to 16KB in your `platformio.ini`:

```ini
build_flags =
-DARDUINO_LOOP_STACK_SIZE=16384
```

This prevents `Guru Meditation` errors with `Stack canary watchpoint triggered` messages during TLS handshakes.

**Flash Partition:** For larger applications (especially with network tests), use a bigger app partition:

```ini
board_build.partitions = huge_app.csv
```

Common partition schemes:
- `default.csv` - 1.3MB app (may be too small for complex apps)
- `min_spiffs.csv` - 1.9MB app, 190KB SPIFFS
- `huge_app.csv` - 3MB app, minimal SPIFFS (recommended for Web3E apps)

Without adequate flash space, you'll see: `Image length XXXXXX doesn't fit in partition length YYYYYY` and boot loops.

### Infura Support (Opt-In)

By default, Web3E uses **public RPC nodes** for maximum portability and zero configuration. Infura support is **opt-in only** and requires compile-time flags.

**To enable Infura:**

Add these build flags to your `platformio.ini`:

```ini
build_flags =
-DARDUINO_LOOP_STACK_SIZE=16384
-DUSING_INFURA
-DINFURA_API_KEY=\"your-infura-api-key-here\"
```

**Without these flags:** The library will use public RPCs from the curated rankings feed. The `Web3(chainId, infura_key)` constructor will ignore the key parameter and log a warning. **Public RPCs use unverified TLS** (HTTPS connection without server certificate verification) for simplicity and broad compatibility.

**With `-DUSING_INFURA` defined:** Infura endpoints become the primary RPC for supported chains (Ethereum, Polygon, Optimism, Arbitrum, Base, Linea, Avalanche testnets), with public nodes as fallback. **Infura uses pinned TLS certificate verification** with Amazon Root CA 1 for enhanced security.

**TLS Certificate Policy:**
- **Public RPCs:** Unverified TLS (`client->setInsecure()`) - encrypted connection without server verification
- **Infura (opt-in):** Pinned Amazon Root CA 1 - full TLS verification with certificate pinning

**Supported Infura chains:** See `tools/infura-chains.json` for the complete list of chains with Infura endpoints.

## Example TokenScript flow

- Two API end points are exposed on the embedded device, '/api/getChallenge' and 'api/checkSignature?sig=<sig>'
Expand Down Expand Up @@ -136,6 +230,24 @@ Note, if you have an Infura API key and wish to use Infura where possible, edit

Web3E will adjust the node endpoint to use Infura for all Infura supported networks. Note that you will need to enable Infura in the dashboard for all these networks; otherwise use the free connections.

### RPC Node Updates

Web3E's RPC node URLs in `src/nodes.h` are automatically updated from a performance-ranked feed using the build-time updater in `tools/`. The updater selects the fastest public nodes (up to 3 per chain) based on response time measurements.

Each chain now supports up to 3 URLs for future failover/rotation:

``` C++
// Get primary URL (backward compatible)
const char* primaryUrl = getNode(SEPOLIA_ID);

// Get alternate URLs for failover
const char* url1 = getNodeUrls(SEPOLIA_ID, 0); // Primary
const char* url2 = getNodeUrls(SEPOLIA_ID, 1); // Alternate 1
const char* url3 = getNodeUrls(SEPOLIA_ID, 2); // Alternate 2
```

See `tools/README.md` for details on updating node URLs.

## Example Web3E DApp flow

- Device creates a challenge string, lets say 'Oranges 22853'.
Expand Down
Loading
Loading