-
Notifications
You must be signed in to change notification settings - Fork 87
Upgrades to support DeSo AMMs and CCV2 #609
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
Upgrades to support DeSo AMMs and CCV2 #609
Conversation
- Make `_getDAOCoinLimitOrderEntry` public so we can call it on a UtxoView from backend. - Add `buyingCoinPkid *PKID` and `sellingCoinPkid *PKID` to the call signature of `GetAllDAOCoinLimitOrdersForThisTransactor`. This allows you to get all the transactions for a particular transactor *by market*. Note that this change is SAFE because if you pass (nil, nil) for the new arguments then the behavior is *identical* to what it was previously. So it gives us the new functionality without any risk or any new indexes. - Add new tests for `GetAllDAOCoinLimitOrdersForThisTransactor` to make sure the new arguments actually work and upgrade old tests. - Add a public `IsDeleted` for `DAOCoinLimitOrderEntry`. This is needed to support filtering out unconfirmed orders in the backend, which is something new we added.
| _AddInternalServerError(ww, fmt.Sprintf("GetDAOCoinLimitOrders: Problem fetching utxoView: %v", err)) | ||
| return | ||
| } | ||
| if txnStatus == TxnStatusConfirmed { |
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.
Can we move the logic to get a utxo view to a separate helper function? Basically just take in a Boolean - something like getUtxoView(uncommitted bool) or maybe a different name. I would also recommend using the GetCommittedTipView function on blockchain since it's really clear what's happening, need to check if it's public tho.
| } | ||
|
|
||
| // If they requested a specific set of OrderIds then fetch them directly | ||
| if len(requestData.OrderIds) > 0 { |
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.
This kinda feels like we're overloading this endpoint now. Any reason we can't break it into a separate one?
| continue | ||
| } | ||
| orderRes, err := buildDAOCoinLimitOrderResponse( | ||
| lib.Base58CheckEncode(orderEntry.TransactorPKID[:], false, fes.Params), |
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.
We need to look up the public keys for these PKIDs. If something had a swap identity, this would lead to unexpected behavior.
| txnStatus := requestData.TxnStatus | ||
| if txnStatus == "" { | ||
| txnStatus = TxnStatusUnconfirmed | ||
| } else if txnStatus != TxnStatusUnconfirmed && |
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.
| } else if txnStatus != TxnStatusUnconfirmed && | |
| } | |
| if txnStatus != TxnStatusUnconfirmed && |
| } | ||
| var buyingCoinPkid *lib.PKID | ||
| if requestData.BuyingCoinPublicKeyBase58Check != "" { | ||
| if IsDesoPkid(requestData.BuyingCoinPublicKeyBase58Check) { |
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.
We could probably just simplify to setting buyingCoin to zero PKID and then just have an if !IsDesoPkid condition. Also maybe we refactor this into a helper function so that the logic of getting a PKID from a public key base 58 check that may be "deso" is all in one place and easily reused everywhere.
| TxnStatusConfirmed TxnStatus = "confirmed" | ||
| // TODO: It would be useful to have one that is "InBlock" or something like that, which | ||
| // means we'll consider txns that are in unconfirmed blocks but will *not* consider txns | ||
| // that are in the mempool. It's a kindof middle-ground. |
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.
Yeah this is a good to do and part of the reason I think creating a helper utility for getting the view makes sense such that we can introduce this functionality later. It's actually not too challenging to do an "in block" thing since we have a "get uncommitted tip view" function already on blockchain.
| type TxnStatus string | ||
|
|
||
| const ( | ||
| TxnStatusUnconfirmed TxnStatus = "unconfirmed" |
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.
Should we change this from "unconfirmed" to "mempool"? This makes the distinction more clear if we later introduce an "in block" status which really would be better named "unconfirmed", but maybe that would be better as "unconfirmed blocks" or something.
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.
+1 to this. We have three statuses in the happy path for the life cycle of a txn: "InMempool", "Unconfirmed", "Committed".
It's good to disambiguate them now.
| OrderIds []string `safeForLogging:"true"` | ||
| // If unset, defaults to TxnStatusUnconfirmed. If set to "unconfirmed" we will | ||
| // consider all txns including those in the mempool. If set to "confirmed" then | ||
| // we will only consider txns that have been confirmed according to consensus. |
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.
| // we will only consider txns that have been confirmed according to consensus. | |
| // we will only consider txns that have been confirmed according on the blockchain. |
| type TxnStatus string | ||
|
|
||
| const ( | ||
| TxnStatusUnconfirmed TxnStatus = "unconfirmed" |
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.
+1 to this. We have three statuses in the happy path for the life cycle of a txn: "InMempool", "Unconfirmed", "Committed".
It's good to disambiguate them now.
|
|
||
| // A list of hex OrderIds that we will fetch | ||
| OrderIds []string `safeForLogging:"true"` |
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.
+1 to Nina's comment. Please create a new endpoint that takes in OrderIds and returns the exact orders. Overloading the existing endpoint with more orthogonal fields will make its usage more error prone.
* Test backend CI against core with relic dependency. * Checkout specific branch just for testing purposes. * Update test Dockerfile. * Fix failing build stages. * Add new deps. * Allow ParamUpdater to update PoS consensus params (#499) * Allow ParamUpdater to update PoS GlobalParams. * Add epoch number to get pos params call. * Change core branch in test Dockerfile. * Add test for updating global params. * Fix bugs in testing updating global params. * Checkout correct core branch. * Change core branch. * Mf/add validator registration endpoints (#500) * Add validator registration endpoints. * Allow ExtraData to be logged. * Add relic dependency to prod dockerfile. * Mf/add get validator by public key endpoint (#501) * Add get validator by PublicKey route. * Address PR review feedback. * Rename VotingPublicKeySignature to VotingAuthorization. (#502) * Rename VotingPublicKeySignature to VotingAuthorization. * Checkout corresponding core branch. * Change core branch in test CI. * Refactor merging GlobalParamsEntry defaults. (#503) * Refactor merging GlobalParamsEntry defaults. * Change core branch in test dockerfile. * Update test.Dockerfile core branch. (#504) * Initial backend updates to conform to new function signatures in core (#512) Co-authored-by: Lazy Nina <> * Update backend to use BackendMempool interface instead of DeSoMempool (#513) Co-authored-by: Lazy Nina <> * Add fee estimator arg to all txn construction calls (#514) Co-authored-by: Lazy Nina <> * merge main into feature pos (#519) * [stable] Release 3.4.4 * add node version endpoint (#505) Co-authored-by: Lazy Nina <> * [stable] Release 3.4.5 * hotfix to exchange test * Add captcha verification (#509) * Updates to captcha verification * Updates to backend * Updates to captcha verify * Update captcha verification * Cleanup logs * Add routes to store reward amount in global state, track usage via data dog * Update verify captcha validation ordering, add back comp profile config bool * Update badger sync settings to optimize memory usage during hypersync (#506) * Update hypersync to use default badger settings, switch to performance settings once hypersync completes * Update test dockerfile to accept core branch name as parameter * Blank commit to trigger build * ln/fix-transaction-info-mempool (#510) Co-authored-by: Lazy Nina <> * ln/no-comp-when-0-create-profile-fee (#511) Co-authored-by: Lazy Nina <> * Empty commit to trigger build (#515) * Add extra data to basic transfer and diamond txn construction endpoints (#516) * trigger build (#517) Co-authored-by: Lazy Nina <> * trigger build * Add RWLock around AllCountryLevelSignUpBonuses (#518) Co-authored-by: Lazy Nina <> --------- Co-authored-by: Lazy Nina <> Co-authored-by: superzordon <88362450+superzordon@users.noreply.github.com> * Remove fee estimator from txn construction calls (#520) Co-authored-by: Lazy Nina <> * Fix compilation errors (#521) Co-authored-by: Lazy Nina <> * Fix validator test (#522) Co-authored-by: Lazy Nina <> * Add DelegatedStakeCommissionBasisPoints to RegisterAsValidator txn construction endpoint (#523) Co-authored-by: Lazy Nina <> * Add stake, unstake, and unlock stake txn construction endpoints (#524) * Add stake, unstake, and unlock stake txn construction endpoints * Add stake, unstake, and unlock stake txn construction endpoints --------- Co-authored-by: Lazy Nina <> * Add GET endpoints for stake and locked stake entries (#525) Co-authored-by: Lazy Nina <> * Add spending limits backend support for stake, unstake, unlock stake (#529) * Update Block Header Timestamps to int64 (#535) * Fix Backend To Run With Regtest PoS Node (#536) * Add txn construction and get endpoints for lockups (#526) * Add spending limits backend support for stake, unstake, unlock stake * Add txn construction and get endpoints for lockups * Add additional sanity checks to lockup endpoint. * Add txn construction and get endpoints for lockups * Add additional sanity checks to lockup endpoint. * Remove redundant profile entry response from LockedBalanceEntryResponse. * Add proper timestamp to simulateSubmitTransaction. * Apply suggestions from code review --------- Co-authored-by: Lazy Nina <> Co-authored-by: Jon Pollock <jon@deso.org> * Add Unjail Validator endpoint (#532) * feature/pos-syncing-and-steady-state (#537) * Regtest PoS Validator Support * Fix n0_test script * Fix compile error * Fix CI (#540) * Only set public keys if not the zero pkid (#533) * Level 2 glog for price fetching logic (#541) * Remove datadir deletion from n0_test * Update miner to pass params into RecomputeBlockRewardWithBlockRewardOutputPublicKey (#542) * feature/pos-networking-and-syncing (#556) * Fix Compile Errors For Networking (#543) * Fix broken unit test (#546) * Add endpoint to get fee rate and block height for local txn construction (#544) * Fix NetworkManager Access (#550) * Reduce logging (#547) * Validator Registration Script (#552) * Validator Registration Script * Fix validator domain * Update flow crypto dependency (#554) --------- Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> * Update usages of EnumerateKeysForPrefix (#559) * Remove relic tag from validator test (#561) * Allow orphans in block index (#567) * Fix max block size logic (#568) * Empty commit to trigger CI * Upgrade Badger version (#566) * Fix Update global params tests (#571) * trigger build (#572) * trigger build (#573) * trigger build (#574) * Empty commit to trigger CI * bls pub key enhancements build (#576) * allow txn relay in needs blocks build (#577) * fix txn relay pos check build (#578) * Empty commit to trigger CI * Fix backend CI * Use GetCurrentGlobalParamsEntry instead of GlobalParamsEntry (#580) * Empty commit for CI * Empty commit for CI * Atomic Transaction Support for Backend (#560) * Update usage of CreateAtomicTxnsWrapper (#581) * Add a Preceding Transaction Field to Transaction Endpoints. (#570) * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use lib.GetAugmentedUniversalViewWithAdditionalTransactions for UpdateProfile. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Use updated lib.GetAugmentedUniversalViewWithAdditionalTransactions parameters. * Gate preceding transactions middleware on POST requests. * Use anonymous struct to simplify preceding transaction middleware. * Update stateful transaction endpoints to use GetAugmentedUniversalViewWithAdditionalTransactions. * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Fix MaxTxnSizeBytes bug --------- Co-authored-by: diamondhands <diamondhands@bitcloutdev.com> Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> * Add all new global params attributes to update global params txn construction endpoint (#583) * Trigger CI * Add get committed tip info endpoint (#582) * Trigger CI * Empty commit for CI * Update node info endpoint to return info about connections to validators (#586) * Upgrade go to 1.22 (#585) * Upgrade deps (#569) * Empty commit for CI * Fix remote node to response (#587) * trigger build 04-11-24 (#588) * Empty commit to trigger CI * Block until read only view regenerates in afterProcessSubmitPostTransaction (#590) * Add LatestView to CheckpointBlockInfo endpoint (#589) * Empty trigger for CI * Empty commit to trigger CI * Empty commit to trigger CI * Update usage of EstimateFeeRate (#592) * Submit atomic transactions endpoint. (#594) * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Subsidized Update Profile Scaffolding * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Fix MaxTxnSizeBytes bug * Implemented Subsidized Update Profile. * Add an endpoint for easily submitting incomplete atomic transactions. * Fix submit-atomic-transaction by using incomplete atomic hex. * Use mempool is update profile subsidization. * Remove subsidized update profile. --------- Co-authored-by: diamondhands <diamondhands@bitcloutdev.com> * Empty commit to trigger CI * Make utxo ops nil on APITransactionToResponse for inner txns (#595) * Empty commit to trigger CI * Empty commit to CI * Add Script To Make Global Params Changes on Regtest Node (#597) * Add Script To Make Global Params Changes on Regtest Node * Remove public key * trigger build 041924 (#599) * Fix update_glboal_params package * Support MinFeeRateNanosPerKB in atomic txn construction (#602) * update call site for EstimateFeeRate (#603) * trigger build 042324 * trigger build 042324 * Gracefully Handle RemoteNode Response When Peer Is Not a Registered Validator (#604) * Empty commit to trigger CI * Empty commit to trigger CI * Gracefully Handle Nil Peer in RemoteNodeToResponse (#605) * Empty commit to trigger CI * Fix panic in get block template (#606) * Empty commit to trigger CI * Fix Failing Unit Tests (#607) * Add simple status check for node to backend (#608) * wip * wip * Upgrades to support DeSo AMMs and CCV2 (#609) This PR contains several SAFE upgrades to backend to support the various things we need for DeSo AMMs: - Add a `TxnStatus` field that can be provided as an argument to `GetDAOCoinLimitOrders`, `GetTxn`, and `GetTransactorDAOCoinLimitOrders`. This param allows the caller to either consider *unconfirmed txns*, which was the existing behavior before the introduction of this field, or to only consider *confirmed* txns. The latter is what we need for the AMM since we only want to be reacting to things that are finalized. Note that this change is SAFE because the default value is TxnStatusUnconfirmed, which was the pre-existing behavior. If you don't pass the argument, as none of the existing callers do, you will get the exact same result. It's only if you pass TxnStatusConfirmed, as the AMM code does, that you will get a different result than before. - Make it so that you can provide a list of OrderIds to `GetDAOCoinLimitOrdersRequest` and get back the ones that are currently on the book. Needed for the main loop of the AMM. - Introduce a new function called `IsDesoPkid` that flexibly allows the caller of backend endpoints to specify any of {"DESO", MiannetZeroPkidBase58Check, TestnetZeroPkidBase58Check} and get the same behavior. This change is needed because some things rely on using a ZeroPkid while other things rely on the "DESO" string being passed. This change is SAFE because it makes these functions LESS restrictive, and all pre-existing code that calls the endpoints with "DESO" are unaffected. - Allow for filtering by buying/selling pkid in `GetTransactorDAOCoinLimitOrders` . This is needed for the main loop of the AMM. This change is SAFE because the params are optional, and leaving them out gives you the exact same behavior as before. * Add GetDaoCaoinLimitOrdersById (#610) * Empty commit to trigger CI * empty commit to trigger build * Get JWT for update global params script (#615) * Empty commit to trigger CI * fix update global params scripts (#616) * empty commit to trigger build * Add GetCurrentEpochProgress API Endpoint to Return Leader Schedule and Current View (#617) * Add GetCurrentEpochProgress API Endpoint to Return Leader Schedule and Current View * Use currentView value from consensus * Empty Commit to Trigger CI * Update checksum script (#618) * Empty commit to trigger CI * Add Uint256Hex struct to hex encode old uint256 usages (#620) * Fix unmarshal nil pointer (#621) * Fix CheckPrecedingTransactions (#623) * Empty commit to trigger CI * Empty commit to trigger build * Add simple balance endpoint (for amm usage) (#628) * wip * Fix CheckPrecedingTransactions (#623) * Rename vars --------- Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> * Downgrade uint256 to 1.2.3 (#627) * Revert "Upgrade deps (#569)" (#630) This reverts commit 9f10808. * Revert "Upgrade go to 1.22 (#585)" (#634) This reverts commit 53adfee. * Revert Badger version from v4 to v3 (#636) * Empty commit to trigger CI * Empty commit to trigger build (#638) * Add blockheight check before GetSpendableUtxos (#639) * Update NodeVersion (#641) * Fix test.Dockerfile (#642) --------- Co-authored-by: mattfoley8 <isaac@deso.org> Co-authored-by: Matt Foley <100429827+mattfoley8@users.noreply.github.com> Co-authored-by: superzordon <88362450+superzordon@users.noreply.github.com> Co-authored-by: tholonious <99746187+tholonious@users.noreply.github.com> Co-authored-by: Jon Pollock <jon@deso.org> Co-authored-by: iamsofonias <sofonias@deso.org> Co-authored-by: diamondhands0 <81935176+diamondhands0@users.noreply.github.com> Co-authored-by: Jon Pollock <135658176+poolcoke@users.noreply.github.com> Co-authored-by: diamondhands <diamondhands@bitcloutdev.com> Co-authored-by: superzordon <zordonclout@gmail.com>
… Focus (#640) * Test backend CI against core with relic dependency. * Checkout specific branch just for testing purposes. * Update test Dockerfile. * Fix failing build stages. * Add new deps. * Allow ParamUpdater to update PoS consensus params (#499) * Allow ParamUpdater to update PoS GlobalParams. * Add epoch number to get pos params call. * Change core branch in test Dockerfile. * Add test for updating global params. * Fix bugs in testing updating global params. * Checkout correct core branch. * Change core branch. * Mf/add validator registration endpoints (#500) * Add validator registration endpoints. * Allow ExtraData to be logged. * Add relic dependency to prod dockerfile. * Mf/add get validator by public key endpoint (#501) * Add get validator by PublicKey route. * Address PR review feedback. * Rename VotingPublicKeySignature to VotingAuthorization. (#502) * Rename VotingPublicKeySignature to VotingAuthorization. * Checkout corresponding core branch. * Change core branch in test CI. * Refactor merging GlobalParamsEntry defaults. (#503) * Refactor merging GlobalParamsEntry defaults. * Change core branch in test dockerfile. * Update test.Dockerfile core branch. (#504) * Initial backend updates to conform to new function signatures in core (#512) Co-authored-by: Lazy Nina <> * Update backend to use BackendMempool interface instead of DeSoMempool (#513) Co-authored-by: Lazy Nina <> * Add fee estimator arg to all txn construction calls (#514) Co-authored-by: Lazy Nina <> * merge main into feature pos (#519) * [stable] Release 3.4.4 * add node version endpoint (#505) Co-authored-by: Lazy Nina <> * [stable] Release 3.4.5 * hotfix to exchange test * Add captcha verification (#509) * Updates to captcha verification * Updates to backend * Updates to captcha verify * Update captcha verification * Cleanup logs * Add routes to store reward amount in global state, track usage via data dog * Update verify captcha validation ordering, add back comp profile config bool * Update badger sync settings to optimize memory usage during hypersync (#506) * Update hypersync to use default badger settings, switch to performance settings once hypersync completes * Update test dockerfile to accept core branch name as parameter * Blank commit to trigger build * ln/fix-transaction-info-mempool (#510) Co-authored-by: Lazy Nina <> * ln/no-comp-when-0-create-profile-fee (#511) Co-authored-by: Lazy Nina <> * Empty commit to trigger build (#515) * Add extra data to basic transfer and diamond txn construction endpoints (#516) * trigger build (#517) Co-authored-by: Lazy Nina <> * trigger build * Add RWLock around AllCountryLevelSignUpBonuses (#518) Co-authored-by: Lazy Nina <> --------- Co-authored-by: Lazy Nina <> Co-authored-by: superzordon <88362450+superzordon@users.noreply.github.com> * Remove fee estimator from txn construction calls (#520) Co-authored-by: Lazy Nina <> * Fix compilation errors (#521) Co-authored-by: Lazy Nina <> * Fix validator test (#522) Co-authored-by: Lazy Nina <> * Add DelegatedStakeCommissionBasisPoints to RegisterAsValidator txn construction endpoint (#523) Co-authored-by: Lazy Nina <> * Add stake, unstake, and unlock stake txn construction endpoints (#524) * Add stake, unstake, and unlock stake txn construction endpoints * Add stake, unstake, and unlock stake txn construction endpoints --------- Co-authored-by: Lazy Nina <> * Add GET endpoints for stake and locked stake entries (#525) Co-authored-by: Lazy Nina <> * Add spending limits backend support for stake, unstake, unlock stake (#529) * Update Block Header Timestamps to int64 (#535) * Fix Backend To Run With Regtest PoS Node (#536) * Add txn construction and get endpoints for lockups (#526) * Add spending limits backend support for stake, unstake, unlock stake * Add txn construction and get endpoints for lockups * Add additional sanity checks to lockup endpoint. * Add txn construction and get endpoints for lockups * Add additional sanity checks to lockup endpoint. * Remove redundant profile entry response from LockedBalanceEntryResponse. * Add proper timestamp to simulateSubmitTransaction. * Apply suggestions from code review --------- Co-authored-by: Lazy Nina <> Co-authored-by: Jon Pollock <jon@deso.org> * Add Unjail Validator endpoint (#532) * feature/pos-syncing-and-steady-state (#537) * Regtest PoS Validator Support * Fix n0_test script * Fix compile error * Fix CI (#540) * Only set public keys if not the zero pkid (#533) * Level 2 glog for price fetching logic (#541) * Remove datadir deletion from n0_test * Update miner to pass params into RecomputeBlockRewardWithBlockRewardOutputPublicKey (#542) * feature/pos-networking-and-syncing (#556) * Fix Compile Errors For Networking (#543) * Fix broken unit test (#546) * Add endpoint to get fee rate and block height for local txn construction (#544) * Fix NetworkManager Access (#550) * Reduce logging (#547) * Validator Registration Script (#552) * Validator Registration Script * Fix validator domain * Update flow crypto dependency (#554) --------- Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> * Update usages of EnumerateKeysForPrefix (#559) * Remove relic tag from validator test (#561) * Allow orphans in block index (#567) * Fix max block size logic (#568) * Empty commit to trigger CI * Upgrade Badger version (#566) * Fix Update global params tests (#571) * trigger build (#572) * trigger build (#573) * trigger build (#574) * Empty commit to trigger CI * bls pub key enhancements build (#576) * allow txn relay in needs blocks build (#577) * fix txn relay pos check build (#578) * Empty commit to trigger CI * Fix backend CI * Use GetCurrentGlobalParamsEntry instead of GlobalParamsEntry (#580) * Empty commit for CI * Empty commit for CI * Atomic Transaction Support for Backend (#560) * Update usage of CreateAtomicTxnsWrapper (#581) * Add a Preceding Transaction Field to Transaction Endpoints. (#570) * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use lib.GetAugmentedUniversalViewWithAdditionalTransactions for UpdateProfile. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Use updated lib.GetAugmentedUniversalViewWithAdditionalTransactions parameters. * Gate preceding transactions middleware on POST requests. * Use anonymous struct to simplify preceding transaction middleware. * Update stateful transaction endpoints to use GetAugmentedUniversalViewWithAdditionalTransactions. * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Fix MaxTxnSizeBytes bug --------- Co-authored-by: diamondhands <diamondhands@bitcloutdev.com> Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> * Add all new global params attributes to update global params txn construction endpoint (#583) * Trigger CI * Add get committed tip info endpoint (#582) * Trigger CI * Empty commit for CI * Update node info endpoint to return info about connections to validators (#586) * Upgrade go to 1.22 (#585) * Upgrade deps (#569) * Empty commit for CI * Fix remote node to response (#587) * trigger build 04-11-24 (#588) * Empty commit to trigger CI * Block until read only view regenerates in afterProcessSubmitPostTransaction (#590) * Add LatestView to CheckpointBlockInfo endpoint (#589) * Empty trigger for CI * Empty commit to trigger CI * Empty commit to trigger CI * Update usage of EstimateFeeRate (#592) * Submit atomic transactions endpoint. (#594) * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Subsidized Update Profile Scaffolding * Simple CreateAtomicTxnsWrapper scaffolding. * Update method on CreateAtomicTxnsWrapper. * Use MaxTxnSizeBytesPoS for atomic transaction construction. * Fix MaxTxnSizeBytes bug * Implemented Subsidized Update Profile. * Add an endpoint for easily submitting incomplete atomic transactions. * Fix submit-atomic-transaction by using incomplete atomic hex. * Use mempool is update profile subsidization. * Remove subsidized update profile. --------- Co-authored-by: diamondhands <diamondhands@bitcloutdev.com> * Empty commit to trigger CI * Make utxo ops nil on APITransactionToResponse for inner txns (#595) * Empty commit to trigger CI * Empty commit to CI * Add Script To Make Global Params Changes on Regtest Node (#597) * Add Script To Make Global Params Changes on Regtest Node * Remove public key * trigger build 041924 (#599) * Fix update_glboal_params package * Support MinFeeRateNanosPerKB in atomic txn construction (#602) * update call site for EstimateFeeRate (#603) * trigger build 042324 * trigger build 042324 * Gracefully Handle RemoteNode Response When Peer Is Not a Registered Validator (#604) * Empty commit to trigger CI * Empty commit to trigger CI * Gracefully Handle Nil Peer in RemoteNodeToResponse (#605) * Empty commit to trigger CI * Fix panic in get block template (#606) * Empty commit to trigger CI * Fix Failing Unit Tests (#607) * Add simple status check for node to backend (#608) * wip * wip * Upgrades to support DeSo AMMs and CCV2 (#609) This PR contains several SAFE upgrades to backend to support the various things we need for DeSo AMMs: - Add a `TxnStatus` field that can be provided as an argument to `GetDAOCoinLimitOrders`, `GetTxn`, and `GetTransactorDAOCoinLimitOrders`. This param allows the caller to either consider *unconfirmed txns*, which was the existing behavior before the introduction of this field, or to only consider *confirmed* txns. The latter is what we need for the AMM since we only want to be reacting to things that are finalized. Note that this change is SAFE because the default value is TxnStatusUnconfirmed, which was the pre-existing behavior. If you don't pass the argument, as none of the existing callers do, you will get the exact same result. It's only if you pass TxnStatusConfirmed, as the AMM code does, that you will get a different result than before. - Make it so that you can provide a list of OrderIds to `GetDAOCoinLimitOrdersRequest` and get back the ones that are currently on the book. Needed for the main loop of the AMM. - Introduce a new function called `IsDesoPkid` that flexibly allows the caller of backend endpoints to specify any of {"DESO", MiannetZeroPkidBase58Check, TestnetZeroPkidBase58Check} and get the same behavior. This change is needed because some things rely on using a ZeroPkid while other things rely on the "DESO" string being passed. This change is SAFE because it makes these functions LESS restrictive, and all pre-existing code that calls the endpoints with "DESO" are unaffected. - Allow for filtering by buying/selling pkid in `GetTransactorDAOCoinLimitOrders` . This is needed for the main loop of the AMM. This change is SAFE because the params are optional, and leaving them out gives you the exact same behavior as before. * Add GetDaoCaoinLimitOrdersById (#610) * Empty commit to trigger CI * empty commit to trigger build * Get JWT for update global params script (#615) * Empty commit to trigger CI * fix update global params scripts (#616) * empty commit to trigger build * Add GetCurrentEpochProgress API Endpoint to Return Leader Schedule and Current View (#617) * Add GetCurrentEpochProgress API Endpoint to Return Leader Schedule and Current View * Use currentView value from consensus * Empty Commit to Trigger CI * Update checksum script (#618) * Empty commit to trigger CI * Add Uint256Hex struct to hex encode old uint256 usages (#620) * Fix unmarshal nil pointer (#621) * Fix CheckPrecedingTransactions (#623) * Empty commit to trigger CI * Empty commit to trigger build * Add simple balance endpoint (for amm usage) (#628) * wip * Fix CheckPrecedingTransactions (#623) * Rename vars --------- Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> * Downgrade uint256 to 1.2.3 (#627) * Revert "Upgrade deps (#569)" (#630) This reverts commit 9f10808. * Revert "Upgrade go to 1.22 (#585)" (#634) This reverts commit 53adfee. * Revert Badger version from v4 to v3 (#636) * Empty commit to trigger CI * Empty commit to trigger build (#638) * Add blockheight check before GetSpendableUtxos (#639) * wip * wip * Bunch of upgrades * fix revert version errors * Incorporate core changes * fix nit * Fix deps and minor bug fixes * fix test.Dockerfile * Trigger build * Fix usd price computation in market order and add price endpoint * Fix bug around quantity currency * Fix txindex bug * Trigger rebuild * fix gettxn * review comments * Review fixes * Patch last pkid issue --------- Co-authored-by: mattfoley8 <isaac@deso.org> Co-authored-by: Matt Foley <100429827+mattfoley8@users.noreply.github.com> Co-authored-by: Lazy Nina <81658138+lazynina@users.noreply.github.com> Co-authored-by: superzordon <88362450+superzordon@users.noreply.github.com> Co-authored-by: tholonious <99746187+tholonious@users.noreply.github.com> Co-authored-by: Jon Pollock <jon@deso.org> Co-authored-by: iamsofonias <sofonias@deso.org> Co-authored-by: Jon Pollock <135658176+poolcoke@users.noreply.github.com> Co-authored-by: Lazy Nina <lazynina84@gmail.com> Co-authored-by: superzordon <zordonclout@gmail.com>
This PR contains several SAFE upgrades to backend to support the various things we need for DeSo AMMs:
TxnStatusfield that can be provided as an argument toGetDAOCoinLimitOrders,GetTxn, andGetTransactorDAOCoinLimitOrders. This param allows the caller to either consider unconfirmed txns, which was the existing behavior before the introduction of this field, or to only consider confirmed txns. The latter is what we need for the AMM since we only want to be reacting to things that are finalized. Note that this change is SAFE because the default value is TxnStatusUnconfirmed, which was the pre-existing behavior. If you don't pass the argument, as none of the existing callers do, you will get the exact same result. It's only if you pass TxnStatusConfirmed, as the AMM code does, that you will get a different result than before.GetDAOCoinLimitOrdersRequestand get back the ones that are currently on the book. Needed for the main loop of the AMM.IsDesoPkidthat flexibly allows the caller of backend endpoints to specify any of {"DESO", MiannetZeroPkidBase58Check, TestnetZeroPkidBase58Check} and get the same behavior. This change is needed because some things rely on using a ZeroPkid while other things rely on the "DESO" string being passed. This change is SAFE because it makes these functions LESS restrictive, and all pre-existing code that calls the endpoints with "DESO" are unaffected.GetTransactorDAOCoinLimitOrders. This is needed for the main loop of the AMM. This change is SAFE because the params are optional, and leaving them out gives you the exact same behavior as before.