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

Initialize past side effects with correct length during dryrun requests #2448

Merged
merged 2 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion daemon/algod/api/server/v2/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func doDryrunRequest(dr *DryrunRequest, response *generated.DryrunResponse) {

response.Txns = make([]generated.DryrunTxnResult, len(dr.Txns))
for ti, stxn := range dr.Txns {
pse := logic.MakePastSideEffects(1)
pse := logic.MakePastSideEffects(len(dr.Txns))
ep := logic.EvalParams{
Txn: &stxn,
Proto: &proto,
Expand Down
48 changes: 48 additions & 0 deletions daemon/algod/api/server/v2/dryrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,54 @@ func TestDryrunLocalCheck(t *testing.T) {
doDryrunRequest(&dr, &response)
checkAppCallPass(t, &response)
}

func TestDryrunMultipleTxns(t *testing.T) {
t.Parallel()

var dr DryrunRequest
var response generated.DryrunResponse

dr.ProtocolVersion = string(dryrunProtoVersion)

txn := transactions.SignedTxn{
Txn: transactions.Transaction{
Type: protocol.ApplicationCallTx,
ApplicationCallTxnFields: transactions.ApplicationCallTxnFields{
ApplicationID: 1,
ApplicationArgs: [][]byte{
[]byte("write"),
},
},
},
}

dr.Txns = []transactions.SignedTxn{txn, txn}
gkv := generated.TealKeyValueStore{
generated.TealKeyValue{
Key: b64("foo"),
Value: generated.TealValue{Type: uint64(basics.TealBytesType), Bytes: b64("bar")},
},
}
dr.Apps = []generated.Application{
{
Id: 1,
Params: generated.ApplicationParams{
ApprovalProgram: globalTestProgram,
GlobalState: &gkv,
GlobalStateSchema: &generated.ApplicationStateSchema{
NumByteSlice: 10,
NumUint: 10,
},
},
},
}
doDryrunRequest(&dr, &response)
checkAppCallPass(t, &response)
if t.Failed() {
logResponse(t, &response)
}
}

func TestDryrunEncodeDecode(t *testing.T) {
t.Parallel()

Expand Down