Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:adrianSuSE:suse-distro-blockchain
suse-distro-check
_service:obs_scm:suse-distro-blockchain-1732431...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:suse-distro-blockchain-1732431697.39c16c0.obscpio of Package suse-distro-check
07070100000000000081A40000000000000000000000016742CF5100000110000000000000000000000000000000000000003700000000suse-distro-blockchain-1732431697.39c16c0/.example.envCHAIN_ID=31337 # This is the default value, change it if needed CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3 ACCOUNT_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 HTTP_PROVIDER_URL=http://127.0.0.1:8545 # Replace with your provider URL PRIVATE_KEY= 07070100000001000081A40000000000000000000000016742CF51000000FD000000000000000000000000000000000000003500000000suse-distro-blockchain-1732431697.39c16c0/.gitignorevenv myv myvirtualenvironment myvirtualenv venv/ myv/ myvirtualenvironment/ myvirtualenv/ .venv .myv .myvirtualenvironment .myvirtualenv ./venv ./myv ./myvirtualenvironment ./myvirtualenv env .env env.local .env.local __pycache__/ *.py[cod] *$py.class 07070100000002000081A40000000000000000000000016742CF5100000000000000000000000000000000000000000000003600000000suse-distro-blockchain-1732431697.39c16c0/.gitmodules07070100000003000081A40000000000000000000000016742CF5100000526000000000000000000000000000000000000003500000000suse-distro-blockchain-1732431697.39c16c0/DEVELOP.md# pyremix Create a virtual environment I'm naming my virtual environment here `myv`. PLEASE NOTE THAT THIS IS NOT PROTECTING YOUR SYSTEM. DO THIS IN A RESERVED VM! (todo: package the development env) ```bash python3 -m venv ./myv ``` Make sure that if you name your virtual environment something else, you include it in the gitignore. Install requirements: ```bash pipx-3.12 install vyper eth-ape ape-vyper web3 streamlit python-dotenv ``` Make sure to have foundry installed. To work on these tooling you need to run an own local chain on your workstation. For that run ```bash anvil ``` And keep it running. It also creates multiple accounts with keypairs you need to use below. First we need to create for each role an own account. So you need to pick a matching public and private key pair from the output of the anvil tool. And use it to create multiple accounts in the anvil chain. ```bash ape accounts import foundation ape accounts import product_creator ape accounts import attestator ape accounts import security_team ``` To finally deploy the contract use ```bash cd ape ape run scripts/deploy_anvil.py --network http://localhost:8545 ``` On modifications of the contract run: ```bash # on abi changes: vyper -f abi contracts/distro.vy > .build/distro.json python3 test_distro_contract.py ``` 07070100000004000081A40000000000000000000000016742CF510000894B000000000000000000000000000000000000003200000000suse-distro-blockchain-1732431697.39c16c0/LICENSE GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. 07070100000005000081A40000000000000000000000016742CF51000012F6000000000000000000000000000000000000003400000000suse-distro-blockchain-1732431697.39c16c0/README.md Motivation ========== The SUSE and openSUSE distribution creation and shipment relies on centralized trust points today. A breach at these critical points inside of the production process could lead to an unwanted shipment of harmful content. Furthermore we rely on external service providers for providing our products. While these can not modify the products, they can still replace them with different SUSE or openSUSE signed content. The goal of this implementation is to achieve a real zero-trust implementation for our distribution building and shipment. Using this first demo implementation we can provide a way how any consumer can check the state of the current provided products. High-Level product tracking of a SUSE/openSUSE distribution =========================================================== 0. Review of submissions and aggregation of a product This first itertion of the implementation is excluding the tracking of each individual review steps. However a lot could be done here in a later extension. Important right now is just that the product/code stream owner defines a fixed set of sources for his product which can be reviewed by any party. It is also critical to have a secure identifier of this state. This could be for example provided via a SHA-256 reflog entry of a project git. 1. The product build The OBS instance is building now the product, which means any binary artifact out of given source. The artifact provides also an identifier which can be used for tracking. The fact that products are signed by OBS with a key don't matter in our concept, since we don't want to rely on a centralised secret (the gpg private signing key). It could be mis-used by an attacker in the same way when the attacker is also able to provide binaries which don't rely on the given the source. Keep in mind that the attacker could be also one of the OBS administrators. Or from the POV of the OBS administrator, I don't want to have the power here to do so. Never being in the situation that someone could claim that I did something like this. However, we again need a secure identifier, like a SHA-256 sum again. 2. The content providers Published products get distributed via various channels and mirrors. This involves also all possible inhouse mirrors and any network infrastructure entities which may spoof network access (Esp. when you consider SSL CA authorities as not secure enough). While content provides can not sign repositories with own content, it is possible for them to block security updates. Or even provide older versions with known attack vectors formerly signed by openSUSE or SUSE. This scenario becomes even worse when it is a targeted attack to or inside of a larger organisation. The problems solved by a blockchain contract for product tracking ================================================================= 1) The responsibilities get defined and documented in the contract. 2) Validation of the current state, avoiding any blocked content. 3) Any role or entity validation can be distributed over multiple persons. For example we can require 3 votes out of the team of 9 security managers to mark a source state as unsecure. In short a zero-trust implementation for a single entity. 4) We avoid the need of a product modification by having a second channel (the blockchain). For example no need to modify a git commit or existing file by providing an additional signature in place. We just need a secure reference, for example a SHA-256 sum to be stored in the blockchain. Roles in this example setup =========================== 1) The Organisation owner / The contract deployer This can be for example the openSUSE board. They would deploy a contract which defines the roles and responsibilities. They have no further involvement in the production process afterwards. 2) The product creator This would be the OBS administrator in this example. He is responsible to take a defined source state and producing binary shipments. He has the duty to register new product builds in the chain. 3) The attestator She would rebuild the source and verifies that the same binary get created. She has the duty to acknowledge a registered product build as reproducable. 4) The security auditor He can register any product build as not-secure when grave issues appear. He has the duty to mark an existing product build as unsecure. Involved software components ============================ 1) The distribution contract can be found in ape/contracts/distro.vy 2) The tool to register a new product build for the OBS admin 3) The tool to modify a registered product build 4) The tool for the user to validate a product 07070100000006000041ED0000000000000000000000046742CF5100000000000000000000000000000000000000000000002E00000000suse-distro-blockchain-1732431697.39c16c0/ape07070100000007000081A40000000000000000000000016742CF510000005B000000000000000000000000000000000000003900000000suse-distro-blockchain-1732431697.39c16c0/ape/.gitignore# Ape stuff .build/ .cache/ # Python .env .venv .pytest_cache .python-version __pycache__ 07070100000008000081A40000000000000000000000016742CF510000002A000000000000000000000000000000000000003E00000000suse-distro-blockchain-1732431697.39c16c0/ape/ape-config.yamlplugins: - name: vyper version: 0.4.0 07070100000009000041ED0000000000000000000000026742CF5100000000000000000000000000000000000000000000003800000000suse-distro-blockchain-1732431697.39c16c0/ape/contracts0707010000000A000081A40000000000000000000000016742CF51000010BB000000000000000000000000000000000000004200000000suse-distro-blockchain-1732431697.39c16c0/ape/contracts/distro.vy# @version ^0.4.0 # SHA-512 ready string for build verification #type BuildVerificationType = Bytes[128] # SHA-256 string for git refs #type GitVerificationType = String[64] # The board of openSUSE community. Or the leadership team of SUSE.com. foundation_owner: public(address) # Empower an OBS admin to create products initially product_creator: public(address) # Empower an entity to become the official validator official_validator: public(address) # Allow to revoke a product build security_team: public(address) # count products to get an ID as identifier next_product: public(uint256) # A product entry, each iteration is a new product. struct my_product : # short name including the branch # For example "SLFO-1.1" for the managed code stream name: String[16] # defines the used source hash. # no git url here, just the hash git_ref: String[64] # some marker to invalidate the build known_critical_issues: bool # reached_end_of_life: bool products: HashMap[uint256, my_product] # A product may be build in different forms. For example # an rpm-md tree, an install iso, kvm image or container. # Each of them need to become validated independend flag BuildKinds: rpmmd product struct my_product_build : # as given on product create product_id: uint256 kind: uint8 verified: bool product_builds: HashMap[String[128], my_product_build] current_verification: HashMap[String[19], String[128]] @deploy def __init__(_product_creator: address, _official_validator: address, _security_team: address): self.foundation_owner = msg.sender self.product_creator = _product_creator self.official_validator = _official_validator self.security_team = _security_team # zero product is currently used for not existing product self.next_product = 1 @external def add_product(name: String[16], git_ref: String[64]) -> uint256: # Only product creator is allowed to add a new product assert msg.sender == self.product_creator # we have not reached our limit yet assert self.next_product < max_value(uint256) # add the product current_product: uint256 = self.next_product self.products[current_product].name = name self.products[current_product].git_ref = git_ref self.products[current_product].known_critical_issues = False self.next_product += 1 return current_product @external def add_product_build(git_ref: String[64], kind: uint8, verification: String[128]): # Only product creator is allowed to add a new product assert msg.sender == self.product_creator # build is not yet registered assert self.product_builds[verification].product_id == 0 # find the product for product_id: uint256 in range(max_value(uint256)): assert product_id < self.next_product if self.products[product_id].git_ref == git_ref: self.product_builds[verification].product_id = product_id current_key: String[19] = concat(self.products[product_id].name, uint2str(kind)) # set current verification self.current_verification[current_key] = verification break # we found a product now assert self.product_builds[verification].product_id != 0 self.product_builds[verification].kind = kind self.product_builds[verification].verified = False @view @external def get_product(product_id: uint256) -> my_product: return self.products[product_id] @view @external def get_product_build(verification: String[128]) -> my_product_build: return self.product_builds[verification] @view @external def current_product_build(name: String[16], kind: uint8) -> String[128]: hash: String[19] = concat(name, uint2str(kind)) return self.current_verification[hash] @view @external def get_product_counter() -> uint256: return self.next_product - 1 @external def set_critical(product_id: uint256, critical: bool): assert msg.sender == self.security_team self.products[product_id].known_critical_issues = critical @external def add_attestation(verification: String[128]): # We have currently just a single official validator assert msg.sender == self.official_validator self.product_builds[verification].verified = True 0707010000000B000081A40000000000000000000000016742CF51000009A3000000000000000000000000000000000000004500000000suse-distro-blockchain-1732431697.39c16c0/ape/deployed_contracts.txt2024-01-17 12:42:46: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-17 19:12:49: simple - Address: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 2024-01-20 13:25:25: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:25:54: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:27:33: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:31:49: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:32:31: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:37:34: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:38:53: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:40:05: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:40:47: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:42:16: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:43:15: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:43:39: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:49:26: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:52:38: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 13:59:43: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:04:58: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:06:06: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:10:18: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:25:23: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:26:30: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:27:23: simple - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 14:53:40: storage - Address: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 2024-01-20 14:54:31: storage - Address: 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 2024-01-20 17:53:48: storage - Address: 0x25AADb79218A717dF9DD63671bc004A17F550227 2024-01-20 17:55:25: storage - Address: 0x32c44284fa28B18C8a1c275a5b52A4B7FFa5B68e 2024-01-20 18:10:20: storage - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 2024-01-20 18:12:37: storage - Address: 0x25AADb79218A717dF9DD63671bc004A17F550227 2024-01-20 18:16:28: storage - Address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 0707010000000C000041ED0000000000000000000000026742CF5100000000000000000000000000000000000000000000003600000000suse-distro-blockchain-1732431697.39c16c0/ape/scripts0707010000000D000081A40000000000000000000000016742CF5100000D03000000000000000000000000000000000000004600000000suse-distro-blockchain-1732431697.39c16c0/ape/scripts/deploy_anvil.pyfrom ape import accounts, project from datetime import datetime import os import subprocess def pyremix(contract): contract_name = contract subprocess.run(["python3", "../pyremix/create_abi.py", contract_name]) subprocess.run(["python3", "../pyremix/createweb3.py"]) subprocess.run(["python3", "../pyremix/create_streamlit_abi.py", contract_name]) # Run Streamlit app subprocess.run(["streamlit", "run", "streamlit_app.py"]) def main(): #contract_name = input("Enter contract name: ") # List all contract files in the ape/contracts directory contracts_dir = os.path.join("./", "contracts") contract_files = [f for f in os.listdir(contracts_dir) if os.path.isfile(os.path.join(contracts_dir, f)) and f.endswith('.vy')] contract_names = [os.path.splitext(f)[0] for f in contract_files] # Present contract names to the user # print("Available contracts:") # for i, name in enumerate(contract_names, start=1): # print(f"{i}: {name}") # Get user choice # contract_choice = None # while contract_choice not in range(1, len(contract_names) + 1): # try: # contract_choice = int(input("Enter the number of the contract you want to deploy: ")) # except ValueError: # pass # Invalid input, prompt again # Hardcode to pick the first (distro.vy) contract_choice = 1 contract_name = contract_names[contract_choice - 1] # Initialize deployer account and print balance foundation_account = accounts.load("foundation") print(f'The foundation account balance is: {foundation_account.balance / 1e18} ETH') # additional accounts product_creator_account = accounts.load("product_creator") print(f'The product creator account balance is: {foundation_account.balance / 1e18} ETH') attestator_account = accounts.load("attestator") print(f'The attestator account balance is: {foundation_account.balance / 1e18} ETH') security_team_account = accounts.load("security_team") print(f'The security team account balance is: {foundation_account.balance / 1e18} ETH') #####CHOOSE NETWORK FOR LOCAL UI### chain_id = "31337" ####### # Deploy the smart contract and print a message contract_class = getattr(project, contract_name) deployed_contract = foundation_account.deploy(contract_class, product_creator_account, attestator_account, security_team_account) print("Contract deployed!") contract_address = deployed_contract.address # Write CONTRACT_ADDRESS to .env file env_file_path = "../.env" new_lines = [] contract_address_line = f"CONTRACT_ADDRESS={contract_address}\n" chain_id_line = f"CHAIN_ID={chain_id}\n" if os.path.exists(env_file_path): with open(env_file_path, "r") as file: lines = file.readlines() for line in lines: if not line.startswith("CONTRACT_ADDRESS") and not line.startswith("CHAIN_ID"): new_lines.append(line) new_lines.append(contract_address_line) new_lines.append(chain_id_line) with open(env_file_path, "w") as file: file.writelines(new_lines) print("added " + chain_id + " and " + contract_address) # Run scripts for local ui in 'pyremix' folder print("PYREMIX") pyremix(contract=contract_name) 0707010000000E000081A40000000000000000000000016742CF510000076C000000000000000000000000000000000000004D00000000suse-distro-blockchain-1732431697.39c16c0/ape/scripts/deploy_local_scroll.pyfrom ape import accounts, project import os import subprocess def pyremix(contract): contract_name = contract subprocess.run(["python", "../pyremix/create_abi.py", contract_name]) subprocess.run(["python", "../pyremix/createweb3.py"]) subprocess.run(["python", "../pyremix/create_streamlit_abi.py", contract_name]) # Run Streamlit app subprocess.run(["streamlit", "run", "streamlit_app.py"]) def main(): contract_name = input("Enter contract name: ") # Initialize deployer account and print balance dev_account = accounts.load("scrollsep") print(f'The account balance is: {dev_account.balance / 1e18} ETH') #####CHOOSE NETWORK FOR LOCAL UI### chain_id = "534351" ################################### # Deploy the smart contract and print a message contract_class = getattr(project, contract_name) kw = { 'type':0 } deployed_contract = dev_account.deploy(contract_class, **kw) print("Contract deployed!") contract_address = deployed_contract.address ################################### # Write CONTRACT_ADDRESS + CHAINID to .env file env_file_path = "../.env" new_lines = [] contract_address_line = f"CONTRACT_ADDRESS={contract_address}\n" chain_id_line = f"CHAIN_ID={chain_id}\n" if os.path.exists(env_file_path): with open(env_file_path, "r") as file: lines = file.readlines() for line in lines: if not line.startswith("CONTRACT_ADDRESS") and not line.startswith("CHAIN_ID"): new_lines.append(line) new_lines.append(contract_address_line) new_lines.append(chain_id_line) with open(env_file_path, "w") as file: file.writelines(new_lines) ################################### # Run scripts for local UI in 'pyremix' folder pyremix(contract=contract_name) 0707010000000F000081A40000000000000000000000016742CF5100000EC9000000000000000000000000000000000000004900000000suse-distro-blockchain-1732431697.39c16c0/ape/scripts/master_template.pyfrom ape import accounts, project from datetime import datetime import os import subprocess def pyremix(contract): contract_name = contract subprocess.run(["python", "../pyremix/create_abi.py", contract_name]) subprocess.run(["python", "../pyremix/createweb3.py"]) subprocess.run(["python", "../pyremix/create_streamlit_abi.py", contract_name]) #subprocess.run(["python", "../pyremix/run_setup.py"]) # Run Streamlit app subprocess.run(["streamlit", "run", "streamlit_app.py"]) def main(): #contract_name = input("Enter contract name: ") contracts_dir = os.path.join("./", "contracts") contract_files = [f for f in os.listdir(contracts_dir) if os.path.isfile(os.path.join(contracts_dir, f)) and f.endswith('.vy')] contract_names = [os.path.splitext(f)[0] for f in contract_files] # Present contract names to the user print("Available contracts:") for i, name in enumerate(contract_names, start=1): print(f"{i}: {name}") # Get user choice contract_choice = None while contract_choice not in range(1, len(contract_names) + 1): try: contract_choice = int(input("Enter the number of the contract you want to deploy: ")) except ValueError: pass # Invalid input, prompt again contract_name = contract_names[contract_choice - 1] # Initialize deployer account and print balance dev_account = accounts.load("anvil0") print(f'The account balance is: {dev_account.balance / 1e18} ETH') #####CHOOSE NETWORK FOR LOCAL UI### # Present network choices and get user input networks = {'1': 'anvil', '2': 'scroll-test-net'} print("Choose the network:") for key, value in networks.items(): print(f"{key}: {value}") choice = None while choice not in networks: choice = input("Enter your choice (1 or 2): ") chosen_network = networks[choice] chain_id = "31337" if chosen_network == "anvil" else "534351" ####### # Deploy the smart contract and print a message contract_class = getattr(project, contract_name) deployed_contract = dev_account.deploy(contract_class) print("Contract deployed!") contract_address = deployed_contract.address # Get the current timestamp current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # Write the contract name, address, and timestamp to a file with open("deployed_contracts.txt", "a") as file: file.write(f"{current_time}: {contract_name} - Address: {contract_address}\n") print(f"{contract_name} address {contract_address} recorded with timestamp.") # Write CONTRACT_ADDRESS to .env file env_file_path = "../.env" new_lines = [] contract_address_line = f"CONTRACT_ADDRESS={contract_address}\n" chain_id_line = f"CHAIN_ID={chain_id}\n" if os.path.exists(env_file_path): with open(env_file_path, "r") as file: lines = file.readlines() for line in lines: if not line.startswith("CONTRACT_ADDRESS") and not line.startswith("CHAIN_ID"): new_lines.append(line) new_lines.append(contract_address_line) new_lines.append(chain_id_line) with open(env_file_path, "w") as file: file.writelines(new_lines) # Run 'run_setup.py' in 'pyremix' folder pyremix(contract=contract_name) # from ape import accounts, project # def main(): # # Initialize deployer account and print balance # dev_account = accounts.load("scrollsep") # print(f'The account balance is: {dev_account.balance / 1e18} ETH') # # Deploy the smart contract and print a message # kw = { # 'type': 0 # } # dev_account.deploy(project.hello, **kw) # print("Contract deployed!") 07070100000010000081A40000000000000000000000016742CF5100000D61000000000000000000000000000000000000003F00000000suse-distro-blockchain-1732431697.39c16c0/ape/streamlit_app.pyimport streamlit as st from web3_script import * st.title('Web3 Contract Interaction') st.header('Function: add_product') name = st.text_input('Enter name', key='add_product_name') git_ref = st.text_input('Enter git_ref', key='add_product_git_ref') if st.button('Execute add_product', key='add_product_button'): result = add_product(name, git_ref) st.write(f'Result: {result}') st.header('Function: add_product_build') git_ref = st.text_input('Enter git_ref', key='add_product_build_git_ref') kind = st.number_input('Enter kind', step=1, key='add_product_build_kind') verification = st.text_input('Enter verification', key='add_product_build_verification') if st.button('Execute add_product_build', key='add_product_build_button'): result = add_product_build(git_ref, kind, verification) st.write(f'Result: {result}') st.header('Function: get_product') product_id = st.number_input('Enter product_id', step=1, key='get_product_product_id') if st.button('Execute get_product', key='get_product_button'): result = get_product(product_id) st.write(f'Result: {result}') st.header('Function: get_product_build') verification = st.text_input('Enter verification', key='get_product_build_verification') if st.button('Execute get_product_build', key='get_product_build_button'): result = get_product_build(verification) st.write(f'Result: {result}') st.header('Function: current_product_build') name = st.text_input('Enter name', key='current_product_build_name') kind = st.number_input('Enter kind', step=1, key='current_product_build_kind') if st.button('Execute current_product_build', key='current_product_build_button'): result = current_product_build(name, kind) st.write(f'Result: {result}') st.header('Function: get_product_counter') if st.button('Execute get_product_counter', key='get_product_counter_button'): result = get_product_counter() st.write(f'Result: {result}') st.header('Function: set_critical') product_id = st.number_input('Enter product_id', step=1, key='set_critical_product_id') critical = st.text_input('Enter critical', key='set_critical_critical') if st.button('Execute set_critical', key='set_critical_button'): result = set_critical(product_id, critical) st.write(f'Result: {result}') st.header('Function: add_attestation') verification = st.text_input('Enter verification', key='add_attestation_verification') if st.button('Execute add_attestation', key='add_attestation_button'): result = add_attestation(verification) st.write(f'Result: {result}') st.header('Function: foundation_owner') if st.button('Execute foundation_owner', key='foundation_owner_button'): result = foundation_owner() st.write(f'Result: {result}') st.header('Function: product_creator') if st.button('Execute product_creator', key='product_creator_button'): result = product_creator() st.write(f'Result: {result}') st.header('Function: official_validator') if st.button('Execute official_validator', key='official_validator_button'): result = official_validator() st.write(f'Result: {result}') st.header('Function: security_team') if st.button('Execute security_team', key='security_team_button'): result = security_team() st.write(f'Result: {result}') st.header('Function: next_product') if st.button('Execute next_product', key='next_product_button'): result = next_product() st.write(f'Result: {result}') 07070100000011000081A40000000000000000000000016742CF51000025B6000000000000000000000000000000000000003D00000000suse-distro-blockchain-1732431697.39c16c0/ape/web3_script.pyfrom web3 import Web3, HTTPProvider from dotenv import load_dotenv import os load_dotenv() w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) assert w3.is_connected(), 'Failed to connect to the Ethereum client.' contract_address = '0x0e075cB6f980203F8e930a0B527CDbE07F303eAD' abi = [ { "stateMutability": "nonpayable", "type": "function", "name": "add_product", "inputs": [ { "name": "name", "type": "string" }, { "name": "git_ref", "type": "string" } ], "outputs": [ { "name": "", "type": "uint256" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "add_product_build", "inputs": [ { "name": "git_ref", "type": "string" }, { "name": "kind", "type": "uint8" }, { "name": "verification", "type": "string" } ], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "get_product", "inputs": [ { "name": "product_id", "type": "uint256" } ], "outputs": [ { "name": "", "type": "tuple", "components": [ { "name": "name", "type": "string" }, { "name": "git_ref", "type": "string" }, { "name": "known_critical_issues", "type": "bool" } ] } ] }, { "stateMutability": "view", "type": "function", "name": "get_product_build", "inputs": [ { "name": "verification", "type": "string" } ], "outputs": [ { "name": "", "type": "tuple", "components": [ { "name": "product_id", "type": "uint256" }, { "name": "kind", "type": "uint8" }, { "name": "verified", "type": "bool" } ] } ] }, { "stateMutability": "view", "type": "function", "name": "current_product_build", "inputs": [ { "name": "name", "type": "string" }, { "name": "kind", "type": "uint8" } ], "outputs": [ { "name": "", "type": "string" } ] }, { "stateMutability": "view", "type": "function", "name": "get_product_counter", "inputs": [], "outputs": [ { "name": "", "type": "uint256" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_critical", "inputs": [ { "name": "product_id", "type": "uint256" }, { "name": "critical", "type": "bool" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "add_attestation", "inputs": [ { "name": "verification", "type": "string" } ], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "foundation_owner", "inputs": [], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "product_creator", "inputs": [], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "official_validator", "inputs": [], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "security_team", "inputs": [], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "next_product", "inputs": [], "outputs": [ { "name": "", "type": "uint256" } ] }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [ { "name": "_product_creator", "type": "address" }, { "name": "_official_validator", "type": "address" }, { "name": "_security_team", "type": "address" } ], "outputs": [] } ] contract = w3.eth.contract(address=contract_address, abi=abi) account_address = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' private_key = os.getenv('PRIVATE_KEY') assert private_key, 'Private key not found in .env file' def add_product(name, git_ref): # Update nonce before building transaction updated_nonce = w3.eth.get_transaction_count(account_address) # Build transaction with updated nonce txn = contract.functions.add_product(name, git_ref).build_transaction({ 'chainId': 31337, 'gas': 2000000, 'nonce': updated_nonce, }) # Sign transaction signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key) # Send transaction tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction) # Wait for transaction to be mined tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) return tx_receipt def add_product_build(git_ref, kind, verification): # Update nonce before building transaction updated_nonce = w3.eth.get_transaction_count(account_address) # Build transaction with updated nonce txn = contract.functions.add_product_build(git_ref, kind, verification).build_transaction({ 'chainId': 31337, 'gas': 2000000, 'nonce': updated_nonce, }) # Sign transaction signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key) # Send transaction tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction) # Wait for transaction to be mined tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) return tx_receipt def get_product(product_id): return contract.functions.get_product(product_id).call() def get_product_build(verification): return contract.functions.get_product_build(verification).call() def current_product_build(name, kind): return contract.functions.current_product_build(name, kind).call() def get_product_counter(): return contract.functions.get_product_counter().call() def set_critical(product_id, critical): # Update nonce before building transaction updated_nonce = w3.eth.get_transaction_count(account_address) # Build transaction with updated nonce txn = contract.functions.set_critical(product_id, critical).build_transaction({ 'chainId': 31337, 'gas': 2000000, 'nonce': updated_nonce, }) # Sign transaction signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key) # Send transaction tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction) # Wait for transaction to be mined tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) return tx_receipt def add_attestation(verification): # Update nonce before building transaction updated_nonce = w3.eth.get_transaction_count(account_address) # Build transaction with updated nonce txn = contract.functions.add_attestation(verification).build_transaction({ 'chainId': 31337, 'gas': 2000000, 'nonce': updated_nonce, }) # Sign transaction signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key) # Send transaction tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction) # Wait for transaction to be mined tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) return tx_receipt def foundation_owner(): return contract.functions.foundation_owner().call() def product_creator(): return contract.functions.product_creator().call() def official_validator(): return contract.functions.official_validator().call() def security_team(): return contract.functions.security_team().call() def next_product(): return contract.functions.next_product().call() 07070100000012000081A40000000000000000000000016742CF51000004A1000000000000000000000000000000000000003900000000suse-distro-blockchain-1732431697.39c16c0/pyproject.toml[tool.poetry] name = "repository-check" version = "0.0.1" description = "A tool to verify the state of current used repositories" authors = ["Adrian Schroeter <adrian@suse.de>"] license = "GPLv3" readme = "README.md" exclude = ["pyremix", "ape"] packages = [ { include = "suse-distro-blockchain", from = "src" }, ] #documentation = "http://.readthedocs.io" repository = "https://github.com/adrianschroeter/suse-distro-blockchain" classifiers = [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "Topic :: System :: Networking" ] [tool.poetry.scripts] distro-repository-check = "suse-distro-check:main" [tool.poetry.dependencies] python = "^3.12" web3 = "^7.5.0" [tool.poetry.dev-dependencies] black = "^19.10b0" flake8 = "^3.9.0" flake8-docstrings = "^1.6.0" flake8-import-order = "^0.18.1" pytest = "^6.2.3" pytest-cov = "^2.11.1" sphinx = "^3.5.3" sphinx-rtd-theme = "^0.5.1" mypy = "^0.812" [tool.coverage.run] branch = true source = ["suse-distro-check"] [tool.coverage.report] show_missing = true [build-system] requires = ["poetry-core"] #build-backend = "poetry.core.masonry.api" 07070100000013000041ED0000000000000000000000026742CF5100000000000000000000000000000000000000000000003200000000suse-distro-blockchain-1732431697.39c16c0/pyremix07070100000014000081A40000000000000000000000016742CF51000005B0000000000000000000000000000000000000004000000000suse-distro-blockchain-1732431697.39c16c0/pyremix/create_abi.pyimport json import os import sys def write_abi_to_env(contract_name): # Adjust file path to point to the correct location print("getting abi for " + contract_name) file_path = os.path.join("..", "ape", ".build", f"{contract_name}.json") print("this is filepath"+file_path) # Read ABI from the JSON file try: with open(file_path, 'r') as file: contract_data = json.load(file) abi = contract_data except FileNotFoundError: print(f"File {file_path} not found.") return except KeyError: print(f"ABI not found in {file_path}.") return # Adjust .env file path to be at the same level as pyremix folder env_file_path = os.path.join("..", ".env") abi_str = json.dumps(abi) # Read the existing .env file and replace or append ABI new_lines = [] abi_line = f"ABI={abi_str}\n" if os.path.exists(env_file_path): with open(env_file_path, "r") as file: lines = file.readlines() for line in lines: if not line.startswith("ABI"): new_lines.append(line) new_lines.append(abi_line) with open(env_file_path, "w") as file: file.writelines(new_lines) print("ABI written to .env file.") # Example usage if len(sys.argv) > 1: contract_name = sys.argv[1] else: print("No contract name provided.") sys.exit(1) write_abi_to_env(contract_name) 07070100000015000081A40000000000000000000000016742CF5100000828000000000000000000000000000000000000004A00000000suse-distro-blockchain-1732431697.39c16c0/pyremix/create_streamlit_abi.pyimport json from dotenv import load_dotenv import os load_dotenv(dotenv_path='../.env') def create_streamlit_app_from_abi(abi, streamlit_app_file): with open(streamlit_app_file, 'w') as app_file: # Write the imports and basic setup for Streamlit app app_file.write("import streamlit as st\n") app_file.write("from web3_script import *\n\n") # Adjust this import according to your web3 script app_file.write("st.title('Web3 Contract Interaction')\n\n") # Generate Streamlit widgets for each function in the ABI for item in abi: if item['type'] == 'function': function_name = item['name'] params = item['inputs'] app_file.write(f"st.header('Function: {function_name}')\n") param_values = [] for param in params: param_name = param['name'] param_type = param['type'] key = f"{function_name}_{param_name}" if param_type == 'bytes': app_file.write(f"{param_name} = st.text_input('Enter {param_name}', key='{key}').encode()\n") elif 'uint' in param_type or 'int' in param_type: app_file.write(f"{param_name} = st.number_input('Enter {param_name}', step=1, key='{key}')\n") else: app_file.write(f"{param_name} = st.text_input('Enter {param_name}', key='{key}')\n") param_values.append(param_name) # Create a button for the function app_file.write(f"if st.button('Execute {function_name}', key='{function_name}_button'):\n") app_file.write(f" result = {function_name}(" + ', '.join(param_values) + ")\n") app_file.write(" st.write(f'Result: {result}')\n\n") # Example usage contract_abi = json.loads(os.getenv('ABI', '[]')) streamlit_app_path = 'streamlit_app.py' # Path for the new Streamlit app create_streamlit_app_from_abi(contract_abi, streamlit_app_path) 07070100000016000081A40000000000000000000000016742CF5100000BAB000000000000000000000000000000000000004000000000suse-distro-blockchain-1732431697.39c16c0/pyremix/createweb3.pyimport json from dotenv import load_dotenv import os # Load environment variables load_dotenv() def create_web3_script(output_file): chain_id = os.getenv('CHAIN_ID', '31337') # Default to 31337 if not found contract_address = os.getenv('CONTRACT_ADDRESS') account_address = os.getenv('ACCOUNT_ADDRESS') http_provider_url = os.getenv('HTTP_PROVIDER_URL') abi = json.loads(os.getenv('ABI', '[]')) # Default to empty list if not found with open(output_file, 'w') as f: f.write("from web3 import Web3, HTTPProvider\n") f.write("from dotenv import load_dotenv\n") f.write("import os\n\n") f.write("load_dotenv()\n\n") f.write(f"w3 = Web3(Web3.HTTPProvider('{http_provider_url}'))\n\n") f.write("assert w3.is_connected(), 'Failed to connect to the Ethereum client.'\n\n") f.write(f"contract_address = '{contract_address}'\n") f.write("abi = " + json.dumps(abi, indent=4) + "\n\n") f.write("contract = w3.eth.contract(address=contract_address, abi=abi)\n\n") f.write(f"account_address = '{account_address}'\n") f.write("private_key = os.getenv('PRIVATE_KEY')\n") f.write("assert private_key, 'Private key not found in .env file'\n\n") for item in abi: if item['type'] == 'function': function_name = item['name'] params = [input['name'] for input in item['inputs']] params_str = ", ".join(params) f.write(f"def {function_name}({params_str}):\n") if item['stateMutability'] in ['view', 'pure']: f.write(f" return contract.functions.{function_name}({params_str}).call()\n\n") else: f.write(" # Update nonce before building transaction\n") f.write(" updated_nonce = w3.eth.get_transaction_count(account_address)\n\n") f.write(f" # Build transaction with updated nonce\n") f.write(f" txn = contract.functions.{function_name}({params_str}).build_transaction({{\n") f.write(" 'chainId': " + chain_id + ",\n") f.write(" 'gas': 2000000,\n") f.write(" 'nonce': updated_nonce,\n") f.write(" })\n\n") f.write(" # Sign transaction\n") f.write(" signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key)\n") f.write(" # Send transaction\n") f.write(" tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction)\n") f.write(" # Wait for transaction to be mined\n") f.write(" tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)\n") f.write(" return tx_receipt\n\n") # Example usage output_script_path = 'web3_script.py' create_web3_script(output_script_path) 07070100000017000081A40000000000000000000000016742CF5100000291000000000000000000000000000000000000003F00000000suse-distro-blockchain-1732431697.39c16c0/pyremix/run_setup.pyimport subprocess def run_scripts_in_order(): scripts = [("create_abi.py", "argument_for_abi"), "createweb3.py", "create_streamlit_abi.py"] for script in scripts: if isinstance(script, tuple): script_name, arg = script command = ["python", script_name, arg] else: command = ["python", script] try: subprocess.run(command, check=True) print(f"Successfully ran {script}") except subprocess.CalledProcessError as e: print(f"An error occurred while running {script}: {e}") break if __name__ == "__main__": run_scripts_in_order() 07070100000018000081A40000000000000000000000016742CF51000000D7000000000000000000000000000000000000003400000000suse-distro-blockchain-1732431697.39c16c0/setup.cfg[flake8] ignore=D200,E203,E501 [mypy] check_untyped_defs = true disallow_incomplete_defs = true disallow_untyped_calls = true disallow_untyped_decorators = true disallow_untyped_defs = true strict_optional = true 07070100000019000041ED0000000000000000000000046742CF5100000000000000000000000000000000000000000000002E00000000suse-distro-blockchain-1732431697.39c16c0/src0707010000001A000041ED0000000000000000000000026742CF5100000000000000000000000000000000000000000000004500000000suse-distro-blockchain-1732431697.39c16c0/src/suse-distro-blockchain0707010000001B000081A40000000000000000000000016742CF51000021E1000000000000000000000000000000000000005A00000000suse-distro-blockchain-1732431697.39c16c0/src/suse-distro-blockchain/suse-distro-check.py#!/usr/bin/python3 from web3 import Web3, EthereumTesterProvider from iniparse import INIConfig from optparse import OptionParser from typing import List from termcolor import colored config_file = "/etc/suse-distro-check.conf" cfg = INIConfig(open(config_file)) network='main' # not a network, but our starting point in config file. It defines the network to be used. provider_url='' provider=None chainid=0 contract_address="0x0" for alias in cfg: if network != alias: continue for k in cfg[alias]: if alias == 'main' and k == 'network': network = cfg[alias][k] if k == 'http_provider': provider_url = cfg[alias][k] if k == 'chainid': chainid = int(cfg[alias][k]) if k == 'contract': contract_address = Web3.to_checksum_address(cfg[alias][k]) provider = Web3.HTTPProvider(provider_url) print(f"Reaching out to {provider_url}") w3 = Web3(provider) if not w3.is_connected(): print("We have no contact to our local blockchain provider") exit(1) print(f"Used chain ID: {w3.eth.chain_id}, @block: {w3.eth.block_number}, contract: {contract_address}") if w3.eth.chain_id != chainid: print(f"Wrong chain ID: {w3.eth.chain_id} and we expect {chainid}") exit(1) if w3.eth.syncing: print("Ethereum is still syncing, we have no reliable data yet") exit(1) # contract abi, imported from compiler output abi = [{"stateMutability": "nonpayable", "type": "function", "name": "add_product", "inputs": [{"name": "name", "type": "string"}, {"name": "git_ref", "type": "string"}], "outputs": [{"name": "", "type": "uint256"}]}, {"stateMutability": "nonpayable", "type": "function", "name": "add_product_build", "inputs": [{"name": "git_ref", "type": "string"}, {"name": "kind", "type": "uint8"}, {"name": "verification", "type": "string"}], "outputs": []}, {"stateMutability": "view", "type": "function", "name": "get_product", "inputs": [{"name": "product_id", "type": "uint256"}], "outputs": [{"name": "", "type": "tuple", "components": [{"name": "name", "type": "string"}, {"name": "git_ref", "type": "string"}, {"name": "known_critical_issues", "type": "bool"}]}]}, {"stateMutability": "view", "type": "function", "name": "get_product_build", "inputs": [{"name": "verification", "type": "string"}], "outputs": [{"name": "", "type": "tuple", "components": [{"name": "product_id", "type": "uint256"}, {"name": "kind", "type": "uint8"}, {"name": "verified", "type": "bool"}]}]}, {"stateMutability": "view", "type": "function", "name": "current_product_build", "inputs": [{"name": "name", "type": "string"}, {"name": "kind", "type": "uint8"}], "outputs": [{"name": "", "type": "string"}]}, {"stateMutability": "view", "type": "function", "name": "get_product_counter", "inputs": [], "outputs": [{"name": "", "type": "uint256"}]}, {"stateMutability": "nonpayable", "type": "function", "name": "set_critical", "inputs": [{"name": "product_id", "type": "uint256"}, {"name": "critical", "type": "bool"}], "outputs": []}, {"stateMutability": "nonpayable", "type": "function", "name": "add_attestation", "inputs": [{"name": "verification", "type": "string"}], "outputs": []}, {"stateMutability": "view", "type": "function", "name": "foundation_owner", "inputs": [], "outputs": [{"name": "", "type": "address"}]}, {"stateMutability": "view", "type": "function", "name": "product_creator", "inputs": [], "outputs": [{"name": "", "type": "address"}]}, {"stateMutability": "view", "type": "function", "name": "official_validator", "inputs": [], "outputs": [{"name": "", "type": "address"}]}, {"stateMutability": "view", "type": "function", "name": "security_team", "inputs": [], "outputs": [{"name": "", "type": "address"}]}, {"stateMutability": "view", "type": "function", "name": "next_product", "inputs": [], "outputs": [{"name": "", "type": "uint256"}]}, {"stateMutability": "nonpayable", "type": "constructor", "inputs": [{"name": "_product_creator", "type": "address"}, {"name": "_official_validator", "type": "address"}, {"name": "_security_team", "type": "address"}], "outputs": []}] contract = w3.eth.contract(address=contract_address, abi=abi) def main(argv: List[str] = None) -> None: """ Run the local check """ from xml.dom.minidom import parse, parseString import glob import re import os import argparse parser = argparse.ArgumentParser( description="Validate you repository via the blockchain.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument( "aliases", nargs="+", help="The alias of a repository to be checked as defined in zypp repo file", ) args = parser.parse_args(argv) repos = [] reposdirs = [ "/etc/zypp/repos.d" ] for reposdir in reposdirs: if not os.path.isdir(reposdir): continue for reponame in sorted(glob.glob('%s/*.repo' % reposdir)): repocfg = INIConfig(open(reponame)) for alias in repocfg: if len(args.aliases) > 0 and not alias in args.aliases[0]: continue repoattr = {'enabled': 0, 'priority': 99, 'autorefresh': 1, 'type': 'rpm-md', 'metadata_expire': 900} for k in repocfg[alias]: repoattr[k] = repocfg[alias][k] if repoattr['type'] == 'rpm-md': path = re.sub(r'.*/', '', reponame) path = re.sub(r'\.repo$', '', path) path = re.sub(r'^\.', '_', path) rpmmd = "/var/cache/zypp/raw/" + re.sub(r'[/]', '_', path) rpmmd += "/repodata/repomd.xml" if not os.path.exists(rpmmd): print(f"Warning: skipping {rpmmd}") continue print(f"Reading {rpmmd}") xml = parse(rpmmd) for data in xml.getElementsByTagName("data"): if data.getAttribute("type") != "primary": continue cksum = data.getElementsByTagName("checksum")[0] cksum_type = cksum.getAttribute("type") if cksum_type != "sha256" and cksum_type != "sha512": print(f"Warning: skipping {rpmmd}, not supported checksum type") continue verification = cksum.firstChild.nodeValue # We have the checksum of our primary file, now ask the blockchain try: build = contract.functions.get_product_build(verification).call() except: print(f"Warning: repo not registered in the block chain with verification id {verification}") continue # we get always an empty product atm when it is not matching if build[0] == 0: print(f"Warning: repo not registered in the block chain with id {verification}") continue product = contract.functions.get_product(build[0]).call() exit_code=0 print(f"Selected product: {product[0]}") print(f"Used source SHA-256: {product[1]}") if build[1] == 0: print("Build Type: rpm-md") else: print("Build Type: UNKNOWN") if product[2]: print(colored(f"ERROR: Critical security issues reported", color="red")) exit_code=1 else: print(colored(f"No critical security issues reported", color="green")) if build[2]: print(colored(f"Same rebuild from source attestated: {build[2]}", color="green")) else: print(colored(f"Same rebuild not (yet) attestated", color="yellow")) #exit_code=1 # to be configured by user print() current_verification = contract.functions.current_product_build(product[0], build[1]).call() if verification == current_verification: print(colored("The contract proofed your repository cache as current state :)", color="green")) else: print(colored(f"ERROR: The contract has different current state registered: {current_verification}", color="red")) exit_code=1 exit(exit_code) if __name__ == "__main__": # pragma: nocover main() 0707010000001C000041ED0000000000000000000000026742CF5100000000000000000000000000000000000000000000004E00000000suse-distro-blockchain-1732431697.39c16c0/src/suse_distro_blockchain.egg-info0707010000001D000081A40000000000000000000000016742CF5100000042000000000000000000000000000000000000005700000000suse-distro-blockchain-1732431697.39c16c0/src/suse_distro_blockchain.egg-info/PKG-INFOMetadata-Version: 2.1 Name: suse-distro-blockchain Version: 0.0.0 0707010000001E000081A40000000000000000000000016742CF510000011A000000000000000000000000000000000000005A00000000suse-distro-blockchain-1732431697.39c16c0/src/suse_distro_blockchain.egg-info/SOURCES.txtREADME.md pyproject.toml setup.cfg src/suse-distro-blockchain/suse-distro-check.py src/suse_distro_blockchain.egg-info/PKG-INFO src/suse_distro_blockchain.egg-info/SOURCES.txt src/suse_distro_blockchain.egg-info/dependency_links.txt src/suse_distro_blockchain.egg-info/top_level.txt0707010000001F000081A40000000000000000000000016742CF5100000001000000000000000000000000000000000000006300000000suse-distro-blockchain-1732431697.39c16c0/src/suse_distro_blockchain.egg-info/dependency_links.txt 07070100000020000081A40000000000000000000000016742CF5100000017000000000000000000000000000000000000005C00000000suse-distro-blockchain-1732431697.39c16c0/src/suse_distro_blockchain.egg-info/top_level.txtsuse-distro-blockchain 07070100000021000081A40000000000000000000000016742CF51000001B9000000000000000000000000000000000000004100000000suse-distro-blockchain-1732431697.39c16c0/suse-distro-check.conf[main] network=holesky [holesky] # Public holesky test network http_provider=https://ethereum-holesky-rpc.publicnode.com chainid=17000 contract=0x6135d6ec831bD648852Ea10a3f162d353286D4a5 [mainnet] # Production setup should be used ideally via an own node for security http_provider= chainid=1 contract= [anvil] # for local development http_provider=http://127.0.0.1:8545 chainid=31337 contract=0x12aedb6639c160b051be89b77717f46eafac282b 07070100000022000081A40000000000000000000000016742CF510000050A000000000000000000000000000000000000004200000000suse-distro-blockchain-1732431697.39c16c0/test_distro_contract.py# absolute minimal contract test case import boa from eth_account import Account contract = boa.load('ape/contracts/distro.vy', boa.env.eoa, boa.env.eoa, boa.env.eoa) git_sha="8a645f5782b507202c75ee7fbeaf7bb21d34dd5c2eda4118bb76a31a39226e30" primary_sha="562a8a6891053541a9cb4d6b252e0cdde4b9da98fc99e87aaeac3ecccb05b91755a2ffcdfd3cdd3e3a55fc5deb96157be4565f4e1c4eb177f7b08075a15e2b70" product_name="example-1" build_kind=1 print("Setting balance...") boa.env.set_balance(boa.env.eoa, 1000 * 10**18) product_id = contract.add_product(product_name, git_sha) print(f"Created Product with ID {product_id}") contract.add_product_build(git_sha, build_kind, primary_sha) print(f"Created Product Build") product_build = contract.get_product_build(primary_sha) if product_build[0] != 1 or product_build[1] != 1: print("Product Build not found!") exit(1) print("Found Product Build") product = contract.get_product(product_build[0]) if product[0] != product_name or product[1] != git_sha: print("Product Build not found!") exit(1) print("Found Product") verification = contract.current_product_build(product_name, build_kind) if verification != primary_sha: print("Is not current verification!") exit(1) print("Product is verified to be current") print(" SUCCESS :) ") 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!189 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor