-
Notifications
You must be signed in to change notification settings - Fork 490
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
simulate: fix signers #5942
simulate: fix signers #5942
Conversation
@jasonpaulos let me know what you think about this general approach. If it looks good, I can work on the endpoint and more tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The direction makes sense to me. This will need extensive testing.
What are you thinking about for how to enable this? At the moment my preference would be a boolean alongside AllowEmptySignatures
, which you'd only be allowed to set if AllowEmptySignatures
is also set
@jasonpaulos this comment in the test you initially wrote got me thinking... Should we expect the transaction group to be modified in the response? Is there any precedent for this? I feel like there is value in seeing the txn group as it was given and also seeing what was modified. Perhaps an additional field that indicates a changed signer per txn, but the actual transaction object remains unchanged? |
Also I'm switching from the terminology "fix auth addr" to "fix signer" to avoid confusion between the auth addr for a given account in the ledger and the signer for the transaction, making it clear the ledger remains unchanged and its just txns that are getting modified. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5942 +/- ##
==========================================
- Coverage 55.86% 55.85% -0.02%
==========================================
Files 482 482
Lines 68475 68538 +63
==========================================
+ Hits 38253 38280 +27
- Misses 27620 27646 +26
- Partials 2602 2612 +10 ☔ View full report in Codecov by Sentry. |
I agree that it would be preferable to not modify the transactions as given, and instead provide an additional response field with the overridden signer. The only problem is that the response structure may make it difficult to associate this additional information with inner transactions. |
Unless you are thinking of functionality that I am not, we're only modifying the signers on the outer transactions, so we only need to add additional information to the outers. |
Good point, this plan should have no problems then |
@jasonpaulos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, but I left a few asks and I made this sub-PR with mostly test changes: joe-p#3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM one small suggestion
Co-authored-by: Pavel Zbitskiy <65323360+algorandskiy@users.noreply.github.com>
a3c6d9f
to
cf0272f
Compare
Thanks @algorandskiy. Apologies for the force push. Fixed a typo in the commit message and didn't realize it would dismiss @jasonpaulos review status |
Remove custom `makeEmptyTransactionSigner` implementation and `AuthAddressProvider` since algosdk now correctly handles simulate calls from rekeyed accounts. This was originally added as a workaround in #89 but is no longer needed after algorand/go-algorand#5942.
* feat(deps): upgrade to algosdk v3 and algokit-utils v8 Migrate to latest versions of core dependencies: - algosdk v3 - @algorandfoundation/algokit-utils v8 - @txnlab/use-wallet-react v4 Update code to use new APIs: - Use `toString()` for address handling - Update types to use `algosdk.modelsv2.*` - Refactor balance calculations to use `BigInt` - Update transaction signing and simulation interfaces * chore(contracts): Convert account addresses to strings in test assertions for algosdk v3 changes. Also update to latest algokit-client-generator and commit latest generated clients * fix(tests): update fixture data to match Algorand REST API format Update test fixtures and interfaces to match the actual Algorand REST API format rather than the SDK v3 types. While migrating to algosdk v3.0.0, the mock data should continue using kebab-case and JSON format as returned by the REST API. Also fix `Application` approval/clear program properties in fixtures to use base64 strings instead of Uint8Arrays to match actual node responses. * refactor(boxes): remove redundant BigInt conversion and sort imports - Remove redundant `BigInt` conversion since `entryRound` is already a bigint type - Fix import sort order * refactor(ui): remove rekeyed account simulate workaround Remove custom `makeEmptyTransactionSigner` implementation and `AuthAddressProvider` since algosdk now correctly handles simulate calls from rekeyed accounts. This was originally added as a workaround in #89 but is no longer needed after algorand/go-algorand#5942. * fix(ui): update simulate params to use skipSignatures Remove `makeEmptyTransactionSigner` in favor of `skipSignatures` flag for simulate transactions. This aligns with updated algosdk best practices for handling simulate calls without signatures (from normal or rekeyed accounts). * chore(deps): Update dependencies to latest patch versions Upgraded @algorandfoundation/algokit-utils to 8.0.3 across all packages. Updated @algorandfoundation/algokit-client-generator to 4.0.6 and @algorandfoundation/tealscript to 0.106.1 in contracts for better compatibility * contracts: deployed betanet instance, updated checked-in app ids for the deploy. * chore(deps): Update dependencies to latest stable versions Updated multiple dependencies in go.mod and go.sum, including `go-algorand-sdk` to v2.7.0, `prometheus/client_golang` to v1.20.5, and `crypto` to v0.31.0. * chore(contracts): generated arc56 files no loner in draft form * chore(deps): update wallet dependencies - @blockshake/defly-connect from 1.1.6 to 1.2.1 - @perawallet/connect from 1.3.5 to 1.4.1 - @txnlab/use-wallet-react from 4.0.0-beta.2 to 4.0.0-beta.4 --------- Co-authored-by: Patrick Bennett <patrick+git@bennettfamily.org> Co-authored-by: Patrick Bennett <pbennett@users.noreply.github.com>
Summary
This is a new feature in simulate that will close #5914. Auth address correction is done is two places:
simulateWithTracer
the txn fields will be analyzed and auth addrs for txns will be updated past on previousrekeyTo
fieldsAfterProgram
the auth addr field for all txns up to the next app call will be correctedThis allows one to simulate with empty signatures without knowing the proper auth addresses when forming the group.
Test Plan
Simple test to ensure the endpoint works as expected in
test/e2e-go/restAPI/simulate/simulateRestAPI_test.go
and more comprehensive testing inledger/simulation/simulation_eval_test.go