Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Moonbeam #4

Open
wants to merge 121 commits into
base: subsocial/staking
Choose a base branch
from

Conversation

TarekkMA
Copy link

Please merge #2 first

nbaztec and others added 30 commits May 18, 2022 15:43
* create local asset id just encoding once

* fmt
…1511)

* Use perbill floating point mult when calculating weight

* Cosmetic changes

* Rename test

* Always round up fractional computation

* Comments

* fmt

* comments
…ng another (moonbeam-foundation#1527)

* test to reproduce the orbiter bug

* ensure that next_orbiter <= orbiters.len()
* v0.9.20 dependency update

* Re-pin frontier

* Fix tests

* Re-pin frontier

* Bump substrate version for `session-keys-primitives`

* Oops
* Adds correct timeout for tracing tests

* Trigger another build

* Increase timeout

* disable interpreted wasm in tests when forced wasm executed

* Forces wasm executio in test-trace

* Better test names

* Forces compiled wasm
…oundation#1496)

* Manual LengthToFee impl for moonbase runtime

* Present length:fee relationship in orders of magnitude

* Ascii art

* Annotate

* Ignore editorconfig

* Remove comment

* Remove unused import

* Update tests

* fmt

* Hook up WeightToFee (moonbase runtime)

* fmt

* Fix author mapping tests
* Author priority fees fix

* editorconfig

* Split base fee and priority handling

* Test issuance

* Expect treasury
* use revoke ScheduledRequests to proxy as leave request

* add more typescript tests

* rework delegator leave functionality

* update weights
…oonbeam-foundation#1487)

* update to PrecompileHandle (no tests)

* testing util + change log util

* update assets-erc20 tests

* update author-mapping tests

* update balances-erc20 tests

* update pallet-democracy tests

* update crowdloan-rewards tests

* update parachain-staking tests

* update relay-encoder tests

* update xcm_transactor tests

* update xtokens tests

* rename test functions

* update moonriver tests

* update moonbeam tests

* update moonbase tests

* temp: use custom branches

* typos

* improve util

* bump evm (now records call opcode cost)

* PrecompileSubcall tracing event

* bump evm (tracing)

* path gasometer crate (fixes tracing)

* bump evm (fix duplicate exit event making tracing crash)

* succeed util function

* lint + toml_sort

* apply EVM PR suggestions

* bump evm

* fix tests

* bump frontier (simpler Precompile trait) + utils

* don't use patch for evm

* fix tracing runtime build

Co-authored-by: librelois <[email protected]>
* update to PrecompileHandle (no tests)

* testing util + change log util

* update assets-erc20 tests

* update author-mapping tests

* update balances-erc20 tests

* update pallet-democracy tests

* update crowdloan-rewards tests

* update parachain-staking tests

* update relay-encoder tests

* update xcm_transactor tests

* update xtokens tests

* rename test functions

* update moonriver tests

* update moonbeam tests

* update moonbase tests

* temp: use custom branches

* typos

* batch precompile

* improve util

* some tests

* improve util

* test incomplete batch

* new mode to continue executing subsequent subcalls after failure + fix missing value/data_call bug

* test evm behavior + bump evm version with call cost fix

* bump evm (now records call opcode cost)

* PrecompileSubcall tracing event

* bump evm (tracing)

* wip tracing

* fix typo

* path gasometer crate (fixes tracing)

* path gasometer crate (fixes tracing)

* fix test

* bump evm (fix duplicate exit event making tracing crash)

* succeed util function

* fix lock + succeed fn

* lint + toml_sort

* apply EVM PR suggestions

* bump evm

* fix tests

* Batch logs + better log testing

* no longer return ouput + better handle logs cost

* per subcall gaslimit + batchAll no longer emit logs

* always emit logs + gas cost test

* doc about 0 = all remaining gas

* bump frontier (simpler Precompile trait) + utils

* fmt

* clippy

* batchAll must revert if not enough gas + fmt + tests for log OOG/gas limit check

* remove unused outputs in tests

* don't use patch for evm

* fix tracing runtime build

* add batch precompile to all runtimes

* reserve gas for call cost

* cleanup mock

* remove logs

Co-authored-by: librelois <[email protected]>
…oundation#1449)

* Pallet compiles with draft design

* Use feePerSecond also on transact_through_signed

* Commit what we have so far

* Add tests for new function

* Make moonbase compile plus benchmarks included

* Benchmark vec and migration

* Weights and benchmark done

* Xcm transactor new precompiles

* Test new accessors

* Add tests for dispatchables

* fix comments

* Enable migration and xcm support in moonbeam

* Adapt tests to new changes

* First test working

* add integration test

* FMT

* Change DestinationFeePerSecond to AssetFeePerSecond

* destinationassetfeepersecond

* Add extrinsic for removal of fee per second

* Change comment

* FMT

* editorconfig plus one repeated test

* Add and fix existing xcm transactor typescript test

* Moonbeam and moonriver editorconfig

* Editorconfig

* Filter call from moonbase & moonriver

* small fixes to migration

* fmt

* xcm transactor test change

* comments

* whitelist parachainInfo parachainId

* Benchmark with whitelisted parachainId

* FMT

* xcm transactor tests update

* FMT

* More FMT
* Cleanup migrations

* fmt & fix rustc warning

Co-authored-by: librelois <[email protected]>
…n#1535)

* init

* fix

* fix tests

* start adding removeKeys extrinsic

* fix tests and enable testing feature for precompile utils in author mapping

* adding precompile utils with feature testing as dev dep for all precompiles

* update weights generated by bench machine

* add back ownership check on author mapping for setting and rming keys

* allow rotating to same nimbus id and rename authod id to new author id

* fix test

* clean

* rename author id to nimbus id and do not return post dispatch info also clean

* make unique error for condition that prevents overwriting mappings that dont belong to you

* revert unique error and add comment instead

* add KeysWrapper to make single input of set keys one 64 byte slice

* rename events

* fix

* fmt

* clean

* fix

* Revert "fmt"

This reverts commit b01468c.

* Adds missing KeysWrapper for benchmark

* Removes typescript-api from prettier

* make Identity type for KeysWrapper a Vec u8 as per elois suggestion

* fix

* impl Decode for KeysWrapper

* Revert "impl Decode for KeysWrapper"

This reverts commit 6c84a60.

* Adds support for vec<u8> for keys (moonbeam-foundation#1538)

* Adds AuthorMapping keys tests

* rename events

* Adds more tests

* Make setKeys use Vec<u8>

* Fixes try_from for Keys

* Fancier decode

Co-authored-by: 4meta5 <[email protected]>

* Adds test for invalid key size in precompile

* Fixes tests

* Typo

* remove KeysWrapper

* add back strict bound check on vector and WrongKeySize err

* remove unnecessary constant

Co-authored-by: Crystalin <[email protected]>
)

* Reduced minimum staking delegation

* fix rust tests

Co-authored-by: librelois <[email protected]>
* Prevent delegateCall on EVM

* Filter delegateCall only for Precompiles

* Adds test for precompile delegate calls

* Fixes merge

* fmt

* Typo

* Better fix

* More fixes

* Cleanup imports

* Removes delegateCall test on assets

* More test to remove

* Better revert instruction
notlesh and others added 24 commits July 11, 2022 12:47
* add tests for delegator_leave and manual revoke cancellations

* split tests
* Pin frontier

* Add ts tests

* Fix nonce check
* Remove xcm migrations

* add comments

* toml sort

* bring back mistakenly removed dependency

* and whitespace

* change comment
* Filter anonymous proxy

* Adds ref line

* Disable editorconfig checker on long URL

* Use proper pallet_proxy::Call enum variants

Co-authored-by: Stephen Shelton <[email protected]>
* wip

* Test working, clean it up

* Add test for testing xcmpqueue outbound messages

* remove only

* remove log

* remove unused

* comments

* let for const

* change description

* ensure block is created properluy

* Cleanup of util/xcm

* toHaveLengthOf

* FMT and prettier

* more fmt

* remove extra await
* Temp receipt root fix

* Pin frontier

* Use promisify

* Update package-lock.json

* Prettier

* Typo
…on#1682)

* Makes transaction test running on lower gas

* Fix ethereum data test

* Adds more gas for createContract default

* Fix last test broken
…oundation#1376)

* try fix std node compilation error

* try fix std error

* bump serde dep

* fix compile

* update vrf pallet mock

* init fix

* mid config

* save review comments

* instant randomness generic over storage map

* update not done

* fix

* clean pallet randomness

* apply review suggestions

* fix

* fix

* save

* precompile in progress

* update pallet deps

* clean precompile compiles

* clean fulfill body

* propagate pallet errors to precompile add some functions

* randomness precompile

* remove Last storage items because unused can add back if remember use case

* split randomness requested event

* init reentrancy bool and clean precompile functions

* fix vrf pallet to lookup VrfId instead of babe AuthorityId

* continue configuring runtime and remove inner bool from RandomnessWrapper

* remove EvmData trait bounds from precompile

* moonbase compiles with randomness precompile added

* fix toml

* move set vrf inputs into inherent to be included after all other inherents in client

* read babe randomness from relay chain state proof and fix pallet mock for unit tests

* remove redundant slicing

* fix line length

* fix vrf unit test mock

* unit tests for request randomness in randomness pallet

* fix

* fix moonbase config

* precompile exists

* precompile exists

* read relay chain time in the vrf inherent as well need to consider renaming it to something more general

* set babe randomness in vrf inherent

* fix precompile naming

* decouple pallets and unwrap or default for LastVrfInput in on initialize instead of panicking

* fix naming conventions

* simplify event handler to combine both vrf and randomness pallet updates in one handler impl

* only one randomness pallet now and remove all babe storage items such that we use generic getter instead assigned in runtime to read relevant data from ParachainSystem

* move vrf logic into own file

* remove inherent as is not necessary

* add back inherent to populate the Randomness babe values with most recent data of this block

* add back inherent to populate babe randomness results at the beginning of the block but not during on initialize

* use RandomnessResults from storage instead of getters to prepare and clean up in finish fulfill

* also update RandomnessResults upon request expiration execution to cover all request removal scenarios

* require inherent to be included in block and clean other code and add some todos

* init client vrf digest

* remove unused code

* get nimbus digest provider commit

* init runtime api

* try configure closure but keystore cannot be borrowed in the expected way

* struggling to access runtime API from inside node service file

* fix rust compilation

* move runtime api function helper into moonbeam vrf and use it from there

* clean

* fix pallet to use our VRF PreDigest instead of babes

* add default genesis item for vrf input in first block after genesis

* add migration and try fix randomness set output vrf verification which is panicking still in tests

* try fix

* add randomness inherent data provider for dev manual seal mode

* add additional digests provider to manual seal params

* fix

* use cumulus patch to insert epoch index into relay sproof to prevent panic in dev mode

* Revert "use cumulus patch to insert epoch index into relay sproof to prevent panic in dev mode"

This reverts commit 45a358c.

* add Randomness solidity interface to Randomness precompile

* compute selectors and verify with unit test

* toml sort

* fix solidity interface and add test (moonbeam-foundation#1643)

* put utils solidity behind testing to access std

* fix fix std

* add precompile getters for relay block number and relay epoch index and temporarily unwrap or default for epoch index getter impl just until cumulus can be patched

* fmt

* fmt and try debug new on finalize error

* make epoch requests take no epoch input and default ask for next epoch and fix relay block getter and fix inherent included logic to make it future proof for async backing when relay block will not change every parachain block

* change per block request interface such that last param specifies number of blocks in the future instead of the exact block requested

* add inherent in all runtimes

* try update randomness precompile but solidity parsing is no longer in root

* remove randomness from moonriver and moonbeam and redeclare solidity after merge conflict mistake

* wow lots of duplication to only include randomness in moonbase

* Revert "wow lots of duplication to only include randomness in moonbase"

This reverts commit fa1669c.

* Revert "remove randomness from moonriver and moonbeam and redeclare solidity after merge conflict mistake"

This reverts commit 193d16a.

* finish merge master

* remove randomness from moonbeam and moonriver

* Update pallets/randomness/src/lib.rs

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

* update nimbus and refactor randomness precompile ensure check and rm all instant randomness unsafe logic

* Revert "update nimbus and refactor randomness precompile ensure check and rm all instant randomness unsafe logic"

This reverts commit ac36956.

* revert dep changes to save the Cargo lock

* fix increase request fee to match substrate increase fee conventions to not pass in new value but pass in increase

* camelcase solidity input var names

* fix polkadot dependency

* update nimbus

* change epoch delay for epoch requests and add debug assert verification in pallet

* wrap existing block executor with vrf verifying block executor

* clean and disambiguate errors

* replace reserve and unreserve with transfer to an escrow account which is assigned to precompile account

* do not expect vrf digest nor set output in first block genesis or runtime upgrade

* fix

* update block executor as well with corner case first block logic

* remove BlockExecutor and panic in pallet instead

* remove migration and genesis from pallet randomness in favor of this dumb storage item

* fix mocks

* fix expected VrfInput to be set error in first block from runtime api

* fix ts test error now 5 extrinsics

* try fix ts

* fix solidity test file and add randomness precompile tests (moonbeam-foundation#1644)

* fix solidity test file

* Adds missing compiled precompiles

* Adds simple test

* handle memory arg cases, randomize test solidity file

* cleanup

* remove deleted file

* add docs

* add docs

* add randomness precompile tests

* reset Cargo.lock

* fix tests

* add more tests

* add additional test for documented selectors

* fmt

* fix fmt and test

* skip failing test

* Fix merge

* use custom defined structs

* docs

* fmt

* Upgrading authoring version

* Prevent runtime upgrade test to run when authoring version changed

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

* add back panic for reading epoch index but now need to apply cumulus patch on current fork

* patch cumulus fork to insert epoch index into RelaySproofBuilder

* benchmark all public pallet functions used by precompile

* TODO set output benchmark code requires inserting some dummy vrf pre digest into digests

* remove tiny_keccak dep

* fix tests

* unskip tests

* backward compatible vrf client (moonbeam-foundation#1661)

* return None when API is missing

* fmt

* get runtime api only once

* do not use free balance checks

* fix

* replace ReservAccount config associated type with Pallet ID for randomness pallet

* temp weight for set output and add todo to benchmark file

* more unit tests

* Add test to ensure fn remains Mandatory

* Attempt to hook up pallet_randomness benchmarks to moonbase only

* bring back moonbase-runtime-benchmarks

* Comment out failing benchmarks

* Hook up randomness weights

* make expiration type depend on request type and ensure CannotMakeRandomnessRequestAfterExpirationDelay

* fix and clean

* clean

* add num words before refactoring

* Redesign Randomness Precompile Interface (moonbeam-foundation#1669)

* Providing new Randomness Precompile interfaces

* Removes useless Request Status None

* Fixes documentation rawFulfillRandomWords

* init refactor

* save need to add back ExpirationDelay and keep MaxDelay they are distinct

* Tweak pallet randomness consumer interface

* Adds randomness compiled contracts

* get request first attempt impl

* get request status

* clean

* Adds a Lottery Solidity Contract for demo/test (moonbeam-foundation#1672)

* Provides a randomness lottery demo

* Adds the increaseRequestFees method

* Fixes jackpot

* Restore singular word "fee"

* Adds doc to randomness getRequest

* Updates compiled Lottery

* Adds the getRequestStatus

* Fix request id init + new events

* disambiguate client errors to panic if vrf is not able to be provided

* fix

* insert default vrf output in the first block of the runtime upgrade

* fix enum encoding

* Makes requestId using uint256

* Adds the lottery test

* Fix selector modifiers in precompiles randomness

* return request id with request_randomness

* First startlottery tests working

* Adds more test for lottery

* call fulfill in the precompile address

* clean and add todo for fulfill needs function selector for callback

* Adds test for fulfillment

* clean code

* add rawFulfillRandomWords function selector to the provide callback

* Adds request id to fulfillment

* add request id to provide randomness

* Fixes randomness precompile selector callback

* Adds support for deposit in randomness demo

* Better setup for deposit

* Adds test for lottery rewards

* Fixes randomness event logs

* fix and add number of random words constraint

* fix order

* Adds status to the lottery

* Fix benchmark build

* revert client panics

* into master

* Fix execute_request_expiration

* Update weights.rs

* address review

* fix

* address some comments

* revert if RequestId input overflows u64 type set in pallet

* Official benchmarks

* add crude weight to gas need to replace with constants and add tests to verify equal to values in actual runtime

* charge constant gas in precompile and convert weight to gas in tests need to move tests to runtime integration tests

* move tests to runtime and remove randomness pallet WeightInfo config associated type

* Fixes toml and unused

* fix solidity test

* Fixes demo solidity contract

* Adds support for Babe test in demo

* add 100 num words for benchmarking

* add 100 words for all benchmarks

* Update weights

* fix integration test and update precompile gas values

* thanks @girazoki make get last vrf output return option so digest is not included for moonriver and moonbeam

* Adds babe request tests

* address other review comments

* rm unused dep

* remove RandomnessResult when there are 0 requests left

* Adds test for randomnessResults

* Adds test for multiple ethereum transfers

* Removes precompile tests in benefit of randomness tests

* Adds vrf babe test (moonbeam-foundation#1684)

* add babe tests

* Adds randomness to typescript api

* Fix babe lottery tests

* Fix vrf lottery

* Adds test around the randomness result

* prettier

Co-authored-by: librelois <[email protected]>
Co-authored-by: Crystalin <[email protected]>
Co-authored-by: Nisheeth Barthwal <[email protected]>
Co-authored-by: girazoki <[email protected]>
Co-authored-by: nanocryk <[email protected]>
Co-authored-by: notlesh <[email protected]>
* Support 1700 new api-augment

* prettier
* Refactor xcm tests

* Test for SetError, SetAPpendix, ClaimAsset

* cleanup and doc

* `registerForeignAsset` helper

* Set correct weight and fix no-error test

* prettier

Co-authored-by: tgmichel <[email protected]>
* fixes try-runtime compilation
…ation#1692)

* fix tracing tests: 1000 loop require higher gas limit

* prettier
…on#1695)

* Read both delegator and collator migration storage

* prettier
)

* test substrate events after evm revert/success

* use proper constant

* increase gas price in test

* fix test

* fix BalanceLow error

* fix gasprice in test
* Add `EthereumXcmTransactionV2`

* Update existing ts tests to V2

* Add test for asset fees

* Move constants definition inside describe

* Explain nonce 1 after 2 ethereum-xcm transacts

* Clean tests

* descend from address helper fn
…ation#1700)

* remove deprecated parachain-staking items

* update tests to new style
@TarekkMA TarekkMA requested review from F3Joule and siman August 10, 2022 15:54
@F3Joule F3Joule changed the title Sync Moonbean Sync Moonbeam Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.