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

go-algorand 3.0.1-stable #2949

Merged
merged 52 commits into from
Sep 27, 2021
Merged

go-algorand 3.0.1-stable #2949

merged 52 commits into from
Sep 27, 2021

Conversation

Algo-devops-service
Copy link
Contributor

@Algo-devops-service Algo-devops-service commented Sep 24, 2021

GitHub Logo

IMPORTANT
This release requires a protocol upgrade.
This release contains a consensus protocol upgrade, which implements the following spec: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c

Highlights

This release features the 1.0 version of AVM, extending Algorand's smart contract capabilities for even greater composability. Highlights in this release include:

  • Application transactions: the ability for smart contracts to execute transactions on directly on chain.
  • App cost pooling: larger contract size, by combining the budgets across an application group.
  • Increased account smart contract limit to 50
  • More smart contract opcodes to improve composability (inner transaction references, verify ECDSA, log, and others)
  • Debugging for itxn programs and include a bugfix for dryrun crashes.

Changes

  1. AVM
  2. Goal
  3. TEAL
  4. Ledger
  5. Network
  6. Tools
  7. Tests
  8. Other

Additional Resources

algorandskiy and others added 30 commits August 13, 2021 14:05
Treat LogCalls similarly to Eval Deltas with respect to encoding limits.
This PR addresses several different behaviors of pingpong that doesn't align (anymore) with it's usage:
1. during asset testing, avoid creating assets for the source account - this would generate failures on subsequent iterations.
2. for asset testing, ensure we have sufficient asset supply for the entire rebalancing period.
3. refactor the waiting for next round using a single `waitForNextRoundOrSleep` method.
4. generate an error when the number of created assets per account surpass the expected value.
5. when distributing assets, avoid using the `pps.constructTxn` method, as it's randomly select source/destination. instead, assemble the transaction explicitly.
6. `sendAsGroup` was much simplified by passing the explicit account. The non-possible error cases were removed.
7. in `prepareApps`, applications are compiled only once.
8. the`senders` slice in `prepareApps` should have been reset. It wouldn't work correctly without it.
9. The pingpong logic of sendFromTo was changed -
     instead of sending traffic, rebalancing and sending traffic again, we calculate the pessimistic remaining balance on each of the accounts. A background go-routine would update all these account. Once the balance on 20% of the accounts drops below the desired level, we attempt to rebalance them. In addition, in 50% of the cases, the pingpong would pick an account that has a low balance as the recipient of the transaction.
    This model allow much longer runs without rebalancing actions takes place, resulting in a more precise and consistent transaction generation.
10. precise rate control. The rate control was improved to ensure we generate transactions at a constant rate, with a 20ms wiggling temporal buffer.
11. a `constructPayment` was created to replace the libgoal `ConstructPayment`. The difference is in the source of the getSuggestedParams`, which are refreshed by the monitoring go-routine. This reduces unneeded communication between pingpong and the node.
12. fix some of the allocated funding balances for applications - making sure that we account for the setup costs, so that we won't run out of funds between rebalancing.
fixing a typo in e2e.sh for integration tests
## Summary

With this PR, the commands `goal app info`, `goal account info`, and `goal account list --info` now display the number of extra pages an application has.

For example, the following were executed on a private network where apps 1, 2, 3, 4 have 1, 2, 3, 0 extra pages, respectively.
```
$ goal app info --app-id 3 -d DATA_DIR
Application ID:        3
Creator:               U4SKWGT6KYRA3DCMVPJLMMMNCP35UOYBFMQLEHLYDHO4C4N7GU7LLNQUHU
Approval hash:         Q7ODX32ILHMGO6KPSELVTO7RCVOUZ37RWYHISAWER7GVARJGKTWEWD37AM
Clear hash:            P7GEWDXXW5IONRW6XRIRVPJCT2XXEQGOBGG65VJPBUOYZEJCBZWTPHS3VQ
Extra program pages:   3
Max global byteslices: 2
Max global integers:   1
Max local byteslices:  4
Max local integers:    3
```

```
$ goal account info -a U4SKWGT6KYRA3DCMVPJLMMMNCP35UOYBFMQLEHLYDHO4C4N7GU7LLNQUHU -d DATA_DIR
Created Assets:
        <none>
Held Assets:
        <none>
Created Apps:
        ID 1, 1 extra page, global state used 0/1 uints, 0/2 byte slices
        ID 2, 2 extra pages, global state used 0/1 uints, 0/2 byte slices
        ID 3, 3 extra pages, global state used 0/1 uints, 0/2 byte slices
        ID 4, global state used 0/1 uints, 0/2 byte slices
Opted In Apps:
        <none>
```

```
$ goal account list --info -d DATA_DIR
[offline]       EHF6QYU3HCUUXIZAMPJ5RZWNDT37Y72NHVZ4XHWMYILPXWVU7G2G4PX32I   EHF6QYU3HCUUXIZAMPJ5RZWNDT37Y72NHVZ4XHWMYILPXWVU7G2G4PX32I   4000024000000000 microAlgos
Created Assets:
...
[offline]       U4SKWGT6KYRA3DCMVPJLMMMNCP35UOYBFMQLEHLYDHO4C4N7GU7LLNQUHU   U4SKWGT6KYRA3DCMVPJLMMMNCP35UOYBFMQLEHLYDHO4C4N7GU7LLNQUHU   1000006000004997 microAlgos     [created app IDs: 1, 2, 3, 4]
Created Assets:
        <none>
Held Assets:
        <none>
Created Apps:
        ID 1, 1 extra page, global state used 0/1 uints, 0/2 byte slices
        ID 2, 2 extra pages, global state used 0/1 uints, 0/2 byte slices
        ID 3, 3 extra pages, global state used 0/1 uints, 0/2 byte slices
        ID 4, global state used 0/1 uints, 0/2 byte slices
Opted In Apps:
        <none>
```

## Test Plan

Modified existing e2e test and expect test. (I know expect tests aren't currently running, but it passed locally.)
<!--
Thanks for submitting a pull request! We appreciate the time and effort you spent to get this far.

If you haven't already, please make sure that you've reviewed the CONTRIBUTING guide:
https://github.com/algorand/go-algorand/blob/master/CONTRIBUTING.md#code-guidelines

In particular ensure that you've run the following:
* make generate
* make sanity (which runs make fmt, make lint, make fix and make vet)

It is also a good idea to run tests:
* make test
* make integration
-->

## Summary
A user reported a strange and not very helpful error message. This was due to incomplete error handling in the bash script relating to a truncated `updater` binary.

The current workaround for this is to delete the `updater` binary and trigger `update.sh` to re-download it, but this is not obvious and I wouldn't expect any user to reach that conclusion.

This fix adds error handling in case `updater` fails and should fix this particular failure.

Here is the error message:
```
Current Version = 8590458880
Latest Version =
./update.sh: line 250: [: 8590458880: unary operator expected
New version found
Update Downloaded to /tmp/tmp.QlV71NLGFr/.tar.gz
Expanding update...
tar (child): /tmp/tmp.QlV71NLGFr/.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
*** UPDATE FAILED: Error expanding update ***
```
## Test Plan

Ran some tests against a directory, empty file, and regular file in my shell:
```
will@arendelle:~/go/src/github.com/algorand/go-algorand/cmd/updater$ [[ -f dir && -s dir ]]
will@arendelle:~/go/src/github.com/algorand/go-algorand/cmd/updater$ echo $?
1
will@arendelle:~/go/src/github.com/algorand/go-algorand/cmd/updater$ [[ -f empty && -s empty ]]
will@arendelle:~/go/src/github.com/algorand/go-algorand/cmd/updater$ echo $?
1
will@arendelle:~/go/src/github.com/algorand/go-algorand/cmd/updater$ [[ -f util.go && -s util.go ]]
will@arendelle:~/go/src/github.com/algorand/go-algorand/cmd/updater$ echo $?
0
```
Codegen verification step is now being run by CircleCI, so it's no longer necessary to run it on Travis, especially since we recently got a `toomanyrequests: You have reached your pull rate limit.` docker error. We want to reduce unnecessary docker requests.
parametrize account balance range for bootstrapping testing scenario.
ParseHostOrURL does not accepts ":xxx:123" anymore
pingpongTest.exp is still disabled
Add comments for protocol hash IDs and tags
The number of buckets in verifiedTransactionCache can be arbitrarily large depending on the requested cache size, and each lookup in the cache does that many map lookups. This PR limits the number of buckets to 3. Now, the lookup takes at most 3 lookups and the size overhead is 1.5.
When creating large networks with bootstrapped databases ( 60m accounts ), the netgoal was failing due to a false-positive deadlock detection. Given that the netgoal is a testing utility, it would be better to turn off these false-positives testing off netgoal.
Status code differs on CircleCI. Relaxed the status code value check.
Change the skipped expect tests to be defined as "t.Skip" so we can track these as such on the log file.
fix e2e test TestStartAndStop
…2784)

This also unifies a lot of field handling so that the code is less
susceptible to copy-paste errors, but it has a ways to go. Hard to
both unify the handling of the different fields and use separate
types for each field index. Lots and lots of interfaces could do. Or
generics in 6 months? For the moment, each field type is a pile of
arrays and maps working together.

It's unclear what we gain from those separate index types, since
we always cast into the type just before using them, as we are
getting the indexes from reading a byte in bytecode.

New tests will catch this mistake if we make it again.
* After re-enabling we started seeing failures on other e2e-go tests
  due to unsufficient resources to allow algod making new rounds
* Possible solution is to run expect tests as a separate stage on CI
  go test ./test/e2e-go/cli/goal/expect/... -run TestGoalWithExpect
Disassemble was omitting labels if they were only used as targets of backjumps.

This fixes that, but making a second pass to find labels if any such labels exist in a program. It also changes testProg, which is used extensively to test programs in the logic package, so that every such test is a Disassemble/Reassemble test to ensure the same program is produced.
new scripts runNodeHost.py and nodeHostTarget.py manage starting a new ec2 node with algod (or several) pointed at a specific relay so that we can test per-client usage on that one relay.

improve goal: don't crash if kmd isn't present when we don't need it

tweaks to other heapWatch scripts for measuring this data.
Attempt to split expect tests into a 3rd category.

This changes the behavior of e2e_go_tests.sh. Previously it would run the e2e_go tests AND the EXPECT tests. Now it runs one or the other.
This PR adds a Cost Parameter to DryrunResponse. It is calculated by giving the evalParams object in dryrun.go the maximum budget allowed (maxappcost * maxgroupsize) and checking the difference after stateful evaluation. LogicSig dryruns will return cost of 0.
The current code creates an impression that the evaluator can be used for round 0 which is not true. This PR simplifies the code, so this is more evident.
Fix overriding consensus parameters in evaluator for indexer
Goal was not able to communicate with the Ledger Nano S device.
The device has two HID occurrences on the OS and after the firmware upgrade, one of them became not responsive. That made goal to the hang.

fixing the interaction with the Ledger devices (S and X) on the Windows platform.
* expose nonparticipation txn field in teal
* Increase max app opt ins to 50

* Fixed error check in new ledger testing harness
Allow AVM 1.0 programs to "execute transactions"

1. An app now has authority over an account which is the hash of its appid.
2. The app can create transactions with three new opcodes, tx_begin, tx_field, and tx_submit.
3. If the transaction so created would need to be authorized by that app account from 1, the effects occur.
4. Fees on inner transactions are paid from the app account, though overpaying at the top-level can be pooled.

So far, only pay and axfer are allowed. acfg and afrz are under consideration, but have separate issues written.

This makes ApplyData a recursive datastructure, so that the "inner" transactions of app calls can be encoded in EvalDelta and, themselves, have ApplyData.
jannotti and others added 19 commits September 7, 2021 11:48
…2840)

Intended to just increase coverage in AVM, but doing so found a
bug. (Go figure.)  tx_field should only allow actual addresses for
address fields, rather than low integers as references from the
Account array.
… API (#2836)

This is a follow up to #2661. It adds the app account address to the goal app info command, and it changes the log item type format in the REST API to "byte" in order to show that it's binary data. As a bonus, the encoder will automatically convert to base64 for us.
Drive the checking of whether tx_field can set a particular field in a table-driven way, rather than by simple switch. This is cleaner as we add functionality in later versions, and will allow generating the spec for tx_field.
Our partitioned tests might be skipping tests or running them twice. Here we want to make sure they don't do that.
loads and stores opcodes that take scratch slot from stack
When multiple threads use the synchTest object, and one fails, all
call FailNow.

After the first call, the main test routine reads t.finished to
terminate the test.

While the main test routine is reading t.finished, another thread
calls FailNow, which in turn writes to t.finished, causing the data
race.

While FailNow called from synchTest are guarded by a mutex, the main
testing object has the TestingTB object, which does not use the same
mutex.

The solution is to call FailNow from synchTest object only the first
time.

* When multiple threads use the synchTest object, and one fails, all
call FailNow.

After the first call, the main test routine reads t.finished to
terminate the test.

While the main test routine is reading t.finished, another thread
calls FailNow, which in turn writes to t.finished, causing the data
race.

While FailNow called from synchTest are guarded by a mutex, the main
testing object has the TestingTB object, which does not use the same
mutex.

The solution is to call FailNow from synchTest object only the first
time.
* Add secp256k1 module from go-ethereum 1.10.7

* ECDSA secp256k1 implementation

Cost calculated relative to ed25519verify

BenchmarkEcDsa/ecdsa_verify-8              17341             67335 ns/op
BenchmarkEcDsa/ecdsa_pk_decompress-8       42854             25714 ns/op
BenchmarkEcDsa/ecdsa_pk_recover-8          15337             78249 ns/op
BenchmarkEd25519Verifyx1-8         15244             75253 ns/op
Indexer needs to know all accounts referenced in a block to be able to read all of them in one batch. This PR creates a function that returns all such account addresses.
The auto-generated msgp test files were not up-to-date.

This PR updates these.
Updated the netgoal utility to only create one wallet per non-participating node to better concentrate Algos for use by pingpong.
Increment TxnCounter with inner transactions

acfg and afrz inner transactions

This also sorts out inner txcounting, so that an innner transaction
knows the current txncount as it executes, so it can get the right id
if it creates.


Co-authored-by: Jason Paulos <[email protected]>
Rename extractXXbits, add small spec updates.
Since the merge of #2852 go mod tidy and go mod vendor see paths in github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1 as a dependency, and go mod tidy adds it to go.mod.
This commit makes consensus parameter changes for V30.

v30 introduces AVM 1.0 and TEAL 5, increases the app opt in limit to 50, and allows costs to be pooled in grouped stateful transactions.
![GitHub Logo](https://raw.githubusercontent.com/algorand/go-algorand/master/release/release-banner.jpg)




# Highlights

This version adds debugging for itxn programs and includes a bugfix for dryrun crashes. 
**This release does not contain a protocol upgrade.**

# Changes

1. TEAL
    * Added
        * Enable debugging itxn programs (#2900)
    * Fixed
        * Fix dryrun crash on rewards calculation (#2894)

## Additional Resources
* [Algorand Forum](https://forum.algorand.org)
* [Developer Documentation](https://developer.algorand.org)
@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2021

Codecov Report

Merging #2949 (d279007) into rel/stable (d1aca92) will increase coverage by 0.21%.
The diff coverage is 14.82%.

Impacted file tree graph

@@              Coverage Diff               @@
##           rel/stable    #2949      +/-   ##
==============================================
+ Coverage       47.10%   47.32%   +0.21%     
==============================================
  Files             349      355       +6     
  Lines           56351    57182     +831     
==============================================
+ Hits            26544    27059     +515     
- Misses          26831    27069     +238     
- Partials         2976     3054      +78     
Impacted Files Coverage Δ
cmd/algoh/main.go 0.00% <0.00%> (ø)
cmd/goal/account.go 14.32% <0.00%> (-0.46%) ⬇️
cmd/goal/accountsList.go 0.00% <0.00%> (ø)
cmd/goal/application.go 12.77% <0.00%> (-0.10%) ⬇️
cmd/goal/clerk.go 9.11% <0.00%> (-0.03%) ⬇️
cmd/goal/commands.go 10.81% <0.00%> (-0.26%) ⬇️
config/version.go 9.09% <ø> (ø)
crypto/secp256k1/panic_cb.go 0.00% <ø> (ø)
crypto/secp256k1/scalar_mult_cgo.go 77.77% <ø> (ø)
crypto/secp256k1/secp256.go 42.25% <ø> (ø)
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1aca92...d279007. Read the comment docs.

@algojack algojack self-assigned this Sep 24, 2021
@algojack algojack marked this pull request as ready for review September 24, 2021 19:53
@algojohnlee algojohnlee merged commit b619b94 into algorand:rel/stable Sep 27, 2021
PhearZero pushed a commit to PhearNet/crypto that referenced this pull request Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.