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

[programmability] basic adapter + CLI #10

Merged
merged 1 commit into from
Dec 3, 2021

Conversation

sblackshear
Copy link
Collaborator

@sblackshear sblackshear commented Dec 1, 2021

Prototype demonstrating how to hook the proposed programmability model up to the Move VM and the OnDiskStateView persistent storage used by the Move CLI.

  • Refactor ID and Authenticator to use the Move address type under the hood
  • Modify Transfer::transfer<T>(address, T) to emit a distinguished event containing the recipient address
  • Implement an adapter that processes these events to store the T on disk under its ID
  • In addition, the adapter wraps the Move CLI to enable persistent state, publishing modules, calling functions of published modules, etc.

This is limited/unsatisfactory in many ways (see the various TODO's), but it works well enough to enable experimenting with programmability and persistence via a basic CLI. To check it out, try

cd fastnft/fastx_programmability/adapter/tests/testsuite/create_transfer_use 
cargo run -p fastx-adapter -- sandbox exp-test

This runs the expected value test scenario defined in args.txt:

# Publish fastX stdlib and the test module
sandbox publish

# Create an S object with value 10 + transfer it to B0B
run CreateTransferUse create 0xB0B --args 99

# look at the object. note that it has been stored under a freshly created ID 0x4B...
# we should see that it has value 10 and its owner (B0B) stored in its id field
sandbox view storage/0x4B655E9C2E18E1E14F7FAEE0FDF81138/resources/0x00000000000000000000000000000002::CreateTransferUse::S.bcs

# transfer the object from B0B to CAB
run CreateTransferUse transfer 0xB0B --args 0x4B655E9C2E18E1E14F7FAEE0FDF81138 0xCAB

# look at the object again. should be the same except its owner (stored in the id field) has changed
sandbox view storage/0x4B655E9C2E18E1E14F7FAEE0FDF81138/resources/0x00000000000000000000000000000002::CreateTransferUse::S.bcs

demonstrating that the adapter can call functions of modules published on-chain + see the effects in on-disk persistent state.

@sblackshear sblackshear force-pushed the fastx_adapter branch 2 times, most recently from a36c355 to feb38a7 Compare December 1, 2021 06:26
Prototype demonstrating how to hook the proposed programmability model up to the Move VM and the `OnDiskStateView` persistent storage used by the Move CLI.

- Refactor `ID` and `Authenticator` to use the Move `address` type under the hood
- Modify `Transfer::transfer<T>(address, T)` to emit a distinguished event containing the recipient address
- Implement an adapter that processes these events to store the `T` on disk under its ID
- In addition, the adapter wraps the Move CLI to enable persistent state, publishing modules, calling functions of published modules, etc.

This is limited/unsatisfactory in many ways (see the various TODO's), but it works well enough to enable experimenting with programmability and persistence via a basic CLI.
@sblackshear sblackshear merged commit b45985f into MystenLabs:main Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant