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

[chain] Introduce Multi-Actions and Outputs in Transactions #858

Merged
merged 79 commits into from
May 22, 2024

Conversation

wlawt
Copy link
Contributor

@wlawt wlawt commented Apr 24, 2024

Resolves: #335 , #359

Overview

This PR introduces the ability to specify multiple actions within a single transaction. We limit the number of actions that can be specified within a transaction using MaxActionsPerTx.

Furthermore, this PR introduces the ability to specify multiple outputs in Result. This lays the groundwork to enable outputting multiple Warp messages in an Action/Transaction.

Review Guide

  • chain/transaction.go - Core logic to handle multiple actions
  • chain/result.go - Enabling multiple outputs
  • Integration tests for both MorpheusVM and TokenVM

TODO

  • Add Rule to limit number of Actions per Transaction
  • Make Result.Output [][][]byte
  • Add multi-action tests in TokenVM integration
  • Add ActionID (hash(txID, actionIndex))

Tests

  • CI
  • Added more integration tests in TokenVM to include multi-action

@wlawt wlawt self-assigned this Apr 24, 2024
chain/dependencies.go Outdated Show resolved Hide resolved
rpc/jsonrpc_client.go Fixed Show fixed Hide fixed
@wlawt wlawt force-pushed the multi-action-support branch 2 times, most recently from c6ab96d to d4fa834 Compare April 25, 2024 16:52
@@ -432,19 +432,19 @@ var _ = ginkgo.Describe("[Tx Processing]", func() {
// read: 2 keys reads, 1 had 0 chunks
// allocate: 1 key created with 1 chunk
// write: 2 keys modified (new + old)
transferTxConsumed := fees.Dimensions{187, 7, 12, 25, 26}
transferTxConsumed := fees.Dimensions{191, 7, 12, 25, 26}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated back to 191 because we do p.PackInt(len(t.Actions)) which is 4 bytes

@wlawt wlawt force-pushed the multi-action-support branch 13 times, most recently from ca77bb4 to fbe2b9e Compare May 1, 2024 14:27
cli/prompt.go Outdated Show resolved Hide resolved
@wlawt wlawt force-pushed the multi-action-support branch 6 times, most recently from 7bb262b to 3979353 Compare May 3, 2024 17:58
codec/address.go Outdated Show resolved Hide resolved
codec/packer.go Outdated Show resolved Hide resolved
@wlawt
Copy link
Contributor Author

wlawt commented May 9, 2024

PRs that are merging into this one: #889 and #894

* include r.Outputs size in calculation above

* fix packing of Outputs for each Action
wlawt and others added 2 commits May 20, 2024 19:07
* remove err from Action

* mock gen

* add more TODOs

* add context on why revert is better

* add back error

* cleanup interface

* cleanup tx loop

* update error marshaling

* update transfer op

* cleaning up access

* finish tokenvm

* update mocks

* fix programs

* update create order

* cleanup cmd program

* backend.go compiles

* more cleanup

* morpheusvm integration passing

* fix tokenvm integration

* add nolint

* require lint

---------

Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
README.md Outdated Show resolved Hide resolved
* remove LID definition

* remove optional packer

* update cli

* update heap

* eheap + emap

* making progress on morpheusvm

* cleanup load test error

* tokenvm actions

* update token-cli

* update token-feed + token-faucet

* update token-wallet

* more progress in tokenvm

* update token storage

* use id const

* update programs

* unit tests passing

* remove consts form simulator

* fix lint

* pass integration tests

* integration test passing

* reduce size of digest

* fix load test

* e2e lint

* reuse nodes

* reuse nodes

* fix lint

* run gci
* add key validity check to Keys set

* cleanup state key validity checking

* reviewed chain/transaction

* cli changes

* add multi-send example to morpheus

* cleanup tokenvm

* remove heap casting

* fix program execute

* fix return

* cleanup var names

* unify error

* update fetcher tests

* remove unnecessary conversion
@patrick-ogrady patrick-ogrady merged commit af85e97 into main May 22, 2024
9 checks passed
@patrick-ogrady patrick-ogrady deleted the multi-action-support branch May 22, 2024 00:52
@patrick-ogrady patrick-ogrady added this to the Builder Ready milestone May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[chain/tx] Make transaction.Action an array (Support Batch Transactions)
3 participants