Skip to content

gl.get_contract_at(...).view() dispatches to __handle_undefined_method__ despite target method being correctly registered in schema #420

Description

@Snehal707

Summary

Calling a correctly-defined, correctly-decorated @gl.public.view method on a separately deployed Intelligent Contract through gl.get_contract_at(address).view().method_name() fails with call to private method Contract.__handle_undefined_method__ / call to private method Contract.__receive__, even though gen_getContractSchema confirms that the target method is registered and visible.

Environment

  • StudioNet (https://studio.genlayer.com/api)
  • genlayer-test 0.30.0rc2
  • genlayer-py 0.19.0rc2

Reproduction

Target contract:

from genlayer import *

class ICStoreProbe(gl.Contract):
    value: str

    def __init__(self, value: str):
        self.value = value

    @gl.public.view
    def read_it(self) -> str:
        return self.value
  1. Deploy the target with value = "probe-value"; deployment finalizes before the call.
  2. Query gen_getContractSchema for the deployed target. It returns:
{
  "read_it": {
    "params": [],
    "kwparams": {},
    "readonly": true,
    "ret": "string"
  }
}
  1. Deploy a second contract and call:
other = gl.get_contract_at(target_address)
return other.view().read_it()
  1. The call fails with gen_call failed (code=-32000): execution failed.

Ruled out

  • The target method is decorated correctly and is schema-visible.
  • Deployment timing/race: the test harness waits for the deployment receipt before returning the contract handle.
  • Dynamic-proxy-only issue: a statically typed @gl.contract_interface variant also failed.
  • Read-context-only issue: a write transaction variant also failed. Example transaction 0x2a9b9962b5fa117bbefee0dea26cd73fc8a9545db8927a41b5851634eccdc041 reached FINALIZED, but its leader/validator execution_result was ERROR.

The detailed GenVM stderr from the dynamic/write attempt was:

ValueError: call to private method `<function Contract.__handle_undefined_method__ ...>`
call to private method `<function Contract.__receive__ ...>`

Conclusion

The target method is correctly defined and schema-visible, yet the calling runtime dispatches to the undefined-method fallback path. This appears to be a dispatch/resolution bug in the IC-to-IC call mechanism rather than a contract-authoring error.

Question

Is gl.get_contract_at(...).view() known to work in the current StudioNet build? Is there a required registration/configuration step beyond correct method decoration, or is this a runtime bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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