Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept Athena VM integration #6180

Closed
wants to merge 46 commits into from
Closed

Proof of concept Athena VM integration #6180

wants to merge 46 commits into from

Conversation

lrettig
Copy link
Member

@lrettig lrettig commented Jul 26, 2024

Motivation

Quick-and-dirty Athena POC integration, sufficient to run a go-spacemesh-based testnet with Athena as its only VM.

Description

  • brings in compiled Athena module
  • replaces the existing genvm with Athena
  • augments the existing account data type with 32-byte key/value storage slots

Non-goals: This POC is not intended to be merged into mainline go-spacemesh. It's not intended to be kept fully up to date with go-spacemesh fixes and releases, as it's only intended for testnet usage. We don't intend to maintain the existing genvm in this branch.

Test Plan

tbd

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

@lrettig lrettig changed the title Download athena dependencies Proof of concept Athena VM integration Jul 26, 2024
@mathcrypto mathcrypto self-requested a review July 29, 2024 16:51
@lrettig lrettig force-pushed the athena branch 2 times, most recently from 7106567 to d52bed7 Compare July 30, 2024 22:56
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 78.33935% with 180 lines in your changes missing coverage. Please review.

Project coverage is 81.6%. Comparing base (f5f96b9) to head (82f9523).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
vm/vm.go 74.0% 69 Missing and 26 partials ⚠️
vm/core/context.go 75.1% 23 Missing and 12 partials ⚠️
vm/host.go 74.5% 12 Missing and 1 partial ⚠️
vm/rewards.go 84.1% 6 Missing and 4 partials ⚠️
vm/sdk/encode.go 0.0% 8 Missing ⚠️
vm/templates/wallet/handler.go 86.8% 4 Missing and 1 partial ⚠️
vm/core/staged_cache.go 84.6% 2 Missing and 2 partials ⚠️
vm/registry/registry.go 75.0% 1 Missing and 1 partial ⚠️
vm/sdk/wallet/address.go 66.6% 1 Missing and 1 partial ⚠️
vm/sdk/wallet/tx.go 95.1% 1 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #6180     +/-   ##
=========================================
- Coverage     81.8%   81.6%   -0.2%     
=========================================
  Files          312     327     +15     
  Lines        34603   35447    +844     
=========================================
+ Hits         28310   28957    +647     
- Misses        4458    4604    +146     
- Partials      1835    1886     +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@poszu poszu force-pushed the athena branch 2 times, most recently from db74094 to 2e3e5a4 Compare September 5, 2024 13:25
@poszu poszu mentioned this pull request Oct 4, 2024
@lrettig lrettig closed this Oct 4, 2024
@lrettig lrettig reopened this Oct 4, 2024
Update to latest athena release
Cherry pick CGO bugfixes from athena-poc-init branch
Tx parsing WIP
Remove references to genvm, athena
Fix more paths
Disable tests that rely on multisig, vault, vesting
@@ -0,0 +1,46 @@
//! Test harness for the Wallet program.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need script crate with the test harness. We can test the program crate using integration tests located under program/tests (they would run the program in a VM), wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this was copied over from the Athena side, right? It belongs there, not here

Comment on lines +1 to +9
[workspace]
[package]
name = "wallet-common"
version = "0.1.0"
edition = "2021"

[dependencies]
athena-interface = { git = "https://github.com/athenavm/athena.git", branch = "main" }
parity-scale-codec = { version = "3.6.12", features = ["derive"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving common and program into the vm/templates/wallet/ directory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"program" should probably become "wallet" (right? it's the wallet template), but there's currently another folder with that name. Let's sort out the existing Go code a little better before re-arranging these.

api/grpcserver/grpcserver_test.go Outdated Show resolved Hide resolved
api/grpcserver/grpcserver_test.go Outdated Show resolved Hide resolved
api/grpcserver/v2alpha1/account_test.go Outdated Show resolved Hide resolved
api/grpcserver/v2alpha1/transaction.go Outdated Show resolved Hide resolved
sql/accounts/accounts.go Outdated Show resolved Hide resolved
sql/accounts/accounts.go Outdated Show resolved Hide resolved
sql/accounts/accounts.go Outdated Show resolved Hide resolved
common/types/account_storage.go Outdated Show resolved Hide resolved
@poszu poszu changed the base branch from develop to athena-poc October 7, 2024 11:05
poszu and others added 3 commits October 7, 2024 14:03
Finalize removing method from tx header
go generate (scalegen)
mockgen
@lrettig
Copy link
Member Author

lrettig commented Oct 7, 2024

Questions:

  • where do we want to compute the principal, in athena or in go-sm? I think this could be either. If in athena, we need an interface for this.
  • does the nonce live inside the athena tx payload or outside? (this was brought up before but we didn't reach a final answer: https://community.spacemesh.io/t/proposed-athena-design/433#questions-14) If inside, we need an interface for this.
  • where do we do gas computations, in athena or in go-sm? Assuming in athena, then we need an interface that, given a TX payload and target address + method, calculates the max gas.
  • where/how do we handle encoding of the athena tx payload? (These are the parts labeled ENCODE(...) in this post.) Assuming we want this logic to live entirely inside athena, we need an interface for this, too.

@lrettig
Copy link
Member Author

lrettig commented Oct 8, 2024

Closing in favor of #6379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants