Skip to content

Commit

Permalink
benjamin button [do not merge] (#575)
Browse files Browse the repository at this point in the history
* squash

* A0-1259: Add metadata to PSP22 contracts (#585)

* Add metadata to PSP22 contracts

* Fix shellcheck warnings in deploy.sh

* Remove const

* A0-1235: ticket token (#576)

* ticket token + iterations

Co-authored-by: kostekIV <[email protected]>

* A0-1159: The Pressiah Cometh (#586)

* A0-1379: Button refactor (#591)

* One contract to rule them all

* Wydup dedup

* Missing comment

* Update the deployment script

* errors

* last changes?

* error renaming

Co-authored-by: Piotr Mikołajczyk <[email protected]>

* A0-1238: Marketplace for auctioning tickets (#613)

* Prototype dummy marketplace

* Implement selling tickets

* Emit events from marketplace

* Add docs

* Deploy markets for all games

* Improve cosmetics

* Wrap original errors where possible

* Add max_price to buy()

* A0-1352: Add clean script (#624)

* creating clean contract script

* clean script working

* newline add

* Fix broken deploy-feature-envs workflow

* Fix broken deploy-feature-envs workflow (vars not wrapped with {{}})

* Fix missing backslash in deploy-feature-envs workflow

* fix token names (#639)

* Simple dex (#612)

* implementation sur course

* swaps done

* add new role

* added events

* wut

* edited events

* set AC

* give why

* docstring

* modified docstring

* cleanup

* Update contracts/simple_dex/lib.rs

Co-authored-by: deuszx <[email protected]>

* simplified artihmetic

* moved roles to own mod

* wZERO

* dumbed down LP

* slippage check

* check pool composition

* explicitely check swap fee value that is set

* change parameter name to avoid confusion, use integer operations
could use promils for better precision but meh

* not payabale

* refactor

* ok semver

* refactor role check

* remove duplicated check

* Update contracts/wrapped_azero/lib.rs

Co-authored-by: deuszx <[email protected]>

* remove unused dep

* Update contracts/simple_dex/lib.rs

Co-authored-by: Michal Handzlik <[email protected]>

* Update contracts/simple_dex/lib.rs

Co-authored-by: Michal Handzlik <[email protected]>

* added swap pairs

* edited docstring

Co-authored-by: deuszx <[email protected]>
Co-authored-by: Michal Handzlik <[email protected]>

* Add --faucet-account-id to deploy-feature-envs workflow

* Modify forkoff in deploy-feature-envs to keep state of Balances

* Fix invalid argument used in deploy feature env

* Remove forkoff from deploy feature env

* A0-1238: Put tickets into marketplace when button dies (#630)

* Transfer all tickets to market on button reset

* Update contracts/button/lib.rs

Co-authored-by: kostekIV <[email protected]>

* Update contracts/button/lib.rs

Co-authored-by: kostekIV <[email protected]>

* Fix misapplied suggestion

* Inline function

Co-authored-by: kostekIV <[email protected]>

* add score (#645)

* Tweak indentation in cliain Dockerfile to get rid of conflict

* Alter deploy-feature-envs workflow to remove DEPLOYED-CONTRACTS label if present

* use docker network (#654)

* use docker network

* cleanup

* A0-1236: Minting and burning reward tokens (#657)

* add round number to storage (#661)

* Wrap clean.sh to catch some errors

* Add env file for fe-benjamin

* A0-1416: Add workflow for deploying the button

* Replace some variables in the the-button workflow

* Add missing env variable in fe-benjamin environment

* In button workflow, comment out push event and upload NODE env var to artifacts

* Modify workflow so that restore-cache will not be failing

* increse lifetime (#671)

* Add step to upload artifact with contracts' json files (#673)

* Fix missing semicolon (#678)

* check if exists before removing (#681)

* Remove unnecessary old input params when triggering the-button workflow (#685)

* wait for finalization (#684)

* wait for finalization

* Blend contracts e2e tests and deployment workflows into one workflow

* addressing comments

Co-authored-by: Mikolaj Gasior <[email protected]>

* Change contracts workflow to deploy only on push (#698)

* A0-1140: e2e tests for contracts (#697)

* Fix invalid clap default

* Setup framework for testing the button

* Test early bird play

* Test marketplace contract

* Test all button game variants

* Run contract e2e tests on CI

* Bump aleph_client version

* Fix cache target list

* Fix clippy warnings

* Simplify scopes

* Add docs

* Use From/TryFrom instead of custom traits

* Allow minting only in dev

* Fix clippy

* Add missing export (#708)

* Add missing export

* Change feature-env ENV_NAME

* commit fixes (#712)

* commit fixes

* fmt fix

* just to trigger the deployment (#713)

* edit condition (#715)

* edit condition

* testit

* trigger it

* cleanup

* cleanup

* A0-1140: Deploy simple dex (#720)

* Add simple_dex to deploy.sh

* Expose out_given_in in simple_dex

* List all contracts in excluded packages (#725)

* List all contracts in excluded packages

... so that they will be checked on CI.

* Fix clippy in contracts

* A0-1140: e2e tests for simple_dex (#723)

* Add simple_dex to deploy.sh

* Expose out_given_in in simple_dex

* Add e2e test for simple_dex

* Fix clippy

* Test dex swap rejection due to slippage

* clean dex from chain (#731)

* Deploy wazero (#733)

* deploy wrapped A0

* edit workflow

* add cleanup step

* no need

* just continue

* cleanup

* check liquidity in swaps only (#736)

* check liqui in swaps

* refactor tests too

* cleanup

* check swap fail due to not enoigh liqui

* Update e2e-tests/src/test/button_game/mod.rs

Co-authored-by: Paweł Obrok <[email protected]>

* ugh fmt

Co-authored-by: Paweł Obrok <[email protected]>

* Add labels and change hardcoded contract code names with a file match

* A0-1140: Leave dust in the dex (#724)

* Add simple_dex to deploy.sh

* Expose out_given_in in simple_dex

* Add e2e test for simple_dex

* Fix clippy

* Leave dust in the dex

* Vary fee percentage in dex test

* Remove paths from contracts e2e tests

* A0-1140: e2e tests for wrapped_azero (#737)

* Add e2e tests for wrapped_azero

* Fix copypasta

* Trigger CI

* Dex whitelist (#805)

* add query

* whitelist tokens

* use benjamin feature env image

* try private

* simplify workflow to test it

* fuck

* use exported image

* uncommment

* cleanup

* remove form whitelist

* docstring

* A0-1459: Replace triggering workflow from indexer repo with kubectl cmds (#813)

* Replace triggering workflow from indexer repo with kubectl cmds

* only one workflow running ever (#954)

* only one workflow runnign ever

* fix version

* update to public image

* Merge main + migrate to ink4 (#898)

* A0-1472 Validator Network log addresses (#701)

* A0-1455: Refactor for incoming protocol upgrade (#711)

* Refactor for incoming protocol upgrade

* The type should be what is sent, not the sending mechanism

* version upgrade catchup test (#706)

* support in cliain for version_upgrade

* support of our docker-compose to run using bridged docker's network

* catchup_version_upgrade_test.sh

* added the catchup version upgrade test to github pipelines

* review changes

* chmod +x catchup_version_upgrade_test.sh

* review changes: using `matrix` for catch-up version upgrade test

* review changes: bumped version of aleph-client; added schedule_version_upgrade_with_state

* review changes: comment about key derivation in docker-compose `//1` etc.

* fix: e2e...yml: wrong `uses`

* bumped e2e-tests/Cargo.lock

* fix: version_upgrade after api refactor

* review changes: added cache cleanup to build-cliain-image job

* fix: typo in e2e...yml s/NODE2/Node2

* fix for e2e...yml: fixed matrix-include for catch-up version upgrade test

* review changes: renamed local variable in catchup_version_upgrade.sh

* more review changes for catchup_version_upgrade_test.sh

* A0-1499: E2e ban test threshold (#704)

* Checkpoint

* Partial attempt

* Fixed index

* Touch up

* Reworked automatic test for greater modularity

* Partial manual kick-out

* Modularity; bumped crate versions

* GH workflow

* Test case reordering

* Initial modules work

* Manual kickout case

* Consts

* Modules

* Checkpoint

* Removed next era validators check

* Checkpoint

* Semver consistent versioning

* Removed superfluous function and imports

* Checkpoint

* Explicit params for bounded vec

* Merge fixes

* Changed bounded vec creation

* Linter, version

* Fixed reason passed to extrinsic

* Session count tracking

* Welcome to the ban world!

* GH workflow

* Changed params to refs; cases reorder

* Housekeeping

* Version bumps

* Changed option unwrapping

* Removed needless borrow

* Added ban event call

* Removed borrows

* Removed ban event call from initial place

* Changed test logic to post factum

* Changed logic to test only sessions after ban config change comes in

* Test logic fix

* Typo fix in rewards test

* Removed unnecessary reference

* Rolled back pallet change

* aleph-client version bump

* A0-1455: Add future protocol and decision process for connection direction (#716)

* Add future protocol and decision process for connection direction

Not used for now, that'll be in the next PR.

* Small review comments

* Massively improve xor computation

* Naming in tests

* A0-1413: remove legacy network (#719)

* remove legacy network

* fix tests

* remove unnecessary comment

* fix test names

* A0-1455: Enable two-way connections (#721)

* Enable two-way connections

* Add comments, remove typos

* Clarify legacy marking logic

* Linter

* A0-1574: Remove unnecessary implementations in the substrate network (#726)

* Remove substrate NetworkIdentity

* No Multiaddress requirement for substrate network

* Remove unnecessary wrappers

* A0-1586: At most one discovery message (#734)

* At most one discovery message

* Clippy being helpful

* A0-1591: Remove unnecessary abstraction layers in network (#741)

* Remove unnecessary abstraction layers in network

* Test name made little sense now

* A0 1350 - small subxt migration (#730)

* disable try-runtime check (#750)

* Add timeout for upgrade catchup e2e test (#758)

* Add authentication compatibility tests with fixed bytes (#751)

* Update to 0.9.29 (#754)

* fix runtime

* fix aleph-node

* bump spec version

* bump versions

* update runtime in aleph-client

* Temporarily remove try-runtime

* review nits

* fix tests

* reintroduce try-runtime

* whitespaces

Co-authored-by: Jan Koscisz <[email protected]>
Co-authored-by: kostekIV <[email protected]>

* Update to 0.9.30 (#756)

* A0-1585: Replace AuthorityId with parameter (#748)

* Replace AuthorityId with parameter

* SecretKey is a much better name than PrivateKey

* Rename most peer ids to public keys

Co-authored-by: lesniak43 <[email protected]>

* Request justification from forks (#764)

* add backend

* request justification from forks

* change requesting logic

* Request penultimate block

* review changes

* fix rename leftover

* simplify backend dependecy

* Rework justification request status

* Revert "simplify backend dependecy"

This reverts commit abf2605.

* fix revert

* fix service

* warn about missing blocks

* improve comment

* Review changes

* improve comment

* split and simplify request logic

* Do do_request wanted

* Clearer?

* fix inequality after moving surrounding block

* Always count child tries

* impl BB

* prepare for tests

* Fix tests

* bump version

* fmt

* Simplify backend trait

* fmt

* Missing generic

* A0-1584: Unify MockMultiaddress (#770)

* Unify MockMultiaddress

* Random multiaddress function

* Some clippy warnings

* network delay (#762)

* docker related configs for network-delay tests

* shell script for simple network-delay test

* - renamed dockerfile for network tests
- chmod +x for network_tests scripts

* added common.sh for scripts; more user friendly run_consensus_network_delay.sh

* refactored run_consensus_network_delay.sh

* checking relative-finalization

* A0-1635: Limit nonfinalized block production (#769)

* Limit nonfinalized block production

* Better saturation handling

* Add log when delaying block production

* Disable two tests that were operating under outdated assumptions

* Disable one more test

* Chillout (#749)

* Remove validators from candidates in elections when they're got benned

* Add missing config item

* bump spec version

* Adjust mock

* Don't ban nice guys

* fmt

* typo

Co-authored-by: Marcin <[email protected]>

* A0-1503: Use the default rust test runner (#755)

* Use the default rust test runner

* Update CI flow to use the new runner

* Refer to finalization test unambiguously in CI

* Remove accidentally commited .idea

* Fix mismerge

* Refer explicitly to some more testcases

* Refer explicitly to some more testcases

* Initialize logging in e2e tests

* Ignore ban_automatic test for now

See https://cardinal-cryptography.atlassian.net/browse/A0-1634

* Rename config() -> setup_test()

* Take e2e test binary location from cargo

* Update e2e docker build in nightly

* Fix typo

* Update to 0.9.31 (#759)

* Added pending_rewards call to nomination pool api to our runtime (#778)

* Added pending_rewards call to nomination pool api to our runtime

* Set runtime version to 0.8.4

* Experimental pruning flag (#783)

* add experimental_pruning flag

* add default value

* fmt

Co-authored-by: Jedrzej Kula <[email protected]>

* Update to 0.9.32 (#760)

* fix validator network outgoing peers status report (#785)

* Bring back pallet contracts API to runtime (#787)

* A0-1592: make connection manager operate of validator network directly (#790)

* Make connection manager operate of validator network directly

* Fix and simplify network service tests

* A0-1664 Stop exposing sync connected events from substrate network (#788)

* removing stuff

* remove tests that do not work...

* polishing

* no ()

* fmt

Co-authored-by: Damian Leśniak <[email protected]>
Co-authored-by: maciejnems <[email protected]>

* fix clashing args in purge-chain cmd (#792)

* add e2e tests for permissionless election (#702)

* we put more docker in your docker so...you can test your network (#786)

* initial version of Dockerfile for synthetic network aleph-node

* working synthetic-network

* build script for aleph-node:synthetic-network

* added script for running synthetic-network

* added descriptive log line to run-synthetic-network

* extended `help` of run_consensus_synthetic-network.sh

* refactored build_synthetic-network...

* added script for running scripts for synthetic-network

* refactored synthetic-network scripts

* refactored run_script_for_synthetic-network.sh

* refactored run_script_for_synthetic-network.sh: added help and args

* added description to patching step in build-synthetic-network script

* added description about aleph-node:latest docker image requirement in run_consensus_synthetic-network.sh

* reformated Dockerfile.synthetic-network

* added PREREQ to run_script_for_synthetic-network.sh

* +x on synthetic-network scripts

* added note about node.js in run_script_for_synthetic-network.sh

* more robust Dockerfile.synthetic_network

* FIX: docker-compose for synthetic-network was using two seperate networks and somehow libp2p was using the other one, not controlled by us

* added a shell script allowing to reset to default settings a node within synthetic-network

* moved scripts for synthetic-network

* example .js script for synthetic-network

* moved synthetic-network scripts

* added README.md for synthetic-network

* FIX: run_consensus_synthetic-network.sh after it was moved

* passing args to invoked script in run_script_for_synthetic-network.sh

* small change in README.md for synthetic-network

* review changes for synthetic-network

* A0-1520: Add uploading runtime to CI S3 bucket and attaching it to release (#699)

* Add uploading binary and runtime to CI S3 bucket
* Add runtime to prerelease and release assets

* A0-1503: Take e2e config from env (#779)

* Take e2e config from env

* Add README to e2e-tests

* A0-1575: Addressing information refactor (#795)

* Addressing information refactor

* Clippy being actually helpful

* Demariofy

Co-authored-by: timorl <[email protected]>

* A0-1520: Add a condition for S3 steps to run only when AWS secrets are present (#797)

* Add a condition for S3 steps to run only when AWS secrets are present
* Change calls to secrets var with env vars

* A0-1667 Add timeouts to the dialer (#791)

* A0-1526: Sign addressing information (#798)

* Sign addressing information

* Better name for verification

* Elaborate why zero signatures

Co-authored-by: timorl <[email protected]>

* A0-1663: remove unnecessary session start retries in connection manager (#803)

* remove retry_session_start in connection manager

* review comments

* Make the gossip network into a module (#802)

Co-authored-by: timorl <[email protected]>

* Move data network into its own module (#809)

Co-authored-by: timorl <[email protected]>

* A0-1668 Make runtime cache configurable (#801)

* Do not write old state to storage in pre-migration check (#807)

* A0-1576: Move clique network into network (#811)

* Move clique network into network

* For manager it is actually the validator network

* Stray bad use of validator_network

* Stray uses of 'validator' in clique

* Better logging targets

Co-authored-by: timorl <[email protected]>

* A0-1576: Improve network manager interface (#815)

* Improve network manager interface

* Two hard problems in CS

Co-authored-by: timorl <[email protected]>

* add clique network log target to docker entrypoint (#818)

* Make max-runtime-instances configurable (#817)

* Short session mode is now 3 (#789)

* Short session mode is now 3

* Fixed e2e case

* Clippy args change for aleph-node (#772)

* More restrictive clippy checks

* Fixed all clippy complaints

* Fixed clippy args order

* Do not allow type complexity lints to sneak through

* Streamlined clippy command

* First batch

* Partial

* Complex types partial

* Structs for mock data

* Cleanup

* Removed non-channel unused parameters

* Add logging about ABFT version (#823)

* Add logging about ABFT version

* Legacy-only log

Co-authored-by: timorl <[email protected]>

* bump versions (#820)

* bump versions

* Adjust to new versions

* Bump finality version

* bump versions and use defaults

* fmt

* consistent import

* Bump default abft version

* A0-1761: Enhance gossip network interface (#822)

* Enhance gossip network interface

* Add tests for sending

Co-authored-by: timorl <[email protected]>

* Fixing broken compatibility (#828)

* Generate raw chainspecs in script

* Make compatibility work again

Co-authored-by: timorl <[email protected]>

* A0-1491: Change protocol naming convention and add block sync protocol (#829)

* Change protocol naming convention and add block sync protocol

* Turn the block sync network on properly

Co-authored-by: timorl <[email protected]>

* A0-1609 Removed unwrap()'s in aleph-client (#824)

* A0-1609 Removed unwrap()'s in aleph-client

* A0-1609 Review

* A0-1610: Contract support redux (#816)

* Add e2e tests for a simple contract

* Fix tests and warnings

* Run adder test on CI

* Install fmt/clippy/wasm target per package on CI

The different packages can have different toolchain versions, so
installing once isn't enough.

* Install cargo contract for e2e tests

* Install cargo-contract only in adder test

It can take a significant amount of time without cache, which exceeds
the timeout on the tests.

* Install rust-src for 1.65.0 on CI

* Set adder metadata on CI

* Pass ADDER_METADATA to adder test

* Extend adder test timeout

* Give names to adder arguments in CI

* Mount contract dir in e2e tests (for the metadata)

* Fix clippy

* Bump aleph-client to 2.5.0

* Authenticate when installing protoc

This should make it less likely that we hit API limits.

* Revert "Authenticate when installing protoc"

This reverts commit f7563d4.

* Add Option<T> conversion for contract returns

* Extract variables

* A0-1796: add justification broadcast ticker (#833)

* add justification broadcast ticker

* Join periodic and normal broadcast last Instant

* move clippy dead code

* rename to ticker

* restructure tests

* change timeout after try tick true

* hmmmmmm

* apply suggested changes to docs

* add assert to constructor

* or maybe no assert

* the in docs

Co-authored-by: kostekIV <[email protected]>

* wait_and_tick

Co-authored-by: kostekIV <[email protected]>

* A0-1770: Add basic interfaces used and exposed by sync (#837)

* Add basic interfaces used and exposed by sync

* Huh, hashes are `Copy`

* Better verification abstraction

* Use BlockNumber

Co-authored-by: timorl <[email protected]>

* A0-1822: add substrate chain status notifier (#839)

* add substrate chain status notifier

* A0-1795: add task queue (#836)

* add task queue

* extract aleph-block-sync LOG_TARGET

* Add justification implementation (#841)

Co-authored-by: timorl <[email protected]>

* A0-1613 Improving `Connection`s (#834)

* synthetic-network for nightly-pipeline (#804)

* as_ref in aleph-client for Connection types

* rust API for synthetic-network's json API

* refactored synthetic-link

* new e2e-tests: high out-latency

* refactored synthetic-network bash scripts

* added git submodule for synthetic-network

* added nightly e2e test for synthetic-network

* refactored synthetic-link library

* added load_config for synthetic-network e2e test

* more refactoring of synthetic-link

* missing synthetic-link in Cargo.toml

* e2e-tests/config.rs cleaned

* Into -> From in synthetic-link

* slightly cleaned code for synthetic-network

* added RUST_SRC_PATH in shell.nix for better support for IDEs

* slightly cleaned synthetic-link

* refactored synthetic-link: more types for ranged parameters

* refactored synthetic-link lib

* added code-docs to synthetic-link

* using try_from for PortRange in synthetic-lib for input validation

* missing deps after merge for synthetic-network

* REVERT ME testing nightly pipeline

* fix after merge

* say no to install-protoc in github pipelines

* Revert "say no to install-protoc in github pipelines"

This reverts commit b991f75.

* GITHUB_TOKEN for "Install Protoc" action

* reverted changed file permissions

* reverted rust-toolchain file

* typo in description for PortRange

* e2e-tests: config.validator_names() uses validators_count

* e2e-tests: added description for the `latency` tests

* shell.nix: added description for new ENV var RUST_SRC_PATH - it's for rust-analyzer

* BACKUP: e2e-tests/config.rs with iterators

* new verion of the synthetic-network e2e-test that supports non-dockerized runs (urls)

* fix for e2e-test `no_quorum_without_high_latency` - missing call for urls instead of names

* extended README.md for the synthetic-network: how to run e2e-tests with synthetic-network locally

* renamed e2e-tests for high-out-latency with synthetic-network

* renamed one of the e2e-tests pipelines in nightly for high-latency (synthetic-network)

* Revert "REVERT ME testing nightly pipeline"

This reverts commit 8eb1410.

* A0-1619 New GH check for runtime metadata (#842)

* A0-1619 New GH check for runtime metadata

* A0-1619 Removed interactive mode from the new runtime check. Fixed steps dependencies.

* A0-1619 Attempt to fix workflows.

* A0-1619 use pre-build subxt image

* A0-1619 Fixed docker entrypoint. Regenerated runtime metadata as it was outdated.

* A0-1619 Attempt 4 to fix workflows

* A0-1619 Attempt 5 to fix workflows

* A0-1619 Hopefully better attempt to the Dockerfile

* A0-1608 Add documentation of all public API and traits of aleph-client (#832)

* A0-1608 Add documentation of all public API and traits

* A0-1608 Review

* A0-1608 Added basic workflow for building docs

* A0-1608 Removed redundant workflow condition

* A0-1068 Review part 2

* A0-1608 fixes after conflicts

* sneaky fix for outdated runtime data

* revert sneaky fix

* an ugly workaround for the fact we want to ignore rustdoc warnings in generated runtime file

* A0-1610: Restore contract event support (#838)

* Restore contract event listening

* Authenticate when installing protoc on CI

This should reduce the number of failures caused by rate limiting.

* Bump aleph-client version

* Update contract event docs

* Improve cosmetics

* This reverts commit e21d155.

* A0-1611: Full multisig support in `aleph-client` (#845)

* Full basic support

* Api is ready

* Playing

* Keep approvers instead of counter

* revert local playing

* Docs

* Easier review comments

* Move context code closer to ContextualApi

* Docs

* playground updated

* Revert "playground updated"

This reverts commit bf1dbdc.

* Updated aleph-client readme (#846)

* A0-1823: add substrate specific chain status (#844)

* add substrate chain status

* Remove `pub(crate)` from `aleph-client` (#849)

* Remove `pub(crate)`

* Don't expose client

* Revert "Don't expose client"

This reverts commit 66a3417.

* Bump

* Use official contract-transcode instead of fork (#847)

* Bump to 9.0 (#853)

* A0-1821: add substrate specific finalizer for sync protocol (#854)

* Fix syntax error in deploy-testnet workflow

* Remove unnecessary AWS credentials step from deploy-testnet workflow

* Save to S3 bucket

* Remove accidentally added file

* Authorities are staking finalization stall (#771)

* Init CI attempt

* More

* Finalization check

* Max node count

* GH action fix

* Improved error message

* Increased node count

* Increased timeout for authorities are staking e2e test

* Removed post-test finalization check

* Script fix

* Make sure rotate keys is done for every validator separately

* fmt

* Ip address and ports from config

* WS params parsing; default node count change

* Follow up finalization check

* Patch version bump

* Extracted controller connections; minor fixes

Co-authored-by: Marcin <[email protected]>

* `aleph-client`: Get tx events (#860)

* Change connection API

* Aleph client migrated

* Incorrect bump, but bumping anyway

* Rename to `TxInfo`

* Migrate cliain

* Move to lib

* Revert "Move to lib"

This reverts commit cb58f2a.

* Get tx events

* Example usage

* rename variables

* Correct info for submitted

* Grammar

* xD for the first time

* xD for the second time

* Make AsConnection and AsSigned visible outside aleph-client (#861)

* pub use for AsConnection and SignedConnection

* bump

* A0-1766: Sketch out the pricing script (#852)

* Sketch out the pricing script

* Format the pricing table prettier

* Improve cosmetics

* Improve cosmetics

Co-authored-by: Michal Handzlik <[email protected]>

* fix justification request status report not resetting (#866)

* A0-1852 remove send-runtime-hook and fork-off from Deploy to Devnet workflow (#858)

* A0-1852 remove send-runtime-hook and fork-off from Deploy to Devnet workflow

* A0-1852 Use r-9.0-rc2 image for testing

* A0-1852 Use current commit for testing. Decrease sleep

* Remove deprecated set-output command

* Testing workflow

* Revert "Testing workflow"

This reverts commit 0b917db.

* Review remarks

* adds `protobuf-compiler` to list of build dependencies (#859)

* added protobuf-compiler to list of packages required to manually build aleph-node

* nix: version.nix uses fixed version of rust toolchain now (nightly-2022-08-12)

* Fix for the runtime check (#874)

* Wait for finalized on transfer of money for tests (#873)

Without this, the money might not yet be available for subsequent
actions. This happens especially often on non-local nets.

* Migrate access_control to ink4

* Migrate ticket_token to ink4

* Migrate game_token to ink4

* Migrate marketplace to ink4

* Hide primitive types behind Balance and BlockNumber (#871)

* A0-1845: Authorities api (#870)

* `aleph-client`: Cast `ConvertibleValue` to a sequence (#875)

* Create ConvertibleValue from sequence

* Support arrays

* Simplify results

* A0-1820: implement substrate specific verifier for sync protocol (#864)

* Small refactor to prepare for verifier

* move justification verification to sync folder

* implement SessionVerifier cache

* implement verifier for VerifierCache

* Use Ref to talk to access_control

* Migrate button to ink4

* Migrate wrapped_azero to ink4

* Migrate simple_dex to ink4

* `aleph-client`: Fetch contract events (#877)

* Move all button comms to Ref

* Pin version of buildx. (#878)

* A0-1614 (don't) hide subxt types (#848)

* `aleph-client`: Custom gas limit (#880)

* Custom gas limit

* Bump

* locks

* Custom proof size limit

* Precise estimate

* A0-1872: Network data for sync (#879)

* Network data for sync

* Actually remembered we need one more kind of message in this version

Co-authored-by: timorl <[email protected]>

* A0-1794 Write initial version of the forest struct (#830)

* init

* the forest grows

* Vertex

* first version

* remove empty file

* add parent check to update_body

* polishing

* yet another Vertex

* forest reimagined

* grown forest

* Trim

* Tests

* Better tests

* Add max forest depth

Co-authored-by: Damian Leśniak <[email protected]>
Co-authored-by: timorl <[email protected]>

* A0-1824: add sync required mocks (#883)

* WIP

* Fix e2e contract tests.

* wait_for_death returns Err when button doesn't die.

* Log when dry-run call reverts.

* FMT button_game tests.

* wait_for_death actually waits up to timeout.

* Restore unnecessary change to Cargo.toml

* Debug messages are not errors.

* Remove debug printlns from the contract.

* Cleanup error handling.

* Import info log

* A0-1718 remove old authentications (#881)

* A0-1855: In FE, replace private feature-env-aleph-node repo with public aleph-node (#884)

* Replace 573243519133.dkr.ecr.us-east-1.amazonaws.com/feature-env-aleph-node with public.ecr.aws/p6e8q1z1/aleph-node

* Change FE repository to feature-env-aleph-node

* A0-1304: add state pruning compatibility (#890)

* make aleph node compatible with state pruning

* add/fix session map tests

* fix experimental pruning logs

* remove unnecessary wrapping

* A0-1502: Finality version e2e test (#717)

* Setting up AlephBFT version

* Changed handling to map from session to version

* Changed logic to handle serving last set AlephBFT version

* Changed logic to handle setting of version in future only

* Reworked storage and accessors to only store one version plus session to change it

* Treat version change as a delimiting flag

* Loose coupling between pallet_aleph and pallet_session to access current session index

* Fixed trait implementation for mock

* Added comment to trait

* Replaced panics with Results in AlephBFT version handling

* Changed logic to work with numbered versions

* Changed behavior on session start and end

* Fixed version change update

* Linked SessionManager in runtime

* Mock impl

* Reworked SessionManage link

* Linter

* Removed pallet_elections from mock

* Removed event

* linter

* Linter

* Reworked AlephBFT version history updates

* Reworked storage to use value instead of map

* Added unit test

* Added version change unscheduling and next session version

* Removed explicit version unscheduling; added version default

* Extended docs for pallet aleph

* Moved default AlephBFT version to const

* Renamed helper function

* Fixed test

* Changed naming

* Bumped spec version

* Bumped transaction version

* Finality version RPC and e2e test, first stab

* Added GenesisBuild to pallet_aleph

* Added finality version e2e test

* Reworked test logic

* Removed unused imports

* Dependency version fixes; prep work for test logic change

* Post factum checks

* Changed checks; changed finality version update session

* Added test description

* aleph-client and aleph-e2e-client version bumps

* spec_version and transaction_version bumps

* Changed comment about error code

* Added doc comment

* Cargo.lock

* Bumped runtime version

* Disabled runtime upgrade check in CI

* Revert "Disabled runtime upgrade check in CI"

This reverts commit e4cc57b.

* Disabled runtime upgrade check without removing it

* Post-merge cleanup

* Back to storage; handle connection refactor

* Codegen

* Bumped aleph-client version

* Back to rpc call; prelims

* Rpc interface

* Rpc

* Link with node

* Rpc request; cleanup

* Partial fix

* Fixed RPC params

* Versioning

* Linter

* Default version fix

* E2e test version bump

* Interface reorg

* Linter

* Connection fixes; pipelines

* Linter

* Finality version set in chain spec

* Subxt codegen

* E2e test fix

* Runtime metadata for aleph-client

* Hide doc warnings

* Removed hide docs

* Actually check the version change

* Subxt metadata

* Linter cleanup

* Const reorg

* Current finality version calculated based on the legacy one

* Use tokio instead of thread to sleep in e2e

* Simplify error unpacking

* Run CI contract tests on regular nodes

* Use existing action for button e2e tests on CI

* Build image for contract e2e tests

* A0-1897 validator-network authorization (#892)

* new authorizator service for the validator network - no send/receive data before a user is authorized

* unit-tests for the authorization api for the validator-network

* fixed path in the script for synthetic-network

* simplified authorization impl for validator network

* authorization: lint

* more verbose types for the authorization api

* - removed mocks for AsyncWrite/Read used by the the clique authorization tests
- tests for authorization in clique-network use now `prepare` instead of mocking the handshake

* cleaned tests for authorization

* removed the Authorization api - switched bare channels

* refactored out names of the authorizator

* fixed tests after refactoring the authorizator

* simplified `handle_authorization` in clique network

* review changes related with authorization in clique network

* cleaned tests fot the authorization in the clique network

* Install protoc in contract e2e tests

* Use built image in contract e2e

* Run button e2e tests along with others

* Fix clippy warnings

* Extend e2e button test timeout

* Empty commit to trigger actions

* Add a new line to the workflow to trigger

* Change most workflows to use self-hosted runners

* Comment out starting sccache server as it should be started in the runner already

* Add empty step to post-cache as it cannot be empty

* Add missing 'shell: bash' line

* Uncomment installing cargo-cache

* Comment out cargo-cache

* Remove restore- and post-cache from workflows

* A0-1763: Remove v0 connections from clique (#895)

* v0 removal

* Remove ConnectionType

* Update some comments

* Main logic for justification sync (#902)

Co-authored-by: timorl <[email protected]>

* Set specific cargo contract version on CI

* Update cargo contract version in README

* Use good ole' run to install cargo-contract

It seems the baptiste0928/cargo-install action, while great at caching, is
not able to fix the version to *-beta.1 when a *-rc.1 version exists.
Using this method for now, as the rc line is not compatible with our
current node, it should be switched to the caching
baptiste0928/cargo-install action when a stable version is compatible
with the node.

* Restore using dockerized node to inspect key

The script contracts/scripts/deploy.sh might be run on CI without
compiling the node first, so this is needed.

* Add call indices to pallets (#917)

* Add call indices to pallets

* Change libssl version in cliain.

---------

Co-authored-by: Bartosz Jędrzejewski <[email protected]>

* A0-1923: add e2e tests for pruning (#914)

* add pruning catch up tests

* Set button test envs on CI

* A0-1932: Extend push-foundation-repo workflow to push release branches and tags (#901)

* Extend push-foundation-repo workflow to push release branches and tags

* Change 'git push' command to use URL instead of adding mirror

* Fixed version of actions/checkout

* Change libssl version in cliain.

---------

Co-authored-by: Piotr K <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>

* Fix a specific cargo-contract version on CI (#935)

* Fix a specific cargo-contract version on CI

* Update metadata file location

* Pass button args in run_e2e_test.sh

* Fix invalid variable used for sha_short (#862)

* Fix invalid variable used for sha_short

* A0-1902: update to 0.9.33 (#923)

* change fork version to 0.9.33

* update dependencies

* no longer block id

* add max winners bound to elections

* fix pallets contract and nomination pools

* subxt code gen

* determinism arg in cliain and aleph-client

* substrate uses try-runtime in Cargo.toml like that

* bump spec version

* Fix triggering contract deploy

* Use cargo-contract 2.0.1

2.0.0-beta.1 is incompatible with current pallet-contracts.

* Fix clippy warning

* A0-1903: update to 0.9.34 (#926)

* Fix call to invalid step output in the deploy-mainnet workflow (#937)

* Use cargo contract 2.0.1 for button CI

* Enforce heap pages (#938)

* enforce-heap-pages

* set call stack

* bump-spec-version

* fix-typo

---------

Co-authored-by: Michal Swietek <[email protected]>

* Fork off: child support (#915)

* A0-1904: update to 0.9.35 (#936)

* change fork version to 0.9.34

* pallet contracts UnsafeUnstableInterface set to false

* subxt code gen

* temporarily remove fee calculation test

* fix build

* change fork version to aleph-0.9.34

* bump spec version to 52

* move comment up

* change fork version to wip-0.9.35

* fix pruning arguments

* fix weight changes

* update jsonspree

* fix compiler error

* rm wip

* lock

* spec

* aleph

* lint

* lint

* cleanup

* maximize build space

* lint

* clean before unit

* revert

* set tmp dir

* fp

* fp2

* one more try

---------

Co-authored-by: KostekIV <[email protected]>
Co-authored-by: kostekIV <[email protected]>

* Fixed wrong merge

* Check excluded packages with a matrix job

This way the checks should run in parallel and not overflow available
disk space.

* A0-1905: update substrate to 0.9.36 (#939)

* change fork version to 0.9.34

* pallet contracts UnsafeUnstableInterface set to false

* subxt code gen

* temporarily remove fee calculation test

* fix build

* change fork version to aleph-0.9.34

* bump spec version to 52

* move comment up

* change fork version to wip-0.9.35

* fix pruning arguments

* fix weight changes

* update jsonspree

* fix compiler error

* rm wip

* lock

* spec

* aleph

* lint

* lint

* cleanup

* update

* bump spec

* set contracts-transcode version

* locks

* fix try-runtime

---------

Co-authored-by: maciejnems <[email protected]>

* Use docker cargo contract image in adder e2e test

* Check contstraints for memory parameters (#940)

* Check contstraints for memory parameters

* Add comments

* Move smallvec to dev-dependencies

* fmt

---------

Co-authored-by: Michal Swietek <[email protected]>

* Pinned version of ink-dev. Fixed bug so non-interactive mode is used

* Trying to fix added e2e

* Run adder e2e test to speed up build

* Run adder e2e test to speed up build - attempt 2

* Add cargo-cache with storing .cargo in S3 bucket for testing

* Fix missing 'env.' in call to env vars

* Add 'true' to ignore exit code != 0

* Add set +e to ignore exit code

* Add caching 'target' dir and rename things a bit

* Change uploading cache to devnet CI S3 bucket

* Tweak step names

* Comment out blocks uploading builds to S3 bucket

* Do not gzip files

* Extract cache key to a separate env var

* A0-1906: bump substrate to 0.9.37 (#941)

* change fork version to 0.9.34

* pallet contracts UnsafeUnstableInterface set to false

* subxt code gen

* temporarily remove fee calculation test

* fix build

* change fork version to aleph-0.9.34

* bump spec version to 52

* move comment up

* change fork version to wip-0.9.35

* fix pruning arguments

* fix weight changes

* update jsonspree

* fix compiler error

* rm wip

* lock

* spec

* aleph

* lint

* lint

* cleanup

* update

* bump spec

* set contracts-transcode version

* locks

* fix try-runtime

* bump substrate

* adjust runtime

* fix node

* update aleph-client

* update adder toolchain

* fix tests

* dont panic

* revert toolchain

* nightly

* skip adder

* ...

---------

Co-authored-by: maciejnems <[email protected]>

* Remove cache steps

* Comment out using sccache

* Restore sccache in build-node-and-runtime.yml

* Trigger CI

* update to v0.9.38 (#944)

* update to 0.9.38

* bump spec & lint

* update metadata

* set forck branch

* Attempt to show output from a failed test

* In test catch_up, remvoe one non-validator from the test to decrease test CPU load

* update lock (#947)

* Make contract storage cheaper. (#945)

Co-authored-by: Marcin <[email protected]>

* Switch test_catch_up to self_hosted. Changed timeout for waiting for authorities to 300s

* Set CARGO_HOME to /Users/nicholas/Repositories/github.com/cc/aleph-node

* Fix typo

* Increased timeout for waiting for authorities in cathc_up tests

* Fix typos

* Add step that cleans the workspace

* Change cleanup workspace step to just 'rm' commands

* Extract workspace cleanup to a separate action

* Remove cleanup steps

* Increase free storage for unit tests (#952)

* Update logo link (#951)

* add posibility for experimental pruning in docker_entrypoint.sh (#949)

Co-authored-by: Marcin <[email protected]>

* Set timeout for waiting for authorities in catch_up tests and multiple restarts to 60s

* Increase multiple_restart waiting for authorities timeout to 120s

* clippy + local pipeline (#959)

* clippy + local pipeline

* update local image

* Fix docker usage in contract deploy

* Update metadata paths

---------

Co-authored-by: lesniak43 <[email protected]>
Co-authored-by: timorl <[email protected]>
Co-authored-by: fixxxedpoint <[email protected]>
Co-authored-by: maciejzelaszczyk <[email protected]>
Co-authored-by: Maciej Nemś <[email protected]>
Co-authored-by: kostekIV <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
Co-authored-by: Jan Koscisz <[email protected]>
Co-authored-by: Marcin <[email protected]>
Co-authored-by: Jędrzej Kula <[email protected]>
Co-authored-by: Jedrzej Kula <[email protected]>
Co-authored-by: Michal Handzlik <[email protected]>
Co-authored-by: Damian Leśniak <[email protected]>
Co-authored-by: Mikolaj Gasior <[email protected]>
Co-authored-by: timorl <[email protected]>
Co-authored-by: Krzysztof Ziobro <[email protected]>
Co-authored-by: Piotr Mikołajczyk <[email protected]>
Co-authored-by: Damian Straszak <[email protected]>
Co-authored-by: bartoszjedrzejewski <[email protected]>
Co-authored-by: deuszx <[email protected]>
Co-authored-by: Bartosz Jędrzejewski <[email protected]>
Co-authored-by: Piotr K <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
Co-authored-by: Filip Bielejec <[email protected]>

* Fix yamllint errors

* Fix mismerge

* Dockerize contracts/scripts/test.sh (#994)

* Dockerize contracts/scripts/test.sh

* Move to repo root in contracts/scripts/test.sh

* [A0-2073] Update contracts to =4.0.1 ink. (#995)

Co-authored-by: Marcin <[email protected]>

* Increase sleep from 5s to 10s.

* Merge with main (#997)

* Improve flaky contract tests (#1009)

* env does not exist anymore

---------

Co-authored-by: Paweł Obrok <[email protected]>
Co-authored-by: kostekIV <[email protected]>
Co-authored-by: Michal Handzlik <[email protected]>
Co-authored-by: Piotr Mikołajczyk <[email protected]>
Co-authored-by: Mikolaj Gasior <[email protected]>
Co-authored-by: deuszx <[email protected]>
Co-authored-by: Mikolaj Gasior <[email protected]>
Co-authored-by: lesniak43 <[email protected]>
Co-authored-by: timorl <[email protected]>
Co-authored-by: fixxxedpoint <[email protected]>
Co-authored-by: maciejzelaszczyk <[email protected]>
Co-authored-by: Maciej Nemś <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
Co-authored-by: Jan Koscisz <[email protected]>
Co-authored-by: Marcin <[email protected]>
Co-authored-by: Jędrzej Kula <[email protected]>
Co-authored-by: Jedrzej Kula <[email protected]>
Co-authored-by: Damian Leśniak <[email protected]>
Co-authored-by: timorl <[email protected]>
Co-authored-by: Krzysztof Ziobro <[email protected]>
Co-authored-by: Damian Straszak <[email protected]>
Co-authored-by: bartoszjedrzejewski <[email protected]>
Co-authored-by: deuszx <[email protected]>
Co-authored-by: Bartosz Jędrzejewski <[email protected]>
Co-authored-by: Piotr K <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
Co-authored-by: Michal Swietek <[email protected]>
  • Loading branch information
28 people authored Mar 15, 2023
1 parent 8e3643e commit f4e8242
Show file tree
Hide file tree
Showing 65 changed files with 14,379 additions and 920 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ target
!target/release/aleph-node
!target/production/aleph-node
!bin/cliain/target/release/cliain

12 changes: 12 additions & 0 deletions .github/actions/run-e2e-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ inputs:
description: 'Whether to deploy the adder sample contract to the node.'
required: false
default: 'false'
deploy-button:
description: 'Whether to deploy the button game contracts to the node.'
required: false
default: 'false'
image-path:
description: 'Custom path to docker image for aleph-node'
required: false
Expand Down Expand Up @@ -116,6 +120,14 @@ runs:
popd
fi
DEPLOY_BUTTON="${{ inputs.deploy-button }}"
if [[ "${DEPLOY_BUTTON}" = "true" ]]; then
source contracts/env/dev
contracts/scripts/deploy.sh
source contracts/scripts/test_env.sh
fi
./.github/scripts/run_e2e_test.sh "${ARGS[@]}"
- name: Run finalization e2e test
Expand Down
17 changes: 16 additions & 1 deletion .github/scripts/run_e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,22 @@ fi

if [[ -n "${ADDER:-}" ]]; then
ARGS+=(-e "ADDER=${ADDER}")
ARGS+=(-e "ADDER_METADATA=/contracts/adder/target/ink/metadata.json")
ARGS+=(-e "ADDER_METADATA=/contracts/adder/target/ink/adder.json")
fi

if [[ -n "${BUTTON_GAME_METADATA:-}" ]]; then
ARGS+=(-e "THE_PRESSIAH_COMETH=${THE_PRESSIAH_COMETH}")
ARGS+=(-e "EARLY_BIRD_SPECIAL=${EARLY_BIRD_SPECIAL}")
ARGS+=(-e "BACK_TO_THE_FUTURE=${BACK_TO_THE_FUTURE}")
ARGS+=(-e "SIMPLE_DEX=${SIMPLE_DEX}")
ARGS+=(-e "WRAPPED_AZERO=${WRAPPED_AZERO}")
ARGS+=(-e "RUST_LOG=${RUST_LOG}")
ARGS+=(-e "BUTTON_GAME_METADATA=/contracts/button/target/ink/button.json")
ARGS+=(-e "TICKET_TOKEN_METADATA=/contracts/ticket_token/target/ink/ticket_token.json")
ARGS+=(-e "REWARD_TOKEN_METADATA=/contracts/game_token/target/ink/game_token.json")
ARGS+=(-e "MARKETPLACE_METADATA=/contracts/marketplace/target/ink/marketplace.json")
ARGS+=(-e "SIMPLE_DEX_METADATA=/contracts/simple_dex/target/ink/simple_dex.json")
ARGS+=(-e "WRAPPED_AZERO_METADATA=/contracts/wrapped_azero/target/ink/wrapped_azero.json")
fi

if [[ -n "${OUT_LATENCY:-}" ]]; then
Expand Down
22 changes: 22 additions & 0 deletions .github/scripts/run_smartnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

export NODE_IMAGE=public.ecr.aws/p6e8q1z1/aleph-node:latest

# key derived from "//0"
export NODE_ID=5D34dL5prEUaGNQtPPZ3yN5Y6BnkfXunKXXz6fo7ZJbLwRRH
export ALICE=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

mkdir -p docker/data/

# generate chainspec
docker run --rm -v $(pwd)/docker/data:/data --entrypoint "/bin/sh" -e RUST_LOG=debug "${NODE_IMAGE}" -c \
"aleph-node bootstrap-chain --base-path /data --account-ids $NODE_ID --faucet-account-id $ALICE --sudo-account-id $NODE_ID --chain-id a0smnet --token-symbol SZERO --chain-name 'Aleph Zero Smartnet' > /data/chainspec.smartnet.json"

# Get bootnode peer id
export BOOTNODE_PEER_ID=$(docker run --rm -v $(pwd)/docker/data:/data --entrypoint "/bin/sh" -e RUST_LOG=info "${NODE_IMAGE}" -c "aleph-node key inspect-node-key --file /data/$NODE_ID/p2p_secret")

docker network create node-network || true
docker-compose -f docker/smartnet-compose.yml up --remove-orphans
exit $?
19 changes: 19 additions & 0 deletions .github/workflows/check-excluded-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ jobs:
build:
name: Check excluded packages
runs-on: self-hosted
strategy:
matrix:
package: [
flooder,
e2e-tests,
aleph-client,
fork-off,
benches/payout-stakers,
bin/cliain,
contracts/access_control,
contracts/button,
contracts/game_token,
contracts/marketplace,
contracts/simple_dex,
contracts/ticket_token,
contracts/wrapped_azero,
contracts/adder,
scripts/synthetic-network/synthetic-link,
]
env:
CARGO_INCREMENTAL: 0
RUSTC_WRAPPER: sccache
Expand Down
257 changes: 257 additions & 0 deletions .github/workflows/contracts-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
---
name: contracts-e2e-tests-and-deploy

on:
workflow_call:

# DO NOT TOUCH THIS:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
CACHE_KEY: fe-benjamin-button
CONTRACTS_ENVFILE: fe-benjamin
NODE_VERSION: 16
S3BUCKET_PATH: contracts/fe-benjamin-button

jobs:
build_and_deploy_contracts:
name: Deploy contracts on feature environment
if: >
(github.event_name == 'push' && github.ref_name == 'benjamin') ||
(github.event_name == 'pull_request' &&
github.event.action == 'labeled' &&
github.event.label.name == '[AZERO] DEPLOY-CONTRACTS')
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/[email protected]

- name: Check if environment is reachable
shell: bash
run: |
source contracts/env/${{ env.CONTRACTS_ENVFILE }} && \
HOSTPORT=${NODE/wss:\/\//} && nc -zvw5 ${HOSTPORT/:*/} ${HOSTPORT/*:/}
- name: Get branch name and commit SHA
id: get_branch
uses: ./.github/actions/get-branch

# Use of 'actions-rs/toolchain@v1' has been removed as it was causing some unknown problems
# Also, there is a ticket to replace it with custom solution anyway

- name: Setup rust toolchain
run: |
. "$HOME/.cargo/env"
rustup target add wasm32-unknown-unknown
rustup toolchain install nightly-2022-08-12-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2022-08-12-x86_64-unknown-linux-gnu
rustup default nightly-2022-08-12-x86_64-unknown-linux-gnu
- name: Install jq
shell: bash
run: |
sudo apt-get install -y jq
- name: Install binaryen
shell: bash
# yamllint disable rule:line-length
run: |
wget https://github.com/WebAssembly/binaryen/releases/download/version_110/binaryen-version_110-x86_64-linux.tar.gz \
-O /tmp/binaryen-version_110-x86_64-linux.tar.gz
tar -zxvf /tmp/binaryen-version_110-x86_64-linux.tar.gz -C /tmp
sudo chmod +x /tmp/binaryen-version_110/bin/*
sudo cp -rf /tmp/binaryen-version_110/* /usr/
# yamllint enable rule:line-length

- name: Install node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Restore cache
uses: ./.github/actions/restore-cache
with:
target-key: ${{ env.CACHE_KEY }}
cargo-key: ${{ env.CACHE_KEY }}
cache-version: v3
cargo-targets: |
contracts/access_control/target/
contracts/button/target/
contracts/game_token/target/
contracts/marketplace/target/
contracts/simple_dex/target/
contracts/ticket_token/target/
contracts/wrapped_azero/target/
- name: Install cargo additional libs
run: |
. "$HOME/.cargo/env"
cargo install dylint-link cargo-dylint
- name: Install cargo-contract
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-contract
version: "2.0.1"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
env:
AWS_REGION: us-east-1
with:
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Copy addresses.json file from S3 bucket
shell: bash
# yamllint disable rule:line-length
run: |
aws s3 cp s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/addresses.json contracts/addresses.json
# yamllint enable rule:line-length

- name: Copy metadata.json files from S3 bucket
shell: bash
env:
DOWNLOAD_TMP_DIR: downloaded_metadata
run: |
mkdir -p $DOWNLOAD_TMP_DIR
aws s3 sync --exclude '*' --include '*metadata.json' \
s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/ ./$DOWNLOAD_TMP_DIR/
for i in `find $DOWNLOAD_TMP_DIR -name "metadata.json" | awk -F/ '{print $2}'`; do \
mkdir -p contracts/$i/target/ink; \
cp $DOWNLOAD_TMP_DIR/$i/metadata.json contracts/$i/target/ink/metadata.json; \
done
- name: Run clean.sh script
shell: bash
run: |
. "$HOME/.cargo/env"
source contracts/env/${{ env.CONTRACTS_ENVFILE }} && ./contracts/scripts/clean.sh
- name: Run deploy.sh script
shell: bash
run: |
. "$HOME/.cargo/env"
source contracts/env/${{ env.CONTRACTS_ENVFILE }} && ./contracts/scripts/deploy.sh
- name: Copy metadata.json and addresses.json files onto S3 bucket
shell: bash
run: |
aws s3 cp contracts/addresses.json \
s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/addresses.json
for i in `find contracts -name "metadata.json" | awk -F/ '{print $2}'`; do \
aws s3 cp contracts/"$i"/target/ink/metadata.json \
s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/"$i"/metadata.json; \
done
echo -n "${{ steps.get_branch.outputs.sha_short }}" > commit_sha.txt
aws s3 cp commit_sha.txt \
s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/commit_sha.txt
source contracts/env/${{ env.CONTRACTS_ENVFILE }} && echo -n "$NODE" > env_NODE.txt
aws s3 cp env_NODE.txt \
s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/env_NODE.txt
- name: Rename metadata and addresses JSON files to artifact upload
shell: bash
run: |
cp contracts/addresses.json addresses.${{ env.CONTRACTS_ENVFILE }}.json
for i in `find contracts -name "metadata.json" | awk -F/ '{print $2}'`; do \
cp contracts/"$i"/target/ink/metadata.json \
metadata_"$i".${{ env.CONTRACTS_ENVFILE }}.json; \
done
- name: Upload artifact with contract addresses
uses: actions/upload-artifact@v3
with:
name: contracts-addresses
path: addresses.${{ env.CONTRACTS_ENVFILE }}.json
if-no-files-found: error
retention-days: 90

- name: Upload artifact with contract metadata
uses: actions/upload-artifact@v3
with:
name: contracts-metadata
path: metadata_*.${{ env.CONTRACTS_ENVFILE }}.json
if-no-files-found: error
retention-days: 90

- name: Remove deploy label if present
uses: actions-ecosystem/[email protected]
if: >
github.event_name == 'pull_request' &&
contains( github.event.pull_request.labels.*.name, '[AZERO] DEPLOY-CONTRACTS')
with:
labels: '[AZERO] DEPLOY-CONTRACTS'
github_token: ${{ secrets.CI_GH_TOKEN }}

- name: Add label to mark that contracts have been deployed
if: github.event_name == 'pull_request'
uses: actions-ecosystem/[email protected]
with:
labels: 'DEPLOYED-CONTRACTS'
github_token: ${{ secrets.CI_GH_TOKEN }}

- name: Cleanup cache
uses: ./.github/actions/post-cache

- name: GIT | Checkout aleph-apps repo
uses: actions/checkout@master
with:
repository: Cardinal-Cryptography/aleph-apps
token: ${{ secrets.CI_GH_TOKEN }}
path: "aleph-apps"
ref: main

- name: KUSTOMIZE | Init kustomize
uses: imranismail/setup-kustomize@v1
with:
kustomize-version: '3.8.6'

- name: KUBECTL | Setup kubectl
uses: azure/[email protected]
with:
version: 'v1.23.6'

- name: INDEXER | Destroy archive and squid apps
shell: bash
run: |
aws eks --region eu-central-1 update-kubeconfig --name alephzero-devnet-eu-central-1-eks
kubectl delete -n indexer-squid --ignore-not-found=true deploy squid-api
kubectl delete -n indexer-squid --ignore-not-found=true deploy squid-processor
kubectl delete -n indexer-archive --ignore-not-found=true deploy archive-gateway
kubectl delete -n indexer-archive --ignore-not-found=true deploy archive-ingest
- name: INDEXER | Create archive db and archive apps
shell: bash
run: |
kubectl rollout restart statefulset archive-db -n indexer-archive
kubectl rollout status --watch --timeout=600s -n indexer-archive statefulset/archive-db
cd aleph-apps/indexer/archive/overlays/devnet/eu-central-1
kustomize build . | kubectl apply -f -
sleep 3
kubectl rollout status --watch --timeout=600s -n indexer-archive deploy/archive-ingest
kubectl rollout status --watch --timeout=600s -n indexer-archive deploy/archive-gateway
- name: INDEXER | Create squid db and squid apps
shell: bash
run: |
kubectl rollout restart statefulset squid-db -n indexer-squid
kubectl rollout status --watch --timeout=600s -n indexer-squid statefulset/squid-db
cd aleph-apps/indexer/squid/overlays/devnet/eu-central-1
kustomize build . | kubectl apply -f -
sleep 3
kubectl rollout status --watch --timeout=600s -n indexer-squid deploy/squid-processor
kubectl rollout status --watch --timeout=600s -n indexer-squid deploy/squid-api
- name: BUTTON | Restart the-button deployment
shell: bash
run: |
kubectl rollout restart deployment the-button -n the-button
kubectl rollout status --watch --timeout=600s -n the-button deploy/the-button
Loading

0 comments on commit f4e8242

Please sign in to comment.