Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cd116c0
The new inner appl fields
jannotti Oct 6, 2021
1f34627
Merge branch 'master' into inner-appl
jannotti Oct 7, 2021
088a724
Unit tests for field setting on appls
jannotti Oct 7, 2021
3b742fb
Construct EvalDelta in AVM rather than by inspecting ledger
jannotti Oct 21, 2021
bb4e0cd
Merge 'master' into inner-appl, adapt to ledger/internal mocks.
jannotti Oct 21, 2021
4797e9b
Obey the linter!
jannotti Oct 21, 2021
fc4455c
more LedgerForEvaluation accomodation
jannotti Oct 21, 2021
2ad431b
Test inner evaldeltas
jannotti Oct 26, 2021
5046b23
Checks on calling old AVM apps, or re-entrancy
jannotti Oct 27, 2021
6d80f94
Allow opcode budget to be added to by executing inner apps.
jannotti Oct 27, 2021
2fdee53
TxID and GroupID for inner transactions
jannotti Oct 28, 2021
a4e71f0
gitxn/gitxna
jannotti Oct 30, 2021
f81082c
Lint, spec generate
jannotti Oct 31, 2021
a9f66ae
Merge branch 'master' into inner-appl
jannotti Nov 1, 2021
566c840
txn simplifications
jannotti Nov 2, 2021
19fdabc
Encode "arrayness" in the txn field spec
jannotti Nov 2, 2021
8fdff9a
Pavel's CR comments
jannotti Nov 2, 2021
cc690fb
Update tests to distinguish assembly / eval errors
jannotti Nov 2, 2021
a64bd3b
Test itxn_field assembly separate from eval
jannotti Nov 2, 2021
b86e11f
factor out the array index parsing of all the txn assembly
jannotti Nov 2, 2021
3f348fd
Consistent errors and parsign for many opcodes
jannotti Nov 3, 2021
ff34b35
Cleanup immediate parsing, prep txn effects testing
jannotti Nov 3, 2021
4c2d6e5
EvalParams is now a single object used to evaluate each txn in turn.
jannotti Nov 17, 2021
d1efc26
Simplifications for the Dawg (the Review Dog)
jannotti Nov 18, 2021
099f843
Use a copy for the EvalParams.TxnGroup
jannotti Nov 18, 2021
1995986
Set the logicsig on txns in the GroupContext, so check() can see it
jannotti Nov 19, 2021
0f357e8
Update test for explicit empty check
jannotti Nov 19, 2021
9519f9a
Merge branch 'master' into inner-appl
jannotti Nov 19, 2021
d371ef2
Three new globals for to help contract-to-contract usability (#3237)
jannotti Nov 23, 2021
d28eca1
Gloadss (#3248)
jannotti Nov 24, 2021
bdf68f3
Feature/contract to contract (#3285)
jannotti Dec 16, 2021
bc11d24
add access to resources created in the current group (#3340)
jannotti Dec 28, 2021
50c025f
Feature/contract to contract (#3357)
jannotti Jan 7, 2022
ae1913a
Feature/contract to contract (#3389)
jannotti Jan 7, 2022
ef0fad7
Feature/contract to contract (#3390)
jannotti Jan 7, 2022
80dd665
Merge branch 'master' into feature/contract-to-contract
jannotti Jan 7, 2022
0dd28f2
Feature/c2c temp (#3392)
jannotti Jan 7, 2022
b385f6b
Feature/contract to contract (#3394)
jannotti Jan 7, 2022
4e717ce
Merge branch 'feature/contract-to-contract' of github.com:algorand/go…
jannotti Jan 7, 2022
d2594fb
Feature/contract to contract (#3395)
jannotti Jan 10, 2022
b70783e
Feature/contract to contract (#3401)
jannotti Jan 10, 2022
62469a2
Feature/contract to contract (#3402)
jannotti Jan 10, 2022
29269c3
Feature/contract to contract update (#3412)
bricerisingalgorand Jan 13, 2022
a4d9d71
c2c: bsqrt, acct_params_get (#3404)
jannotti Jan 14, 2022
593be3c
Feature/contract to contract (#3418)
algoidurovic Jan 14, 2022
a106e83
Allow 256 inners (#3422)
jannotti Jan 18, 2022
83bccc5
merge before audit (#3431)
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
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ workflows:
context:
- slack-secrets
- aws-secrets

#- windows_x64_build

commands:
Expand Down Expand Up @@ -478,11 +477,14 @@ commands:
- attach_workspace:
at: << parameters.build_dir >>
- run:
name: Upload binaries << parameters.platform >>
name: Upload Binaries << parameters.platform >>
command: |
if [ "${CIRCLE_BRANCH}" = "rel/nightly" ]
then
export NO_BUILD="true"
fi
export PATH=$(echo "$PATH" | sed -e "s|:${HOME}/\.go_workspace/bin||g" | sed -e 's|:/usr/local/go/bin||g')
export GOPATH="<< parameters.build_dir >>/go"
export NO_BUILD=true
export TRAVIS_BRANCH=${CIRCLE_BRANCH}
scripts/travis/deploy_packages.sh
- when:
Expand Down
1 change: 1 addition & 0 deletions THANKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A big thank you to everyone who has contributed to the `go-algorand` codebase.

### External Contributors
- aybehrouz
- fionnachan
- jeapostrophe
- jecassis
- jsign
Expand Down
2 changes: 1 addition & 1 deletion agreement/cryptoVerifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func makeUnauthenticatedVote(l Ledger, sender basics.Address, selection *crypto.

m, _ := membership(l, rv.Sender, rv.Round, rv.Period, rv.Step)
cred := committee.MakeCredential(&selection.SK, m.Selector)
ephID := basics.OneTimeIDForRound(rv.Round, voting.KeyDilution(config.Consensus[protocol.ConsensusCurrentVersion]))
ephID := basics.OneTimeIDForRound(rv.Round, voting.KeyDilution(config.Consensus[protocol.ConsensusCurrentVersion].DefaultKeyDilution))
sig := voting.Sign(ephID, rv)

return unauthenticatedVote{
Expand Down
20 changes: 2 additions & 18 deletions agreement/demux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"time"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/logging/logspec"
"github.com/algorand/go-algorand/protocol"
Expand Down Expand Up @@ -123,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 Expand Up @@ -236,22 +235,7 @@ func (d *demux) next(s *Service, deadline time.Duration, fastDeadline time.Durat

ledgerNextRoundCh := s.Ledger.Wait(nextRound)
deadlineCh := s.Clock.TimeoutAt(deadline)
var fastDeadlineCh <-chan time.Time

fastPartitionRecoveryEnabled := false
if proto, err := d.ledger.ConsensusVersion(ParamsRound(currentRound)); err != nil {
logging.Base().Warnf("demux: could not get consensus parameters for round %d: %v", ParamsRound(currentRound), err)
// this might happen during catchup, since the Ledger.Wait fires as soon as a new block is received by the ledger, which could be
// far before it's being committed. In these cases, it should be safe to default to the current consensus version. On subsequent
// iterations, it will get "corrected" since the ledger would finish flushing the blocks to disk.
fastPartitionRecoveryEnabled = config.Consensus[protocol.ConsensusCurrentVersion].FastPartitionRecovery
} else {
fastPartitionRecoveryEnabled = config.Consensus[proto].FastPartitionRecovery
}

if fastPartitionRecoveryEnabled {
fastDeadlineCh = s.Clock.TimeoutAt(fastDeadline)
}
fastDeadlineCh := s.Clock.TimeoutAt(fastDeadline)

d.UpdateEventsQueue(eventQueueDemux, 0)
d.monitor.dec(demuxCoserviceType)
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
3 changes: 3 additions & 0 deletions agreement/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ type unauthenticatedProposal struct {
OriginalProposer basics.Address `codec:"oprop"`
}

// TransmittedPayload exported for dumping textual versions of messages
type TransmittedPayload = transmittedPayload

// ToBeHashed implements the Hashable interface.
func (p unauthenticatedProposal) ToBeHashed() (protocol.HashID, []byte) {
return protocol.Payload, protocol.Encode(&p)
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
28 changes: 11 additions & 17 deletions agreement/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ type (
Proposals [2]proposalValue `codec:"props"`
Sigs [2]crypto.OneTimeSignature `codec:"sigs"`
}

// UnauthenticatedVote exported for dumping textual versions of messages
UnauthenticatedVote = unauthenticatedVote
)

// verify verifies that a vote that was received from the network is valid.
Expand Down Expand Up @@ -152,27 +155,18 @@ func makeVote(rv rawVote, voting crypto.OneTimeSigner, selection *crypto.VRFSecr
return unauthenticatedVote{}, fmt.Errorf("makeVote: could not get consensus params for round %d: %v", ParamsRound(rv.Round), err)
}

if proto.FastPartitionRecovery {
switch rv.Step {
case propose, soft, cert, late, redo:
if rv.Proposal == bottom {
logging.Base().Panicf("makeVote: votes from step %d cannot validate bottom", rv.Step)
}
case down:
if rv.Proposal != bottom {
logging.Base().Panicf("makeVote: votes from step %d must validate bottom", rv.Step)
}
switch rv.Step {
case propose, soft, cert, late, redo:
if rv.Proposal == bottom {
logging.Base().Panicf("makeVote: votes from step %d cannot validate bottom", rv.Step)
}
} else {
switch rv.Step {
case propose, soft, cert:
if rv.Proposal == bottom {
logging.Base().Panicf("makeVote: votes from step %d cannot validate bottom", rv.Step)
}
case down:
if rv.Proposal != bottom {
logging.Base().Panicf("makeVote: votes from step %d must validate bottom", rv.Step)
}
}

ephID := basics.OneTimeIDForRound(rv.Round, voting.KeyDilution(proto))
ephID := basics.OneTimeIDForRound(rv.Round, voting.KeyDilution(proto.DefaultKeyDilution))
sig := voting.Sign(ephID, rv)
if (sig == crypto.OneTimeSignature{}) {
return unauthenticatedVote{}, fmt.Errorf("makeVote: got back empty signature for vote")
Expand Down
Loading