yeagerai / genlayer-simulator

MIT License
16 stars 8 forks source link

feat: integrate new genvm #599

Closed kp2pml30 closed 3 days ago

kp2pml30 commented 1 week ago

Fixes \

What

Why

Testing done

Decisions made

  1. I changed how method parameters are handled in the UI to support the new calldata format the right way
  2. Moved all llms to webrequests module to reuse your code!
  3. returns from read methods are hacky because currently I haven't implemented calldata parsing in the frontend. For that reason it returns it in a string format, which is partially json compatible. Tests also use that fact

Checks

Reviewing tips

@denishacquin please review frontend changes, I tested them by hand but still

Even thought I reread this PR myself, changes are massive and there may be something I missed, feel free to ask any questions and suggest changes

WEBREQUESTSELENIUMPORT = '5001' GENVM_BIN = "/genvm/bin" was added to .env.example and so it should appear in your .env as well

User facing release notes

Users must know that new genvm looks stylish and cool 😎

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 22.61905% with 260 lines in your changes missing coverage. Please review.

Project coverage is 19.06%. Comparing base (af6baf7) to head (c374d0c). Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ontend/src/components/Simulator/ContractParams.vue 0.00% 117 Missing and 1 partial :warning:
...nd/src/components/Simulator/ContractMethodItem.vue 0.00% 40 Missing :warning:
...rontend/src/components/Simulator/ContractParams.ts 0.00% 33 Missing and 1 partial :warning:
...src/components/Simulator/ConstructorParameters.vue 0.00% 20 Missing :warning:
frontend/src/hooks/useContractQueries.ts 0.00% 16 Missing :warning:
frontend/src/components/global/Btn.vue 0.00% 9 Missing :warning:
...tend/src/components/global/fields/AnyFieldValue.ts 10.00% 9 Missing :warning:
...d/src/components/Simulator/ContractReadMethods.vue 0.00% 6 Missing :warning:
.../src/components/Simulator/ContractWriteMethods.vue 0.00% 6 Missing :warning:
frontend/src/hooks/useInputMap.ts 77.77% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #599 +/- ## ========================================== + Coverage 18.61% 19.06% +0.45% ========================================== Files 123 127 +4 Lines 9618 9759 +141 Branches 299 300 +1 ========================================== + Hits 1790 1861 +71 - Misses 7744 7813 +69 - Partials 84 85 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

kp2pml30 commented 1 week ago

I also totally don't understand what pre-commit wants from me, I haven't even changed that file and pre-commit run --all-files passes locally

AgustinRamiroDiaz commented 1 week ago

I also totally don't understand what pre-commit wants from me, I haven't even changed that file and pre-commit run --all-files passes locally

probably it was left broken from another person (it's not a requirement to merge)

AgustinRamiroDiaz commented 1 week ago

@kirilaa I'm getting this error on the console when opening a contract

EDITED: the right person to tag would be @kp2pml30

endpoint_name:"gen_getContractSchemaForCode"
error:""
traceback:"Traceback (most recent call last):
File "/app/backend/protocol_rpc/endpoint_generator.py", line 46, in endpoint
result = await result
^^^^^^^^^^^^
File "/app/backend/protocol_rpc/endpoints.py", line 347, in get_contract_schema_for_code
return json.loads(await node.get_contract_schema(contract_code))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/node/base.py", line 163, in get_contract_schema
return await genvm.get_contract_schema(code.encode("utf-8"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/node/genvm/base.py", line 167, in get_contract_schema
raise Exception(f"execution failed {res}")
Exception: execution failed ExecutionResult(result=ExecutionFail: Traceback (most recent call last):
File "/app/backend/node/genvm/base.py", line 306, in _run_genvm_host
get_genvm_path(),
^^^^^^^^^^^^^^^^
File "/app/backend/node/genvm/config.py", line 36, in get_genvm_path
_found_at = _find_exe("genvm")
^^^^^^^^^^^^^^^^^^
File "/app/backend/node/genvm/config.py", line 27, in _find_exe
raise Exception(f"Can't find executable {name}, searched at {checked}")
Exception: Can't find executable genvm, searched at [PosixPath('/usr/local/bin/genvm'), PosixPath('/usr/local/sbin/genvm'), PosixPath('/usr/local/bin/genvm'), PosixPath('/usr/sbin/genvm'), PosixPath('/usr/bin/genvm'), PosixPath('/sbin/genvm'), PosixPath('/bin/genvm')]
, eq_outputs={}, pending_transactions=[], stdout='', stderr='')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/backend/protocol_rpc/message_handler/base.py", line 110, in wrapper
result = await result
^^^^^^^^^^^^
File "/app/backend/protocol_rpc/endpoint_generator.py", line 50, in endpoint
raise JSONRPCError(code=-32000, message=str(e))
flask_jsonrpc.exceptions.JSONRPCError
"
AgustinRamiroDiaz commented 1 week ago

@kirilaa probably related to my prior question: do we need to install the GenVM? How can we package it so that users can use the studio (simulator)? It'd be great if it was on a container, but it could also be a script to be added to the genlayer-init cli

EDITED: the right person to tag would be @kp2pml30

kp2pml30 commented 1 week ago

@AgustinRamiroDiaz please see updated slack message

Also note, that WEBREQUESTSELENIUMPORT = '5001' GENVM_BIN = "/genvm/bin" was added to .env.example and so it should appear in your .env as well

added it to the pr description as well

kirilaa commented 1 week ago

@kirilaa I'm getting this error on the console when opening a contract

I guess you wanted to tag @kp2pml30 :)

AgustinRamiroDiaz commented 1 week ago

@kp2pml30 can sentence-transformers==3.1.1 be removed now from the backend/protocol_rpc/requirements.txt ?

AgustinRamiroDiaz commented 1 week ago

Whenever I move between contracts, the method gen_getContractSchemaForCode gets called twice

image

kp2pml30 commented 1 week ago

Whenever I move between contracts, the method gen_getContractSchemaForCode gets called twice

image

this thing is likely to blame (anonymous from the second trace):

watch(
    () => contract.value?.content,
    () => {
      queryClient.invalidateQueries({
        queryKey: ['schema', contract.value?.id],
      });
    },
  );
AgustinRamiroDiaz commented 5 days ago

@kp2pml30 please don't merge if e2e tests don't pass

AgustinRamiroDiaz commented 5 days ago

Please fix this error (when deploying an IC) prior to merge

jsonrpc-1             | Error running consensus unhandled errors in a TaskGroup (1 sub-exception)
jsonrpc-1             |   + Exception Group Traceback (most recent call last):
jsonrpc-1             |   |   File "/app/backend/consensus/base.py", line 109, in _run_consensus
jsonrpc-1             |   |     async with asyncio.TaskGroup() as tg:
jsonrpc-1             |   |                ^^^^^^^^^^^^^^^^^^^
jsonrpc-1             |   |   File "/usr/local/lib/python3.12/asyncio/taskgroups.py", line 145, in __aexit__
jsonrpc-1             |   |     raise me from None
jsonrpc-1             |   | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
jsonrpc-1             |   +-+---------------- 1 ----------------
jsonrpc-1             |     | Traceback (most recent call last):
jsonrpc-1             |     |   File "/app/backend/consensus/base.py", line 135, in exec_transaction_with_session_handling
jsonrpc-1             |     |     await self.exec_transaction(
jsonrpc-1             |     |   File "/app/backend/consensus/base.py", line 269, in exec_transaction
jsonrpc-1             |     |     validation_results = await asyncio.gather(*validation_tasks)
jsonrpc-1             |     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jsonrpc-1             |     |   File "/app/backend/node/base.py", line 106, in exec_transaction
jsonrpc-1             |     |     receipt = await self.deploy_contract(
jsonrpc-1             |     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
jsonrpc-1             |     |   File "/app/backend/node/base.py", line 165, in deploy_contract
jsonrpc-1             |     |     return await self._run_genvm(
jsonrpc-1             |     |            ^^^^^^^^^^^^^^^^^^^^^^
jsonrpc-1             |     |   File "/app/backend/node/base.py", line 272, in _run_genvm
jsonrpc-1             |     |     return self._set_vote(
jsonrpc-1             |     |            ^^^^^^^^^^^^^^^
jsonrpc-1             |     |   File "/app/backend/node/base.py", line 140, in _set_vote
jsonrpc-1             |     |     leader_receipt.execution_result == receipt.leader_receipt
jsonrpc-1             |     |                                        ^^^^^^^^^^^^^^^^^^^^^^
jsonrpc-1             |     | AttributeError: 'Receipt' object has no attribute 'leader_receipt'
jsonrpc-1             |     +------------------------------------
jsonrpc-1             | 
github-actions[bot] commented 22 hours ago

:tada: This PR is included in version 0.22.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: