Skip to content

Commit 238906c

Browse files
authored
Merge pull request #4709 from jannotti/box-specs-review
code review
2 parents f9fbae2 + b396eeb commit 238906c

File tree

4 files changed

+5
-44
lines changed

4 files changed

+5
-44
lines changed

data/transactions/logic/box.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func opBoxExtract(cx *EvalContext) error {
154154
return fmt.Errorf("no such box %#v", name)
155155
}
156156

157-
bytes, err := extractCarefully([]byte(contents), start, length)
157+
bytes, err := extractCarefully(contents, start, length)
158158
cx.stack[pprev].Bytes = bytes
159159
cx.stack = cx.stack[:prev]
160160
return err
@@ -182,7 +182,7 @@ func opBoxReplace(cx *EvalContext) error {
182182
return fmt.Errorf("no such box %#v", name)
183183
}
184184

185-
bytes, err := replaceCarefully([]byte(contents), replacement, start)
185+
bytes, err := replaceCarefully(contents, replacement, start)
186186
if err != nil {
187187
return err
188188
}

data/transactions/logic/ledger_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,6 @@ func (l *Ledger) Perform(gi int, ep *EvalParams) error {
898898
}
899899
}
900900

901-
// Get() through allocated() implement cowForLogicLedger, so we should
902-
// be able to make logicLedger with this inside. That let's us to
903-
// write tests and then poke around and see how the balance table
904-
// inside is affected.
905-
906901
// Get returns the AccountData of an address. This test ledger does
907902
// not handle rewards, so the pening rewards flag is ignored.
908903
func (l *Ledger) Get(addr basics.Address, withPendingRewards bool) (basics.AccountData, error) {

data/transactions/logic/parsing_test.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ import (
2121
"encoding/base64"
2222
"encoding/binary"
2323
"fmt"
24-
"github.com/algorand/avm-abi/abi"
25-
"github.com/algorand/go-algorand/data/basics"
2624
"math"
2725
"testing"
2826

27+
"github.com/algorand/avm-abi/abi"
28+
"github.com/algorand/go-algorand/data/basics"
29+
2930
"github.com/algorand/go-algorand/test/partitiontest"
3031
"github.com/stretchr/testify/require"
3132
)
@@ -91,18 +92,6 @@ func TestNewAppCallBytes(t *testing.T) {
9192
}
9293
}
9394

94-
for _, v := range []uint64{1, 0, math.MaxUint64} {
95-
for _, e := range []string{"int", "integer"} {
96-
t.Run(fmt.Sprintf("encoding=%v,value=%v", e, v), func(t *testing.T) {
97-
acb, err := NewAppCallBytes(fmt.Sprintf("%v:%v", e, v))
98-
require.NoError(t, err)
99-
r, err := acb.Raw()
100-
require.NoError(t, err)
101-
require.Equal(t, v, binary.BigEndian.Uint64(r))
102-
})
103-
}
104-
}
105-
10695
for _, v := range []string{"737777777777777777777777777777777777777777777777777UFEJ2CI"} {
10796
for _, e := range []string{"addr", "address"} {
10897
t.Run(fmt.Sprintf("encoding=%v,value=%v", e, v), func(t *testing.T) {

ledger/internal/applications.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121

2222
"github.com/algorand/go-algorand/data/basics"
2323
"github.com/algorand/go-algorand/data/bookkeeping"
24-
"github.com/algorand/go-algorand/data/transactions"
2524
"github.com/algorand/go-algorand/data/transactions/logic"
2625
"github.com/algorand/go-algorand/ledger/apply"
2726
"github.com/algorand/go-algorand/ledger/ledgercore"
@@ -31,28 +30,6 @@ import (
3130
/* This file adds functions to roundCowState that make it more palatable for use
3231
outside of the ledger package. The LedgerForLogic interface expects them. */
3332

34-
type cowForLogicLedger interface {
35-
Get(addr basics.Address, withPendingRewards bool) (ledgercore.AccountData, error)
36-
GetAppParams(addr basics.Address, aidx basics.AppIndex) (basics.AppParams, bool, error)
37-
GetAssetParams(addr basics.Address, aidx basics.AssetIndex) (basics.AssetParams, bool, error)
38-
GetAssetHolding(addr basics.Address, aidx basics.AssetIndex) (basics.AssetHolding, bool, error)
39-
GetCreator(cidx basics.CreatableIndex, ctype basics.CreatableType) (basics.Address, bool, error)
40-
GetKey(addr basics.Address, aidx basics.AppIndex, global bool, key string, accountIdx uint64) (basics.TealValue, bool, error)
41-
BuildEvalDelta(aidx basics.AppIndex, txn *transactions.Transaction) (transactions.EvalDelta, error)
42-
43-
SetKey(addr basics.Address, aidx basics.AppIndex, global bool, key string, value basics.TealValue, accountIdx uint64) error
44-
DelKey(addr basics.Address, aidx basics.AppIndex, global bool, key string, accountIdx uint64) error
45-
46-
round() basics.Round
47-
prevTimestamp() int64
48-
allocated(addr basics.Address, aidx basics.AppIndex, global bool) (bool, error)
49-
txnCounter() uint64
50-
incTxnCount()
51-
52-
// The method should use the txtail to ensure MaxTxnLife+1 headers back are available
53-
blockHdrCached(round basics.Round) (bookkeeping.BlockHeader, error)
54-
}
55-
5633
func (cs *roundCowState) AccountData(addr basics.Address) (ledgercore.AccountData, error) {
5734
record, err := cs.Get(addr, true)
5835
if err != nil {

0 commit comments

Comments
 (0)