Skip to content

Commit

Permalink
Add light node mode (#1270)
Browse files Browse the repository at this point in the history
* Added types

* Renamed a file

* Changed asset- and waves balances structures

* Commented a function

* Changed addresses types

* Changed balanceAsset

* Added a constructor

* Added decimals to asset snapshot

* Changed uint8 to int8

* Added a field for asset reissuability

* Changed the type of total quantity

* removed the pointer

* Changed the type of orderID

* Make 'SnapshotManager' as an interface type.

* Replace 'proto.assetID' to 'crypto.Digest'.

* Replace 'proto.Address' to 'proto.WavesAddress'.

* Changed leaseID type

* changed types of leaseIn and leaseOut

* Removed the pointer types from AliasSnapshot

* Change a bit 'AtomicSnapshot' interface.

* Update snapshot types.

* Removed unnecessary fields in 'AccountScriptSnapshot' struct.

* Remove unnecessary types.

* Change 'StaticAssetInfoSnapshot.Issuer' field to 'StaticAssetInfoSnapshot.IssuerPublicKey'.

* Rename 'AssetReissuabilitySnapshot' to 'AssetVolumeSnapshot'.

* Add feature block reward distribution (#1082)

* add feature BlockRewardDistribution

* fix tests

* Improvement of the test on reward distribution to check that remainder of division goes to miner.

* refactor after rewiev

* fix feature info and add reward addresses in testnet and stagenet configs

* DAO and buyback addresses added for MainNet.
Formatting of settings files fixed.

---------

Co-authored-by: Alexey Kiselev <[email protected]>
Co-authored-by: Nikolay Eskov <[email protected]>

* change actions count with feature BlockRewardDistribution activated (#1088)

* change count actions with feature BlockRewardDistribution activated

* fix comment in script

* Merge fix.

* Fix version in comment

* Eth transaction refactoring and tests

---------

Co-authored-by: Alexey Kiselev <[email protected]>
Co-authored-by: Nikolay Eskov <[email protected]>

* Ride add rewards to block info (#1096)

* add feature BlockRewardDistribution

* fix tests

* Improvement of the test on reward distribution to check that remainder of division goes to miner.

* refactor after rewiev

* fix feature info and add reward addresses in testnet and stagenet configs

* change count actions with feature BlockRewardDistribution activated

* Ride version 7 added. Extended version of BlockInfo ride object added.
Ride types representation in objects stdlib description changed to simple string. Parsing of types added to code generation and updated in compiler.
Code generation updated to support Tuple types.

* Fixed code generation for RideV7. Fixed compilation of V7 scripts.
Added rewards structure and function to SmartState to get the block rewards.
Added test on script accessing new rewards field on BlockInfo.

* Fixed FunctionCall usage in tests

* Fixed sorting of rewards with stable sort.

* Script activation check added for RideV7.

* Code improvements

* Restored recursive check of list types in generated code.

* Generation of simplified code for tuple type checks.

* Duplicated tests removed

* Fixed lib version check in Ride compiler

---------

Co-authored-by: Anton Ilin <[email protected]>
Co-authored-by: Anton Ilin <[email protected]>

* Fix clear-text logging of sensitive information. (#1128)

* Bump golang.org/x/sync from 0.2.0 to 0.3.0 (#1129)

Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.2.0 to 0.3.0.
- [Commits](golang/sync@v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kiselev <[email protected]>

* Added 'LeaseStateStatus'. Changed types in 'LeaseStateSnapshot'.

* Rename 'LeaseStateStatus.Status' to 'LeaseStateStatus.Value'.

* Add methods to 'SnapshotManager' interface. Changed 'AtomicSnapshot' interface.

* Snapshot applier (#1145)

* Create marshal/unmarshal methods for 'leasing' structure in 'pkg/state'.

* WIP: rollbackable map.

* Return 'balanceProfile' and 'wavesBalanceRecord' by value.

* Started 'snapshotApplier.'

* Add apply methods for assets snapshot applying.

* Add 'snapshotApplier.applySponsorship' method.

* Add 'snapshotApplier.applyAccountScript' method.

* Refactor 'ordersVolumes'.

* Add 'snapshotApplier.applyFilledVolumeAndFee' method.

* Add 'snapshotApplier.applyDataEntry' method.

* Add 'snapshotApplier.applyLeaseState' method.

* Revert "WIP: rollbackable map."

This reverts commit cb34969.

* Created and used 'SnapshotApplierInfo' interface in 'state' package.

* Create 'SnapshotApplier' interface in 'state' package.

* Refactor 'SnapshotApplier' interface.

* Remove 'SnapshotApplierInfo' interface.

* Extracted 'snapshotApplierStorages'.

* Rename 'ApplyDataEntry' to 'ApplyDataEntries'.

* Replace 'SnapshotManager' to 'SnapshotApplier'.

* Node transaction snapshots (#1078)

* Added a conversion function

* Added payment transaction conversion

* Added transfer tx conversion

* Transfer tx conversion changed

* Added issue and reissue tx conversions

* Issue

* Issue, reissue, burn, exchange

* Hanled lease transactions

* Finished performers

* Added snapshots for all types of transactions

* Fixed types after merging

* Fixed issue snapshot mistake

* Added rewards snapshot in append block

* Changed functions to newest

* Added snapshots from actions

* Removed todos

* Deleted useless code

* Fixed a mistake with leasing cancel

* Added tests for issue and reissue transactions

* Fixed tests

* fixed implicit memory aliasing

* Added tests for burn, lease, lease cancel, exchange and create alias transactions

* Added tests for data, sponsorship, set account and asset script transactions

* Added a test for the invoke transaction snapshots

* Fixed after merge

* Fixed a function

* Moved snapshot generation

* Remove 'SnapshotManager' interface.

* Added a todo

* Refactored perfomerInfo

* Refactored performer info again

* Moved generation to snapshot generator

* Fixed some linter issues

* Added an asset atomic snapshot for issue transaction

* Replaced current recording to storage to snapshot applier

* Replaced to snapshot applier, except balances

* Fixed a comment

* Removed the comment

* Removed unnecessary code

* Returned the linter command back

* Replaced current recording to storage to snapshot applier (#1162)

* Replaced current recording to storage to snapshot applier

* Replaced to snapshot applier, except balances

* Fixed a comment

* Removed the comment

* Removed unnecessary code

* Returned the linter command back

* Revert "Replaced current recording to storage to snapshot applier (#1162)" (#1164)

This reverts commit 51904b2.

* Added asset script atomic snapshot to the issue script actions

* Fixed some linter issues

* Fixed a few more linter issues

* Fixed all linter issues

* Fixed err shadowing

* Fixed a mistake with issue counter

* removed a useless line

* Fixed applying order transactions

* Fixed applying order transactions

* Added lising snapshot to the tx diff generated group

* Moved complexity saving into transaction performer

* Moved complexity saving into transaction performer

* removed a line

* Fixed a bug with an empty sender

* Used error.Is

* Set an empty script for issue with sig

* add light node states

* add snapshot storage

* fix some linter issues

* move snapshots types to proto

* fix linter issues

* Fixed a bug with wrong action sender

* Fixed a bug with wrong action sender

* use vtproto

* Add 'TransactionStatusSnapshot'.

* Implemented 'AtomicSnapshot' interface for 'TransactionStatusSnapshot'.

* Changed 'AssetScriptSnapshot' and 'scriptStorageState.setAssetScript'.

Removed 'pk' arg from 'setAssetScript'.
Removed two fields from 'AssetScriptSnapshot':
- 'SenderPK'
- 'Complexity'

* * Commented invoke snapshots, import ok (#1165)

* Replaced current recording to storage to snapshot applier

* Replaced to snapshot applier, except balances

* Fixed a comment

* Removed the comment

* Removed unnecessary code

* Returned the linter command back

* Added asset script atomic snapshot to the issue script actions

* Fixed some linter issues

* Fixed a few more linter issues

* Fixed all linter issues

* Fixed err shadowing

* Fixed a mistake with issue counter

* removed a useless line

* Fixed applying order transactions

* Fixed applying order transactions

* Added lising snapshot to the tx diff generated group

* Moved complexity saving into transaction performer

* Moved complexity saving into transaction performer

* removed a line

* Fixed a bug with an empty sender

* Used error.Is

* Set an empty script for issue with sig

* move snapshots types to proto

* Fixed a bug with wrong action sender

* Fixed a bug with wrong action sender

* Add 'TransactionStatusSnapshot'.

* Implemented 'AtomicSnapshot' interface for 'TransactionStatusSnapshot'.

* Changed 'AssetScriptSnapshot' and 'scriptStorageState.setAssetScript'.

Removed 'pk' arg from 'setAssetScript'.
Removed two fields from 'AssetScriptSnapshot':
- 'SenderPK'
- 'Complexity'

* * Commented invoke snapshots, import ok

* moved setting complexity and set script to snapshot applier

* Fixed a test and a mistake

* Fixed renaming

* Fixed a comment

* Moved dapp complexity to applier

* Added dapp complexity to set script as well

* Fixed a check mistake

* Fixed a test

* removed empty script check

* removed a todo

* Removed useless code

* Modified a test

* Fixed same keys issue for data entry actions

* Remove invoke snapshot (#1235)

* moved complexity back

* Reverted some changes, import ok

* Returned account script and asset script txs, import ?

* Uncommented internal snapshot, import ok

* Fixed height problem with issue action and issue tx, import NO

* Issue action reverted

* Added log and issueCounter for issue action

* Commented invoke snapshots, import ok

---------

Co-authored-by: Nikolay Eskov <[email protected]>

---------

Co-authored-by: Anton Ilin <[email protected]>
Co-authored-by: Nikolay Eskov <[email protected]>

* Added asset script special snapshot

* Added internal snapshot for script for issue tx

* add tx status snapshot to proto func

* remove unnecessary changes

* fix test

* Separated internal tx snapshots.

* Reduced 'internalSnapshot' interface, removed unnecessary code.

* add new add block with snapshot

* add light node

* fix linter issue

* fix tests

* fix ng state

* fix some bugs

* Merge fix

* fix issues

* fix tests

* fix itests

* add add block with snpashots and new states for snapshots

* fix test

* Add snapshot hash check for 'txAppender.appendBlock'.

* Timeout tasks for wait snapshot states of FSM can be cancelled.

* remove copypasts

* Fixed bug in 'MicroBlockCache.GetSnapshot'.

* Add block snapshots as an optional return parameter for 'newBlocks.current'.

* move snapshot requests to defer

* Refactor a bit 'newBlocks.current'.

* Linter fixes.

* Remove irrelevant TODO.

* fix channel size for proto msgs

* Fix light node fee distribution (#1341)

* Fix TODO comment in 'snapshot_generator_internal_test.go'.

* Use 'error.As' in 'wrapErr' func according to the linter recommendation.

* Use 'errors.Is' according to the linter recommendation.

* Rename 'needToRecalc' variable to 'needToRecalculate'.

* Add 'default' case for 'switch' in 'txAppender.handleFallible'.

* Add TODO for 'txAppender.applySnapshotInLightNode'.

* Refactor 'newStateManager' function.

* Reuse 'currentBlockInfo' struct in 'applySnapshotInLightNode' and 'appendTxs' methods of 'txAppender'.

* Coun miner fee while processing transactions snapshots in 'txAppender.applySnapshotInLightNode'.

* Count miner fees after transactions processing.

* Fix mistake with wrapping wrong error variable while calculating miner's fees.

* Count miner tx fee after tx application.

* Count miner tx fees in 'commitTxApplication'.

* fix other channel size

* fix state name

* Add 'cleanupBeforeTransition' deferred calls for 'WaitMicroSnapshotState' and 'WaitSnapshotState'.

* Simplified a bit 'syncSkipMessageList' for SYNC in full mode

* fix microBlockSnapshot state name

* initialize snapshot chache

* fix linter

* fix linters

* Add snapshots to importer (#1290)

* Added snapshots import to importer

* Added flags

* Added snapshots to importer

* Importer refactoring. Extracted blockReader and snapshotReader.
Linter errors fixed. Blockchain scheme fixed.

* Linter action version updated.

* Golangci-lint version updated to 1.55.2.

* Importer global refactoring.

* Use new min and max fucntions from Go 1.21.

* Unused newSnapshots type removed.

* Small style fix.
Additional check on data size while deserializing snapshots.

---------

Co-authored-by: Alexey Kiselev <[email protected]>

* Fix gosec issues.

* return to ng if failed to apply block/microblock

* add Score in WaitSnapshots States

* fix Score check func and reduce timeouts

* increse message max lenght and allow negative in/out in lease balance snapshot

* fix asset volume decode/encode

* fix linters

* move ask blockIDs

* fix linters

* Fix log records.

* Fix 'TestTxSnapshotHasher'.

* Add new testcase for 'TestTxSnapshotMarshalToPBAndUnmarshalFromPB'.

* Remove unnecessary closure from 'selectImporter' im 'cmd/importer/importer.go'.

* Optimized a bit 'BlockSnapshot.ToProtobuf'.

* Optimized a bit 'NGState.checkAndAppendMicroBlock'.

* Optimized a bit 'WaitMicroSnapshotState.checkAndAppendMicroBlock'.

* rewrite ApplyFromFile in importer and fix some issues

* Remove 'nolint' for 'ProtocolVersion' func.

* Add more logs in 'ApplyFromFile' func.

* Add sanity checks for 'ImportParams'.

* Properly handle error in 'processScoreAfterApplyingOrReturnToNG'.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: esuwu <[email protected]>
Co-authored-by: Nikolay Eskov <[email protected]>
Co-authored-by: Alexey Kiselev <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandr Dolgavin <[email protected]>
  • Loading branch information
6 people authored Apr 19, 2024
1 parent 85fc27e commit 9ed6753
Show file tree
Hide file tree
Showing 60 changed files with 3,111 additions and 758 deletions.
2 changes: 1 addition & 1 deletion cmd/chaincmp/chaincmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func run() error {
for i, u := range other {
u, err = checkAndUpdateURL(u)
if err != nil {
zap.S().Error("Incorrect reference's URL: %s", err.Error())
zap.S().Errorf("Incorrect reference's URL: %s", err.Error())
return errInvalidParameters
}
other[i] = u
Expand Down
5 changes: 3 additions & 2 deletions cmd/convert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"flag"
"os"

"github.com/wavesplatform/gowaves/pkg/proto"
"go.uber.org/zap"

"github.com/wavesplatform/gowaves/pkg/proto"
)

var (
Expand All @@ -28,7 +29,7 @@ func main() {
zap.S().Fatal("please, provide scheme-byte argument")
}
if len(*schemeByte) != 1 {
zap.S().Fatal("invalid scheme-byte argument %q", *schemeByte)
zap.S().Fatalf("invalid scheme-byte argument %q", *schemeByte)
}
scheme := []byte(*schemeByte)[0]
switch *command {
Expand Down
Loading

0 comments on commit 9ed6753

Please sign in to comment.