Skip to content

Commit 6a383ae

Browse files
smrz2001claude
andauthored
feat: add anchor-evm crate for EVM-based anchoring (#742)
* feat: add anchor-evm crate for EVM-based anchoring Add new crate implementing EVM blockchain anchoring for Ceramic streams. - Supports self-anchoring directly to EVM chains without Merkle trees - Implements gas management with dynamic pricing and retry logic - Uses environment variables for RPC endpoints to avoid hardcoded secrets - Includes comprehensive tests for Gnosis Chain integration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(anchor-evm): address PR review comments and add full integration test Fixes from PR #742 review: - Fix tx_hash_to_cid: wrap hash with Keccak256 code + ETH_TX codec (0x93) instead of re-hashing with SHA2-256 - Fix AnchorProof parameter order: (chain_id, root, tx_hash, tx_type) - Add chain ID validation after connecting to provider - Implement retry logic with exponential backoff - Add wallet balance logging for gas cost tracking - Update default confirmations from 1 to 4 (matching JS implementation) Code cleanup: - Remove unused GasConfig (alloy handles gas estimation automatically) - Remove unused get_root_block function and getRootBlock interface - Consolidate gnosis_test.rs into integration_test.rs Testing: - Add test_cid_to_bytes32_matches_js to verify JS compatibility - Add test_tx_hash_to_cid_matches_js to verify JS compatibility - Add test_anchor_service_with_evm for full AnchorService flow testing (merkle tree building, EVM anchoring, time event creation) Documentation: - Update README with comprehensive test documentation - Document all environment variables for integration tests - Update contract interface to match actual implementation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(anchor-evm): handle reverted transactions and missing block number - Check receipt.status() and return error if transaction reverted - Use ok_or_else() instead of unwrap() for block_number 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: macOS-13 -> macos-15-intel * review comment --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 48994b2 commit 6a383ae

11 files changed

Lines changed: 1339 additions & 4 deletions

File tree

.github/workflows/build-test-sdk.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
settings:
30-
- host: macos-13
30+
- host: macos-15-intel
3131
target: x86_64-apple-darwin
3232
build: pnpm build:rust --target x86_64-apple-darwin && pnpm build:js
3333
- host: ubuntu-latest
@@ -105,7 +105,7 @@ jobs:
105105
- host: macos-latest
106106
target: aarch64-apple-darwin
107107
architecture: arm64
108-
- host: macos-13
108+
- host: macos-15-intel
109109
target: x86_64-apple-darwin
110110
architecture: x64
111111
node:

.github/workflows/publish-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
settings:
28-
- host: macos-13
28+
- host: macos-15-intel
2929
target: x86_64-apple-darwin
3030
build: pnpm build:rust --target x86_64-apple-darwin && pnpm build:js
3131
- host: ubuntu-latest

Cargo.lock

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ resolver = "2"
33
members = [
44
"actor",
55
"actor-macros",
6+
"anchor-evm",
67
"anchor-remote",
78
"anchor-service",
89
"api",
@@ -42,7 +43,7 @@ members = [
4243
# e.g. anyhow's backtrace feature.
4344

4445
ahash = "0.8"
45-
alloy = { version = "0.4", features = ["k256", "provider-http", "rpc-types"] }
46+
alloy = { version = "0.4", features = ["k256", "provider-http", "rpc-types", "signers", "sol-types", "signer-local", "contract"] }
4647
anyhow = { version = "1" }
4748
arrow = { version = "54", features = ["prettyprint"] }
4849
arrow-array = "54"
@@ -66,6 +67,7 @@ bytes = "1.1"
6667
bytesize = "1.1"
6768
ceramic-actor = { path = "./actor" }
6869
ceramic-actor-macros = { path = "./actor-macros" }
70+
ceramic-anchor-evm = { path = "./anchor-evm" }
6971
ceramic-anchor-service = { path = "./anchor-service" }
7072
ceramic-anchor-remote = { path = "./anchor-remote" }
7173
ceramic-api = { path = "./api" }

anchor-evm/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "ceramic-anchor-evm"
3+
description = "EVM blockchain anchoring service for Ceramic"
4+
version.workspace = true
5+
edition.workspace = true
6+
authors.workspace = true
7+
license.workspace = true
8+
repository.workspace = true
9+
publish = false
10+
11+
[dependencies]
12+
alloy.workspace = true
13+
anyhow.workspace = true
14+
async-trait.workspace = true
15+
ceramic-anchor-service.workspace = true
16+
ceramic-core.workspace = true
17+
ceramic-event.workspace = true
18+
hex.workspace = true
19+
multihash-codetable.workspace = true
20+
tokio.workspace = true
21+
tracing.workspace = true
22+
url.workspace = true
23+
24+
[dev-dependencies]
25+
ceramic-sql.workspace = true
26+
cid.workspace = true
27+
expect-test.workspace = true
28+
test-log.workspace = true
29+
tracing-subscriber.workspace = true

0 commit comments

Comments
 (0)