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

merge before audit #3431

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8590499
Three new globals for to help contract-to-contract usability
jannotti Nov 21, 2021
24055a3
detritis
jannotti Nov 21, 2021
92a26b6
Check error
jannotti Nov 22, 2021
d268300
doc comments
jannotti Nov 22, 2021
e5a1e53
Merge remote-tracking branch 'upstream/feature/contract-to-contract' …
jannotti Nov 23, 2021
db80261
Impose limits on the entire "tree" of inner calls.
jannotti Dec 7, 2021
34d35fd
Move appID tracking into EvalContext, out of LedgerForLogic
jannotti Dec 9, 2021
6260b9d
Stupid linter
jannotti Dec 9, 2021
4624e33
Fix unit tests error messages
jannotti Dec 10, 2021
d494c40
Allow access to resources created in the same transaction group
jannotti Dec 15, 2021
4d25744
Merge branch 'master' into feature/contract-to-contract
jannotti Dec 16, 2021
320e11d
Merge remote-tracking branch 'upstream/feature/contract-to-contract' …
jannotti Dec 16, 2021
6df82a1
Merge remote-tracking branch 'upstream/feature/contract-to-contract' …
jannotti Dec 16, 2021
b3215c0
Access to apps created in group
jannotti Dec 17, 2021
06edcf5
Remove tracked created mechanism in favor of examining applydata.
jannotti Dec 17, 2021
b7ee4a1
Allow v6 AVM code to use in-group created asas, apps (& their accts)
jannotti Dec 21, 2021
813bdf8
lint docs
jannotti Dec 21, 2021
0fcc77b
typo
jannotti Dec 21, 2021
50665a2
The review dog needs obedience training.
jannotti Dec 21, 2021
7422318
Use one EvalParams for logic evals, another for apps in dry run
jannotti Dec 22, 2021
02bd552
Use logic.NewAppEvalParams to decrease copying and bugs in debugger
jannotti Dec 22, 2021
82d9ef5
Simplify use of NewEvalParams. No more nil return when no apps.
jannotti Dec 22, 2021
11a5b53
Remove explicit PastSideEffects handling in tealdbg
jannotti Dec 22, 2021
8fa33c9
Always create EvalParams to evaluate a transaction group.
jannotti Dec 23, 2021
7e8d997
Correct mistaken commit
jannotti Dec 23, 2021
222e4f8
Spec improvments
jannotti Dec 29, 2021
325b86b
More spec improvments, including resource "availability"
jannotti Jan 4, 2022
f879152
Recursively return inner transaction tree
jannotti Jan 4, 2022
5c69765
Lint
jannotti Jan 4, 2022
e9e78fd
No need for ConfirmedRound, so don't deref a nil pointer!
jannotti Jan 4, 2022
d591ab6
Merge branch 'master' into feature/contract-to-contract
jannotti Jan 5, 2022
bc9a03f
license check
jannotti Jan 5, 2022
00cbd47
Merge branch 'feature/contract-to-contract' into feature/contract-to-…
jannotti Jan 5, 2022
6870ea2
Shut up, dawg.
jannotti Jan 5, 2022
9ec5395
Merge branch 'master' into feature/contract-to-contract
jannotti Jan 7, 2022
4945347
Merge remote-tracking branch 'upstream/feature/contract-to-contract' …
jannotti Jan 7, 2022
46784c7
testing: Fix unit test TestAsyncTelemetryHook_QueueDepth (#2685)
tsachiherman Jan 7, 2022
f9497d9
Deprecate `FastPartitionRecovery` from `ConsensusParams` (#3386)
tolikzinovyev Jan 7, 2022
e4a2420
Merge branch 'algorand:feature/contract-to-contract' into feature/con…
jannotti Jan 7, 2022
6baa253
Merge branch 'algorand:feature/contract-to-contract' into feature/con…
jannotti Jan 7, 2022
e2b34d2
base64 merge cleanup
jannotti Jan 7, 2022
2346615
Remaking a PR for CI (#3398)
algojack Jan 10, 2022
c3f405e
Merge pull request #3 from algorand/feature/contract-to-contract
jannotti Jan 10, 2022
038e842
Remove the extraneous field type arrays.
jannotti Jan 10, 2022
62eac10
bsqrt
jannotti Jan 11, 2022
a934729
acct_holding_get, a unified opcode for account field access
jannotti Jan 12, 2022
55df8a5
Thanks, dawg
jannotti Jan 12, 2022
e19fafb
[Other] CircleCI pipeline change for binary uploads (#3381)
algobarb Jan 12, 2022
3904ed8
signer.KeyDilution need not depend on config package (#3265)
algonautshant Jan 12, 2022
4323612
CR and more spec simplification
jannotti Jan 13, 2022
a1edadc
algodump is a tcpdump-like tool for algod's network protocol (#3166)
zeldovich Jan 13, 2022
326d04a
Removing C/crypto dependencies from `data/abi` package (#3375)
ahangsu Jan 13, 2022
ee988ea
Feature Networks pipeline related changes (#3393)
algojack Jan 13, 2022
4611691
e2e test for inner transaction appls
jannotti Jan 14, 2022
f864f9e
testing: Add slightly more coverage to TestAcctUpdatesLookupRetry (#3…
cce Jan 14, 2022
9d07369
add context to (most) agreement logged writes (#3411)
tsachiherman Jan 14, 2022
4006ce2
network: faster node shutdown (#3416)
tsachiherman Jan 14, 2022
e5194d2
Give max group size * 16 inner txns, regardless of apps present
jannotti Jan 14, 2022
52bbe2b
Merge branch 'algorand:feature/contract-to-contract' into feature/con…
jannotti Jan 14, 2022
728240d
Adjust test for allowing 256 inners
jannotti Jan 18, 2022
b7b89c3
Merge remote-tracking branch 'origin/feature/contract-to-contract' in…
jannotti Jan 18, 2022
b142797
Merge branch 'master' into feature/contract-to-contract
jannotti Jan 18, 2022
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 agreement/demux.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (d *demux) tokenizeMessages(ctx context.Context, net Network, tag protocol.

o, err := tokenize(raw.Data)
if err != nil {
logging.Base().Warnf("disconnecting from peer: error decoding message tagged %v: %v", tag, err)
d.log.Warnf("disconnecting from peer: error decoding message tagged %v: %v", tag, err)
net.Disconnect(raw.MessageHandle)
d.UpdateEventsQueue(eventQueueTokenizing[tag], 0)
continue
Expand Down
12 changes: 4 additions & 8 deletions agreement/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

package agreement

import (
"github.com/algorand/go-algorand/logging"
)

// A listener is a state machine which can handle events, returning new events.
type listener interface {
// T returns the stateMachineTag describing the listener.
Expand Down Expand Up @@ -60,17 +56,17 @@ func (l checkedListener) handle(r routerHandle, p player, in event) event {
errs := l.pre(p, in)
if len(errs) != 0 {
for _, err := range errs {
logging.Base().Errorf("%v: precondition violated: %v", l.T(), err)
r.t.log.Errorf("%v: precondition violated: %v", l.T(), err)
}
logging.Base().Panicf("%v: precondition violated: %v", l.T(), errs[0])
r.t.log.Panicf("%v: precondition violated: %v", l.T(), errs[0])
}
out := l.listener.handle(r, p, in)
errs = l.post(p, in, out)
if len(errs) != 0 {
for _, err := range errs {
logging.Base().Errorf("%v: postcondition violated: %v", l.T(), err)
r.t.log.Errorf("%v: postcondition violated: %v", l.T(), err)
}
logging.Base().Panicf("%v: postcondition violated: %v", l.T(), errs[0])
r.t.log.Panicf("%v: postcondition violated: %v", l.T(), errs[0])
}
return out
}
24 changes: 12 additions & 12 deletions agreement/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ func persist(log serviceLogger, crash db.Accessor, Round basics.Round, Period pe
return
}

logging.Base().Errorf("persisting failure: %v", err)
log.Errorf("persisting failure: %v", err)
return
}

// reset deletes the existing recovery state from database.
//
// In case it's unable to clear the Service table, an error would get logged.
func reset(log logging.Logger, crash db.Accessor) {
logging.Base().Infof("reset (agreement): resetting crash state")
log.Infof("reset (agreement): resetting crash state")

err := crash.Atomic(func(ctx context.Context, tx *sql.Tx) (err error) {
// we could not retrieve our state, so wipe it
Expand All @@ -99,7 +99,7 @@ func reset(log logging.Logger, crash db.Accessor) {
})

if err != nil {
logging.Base().Warnf("reset (agreement): failed to clear Service table - %v", err)
log.Warnf("reset (agreement): failed to clear Service table - %v", err)
}
}

Expand All @@ -124,7 +124,7 @@ func restore(log logging.Logger, crash db.Accessor) (raw []byte, err error) {
if err == nil {
// the above call was completed sucecssfully, which means that we've just created the table ( which wasn't there ! ).
// in that case, the table is guaranteed to be empty, and therefore we can return right here.
logging.Base().Infof("restore (agreement): crash state table initialized")
log.Infof("restore (agreement): crash state table initialized")
err = errNoCrashStateAvailable
return
}
Expand All @@ -135,7 +135,7 @@ func restore(log logging.Logger, crash db.Accessor) (raw []byte, err error) {
if !reset {
return
}
logging.Base().Infof("restore (agreement): resetting crash state")
log.Infof("restore (agreement): resetting crash state")

// we could not retrieve our state, so wipe it
_, err = tx.Exec("delete from Service")
Expand All @@ -149,12 +149,12 @@ func restore(log logging.Logger, crash db.Accessor) (raw []byte, err error) {
row := tx.QueryRow("select count(*) from Service")
err := row.Scan(&nrows)
if err != nil {
logging.Base().Errorf("restore (agreement): could not query raw state: %v", err)
log.Errorf("restore (agreement): could not query raw state: %v", err)
reset = true
return err
}
if nrows != 1 {
logging.Base().Infof("restore (agreement): crash state not found (n = %d)", nrows)
log.Infof("restore (agreement): crash state not found (n = %d)", nrows)
reset = true
noCrashState = true // this is a normal case (we have leftover crash state from an old round)
return errNoCrashStateAvailable
Expand All @@ -163,7 +163,7 @@ func restore(log logging.Logger, crash db.Accessor) (raw []byte, err error) {
row = tx.QueryRow("select data from Service")
err = row.Scan(&raw)
if err != nil {
logging.Base().Errorf("restore (agreement): could not read crash state raw data: %v", err)
log.Errorf("restore (agreement): could not read crash state raw data: %v", err)
reset = true
return err
}
Expand All @@ -176,7 +176,7 @@ func restore(log logging.Logger, crash db.Accessor) (raw []byte, err error) {
// decode process the incoming raw bytes array and attempt to reconstruct the agreement state objects.
//
// In all decoding errors, it returns the error code in err
func decode(raw []byte, t0 timers.Clock) (t timers.Clock, rr rootRouter, p player, a []action, err error) {
func decode(raw []byte, t0 timers.Clock, log serviceLogger) (t timers.Clock, rr rootRouter, p player, a []action, err error) {
var t2 timers.Clock
var rr2 rootRouter
var p2 player
Expand All @@ -185,7 +185,7 @@ func decode(raw []byte, t0 timers.Clock) (t timers.Clock, rr rootRouter, p playe

err = protocol.DecodeReflect(raw, &s)
if err != nil {
logging.Base().Errorf("decode (agreement): error decoding retrieved state (len = %v): %v", len(raw), err)
log.Errorf("decode (agreement): error decoding retrieved state (len = %v): %v", len(raw), err)
return
}

Expand Down Expand Up @@ -307,9 +307,9 @@ func (p *asyncPersistenceLoop) loop(ctx context.Context) {
// sanity check; we check it after the fact, since it's not expected to ever happen.
// performance-wise, it takes approximitly 300000ns to execute, and we don't want it to
// block the persist operation.
_, _, _, _, derr := decode(s.raw, s.clock)
_, _, _, _, derr := decode(s.raw, s.clock, p.log)
if derr != nil {
logging.Base().Errorf("could not decode own encoded disk state: %v", derr)
p.log.Errorf("could not decode own encoded disk state: %v", derr)
}
}
}
7 changes: 4 additions & 3 deletions agreement/persistence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func TestAgreementSerialization(t *testing.T) {
encodedBytes := encode(clock, router, status, a)

t0 := timers.MakeMonotonicClock(time.Date(2000, 0, 0, 0, 0, 0, 0, time.UTC))
clock2, router2, status2, a2, err := decode(encodedBytes, t0)
log := makeServiceLogger(logging.Base())
clock2, router2, status2, a2, err := decode(encodedBytes, t0, log)
require.NoError(t, err)
require.Equalf(t, clock, clock2, "Clock wasn't serialized/deserialized correctly")
require.Equalf(t, router, router2, "Router wasn't serialized/deserialized correctly")
Expand Down Expand Up @@ -77,10 +78,10 @@ func BenchmarkAgreementDeserialization(b *testing.B) {

encodedBytes := encode(clock, router, status, a)
t0 := timers.MakeMonotonicClock(time.Date(2000, 0, 0, 0, 0, 0, 0, time.UTC))

log := makeServiceLogger(logging.Base())
b.ResetTimer()
for n := 0; n < b.N; n++ {
decode(encodedBytes, t0)
decode(encodedBytes, t0, log)
}
}

Expand Down
4 changes: 1 addition & 3 deletions agreement/proposalManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package agreement

import (
"fmt"

"github.com/algorand/go-algorand/logging"
)

// A proposalManager is a proposalMachine which applies relay rules to incoming
Expand Down Expand Up @@ -71,7 +69,7 @@ func (m *proposalManager) handle(r routerHandle, p player, e event) event {
r = m.handleNewPeriod(r, p, e.(thresholdEvent))
return emptyEvent{}
}
logging.Base().Panicf("proposalManager: bad event type: observed an event of type %v", e.t())
r.t.log.Panicf("proposalManager: bad event type: observed an event of type %v", e.t())
panic("not reached")
}

Expand Down
6 changes: 2 additions & 4 deletions agreement/proposalStore.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package agreement

import (
"fmt"

"github.com/algorand/go-algorand/logging"
)

// An blockAssembler contains the proposal data associated with some
Expand Down Expand Up @@ -289,7 +287,7 @@ func (store *proposalStore) handle(r routerHandle, p player, e event) event {
case newRound:
if len(store.Assemblers) > 1 {
// TODO this check is really an implementation invariant; move it into a whitebox test
logging.Base().Panic("too many assemblers")
r.t.log.Panic("too many assemblers")
}
for pv, ea := range store.Assemblers {
if ea.Filled {
Expand Down Expand Up @@ -347,7 +345,7 @@ func (store *proposalStore) handle(r routerHandle, p player, e event) event {
se.Payload = ea.Payload
return se
}
logging.Base().Panicf("proposalStore: bad event type: observed an event of type %v", e.t())
r.t.log.Panicf("proposalStore: bad event type: observed an event of type %v", e.t())
panic("not reached")
}

Expand Down
3 changes: 1 addition & 2 deletions agreement/proposalTracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"

"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/logging"
)

// A proposalSeeker finds the vote with the lowest credential until freeze() is
Expand Down Expand Up @@ -180,7 +179,7 @@ func (t *proposalTracker) handle(r routerHandle, p player, e event) event {
return se
}

logging.Base().Panicf("proposalTracker: bad event type: observed an event of type %v", e.t())
r.t.log.Panicf("proposalTracker: bad event type: observed an event of type %v", e.t())
panic("not reached")
}

Expand Down
1 change: 0 additions & 1 deletion agreement/pseudonode.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ func (t pseudonodeProposalsTask) execute(verifier *AsyncVoteVerifier, quit chan

payloads, votes := t.node.makeProposals(t.round, t.period, t.participation)
fields := logging.Fields{
"Context": "Agreement",
"Type": logspec.ProposalAssembled.String(),
"ObjectRound": t.round,
"ObjectPeriod": t.period,
Expand Down
4 changes: 2 additions & 2 deletions agreement/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func MakeService(p Parameters) *Service {

s.parameters = parameters(p)

s.log = serviceLogger{Logger: p.Logger}
s.log = makeServiceLogger(p.Logger)

// GOAL2-541: tracer is not concurrency safe. It should only ever be
// accessed by main state machine loop.
Expand Down Expand Up @@ -191,7 +191,7 @@ func (s *Service) mainLoop(input <-chan externalEvent, output chan<- []action, r
var err error
raw, err := restore(s.log, s.Accessor)
if err == nil {
clock, router, status, a, err = decode(raw, s.Clock)
clock, router, status, a, err = decode(raw, s.Clock, s.log)
if err != nil {
reset(s.log, s.Accessor)
} else {
Expand Down
5 changes: 4 additions & 1 deletion agreement/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,12 @@ type serviceLogger struct {
logging.Logger
}

func makeServiceLogger(log logging.Logger) serviceLogger {
return serviceLogger{log.With("Context", "Agreement")}
}

func (log serviceLogger) with(e logspec.AgreementEvent) serviceLogger {
fields := logging.Fields{
"Context": "Agreement",
"Type": e.Type.String(),
"Round": e.Round,
"Period": e.Period,
Expand Down
7 changes: 3 additions & 4 deletions agreement/voteAggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package agreement
import (
"fmt"

"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
)

Expand Down Expand Up @@ -118,7 +117,7 @@ func (agg *voteAggregator) handle(r routerHandle, pr player, em event) (res even
} else if tE.(thresholdEvent).Round == e.FreshnessData.PlayerRound+1 {
return emptyEvent{}
}
logging.Base().Panicf("bad round (%v, %v)", tE.(thresholdEvent).Round, e.FreshnessData.PlayerRound) // TODO this should be a postcondition check; move it
r.t.log.Panicf("bad round (%v, %v)", tE.(thresholdEvent).Round, e.FreshnessData.PlayerRound) // TODO this should be a postcondition check; move it

case bundlePresent:
ub := e.Input.UnauthenticatedBundle
Expand Down Expand Up @@ -180,7 +179,7 @@ func (agg *voteAggregator) handle(r routerHandle, pr player, em event) (res even
smErr := makeSerErrf("bundle for (%v, %v, %v: %v) failed to cause a significant state change", b.U.Round, b.U.Period, b.U.Step, b.U.Proposal)
return filteredEvent{T: bundleFiltered, Err: smErr}
}
logging.Base().Panicf("voteAggregator: bad event type: observed an event of type %v", e.t())
r.t.log.Panicf("voteAggregator: bad event type: observed an event of type %v", e.t())
panic("not reached")
}

Expand All @@ -200,7 +199,7 @@ func (agg *voteAggregator) filterVote(proto protocol.ConsensusVersion, p player,
case none:
return nil
}
logging.Base().Panicf("voteAggregator: bad event type: while filtering, observed an event of type %v", filterRes.t())
r.t.log.Panicf("voteAggregator: bad event type: while filtering, observed an event of type %v", filterRes.t())
panic("not reached")
}

Expand Down
8 changes: 2 additions & 6 deletions agreement/voteAuxiliary.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

package agreement

import (
"github.com/algorand/go-algorand/logging"
)

// A voteTrackerPeriod is a voteMachinePeriod which indicates whether a
// next-threshold of votes was observed for a some value in a period.
type voteTrackerPeriod struct {
Expand Down Expand Up @@ -82,7 +78,7 @@ func (t *voteTrackerPeriod) handle(r routerHandle, p player, e event) event {
case nextThresholdStatusRequest:
return t.Cached
default:
logging.Base().Panicf("voteTrackerPeriod: bad event type: observed an event of type %v", e.t())
r.t.log.Panicf("voteTrackerPeriod: bad event type: observed an event of type %v", e.t())
panic("not reached")
}
}
Expand Down Expand Up @@ -152,7 +148,7 @@ func (t *voteTrackerRound) handle(r routerHandle, p player, e event) event {
case freshestBundleRequest:
return freshestBundleEvent{Ok: t.Ok, Event: t.Freshest}
default:
logging.Base().Panicf("voteTrackerRound: bad event type: observed an event of type %v", e.t())
r.t.log.Panicf("voteTrackerRound: bad event type: observed an event of type %v", e.t())
panic("not reached")
}
}
Loading