Skip to content

watch_logs never fires because ArkivEntity* events are missing from the SDK ABI #11

@cryptobench

Description

@cryptobench

Summary

Subscribing with ArkivClient.watch_logs produces no callbacks on the current storage contract. The node emits ArkivEntityCreated/Updated/Deleted/BTLExtended events, but the SDK ABI only defines the legacy GolemBaseStorage* signatures, so the emitted topics cannot be resolved and the log handler short-circuits.

Environment

  • SDK: arkiv-sdk-python (vendored in Arkiv-Network/ctf-ideas, current HEAD)
  • Node: golembase-op-geth Docker Compose stack
  • Python: 3.11.13

Reproduction

  1. Clone https://github.com/Arkiv-Network/ctf-ideas.
  2. Prepare the environment (same as issue ArkivClient send_transaction fails on latest storage contract (missing ArkivEntity* ABI entries) #10):
    python3.11 -m venv .venv
    source .venv/bin/activate
    pip install -U pip
    pip install -r challenges/the-lockbox/server/requirements.txt
  3. Start the node and fund a wallet:
    cd golembase-op-geth
    docker compose up -d
    export WALLET_PASSWORD=secret
    docker compose exec -T op-geth golembase account import --privatekey 0x9e0e50eaab436bc147c947960224895674d6c9c6303cb9ba941ed04e87188576
    docker compose exec -T op-geth golembase account fund --node-url http://localhost:8545 --value 100
    docker compose exec -T op-geth golembase account balance --node-url http://localhost:8545
    cd ..
  4. Export the connection variables:
    export ARKIV_RPC_URL=http://localhost:8545
    export ARKIV_WS_URL=ws://localhost:8545
    export ARKIV_PRIVATE_KEY=0x9e0e50eaab436bc147c947960224895674d6c9c6303cb9ba941ed04e87188576
  5. Save the following script as scripts/repro_watch_logs_missing_events.py and run it:
    #!/usr/bin/env python3
    """Show that watch_logs ignores ArkivEntity* events without ABI patching."""
    
    import asyncio
    import json
    import os
    
    from arkiv_sdk import Annotation, ArkivClient, ArkivCreate
    
    
    async def main() -> None:
        rpc = os.environ["ARKIV_RPC_URL"]
        ws = os.environ["ARKIV_WS_URL"]
        pk = bytes.fromhex(os.environ["ARKIV_PRIVATE_KEY"][2:])
        client = await ArkivClient.create_rw_client(rpc_url=rpc, ws_url=ws, private_key=pk)
    
        seen = []
    
        def create_callback(ev) -> None:
            seen.append(ev)
    
        handle = await client.watch_logs(label="abi-repro", create_callback=create_callback)
    
        payload = json.dumps({"demo": True}).encode()
        await client.create_entities(
            [
                ArkivCreate(
                    payload,
                    10_000,
                    [Annotation("ctf", "abi-repro")],
                    [],
                )
            ]
        )
    
        await asyncio.sleep(2)
        await handle.unsubscribe()
        await client.disconnect()
    
        print(f"create callbacks fired: {len(seen)}")
    
    
    if __name__ == "__main__":
        asyncio.run(main())
    Command:
    python scripts/repro_watch_logs_missing_events.py

Expected

The create_callback should run exactly once and the script should print create callbacks fired: 1.

Actual

The script fails during create_entities with:

web3.exceptions.Web3ValueError: Could not find any event with matching topic

The emitted topic (0x73dc52f9…) matches the hash of ArkivEntityCreated(uint256,address,uint256,uint256), which is absent from the SDK ABI, so self.arkiv_contract.get_event_by_topic(...) raises. Even when we monkeypatch the ABI locally to add the new events, the subsequent match statement in _process_arkiv_log_receipt ignores ArkivEntityCreated, yielding zero callbacks.

Impact

watch_logs is unusable against the latest storage contract unless downstream projects mutate the ABI and add custom dispatch code. Please ship the updated ArkivEntity* event definitions with the SDK and extend the log processing logic so subscriptions receive callbacks for the new events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions