Compare commits
	
		
			No commits in common. "dfd5081b1ba165b5257459dd057216699f5f9f20" and "3be12f7807218ecb322bea5cb0c7cea789d87ba3" have entirely different histories.
		
	
	
		
			dfd5081b1b
			...
			3be12f7807
		
	
		
							
								
								
									
										49
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										49
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -2104,7 +2104,6 @@ dependencies = [ | |||||||
|  "hyper 1.4.1", |  "hyper 1.4.1", | ||||||
|  "hyper-rustls 0.27.3", |  "hyper-rustls 0.27.3", | ||||||
|  "hyper-util", |  "hyper-util", | ||||||
|  "mpl-token-metadata", |  | ||||||
|  "prost", |  "prost", | ||||||
|  "prost-types", |  "prost-types", | ||||||
|  "public-ip", |  "public-ip", | ||||||
| @ -2880,19 +2879,6 @@ version = "1.12.0" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" | checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "mpl-token-metadata" |  | ||||||
| version = "5.1.0" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "989e6a3000e761d3b2d685662a3a9ee99826f9369fb033bd1bc7011b1cf02ed9" |  | ||||||
| dependencies = [ |  | ||||||
|  "borsh 0.10.4", |  | ||||||
|  "num-derive 0.3.3", |  | ||||||
|  "num-traits", |  | ||||||
|  "solana-program", |  | ||||||
|  "thiserror", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "multimap" | name = "multimap" | ||||||
| version = "0.10.0" | version = "0.10.0" | ||||||
| @ -2982,17 +2968,6 @@ version = "0.1.0" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "num-derive" |  | ||||||
| version = "0.3.3" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" |  | ||||||
| dependencies = [ |  | ||||||
|  "proc-macro2", |  | ||||||
|  "quote", |  | ||||||
|  "syn 1.0.109", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "num-derive" | name = "num-derive" | ||||||
| version = "0.4.2" | version = "0.4.2" | ||||||
| @ -4496,7 +4471,7 @@ dependencies = [ | |||||||
|  "log", |  "log", | ||||||
|  "memoffset", |  "memoffset", | ||||||
|  "num-bigint 0.4.6", |  "num-bigint 0.4.6", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "parking_lot", |  "parking_lot", | ||||||
|  "rand 0.8.5", |  "rand 0.8.5", | ||||||
| @ -4525,7 +4500,7 @@ dependencies = [ | |||||||
|  "itertools 0.12.1", |  "itertools 0.12.1", | ||||||
|  "libc", |  "libc", | ||||||
|  "log", |  "log", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "percentage", |  "percentage", | ||||||
|  "rand 0.8.5", |  "rand 0.8.5", | ||||||
| @ -4611,7 +4586,7 @@ dependencies = [ | |||||||
|  "console", |  "console", | ||||||
|  "dialoguer", |  "dialoguer", | ||||||
|  "log", |  "log", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "parking_lot", |  "parking_lot", | ||||||
|  "qstring", |  "qstring", | ||||||
| @ -4931,7 +4906,7 @@ checksum = "cfd8e539a9963c2914ff8426dfe92351a902892aea465cd507e36d638ca0b7d6" | |||||||
| dependencies = [ | dependencies = [ | ||||||
|  "bincode", |  "bincode", | ||||||
|  "log", |  "log", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "rustc_version", |  "rustc_version", | ||||||
|  "serde", |  "serde", | ||||||
| @ -4958,7 +4933,7 @@ dependencies = [ | |||||||
|  "itertools 0.12.1", |  "itertools 0.12.1", | ||||||
|  "lazy_static", |  "lazy_static", | ||||||
|  "merlin", |  "merlin", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "rand 0.7.3", |  "rand 0.7.3", | ||||||
|  "serde", |  "serde", | ||||||
| @ -4988,7 +4963,7 @@ dependencies = [ | |||||||
|  "itertools 0.12.1", |  "itertools 0.12.1", | ||||||
|  "lazy_static", |  "lazy_static", | ||||||
|  "merlin", |  "merlin", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "rand 0.7.3", |  "rand 0.7.3", | ||||||
|  "serde", |  "serde", | ||||||
| @ -5042,7 +5017,7 @@ checksum = "68034596cf4804880d265f834af1ff2f821ad5293e41fa0f8f59086c181fc38e" | |||||||
| dependencies = [ | dependencies = [ | ||||||
|  "assert_matches", |  "assert_matches", | ||||||
|  "borsh 1.5.1", |  "borsh 1.5.1", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "solana-program", |  "solana-program", | ||||||
|  "spl-token", |  "spl-token", | ||||||
| @ -5057,7 +5032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||||||
| checksum = "714b53f7312c2802c62f14bc8a07916c2c872761e3d6be97e99fd432be7799ca" | checksum = "714b53f7312c2802c62f14bc8a07916c2c872761e3d6be97e99fd432be7799ca" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "borsh 1.5.1", |  "borsh 1.5.1", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "solana-program", |  "solana-program", | ||||||
|  "spl-associated-token-account-client", |  "spl-associated-token-account-client", | ||||||
| @ -5153,7 +5128,7 @@ version = "0.5.0" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "d7b28bed65356558133751cc32b48a7a5ddfc59ac4e941314630bbed1ac10532" | checksum = "d7b28bed65356558133751cc32b48a7a5ddfc59ac4e941314630bbed1ac10532" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "solana-program", |  "solana-program", | ||||||
|  "spl-program-error-derive", |  "spl-program-error-derive", | ||||||
| @ -5208,7 +5183,7 @@ checksum = "70a0f06ac7f23dc0984931b1fe309468f14ea58e32660439c1cef19456f5d0e3" | |||||||
| dependencies = [ | dependencies = [ | ||||||
|  "arrayref", |  "arrayref", | ||||||
|  "bytemuck", |  "bytemuck", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "num_enum", |  "num_enum", | ||||||
|  "solana-program", |  "solana-program", | ||||||
| @ -5223,7 +5198,7 @@ checksum = "d9c10f3483e48679619c76598d4e4aebb955bc49b0a5cc63323afbf44135c9bf" | |||||||
| dependencies = [ | dependencies = [ | ||||||
|  "arrayref", |  "arrayref", | ||||||
|  "bytemuck", |  "bytemuck", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "num_enum", |  "num_enum", | ||||||
|  "solana-program", |  "solana-program", | ||||||
| @ -5247,7 +5222,7 @@ checksum = "c0b788a8c34a917b68b4ed2cdec255d03cc09ccba21545dac39c08a97fce640f" | |||||||
| dependencies = [ | dependencies = [ | ||||||
|  "arrayref", |  "arrayref", | ||||||
|  "bytemuck", |  "bytemuck", | ||||||
|  "num-derive 0.4.2", |  "num-derive", | ||||||
|  "num-traits", |  "num-traits", | ||||||
|  "num_enum", |  "num_enum", | ||||||
|  "solana-program", |  "solana-program", | ||||||
|  | |||||||
| @ -22,7 +22,6 @@ solana-program = "2.0" | |||||||
| solana-sdk = "2.0" | solana-sdk = "2.0" | ||||||
| spl-associated-token-account = "5.0" | spl-associated-token-account = "5.0" | ||||||
| spl-token = "6.0" | spl-token = "6.0" | ||||||
| mpl-token-metadata = "5.0" |  | ||||||
| tokio = { version = "1.40", features = ["macros", "rt-multi-thread", "fs"] } # this can be "full" | tokio = { version = "1.40", features = ["macros", "rt-multi-thread", "fs"] } # this can be "full" | ||||||
| tokio-stream = { version = "0.1", features = ["sync"] } | tokio-stream = { version = "0.1", features = ["sync"] } | ||||||
| # sgx poc dependencies | # sgx poc dependencies | ||||||
|  | |||||||
							
								
								
									
										227
									
								
								LICENSE
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										227
									
								
								LICENSE
									
									
									
									
									
								
							| @ -1,227 +0,0 @@ | |||||||
|                     GNU GENERAL PUBLIC LICENSE |  | ||||||
|                        Version 2, June 1991 |  | ||||||
| 
 |  | ||||||
|  Copyright (C) 2025, DeTEE, Ltd. https://detee.ltd/ |  | ||||||
|  Everyone is permitted to copy and distribute verbatim copies |  | ||||||
|  of this license document, but changing it is not allowed. |  | ||||||
|  Contact the author at https://detee.ltd/#contacts |  | ||||||
| 
 |  | ||||||
|    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |  | ||||||
| 
 |  | ||||||
|   0. This License applies to any program or other work which contains |  | ||||||
| a notice placed by the copyright holder saying it may be distributed |  | ||||||
| under the terms of this General Public License.  The "Program", below, |  | ||||||
| refers to any such program or work, and a "work based on the Program" |  | ||||||
| means either the Program or any derivative work under copyright law: |  | ||||||
| that is to say, a work containing the Program or a portion of it, |  | ||||||
| either verbatim or with modifications and/or translated into another |  | ||||||
| language.  (Hereinafter, translation is included without limitation in |  | ||||||
| the term "modification".)  Each licensee is addressed as "you". |  | ||||||
| 
 |  | ||||||
| Activities other than copying, distribution and modification are not |  | ||||||
| covered by this License; they are outside its scope.  The act of |  | ||||||
| running the Program is not restricted, and the output from the Program |  | ||||||
| is covered only if its contents constitute a work based on the |  | ||||||
| Program (independent of having been made by running the Program). |  | ||||||
| Whether that is true depends on what the Program does. |  | ||||||
| 
 |  | ||||||
|   1. You may copy and distribute verbatim copies of the Program's |  | ||||||
| source code as you receive it, in any medium, provided that you |  | ||||||
| conspicuously and appropriately publish on each copy an appropriate |  | ||||||
| copyright notice and disclaimer of warranty; keep intact all the |  | ||||||
| notices that refer to this License and to the absence of any warranty; |  | ||||||
| and give any other recipients of the Program a copy of this License |  | ||||||
| along with the Program. |  | ||||||
| 
 |  | ||||||
| You may charge a fee for the physical act of transferring a copy, and |  | ||||||
| you may at your option offer warranty protection in exchange for a fee. |  | ||||||
| 
 |  | ||||||
|   2. You may modify your copy or copies of the Program or any portion |  | ||||||
| of it, thus forming a work based on the Program, and copy and |  | ||||||
| distribute such modifications or work under the terms of Section 1 |  | ||||||
| above, provided that you also meet all of these conditions: |  | ||||||
| 
 |  | ||||||
|     a) You must cause the modified files to carry prominent notices |  | ||||||
|     stating that you changed the files and the date of any change. |  | ||||||
| 
 |  | ||||||
|     b) You must cause any work that you distribute or publish, that in |  | ||||||
|     whole or in part contains or is derived from the Program or any |  | ||||||
|     part thereof, to be licensed as a whole at no charge to all third |  | ||||||
|     parties under the terms of this License. |  | ||||||
| 
 |  | ||||||
|     c) If the modified program normally reads commands interactively |  | ||||||
|     when run, you must cause it, when started running for such |  | ||||||
|     interactive use in the most ordinary way, to print or display an |  | ||||||
|     announcement including an appropriate copyright notice and a |  | ||||||
|     notice that there is no warranty (or else, saying that you provide |  | ||||||
|     a warranty) and that users may redistribute the program under |  | ||||||
|     these conditions, and telling the user how to view a copy of this |  | ||||||
|     License.  (Exception: if the Program itself is interactive but |  | ||||||
|     does not normally print such an announcement, your work based on |  | ||||||
|     the Program is not required to print an announcement.) |  | ||||||
| 
 |  | ||||||
| These requirements apply to the modified work as a whole.  If |  | ||||||
| identifiable sections of that work are not derived from the Program, |  | ||||||
| and can be reasonably considered independent and separate works in |  | ||||||
| themselves, then this License, and its terms, do not apply to those |  | ||||||
| sections when you distribute them as separate works.  But when you |  | ||||||
| distribute the same sections as part of a whole which is a work based |  | ||||||
| on the Program, the distribution of the whole must be on the terms of |  | ||||||
| this License, whose permissions for other licensees extend to the |  | ||||||
| entire whole, and thus to each and every part regardless of who wrote it. |  | ||||||
| 
 |  | ||||||
| Thus, it is not the intent of this section to claim rights or contest |  | ||||||
| your rights to work written entirely by you; rather, the intent is to |  | ||||||
| exercise the right to control the distribution of derivative or |  | ||||||
| collective works based on the Program. |  | ||||||
| 
 |  | ||||||
| In addition, mere aggregation of another work not based on the Program |  | ||||||
| with the Program (or with a work based on the Program) on a volume of |  | ||||||
| a storage or distribution medium does not bring the other work under |  | ||||||
| the scope of this License. |  | ||||||
| 
 |  | ||||||
|   3. You may copy and distribute the Program (or a work based on it, |  | ||||||
| under Section 2) in object code or executable form under the terms of |  | ||||||
| Sections 1 and 2 above provided that you also do one of the following: |  | ||||||
| 
 |  | ||||||
|     a) Accompany it with the complete corresponding machine-readable |  | ||||||
|     source code, which must be distributed under the terms of Sections |  | ||||||
|     1 and 2 above on a medium customarily used for software interchange; or, |  | ||||||
| 
 |  | ||||||
|     b) Accompany it with a written offer, valid for at least three |  | ||||||
|     years, to give any third party, for a charge no more than your |  | ||||||
|     cost of physically performing source distribution, a complete |  | ||||||
|     machine-readable copy of the corresponding source code, to be |  | ||||||
|     distributed under the terms of Sections 1 and 2 above on a medium |  | ||||||
|     customarily used for software interchange; or, |  | ||||||
| 
 |  | ||||||
|     c) Accompany it with the information you received as to the offer |  | ||||||
|     to distribute corresponding source code.  (This alternative is |  | ||||||
|     allowed only for noncommercial distribution and only if you |  | ||||||
|     received the program in object code or executable form with such |  | ||||||
|     an offer, in accord with Subsection b above.) |  | ||||||
| 
 |  | ||||||
| The source code for a work means the preferred form of the work for |  | ||||||
| making modifications to it.  For an executable work, complete source |  | ||||||
| code means all the source code for all modules it contains, plus any |  | ||||||
| associated interface definition files, plus the scripts used to |  | ||||||
| control compilation and installation of the executable.  However, as a |  | ||||||
| special exception, the source code distributed need not include |  | ||||||
| anything that is normally distributed (in either source or binary |  | ||||||
| form) with the major components (compiler, kernel, and so on) of the |  | ||||||
| operating system on which the executable runs, unless that component |  | ||||||
| itself accompanies the executable. |  | ||||||
| 
 |  | ||||||
| If distribution of executable or object code is made by offering |  | ||||||
| access to copy from a designated place, then offering equivalent |  | ||||||
| access to copy the source code from the same place counts as |  | ||||||
| distribution of the source code, even though third parties are not |  | ||||||
| compelled to copy the source along with the object code. |  | ||||||
| 
 |  | ||||||
|   4. You may not copy, modify, sublicense, or distribute the Program |  | ||||||
| except as expressly provided under this License.  Any attempt |  | ||||||
| otherwise to copy, modify, sublicense or distribute the Program is |  | ||||||
| void, and will automatically terminate your rights under this License. |  | ||||||
| However, parties who have received copies, or rights, from you under |  | ||||||
| this License will not have their licenses terminated so long as such |  | ||||||
| parties remain in full compliance. |  | ||||||
| 
 |  | ||||||
|   5. You are not required to accept this License, since you have not |  | ||||||
| signed it.  However, nothing else grants you permission to modify or |  | ||||||
| distribute the Program or its derivative works.  These actions are |  | ||||||
| prohibited by law if you do not accept this License.  Therefore, by |  | ||||||
| modifying or distributing the Program (or any work based on the |  | ||||||
| Program), you indicate your acceptance of this License to do so, and |  | ||||||
| all its terms and conditions for copying, distributing or modifying |  | ||||||
| the Program or works based on it. |  | ||||||
| 
 |  | ||||||
|   6. Each time you redistribute the Program (or any work based on the |  | ||||||
| Program), the recipient automatically receives a license from the |  | ||||||
| original licensor to copy, distribute or modify the Program subject to |  | ||||||
| these terms and conditions.  You may not impose any further |  | ||||||
| restrictions on the recipients' exercise of the rights granted herein. |  | ||||||
| You are not responsible for enforcing compliance by third parties to |  | ||||||
| this License. |  | ||||||
| 
 |  | ||||||
|   7. If, as a consequence of a court judgment or allegation of patent |  | ||||||
| infringement or for any other reason (not limited to patent issues), |  | ||||||
| conditions are imposed on you (whether by court order, agreement or |  | ||||||
| otherwise) that contradict the conditions of this License, they do not |  | ||||||
| excuse you from the conditions of this License.  If you cannot |  | ||||||
| distribute so as to satisfy simultaneously your obligations under this |  | ||||||
| License and any other pertinent obligations, then as a consequence you |  | ||||||
| may not distribute the Program at all.  For example, if a patent |  | ||||||
| license would not permit royalty-free redistribution of the Program by |  | ||||||
| all those who receive copies directly or indirectly through you, then |  | ||||||
| the only way you could satisfy both it and this License would be to |  | ||||||
| refrain entirely from distribution of the Program. |  | ||||||
| 
 |  | ||||||
| If any portion of this section is held invalid or unenforceable under |  | ||||||
| any particular circumstance, the balance of the section is intended to |  | ||||||
| apply and the section as a whole is intended to apply in other |  | ||||||
| circumstances. |  | ||||||
| 
 |  | ||||||
| It is not the purpose of this section to induce you to infringe any |  | ||||||
| patents or other property right claims or to contest validity of any |  | ||||||
| such claims; this section has the sole purpose of protecting the |  | ||||||
| integrity of the free software distribution system, which is |  | ||||||
| implemented by public license practices.  Many people have made |  | ||||||
| generous contributions to the wide range of software distributed |  | ||||||
| through that system in reliance on consistent application of that |  | ||||||
| system; it is up to the author/donor to decide if he or she is willing |  | ||||||
| to distribute software through any other system and a licensee cannot |  | ||||||
| impose that choice. |  | ||||||
| 
 |  | ||||||
| This section is intended to make thoroughly clear what is believed to |  | ||||||
| be a consequence of the rest of this License. |  | ||||||
| 
 |  | ||||||
|   8. If the distribution and/or use of the Program is restricted in |  | ||||||
| certain countries either by patents or by copyrighted interfaces, the |  | ||||||
| original copyright holder who places the Program under this License |  | ||||||
| may add an explicit geographical distribution limitation excluding |  | ||||||
| those countries, so that distribution is permitted only in or among |  | ||||||
| countries not thus excluded.  In such case, this License incorporates |  | ||||||
| the limitation as if written in the body of this License. |  | ||||||
| 
 |  | ||||||
|   9. The Free Software Foundation may publish revised and/or new versions |  | ||||||
| of the General Public License from time to time.  Such new versions will |  | ||||||
| be similar in spirit to the present version, but may differ in detail to |  | ||||||
| address new problems or concerns. |  | ||||||
| 
 |  | ||||||
| Each version is given a distinguishing version number.  If the Program |  | ||||||
| specifies a version number of this License which applies to it and "any |  | ||||||
| later version", you have the option of following the terms and conditions |  | ||||||
| either of that version or of any later version published by the Free |  | ||||||
| Software Foundation.  If the Program does not specify a version number of |  | ||||||
| this License, you may choose any version ever published by the Free Software |  | ||||||
| Foundation. |  | ||||||
| 
 |  | ||||||
|   10. If you wish to incorporate parts of the Program into other free |  | ||||||
| programs whose distribution conditions are different, write to the author |  | ||||||
| to ask for permission.  For software which is copyrighted by the Free |  | ||||||
| Software Foundation, write to the Free Software Foundation; we sometimes |  | ||||||
| make exceptions for this.  Our decision will be guided by the two goals |  | ||||||
| of preserving the free status of all derivatives of our free software and |  | ||||||
| of promoting the sharing and reuse of software generally. |  | ||||||
| 
 |  | ||||||
|                             NO WARRANTY |  | ||||||
| 
 |  | ||||||
|   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |  | ||||||
| FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN |  | ||||||
| OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |  | ||||||
| PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |  | ||||||
| OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |  | ||||||
| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS |  | ||||||
| TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE |  | ||||||
| PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |  | ||||||
| REPAIR OR CORRECTION. |  | ||||||
| 
 |  | ||||||
|   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |  | ||||||
| WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |  | ||||||
| REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |  | ||||||
| INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |  | ||||||
| OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |  | ||||||
| TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |  | ||||||
| YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |  | ||||||
| PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |  | ||||||
| POSSIBILITY OF SUCH DAMAGES. |  | ||||||
| @ -47,11 +47,12 @@ address=$(docker logs dthc0 | grep 'SOL' | awk '{ print $NF }') | |||||||
| "${script_dir}"/mint_sol "${address}" | "${script_dir}"/mint_sol "${address}" | ||||||
| while true; do | while true; do | ||||||
|     echo -n "." && sleep 1 |     echo -n "." && sleep 1 | ||||||
|     docker logs dthc0 | grep -q "Heartbeat..." && echo && break |     docker logs dthc0 | grep -q "Mint created" && echo && break | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| echo "Creating a cluster with ${num_nodes} nodes" | echo "Creating a cluster with ${num_nodes} nodes" | ||||||
| for n in $(seq 1 $num_nodes); do | for n in $(seq 1 $num_nodes); do | ||||||
|  |     #init_nodes=$(docker inspect dthc0 --format '{{ .NetworkSettings.Networks.dthc.IPAddress }}') | ||||||
|     node_ip="172.18.0.$((2 + n))" |     node_ip="172.18.0.$((2 + n))" | ||||||
|     node_port=$((31300 + n)) |     node_port=$((31300 + n)) | ||||||
|     node_volume="/tmp/dthc${n}" |     node_volume="/tmp/dthc${n}" | ||||||
| @ -68,13 +69,15 @@ for n in $(seq 1 $num_nodes); do | |||||||
|                detee/hacker-challenge:test |                detee/hacker-challenge:test | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| echo "Initialing test.." |  | ||||||
| sleep 4; |  | ||||||
| 
 |  | ||||||
| echo "Running the test mint" | echo "Running the test mint" | ||||||
| for n in {1..20}; do | for n in {1..20}; do | ||||||
|     node_port=$((31300 + n)) |     node_port=$((31300 + n)) | ||||||
|     curl -X POST "127.0.0.1:${node_port}/mint?address=EZT16iP1SQVUFf1AJN6oiE5BZPnyBUqaKDkZ4oZRsvhR" --connect-timeout 5 2> /dev/null |     curl -X POST "127.0.0.1:${node_port}/mint" \ | ||||||
|  |          --json '{"wallet": "EZT16iP1SQVUFf1AJN6oiE5BZPnyBUqaKDkZ4oZRsvhR"}' \ | ||||||
|  |          --connect-timeout 5 2> /dev/null | ||||||
|  |     echo "" | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
|  | # curl 127.0.0.1:31303/metrics | ||||||
|  | # curl -X POST 127.0.0.1:31303/mint -d '{"wallet": "EZT16iP1SQVUFf1AJN6oiE5BZPnyBUqaKDkZ4oZRsvhR"}' -H 'Content-Type: application/json' | ||||||
| # docker run --name dthc0 --network dthc -d --ip 172.18.0.2 --env NODE_IP="172.18.0.2" --env INIT_NODES="172.18.0.5 172.18.0.3 172.18.0.4" --volume /tmp/dthc0:/challenge/main --publish 31300:31372 --device /dev/sgx/provision --device /dev/sgx/enclave detee/hacker-challenge:test | # docker run --name dthc0 --network dthc -d --ip 172.18.0.2 --env NODE_IP="172.18.0.2" --env INIT_NODES="172.18.0.5 172.18.0.3 172.18.0.4" --volume /tmp/dthc0:/challenge/main --publish 31300:31372 --device /dev/sgx/provision --device /dev/sgx/enclave detee/hacker-challenge:test | ||||||
|  | |||||||
| @ -1,11 +1,9 @@ | |||||||
| use crate::persistence::{SealError, SealedFile}; | use crate::persistence::{SealError, SealedFile}; | ||||||
| use serde::{Deserialize, Serialize}; | use serde::{Deserialize, Serialize}; | ||||||
| use serde_with::{serde_as, TimestampSeconds}; | use serde_with::{serde_as, TimestampSeconds}; | ||||||
| use std::{ | use std::collections::{HashMap, HashSet}; | ||||||
|     collections::{HashMap, HashSet}, | use std::sync::atomic::{AtomicBool, Ordering}; | ||||||
|     sync::atomic::{AtomicBool, Ordering}, | use std::time::{Duration, SystemTime, UNIX_EPOCH}; | ||||||
|     time::{Duration, SystemTime, UNIX_EPOCH}, |  | ||||||
| }; |  | ||||||
| use tokio::sync::RwLock; | use tokio::sync::RwLock; | ||||||
| 
 | 
 | ||||||
| type IP = String; | type IP = String; | ||||||
|  | |||||||
| @ -6,7 +6,8 @@ use crate::{datastore::State, grpc::challenge::update_server::Update}; | |||||||
| use detee_sgx::RaTlsConfig; | use detee_sgx::RaTlsConfig; | ||||||
| use rustls::pki_types::CertificateDer; | use rustls::pki_types::CertificateDer; | ||||||
| use std::{pin::Pin, sync::Arc}; | use std::{pin::Pin, sync::Arc}; | ||||||
| use tokio::{sync::broadcast::Sender, time::interval}; | use tokio::sync::broadcast::Sender; | ||||||
|  | use tokio::time::interval; | ||||||
| use tokio_stream::{Stream, StreamExt}; | use tokio_stream::{Stream, StreamExt}; | ||||||
| use tonic::{Request, Response, Status, Streaming}; | use tonic::{Request, Response, Status, Streaming}; | ||||||
| 
 | 
 | ||||||
| @ -138,12 +139,12 @@ struct ConnInfo { | |||||||
| 
 | 
 | ||||||
| #[tonic::async_trait] | #[tonic::async_trait] | ||||||
| impl Update for NodeServer { | impl Update for NodeServer { | ||||||
|     type GetUpdatesStream = Pin<Box<dyn Stream<Item = Result<NodeUpdate, Status>> + Send>>; |  | ||||||
| 
 |  | ||||||
|     async fn get_keys(&self, _request: Request<Empty>) -> Result<Response<Keys>, Status> { |     async fn get_keys(&self, _request: Request<Empty>) -> Result<Response<Keys>, Status> { | ||||||
|         Ok(Response::new(self.keys.clone())) |         Ok(Response::new(self.keys.clone())) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     type GetUpdatesStream = Pin<Box<dyn Stream<Item = Result<NodeUpdate, Status>> + Send>>; | ||||||
|  | 
 | ||||||
|     async fn get_updates( |     async fn get_updates( | ||||||
|         &self, |         &self, | ||||||
|         req: Request<Streaming<NodeUpdate>>, |         req: Request<Streaming<NodeUpdate>>, | ||||||
|  | |||||||
| @ -56,16 +56,16 @@ async fn get_nodes(state: web::Data<Arc<State>>) -> HttpResponse { | |||||||
| 
 | 
 | ||||||
| #[derive(Deserialize)] | #[derive(Deserialize)] | ||||||
| struct MintReq { | struct MintReq { | ||||||
|     address: String, |     wallet: String, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[post("/mint")] | #[post("/mint")] | ||||||
| async fn mint( | async fn mint( | ||||||
|     state: web::Data<Arc<State>>, |     state: web::Data<Arc<State>>, | ||||||
|     sol_client: web::Data<Arc<SolClient>>, |     sol_client: web::Data<Arc<SolClient>>, | ||||||
|     req: web::Query<MintReq>, |     req: web::Json<MintReq>, | ||||||
| ) -> impl Responder { | ) -> impl Responder { | ||||||
|     let recipient = req.into_inner().address; |     let recipient = req.into_inner().wallet; | ||||||
|     state.increase_mint_requests().await; |     state.increase_mint_requests().await; | ||||||
| 
 | 
 | ||||||
|     if state.is_minting() { |     if state.is_minting() { | ||||||
|  | |||||||
| @ -54,8 +54,7 @@ pub async fn heartbeat( | |||||||
|         state.update_keepalive().await; |         state.update_keepalive().await; | ||||||
|         state.remove_inactive_nodes().await; |         state.remove_inactive_nodes().await; | ||||||
|         let connected_ips = state.get_connected_ips().await; |         let connected_ips = state.get_connected_ips().await; | ||||||
|         let my_ip = state.get_my_ip().await; |         println!("Connected nodes ({}): {:?}", connected_ips.len(), connected_ips); | ||||||
|         println!("Connected nodes ({}): \"{}\" -> {:?}", connected_ips.len(), my_ip, connected_ips); |  | ||||||
|         let my_node_info = state.get_my_info().await; |         let my_node_info = state.get_my_info().await; | ||||||
|         my_node_info.save(); |         my_node_info.save(); | ||||||
|         let _ = tx.send((state.get_my_ip().await, my_node_info).into()); |         let _ = tx.send((state.get_my_ip().await, my_node_info).into()); | ||||||
|  | |||||||
							
								
								
									
										148
									
								
								src/solana.rs
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										148
									
								
								src/solana.rs
									
									
									
									
									
								
							| @ -1,10 +1,5 @@ | |||||||
| #![allow(dead_code)] | #![allow(dead_code)] | ||||||
| use crate::{grpc::challenge::Keys, persistence::KeysFile}; | use crate::{grpc::challenge::Keys, persistence::KeysFile}; | ||||||
| use mpl_token_metadata::{ |  | ||||||
|     instructions::{CreateMetadataAccountV3, CreateMetadataAccountV3InstructionArgs}, |  | ||||||
|     types::DataV2, |  | ||||||
|     ID as mpl_token_metadata_id, |  | ||||||
| }; |  | ||||||
| use solana_client::nonblocking::rpc_client::RpcClient; | use solana_client::nonblocking::rpc_client::RpcClient; | ||||||
| use solana_program::program_pack::Pack; | use solana_program::program_pack::Pack; | ||||||
| use solana_sdk::{ | use solana_sdk::{ | ||||||
| @ -132,56 +127,31 @@ impl TryFrom<KeysFile> for SolClient { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async fn create_token(client: &RpcClient, payer_keypair: &Keypair) -> Pubkey { | async fn wait_for_sol(client: &RpcClient, pubkey: &Pubkey) { | ||||||
|     // #1 top up the payer
 |     println!("Waiting to receive 0.01 SOL in address {pubkey}"); | ||||||
|     println!("Waiting for at least 0.01 SOL in address {}", payer_keypair.pubkey()); |     loop { | ||||||
|     while !has_enough_lamports(client, &payer_keypair.pubkey(), 10_000_000).await { |  | ||||||
|         sleep(Duration::from_secs(30)).await; |         sleep(Duration::from_secs(30)).await; | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     // #2 create token mint
 |  | ||||||
|     println!("Creating Token Mint"); |  | ||||||
|     let mut mint_pubkey = None; |  | ||||||
|     while mint_pubkey.is_none() { |  | ||||||
|         sleep(Duration::from_secs(30)).await; |  | ||||||
|         mint_pubkey = create_mint(client, payer_keypair).await; |  | ||||||
|     } |  | ||||||
|     let mint_pubkey = mint_pubkey.unwrap(); |  | ||||||
|     println!("Token Mint created: {mint_pubkey}"); |  | ||||||
| 
 |  | ||||||
|     // #3 create token meta
 |  | ||||||
|     println!("Creating Token Metadata"); |  | ||||||
|     while !create_meta(client, payer_keypair, &mint_pubkey).await { |  | ||||||
|         sleep(Duration::from_secs(30)).await; |  | ||||||
|     } |  | ||||||
|     println!("Token Metadata created"); |  | ||||||
| 
 |  | ||||||
|     mint_pubkey |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| async fn has_enough_lamports(client: &RpcClient, pubkey: &Pubkey, threshold: u64) -> bool { |  | ||||||
|         match client.get_balance(pubkey).await { |         match client.get_balance(pubkey).await { | ||||||
|             Ok(balance) => { |             Ok(balance) => { | ||||||
|             println!("{pubkey} needs {threshold} and has {balance}"); |                 println!("Got {balance} lamports."); | ||||||
|             balance >= threshold |                 if balance > 10_000_000 { | ||||||
|  |                     return; | ||||||
|                 } |                 } | ||||||
|         Err(e) => { |             } | ||||||
|             println!("Could not get balance: {e:?}"); |             Err(e) => println!("Could not get balance: {e:?}"), | ||||||
|             false |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async fn create_mint(client: &RpcClient, payer_keypair: &Keypair) -> Option<Pubkey> { | async fn create_token(client: &RpcClient, keypair: &Keypair) -> Pubkey { | ||||||
|  |     wait_for_sol(client, &keypair.pubkey()).await; | ||||||
|  | 
 | ||||||
|     let mint_keypair = Keypair::new(); |     let mint_keypair = Keypair::new(); | ||||||
|     let mint_rent = client |     let payer = Keypair::from_base58_string(&keypair.to_base58_string()); | ||||||
|         .get_minimum_balance_for_rent_exemption(Mint::LEN) |     let mint_rent = client.get_minimum_balance_for_rent_exemption(Mint::LEN).await.unwrap(); | ||||||
|         .await |  | ||||||
|         .map_err(|e| println!("Can't get minimum balance for rent exemption: {e}")) |  | ||||||
|         .ok()?; |  | ||||||
| 
 | 
 | ||||||
|     let create_mint_account_ix = system_instruction::create_account( |     let create_mint_account_ix = system_instruction::create_account( | ||||||
|         &payer_keypair.pubkey(), |         &payer.pubkey(), | ||||||
|         &mint_keypair.pubkey(), |         &mint_keypair.pubkey(), | ||||||
|         mint_rent, |         mint_rent, | ||||||
|         Mint::LEN as u64, |         Mint::LEN as u64, | ||||||
| @ -189,91 +159,21 @@ async fn create_mint(client: &RpcClient, payer_keypair: &Keypair) -> Option<Pubk | |||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     let init_mint_ix = |     let init_mint_ix = | ||||||
|         initialize_mint(&spl_token::id(), &mint_keypair.pubkey(), &payer_keypair.pubkey(), None, 9) |         initialize_mint(&spl_token::id(), &mint_keypair.pubkey(), &payer.pubkey(), None, 9) | ||||||
|             .map_err(|e| println!("Can't initialize mint: {e}")) |             .unwrap(); | ||||||
|             .ok()?; |  | ||||||
| 
 |  | ||||||
|     let recent_blockhash = client |  | ||||||
|         .get_latest_blockhash() |  | ||||||
|         .await |  | ||||||
|         .map_err(|e| println!("Can't get latest blockhash: {e}")) |  | ||||||
|         .ok()?; |  | ||||||
| 
 | 
 | ||||||
|  |     let recent_blockhash = client.get_latest_blockhash().await.unwrap(); | ||||||
|     let tx = Transaction::new_signed_with_payer( |     let tx = Transaction::new_signed_with_payer( | ||||||
|         &[create_mint_account_ix, init_mint_ix], |         &[create_mint_account_ix, init_mint_ix], | ||||||
|         Some(&payer_keypair.pubkey()), |         Some(&payer.pubkey()), | ||||||
|         &[&payer_keypair, &mint_keypair], |         &[&payer, &mint_keypair], | ||||||
|         recent_blockhash, |         recent_blockhash, | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     client |     let signature = client.send_and_confirm_transaction(&tx).await.unwrap(); | ||||||
|         .send_and_confirm_transaction(&tx) | 
 | ||||||
|         .await |     println!("Mint created: {}", mint_keypair.pubkey()); | ||||||
|         .map_err(|e| println!("Can't execute transaction: {e}")) |     println!("Transaction signature: {}", signature); | ||||||
|         .map(|s| { | 
 | ||||||
|             println!("Transaction signature: {}", s); |  | ||||||
|     mint_keypair.pubkey() |     mint_keypair.pubkey() | ||||||
|         }) |  | ||||||
|         .ok() |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| async fn create_meta(client: &RpcClient, payer_keypair: &Keypair, mint_pubkey: &Pubkey) -> bool { |  | ||||||
|     create_meta_int(client, payer_keypair, mint_pubkey).await.is_some() |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| async fn create_meta_int( |  | ||||||
|     client: &RpcClient, |  | ||||||
|     payer_keypair: &Keypair, |  | ||||||
|     mint_pubkey: &Pubkey, |  | ||||||
| ) -> Option<()> { |  | ||||||
|     let metadata_seeds = &[b"metadata", mpl_token_metadata_id.as_ref(), mint_pubkey.as_ref()]; |  | ||||||
|     let (metadata_pda, _bump) = |  | ||||||
|         Pubkey::find_program_address(metadata_seeds, &mpl_token_metadata_id); |  | ||||||
| 
 |  | ||||||
|     let data_v2 = DataV2 { |  | ||||||
|         name: "DeTEE Hacker Challenge Token".to_string(), |  | ||||||
|         symbol: "DTHC".to_string(), |  | ||||||
|         uri: "https://detee.ltd/dthc/meta.json".to_string(), |  | ||||||
|         seller_fee_basis_points: 0, // usually for NFTs, can be 0 for fungible
 |  | ||||||
|         creators: None, // or Some(vec![Creator { ... }]) if you want to specify creators
 |  | ||||||
|         collection: None, |  | ||||||
|         uses: None, |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     let create_metadata_account_ix = CreateMetadataAccountV3 { |  | ||||||
|         metadata: metadata_pda, |  | ||||||
|         mint: *mint_pubkey, |  | ||||||
|         mint_authority: payer_keypair.pubkey(), |  | ||||||
|         payer: payer_keypair.pubkey(), |  | ||||||
|         update_authority: (payer_keypair.pubkey(), true), |  | ||||||
|         system_program: solana_program::system_program::id(), |  | ||||||
|         rent: None, |  | ||||||
|     } |  | ||||||
|     .instruction(CreateMetadataAccountV3InstructionArgs { |  | ||||||
|         data: data_v2, |  | ||||||
|         is_mutable: true, |  | ||||||
|         collection_details: None, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     let recent_blockhash = client |  | ||||||
|         .get_latest_blockhash() |  | ||||||
|         .await |  | ||||||
|         .map_err(|e| println!("Can't get latest blockhash: {e}")) |  | ||||||
|         .ok()?; |  | ||||||
| 
 |  | ||||||
|     let tx = Transaction::new_signed_with_payer( |  | ||||||
|         &[create_metadata_account_ix], |  | ||||||
|         Some(&payer_keypair.pubkey()), |  | ||||||
|         &[&payer_keypair], |  | ||||||
|         recent_blockhash, |  | ||||||
|     ); |  | ||||||
| 
 |  | ||||||
|     client |  | ||||||
|         .send_and_confirm_transaction(&tx) |  | ||||||
|         .await |  | ||||||
|         .map_err(|e| println!("Can't execute transaction: {e}")) |  | ||||||
|         .map(|s| { |  | ||||||
|             println!("Transaction signature: {}", s); |  | ||||||
|         }) |  | ||||||
|         .ok() |  | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user