Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
17fdd31
Increment TxnCounter with inner transactions
jannotti Sep 9, 2021
95c6da7
Add creatable IDs to ApplyData and REST API.
jannotti Sep 9, 2021
50280bf
`make msgp` after adding creatable fields to ApplyData
jannotti Sep 10, 2021
a62e8b3
first round trip with foundation
jannotti Sep 10, 2021
c728fd6
Adjust v1 REST API to get app/asa id from ApplyData if possible
jannotti Sep 10, 2021
27b53c1
Typo
jannotti Sep 10, 2021
96b4b7f
Temporary explanation in leiu of a new table of fields.
jannotti Sep 10, 2021
d575c64
Confirm followup creates have the expected id after inners
jannotti Sep 10, 2021
9b7bcc2
Test suggested by @jasonpaulos
jannotti Sep 10, 2021
bae2859
acfg and afrz inner transactions
jannotti Sep 11, 2021
41d379d
Lint & Jason P. Perfect together
jannotti Sep 12, 2021
7e4f50a
CR fixups
jannotti Sep 13, 2021
abcff11
Correct outdated comment
jannotti Sep 13, 2021
e326edd
Merge branch 'master' into spec-updates
jannotti Sep 13, 2021
5222a36
Prose changes
jannotti Sep 13, 2021
68cd49f
Field versioning
jannotti Sep 13, 2021
e0939bc
Require 32 byte hash
jannotti Sep 13, 2021
b2b6bc3
tx_begin -> itxn_begin for consistency with future `itxn` opcode
jannotti Sep 13, 2021
7c81231
Put inner IDs into inner rest response
jannotti Sep 13, 2021
95b2f04
Test inner txn indexes
jasonpaulos Sep 13, 2021
9afb79b
Merge pull request #2 from jasonpaulos/inner-txn-index-test
jannotti Sep 13, 2021
1a3fda3
Adds an itxn instruction for seeing inner txns (fields and results)
jannotti Sep 14, 2021
b8443dc
Merge branch 'spec-updates' into itxn
jannotti Sep 14, 2021
7288691
Merge branch 'master' into itxn
jannotti Sep 14, 2021
69081ef
spelling
jannotti Sep 14, 2021
0658d4c
Fix doc name, unit test to avoid problems
jannotti Sep 14, 2021
3e6aa96
Generate specs
jannotti Sep 14, 2021
100227a
Spec details
jannotti Sep 14, 2021
12de4ce
partiion fucking test
jannotti Sep 14, 2021
24c76af
spelling
jannotti Sep 14, 2021
e1ad562
Code review
jannotti Sep 14, 2021
363445a
typo
jannotti Sep 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/opdoc/opdoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ func assetHoldingFieldsMarkdown(out io.Writer) {

func assetParamsFieldsMarkdown(out io.Writer) {
fmt.Fprintf(out, "\n`asset_params_get` Fields:\n\n")
fieldTableMarkdown(out, logic.AssetParamsFieldNames, logic.AssetParamsFieldTypes, logic.AssetParamsFieldDocs)
fieldTableMarkdown(out, logic.AssetParamsFieldNames, logic.AssetParamsFieldTypes, logic.AssetParamsFieldDocs())
}

func appParamsFieldsMarkdown(out io.Writer) {
fmt.Fprintf(out, "\n`app_params_get` Fields:\n\n")
fieldTableMarkdown(out, logic.AppParamsFieldNames, logic.AppParamsFieldTypes, logic.AppParamsFieldDocs)
fieldTableMarkdown(out, logic.AppParamsFieldNames, logic.AppParamsFieldTypes, logic.AppParamsFieldDocs())
}

func ecDsaCurvesMarkdown(out io.Writer) {
Expand Down Expand Up @@ -373,11 +373,11 @@ func main() {
assetholding.Close()

assetparams, _ := os.Create("asset_params_fields.md")
fieldTableMarkdown(assetparams, logic.AssetParamsFieldNames, logic.AssetParamsFieldTypes, logic.AssetParamsFieldDocs)
fieldTableMarkdown(assetparams, logic.AssetParamsFieldNames, logic.AssetParamsFieldTypes, logic.AssetParamsFieldDocs())
assetparams.Close()

appparams, _ := os.Create("app_params_fields.md")
fieldTableMarkdown(appparams, logic.AppParamsFieldNames, logic.AppParamsFieldTypes, logic.AppParamsFieldDocs)
fieldTableMarkdown(appparams, logic.AppParamsFieldNames, logic.AppParamsFieldTypes, logic.AppParamsFieldDocs())
appparams.Close()

langspecjs, _ := os.Create("langspec.json")
Expand Down
5 changes: 5 additions & 0 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,11 @@ func initConsensusProtocols() {

// Enable App calls to pool budget in grouped transactions
vFuture.EnableAppCostPooling = true

// Enable Inner Transactions, and set maximum number. 0 value is
// disabled. Value > 0 also activates storage of creatable IDs in
// ApplyData, as that is required to support REST API when inner
// transactions are activated.
vFuture.MaxInnerTransactions = 16

// Allow 50 app opt ins
Expand Down
22 changes: 20 additions & 2 deletions daemon/algod/api/server/v1/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func computeCreatableIndexInPayset(tx node.TxnWithStatus, txnCounter uint64, pay
// computeAssetIndexFromTxn returns the created asset index given a confirmed
// transaction whose confirmation block is available in the ledger. Note that
// 0 is an invalid asset index (they start at 1).
func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint64) {
func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) uint64 {
// Must have ledger
if l == nil {
return 0
Expand All @@ -413,6 +413,15 @@ func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint6
return 0
}

aidx := uint64(tx.ApplyData.ConfigAsset)
if aidx > 0 {
return aidx
}
// If there is no ConfigAsset in the ApplyData, it must be a
// transaction before inner transactions were activated. Therefore
// the computeCreatableIndexInPayset function will work properly
// to deduce the aid. Proceed.

// Look up block where transaction was confirmed
blk, err := l.Block(tx.ConfirmedRound)
if err != nil {
Expand All @@ -430,7 +439,7 @@ func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint6
// computeAppIndexFromTxn returns the created app index given a confirmed
// transaction whose confirmation block is available in the ledger. Note that
// 0 is an invalid asset index (they start at 1).
func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint64) {
func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) uint64 {
// Must have ledger
if l == nil {
return 0
Expand All @@ -448,6 +457,15 @@ func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint64)
return 0
}

aidx := uint64(tx.ApplyData.ApplicationID)
if aidx > 0 {
return aidx
}
// If there is no ApplicationID in the ApplyData, it must be a
// transaction before inner transactions were activated. Therefore
// the computeCreatableIndexInPayset function will work properly
// to deduce the aidx. Proceed.

// Look up block where transaction was confirmed
blk, err := l.Block(tx.ConfirmedRound)
if err != nil {
Expand Down
33 changes: 26 additions & 7 deletions daemon/algod/api/server/v2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func computeCreatableIndexInPayset(tx node.TxnWithStatus, txnCounter uint64, pay
// computeAssetIndexFromTxn returns the created asset index given a confirmed
// transaction whose confirmation block is available in the ledger. Note that
// 0 is an invalid asset index (they start at 1).
func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx *uint64) {
func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) *uint64 {
// Must have ledger
if l == nil {
return nil
Expand All @@ -128,6 +128,15 @@ func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx *uint
return nil
}

aid := uint64(tx.ApplyData.ConfigAsset)
if aid > 0 {
return &aid
}
// If there is no ConfigAsset in the ApplyData, it must be a
// transaction before inner transactions were activated. Therefore
// the computeCreatableIndexInPayset function will work properly
// to deduce the aid. Proceed.

// Look up block where transaction was confirmed
blk, err := l.Block(tx.ConfirmedRound)
if err != nil {
Expand All @@ -145,7 +154,7 @@ func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx *uint
// computeAppIndexFromTxn returns the created app index given a confirmed
// transaction whose confirmation block is available in the ledger. Note that
// 0 is an invalid asset index (they start at 1).
func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx *uint64) {
func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) *uint64 {
// Must have ledger
if l == nil {
return nil
Expand All @@ -163,6 +172,15 @@ func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx *uint64
return nil
}

aid := uint64(tx.ApplyData.ApplicationID)
if aid > 0 {
return &aid
}
// If there is no ApplicationID in the ApplyData, it must be a
// transaction before inner transactions were activated. Therefore
// the computeCreatableIndexInPayset function will work properly
// to deduce the aid. Proceed.

// Look up block where transaction was confirmed
blk, err := l.Block(tx.ConfirmedRound)
if err != nil {
Expand Down Expand Up @@ -283,12 +301,12 @@ func convertLogs(txn node.TxnWithStatus) *[][]byte {
func convertInners(txn *node.TxnWithStatus) *[]preEncodedTxInfo {
inner := make([]preEncodedTxInfo, len(txn.ApplyData.EvalDelta.InnerTxns))
for i, itxn := range txn.ApplyData.EvalDelta.InnerTxns {
inner[i] = convertTxn(&itxn)
inner[i] = convertInnerTxn(&itxn)
}
return &inner
}

func convertTxn(txn *transactions.SignedTxnWithAD) preEncodedTxInfo {
func convertInnerTxn(txn *transactions.SignedTxnWithAD) preEncodedTxInfo {
// This copies from handlers.PendingTransactionInformation, with
// simplifications because we have a SignedTxnWithAD rather than
// TxnWithStatus, and we know this txn has committed.
Expand All @@ -301,9 +319,10 @@ func convertTxn(txn *transactions.SignedTxnWithAD) preEncodedTxInfo {
response.ReceiverRewards = &txn.ApplyData.ReceiverRewards.Raw
response.CloseRewards = &txn.ApplyData.CloseRewards.Raw

// Indexes can't be set until we allow acfg or appl
// response.AssetIndex = computeAssetIndexFromTxn(txn, v2.Node.Ledger())
// response.ApplicationIndex = computeAppIndexFromTxn(txn, v2.Node.Ledger())
// Since this is an inner txn, we know these indexes will be populated. No
// need to search payset for IDs
response.AssetIndex = numOrNil(uint64(txn.ApplyData.ConfigAsset))
response.ApplicationIndex = numOrNil(uint64(txn.ApplyData.ApplicationID))

// Deltas, Logs, and Inners can not be set until we allow appl
// response.LocalStateDelta, response.GlobalStateDelta = convertToDeltas(txn)
Expand Down
2 changes: 1 addition & 1 deletion data/pools/transactionPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (pool *TransactionPool) isAssemblyTimedOut() bool {
// we have no deadline, so no reason to timeout.
return false
}
generateBlockDuration := generateBlockBaseDuration + time.Duration(pool.pendingBlockEvaluator.TxnCounter())*generateBlockTransactionDuration
generateBlockDuration := generateBlockBaseDuration + time.Duration(pool.pendingBlockEvaluator.PaySetSize())*generateBlockTransactionDuration
return time.Now().After(pool.assemblyDeadline.Add(-generateBlockDuration))
}

Expand Down
Loading